PR gold/12934
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-06-28 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12934
4 * target-select.cc (Target_selector::Target_selector): Add
5 emulation parameter. Change all callers.
6 (select_target_by_bfd_name): Rename from select_target_by_name.
7 Change all callers.
8 (select_target_by_emulation): New function.
9 (supported_emulation_names): New function.
10 * target-select.h (class Target_selector): Add emulation_ field.
11 Update declarations.
12 (Target_selector::recognize_by_bfd_name): Rename from
13 recognize_by_name. Change all callers.
14 (Target_selector::supported_bfd_names): Rename from
15 supported_names. Change all callers.
16 (Target_selector::recognize_by_emulation): New function.
17 (Target_selector::supported_emulations): New function.
18 (Target_selector::emulation): New function.
19 (Target_selector::do_recognize_by_bfd_name): Rename from
20 do_recognize_by_name. Change all callers.
21 (Target_selector::do_supported_bfd_names): Rename from
22 do_supported_names. Change all callers.
23 (Target_selector::do_recognize_by_emulation): New function.
24 (Target_selector::do_supported_emulations): New function.
25 (select_target_by_bfd_name): Change name in declaration.
26 (select_target_by_emulation): Declare.
27 (supported_emulation_names): Declare.
28 * parameters.cc (parameters_force_valid_target): Try to find
29 target based on emulation from -m option.
30 * options.h (class General_options): Change doc string for -m.
31 * options.cc (help): Print emulations.
32 (General_options::parse_V): Likewise.
33 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
34 Add emulation parameter. Change all callers.
35
36 2011-06-28 Ian Lance Taylor <iant@google.com>
37
38 * target.h (class Target): Add osabi_ field.
39 (Target::osabi): New function.
40 (Target::set_osabi): New function.
41 (Target::Target): Initialize osabi_.
42 (Target::do_adjust_elf_header): Make pure virtual.
43 (Sized_target::do_adjust_elf_header): Declare.
44 * target.cc (Sized_target::do_adjust_elf_header): New function.
45 (class Sized_target): Instantiate all versions.
46 * freebsd.h (class Target_freebsd): Remove.
47 (Target_selector_freebsd::do_recognize): Call set_osabi on
48 Target.
49 (Target_selector_freebsd::do_recognize_by_name): Likewise.
50 (Target_selector_freebsd::set_osabi): Remove.
51 * i386.cc (class Target_i386): Inherit from Sized_target rather
52 than Target_freebsd.
53 * x86_64.cc (class Target_x86_64): Likewise.
54
55 2011-06-28 Ian Lance Taylor <iant@google.com>
56
57 * target.h (Target::can_check_for_function_pointers): Rewrite.
58 Make non-virtual.
59 (Target::can_icf_inline_merge_sections): Likewise.
60 (Target::section_may_have_icf_unsafe_poineters): Likewise.
61 (Target::Target_info): Add can_icf_inline_merge_sections field.
62 (Target::do_can_check_for_function_pointers): New virtual
63 function.
64 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
65 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
66 from can_check_for_function_pointers, move in file.
67 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
68 section_may_have_icf_unsafe_poineters, move in file.
69 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
70 * i386.cc (Target_i386::do_can_check_for_function_pointers):
71 Rename from can_check_for_function_pointers, move in file.
72 (Target_i386::can_icf_inline_merge_sections): Remove.
73 (Target_i386::i386_info): Initialize
74 can_icf_inline_merge_sections.
75 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
76 Initialize can_icf_inline_merge_sections.
77 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
78 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
79 Rename from can_check_for_function_pointers, move in file.
80 (Target_x86_64::can_icf_inline_merge_sections): Remove.
81 (Target_x86_64::x86_64_info): Initialize
82 can_icf_inline_merge_sections.
83 * testsuite/testfile.cc (Target_test::test_target_info):
84 Likewise.
85 * icf.cc (get_section_contents): Correct formatting.
86
87 2011-06-27 Ian Lance Taylor <iant@google.com>
88
89 * symtab.cc (Symbol::versioned_name): New function.
90 (Symbol_table::add_to_final_symtab): Use versioned_name when
91 appropriate.
92 (Symbol_table::sized_write_symbol): Likewise.
93 * symtab.h (class Symbol): Declare versioned_name.
94 * stringpool.h (class Stringpool_template): Add variant of add
95 which takes a std::basic_string.
96 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
97 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
98 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
99 (ver_test_12.o): New target.
100 * testsuite/Makefile.in: Rebuild.
101
102 2011-06-27 Doug Kwan <dougkwan@google.com>
103
104 * arm.cc (Arm_relocate_functions::thm_jump8,
105 Arm_relocate_functions::thm_jump11): Use a wider signed
106 type to compute offset.
107 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
108 arm_thm_jump8.
109 * testsuite/Makefile.in: Regenerate.
110 * testsuite/arm_branch_in_range.sh: Check test results of
111 arm_thm_jump11 and arm_thm_jump8.
112 * testsuite/arm_thm_jump11.s: New test source file.
113 * testsuite/arm_thm_jump11.t: New linker script.
114 * testsuite/arm_thm_jump8.s: New test source file.
115 * testsuite/arm_thm_jump8.t: New linker script.
116
117 2011-06-24 Ian Lance Taylor <iant@google.com>
118
119 * layout.cc: Include "object.h".
120 (ctors_sections_in_init_array): New static variable.
121 (Layout::is_ctors_in_init_array): New function.
122 (Layout::layout): Add entry to ctors_sections_in_init_array if
123 appropriate.
124 * layout.h (class Layout): Declare is_ctors_in_init_array.
125 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
126 is_ctors_reverse_view is set.
127 (Sized_relobj_file::write_sections): Add layout parameter. Change
128 all callers. Set is_ctors_reverse_view field of View_size.
129 (Sized_relobj_file::reverse_words): New function.
130 * object.h (Sized_relobj_file::View_size): Add
131 is_ctors_reverse_view field.
132 (class Sized_relobj_file): Update declarations.
133 * testsuite/initpri3.c: New test.
134 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
135 initpri3b.
136 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
137 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
138 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
139 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
140 * testsuite/Makefile.in: Rebuild.
141
142 2011-06-24 Cary Coutant <ccoutant@google.com>
143
144 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
145 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
146 (debug_msg_cdebug.err): New targets.
147 * testsuite/Makefile.in: Regenerate.
148 * testsuite/debug_msg.sh: Check output of link with compressed debug.
149 Fix checks for link with shared library.
150
151 2011-06-24 Doug Kwan <dougkwan@google.com>
152
153 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
154 skip empty text sections.
155 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
156
157 2011-06-22 Ian Lance Taylor <iant@google.com>
158
159 PR gold/12910
160 * options.h (class General_options): Add --ctors-in-init-array.
161 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
162 friends as SHT_PROGBITS for merging sections.
163 (Layout::layout): Remove special handling of .init_array and
164 friends. Don't sort if doing relocatable link. Sort for .ctors
165 and .dtors if ctors_in_init_array.
166 (Layout::make_output_section): Force correct section types for
167 .init_array and friends. Don't sort if doing relocatable link,
168 Don't sort .ctors and .dtors if ctors_in_init_array.
169 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
170 (Layout::output_section_name): Add relobj parameter. Change all
171 callers. Handle .ctors. and .dtors. in code rather than table.
172 Handle .ctors and .dtors if ctors_in_init_array.
173 (Layout::match_file_name): New function, moved from output.cc.
174 * layout.h (class Layout): Update declarations.
175 * output.cc: Include "layout.h".
176 (Input_section_sort_entry::get_priority): New function.
177 (Input_section_sort_entry::match_file_name): Just call
178 Layout::match_file_name.
179 (Output_section::Input_section_sort_init_fini_compare::operator()):
180 Handle .ctors and .dtors. Sort by explicit priority rather than
181 by name.
182 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
183 * testsuite/initpri2.c: New test.
184 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
185 (check_PROGRAMS): Add initpri2.
186 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
187 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
188 * configure, testsuite/Makefile.in: Rebuild.
189
190 2011-06-19 Ian Lance Taylor <iant@google.com>
191
192 PR gold/12880
193 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
194 .interp section to a PT_INTERP segment even if we have seen a
195 --dynamic-linker option. Don't do it if we have seen a PHDRS
196 clause in a linker script.
197 (Layout::finalize): Don't create a .interp section if we've
198 already create a PT_INTERP segment.
199 (Layout::create_interp): Always call choose_output_section (revert
200 patch of 2011-06-17). Don't create PT_INTERP segment.
201 * script-sections.cc
202 (Script_sections::create_note_and_tls_segments): Add a .interp
203 section to a PT_INTERP segment even if we have seen a
204 --dynamic-linker option.
205
206 2011-06-18 Ian Lance Taylor <iant@google.com>
207
208 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
209 merely because a non-PT_LOAD segment has a dynamic reloc.
210
211 2011-06-18 Ian Lance Taylor <iant@google.com>
212
213 * layout.cc (Layout::finish_dynamic_section): Don't create
214 DT_FLAGS entry if not needed.
215
216 2011-06-18 Ian Lance Taylor <iant@google.com>
217
218 PR gold/12745
219 * layout.cc (Layout::layout_eh_frame): Correct handling of
220 writable .eh_frame section.
221
222 2011-06-17 Ian Lance Taylor <iant@google.com>
223
224 PR gold/12893
225 * resolve.cc (Symbol_table::resolve): Don't give an error if a
226 symbol is redefined with the exact same object and value.
227
228 2011-06-17 Ian Lance Taylor <iant@google.com>
229
230 PR gold/12880
231 * layout.h (class Layout): Add interp_segment_ field.
232 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
233 (Layout::attach_allocated_section_to_segment): If making shared
234 library, put .interp section in PT_INTERP segment.
235 (Layout::finalize): Also call create_interp if -dynamic-linker
236 option was used.
237 (Layout::create_interp): Assert that there is no PT_INTERP
238 segment. If not using a SECTIONS clause, use make_output_section.
239 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
240 * script-sections.cc
241 (Script_sections::create_note_and_tls_segments): If making shared
242 library, put .interp section in PT_INTERP segment.
243
244 2011-06-17 Ian Lance Taylor <iant@google.com>
245
246 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
247 when making a shared library.
248
249 2011-06-17 Ian Lance Taylor <iant@google.com>
250
251 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
252 parameter. Change all callers. Don't issue warning about PC32
253 against locally defined symbol.
254
255 2011-06-16 Ian Lance Taylor <iant@google.com>
256
257 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
258 occurs in same object.
259
260 2011-06-14 Alan Modra <amodra@gmail.com>
261
262 * po/POTFILES.in: Regenerate.
263
264 2011-06-09 Ian Lance Taylor <iant@google.com>
265
266 * script-sections.cc
267 (Orphan_output_section::set_section_addresses): For a relocatable
268 link set address to 0.
269
270 2011-06-09 Cary Coutant <ccoutant@google.com>
271
272 PR gold/12804
273 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
274 used with --compress-debug-sections.
275 * gold/object.cc (Sized_relobj_file::do_layout): Report
276 uncompressed size of compressed input sections.
277
278 2011-06-08 Cary Coutant <ccoutant@google.com>
279
280 PR gold/12804
281 * testsuite/two_file_test_2_v1.cc: Change initialization of
282 v2 to keep it in .data.
283
284 2011-06-07 Cary Coutant <ccoutant@google.com>
285
286 * common.cc (Symbol_table::do_allocate_commons_list): Call
287 gold_fallback.
288 * errors.cc (Errors::fatal): Adjust call to gold_exit.
289 (Errors::fallback): New function.
290 (gold_fallback): New function.
291 * errors.h (Errors::fallback): New function.
292 * gold.cc (gold_exit): Change status parameter to enum; adjust
293 all callers.
294 (queue_initial_tasks): Call gold_fallback.
295 * gold.h: Include cstdlib.
296 (Exit_status): New enum type.
297 (gold_exit): Change status parameter to enum.
298 (gold_fallback): New function.
299 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
300 (Layout::create_symtab_sections): Likewise.
301 (Layout::create_shdrs): Likewise.
302 * main.cc (main): Adjust call to gold_exit.
303 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
304 (Output_data_got::add_got_entry_pair): Likewise.
305 (Output_section::add_input_section): Likewise.
306 (Output_section::add_output_section_data): Likewise.
307 (Output_segment::set_section_list_addresses): Likewise.
308 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
309
310 2011-06-07 Cary Coutant <ccoutant@google.com>
311
312 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
313 for incremental links.
314 * output.cc (Output_segment::set_section_list_addresses): Remove
315 FIXME and test for TLS or BSS.
316
317 2011-06-07 Cary Coutant <ccoutant@google.com>
318
319 * testsuite/Makefile.am: Add incremental_copy_test,
320 incremental_common_test_1.
321 * testsuite/Makefile.in: Regenerate.
322 * testsuite/common_test_1_v1.c: New source file.
323 * testsuite/common_test_1_v2.c: New source file.
324 * testsuite/copy_test_v1.cc: New source file.
325
326 2011-06-07 Cary Coutant <ccoutant@google.com>
327
328 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
329 update, allocate common from bss section's free list.
330 * incremental-dump.cc (dump_incremental_inputs): Print flag for
331 linker-defined symbols.
332 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
333 Skip GOT and PLT entries that are no longer referenced.
334 (Output_section_incremental_inputs::write_info_blocks): Mark
335 linker-defined symbols.
336 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
337 * output.cc (Output_section::allocate): New function.
338 * output.h (Output_section::allocate): New function.
339 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
340 linker-defined symbols.
341 (Symbol::override_base_with_special): Copy is_predefined_ flag.
342 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
343 (Symbol::init_base_output_data): Likewise.
344 (Symbol::init_base_output_segment): Likewise.
345 (Symbol::init_base_constant): Likewise.
346 (Sized_symbol::init_output_data): Likewise.
347 (Sized_symbol::init_output_segment): Likewise.
348 (Sized_symbol::init_constant): Likewise.
349 (Symbol_table::do_define_in_output_data): Likewise.
350 (Symbol_table::do_define_in_output_segment): Likewise.
351 (Symbol_table::do_define_as_constant): Likewise.
352 * symtab.h (Symbol::is_predefined): New function.
353 (Symbol::init_base_output_data): Add is_predefined parameter.
354 (Symbol::init_base_output_segment): Likewise.
355 (Symbol::init_base_constant): Likewise.
356 (Symbol::is_predefined_): New data member.
357 (Sized_symbol::init_output_data): Add is_predefined parameter.
358 (Sized_symbol::init_output_segment): Likewise.
359 (Sized_symbol::init_constant): Likewise.
360 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
361
362 2011-06-07 Cary Coutant <ccoutant@google.com>
363
364 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
365 instead of emit_copy_reloc.
366 (Copy_relocs::emit_copy_reloc): Refactor.
367 (Copy_relocs::make_copy_reloc): New function.
368 (Copy_relocs::add_copy_reloc): Remove.
369 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
370 section.
371 (Copy_relocs::make_copy_reloc): New function.
372 (Copy_relocs::add_copy_reloc): Remove.
373 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
374 unchanged input files.
375 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
376 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
377 Reserve BSS space for COPY relocations.
378 (Sized_incremental_binary::do_emit_copy_relocs): New function.
379 (Output_section_incremental_inputs::write_info_blocks): Record
380 whether a symbol is copied from a shared object.
381 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
382 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
383 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
384 (Incremental_input_entry_reader::get_output_symbol_index): Add
385 is_copy parameter.
386 (Incremental_binary::emit_copy_relocs): New function.
387 (Incremental_binary::do_emit_copy_relocs): New function.
388 (Sized_incremental_binary::Sized_incremental_binary): Initialize
389 new data member.
390 (Sized_incremental_binary::add_copy_reloc): New function.
391 (Sized_incremental_binary::do_emit_copy_relocs): New function.
392 (Sized_incremental_binary::Copy_reloc): New struct.
393 (Sized_incremental_binary::Copy_relocs): New typedef.
394 (Sized_incremental_binary::copy_relocs_): New data member.
395 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
396 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
397 * target.h (Sized_target::emit_copy_reloc): New function.
398 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
399
400 2011-06-02 Cary Coutant <ccoutant@google.com>
401
402 PR gold/12163
403 * gold/archive.cc (Archive::Archive): Initialize new data member.
404 (Archive::include_all_members): Return if archive has already been
405 included.
406 * gold/archive.h (Archive::include_all_members_): New data member.
407
408 2011-06-02 Nick Clifton <nickc@redhat.com>
409
410 * dynobj.h: Fix spelling mistake in comment.
411 * output.cc: Likewise.
412
413 2011-05-31 Doug Kwan <dougkwan@google.com>
414 Asier Llano
415
416 PR gold/12826
417 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
418 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
419 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
420 redundant arm_exidx_test.so.
421 * testsuite/Makefile.in: Regenerate.
422 (check_SCRIPTS): Add pr12826.sh
423 (check_DATA): Add pr12826.stdout
424 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
425 * testsuite/pr12826.sh: New file.
426 * testsuite/pr12826_1.s: Ditto.
427 * testsuite/pr12826_1.s: Ditto.
428
429 2011-05-30 Ian Lance Taylor <iant@google.com>
430
431 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
432 sections.
433
434 2011-05-29 Ian Lance Taylor <iant@google.com>
435
436 PR gold/12804
437 * testsuite/Makefile.am: Use different file name for two_file_test
438 temporary file for each incremental test.
439 * testsuite/Makefile.in: Rebuild.
440
441 2011-05-29 Ian Lance Taylor <iant@google.com>
442
443 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
444 binary input file is empty.
445
446 2011-05-27 Ian Lance Taylor <iant@google.com>
447
448 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
449 (ver_test_9.so): Likewise.
450 * testsuite/Makefile.in: Rebuild.
451
452 2011-05-26 Cary Coutant <ccoutant@google.com>
453
454 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
455 * incremental.cc (Incremental_inputs::report_input_section): Fix
456 comment, indentation.
457 (Incremental_inputs::report_comdat_group): New function.
458 (Output_section_incremental_inputs::set_final_data_size): Adjust size
459 of data for incremental input file entry.
460 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
461 group count, COMDAT group signatures.
462 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
463 an unchanged input file.
464 * incremental.h (Incremental_object_entry::Incremental_object_entry):
465 Initialize new data member.
466 (Incremental_object_entry::add_comdat_group): New function.
467 (Incremental_object_entry::get_comdat_group_count): New function.
468 (Incremental_object_entry::get_comdat_signature_key): New function.
469 (Incremental_object_entry::groups_): New data member.
470 (Incremental_inputs::report_comdat_group): New function.
471 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
472 data for incremental input file entry.
473 (Incremental_input_entry_reader::get_comdat_group_count): New function.
474 (Incremental_input_entry_reader::get_input_section): Adjust size of
475 data for incremental input file entry.
476 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
477 (Incremental_input_entry_reader::get_comdat_group_signature): New
478 function.
479 * object.cc (Sized_relobj::include_section_group): Report kept
480 COMDAT groups for incremental links.
481
482 2011-05-24 David Meyer <pdox@google.com>
483
484 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
485 with name parameter. Add found_name parameter.
486 * fileread.cc (Input_file::find_file): Adjust code accordingly.
487 * dirsearch.h (class Dirsearch): Update declaration.
488
489 2011-05-24 Ian Lance Taylor <iant@google.com>
490
491 * archive.cc (Library_base::should_include_member): Pull in object
492 from archive if it defines the entry symbol.
493 * parameters.cc (Parameters::entry): New function.
494 * parameters.h (class Parameters): Declare entry.
495 * output.h (class Output_file_header): Remove entry_ field.
496 * output.cc (Output_file_header::Output_file_header): Remove entry
497 parameter. Change all callers.
498 (Output_file_header::entry): Use parameters->entry.
499 * gold.cc (queue_middle_tasks): Likewise.
500 * plugin.cc (Plugin_hook::run): Likewise.
501
502 2011-05-24 Cary Coutant <ccoutant@google.com>
503
504 * gold.cc (queue_initial_tasks): Pass incremental base filename
505 to Output_file::open_base_file; don't print error message.
506 * incremental-dump.cc (main): Adjust call to
507 Output_file::open_for_modification.
508 * incremental-dump.cc (main): Likewise.
509 * incremental.cc (Incremental_inputs::report_command_line):
510 Ignore --incremental-base option when comparing command lines.
511 Ignore parameter when given as separate argument.
512 * options.h (class General_options): Add --incremental-base.
513 * output.cc (Output_file::Output_file):
514 (Output_file::open_base_file): Add base_name and writable parameters;
515 read base file into new file; print error message here.
516 (Output_file::map_no_anonymous): Add writable parameter; adjust all
517 callers.
518 * output.h (Output_file::open_for_modification): Rename to...
519 (Output_file::open_base_file): ...this; add base_name and
520 writable parameters; adjust all callers.
521 (Output_file::map_no_anonymous): Add writable parameter; adjust all
522 callers.
523 * testsuite/Makefile.am (incremental_test_4): Test
524 --incremental-base.
525 * testsuite/Makefile.in: Regenerate.
526
527 2011-05-24 Cary Coutant <ccoutant@google.com>
528
529 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
530 incremental_test_4.
531 * testsuite/Makefile.in: Regenerate.
532 * testsuite/two_file_test_1_v1.cc: New test source file.
533 * testsuite/two_file_test_1b_v1.cc: New test source file.
534 * testsuite/two_file_test_2_v1.cc: New test source file.
535
536 2011-05-24 Cary Coutant <ccoutant@google.com>
537
538 * dynobj.h (Dynobj::do_dynobj): New function.
539 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
540 flag and soname for shared objects.
541 * incremental.cc (Incremental_inputs::report_object): Make
542 either Incremental_object_entry or Incremental_dynobj_entry; add
543 soname to string table.
544 (Incremental_inputs::report_input_section): Add assertion.
545 (Output_section_incremental_inputs::set_final_data_size): Adjust
546 type of input file entry for shared libraries; adjust size of
547 shared library info entry.
548 (Output_section_incremental_inputs::write_input_files): Write
549 as_needed flag for shared libraries.
550 (Output_section_incremental_inputs::write_info_blocks): Adjust type
551 of input file entry for shared libraries; write soname.
552 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
553 soname from incremental info.
554 * incremental.h (enum Incremental_input_flags): Add
555 INCREMENTAL_INPUT_AS_NEEDED.
556 (Incremental_input_entry::Incremental_input_entry): Initialize new
557 data member.
558 (Incremental_input_entry::set_as_needed): New function.
559 (Incremental_input_entry::as_needed): New function.
560 (Incremental_input_entry::do_dynobj_entry): New function.
561 (Incremental_input_entry::as_needed_): New data member.
562 (Incremental_object_entry::Incremental_object_entry): Don't check
563 for shared library.
564 (Incremental_object_entry::do_type): Likewise.
565 (class Incremental_dynobj_entry): New class.
566 (Incremental_input_entry_reader::as_needed): New function.
567 (Incremental_input_entry_reader::get_soname): New function.
568 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
569 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
570 size of shared library info entry.
571 * layout.cc (Layout::finish_dynamic_section): Don't test for
572 incremental link when adding DT_NEEDED entries.
573 * object.h (Object::Object): Initialize new data member.
574 (Object::dynobj): New function.
575 (Object::set_as_needed): New function.
576 (Object::as_needed): New function.
577 (Object::do_dynobj): New function.
578 (Object::as_needed_): New data member.
579
580 2011-05-24 Cary Coutant <ccoutant@google.com>
581
582 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
583 info; adjust display of GOT entries.
584 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
585 vector of input objects; remove file_status_.
586 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
587 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
588 got_plt reader; call target hooks to reserve GOT entries.
589 (Output_section_incremental_inputs::set_final_data_size): Adjust size
590 of input file info header and GOT info entry.
591 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
592 relocation info.
593 (Got_plt_view_info::got_descriptor): Remove.
594 (Got_plt_view_info::sym_index): New data member.
595 (Got_plt_view_info::input_index): New data member.
596 (Local_got_offset_visitor::visit): Write input file index.
597 (Global_got_offset_visitor::visit): Write 0 for input file index.
598 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
599 with sym_index and input_index.
600 (Output_section_incremental_inputs::write_got_plt): Adjust size of
601 incremental info GOT entry; replace got_descriptor with input_index.
602 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
603 map from input file index to object.
604 (Sized_relobj_incr::do_layout): Replace direct data member reference
605 with accessor function.
606 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
607 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
608 Adjust size of input file info header.
609 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
610 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
611 (Incremental_input_entry_reader::get_input_section): Adjust size of
612 input file info header.
613 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
614 of incremental info GOT entry.
615 (Incremental_got_plt_reader::get_got_desc): Remove.
616 (Incremental_got_plt_reader::get_got_symndx): New function.
617 (Incremental_got_plt_reader::get_got_input_index): New function.
618 (Sized_incremental_binary::Sized_incremental_binary): Remove
619 file_status_; add input_objects_.
620 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
621 (Sized_incremental_binary::set_file_is_unchanged): Remove.
622 (Sized_incremental_binary::file_is_unchanged): Remove.
623 (Sized_incremental_binary::set_input_object): New function.
624 (Sized_incremental_binary::input_object): New function.
625 (Sized_incremental_binary::file_status_): Remove.
626 (Sized_incremental_binary::input_objects_): New data member.
627 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
628 references.
629 (Sized_relobj_incr::invalid_address): Move to base class.
630 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
631 class.
632 (Sized_relobj_incr::do_output_section_offset): Likewise.
633 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
634 (Sized_relobj_incr::section_offsets_): Likewise.
635 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
636 function.
637 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
638 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
639 with accessor function.
640 (Sized_relobj_file::do_layout): Likewise.
641 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
642 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
643 (Sized_relobj_file::compute_final_local_value): Replace refs to
644 section_offsets_ with accessor function.
645 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
646 * object.h (Relobj::Relobj): Initialize new data members.
647 (Relobj::add_dyn_reloc): New function.
648 (Relobj::first_dyn_reloc): New function.
649 (Relobj::dyn_reloc_count): New function.
650 (Relobj::first_dyn_reloc_): New data member.
651 (Relobj::dyn_reloc_count_): New data member.
652 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
653 references.
654 (Sized_relobj::Address): New typedef.
655 (Sized_relobj::invalid_address): Move here from child class.
656 (Sized_relobj::Sized_relobj): Initialize new data members.
657 (Sized_relobj::sized_relobj): New function.
658 (Sized_relobj::is_output_section_offset_invalid): Move here from
659 child class.
660 (Sized_relobj::get_output_section_offset): Likewise.
661 (Sized_relobj::local_has_got_offset): Likewise.
662 (Sized_relobj::local_got_offset): Likewise.
663 (Sized_relobj::set_local_got_offset): Likewise.
664 (Sized_relobj::do_for_all_local_got_entries): Likewise.
665 (Sized_relobj::clear_got_offsets): New function.
666 (Sized_relobj::section_offsets): Move here from child class.
667 (Sized_relobj::do_output_section_offset): Likewise.
668 (Sized_relobj::do_set_section_offset): Likewise.
669 (Sized_relobj::Local_got_offsets): Likewise.
670 (Sized_relobj::local_got_offsets_): Likewise.
671 (Sized_relobj::section_offsets_): Likewise.
672 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
673 references.
674 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
675 class.
676 (Sized_relobj_file::sized_relobj): New function
677 (Sized_relobj_file::local_has_got_offset): Move to base class.
678 (Sized_relobj_file::local_got_offset): Likewise.
679 (Sized_relobj_file::set_local_got_offset): Likewise.
680 (Sized_relobj_file::get_output_section_offset): Likewise.
681 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
682 (Sized_relobj_file::do_output_section_offset): Likewise.
683 (Sized_relobj_file::do_set_section_offset): Likewise.
684 (Sized_relobj_file::Local_got_offsets): Likewise.
685 (Sized_relobj_file::local_got_offsets_): Likewise.
686 (Sized_relobj_file::section_offsets_): Likewise.
687 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
688 (all constructors).
689 (set_needs_dynsym_index): Convert relobj to derived class pointer.
690 (Output_reloc::get_symbol_index): Likewise.
691 (Output_reloc::local_section_offset): Likewise.
692 (Output_reloc::get_address): Likewise.
693 (Output_reloc::symbol_value): Likewise.
694 (Output_data_got::reserve_slot): Move to class definition.
695 (Output_data_got::reserve_local): New function.
696 (Output_data_got::reserve_slot_for_global): Remove.
697 (Output_data_got::reserve_global): New function.
698 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
699 (all constructors, two instantiations).
700 (Output_reloc::get_relobj): New function (two instantiations).
701 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
702 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
703 (Output_data_reloc::add_global): Adjust type of relobj.
704 (Output_data_reloc::add_global_relative): Likewise.
705 (Output_data_reloc::add_symbolless_global_addend): Likewise.
706 (Output_data_reloc::add_local): Likewise.
707 (Output_data_reloc::add_local_relative): Likewise.
708 (Output_data_reloc::add_symbolless_local_addend): Likewise.
709 (Output_data_reloc::add_local_section): Likewise.
710 (Output_data_reloc::add_output_section): Likewise.
711 (Output_data_reloc::add_absolute): Likewise.
712 (Output_data_reloc::add_target_specific): Likewise.
713 (Output_data_got::reserve_slot): Move definition here.
714 (Output_data_got::reserve_local): New function.
715 (Output_data_got::reserve_global): New function.
716 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
717 section_offsets_ with accessor function.
718 (Sized_relobj_file::write_sections): Likewise.
719 (Sized_relobj_file::do_relocate_sections): Likewise.
720 * target.h (Sized_target::reserve_local_got_entry): New function.
721 (Sized_target::reserve_global_got_entry): New function.
722 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
723 (Target_x86_64::reserve_global_got_entry): New function.
724 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
725
726 2011-05-23 Cary Coutant <ccoutant@google.com>
727
728 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
729 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
730 bit when checking got_type.
731 * incremental.cc (Sized_incremental_binary::setup_readers):
732 Store symbol table and string table locations; initialize bit vector
733 of file status flags.
734 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
735 unchanged files.
736 (Sized_incremental_binary::do_process_got_plt): New function.
737 (Sized_incremental_binary::get_symtab_view): Use stored locations.
738 (Output_section_incremental_inputs::set_final_data_size): Record
739 file index for each input file.
740 (Output_section_incremental_inputs::write_got_plt): Store file index
741 instead of input entry offset for each GOT entry.
742 * incremental.h
743 (Incremental_input_entry::Incremental_input_entry): Initialize new
744 data member.
745 (Incremental_input_entry::set_offset): Store file index.
746 (Incremental_input_entry::get_file_index): New function.
747 (Incremental_input_entry::file_index_): New data member.
748 (Incremental_binary::process_got_plt): New function.
749 (Incremental_binary::do_process_got_plt): New function.
750 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
751 data members.
752 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
753 (Sized_incremental_binary::set_file_is_unchanged): New function.
754 (Sized_incremental_binary::file_is_unchanged): New function.
755 (Sized_incremental_binary::do_process_got_plt): New function.
756 (Sized_incremental_binary::file_status_): New data member.
757 (Sized_incremental_binary::main_symtab_loc_): New data member.
758 (Sized_incremental_binary::main_strtab_loc_): New data member.
759 * output.cc (Output_data_got::Got_entry::write): Add case
760 RESERVED_CODE.
761 (Output_data_got::add_global): Call add_got_entry.
762 (Output_data_got::add_global_plt): Likewise.
763 (Output_data_got::add_global_with_rel): Likewise.
764 (Output_data_got::add_global_with_rela): Likewise.
765 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
766 (Output_data_got::add_global_pair_with_rela): Likewise.
767 (Output_data_got::add_local): Call add_got_entry.
768 (Output_data_got::add_local_plt): Likewise.
769 (Output_data_got::add_local_with_rel): Likewise.
770 (Output_data_got::add_local_with_rela): Likewise.
771 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
772 (Output_data_got::add_local_pair_with_rela): Likewise.
773 (Output_data_got::reserve_slot): New function.
774 (Output_data_got::reserve_slot_for_global): New function.
775 (Output_data_got::add_got_entry): New function.
776 (Output_data_got::add_got_entry_pair): New function.
777 (Output_section::add_output_section_data): Edit FIXME.
778 * output.h
779 (Output_section_data_build::Output_section_data_build): New
780 constructor with size parameter.
781 (Output_data_space::Output_data_space): Likewise.
782 (Output_data_got::Output_data_got): Initialize new data member; new
783 constructor with size parameter.
784 (Output_data_got::add_constant): Call add_got_entry.
785 (Output_data_got::reserve_slot): New function.
786 (Output_data_got::reserve_slot_for_global): New function.
787 (class Output_data_got::Got_entry): Add RESERVED_CODE.
788 (Output_data_got::add_got_entry): New function.
789 (Output_data_got::add_got_entry_pair): New function.
790 (Output_data_got::free_list_): New data member.
791 * target.h (Sized_target::init_got_plt_for_update): New function.
792 (Sized_target::register_global_plt_entry): New function.
793 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
794 Initialize new data member; call init; add constructor with PLT count.
795 (Output_data_plt_x86_64::init): New function.
796 (Output_data_plt_x86_64::add_relocation): New function.
797 (Output_data_plt_x86_64::reserve_slot): New function.
798 (Output_data_plt_x86_64::free_list_): New data member.
799 (Target_x86_64::init_got_plt_for_update): New function.
800 (Target_x86_64::register_global_plt_entry): New function.
801 (Output_data_plt_x86_64::add_entry): Allocate from free list for
802 incremental updates.
803 (Output_data_plt_x86_64::add_relocation): New function.
804 * testsuite/object_unittest.cc (Object_test): Set default options.
805
806 2011-05-16 Ian Lance Taylor <iant@google.com>
807
808 * options.h (class General_options): Make -i a synonym for -r.
809
810 2011-05-16 Ian Lance Taylor <iant@google.com>
811
812 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
813
814 2011-05-10 Cary Coutant <ccoutant@google.com>
815
816 * object.cc (Sized_relobj::do_count_local_symbols): Check for
817 strip_all (-s).
818
819 2011-05-06 Ian Lance Taylor <iant@google.com>
820
821 * layout.cc (Layout::layout): If the output section flags change,
822 update the ordering.
823
824 2011-04-25 Cary Coutant <ccoutant@google.com>
825
826 * incremental-dump.cc (dump_incremental_inputs): Print local
827 symbol info for each input file.
828 * incremental.cc
829 (Output_section_incremental_inputs::set_final_data_size): Add local
830 symbol info to input file entries in incremental info.
831 (Output_section_incremental_inputs::write_info_blocks): Likewise.
832 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
833 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
834 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
835 implementation.
836 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
837 (Sized_incr_relobj::do_relocate): Write the local symbols.
838 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
839 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
840 Adjust size of input file header.
841 (Incremental_inputs_reader::get_local_symbol_offset): New function.
842 (Incremental_inputs_reader::get_local_symbol_count): New function.
843 (Incremental_inputs_reader::get_input_section): Adjust size of input
844 file header.
845 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
846 (Sized_incr_relobj::This): New typedef.
847 (Sized_incr_relobj::sym_size): New const data member.
848 (Sized_incr_relobj::Local_symbol): New struct.
849 (Sized_incr_relobj::do_output_local_symbol_count): New function.
850 (Sized_incr_relobj::do_local_symbol_offset): New function.
851 (Sized_incr_relobj::local_symbol_count_): New data member.
852 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
853 (Sized_incr_relobj::local_symbol_index_): New data member.
854 (Sized_incr_relobj::local_symbol_offset_): New data member.
855 (Sized_incr_relobj::local_dynsym_offset_): New data member.
856 (Sized_incr_relobj::local_symbols_): New data member.
857 * object.h (Relobj::output_local_symbol_count): New function.
858 (Relobj::local_symbol_offset): New function.
859 (Relobj::do_output_local_symbol_count): New function.
860 (Relobj::do_local_symbol_offset): New function.
861 (Sized_relobj::do_output_local_symbol_count): New function.
862 (Sized_relobj::do_local_symbol_offset): New function.
863
864 2011-04-22 Vladimir Simonov <sv@sw.ru>
865
866 * descriptors.cc (set_close_on_exec): New function.
867 (Descriptors::open): Use set_close_on_exec.
868 * output.cc (S_ISLNK): Define if not defined.
869
870 2011-04-22 Cary Coutant <ccoutant@google.com>
871
872 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
873 global symbol map.
874 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
875 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
876 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
877 relocations.
878 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
879 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
880 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
881 * incremental.h
882 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
883 function.
884 (Incremental_binary::apply_incremental_relocs): New function.
885 (Incremental_binary::do_apply_incremental_relocs): New function.
886 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
887 data member.
888 (Sized_incremental_binary::add_global_symbol): New function.
889 (Sized_incremental_binary::global_symbol): New function.
890 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
891 (Sized_incremental_binary::symbol_map_): New data member.
892 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
893 * target.h (Sized_target::apply_relocation): New function.
894 * target-reloc.h (apply_relocation): New function.
895 * x86_64.cc (Target_x86_64::apply_relocation): New function.
896
897 2011-04-22 Doug Kwan <dougkwan@google.com>
898
899 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
900 flag of a SHT_ARM_EXIDX section.
901 * testsuite/Makefile.am (arm_exidx_test): New test rules.
902 * testsuite/Makefile.in: Regenerate.
903 * testsuite/arm_exidx_test.s: New file.
904 * testsuite/arm_exidx_test.sh: Same.
905
906 2011-04-20 Cary Coutant <ccoutant@google.com>
907
908 PR gold/12689
909 * archive.h (Incremental_archive_entry::Archive_member):
910 Initialize arg_serial_ (second constructor).
911
912 2011-04-17 Ian Lance Taylor <iant@google.com>
913
914 * object.cc (Relocate_info::location): Simplify location string.
915 * errors.cc (Errors::error_at_location): Don't print program
916 name.
917 (Errors::warning_at_location): Likewise.
918 (Errors::undefined_symbol): Likewise.
919 * testsuite/debug_msg.sh: Update accordingly.
920
921 2011-04-14 Cary Coutant <ccoutant@google.com>
922
923 * gold/layout.cc (Layout::symtab_section_offset): New function.
924 * gold/layout.h (Layout::symtab_section_offset): New function.
925 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
926
927 2011-04-12 Ian Lance Taylor <iant@google.com>
928
929 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
930 with MREMAP_MAYMOVE.
931 * output.h (class Output_file): Add map_is_allocated_ field.
932 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
933 not available, provide stubs. If mremap is not available, #define
934 it to gold_mremap.
935 (MREMAP_MAYMOVE): Define if not defined.
936 (Output_file::Output_file): Initialize map_is_allocated_.
937 (Output_file::resize): Check map_is_allocated_.
938 (Output_file::map_anonymous): If mmap fails, use malloc.
939 (Output_file::unmap): Don't do anything for an anonymous map.
940 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
941 is not available, provide stubs.
942 (File_read::View::~View): Use free rather than delete[].
943 (File_read::make_view): Use malloc rather than new[]. If mmap
944 fails, use malloc.
945 (File_read::find_or_make_view): Use malloc rather than new[].
946 * gold.h: Remove HAVE_REMAP code.
947 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
948 exists. Rename mremap to gold_mremap. If mmap is not available
949 don't do anything.
950 * configure, config.in: Rebuild.
951
952 2011-04-11 Ian Lance Taylor <iant@google.com>
953
954 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
955 initialize local variable v.
956
957 2011-04-11 Cary Coutant <ccoutant@google.com>
958
959 * archive.cc (Archive::include_member): Adjust call to
960 report_object.
961 (Add_archive_symbols::run): Track argument serial numbers.
962 (Lib_group::include_member): Likewise.
963 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
964 * archive.h (Incremental_archive_entry::Archive_member):
965 Initialize arg_serial_.
966 (Archive_member::arg_serial_): New data member.
967 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
968 (Sized_dynobj::do_add_symbols): Track symbols when doing an
969 incremental link.
970 (Sized_dynobj::do_for_all_local_got_entries): New function.
971 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
972 function.
973 * fileread.cc (get_mtime): New function.
974 * fileread.h (get_mtime): New function.
975 * gold.cc (queue_initial_tasks): Check for incremental update.
976 (process_incremental_input): New function.
977 (queue_middle_tasks): Don't force valid target for incremental
978 update.
979 * incremental-dump.cc (find_input_containing_global): Adjust
980 size of symbol info entry.
981 (dump_incremental_inputs): Dump argument serial number and
982 in_system_directory flag; bias shndx by 1; print symbol names
983 when dumping per-file symbol lists; use new symbol info readers.
984 * incremental.cc
985 (Output_section_incremental_inputs:update_data_size): New function.
986 (Sized_incremental_binary::setup_readers): Setup input readers
987 for each input file; build maps for files added from libraries
988 and scripts.
989 (Sized_incremental_binary::check_input_args): New function.
990 (Sized_incremental_binary::do_check_inputs): Build map of argument
991 serial numbers to input arguments.
992 (Sized_incremental_binary::do_file_has_changed): Rename
993 do_file_is_unchanged to this; compare file modification times.
994 (Sized_incremental_binary::do_init_layout): New function.
995 (Sized_incremental_binary::do_reserve_layout): New function.
996 (Sized_incremental_binary::do_get_input_reader): Remove.
997 (Sized_incremental_binary::get_symtab_view): New function.
998 (Incremental_checker::can_incrementally_link_output_file): Remove.
999 (Incremental_inputs::report_command_line): Exclude --debug options.
1000 (Incremental_inputs::report_archive_begin): Add parameter; track
1001 argument serial numbers; don't put input file entry for archive
1002 before archive members.
1003 (Incremental_inputs::report_archive_end): Put input file entry
1004 for archive after archive members.
1005 (Incremental_inputs::report_object): Add parameter; track argument
1006 serial numbers and in_system_directory flag.
1007 (Incremental_inputs::report_script): Add parameter; track argument
1008 serial numbers.
1009 (Output_section_incremental_inputs::set_final_data_size): Adjust
1010 size of symbol info entry; check for forwarding symbols.
1011 (Output_section_incremental_inputs::write_input_files): Write
1012 in_system_directory flag and argument serial number.
1013 (Output_section_incremental_inputs::write_info_blocks): Map section
1014 indices between incremental info and original input file; store
1015 input section index for each symbol.
1016 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1017 change operator() to visit().
1018 (class Global_got_offset_visitor): Likewise.
1019 (class Global_symbol_visitor_got_plt):
1020 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1021 classes.
1022 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1023 (Sized_incr_relobj::do_read_symbols): New function.
1024 (Sized_incr_relobj::do_layout): New function.
1025 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1026 (Sized_incr_relobj::do_add_symbols): New function.
1027 (Sized_incr_relobj::do_should_include_member): New function.
1028 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1029 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1030 (Sized_incr_relobj::do_section_size): New function.
1031 (Sized_incr_relobj::do_section_name): New function.
1032 (Sized_incr_relobj::do_section_contents): New function.
1033 (Sized_incr_relobj::do_section_flags): New function.
1034 (Sized_incr_relobj::do_section_entsize): New function.
1035 (Sized_incr_relobj::do_section_address): New function.
1036 (Sized_incr_relobj::do_section_type): New function.
1037 (Sized_incr_relobj::do_section_link): New function.
1038 (Sized_incr_relobj::do_section_info): New function.
1039 (Sized_incr_relobj::do_section_addralign): New function.
1040 (Sized_incr_relobj::do_initialize_xindex): New function.
1041 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1042 (Sized_incr_relobj::do_read_relocs): New function.
1043 (Sized_incr_relobj::do_gc_process_relocs): New function.
1044 (Sized_incr_relobj::do_scan_relocs): New function.
1045 (Sized_incr_relobj::do_count_local_symbols): New function.
1046 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1047 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1048 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1049 (Sized_incr_relobj::do_relocate): New function.
1050 (Sized_incr_relobj::do_set_section_offset): New function.
1051 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1052 (Sized_incr_dynobj::do_read_symbols): New function.
1053 (Sized_incr_dynobj::do_layout): New function.
1054 (Sized_incr_dynobj::do_add_symbols): New function.
1055 (Sized_incr_dynobj::do_should_include_member): New function.
1056 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1057 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1058 (Sized_incr_dynobj::do_section_size): New function.
1059 (Sized_incr_dynobj::do_section_name): New function.
1060 (Sized_incr_dynobj::do_section_contents): New function.
1061 (Sized_incr_dynobj::do_section_flags): New function.
1062 (Sized_incr_dynobj::do_section_entsize): New function.
1063 (Sized_incr_dynobj::do_section_address): New function.
1064 (Sized_incr_dynobj::do_section_type): New function.
1065 (Sized_incr_dynobj::do_section_link): New function.
1066 (Sized_incr_dynobj::do_section_info): New function.
1067 (Sized_incr_dynobj::do_section_addralign): New function.
1068 (Sized_incr_dynobj::do_initialize_xindex): New function.
1069 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1070 (make_sized_incremental_object): New function.
1071 (Incremental_library::copy_unused_symbols): New function.
1072 (Incremental_library::do_for_all_unused_symbols): New function.
1073 * incremental.h (enum Incremental_input_flags): New type.
1074 (class Incremental_checker): Remove.
1075 (Incremental_input_entry::Incremental_input_entry): Add argument
1076 serial number.
1077 (Incremental_input_entry::arg_serial): New function.
1078 (Incremental_input_entry::set_is_in_system_directory): New function.
1079 (Incremental_input_entry::is_in_system_directory): New function.
1080 (Incremental_input_entry::arg_serial_): New data member.
1081 (Incremental_input_entry::is_in_system_directory_): New data member.
1082 (class Script_info): Move here from script.h.
1083 (Script_info::Script_info): Add filename parameter.
1084 (Script_info::filename): New function.
1085 (Script_info::filename_): New data member.
1086 (Incremental_script_entry::Incremental_script_entry): Add argument
1087 serial number.
1088 (Incremental_object_entry::Incremental_object_entry): Likewise.
1089 (Incremental_object_entry::add_input_section): Build list of input
1090 sections with map to original shndx.
1091 (Incremental_object_entry::get_input_section_index): New function.
1092 (Incremental_object_entry::shndx_): New data member.
1093 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1094 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1095 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1096 serial number.
1097 (Incremental_inputs::report_archive_begin): Likewise.
1098 (Incremental_inputs::report_object): Likewise.
1099 (Incremental_inputs::report_script): Likewise.
1100 (class Incremental_global_symbol_reader): New class.
1101 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1102 and store flags and input file type.
1103 (Incremental_input_entry_reader::arg_serial): New function.
1104 (Incremental_input_entry_reader::type): Extract type from flags.
1105 (Incremental_input_entry_reader::is_in_system_directory): New function.
1106 (Incremental_input_entry_reader::get_input_section_count): Call
1107 accessor function for type.
1108 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1109 function for type; adjust size of global symbol entry.
1110 (Incremental_input_entry_reader::get_global_symbol_count): Call
1111 accessor function for type.
1112 (Incremental_input_entry_reader::get_object_count): Likewise.
1113 (Incremental_input_entry_reader::get_object_offset): Likewise.
1114 (Incremental_input_entry_reader::get_member_count): Likewise.
1115 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1116 (Incremental_input_entry_reader::get_member_offset): Likewise.
1117 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1118 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1119 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1120 (Incremental_input_entry_reader::get_global_symbol_reader): New
1121 function.
1122 (Incremental_input_entry_reader::get_output_symbol_index): New
1123 function.
1124 (Incremental_input_entry_reader::type_): Remove.
1125 (Incremental_input_entry_reader::flags_): New data member.
1126 (Incremental_inputs_reader::input_file_offset): New function.
1127 (Incremental_inputs_reader::input_file_index): New function.
1128 (Incremental_inputs_reader::input_file): Call input_file_offset.
1129 (Incremental_inputs_reader::input_file_at_offset): New function.
1130 (Incremental_relocs_reader::get_r_type): Reformat.
1131 (Incremental_relocs_reader::get_r_shndx): Reformat.
1132 (Incremental_relocs_reader::get_r_offset): Reformat.
1133 (Incremental_relocs_reader::data): New function.
1134 (Incremental_binary::Incremental_binary): Initialize new data members.
1135 (Incremental_binary::check_inputs): Add cmdline parameter.
1136 (Incremental_binary::file_is_unchanged): Remove.
1137 (Input_reader::arg_serial): New function.
1138 (Input_reader::get_unused_symbol_count): New function.
1139 (Input_reader::get_unused_symbol): New function.
1140 (Input_reader::do_arg_serial): New function.
1141 (Input_reader::do_get_unused_symbol_count): New function.
1142 (Input_reader::do_get_unused_symbol): New function.
1143 (Incremental_binary::input_file_count): New function.
1144 (Incremental_binary::get_input_reader): Change signature to use
1145 index instead of filename.
1146 (Incremental_binary::file_has_changed): New function.
1147 (Incremental_binary::get_input_argument): New function.
1148 (Incremental_binary::get_library): New function.
1149 (Incremental_binary::get_script_info): New function.
1150 (Incremental_binary::init_layout): New function.
1151 (Incremental_binary::reserve_layout): New function.
1152 (Incremental_binary::output_file): New function.
1153 (Incremental_binary::do_check_inputs): New function.
1154 (Incremental_binary::do_file_is_unchanged): Remove.
1155 (Incremental_binary::do_file_has_changed): New function.
1156 (Incremental_binary::do_init_layout): New function.
1157 (Incremental_binary::do_reserve_layout): New function.
1158 (Incremental_binary::do_input_file_count): New function.
1159 (Incremental_binary::do_get_input_reader): Change signature.
1160 (Incremental_binary::input_args_map_): New data member.
1161 (Incremental_binary::library_map_): New data member.
1162 (Incremental_binary::script_map_): New data member.
1163 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1164 new data members.
1165 (Sized_incremental_binary::output_section): New function.
1166 (Sized_incremental_binary::inputs_reader): Add const.
1167 (Sized_incremental_binary::symtab_reader): Add const.
1168 (Sized_incremental_binary::relocs_reader): Add const.
1169 (Sized_incremental_binary::got_plt_reader): Add const.
1170 (Sized_incremental_binary::get_symtab_view): New function.
1171 (Sized_incremental_binary::Inputs_reader): New typedef.
1172 (Sized_incremental_binary::Input_entry_reader): New typedef.
1173 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1174 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1175 (Sized_incremental_binary::do_file_has_changed): New function.
1176 (Sized_incremental_binary::do_init_layout): New function.
1177 (Sized_incremental_binary::do_reserve_layout): New function.
1178 (Sized_input_reader::Inputs_reader): Remove.
1179 (Sized_input_reader::Input_entry_reader): Remove.
1180 (Sized_input_reader::do_arg_serial): New function.
1181 (Sized_input_reader::do_get_unused_symbol_count): New function.
1182 (Sized_input_reader::do_get_unused_symbol): New function.
1183 (Sized_incremental_binary::do_input_file_count): New function.
1184 (Sized_incremental_binary::do_get_input_reader): Change signature;
1185 use index instead of filename.
1186 (Sized_incremental_binary::section_map_): New data member.
1187 (Sized_incremental_binary::input_entry_readers_): New data member.
1188 (class Sized_incr_relobj): New class.
1189 (class Sized_incr_dynobj): New class.
1190 (make_sized_incremental_object): New function.
1191 (class Incremental_library): New class.
1192 * layout.cc (Free_list::num_lists): New static data member.
1193 (Free_list::num_nodes): New static data member.
1194 (Free_list::num_removes): New static data member.
1195 (Free_list::num_remove_visits): New static data member.
1196 (Free_list::num_allocates): New static data member.
1197 (Free_list::num_allocate_visits): New static data member.
1198 (Free_list::init): New function.
1199 (Free_list::remove): New function.
1200 (Free_list::allocate): New function.
1201 (Free_list::dump): New function.
1202 (Free_list::print_stats): New function.
1203 (Layout_task_runner::run): Resize output file for incremental updates.
1204 (Layout::Layout): Initialize new data members.
1205 (Layout::set_incremental_base): New function.
1206 (Layout::init_fixed_output_section): New function.
1207 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1208 incremental updates.
1209 (Layout::create_gold_note): Do not create gold note section for
1210 incremental updates.
1211 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1212 for incremental updates.
1213 (Layout::set_section_offsets): For incremental updates, allocate space
1214 from free list.
1215 (Layout::create_symtab_sections): Layout with offsets relative to
1216 start of section; for incremental updates, allocate space from free
1217 list.
1218 (Layout::create_shdrs): For incremental updates, allocate space from
1219 free list.
1220 (Layout::finish_dynamic_section): For incremental updates, do not
1221 check --as-needed (fixed in subsequent patch).
1222 * layout.h (class Free_list): New class.
1223 (Layout::set_incremental_base): New function.
1224 (Layout::incremental_base): New function.
1225 (Layout::init_fixed_output_section): New function.
1226 (Layout::allocate): New function.
1227 (Layout::incremental_base_): New data member.
1228 (Layout::free_list_): New data member.
1229 * main.cc (main): Print Free_list statistics.
1230 * object.cc (Relobj::finalize_incremental_relocs): Add
1231 clear_counts parameter; clear counts only when clear_counts is set.
1232 (Sized_relobj::Sized_relobj): Initialize new base class.
1233 (Sized_relobj::do_layout): Don't report special sections.
1234 (Sized_relobj::do_for_all_local_got_entries): New function.
1235 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1236 symtab_off to all symbol table offsets.
1237 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1238 * object.h (class Got_offset_list): Move to top of file.
1239 (Object::Object): Allow case where input_file == NULL.
1240 (Object::~Object): Likewise.
1241 (Object::input_file): Assert that input_file != NULL.
1242 (Object::lock): Allow case where input_file == NULL.
1243 (Object::unlock): Likewise.
1244 (Object::is_locked): Likewise.
1245 (Object::token): Likewise.
1246 (Object::release): Likewise.
1247 (Object::is_incremental): New function.
1248 (Object::get_mtime): New function.
1249 (Object::for_all_local_got_entries): New function.
1250 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1251 (Object::set_is_in_system_directory): New function.
1252 (Object::is_in_system_directory): New function.
1253 (Object::do_is_incremental): New function.
1254 (Object::do_get_mtime): New function.
1255 (Object::do_for_all_local_got_entries): New function.
1256 (Object::is_in_system_directory_): New data member.
1257 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1258 (class Sized_relobj_base): New class.
1259 (class Sized_relobj): Derive from Sized_relobj_base.
1260 (class Sized_relobj::Symbols): Redeclare from base class.
1261 (class Sized_relobj::local_got_offset_list): Remove.
1262 (class Sized_relobj::Output_sections): Redeclare from base class.
1263 (class Sized_relobj::do_for_all_local_got_entries): New function.
1264 (class Sized_relobj::write_local_symbols): Add offset parameter.
1265 (class Sized_relobj::local_symbol_offset_): Update comment.
1266 (class Sized_relobj::local_dynsym_offset_): Update comment.
1267 * options.cc (Input_arguments::add_file): Remove const.
1268 * options.h (Input_file_argument::Input_file_argument):
1269 Initialize arg_serial_ (all constructors).
1270 (Input_file_argument::set_arg_serial): New function.
1271 (Input_file_argument::arg_serial): New function.
1272 (Input_file_argument::arg_serial_): New data member.
1273 (Input_arguments::Input_arguments): Initialize file_count_.
1274 (Input_arguments::add_file): Remove const.
1275 (Input_arguments::number_of_input_files): New function.
1276 (Input_arguments::file_count_): New data member.
1277 (Command_line::number_of_input_files): Call
1278 Input_arguments::number_of_input_files.
1279 * output.cc (Output_segment_headers::Output_segment_headers):
1280 Set current size.
1281 (Output_section::Input_section::current_data_size): New function.
1282 (Output_section::Output_section): Initialize new data members.
1283 (Output_section::add_input_section): Don't do merge sections for
1284 an incremental link; allocate space from free list for an
1285 incremental update.
1286 (Output_section::add_output_section_data): Allocate space from
1287 free list for an incremental update.
1288 (Output_section::update_data_size): New function.
1289 (Output_section::set_fixed_layout): New function.
1290 (Output_section::reserve): New function.
1291 (Output_segment::set_section_addresses): Remove const.
1292 (Output_segment::set_section_list_addresses): Remove const; allocate
1293 space from free list for an incremental update.
1294 (Output_segment::set_offset): Adjust size of RELRO segment for an
1295 incremental update.
1296 * output.h (Output_data::current_data_size): Move here from
1297 child classes.
1298 (Output_data::pre_finalize_data_size): New function.
1299 (Output_data::update_data_size): New function.
1300 (Output_section_headers::update_data_size): new function.
1301 (Output_section_data_build::current_data_size): Move to Output_data.
1302 (Output_data_strtab::update_data_size): New function.
1303 (Output_section::current_data_size): Move to Output_data.
1304 (Output_section::set_fixed_layout): New function.
1305 (Output_section::has_fixed_layout): New function.
1306 (Output_section::reserve): New function.
1307 (Output_section::update_data_size): New function.
1308 (Output_section::has_fixed_layout_): New data member.
1309 (Output_section::free_list_): New data member.
1310 (Output_segment::set_section_addresses): Remove const.
1311 (Output_segment::set_section_list_addresses): Remove const.
1312 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1313 New function.
1314 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1315 New function.
1316 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1317 parameter when calling Add_symbols constructor; store argument
1318 serial number for members of a lib group.
1319 (Add_symbols::locks): Allow case where token == NULL.
1320 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1321 (Read_member::~Read_member): New function.
1322 (Read_member::is_runnable): New function.
1323 (Read_member::locks): New function.
1324 (Read_member::run): New function.
1325 (Check_script::~Check_script): New function.
1326 (Check_script::is_runnable): New function.
1327 (Check_script::locks): New function.
1328 (Check_script::run): New function.
1329 (Check_library::~Check_library): New function.
1330 (Check_library::is_runnable): New function.
1331 (Check_library::locks): New function.
1332 (Check_library::run): New function.
1333 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1334 (Add_symbols::library_): New data member.
1335 (class Read_member): New class.
1336 (class Check_script): New class.
1337 (class Check_library): New class.
1338 * reloc.cc (Read_relocs::is_runnable): Allow case where
1339 token == NULL.
1340 (Read_relocs::locks): Likewise.
1341 (Scan_relocs::locks): Likewise.
1342 (Relocate_task::locks): Likewise.
1343 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1344 to clear counters.
1345 (Sized_relobj::incremental_relocs_scan): Fix comment.
1346 (Sized_relobj::do_relocate): Pass output file offset to
1347 write_local_symbols.
1348 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1349 from class declaration.
1350 * script.cc (read_input_script): Allocate Script_info; pass
1351 argument serial number to report_script.
1352 * script.h (class Script_info): Move to incremental.h.
1353 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1354 * symtab.h (Symbol_table::add_from_incrobj): New function.
1355 (Symbol_table::set_file_offset): New function.
1356
1357 2011-04-05 Cary Coutant <ccoutant@google.com>
1358
1359 * incremental-dump.cc (dump_incremental_inputs): Change signature
1360 to take a Sized_incremental_binary; change caller. Use readers
1361 in Sized_incremental_binary.
1362 * incremental.cc
1363 (Sized_incremental_binary::find_incremental_inputs_sections):
1364 Rename do_find_incremental_inputs_sections to this.
1365 (Sized_incremental_binary::setup_readers): New function.
1366 (Sized_incremental_binary::do_check_inputs): Check
1367 has_incremental_info_ flag; move setup code to setup_readers;
1368 use input readers.
1369 (Sized_incremental_binary::do_file_is_unchanged): New function.
1370 (Sized_incremental_binary::do_get_input_reader): New function.
1371 * incremental.h (class Incremental_binary): Move to end of file.
1372 (Incremental_binary::file_is_unchanged): New function.
1373 (Incremental_binary::do_file_is_unchanged): New function.
1374 (Incremental_binary::Input_reader): New class.
1375 (Incremental_binary::get_input_reader): New function.
1376 (class Sized_incremental_binary): Move to end of file.
1377 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1378 input section reader classes.
1379 (Sized_incremental_binary::has_incremental_info): New function.
1380 (Sized_incremental_binary::inputs_reader): New function.
1381 (Sized_incremental_binary::symtab_reader): New function.
1382 (Sized_incremental_binary::relocs_reader): New function.
1383 (Sized_incremental_binary::got_plt_reader): New function.
1384 (Sized_incremental_binary::do_file_is_unchanged): New function.
1385 (Sized_incremental_binary::Sized_input_reader): New class.
1386 (Sized_incremental_binary::get_input_reader): New function.
1387 (Sized_incremental_binary::find_incremental_inputs_sections):
1388 Rename do_find_incremental_inputs_sections to this.
1389 (Sized_incremental_binary::setup_readers): New function.
1390 (Sized_incremental_binary::has_incremental_info_): New data member.
1391 (Sized_incremental_binary::inputs_reader_): New data member.
1392 (Sized_incremental_binary::symtab_reader_): New data member.
1393 (Sized_incremental_binary::relocs_reader_): New data member.
1394 (Sized_incremental_binary::got_plt_reader_): New data member.
1395 (Sized_incremental_binary::current_input_file_): New data member.
1396
1397 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1398
1399 PR gold/12640
1400 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1401 violation.
1402
1403 2011-03-30 Cary Coutant <ccoutant@google.com>
1404
1405 * archive.cc (Archive::include_member): Adjust call to report_object.
1406 (Add_archive_symbols::run): Add script_info to call to
1407 report_archive_begin.
1408 (Lib_group::include_member): Adjust call to report_object.
1409 (Add_lib_group_symbols::run): Adjust call to report_object.
1410 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1411 blocks. Add object count for script input files.
1412 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1413 script_info parameter; change all callers.
1414 (Incremental_inputs::report_object): Add script_info parameter;
1415 change all callers.
1416 (Incremental_inputs::report_script): Store backpointer to
1417 incremental info entry.
1418 (Output_section_incremental_inputs::set_final_data_size): Record
1419 additional information for scripts.
1420 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1421 * incremental.h (Incremental_script_entry::add_object): New function.
1422 (Incremental_script_entry::get_object_count): New function.
1423 (Incremental_script_entry::get_object): New function.
1424 (Incremental_script_entry::objects_): New data member; adjust
1425 constructor.
1426 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1427 (Incremental_inputs::report_object): Add script_info parameter.
1428 (Incremental_inputs_reader::get_object_count): New function.
1429 (Incremental_inputs_reader::get_object_offset): New function.
1430 * options.cc (Input_arguments::add_file): Return reference to
1431 new input argument.
1432 * options.h (Input_argument::set_script_info): New function.
1433 (Input_argument::script_info): New function.
1434 (Input_argument::script_info_): New data member; adjust all
1435 constructors.
1436 (Input_file_group::add_file): Return reference to new input argument.
1437 (Input_file_lib::add_file): Likewise.
1438 (Input_arguments::add_file): Likewise.
1439 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1440 * script.cc (Parser_closure::Parser_closure): Add script_info
1441 parameter; adjust all callers.
1442 (Parser_closure::script_info): New function.
1443 (Parser_closure::script_info_): New data member.
1444 (read_input_script): Report scripts earlier to incremental info.
1445 (script_add_file): Set script_info in Input_argument.
1446 (script_add_library): Likewise.
1447 * script.h (Script_options::Script_info): Rewrite class.
1448
1449 2011-03-29 Cary Coutant <ccoutant@google.com>
1450
1451 * archive.cc (Library_base::should_include_member): Move
1452 method here from class Archive.
1453 (Archive::Archive): Initialize base class.
1454 (Archive::should_include_member): Move to base class.
1455 (Archive::do_for_all_unused_symbols): New function.
1456 (Add_archive_symbols::run): Remove redundant access to
1457 incremental_inputs.
1458 (Lib_group::Lib_group): Initialize base class.
1459 (Lib_group::do_filename): New function.
1460 (Lib_group::include_member): Pass pointer to Lib_group to
1461 report_object.
1462 (Lib_group::do_for_all_unused_symbols): New function.
1463 (Add_lib_group_symbols::run): Report archive information for
1464 incremental links.
1465 * archive.h (class Library_base): New base class.
1466 (class Archive): Derive from Library_base.
1467 (Archive::filename): Move to base class.
1468 (Archive::set_incremental_info): Likewise.
1469 (Archive::incremental_info): Likewise.
1470 (Archive::Should_include): Likewise.
1471 (Archive::should_include_member): Likewise.
1472 (Archive::Armap_entry): Remove.
1473 (Archive::Unused_symbol_iterator): Remove.
1474 (Archive::unused_symbols_begin): Remove.
1475 (Archive::unused_symbols_end): Remove.
1476 (Archive::do_filename): New function.
1477 (Archive::do_get_mtime): New function.
1478 (Archive::do_for_all_unused_symbols): New function.
1479 (Archive::task_): Move to base class.
1480 (Archive::incremental_info_): Likewise.
1481 (class Lib_group): Derive from Library_base.
1482 (Lib_group::do_filename): New function.
1483 (Lib_group::do_get_mtime): New function.
1484 (Lib_group::do_for_all_unused_symbols): New function.
1485 (Lib_group::task_): Move to base class.
1486 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1487 function.
1488 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1489 function.
1490 * incremental.cc (Incremental_inputs::report_archive_begin):
1491 Use Library_base; call library's get_mtime; add incremental inputs
1492 entry before members.
1493 (class Unused_symbol_visitor): New class.
1494 (Incremental_inputs::report_archive_end): Use Library_base; use
1495 visitor class to record unused symbols; don't add incremental inputs
1496 entry after members.
1497 (Incremental_inputs::report_object): Use Library_base.
1498 * incremental.h
1499 (Incremental_archive_entry::Incremental_archive_entry): Remove
1500 unused Archive parameter.
1501 (Incremental_inputs::report_archive_begin): Use Library_base.
1502 (Incremental_inputs::report_archive_end): Likewise.
1503 (Incremental_inputs::report_object): Likewise.
1504 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1505 function.
1506 * object.h (Object::for_all_global_symbols): New function.
1507 (Object::do_for_all_global_symbols): New function.
1508 (Sized_relobj::do_for_all_global_symbols): New function.
1509 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1510 function.
1511 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1512 function.
1513
1514 2011-03-27 Ian Lance Taylor <iant@google.com>
1515
1516 * archive.cc (Archive::interpret_header): Return -1 if something
1517 goes wrong. Change callers accordingly.
1518
1519 2011-03-25 Cary Coutant <ccoutant@google.com>
1520
1521 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1522 * testsuite/Makefile.in: Regenerate.
1523
1524 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1525
1526 * plugin.cc (get_view): New.
1527 (Plugin::load): Pass get_view to the plugin.
1528 (Plugin_manager::get_view): New.
1529
1530 2011-03-21 Ian Lance Taylor <iant@google.com>
1531
1532 * testsuite/final_layout.sh: Rewrite to not use dc.
1533 * testsuite/relro_test.sh: Fail if dc is not present.
1534
1535 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1536
1537 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1538 Change == to -eq.
1539 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1540 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1541 Change == to -eq.
1542 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1543 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1544
1545 2011-03-14 Ian Lance Taylor <iant@google.com>
1546
1547 * script-sections.cc (Sort_output_sections::script_compare):
1548 Rename from is_before, change return type.
1549 (Sort_output_sections::operator()): Adjust accordingly.
1550
1551 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1552
1553 PR gold/12572
1554 * testsuite/odr_violation2.cc: Add comment to make all error line
1555 numbers double digits.
1556 * testsuite/debug_msg.sh: Adjust expected errors.
1557
1558 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1559
1560 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1561 but mark earlier ones as non-canonical
1562 (offset_to_iterator): Update search target and example
1563 (do_addr2line): Return extra lines in a vector*
1564 (format_file_lineno): Extract from do_addr2line
1565 (one_addr2line): Add vector* out-param
1566 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1567 when a lineno entry appeared last for its instruction
1568 (Dwarf_line_info): Add vector* out-param
1569 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1570 * symtab.cc (Odr_violation_compare): Include the lineno in the
1571 comparison again.
1572 (linenos_from_loc): New. Combine the canonical line for an
1573 address with its other lines.
1574 (True_if_intersect): New. Helper functor to make
1575 std::set_intersection a query.
1576 (detect_odr_violations): Compare sets of lines instead of just
1577 one line for each function. This became less deterministic, but
1578 has fewer false positives.
1579 * symtab.h: Declarations.
1580 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1581 mix an optimized and non-optimized object in the same binary
1582 (odr_violation2.so): Same.
1583 * testsuite/Makefile.in: Regenerate from Makefile.am.
1584 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1585 * testsuite/debug_msg.sh: Update line numbers and add
1586 assertions.
1587 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1588 non-optimized context.
1589 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1590 isn't inlined, and use OdrDerived in an optimized context.
1591 * testsuite/odr_header1.h: Defines OdrDerived, where
1592 optimization will change the
1593 first-instruction-in-the-destructor's file and line number.
1594 * testsuite/odr_header2.h: Defines OdrBase.
1595
1596 2011-03-09 Ian Lance Taylor <iant@google.com>
1597
1598 * fileread.cc (File_read::clear_views): Don't delete the whole
1599 file view.
1600
1601 2011-03-08 Ian Lance Taylor <iant@google.com>
1602
1603 PR gold/12525
1604 * fileread.cc: #include <climits>.
1605 (GOLD_IOV_MAX): Define.
1606 (File_read::read_multiple): Limit number of entries by iov_max.
1607 * fileread.h (class File_read): Always set max_readv_entries to
1608 128.
1609
1610 2011-03-07 Ian Lance Taylor <iant@google.com>
1611
1612 PR gold/12525
1613 * options.h (class General_options): Add -dy and -dn.
1614
1615 2011-03-02 Cary Coutant <ccoutant@google.com>
1616
1617 * testsuite/script_test_9.t: Add TLS segment.
1618
1619 2011-03-02 Simon Baldwin <simonb@google.com>
1620
1621 * configure.ac: Add check for gnu_indirect_function support in
1622 the toolchain building binutils.
1623 * configure: Rebuild.
1624
1625 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1626
1627 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1628 plugin only symbols.
1629 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1630 in plugin files as not needed in the symbol table.
1631
1632 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1633
1634 * output.cc (Output_section::add_input_section): Delay fill
1635 generation for section ordering.
1636
1637 2011-02-09 Ian Lance Taylor <iant@google.com>
1638
1639 PR gold/12316
1640 * object.h (class Sized_relobj): Remove clear_local_symbols.
1641 * reloc.cc (Sized_relobj::do_relocate): Don't call
1642 clear_local_symbols.
1643
1644 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1645
1646 * plugin.cc (is_visible_from_outside): Return true for symbols
1647 in the -u option.
1648
1649 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1650
1651 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1652 filename.
1653
1654 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1655
1656 * icf.h (is_section_foldable_candidate): Change type of parameter
1657 to std::string.
1658 * icf.cc (Icf::find_identical_sections): Change type of local variable
1659 section_name to be std::string.
1660 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1661
1662 2011-01-25 Ian Lance Taylor <iant@google.com>
1663
1664 * script.cc (script_add_extern): Rewrite to use
1665 add_symbol_reference.
1666
1667 2011-01-25 Doug Kwan <dougkwan@google.com>
1668
1669 * icf.cc (get_section_contents): Always lock section's object.
1670
1671 2011-01-24 Ian Lance Taylor <iant@google.com>
1672
1673 * options.h (class General_options): Accept
1674 --no-detect-odr-violations.
1675
1676 2011-01-24 Ian Lance Taylor <iant@google.com>
1677
1678 * version.cc (version_string): Bump to 1.11.
1679
1680 2011-01-24 Ian Lance Taylor <iant@google.com>
1681
1682 * plugin.cc (class Plugin_rescan): Define new class.
1683 (Plugin_manager::claim_file): Set any_claimed_.
1684 (Plugin_manager::save_archive): New function.
1685 (Plugin_manager::save_input_group): New function.
1686 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1687 necessary.
1688 (Plugin_manager::new_undefined_symbol): New function.
1689 (Plugin_manager::rescan): New function.
1690 (Plugin_manager::rescannable_defines): New function.
1691 (Plugin_manager::add_input_file): Set any_added_.
1692 * plugin.h (class Plugin_manager): define new fields rescannable_,
1693 undefined_symbols_, any_claimed_, and any_added_. Declare
1694 Plugin_rescan as friend. Declare new functions.
1695 (Plugin_manager::Rescannable): Define type.
1696 (Plugin_manager::Rescannable_list): Define type.
1697 (Plugin_manager::Undefined_symbol_list): Define type.
1698 (Plugin_manager::Plugin_manager): Initialize new fields.
1699 * archive.cc (Archive::defines_symbol): New function.
1700 (Add_archive_symbols::run): Pass archive to plugins if any.
1701 * archive.h (class Archive): Declare defines_symbol.
1702 * readsyms.cc (Input_group::~Input_group): New function.
1703 (Finish_group::run): Pass input_group to plugins if any.
1704 * readsyms.h (class Input_group): Declare destructor.
1705 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1706 any.
1707
1708 2011-01-10 Ian Lance Taylor <iant@google.com>
1709
1710 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1711 section as relro.
1712 (Layout::set_segment_offsets): Reset increase_relro before calling
1713 set_section_addresses a second time.
1714
1715 2011-01-04 Cary Coutant <ccoutant@google.com>
1716
1717 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1718 sections before NOBITS sections.
1719
1720 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1721
1722 * version.cc (print_version): Update copyright to 2011.
1723
1724 2010-12-23 Cary Coutant <ccoutant@google.com>
1725
1726 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1727 of OS to this->add. Add OD parameter to second form of the function.
1728
1729 2010-12-20 Ian Lance Taylor <iant@google.com>
1730
1731 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1732 second of two consecutive entries with same offset.
1733
1734 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1735
1736 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1737 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1738 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1739 to avoid unneeded links against $(LDADD).
1740 * testsuite/Makefile.in: Regenerate.
1741
1742 2010-12-15 Ian Lance Taylor <iant@google.com>
1743
1744 PR gold/12324
1745 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1746 for R_X86_64_32 and R_X86_64_PC32.
1747 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1748 ver_matching_def_pic.o.
1749 (ver_matching_def_pic.o): New target.
1750
1751 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1752
1753 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1754 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1755 Move definition before File_read::View member definitions.
1756 (File_read::View::~View): Initialize and hold lock before
1757 updating current_mapped_bytes.
1758
1759 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1760
1761 * dwarf_reader.cc: Remove outdated comment.
1762 * gold-threads.cc: Fix typo in error message.
1763 * archive.cc: Fix typos in comments.
1764 * archive.h: Likewise.
1765 * arm-reloc-property.cc: Likewise.
1766 * arm-reloc-property.h: Likewise.
1767 * arm-reloc.def: Likewise.
1768 * arm.cc: Likewise.
1769 * attributes.h: Likewise.
1770 * cref.cc: Likewise.
1771 * ehframe.cc: Likewise.
1772 * fileread.h: Likewise.
1773 * gold.h: Likewise.
1774 * i386.cc: Likewise.
1775 * icf.cc: Likewise.
1776 * incremental.h: Likewise.
1777 * int_encoding.cc: Likewise.
1778 * layout.h: Likewise.
1779 * main.cc: Likewise.
1780 * merge.h: Likewise.
1781 * object.cc: Likewise.
1782 * object.h: Likewise.
1783 * options.cc: Likewise.
1784 * readsyms.cc: Likewise.
1785 * reduced_debug_output.cc: Likewise.
1786 * reloc.cc: Likewise.
1787 * script-sections.cc: Likewise.
1788 * sparc.cc: Likewise.
1789 * symtab.h: Likewise.
1790 * target-reloc.h: Likewise.
1791 * target.cc: Likewise.
1792 * target.h: Likewise.
1793 * timer.cc: Likewise.
1794 * timer.h: Likewise.
1795 * x86_64.cc: Likewise.
1796
1797 2010-12-09 Cary Coutant <ccoutant@google.com>
1798
1799 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1800 stack.
1801 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1802 parameter; change all callers.
1803 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1804 * options.h (warn_execstack): New option.
1805
1806 2010-12-07 Doug Kwan <dougkwan@google.com>
1807
1808 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1809 like function call relocations.
1810
1811 2010-12-07 Ian Lance Taylor <iant@google.com>
1812
1813 * archive.cc (Archive::get_elf_object_for_member): Permit
1814 punconfigured to be NULL.
1815 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1816 (Archive::include_member): Pass NULL to get_elf_object_for_member
1817 if we searched for the archive and this is the first included
1818 object.
1819
1820 2010-12-01 Ian Lance Taylor <iant@google.com>
1821
1822 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1823 track_relocs_type_ field.
1824 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1825 Set track_relocs_type_.
1826 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1827 contents when using RELA relocs.
1828 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1829 reloc_map_.
1830 * reloc.cc (Track_relocs::next_addend): New function.
1831 * reloc.h (class Track_relocs): Declare next_addend.
1832
1833 2010-12-01 Ian Lance Taylor <iant@google.com>
1834
1835 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1836 virtual destructor.
1837
1838 2010-12-01 Ian Lance Taylor <iant@google.com>
1839
1840 * README: Update compilers known to work and fail.
1841
1842 2010-11-23 Matthias Klose <doko@ubuntu.com>
1843
1844 * configure.in: For --enable-gold, handle value `default' instead of
1845 `both*'. Always install ld as ld.bfd, install as ld if gold is
1846 not the default.
1847 * configure: Regenerate.
1848
1849 2010-11-18 Doug Kwan <dougkwan@google.com>
1850
1851 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1852 and right_alignment to be zero. Store result alignment only if it is
1853 greater than existing alignment.
1854
1855 2010-11-16 Cary Coutant <ccoutant@google.com>
1856
1857 PR gold/12220
1858 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1859 Check for ".zdebug_line".
1860
1861 2010-11-16 Doug Kwan <dougkwan@google.com>
1862 Cary Coutant <ccoutant@google.com>
1863
1864 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1865 by reference; adjust all callers.
1866 * output.cc (Output_segment::set_section_addresses): Adjust references
1867 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1868 list is empty.
1869 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1870 end at page boundary.
1871
1872 2010-11-16 Cary Coutant <ccoutant@google.com>
1873
1874 PR gold/12220
1875 * layout.cc (Layout::choose_output_section): Transform names of
1876 compressed sections even when using a script with a SECTIONS clause.
1877 (Layout::output_section_name): Remove code to transform
1878 compressed debug section names.
1879 * output.cc (Output_section::add_input_section): Use uncompressed
1880 section size when tracking input sections.
1881
1882 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1883
1884 * symtab.h (Symbol::NON_PIC_REF): Remove.
1885 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1886 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1887 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1888 (Symbol::use_plt_offset): Take a flags argument and pass it
1889 directly to needs_dynamic_reloc. Restrict check for undefined
1890 weak symbols to function calls.
1891 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1892 (Target_arm::Scan::global): Use it.
1893 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1894 (Target_arm::Relocate::relocate): Likewise.
1895 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1896 parameter with an r_type parameter. Use get_reference_flags
1897 to get the flags.
1898 (Target_arm::Relocate::relocate): Update accordingly.
1899 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1900 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1901 (Target_i386::Scan::global): Likewise.
1902 (Target_i386::Relocate::relocate): Likewise.
1903 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1904 parameter with an r_type parameter. Use get_reference_flags
1905 to get the flags.
1906 (Target_i386::Relocate::relocate): Update accordingly.
1907 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1908 (Target_powerpc::Scan::global): Use it.
1909 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1910 (Target_powerpc::Relocate::relocate): Likewise.
1911 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1912 (Target_sparc::Scan::global): Use it.
1913 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1914 (Target_sparc::Relocate::relocate): Likewise.
1915 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1916 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1917 (Target_x86_64::Scan::global): Likewise.
1918 (Target_x86_64::Relocate::relocate): Likewise.
1919
1920 2010-11-08 Doug Kwan <dougkwan@google.com>
1921 Cary Coutant <ccoutant@google.com>
1922
1923 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1924 (Arm_exidx_merge_section::section_contents_): New data member.
1925 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1926 (Arm_input_section::~Arm_input_section): De-allocate memory.
1927 (Arm_input_section::original_contents_): New data member.
1928 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1929 in parameters instead of calling Object::section_contents without
1930 locking.
1931 (Arm_output_section::group_section): New parameter TASK. Pass it
1932 to callees that need locking objects.
1933 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1934 to lock EXIDX input sections. Fix a formatting issue. Call
1935 Arm_exidx_merged_section::build_contents to create merged section
1936 contents.
1937 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1938 to lock object of stub table owner.
1939 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1940 TEXT_SIZE to initialize data member TEXT_SIZE_.
1941 (Arm_exidx_input_section::addralign): Fix typo in comment.
1942 (Arm_exidx_input_section::text_size): New method.
1943 (Target_arm::do_relax): New parameter TASK. Pass it to callees
1944 that require locking objects. Lock objects before scanning for stubs
1945 and updating local symbols.
1946 (Arm_input_section<big_endian>::init): Copy contents of original
1947 input section.
1948 (Arm_input_section<big_endian>::do_write): Use saved contents of
1949 original input section instead of calling Object::section_contents
1950 without locking.
1951 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
1952 size without calling Object::section_size().
1953 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
1954 for size. Allocate a buffer for merged EXIDX entries.
1955 (Arm_exidx_merged_section::build_contents): New method.
1956 (Arm_exidx_merged_section::do_write): Move merge section contents
1957 building code to Arm_exidx_merged_section::build_contetns. Write
1958 out contetns in buffer instead of building it on the fly.
1959 (Arm_relobj::make_exidx_input_section): Also pass text section size
1960 to Arm_exidx_input_section constructor.
1961 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
1962 (Arm_dynobj::do_read_symbols): Fix memory leak.
1963 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
1964 * target.h: (class Task): Add forward declaration.
1965 (Target::relax): Add new parameter TASK and pass it to
1966 Target::do_relax().
1967 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
1968
1969 2010-11-05 Cary Coutant <ccoutant@google.com>
1970
1971 PR gold/10708
1972 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
1973 object when reading from the file.
1974 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
1975 second layout pass.
1976 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
1977 when reading section contents.
1978 (get_section_contents): Likewise.
1979 (icf::find_identical_sections): Likewise.
1980 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
1981 object when reading from the file.
1982 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
1983 the object when doing deferred section layout.
1984
1985 2010-11-03 Nick Clifton <nickc@redhat.com>
1986
1987 PR gold/12001
1988 * script.h (class Symbol_assignment: name): New member. Returns
1989 the name of the symbol.
1990 * scrfipt.cc (Script_options::is_pending_assignment): New member.
1991 Returns true if the given symbol name is on the list of
1992 assignments wating to be processed.
1993 * archive.cc (should_incldue_member): If the symbol is undefined,
1994 check to see if it is on the list of symbols pending assignment.
1995
1996 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
1997
1998 * script-sections.cc (Script_sections::find_memory_region): Check
1999 for a NULL output section pointer.
2000
2001 2010-10-29 Doug Kwan <dougkwan@google.com>
2002
2003 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2004 Output_section::add_relaxed_input_section.
2005 * output.cc (Output_section::add_relaxed_input_section): Add new
2006 arguments LAYOUT and NAME. Set section order index.
2007 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2008 Copy section order index.
2009 * output.h (Output_section::add_relaxed_input_section): Add new
2010 arguments LAYOUT and NAME.
2011
2012 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2013
2014 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2015 NATIVE_OR_CROSS_LINKER.
2016 * testsuite/Makefile.in: Regenerate.
2017
2018 2010-10-20 Doug Kwan <dougkwan@google.com>
2019
2020 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2021 without SHF_LINK_ORDER flags.
2022 * layout.cc (Layout::choose_output_section): Do not filter
2023 SHF_LINK_ORDER flag in a relocatable link.
2024
2025 2010-10-17 Cary Coutant <ccoutant@google.com>
2026
2027 * output.h (Output_segment::set_section_addresses): Change function
2028 signature. Update all callers.
2029 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2030 sections.
2031 (Output_segment::set_section_addresses): Align after last TLS
2032 section. Add padding before last relro section instead of after.
2033
2034 2010-10-17 Doug Kwan <dougkwan@google.com>
2035
2036 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2037 GOT output section to be writable.
2038
2039 2010-10-14 Cary Coutant <ccoutant@google.com>
2040
2041 * debug.h (DEBUG_INCREMENTAL): New flag.
2042 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2043 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2044 mode.
2045 * incremental.cc (report_command_line): Ignore all forms of
2046 --incremental.
2047 * layout.cc (Layout::Layout): Check parameters for incremental link
2048 mode.
2049 * options.cc (General_options::parse_incremental): New function.
2050 (General_options::parse_no_incremental): New function.
2051 (General_options::parse_incremental_full): New function.
2052 (General_options::parse_incremental_update): New function.
2053 (General_options::incremental_mode_): New data member.
2054 (General_options::finalize): Check incremental_mode_.
2055 * options.h (General_options): Update help text for --incremental.
2056 Add --no-incremental, --incremental-full, --incremental-update.
2057 (General_options::Incremental_mode): New enum type.
2058 (General_options::incremental_mode): New function.
2059 (General_options::incremental_mode_): New data member.
2060 * parameters.cc (Parameters::incremental_mode_): New data member.
2061 (Parameters::set_options): Set incremental_mode_.
2062 (Parameters::set_incremental_full): New function.
2063 (Parameters::incremental): New function.
2064 (Parameters::incremental_update): New function.
2065 (set_parameters_incremental_full): New function.
2066 * parameters.h (Parameters::set_incremental_full): New function.
2067 (Parameters::incremental): New function.
2068 (Parameters::incremental_update): New function.
2069 (Parameters::incremental_mode_): New data member.
2070 (set_parameters_incremental_full): New function.
2071 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2072 incremental link mode.
2073 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2074 (Sized_relobj::do_relocate_sections): Likewise.
2075 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2076 option.
2077 * testsuite/Makefile.in: Regenerate.
2078 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2079
2080 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2081
2082 * script-sections.h (class Script_sections): Make
2083 Sections_elements typedef public.
2084 * script-sections.cc (class Sort_output_sections): Add elements_
2085 field. Add constructor which sets it; change all callers.
2086 (Sort_output_sections::is_before): New function.
2087 (Sort_output_sections::operator()): Call is_before.
2088 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2089 conditional.
2090 * testsuite/script_test_10.sh: New test. Test script section
2091 order.
2092 * testsuite/script_test_10.t: Likewise.
2093 * testsuite/script_test_10.s: Likewise.
2094 * testsuite/Makefile.am: Wrap the cross linker tests and the
2095 common tests into NATIVE_OR_CROSS_LINKER.
2096 (check_SCRIPTS): Add script_test_10.sh.
2097 (check_DATA): Add script_test_10.stdout.
2098 (script_test_10.o, script_test_10): New targets.
2099 (script_test_10.stdout): New target.
2100 * configure, testsuite/Makefile.in: Regenerate.
2101
2102 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2103
2104 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2105 error for the deprecated relocations.
2106 (Target_arm::Scan::global): Likewise.
2107 (Target_arm::Relocate::relocate): Likewise.
2108
2109 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2110
2111 * fileread.cc (Input_file::find_file): Initialize *found_name
2112 and *namep when using the fallback search for case 4.
2113
2114 2010-10-11 Cary Coutant <ccoutant@google.com>
2115
2116 * options.h (class General_options): Redefine -z lazy as an alias for
2117 the negation of -z now.
2118
2119 2010-10-11 Ian Lance Taylor <iant@google.com>
2120
2121 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2122 binding.
2123
2124 2010-10-06 Nick Clifton <nickc@redhat.com>
2125
2126 * script-sections.cc(class Memory_region): Remove
2127 current_lma_offset_ field. Rename current_vma_offset_ to
2128 current_offset_. Add last_section_ field.
2129 (Memory_region::get_current_vma_address): Rename to
2130 get_current_address.
2131 (Memory_region::get_current_lma_address): Delete.
2132 (Memory_region::increment_vma_offset): Rename to
2133 increment_offset.
2134 (Memory_region::increment_lma_offset): Delete.
2135 (Memory_region::attributes_compatible): New method. Returns
2136 true if the provided section is compatible with the region.
2137 (Memory_region::get_last_section): New method. Returns the last
2138 section to use the region.
2139 (Memory_region::set_last_section): New method. Stores the last
2140 section to use the region.
2141 (Script_sections::block_in_region): New method. Returns true if
2142 a block of memory is contained within a region.
2143 (Script_sections::find_memory_region): New method. Locates a
2144 memory region to be used to set a VMA or LMA address.
2145 (Output_section_definition::set_section_addresses): Add code to
2146 check for addresses set by memory regions.
2147 (Output_segment::set_section_addresses): Remove memory region
2148 walking code.
2149 (Script_sections::create_segment): Add a warning if a header
2150 segment is created outside of any region.
2151 * script-sections.h (class Script_sections): Add prototypes for
2152 find_memory_region and block_in_region methods.
2153 * testsuite/memory_test.s: Use .long instead of .word.
2154 * testsuite/memory_test.t: Add some more output sections.
2155 * testsuite/memory_test.sh: Update expected output.
2156
2157 2010-10-02 Doug Kwan <dougkwan@google.com>
2158
2159 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2160 defintion to symtab.h
2161 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2162 declaration to defintion.
2163
2164 2010-10-01 Nick Clifton <nickc@redhat.com>
2165
2166 * expression.cc (eval): Replace dummy argument with NULL.
2167 (eval_maybe_dot): Check for a NULL result section pointer.
2168 (Symbol_expression::value): Likewise.
2169 (Dot_expression::value): Likewise.
2170 (BINARY_EXPRESSION): Likewise.
2171 (Max_expression::value): Likewise.
2172 (Min_expression::value): Likewise.
2173 (Absolute_expression::value): Likewise.
2174 (Addr_expression::value_from_output_section): Likewise.
2175 (Loaddddr_expression::value_from_output_section): Likewise.
2176 (Segment_start_expression::value): Likewise.
2177 * script-sections.cc
2178 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2179 argument with NULL.
2180 (Sections_elememt_dot_assignment::set_section_addresses):
2181 Likewise.
2182 (Output_data_expression::do_write_to_buffer): Likewise.
2183 (Output_section_definition::finalize_symbols): Likewise.
2184 (Output_section_definition::set_section_addresses): Likewise.
2185
2186 2010-09-30 Doug Kwan <dougkwan@google.com>
2187
2188 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2189
2190 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2191
2192 * target.h (Target::can_icf_inline_merge_sections): New virtual
2193 function.
2194 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2195 virtual function.
2196 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2197 virtual function.
2198 * icf.cc (get_section_contents): Inline merge sections only when
2199 target allows it.
2200
2201 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2202
2203 * configure: Regenerate.
2204
2205 2010-09-17 Ian Lance Taylor <iant@google.com>
2206
2207 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2208 * testsuite/Makefile.am (memory_test.o): New target.
2209 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2210 memory_test.t.
2211 * testsuite/Makefile.in: Rebuild.
2212
2213 2010-09-17 Doug Kwan <dougkwan@google.com>
2214
2215 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2216 defintion if relocation uses GOT entries of the symbol.
2217 * testsuite/icf_safe_test.sh: Fix test.
2218 * testsuite/icf_safe_so_test.sh: Fix test.
2219
2220 2010-09-16 Cary Coutant <ccoutant@google.com>
2221
2222 * script_sections.cc (class Memory_region): Remove "NULL" from
2223 vector initializations.
2224
2225 2010-09-15 Cary Coutant <ccoutant@google.com>
2226
2227 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2228 Resolve forwarding symbols.
2229
2230 2010-09-15 Doug Kwan <dougkwan@google.com>
2231
2232 * gold/testsuite/script_test_3.t: Add ARM special sections.
2233 * gold/testsuite/script_test_4.t: Same.
2234 * gold/testsuite/script_test_5.t: Same.
2235 * gold/testsuite/script_test_6.t: Same.
2236 * gold/testsuite/script_test_7.t: Same.
2237 * gold/testsuite/script_test_7.t: Same.
2238 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2239
2240 2010-09-14 Cary Coutant <ccoutant@google.com>
2241
2242 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2243 (Target_x86_64::Relocate::relocate_tls): Replace check for
2244 saw_tls_block_reloc_ with test for executable section.
2245
2246 2010-09-12 Cary Coutant <ccoutant@google.com>
2247
2248 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2249 position-independent executables to shared libraries need dynamic
2250 relocations.
2251 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2252 position-independent executables.
2253 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2254 * testsuite/Makefile.in: Regenerate.
2255
2256 2010-09-10 Nick Clifton <nickc@redhat.com>
2257
2258 PR gold/11997
2259 * testsuite/memory_test.t: Discard any sections that are not
2260 needed.
2261
2262 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2263
2264 PR gold/11996
2265 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2266 "This::" to work around a bug in gcc 4.2.
2267
2268 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2269
2270 2010-09-09 Rafael Espindola <espindola@google.com>
2271
2272 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2273 sections with different PF_X flags in the same segment.
2274 (Layout::find_first_load_seg): Search all segments to find the first
2275 one.
2276 * options.h (rosegment): New.
2277
2278 2010-09-08 Rafael Espindola <espindola@google.com>
2279
2280 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2281
2282 2010-09-08 Doug Kwan <dougkwan@google.com>
2283
2284 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2285 (Arm_relobj::do_relocate_sections): Add new parameter for output
2286 file to match the parent.
2287 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2288 of local symbols instead of input values. Update code to track
2289 changes in gold::relocate_section.
2290 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2291 (Sized_relobj::compute_final_local_value_internal): New methods.
2292 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2293 body into private version of Sized_relobj::compute_final_local_value.
2294 Call the inline method.
2295 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2296 merged symbol value if there is one.
2297 (Symbol_value::has_output_value): New method defintiion.
2298 (Sized_relobj::Compute_final_local_value_status): New enum type.
2299 (Sized_relobj::compute_final_local_value): New methods.
2300 (Sized_relobj::compute_final_local_value_internal): New methods.
2301 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2302 and arm_cortex_a8.sh.
2303 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2304 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2305 New tests.
2306 * Makefile.in: Regenerate.
2307 * testsuite/arm_bl_out_of_range.s: Update test.
2308 * testsuite/thumb_bl_out_of_range.s: Ditto.
2309 * testsuite/thumb_blx_out_of_range.s: Ditto.
2310 * testsuite/arm_branch_out_of_range.sh: New file.
2311 * testsuite/arm_cortex_a8.sh: Ditto.
2312 * testsuite/arm_cortex_a8_b.s: Ditto.
2313 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2314 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2315 * testsuite/arm_cortex_a8_bl.s: Ditto.
2316 * testsuite/arm_cortex_a8_blx.s: Ditto.
2317 * testsuite/arm_cortex_a8_local.s: Ditto.
2318 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2319 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2320
2321 2010-09-08 Rafael Espindola <espindola@google.com>
2322
2323 * Makefile.am (memory_test.stdout): Run readelf with -W.
2324 * Makefile.in: Regenerate.
2325 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2326 64 bit output.
2327
2328 2010-09-08 Rafael Espindola <espindola@google.com>
2329
2330 * script-sections.cc (Script_sections::add_memory_region): Convert
2331 field precision to int.
2332 * script.cc (script_set_section_region, script_set_section_region):
2333 Convert field precision to int.
2334
2335 2010-09-08 Rafael Espindola <espindola@google.com>
2336
2337 * arm.cc (do_finalize_sections): Create the __exidx_start and
2338 __exdix_end symbols even when the section is missing.
2339
2340 2010-09-08 Nick Clifton <nickc@redhat.com>
2341
2342 * README: Remove claim that MEMORY is not supported.
2343 * expression.cc (script_exp_function_origin)
2344 (script_exp_function_length): Move from here to ...
2345 * script.cc: ... here.
2346 (script_set_section_region, script_add_memory)
2347 (script_parse_memory_attr, script_include_directive): New
2348 functions.
2349 * script-sections.cc
2350 (class Memory_region): New class.
2351 (class Output_section_definition): Add set_memory_region,
2352 set_section_vma, set_section_lma and get_section_name methods.
2353 (class Script_Sections): Add add_memory_region,
2354 find_memory_region, find_memory_region_origin,
2355 find_memory_region_length and set_memory_region methods.
2356 Have set_section_addresses method walk the list of set memory
2357 regions.
2358 Extend the print methos to display memory regions.
2359 * script-sections.h: Add prototypes for new methods.
2360 Add enum for MEMORY region attributes.
2361 * yyscript.y: Add support for parsing MEMORY regions.
2362 * script-c.h: Add prototypes for new functions.
2363 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2364 * testsuite/Makefile.in: Regenerate.
2365 * testsuite/memory_test.sh: New script.
2366 * testsuite/memory_test.s: New assembler source file.
2367 * testsuite/memory_test.t: New linker script.
2368
2369 2010-08-27 Doug Kwan <dougkwan@google.com>
2370
2371 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2372 reference override an existing dynamic weak reference.
2373 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2374 * testsuite/Makefile.in: Regenerate.
2375 * testsuite/dyn_weak_ref.sh: New file.
2376 * testsuite/dyn_weak_ref_1.c: Ditto.
2377 * testsuite/dyn_weak_ref_2.c: Ditto.
2378
2379 2010-08-27 Ian Lance Taylor <iant@google.com>
2380
2381 * incremental.h (class Incremental_input_entry): Add virtual
2382 destructor.
2383
2384 2010-08-27 Ian Lance Taylor <iant@google.com>
2385
2386 * testsuite/start_lib_test_3.c: Mark t3 as used.
2387
2388 2010-08-27 Nick Clifton <nickc@redhat.com>
2389
2390 * options.cc (version_script): Fix small typo in previous
2391 whitespace tidyup.
2392
2393 2010-08-25 Nick Clifton <nickc@redhat.com>
2394
2395 * archive.cc: Formatting fixes: Remove whitespace between
2396 typename and following asterisk. Remove whitespace between
2397 function name and opening parenthesis.
2398 * archive.h: Likewise.
2399 * arm.cc: Likewise.
2400 * attributes.cc: Likewise.
2401 * attributes.h: Likewise.
2402 * common.cc: Likewise.
2403 * copy-relocs.cc: Likewise.
2404 * dirsearch.h: Likewise.
2405 * dynobj.cc: Likewise.
2406 * ehframe.cc: Likewise.
2407 * ehframe.h: Likewise.
2408 * expression.cc: Likewise.
2409 * fileread.cc: Likewise.
2410 * fileread.h: Likewise.
2411 * gc.h: Likewise.
2412 * gold-threads.cc: Likewise.
2413 * gold.cc: Likewise.
2414 * i386.cc: Likewise.
2415 * icf.h: Likewise.
2416 * incremental-dump.cc: Likewise.
2417 * incremental.cc: Likewise.
2418 * layout.cc: Likewise.
2419 * layout.h: Likewise.
2420 * main.cc: Likewise.
2421 * merge.cc: Likewise.
2422 * merge.h: Likewise.
2423 * object.cc: Likewise.
2424 * object.h: Likewise.
2425 * options.cc: Likewise.
2426 * options.h: Likewise.
2427 * output.cc: Likewise.
2428 * output.h: Likewise.
2429 * plugin.cc: Likewise.
2430 * plugin.h: Likewise.
2431 * powerpc.cc: Likewise.
2432 * reloc.cc: Likewise.
2433 * script-c.h: Likewise.
2434 * script-sections.cc: Likewise.
2435 * script.cc: Likewise.
2436 * stringpool.cc: Likewise.
2437 * symtab.cc: Likewise.
2438 * symtab.h: Likewise.
2439 * target.cc: Likewise.
2440 * timer.cc: Likewise.
2441 * timer.h: Likewise.
2442 * version.cc: Likewise.
2443 * x86_64.cc: Likewise.
2444
2445 2010-08-24 Nick Clifton <nickc@redhat.com>
2446
2447 PR 11899
2448 * layout.cc (segment_precedes): Sort segments by their physical
2449 addresses, if they have been set.
2450
2451 2010-08-23 Cary Coutant <ccoutant@google.com>
2452
2453 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2454 symbols data.
2455 (Lib_group::include_member): Unlock object after deleting its
2456 symbols data.
2457 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2458 the bug fixed here.
2459
2460 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2461 Cary Coutant <ccoutant@google.com>
2462
2463 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2464 constructor, and set_blocker.
2465 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2466 readsyms_blocker_.
2467 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2468 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2469 * testsuite/Makefile.am (start_lib_test): New test case.
2470 * testsuite/Makefile.in: Regenerate.
2471 * testsuite/start_lib_test_main.c: New file.
2472 * testsuite/start_lib_test_1.c: New file.
2473 * testsuite/start_lib_test_2.c: New file.
2474 * testsuite/start_lib_test_3.c: New file.
2475
2476 2010-08-19 Ian Lance Taylor <iant@google.com>
2477
2478 * Makefile.in: Rebuild with automake 1.11.1.
2479 * aclocal.m4: Likewise.
2480 * testsuite/Makefile.in: Likewise.
2481
2482 2010-08-19 Ian Lance Taylor <iant@google.com>
2483
2484 PR 10893
2485 * i386.cc (class Output_data_plt_i386): Update declarations.
2486 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2487 local_ifuncs_ fields.
2488 (Target_i386::do_plt_section_for_global): New function.
2489 (Target_i386::do_plt_section_for_local): New function.
2490 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2491 parameter; change all callers. Initialize global_ifuncs_ and
2492 local_ifuncs_. If doing a static link define __rel_iplt_start and
2493 __rel_iplt_end.
2494 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2495 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2496 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2497 symbols.
2498 (Target_i386::make_plt_section): New function, broken out of
2499 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2500 (Target_i386::make_plt_entry): Call make_plt_section.
2501 (Target_i386::make_local_ifunc_plt_entry): New function.
2502 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2503 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2504 R_386_IRELATIVE to switch.
2505 (Target_i386::Scan::global): Likewise.
2506 (Target_i386::Relocate::relocate): Likewise.
2507 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2508 switch.
2509 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2510 (Target_x86_64::do_plt_section_for_global): New function.
2511 (Target_x86_64::do_plt_section_for_local): New function.
2512 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2513 parameter; change all callers. If doing a static link define
2514 __rela_iplt_start and __rela_iplt_end.
2515 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2516 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2517 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2518 to point to .plt.
2519 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2520 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2521 switch.
2522 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2523 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2524 R_X86_64_IRELATIVE to switch.
2525 (Target_x86_64::Scan::global): Likewise.
2526 (Target_x86_64::Relocate::relocate): Likewise.
2527 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2528 switch.
2529 * target.h (class Target): Add plt_section_for_global and
2530 plt_section_for_local functions. Add do_plt_section_for_global
2531 and do_plt_section_for_local virtual functions.
2532 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2533 clarifying comments.
2534 (Symbol::use_plt_offset): Handle IFUNC symbol.
2535 * object.cc (Sized_relobj::Sized_relobj): Initialize
2536 local_plt_offsets_.
2537 (Sized_relobj::local_has_plt_offset): New function.
2538 (Sized_relobj::local_plt_offset): New function.
2539 (Sized_relobj::set_local_plt_offset): New function.
2540 (Sized_relobj::do_count): Handle IFUNC symbol.
2541 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2542 a bit away from input_shndx_ field. Add set_is_func_symbol and
2543 is_ifunc_symbol functions.
2544 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2545 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2546 local_plt_offsets_ field.
2547 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2548 * output.h (class Output_section_data): Add non-const
2549 output_section function.
2550 (class Output_data_got): Update declarations.
2551 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2552 Add use_plt_offset parameter to global and local constructors.
2553 Change all callers. Change local_sym_index_ field to 31 bits.
2554 Change GSYM_CODE and CONSTANT_CODE accordingly.
2555 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2556 doing a static link don't set sh_link field.
2557 (Output_data_got::Got_entry::write): Use PLT offset if
2558 appropriate.
2559 (Output_data_got::add_global_plt): New function.
2560 (Output_data_got::add_local_plt): New function.
2561 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2562 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2563 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2564 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2565 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2566 IFUNC conditional.
2567 * testsuite/ifunc-sel.h: New file.
2568 * testsuite/ifuncmain1.c: New file.
2569 * testsuite/ifuncmain1vis.c: New file.
2570 * testsuite/ifuncmod1.c: New file.
2571 * testsuite/ifuncdep2.c: New file.
2572 * testsuite/ifuncmain2.c: New file.
2573 * testsuite/ifuncmain3.c: New file.
2574 * testsuite/ifuncmod3.c: New file.
2575 * testsuite/ifuncmain4.c: New file.
2576 * testsuite/ifuncmain5.c: New file.
2577 * testsuite/ifuncmod5.c: New file.
2578 * testsuite/ifuncmain6pie.c: New file.
2579 * testsuite/ifuncmod6.c: New file.
2580 * testsuite/ifuncmain7.c: New file.
2581 * configure, testsuite/Makefile.in: Rebuild.
2582
2583 2010-08-18 Ian Lance Taylor <iant@google.com>
2584
2585 * incremental.cc
2586 (Output_section_incremental_inputs::write_input_files): Add cast
2587 to avoid signed/unsigned comparison warning.
2588 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2589
2590 2010-08-12 Cary Coutant <ccoutant@google.com>
2591
2592 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2593
2594 2010-08-13 Ian Lance Taylor <iant@google.com>
2595
2596 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2597
2598 2010-08-12 Cary Coutant <ccoutant@google.com>
2599 Doug Kwan <dougkwan@google.com>
2600
2601 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2602 defintion overrides non-weak undef, remember that the original undef
2603 is not weak.
2604 * symtab.cc (Symbol_table::sized_write_global): For undef without
2605 an original weak binding, set binding to global in output.
2606 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2607 * testsuite/Makefile.in: Regenerate.
2608 * testsuite/strong_ref_weak_def.sh: New file.
2609 * testsuite/strong_ref_weak_def_1.c: Ditto.
2610 * testsuite/strong_ref_weak_def_2.c: Ditto.
2611
2612 2010-08-12 Cary Coutant <ccoutant@google.com>
2613
2614 * testsuite/incremental_test.sh: Rewrite.
2615 * testsuite/incremental_test_1.c: Rewrite.
2616 * testsuite/incremental_test_2.c: Rewrite.
2617
2618 2010-08-12 Cary Coutant <ccoutant@google.com>
2619
2620 * arm.cc (Target_arm::got_size): Add const.
2621 (Target_arm::got_entry_count): New function.
2622 (Target_arm::plt_entry_count): New function.
2623 (Target_arm::first_plt_entry_offset): New function.
2624 (Target_arm::plt_entry_size): New function.
2625 (Output_data_plt_arm::entry_count): New function.
2626 (Output_data_plt_arm::first_plt_entry_offset): New function.
2627 (Output_data_plt_arm::get_plt_entry_size): New function.
2628 * i386.cc (Target_i386::got_size): Add const.
2629 (Target_i386::got_entry_count): New function.
2630 (Target_i386::plt_entry_count): New function.
2631 (Target_i386::first_plt_entry_offset): New function.
2632 (Target_i386::plt_entry_size): New function.
2633 (Output_data_plt_i386::entry_count): New function.
2634 (Output_data_plt_i386::first_plt_entry_offset): New function.
2635 (Output_data_plt_i386::get_plt_entry_size): New function.
2636 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2637 find_incremental_inputs_sections. Dump incremental_got_plt section.
2638 * incremental.cc: Include target.h.
2639 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2640 parameter. Adjust all callers. Find incremental_got_plt section.
2641 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2642 section.
2643 (Output_section_incremental_inputs::set_final_data_size): Calculate
2644 size of incremental_got_plt section.
2645 (Output_section_incremental_inputs::do_write): Write the
2646 incremental_got_plt section.
2647 (Got_plt_view_info): New struct.
2648 (Local_got_offset_visitor): New class.
2649 (Global_got_offset_visitor): New class.
2650 (Global_symbol_visitor_got_plt): New class.
2651 (Output_section_incremental_inputs::write_got_plt): New function.
2652 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2653 Add parameter. Adjust all callers.
2654 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2655 (Incremental_inputs::got_plt_section): New function.
2656 (Incremental_inputs::got_plt_section_): New data member.
2657 (Incremental_got_plt_reader): New class.
2658 * layout.cc (Layout::create_incremental_info_sections): Add the
2659 incremental_got_plt section.
2660 * object.h (Got_offset_list::get_list): New function.
2661 (Got offset_list::for_all_got_offsets): New function.
2662 (Sized_relobj::local_got_offset_list): New function.
2663 * powerpc.cc (Target_powerpc::got_size): Add const.
2664 (Target_powerpc::got_entry_count): New function.
2665 (Target_powerpc::plt_entry_count): New function.
2666 (Target_powerpc::first_plt_entry_offset): New function.
2667 (Target_powerpc::plt_entry_size): New function.
2668 (Output_data_plt_powerpc::entry_count): New function.
2669 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2670 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2671 * sparc.cc (Target_sparc::got_size): Add const.
2672 (Target_sparc::got_entry_count): New function.
2673 (Target_sparc::plt_entry_count): New function.
2674 (Target_sparc::first_plt_entry_offset): New function.
2675 (Target_sparc::plt_entry_size): New function.
2676 (Output_data_plt_sparc::entry_count): New function.
2677 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2678 (Output_data_plt_sparc::get_plt_entry_size): New function.
2679 * symtab.h (Symbol::got_offset_list): New function.
2680 (Symbol_table::for_all_symbols): New function.
2681 * target.h (Sized_target::got_entry_count): New function.
2682 (Sized_target::plt_entry_count): New function.
2683 (Sized_target::plt_entry_size): New function.
2684 * x86_64.cc (Target_x86_64::got_size): Add const.
2685 (Target_x86_64::got_entry_count): New function.
2686 (Target_x86_64::plt_entry_count): New function.
2687 (Target_x86_64::first_plt_entry_offset): New function.
2688 (Target_x86_64::plt_entry_size): New function.
2689 (Output_data_plt_x86_64::entry_count): New function.
2690 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2691 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2692
2693 2010-08-12 Cary Coutant <ccoutant@google.com>
2694
2695 * archive.cc: Include incremental.h.
2696 (Archive::Archive): Initialize incremental_info_.
2697 (Archive::include_member): Record archive members in incremental info.
2698 (Add_archive_symbols::run): Record begin and end of an archive in
2699 incremental info.
2700 (Lib_group::include_member): Record objects in incremental info.
2701 * archive.h (Incremental_archive_entry): Forward declaration.
2702 (Archive::set_incremental_info): New member function.
2703 (Archive::incremental_info): New member function.
2704 (Archive::Unused_symbol_iterator): New class.
2705 (Archive::unused_symbols_begin): New member function.
2706 (Archive::unused_symbols_end): New member function.
2707 (Archive::incremental_info_): New data member.
2708 * incremental-dump.cc (find_input_containing_global): New function.
2709 (dump_incremental_inputs): Dump new incremental info sections.
2710 * incremental.cc: Include symtab.h.
2711 (Output_section_incremental_inputs): New class.
2712 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2713 new incremental info sections.
2714 (Sized_incremental_binary::do_check_inputs): Likewise.
2715 (Incremental_inputs::report_archive): Remove.
2716 (Incremental_inputs::report_archive_begin): New function.
2717 (Incremental_inputs::report_archive_end): New function.
2718 (Incremental_inputs::report_object): New function.
2719 (Incremental_inputs::finalize_inputs): Remove.
2720 (Incremental_inputs::report_input_section): New function.
2721 (Incremental_inputs::report_script): Rewrite.
2722 (Incremental_inputs::finalize): Do nothing but finalize string table.
2723 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2724 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2725 (Incremental_inputs::create_data_sections): New function.
2726 (Incremental_inputs::relocs_entsize): New function.
2727 (Output_section_incremental_inputs::set_final_data_size): New function.
2728 (Output_section_incremental_inputs::do_write): New function.
2729 (Output_section_incremental_inputs::write_header): New function.
2730 (Output_section_incremental_inputs::write_input_files): New function.
2731 (Output_section_incremental_inputs::write_info_blocks): New function.
2732 (Output_section_incremental_inputs::write_symtab): New function.
2733 * incremental.h (Incremental_script_entry): Forward declaration.
2734 (Incremental_object_entry): Forward declaration.
2735 (Incremental_archive_entry): Forward declaration.
2736 (Incremental_inputs): Forward declaration.
2737 (Incremental_inputs_header_data): Remove.
2738 (Incremental_inputs_header): Remove.
2739 (Incremental_inputs_header_write): Remove.
2740 (Incremental_inputs_entry_data): Remove.
2741 (Incremental_inputs_entry): Remove.
2742 (Incremental_inputs_entry_write): Remove.
2743 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2744 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2745 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2746 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2747 Likewise.
2748 (Incremental_input_entry): New class.
2749 (Incremental_script_entry): New class.
2750 (Incremental_object_entry): New class.
2751 (Incremental_archive_entry): New class.
2752 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2753 (Incremental_inputs::report_inputs): Remove.
2754 (Incremental_inputs::report_archive): Remove.
2755 (Incremental_inputs::report_archive_begin): New function.
2756 (Incremental_inputs::report_archive_end): New function.
2757 (Incremental_inputs::report_object): Change prototype.
2758 (Incremental_inputs::report_input_section): New function.
2759 (Incremental_inputs::report_script): Change prototype.
2760 (Incremental_inputs::get_reloc_count): New function.
2761 (Incremental_inputs::set_reloc_count): New function.
2762 (Incremental_inputs::create_data_sections): New function.
2763 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2764 (Incremental_inputs::inputs_section): New function.
2765 (Incremental_inputs::symtab_section): New function.
2766 (Incremental_inputs::relocs_section): New function.
2767 (Incremental_inputs::get_stringpool): Add const.
2768 (Incremental_inputs::command_line): Add const.
2769 (Incremental_inputs::inputs): Remove.
2770 (Incremental_inputs::command_line_key): New function.
2771 (Incremental_inputs::input_file_count): New function.
2772 (Incremental_inputs::input_files): New function.
2773 (Incremental_inputs::relocs_entsize): New function.
2774 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2775 (Incremental_inputs::finalize_inputs): Remove.
2776 (Incremental_inputs::Input_info): Remove.
2777 (Incremental_inputs::lock_): Remove.
2778 (Incremental_inputs::inputs_): Change type.
2779 (Incremental_inputs::inputs_map_): Remove.
2780 (Incremental_inputs::current_object_entry_): New data member.
2781 (Incremental_inputs::inputs_section_): New data member.
2782 (Incremental_inputs::symtab_section_): New data member.
2783 (Incremental_inputs::relocs_section_): New data member.
2784 (Incremental_inputs::reloc_count_): New data member.
2785 (Incremental_inputs_reader): New class.
2786 (Incremental_symtab_reader): New class.
2787 (Incremental_relocs_reader): New class.
2788 * layout.cc (Layout::finalize): Move finalization of incremental info
2789 and creation of incremental info sections to follow finalization of
2790 symbol table. Set offsets for postprocessing sections.
2791 (Layout::create_incremental_info_sections): Call
2792 Incremental_inputs::create_data_sections. Add incremental symtab
2793 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2794 sections to layout after input sections.
2795 * layout.h (struct Timespec): Forward declaration.
2796 (Layout::incremental_inputs): Add const.
2797 (Layout::create_incremental_info_sections): Add parameter.
2798 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2799 * object.cc: Include incremental.h.
2800 (Relobj::finalize_incremental_relocs): New function.
2801 (Sized_relobj::do_layout): Record input sections in incremental info.
2802 * object.h (Object::output_section): New function.
2803 (Object::output_section_offset): Moved from Relobj.
2804 (Object::get_incremental_reloc_base): New function.
2805 (Object::get_incremental_reloc_count): New function.
2806 (Object::do_output_section): New function.
2807 (Object::do_output_section_offset): Moved from Relobj.
2808 (Object::do_get_incremental_reloc_base): New function.
2809 (Object::do_get_incremental_reloc_count): New function.
2810 (Object::Object): Initialize new data members.
2811 (Relobj::output_section): Renamed do_output_section and moved to
2812 protected.
2813 (Relobj::output_section_offset): Moved to Object.
2814 (Relobj::do_get_incremental_reloc_base): New function.
2815 (Relobj::do_get_incremental_reloc_count): New function.
2816 (Relobj::allocate_incremental_reloc_counts): New function.
2817 (Relobj::count_incremental_reloc): New function.
2818 (Relobj::finalize_incremental_relocs): New function.
2819 (Relobj::next_incremental_reloc_index): New function.
2820 (Relobj::reloc_counts_): New data member.
2821 (Relobj::reloc_bases_): New data member.
2822 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2823 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2824 (Sized_relobj::incremental_relocs_scan): New function.
2825 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2826 (Sized_relobj::incremental_relocs_write): New function.
2827 (Sized_relobj::incremental_relocs_write_reltype): New function.
2828 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2829 incremental link.
2830 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2831 archives and object files elsewhere.
2832 (Add_symbols::run): Report object files here.
2833 (Finish_group::run): Report end of archive at end of group.
2834 * reloc.cc: Include layout.h, incremental.h.
2835 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2836 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2837 (Sized_relobj::incremental_relocs_scan): New function.
2838 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2839 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2840 (Sized_relobj::incremental_relocs_write): New function.
2841 (Sized_relobj::incremental_relocs_write_reltype): New function.
2842 * script.cc (read_input_script): Rewrite test for incremental link.
2843 Change call to Incremental_inputs::report_script.
2844 * symtab.h (Symbol_table::first_global_index): New function.
2845 (Symbol_table::output_count): New function.
2846
2847 2010-08-12 Doug Kwan <dougkwan@google.com>
2848
2849 * arm.cc (Target_arm::merge_object_attributes): Check command line
2850 options --no-wchar-size-warning and --no-enum-size-warning.
2851 * options.h (General_options): Add ld-compatible options
2852 --no-enum-size-warning and --no-wchar-size-warning.
2853
2854 2010-08-04 Ian Lance Taylor <iant@google.com>
2855
2856 * x86_64.cc (Target_x86_64::Scan::local): Use
2857 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2858 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2859 (Target_x86_64::Scan::global): Likewise.
2860 (Target_x86_64::Relocate::relocate): Likewise.
2861 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2862 Likewise.
2863
2864 2010-08-03 Cary Coutant <ccoutant@google.com>
2865
2866 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2867 to reserve space in merged_strings vector. Keep total input size
2868 for stats.
2869 (Output_merge_string::do_print_merge_stats): Print total input size.
2870 * merge.h (Output_merge_string): Add input_size_ field.
2871 * stringpool.cc (Stringpool_template::string_length): Move
2872 implementations out of Stringpool_template class and place in
2873 stringpool.h.
2874 * stringpool.h (string_length): Move out of Stringpool_template.
2875
2876 2010-08-03 Ian Lance Taylor <iant@google.com>
2877
2878 PR 11712
2879 * layout.cc (relaxation_loop_body): If address of load segment is
2880 set, adjust address to include headers if possible.
2881
2882 2010-08-03 Ian Lance Taylor <iant@google.com>
2883
2884 * version.cc (version_string): Bump to 1.10.
2885
2886 2010-08-03 Ian Lance Taylor <iant@google.com>
2887
2888 PR 11805
2889 * layout.h (enum Output_section_order): Define.
2890 (class Layout): Update declarations.
2891 * layout.cc (Layout::get_output_section): Add order parameter.
2892 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2893 is_first_non_relro parameters. Change all callers.
2894 (Layout::choose_output_section): Likewise.
2895 (Layout::add_output_section_data): Likewise.
2896 (Layout::make_output_section): Likewise. Set order.
2897 (Layout::default_section_order): New function.
2898 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2899 * output.cc (Output_section::Output_section): Initialize order_.
2900 Don't initialize deleted fields.
2901 (Output_segment::Output_segment): Don't initialize deleted
2902 fields.
2903 (Output_segment::add_output_section_to_load): New function
2904 replacing add_output_section. Change all callers to call this or
2905 add_output_section_to_nonload.
2906 (Output_segment::add_output_section_to_nonload): New function.
2907 (Output_segment::remove_output_section): Rewrite.
2908 (Output_segment::add_initial_output_data): Likewise.
2909 (Output_segment::has_any_data_sections): Likewise.
2910 (Output_segment::is_first_section_relro): Likewise.
2911 (Output_segment::maximum_alignment): Likewise.
2912 (Output_segment::has_dynamic_reloc): New function replacing
2913 dynamic_reloc_count. Change all callers.
2914 (Output_segment::has_dynamic_reloc_list): New function replacing
2915 dynamic_reloc_count_list. Change all callers.
2916 (Output_segment::set_section_addresses): Rewrite.
2917 (Output_segment::set_offset): Rewrite.
2918 (Output_segment::find_first_and_last_list): Remove.
2919 (Output_segment::set_tls_offsets): Rewrite.
2920 (Output_segment::first_section_load_address): Likewise.
2921 (Output_segment::output_section_count): Likewise.
2922 (Output_segment::section_with_lowest_load_address): Likewise.
2923 (Output_segment::write_section_headers): Likewise.
2924 (Output_segment::print_sections_to_map): Likewise.
2925 * output.h (class Output_data): Remove dynamic_reloc_count_
2926 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2927 (Output_data::add_dynamic_reloc): Rewrite.
2928 (Output_data::has_dynamic_reloc): New function.
2929 (Output_data::dynamic_reloc_count): Remove.
2930 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2931 is_last_relro_, is_first_non_relro_, is_interp_,
2932 is_dynamic_linker_section_ fields. Add order and set_order
2933 functions. Remove is_relro_local, set_is_relro_local,
2934 is_last_relro, set_is_last_relro, is_first_non_relro,
2935 set_is_first_non_relro functions, is_interp, set_is_interp,
2936 is_dynamic_linker_section, and set_is_dynamic_linker_section
2937 functions.
2938 (class Output_segment): Change Output_data_list from std::list to
2939 std:;vector. Add output_lists_ field. Remove output_data_ and
2940 output_bss_ fields. Update declarations.
2941
2942 2010-08-02 Ian Lance Taylor <iant@google.com>
2943
2944 * arm.cc (Target_arm::gc_process_relocs): Use typename.
2945 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
2946 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
2947
2948 2010-08-02 Ian Lance Taylor <iant@google.com>
2949
2950 PR 11855
2951 * script.cc (Script_options::Script_options): Initialize
2952 symbol_definitions_ and symbol_references_.
2953 (Script_options::add_symbol_assignment): Update
2954 symbol_definitions_ and symbol_references_.
2955 (Script_options::add_symbol_reference): New function.
2956 (script_symbol): New function.
2957 * script.h (class Script_options): Add symbol_definitions_ and
2958 symbol_references_ fields.
2959 (Script_options::referenced_const_iterator): New type.
2960 (Script_options::referenced_begin): New function.
2961 (Script_options::referenced_end): New function.
2962 (Script_options::is_referenced): New function.
2963 (Script_options::any_unreferenced): New function.
2964 * script-c.h (script_symbol): Declare.
2965 * yyscript.y (exp): Call script_symbol.
2966 * symtab.cc: Include "script.h".
2967 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
2968 Change all callers. Check symbols referenced by scripts.
2969 (Symbol_table::add_undefined_symbols_from_command_line): Add
2970 layout parameter. Change all callers.
2971 (Symbol_table::do_add_undefined_symbols_from_command_line):
2972 Likewise. Break out loop body. Check symbols referenced by
2973 scripts.
2974 (Symbol_table::add_undefined_symbol_from_command_line): New
2975 function broken out of
2976 do_add_undefined_symbols_from_command_line.
2977 * symtab.h (class Symbol_table): Update declarations.
2978 * archive.cc: Include "layout.h".
2979 (Archive::should_include_member): Add layout parameter. Change
2980 all callers. Check for symbol mentioned in expression.
2981 * archive.h (class Archive): Update declaration.
2982 * object.cc (Sized_relobj::do_should_include_member): Add layout
2983 parameter.
2984 * object.h (Object::should_include_member): Add layout parameter.
2985 Change all callers.
2986 (Object::do_should_include_member): Add layout parameter.
2987 (class Sized_relobj): Update declaration.
2988 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
2989 parameter.
2990 * dynobj.h (class Sized_dynobj): Update declaration.
2991 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
2992 layout parameter.
2993 * plugin.h (class Sized_pluginobj): Update declaration.
2994
2995 2010-08-02 Ian Lance Taylor <iant@google.com>
2996
2997 PR 11866
2998 * output.cc (Output_segment::set_offset): Search for the first and
2999 last sections rather than assuming that the list is in order.
3000 (Output_segment::find_first_and_last_list): New function.
3001 * output.h (class Output_segment): Update declarations.
3002 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3003 (relro_strip_test_SOURCES): New variable.
3004 (relro_strip_test_DEPENDENCIES): New variable.
3005 (relro_strip_test_LDFLAGS): New variable.
3006 (relro_strip_test_LDADD): New variable.
3007 (relro_strip_test.so): New target.
3008
3009 2010-08-02 Ian Lance Taylor <iant@google.com>
3010
3011 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3012 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3013 (Target_i386::got_tlsdesc_section): New function.
3014 (Target_i386::got_section): Create space for GOT entries for
3015 TLSDESC relocations.
3016 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3017 R_386_TLS_GOTDESC.
3018 (Target_i386::Scan::global): Likewise.
3019 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3020 using TLSDESC GOT.
3021 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3022 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3023 (Target_x86_64::got_tlsdesc_section): New function.
3024 (Target_x86_64::got_section): Create space for GOT entries for
3025 TLSDESC relocations.
3026 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3027 R_386_TLS_GOTDESC.
3028 (Target_x86_64::Scan::global): Likewise.
3029 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3030 using TLSDESC GOT.
3031
3032 2010-08-02 Ian Lance Taylor <iant@google.com>
3033
3034 * testsuite/final_layout.sh: Use dc to convert from hex to
3035 decimal.
3036
3037 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3038
3039 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3040 paramter to the call to gold::gc_process_relocs.
3041 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3042 paramter to the call to gold::gc_process_relocs.
3043 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3044 parameter to the call to gold::gc_process_relocs.
3045 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3046 template parameter to the call to gold::gc_process_relocs.
3047 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3048 paramter to the call to gold::gc_process_relocs.
3049 * gc.h (get_embedded_addend_size): New function.
3050 (gc_process_relocs): Save the size of the reloc for use by ICF.
3051 * icf.cc (get_section_contents): Get the addend from the text section
3052 for SHT_REL relocation sections.
3053 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3054 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3055 * int_encoding.h (read_from_pointer): New overloaded function.
3056 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3057 * testsuite/icf_sht_rel_addend_test.sh: New file.
3058 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3059 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3060
3061 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3062
3063 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3064 * Makefile.in: Regenerate.
3065 * testsuite/Makefile.in: Regenerate.
3066
3067 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3068
3069 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3070 * gold/testsuite/debug_msg.cc: Likewise.
3071 * gold/testsuite/odr_violation1.cc
3072 * gold/testsuite/odr_violation2.cc
3073
3074 2010-07-21 Cary Coutant <ccoutant@google.com>
3075
3076 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3077 string, and length fields.
3078 (Output_merge_string::Merged_strings_list): New type.
3079 (Output_merge_string::Merged_strings_lists): New typedef.
3080 (Output_merge_string): Replace merged_strings_ with
3081 merged_strings_lists_.
3082 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3083 Merged_strings_list per input object and section. Don't store pointer
3084 to the string. Don't store length with each merged string entry.
3085 (Output_merge_string::finalize_merged_data): Loop over list of merged
3086 strings lists. Recompute length of each merged string.
3087
3088 2010-07-15 Cary Coutant <ccoutant@google.com>
3089
3090 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3091 here.
3092
3093 2010-07-14 Ian Lance Taylor <iant@google.com>
3094
3095 * descriptors.cc (Descriptors::open): Report correct name in error
3096 message.
3097
3098 2010-07-13 Doug Kwan <dougkwan@google.com>
3099
3100 * arm.cc (Arm_input_section::Arm_input_section): For a
3101 SHT_ARM_EXIDX section, always keeps the input sections.
3102 (Arm_input_section::set_exidx_section_link): New method.
3103 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3104 has_errors_ to false.
3105 (Arm_exidx_input_section::has_errors,
3106 Arm_exidx_input_section::set_has_errors): New methods.
3107 (Arm_exidx_input_section::has_errors_): New data member.
3108 (Arm_relobj::get_exidx_shndx_list): New method.
3109 (Arm_output_section::append_text_sections_to_list): Do not skip
3110 section without SHF_EXECINSTR.
3111 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3112 errors.
3113 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3114 section header. Make error messages more verbose. Check for
3115 a non-executable section linked to an EXIDX section.
3116 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3117 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3118 check that there is no deferred EXIDX section if we exit early.
3119 Instead of not making an EXIDX section in case of an error, make one
3120 and set the has_errors flag of it.
3121 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3122 in a relocatable link.
3123 (Target_arm::do_relax): Look for the EXIDX output section instead of
3124 assuming that it is called .ARM.exidx.
3125 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3126 section list. Do not check for SHF_EXECINSTR section flags but
3127 skip any input section with errors.
3128 * output.cc (Output_section::Output_section): Initialize
3129 always_keeps_input_sections_ to false.
3130 (Output_section::add_input_section): Check for
3131 always_keeps_input_sections_.
3132 * output.h (Output_section::always_keeps_input_sections,
3133 Output_section::set_always_keeps_input_sections): New methods.
3134 (Output_section::always_keeps_input_sections): New data member.
3135
3136 2010-07-13 Rafael Espindola <espindola@google.com>
3137
3138 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3139 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3140
3141 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3142 Ian Lance Taylor <iant@google.com>
3143
3144 * output.h (Output_section_lookup_maps::add_merge_section):
3145 Correct check of whether value was inserted.
3146 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3147 (Output_section_lookup_maps::add_relaxed_input_section):
3148 Likewise.
3149 * arm.cc (Target_arm::got_section): Remove used local os.
3150 * i386.cc (Target_i386::got_section): Likewise.
3151 * x86_64.cc (Target_x86_64::got_section): Likewise.
3152 * sparc.cc (Target_sparc::got_section): Likewise.
3153 (Target_sparc::relocate): Remove unused local have_got_offset.
3154 * powerpc.cc (Target_powerpc::relocate): Likewise.
3155
3156 2010-07-13 Ian Lance Taylor <iant@google.com>
3157
3158 * compressed_output.cc (zlib_decompress): Fix signature in
3159 !HAVE_ZLIB_H case.
3160
3161 * archive.cc (Archive::include_member): Unlock an external member
3162 of a thin archive. Don't bother to delete an object we know is
3163 NULL.
3164
3165 2010-07-12 Cary Coutant <ccoutant@google.com>
3166
3167 * compressed_output.cc (zlib_decompress): New function.
3168 (get_uncompressed_size): New function.
3169 (decompress_input_section): New function.
3170 * compressed_output.h (get_uncompressed_size): New function.
3171 (decompress_input_section): New function.
3172 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3173 Handle compressed debug sections.
3174 * layout.cc (is_compressed_debug_section): New function.
3175 (Layout::output_section_name): Map compressed section names to
3176 canonical names.
3177 * layout.h (is_compressed_debug_section): New function.
3178 (is_debug_info_section): Recognize compressed debug sections.
3179 * merge.cc: Include compressed_output.h.
3180 (Output_merge_data::do_add_input_section): Handle compressed
3181 debug sections.
3182 (Output_merge_string::do_add_input_section): Handle compressed
3183 debug sections.
3184 * object.cc: Include compressed_output.h.
3185 (Sized_relobj::Sized_relobj): Initialize new data members.
3186 (build_compressed_section_map): New function.
3187 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3188 * object.h (Object::section_is_compressed): New method.
3189 (Object::do_section_is_compressed): New method.
3190 (Sized_relobj::Compressed_section_map): New type.
3191 (Sized_relobj::do_section_is_compressed): New method.
3192 (Sized_relobj::compressed_sections_): New data member.
3193 * output.cc (Output_section::add_input_section): Handle compressed
3194 debug sections.
3195 * reloc.cc: Include compressed_output.h.
3196 (Sized_relobj::write_sections): Handle compressed debug sections.
3197
3198 2010-07-08 Cary Coutant <ccoutant@google.com>
3199
3200 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3201 weak when resolving to a dynamic def.
3202 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3203 for weak undef/dynamic def cases. Adjust callers.
3204 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3205 undef_binding_weak_.
3206 (Symbol_table::sized_write_globals): Adjust symbol binding.
3207 (Symbol_table::sized_write_symbol): Add binding parameter.
3208 * symtab.h (Symbol::set_undef_binding): New method.
3209 (Symbol::is_undef_binding_weak): New method.
3210 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3211 (Symbol_table::should_override): Add new parameter.
3212 (Symbol_table::sized_write_symbol): Add new parameter.
3213
3214 * testsuite/weak_undef_file1.cc: Add new test case.
3215 * testsuite/weak_undef_file2.cc: Fix header comment.
3216 * testsuite/weak_undef_test.cc: Add new test case.
3217
3218 2010-06-29 Doug Kwan <dougkwan@google.com>
3219
3220 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3221 Initialize USE_SYMBOL_.
3222 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3223 definition.
3224 (Arm_reloc_property::uses_symbol_): New data member declaration.
3225 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3226 uses symbol value and symbol is undefined but not weakly undefined.
3227
3228 2010-06-28 Rafael Espindola <espindola@google.com>
3229
3230 * plugin.cc (Plugin::load): Use dlerror.
3231
3232 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3233
3234 * symtab.cc (detect_odr_violations): When reporting an ODR
3235 violation, report an object where the symbol is defined.
3236
3237 2010-06-25 Doug Kwan <dougkwan@google.com>
3238
3239 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3240 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3241 definition.
3242 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3243 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3244 target hook to detect function points.
3245 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3246 * icf.h (Icf::check_section_for_function_pointers): Change type of
3247 parameter SECTION_NAME to const reference to std::string. Use
3248 target hook to determine if section may have unsafe pointers.
3249 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3250 method definition.
3251
3252 2010-06-21 Rafael Espindola <espindola@google.com>
3253
3254 * fileread.cc (Input_file::find_fie): New
3255 (Input_file::open): Use Input_file::find_fie.
3256 * fileread.h (Input_file::find_fie): New
3257 * plugin.cc (set_extra_library_path): New.
3258 (Plugin::load): Add set_extra_library_path to the transfer vector.
3259 (Plugin_manager::set_extra_library_path): New.
3260 (Plugin_manager::add_input_file): Use the extra search path if set.
3261 (set_extra_library_path(): New.
3262 * plugin.h (Plugin_manager): Add set_extra_library_path and
3263 extra_search_path_.
3264
3265 2010-06-19 Cary Coutant <ccoutant@google.com>
3266
3267 * layout.cc (gdb_sections): Add .debug_types.
3268 (lines_only_debug_sections): Likewise.
3269
3270 2010-06-18 Rafael Espindola <espindola@google.com>
3271
3272 * plugin.cc (add_input_file,add_input_library)
3273 (Plugin_manager::add_input_file): Make filename arguments const.
3274 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3275 const.
3276
3277 2010-06-16 Doug Kwan <dougkwan@google.com>
3278
3279 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3280 .ARM.attributes section if we have not merged any input
3281 attributes sections.
3282
3283 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3284
3285 * arm.cc: Allow combining objects with no EABI version
3286 information.
3287
3288 2010-06-15 Rafael Espindola <espindola@google.com>
3289
3290 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3291
3292 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3293
3294 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3295 (struct iovec): Correct !HAVE_READV definition.
3296
3297 2010-06-10 Cary Coutant <ccoutant@google.com>
3298
3299 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3300 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3301 reloc sections.
3302 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3303
3304 PR 11683
3305 * symtab.h (Symbol::is_placeholder): New member function.
3306 * target-reloc.h (relocate_section): Check for placeholder symbols.
3307
3308 * testsuite/Makefile.am (plugin_test_8): New test.
3309 (plugin_test_9): New test.
3310 * testsuite/Makefile.in: Regenerate.
3311
3312 2010-06-09 Nick Clifton <nickc@redhat.com>
3313
3314 * yyscript.y (input_list_element): Allow strings prefixed with
3315 the '-' character. Treat these as libraries.
3316 * script.cc (script_add_library): New function. Adds a library
3317 specified by "-l<name>" found in an input script.
3318 * script-c.h: Add prototype for script_add_library.
3319
3320 2010-06-07 Doug Kwan <dougkwan@google.com>
3321
3322 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3323 Restrict stub-group size to be within long conditional branch
3324 range when working around cortex-A8 erratum.
3325
3326 2010-06-07 Damien Diederen <dd@crosstwine.com>
3327
3328 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3329 #ifdef typo.
3330
3331 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3332
3333 PR gold/11658
3334 * output.cc
3335 (Output_section::Input_section_sort_entry::compare_section_ordering):
3336 Change to return non-zero correctly.
3337 (Output_section::Input_section_sort_section_order_index_compare
3338 ::operator()): Change to fix ambiguity in comparisons.
3339
3340 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3341
3342 * gold.h (is_wildcard_string): New function.
3343 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3344 (Layout::layout_eh_frame): Ditto.
3345 (Layout::find_section_order_index): New method.
3346 (Layout::read_layout_from_file): New method.
3347 * layout.h (Layout::find_section_order_index): New method.
3348 (Layout::read_layout_from_file): New method.
3349 (Layout::input_section_position_): New private member.
3350 (Layout::input_section_glob_): New private member.
3351 * main.cc (main): Call read_layout_from_file here.
3352 * options.h (--section-ordering-file): New option.
3353 * output.cc (Output_section::input_section_order_specified_): New
3354 member.
3355 (Output_section::Output_section): Initialize new member.
3356 (Output_section::add_input_section): Add new parameter.
3357 Keep input sections when --section-ordering-file is used.
3358 (Output_section::set_final_data_size): Sort input sections when
3359 section ordering file is specified.
3360 (Output_section::Input_section_sort_entry): Add new parameter.
3361 Check sorting type.
3362 (Output_section::Input_section_sort_entry::compare_section_ordering):
3363 New method.
3364 (Output_section::Input_section_sort_compare::operator()): Change to
3365 consider section_order_index.
3366 (Output_section::Input_section_sort_init_fini_compare::operator()):
3367 Change to consider section_order_index.
3368 (Output_section::Input_section_sort_section_order_index_compare
3369 ::operator()): New method.
3370 (Output_section::sort_attached_input_sections): Change to sort
3371 according to section order when specified.
3372 (Output_section::add_input_section<32, true>): Add new parameter.
3373 (Output_section::add_input_section<64, true>): Add new parameter.
3374 (Output_section::add_input_section<32, false>): Add new parameter.
3375 (Output_section::add_input_section<64, false>): Add new parameter.
3376 * output.h (Output_section::add_input_section): Add new parameter.
3377 (Output_section::input_section_order_specified): New
3378 method.
3379 (Output_section::set_input_section_order_specified): New method.
3380 (Input_section::Input_section): Initialize section_order_index_.
3381 (Input_section::section_order_index): New method.
3382 (Input_section::set_section_order_index): New method.
3383 (Input_section::section_order_index_): New member.
3384 (Input_section::Input_section_sort_section_order_index_compare): New
3385 struct.
3386 (Output_section::input_section_order_specified_): New member.
3387 * script-sections.cc (is_wildcard_string): Delete and move modified
3388 method to gold.h.
3389 (Output_section_element_input::Output_section_element_input): Modify
3390 call to is_wildcard_string.
3391 (Output_section_element_input::Input_section_pattern
3392 ::Input_section_pattern): Ditto.
3393 (Output_section_element_input::Output_section_element_input): Ditto.
3394 * testsuite/Makefile.am (final_layout): New test case.
3395 * testsuite/Makefile.in: Regenerate.
3396 * testsuite/final_layout.cc: New file.
3397 * testsuite/final_layout.sh: New file.
3398
3399 2010-06-01 Rafael Espindola <espindola@google.com>
3400
3401 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3402
3403 2010-06-01 Rafael Espindola <espindola@google.com>
3404
3405 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3406 visibility of symbols.
3407
3408 2010-05-27 Doug Kwan <dougkwan@google.com>
3409
3410 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3411 from start of output section instead of address for a local symbol
3412 in a merged or relaxed section when doing a relocatable link.
3413
3414 2010-05-26 Rafael Espindola <espindola@google.com>
3415
3416 PR 11604
3417 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3418 adding sections the garbage collector removed.
3419 * gold/testsuite/Makefile.am: Add test.
3420 * gold/testsuite/Makefile.in: Regenerate.
3421 * gold/testsuite/plugin_test_7.sh: New.
3422 * gold/testsuite/plugin_test_7_1.c: New.
3423 * gold/testsuite/plugin_test_7_2.c: New.
3424
3425 2010-05-26 Rafael Espindola <espindola@google.com>
3426
3427 * script-sections.cc (Output_section_definition::set_section_addresses):
3428 Check for --section-start.
3429
3430 2010-05-26 Doug Kwan <dougkwan@google.com>
3431
3432 * arm.cc (Arm_scan_relocatable_relocs): New class.
3433 (Target_arm::relocate_special_relocatable): New method.
3434 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3435 (Arm_relocate_functions::thumb_branch_common): Same.
3436 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3437 instead of Default_scan_relocatable_relocs.
3438 * target-reloc.h (relocate_for_relocatable): Let target handle
3439 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3440 * target.h (Sized_target::relocate_special_relocatable): New method.
3441
3442 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3443
3444 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3445
3446 2010-05-23 Doug Kwan <dougkwan@google.com>
3447
3448 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3449 instead of a cast.
3450 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3451 with a direct branch, not a conditional branch, to a stub.
3452 * merge.cc (Output_merge_base::record_input_section): New method
3453 defintion.
3454 (Output_merge_data::do_add_input_section): Record input section if
3455 keeps-input-sections flag is set.
3456 (Output_merge_string::do_add_input_section): Ditto.
3457 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3458 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3459 INPUT_SECTIONS_.
3460 (Output_merge_base::keeps_input_sections,
3461 Output_merge_base::set_keeps_input_sections,
3462 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3463 method definitions.
3464 (Output_merge_base::Input_sections): New type declaration.
3465 (Output_merge_base::input_sections_begin,
3466 Output_merge_base::input_sections_end,
3467 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3468 (Output_merge_base::bool keeps_input_sections_,
3469 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3470 Output_merge_base::input_sections_): New data members.
3471 (Output_merge_data::do_set_keeps_input_sections): New method
3472 defintion.
3473 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3474 * output.cc (Output_section::Input_section::relobj): Move method
3475 defintion from class declaration to here and handle merge sections.
3476 (Output_section::Input_section::shndx): Ditto.
3477 (Output_section::Output_section): Remove initializations of removed
3478 data members and initialize new data member LOOKUP_MAPS_.
3479 (Output_section::add_input_section): Set keeps-input-sections flag
3480 for a newly created merge output section as appropriate. Adjust code
3481 to use Output_section_lookup_maps class.
3482 (Output_section::add_relaxed_input_section): Adjst code for lookup
3483 maps code refactoring.
3484 (Output_section::add_merge_input_section): Add a new parameter
3485 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3486 class. If adding input section to a newly created merge output
3487 section fails, remove the new merge section.
3488 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3489 Adjust code for use of the Output_section_lookup_maps class.
3490 (Output_section::find_merge_section): Ditto.
3491 (Output_section::build_lookup_maps): New method defintion.
3492 (Output_section::find_relaxed_input_section): Adjust code to use
3493 Output_section_lookup_maps class.
3494 (Output_section::get_input_sections): Export merge sections. Adjust
3495 code to use Output_section_lookup_maps class.
3496 (Output_section:::add_script_input_section): Adjust code to use
3497 Output_section_lookup_maps class. Update lookup maps for merge
3498 sections also.
3499 (Output_section::discard_states): Use Output_section_lookup_maps.
3500 (Output_section::restore_states): Same.
3501 * output.h (Merge_section_properties): Move class defintion out of
3502 Output_section.
3503 (Output_section_lookup_maps): New class.
3504 (Output_section::Input_section::is_merge_section): New method
3505 defintion.
3506 (Output_section::Input_section::relobj): Move defintion out of class
3507 defintion. Declare method only.
3508 (Output_section::Input_section::shndx): Ditto.
3509 (Output_section::Input_section::output_merge_base): New method defintion.
3510 (Output_section::Input_section::u2_.pomb): New union field.
3511 (Output_section::Merge_section_by_properties_map,
3512 Output_section::Output_section_data_by_input_section_map,
3513 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3514 Remove types.
3515 (Output_section::add_merge_input_section): Add new parameter
3516 KEEPS_INPUT_SECTIONS.
3517 (Output_section::build_lookup_maps): New method declaration.
3518 (Output_section::merge_section_map_,
3519 Output_section::merge_section_by_properties_map_,
3520 Output_section::relaxed_input_section_map_,
3521 Output_section::is_relaxed_input_section_map_valid_): Remove data
3522 members.
3523 (Output_section::lookup_maps_): New data member.
3524
3525 2010-05-21 Doug Kwan <dougkwan@google.com>
3526
3527 PR gold/11619
3528 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3529 avoid a compilation error.
3530
3531 2010-05-19 Rafael Espindola <espindola@google.com>
3532
3533 * script-sections.cc (Output_section_definition::allocate_to_segment):
3534 Update the phdrs_list even when the output section is NULL.
3535 * testsuite/Makefile.am: Add test.
3536 * testsuite/Makefile.in: Regenerate.
3537 * testsuite/script_test_9.cc: New.
3538 * testsuite/script_test_9.sh: New.
3539 * testsuite/script_test_9.t: New.
3540
3541 2010-05-19 Doug Kwan <dougkwan@google.com>
3542
3543 * arm.cc (Arm_input_section::original_size): New method.
3544 (Arm_input_section::do_addralign): Add a cast.
3545 (Arm_input_section::do_output_offset): Remove static cast.
3546 (Arm_input_section::original_addralign,
3547 Arm_input_section::original_size_): Change type to uint32_t.
3548 (Arm_input_section::init): Add safe casts for section alignment
3549 and size.
3550 (Arm_input_section::set_final_data_size): Do not set address and
3551 offset of stub table.
3552 (Arm_output_section::fix_exidx_coverage): Change use of of
3553 Output_section::Simple_input_section to that of
3554 Output_section::Input_section.
3555 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3556 except for the first pass.
3557 * output.cc (Output_section::get_input_sections): Change type of
3558 input_sections to std::list<Input_section>.
3559 (Output_section::add_script_input_section): Rename from
3560 Output_section::add_simple_input_section. Change type of SIS
3561 parameter from Simple_input_section to Input_section.
3562 * output.h (Output_section::Simple_input_section): Remove class.
3563 (Output_section::Input_section): Change class visibility to public.
3564 (Output_section::Input_section::addralign): Use stored alignments
3565 for special input sections if set.
3566 (Output_section::Input_section::set_addralign): New method.
3567 (Output_section::get_input_sections): Change parameter type from
3568 list of Simple_input_section to list of Input_section.
3569 (Output_section::add_script_input_section): Rename from
3570 Output_section::add_simple_input_section. Change first parameter's
3571 type from Simple_input_section to Input_section and remove the
3572 second and third parameters.
3573 * script-sections.cc (Input_section::Input_section_list): Change
3574 type to list of Output_section::Input_section/
3575 (Input_section_info::Input_section_info): Change parameter type of
3576 INPUT_SECTION to Output_section::Input_section.
3577 (Input_section_info::input_section): Change return type.
3578 (Input_section_info::input_section_): Change type to
3579 Output_section::Input_section.
3580 (Output_section_element_input::set_section_addresses): Adjust code
3581 to use Output_section::Input_section instead of
3582 Output_section::Simple_input_section. Adjust code for renaming
3583 of Output_section::add_simple_input_section.
3584 (Orphan_output_section::set_section_addresses): Ditto.
3585
3586 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3587
3588 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3589 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3590
3591 2010-05-18 Rafael Espindola <espindola@google.com>
3592
3593 * options.cc (General_options::finalize): Handle -nostdlib.
3594 * options.h (nostdlib): New option.
3595 * script.cc (script_add_search_dir): Handle -nostdlib.
3596
3597 2010-05-12 Doug Kwan <dougkwan@google.com>
3598
3599 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3600 attributes section only if there no attributes section after merging.
3601 (Target_arm::merge_object_attributes): Move value of
3602 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3603 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3604 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3605 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3606 and arm_attr_merge_7.stdout.
3607 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3608 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3609 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3610 arm_attr_merge_7b.o): New rules.
3611 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3612 arm_attr_merge_7
3613 * testsuite/Makefile.in: Regenerate.
3614 * testsuite/arm_attr_merge.sh: New file.
3615 * testsuite/arm_attr_merge_[67][ab].s: Same.
3616
3617 2010-05-05 Nick Clifton <nickc@redhat.com>
3618
3619 * po/es.po: Updated Spanish translation.
3620
3621 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3622
3623 * Makefile.am (install-exec-local): Properly install gold as
3624 default cross linker.
3625 * Makefile.in: Regenerated.
3626
3627 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3628 Nick Clifton <nickc@redhat.com>
3629
3630 * configure.ac (install_as_default): Define and set to false
3631 unless --enable-gold or --enable-gold=both/gold has been
3632 specified.
3633 * configure: Regenerate.
3634
3635 * Makefile.am (install-exec-local): Install the executable as
3636 'ld.gold'. If install_as_default is true then also install it as
3637 'ld'.
3638 * Makefile.in: Regenerated.
3639
3640 2010-04-24 Ian Lance Taylor <iant@google.com>
3641
3642 * layout.cc (Layout::layout_reloc): In relocatable link don't
3643 combine reloc sections for grouped sections.
3644
3645 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3646
3647 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3648 sections that are not ordinary to icf.
3649 * icf.cc (get_section_contents): Handle relocation pointing to section
3650 with no object or shndx information.
3651 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3652 * testsuite/Makefile.in: Regenerate.
3653 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3654 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3655
3656 2010-04-22 Ian Lance Taylor <iant@google.com>
3657
3658 * expression.cc (Expression::Expression_eval_info): Add
3659 result_alignment_pointer field.
3660 (Expression::eval_with_dot): Add result_alignment_pointer
3661 parameter. Change all callers.
3662 (Expression::eval_maybe_dot): Likewise.
3663 (class Binary_expression): Add alignment_pointer parameter to
3664 left_value and right_value. Change all callers.
3665 (BINARY_EXPRESSION): Set result alignment.
3666 (class Trinary_expression): Add alignment_pointer parameter to
3667 arg2_value and arg3_value. Change all callers.
3668 (Trinary_cond::value): Set result alignment.
3669 (Max_expression::value, Min_expression::value): Likewise.
3670 (Align_expression::value): Likewise.
3671 * script-sections.cc (class Sections_element): Add dot_alignment
3672 parameter to set_section_addresses virtual function. Update
3673 instantiations.
3674 (class Output_section_element): Likewise.
3675 (Script_sections::create_segments): Add dot_alignment parameter.
3676 Change all callers.
3677 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3678 (Script_sections::set_phdrs_clause_addresses): Likewise.
3679 * script-sections.h: Update declarations.
3680 * script.h: Update declarations.
3681 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3682 min_p_align.
3683 * testsuite/script_test_3.t: Set large alignment.
3684 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3685 segment has expected alignment.
3686
3687 2010-04-22 Nick Clifton <nickc@redhat.com>
3688
3689 * po/gold.pot: Updated by the Translation project.
3690 * po/vi.po: Updated Vietnamese translation.
3691
3692 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3693
3694 * testsuite/Makefile.am (check_PROGRAMS): Add
3695 icf_virtual_function_folding_test.
3696 * testsuite/Makefile.in: Regenerated.
3697
3698 2010-04-15 Andrew Haley <aph@redhat.com>
3699
3700 * options.h (merge_exidx_entries): New option.
3701 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3702 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3703 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3704 (Target_arm::merge_exidx_entries): New function.
3705 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3706 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3707 to Arm_exidx_fixup constructor.
3708 Add new arg, merge_exidx_entries.
3709 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3710 Arm_output_section::fix_exidx_coverage.
3711
3712 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3713
3714 * icf.cc (get_section_contents): Check for preemptible functions.
3715 Ignore addend when appropriate.
3716 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3717 section folded.
3718 (add_from_relobj): Check for section folded.
3719 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3720 * symtab.h (should_add_dynsym_entry): Add new parameter.
3721 * target-reloc.h (scan_relocs): Check for section folded.
3722 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3723 Check reloc types for function pointers in shared objects.
3724 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3725 case.
3726 (icf_preemptible_functions_test): New test case.
3727 (icf_string_merge_test): New test case.
3728 * testsuite.Makefile.in: Regenerate.
3729 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3730 bar_glob. Refactor code.
3731 * testsuite/icf_preemptible_functions_test.cc: New file.
3732 * testsuite/icf_preemptible_functions_test.sh: New file.
3733 * testsuite/icf_string_merge_test.cc: New file.
3734 * testsuite/icf_string_merge_test.sh: New file.
3735 * testsuite/icf_virtual_function_folding_test.cc: New file.
3736 * testsuite/icf_virtual_function_folding_test.sh: New file.
3737
3738 2010-04-14 Doug Kwan <dougkwan@google.com>
3739
3740 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3741 for local symbol recounting if we remove a section due to ICF.
3742 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3743 there are no regular objects in input.
3744
3745 2010-04-13 Doug Kwan <dougkwan@google.com>
3746
3747 * arm.cc (Arm_input_section::set_final_data_size): Compute
3748 accurate final data size instead of using current data size.
3749
3750 2010-04-09 Doug Kwan <dougkwan@google.com>
3751
3752 * layout.cc (Layout::choose_output_section): Handle script section
3753 types.
3754 (Layout::make_output_section_for_script): Add section type parameter.
3755 Handle script section types.
3756 * layout.h (Layout::make_output_section_for_script): Add section
3757 type parameter.
3758 * output.cc (Output_section::Output_section): Initialize data member
3759 is_noload_.
3760 (Output_section::do_reset_address_and_file_offset): Do not set address
3761 to 0 if section is a NOLOAD section.
3762 * output.h (Output_section::is_noload): New method.
3763 (Output_section::set_is_noload): Ditto.
3764 (Output_section::is_noload_): New data member.
3765 * script-c.h (Script_section_type): New enum type.
3766 (struct Parser_output_section_header): Add new file section_type.
3767 * script-sections.cc (Sections_element::output_section_name): Add
3768 parameter for returning script section type.
3769 (Output_section_definition::output_section_name): Ditto.
3770 (Output_section_definition::section_type)P; New method.
3771 (Output_section_definiton::script_section_type_name): Ditto.
3772 (Output_section_definition::script_section_type_): New data member.
3773 (Output_section_definition::Output_section_definition): Initialize
3774 data member Output_section_definition::script_section_type_.
3775 (Output_section_definition::create_sections): Pass script section type
3776 to Layout::make_output_section_for_script.
3777 (Output_section_definition::output_section_name): Return script
3778 section type to caller.
3779 (Output_section_definition::set_section_address): Do not advance
3780 dot value and load address if section type is NOLOAD. Set address
3781 of NOLOAD sections regardless of section flags.
3782 (Output_section_definition::print): Print section type if it is
3783 not SCRIPT_SECTION_TYPE_NONE.
3784 (Output_section_definition::section_type): New method.
3785 (Output_section_definition::script_section_type_name): Ditto.
3786 (Script_sections::output_section_name): Add new parameter
3787 PSECTION_TYPE for returning script section type. Pass it to
3788 section elements. Handle discard sections.
3789 (Sort_output_sections::operator()): Handle NOLOAD sections.
3790 * script-sections.h (Script_sections::Section_type): New enum type.
3791 (Script_sections::output_section_name): Add a new parameter for
3792 returning script section type.
3793 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3794 INFO and NOLOAD.
3795 * yyscript.y (union): Add new field SECTION_TYPE.
3796 (COPY, DSECT, INFO, NOLOAD): New tokens.
3797 (opt_address_and_section_type): Change type to output_section_header.
3798 (section_type): New non-terminal
3799 (section_header): Handle section type.
3800 (opt_address_and_section_type): Return section type value.
3801
3802 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3803
3804 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3805 * testsuite/plugin_common_test_2.c (foo): Likewise.
3806
3807 2010-04-08 Doug Kwan <dougkwan@google.com>
3808
3809 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3810 Output_merge_data.
3811 * output.cc (Output_section::add_merge_input_section): Simplify
3812 code and return status of Output_merge_base::add_input_section.
3813 Update merge section map only if Output_merge_base::add_input_section
3814 returns true.
3815
3816 2010-04-07 Doug Kwan <dougkwan@google.com>
3817
3818 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3819 if section is marked as containing instructions but has no mapping
3820 symbols.
3821 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3822 correct section index.
3823 (Arm_relobj::find_linked_text_section): Ditto.
3824
3825 2010-04-07 Cary Coutant <ccoutant@google.com>
3826
3827 * archive.cc (include_member): Destroy Read_symbols_data object before
3828 releasing file.
3829 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3830 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3831 (Read_symbols_data::~Read_symbols_data) New destructor.
3832 (Section_relocs::Section_relocs) New constructor.
3833 (Section_relocs::~Section_relocs) New destructor.
3834 (Read_relocs_data::Read_relocs_data) New constructor.
3835 (Read_relocs_data::~Read_relocs_data) New destructor.
3836 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3837 pointers to NULL after deleting.
3838
3839 2010-04-07 Doug Kwan <dougkwan@google.com>
3840
3841 * arm.cc: Replace "endianity" with "endianness" in comments.
3842 (Arm_exidx_cantunwind): Ditto.
3843 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3844 (Arm_relobj::merge_flags_and_attributes): New method.
3845 (Arm_relobj::merge_flags_and_attributes_): New data member.
3846 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3847 (Arm_relobj::scan_sections_for_stubs): Ditto.
3848 (Arm_relobj::do_read_symbols): Check to see if we really want to
3849 merge processor-specific flags and attributes. Exit early if
3850 an object is empty except for section names and the undefined symbol.
3851 (Target_arm::do_finalize_sections): Move check for ELF format to
3852 Arm_relobj::do_read_symbols. Merge processor specific flags and
3853 attributes from a regular object only when we have determined that
3854 it is aapropriate. Do not create an .ARM.attributes section in
3855 output if there is no regular input object.
3856 (Target_arm::merge_processor_specific_flags): Check
3857 --warn-mismatch before printing any error.
3858 (Target_arm::merge_object_attributes): Ditto.
3859 * gold.cc (queue_middle_tasks): Handle the case in which there is
3860 no regular object in input.
3861 * options.cc (General_options::parse_EB): New method.
3862 (General_options::parse_EL): Same.
3863 (General_options::General_options): Initialize endianness_.
3864 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3865 New options.
3866 (General_options::Endianness): New enum.
3867 (General_options::endianness): New method.
3868 (General_options::endianness_): New data member.
3869 * parameters.cc (Parameters::set_options): Check target endianness.
3870 (Parameters::set_target_once): Ditto.
3871 (Parameters::check_target_endianness): New method.
3872 (parameters_force_valid_target): If either -EL or -EB is specified,
3873 use it to define endianness of default target.
3874 * parameters.h (Parameters::check_target_endianness): New method
3875 declaration.
3876 * target.h (class Target): Change "endianity" to "endianness"
3877 in comments.
3878
3879 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3880
3881 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3882 * configure: Regenerate.
3883 * Makefile.in: Regenerate.
3884 * testsuite/Makefile.in: Regenerate.
3885
3886 2010-04-06 Cary Coutant <ccoutant@google.com>
3887
3888 gcc PR lto/42757
3889 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3890 prevailing definitions of common symbols.
3891 * testsuite/plugin_test_6.sh: New test case.
3892 * testsuite/plugin_common_test_1.c: New test case.
3893 * testsuite/plugin_common_test_2.c: New test case.
3894 * testsuite/Makefile.am (plugin_test_6): New test case.
3895 * testsuite/Makefile.in: Regenerate.
3896
3897 2010-04-06 Nick Clifton <nickc@redhat.com>
3898
3899 * po/vi.po: New Vietnamese translation.
3900
3901 2010-03-30 Doug Kwan <dougkwan@google.com>
3902
3903 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3904
3905 2010-03-25 Doug Kwan <dougkwan@google.com>
3906
3907 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3908 to avoid a conversion warning on a 32-bit host.
3909
3910 2010-03-24 Ian Lance Taylor <iant@google.com>
3911
3912 * testsuite/script_test_3.t: Add a TLS segment.
3913 * testsuite/Makefile.am (check_PROGRAMS): Add
3914 tls_phdrs_script_test.
3915 (tls_phdrs_script_test_SOURCES): Define.
3916 (tls_phdrs_script_test_DEPENDENCIES): Define.
3917 (tls_phdrs_script_test_LDFLAGS): Define.
3918 (tls_phdrs_script_test_LDADD): Define.
3919 * testsuite/Makefile.in: Rebuild.
3920
3921 2010-03-23 Cary Coutant <ccoutant@google.com>
3922
3923 * fileread.cc (find_or_make_view): Fix comment.
3924
3925 2010-03-23 Ian Lance Taylor <iant@google.com>
3926
3927 * script-sections.cc (class Orphan_section_placement): Define
3928 PLACE_TLS and PLACE_TLS_BSS.
3929 (Orphan_section_placement::Orphan_section_placement): Initialize
3930 new places.
3931 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3932 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3933 (tls_script_test_SOURCES): Define.
3934 (tls_script_test_DEPENDENCIES): Define.
3935 (tls_script_test_LDFLAGS): Define.
3936 (tls_script_test_LDADD): Define.
3937 * testsuite/Makefile.in: Rebuild.
3938
3939 2010-03-22 Doug Kwan <dougkwan@google.com>
3940
3941 * arm.cc (Arm_relocate_functions::abs8,
3942 Arm_relocate_functions::abs16): Use correct check for overflow
3943 specified in the ARM ELF specs.
3944 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
3945 target of a BLX instruction specially.
3946 (Reloc_stub::stub_type_for_reloc): Ditto.
3947 (Relocate::relocate): Use symbolic names instead of numeric relocation
3948 codes to report error.
3949 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
3950 workaround.
3951 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
3952 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
3953 thumb2_blx_out_of_range.stdout
3954 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
3955 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
3956 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
3957 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
3958 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
3959 thumb2_blx_in_range, thumb2_blx_in_range.o,
3960 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
3961 thumb2_blx_out_of_range.o): New rules.
3962 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
3963 thumb2_blx_in_range and thumb2_blx_out_of_range.
3964 * testsuite/Makefile.in: Regenerate.
3965 * arm_branch_in_range.sh: Add tests for THUMB BLX.
3966 * testsuite/thumb_blx_in_range.s: New file.
3967 * testsuite/thumb_blx_out_of_range.s: New file.
3968
3969 2010-03-22 Rafael Espindola <espindola@google.com>
3970
3971 * archive.cc (Should_include): Move to archive.h.
3972 (should_include_member): Make it a member of Archive.
3973 (Lib_group): New.
3974 (Add_lib_group_symbols): New.
3975 * archive.h: Include options.h.
3976 (Archive_member): Moved from Archive.
3977 (Should_include): Moved from archive.cc.
3978 (Lib_group): New.
3979 (Add_lib_group_symbols): New.
3980 * dynobj.cc (do_should_include_member): New.
3981 * dynobj.h (do_should_include_member): New.
3982 * gold.cc (queue_initial_tasks): Update call to queue.
3983 * main.cc (main): Print lib group stats.
3984 * object.cc (do_should_include_member): New.
3985 * object.h: Include archive.h.
3986 (Object::should_include_member): New.
3987 (Object::do_should_include_member): New.
3988 (Sized_relobj::do_should_include_member): New.
3989 * options.cc (General_options::parse_start_lib): New.
3990 (General_options::parse_end_lib): New.
3991 (Input_arguments::add_file): Handle lib groups.
3992 (Input_arguments::start_group): Check we are not in a lib.
3993 (Input_arguments::start_lib): New.
3994 (Input_arguments::end_lib): New.
3995 * options.h (General_options): Add start_lib and end_lib.
3996 (Input_argument::lib_): New.
3997 (Input_argument::lib): New.
3998 (Input_argument::is_lib): New.
3999 (Input_file_lib): New.
4000 (Input_arguments::in_lib_): New.
4001 (Input_arguments::in_lib): New.
4002 (Input_arguments::start_lib): New.
4003 (Input_arguments::end_lib_): New.
4004 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4005 in unused members as preempted.
4006 (Sized_pluginobj::do_should_include_member): New.
4007 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4008 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4009 return the blocker.
4010 (Read_symbols::do_whole_lib_group): New.
4011 (Read_symbols::do_lib_group): New.
4012 (Read_symbols::do_read_symbols): Handle lib groups.
4013 (Read_symbols::get_name): Handle lib groups.
4014 * readsyms.h (Read_symbols): Add an archive member pointer.
4015 (Read_symbols::do_whole_lib_group): New.
4016 (Read_symbols::do_lib_group): New.
4017 (Read_symbols::member_): New.
4018 * script.cc (read_input_script): Update call to queue_soon.
4019
4020 2010-03-19 Doug Kwan <dougkwan@google.com>
4021
4022 * arm.cc (Stub_table::Stub_table): Initialize new data members
4023 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4024 (Stub_table::add_reloc_stub): Assign stub offset and update
4025 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4026 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4027 New data members.
4028 (Stub_table::update_data_size_and_addralign): Use
4029 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4030 instead of going over all reloc stubs.
4031 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4032 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4033 Stringpool_template::offset_ to size of Stringpool_char.
4034 (Stringpool_template::new_key_offset): Remove code to initialize
4035 Stringpool_template::offset_.
4036 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4037 Stringpool_template::offset_ to zero.
4038
4039 2010-03-15 Doug Kwan <dougkwan@google.com>
4040
4041 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4042 offset_.
4043 (Stringpool_template::new_key_offset): New method.
4044 (Stringpool_template::add_string): Assign offsets when adding new
4045 strings.
4046 (Stringpool_template::set_string_offsets): Do not set string offsets
4047 when not optimizing.
4048 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4049 member size_.
4050 (Chunked_vector::clear): Clear size_.
4051 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4052 (Chunked_vector::size): Return size_.
4053 (Chunked_vector::push_back): Use size_ to find insert position.
4054 (Chunked_vector::size_): New data member.
4055 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4056 (Stringpool_template::new_key_offset): New method declaration.
4057 (Stringpool_template::offset_): New data member.
4058
4059 2010-03-15 Rafael Espindola <espindola@google.com>
4060
4061 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4062 Add_symbols' constructor.
4063 * readsyms.h (Add_symbols): Remove the input_group member.
4064
4065 2010-03-10 Ian Lance Taylor <iant@google.com>
4066
4067 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4068 target to ask whether a reference to a symbol requires a stack
4069 split.
4070 * target.h (Target::is_call_to_non_split): New function.
4071 (Target::do_is_call_to_non_split): Declare virtual function.
4072 * target.cc: Include "symtab.h".
4073 (Target::do_is_call_to_non_split): New function.
4074 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4075
4076 2010-03-10 Cary Coutant <ccoutant@google.com>
4077
4078 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4079 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4080 (File_read::open[2]): Add whole_file_view_ to list of views.
4081 (File_read::make_view): Remove test of whole_file_view_.
4082 (File_read::find_or_make_view): Create whole_file_view_ if
4083 necessary.
4084 (File_read::clear_views): Replace bool parameter with enum;
4085 adjust all callers. Don't delete views with permanent data;
4086 do delete cached views and views from archives if
4087 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4088 if clearing the corresponding view.
4089 * fileread.h (File_read::Clear_views_mode): New enum.
4090 (File_read::View::is_permanent_view): New method.
4091 (File_read::clear_views): Replace bool parameter
4092 with enum; adjust all callers.
4093 * options.h (General_options): Change keep_files_mapped option;
4094 add map_whole_files.
4095 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4096 releasing the file.
4097 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4098 the file.
4099
4100 2010-03-10 David S. Miller <davem@davemloft.net>
4101
4102 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4103
4104 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4105
4106 * icf.cc (get_section_contents): Add '@' marker after processing the
4107 merge reloc.
4108
4109 2010-03-08 Doug Kwan <dougkwan@google.com>
4110
4111 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4112 due to a conversion warning.
4113 (Arm_relobj::update_output_local_symbol_count): Check for local
4114 symbol with unset output index.
4115
4116 2010-03-05 Ian Lance Taylor <iant@google.com>
4117
4118 * options.h (class General_options): Add --spare-dynamic-tags.
4119 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4120 --spare-dynamic-tags.
4121
4122 2010-03-05 Ian Lance Taylor <iant@google.com>
4123
4124 * incremental.cc: Include "libiberty.h".
4125
4126 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4127
4128 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4129 function, is_info_ member.
4130 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4131 (Versions::Versions): Update caller.
4132 (Versions::define_base_version): Likewise.
4133 (Versions::add_def): Likewise.
4134
4135 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4136
4137 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4138 (Scan::possible_function_pointer_reloc): New function.
4139 (Scan::local_reloc_may_be_function_pointer): Change to call
4140 possible_function_pointer_reloc.
4141 (Scan::global_reloc_may_be_function_pointer): Ditto.
4142 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4143 relocations in ".data.rel.ro._ZTV" section.
4144 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4145 * testsuite/icf_safe_so_test.cc: Ditto.
4146 * testsuite/icf_safe_test.cc: Ditto.
4147 * testsuite/icf_safe_test.sh: Ditto.
4148
4149 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4150 Ian Lance Taylor <iant@google.com>
4151
4152 * target-reloc.h (relocate_section): Check the symbol table index
4153 for -1U before setting the local symbol index.
4154 (scan_relocatable_relocs): If copying the relocation, record that
4155 the local symbol is required.
4156 * object.h (Symbol_value::is_output_symtab_index_set): New
4157 function.
4158 (Symbol_value::may_be_discarded_from_output_symtab): New
4159 function.
4160 (Symbol_value::has_output_symtab_entry): New function.
4161 (Symbol_value::needs_output_symtab_entry): Remove.
4162 (Symbol_value::output_symtab_index): Make sure the symbol index is
4163 set.
4164 (Symbol_value::set_output_symtab_index): Make sure the symbol
4165 index is not set. Make sure the new index is valid.
4166 (Symbol_value::set_must_have_output_symtab_entry): New function.
4167 (Symbol_value::has_output_dynsym_entry): New function.
4168 (Symbol_value::set_output_dynsym_index): Make sure the new index
4169 is valid.
4170 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4171 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4172 local symbol if permitted.
4173 (Sized_relobj::do_finalize_local_symbols): Call
4174 is_output_symtab_index_set rather than needs_output_symtab_entry.
4175 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4176 rather than needs_output_symtab_entry. Call
4177 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4178 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4179 is_output_symtab_index_set rather than needs_output_symtab_entry.
4180 * testsuite/discard_locals_relocatable_test.c: New file.
4181 * testsuite/discard_locals_test.sh: Test -r.
4182 * testsuite/Makefile.am (check_DATA): Add
4183 discard_locals_relocatable_test1.syms,
4184 discard_local_relocatable_test2.syms.
4185 (MOSTLYCLEANFILES): Likewise. Also add
4186 discard_locals_relocatable_test1.lout and
4187 discard_locals_relocatable_test2.out.
4188 (discard_locals_relocatable_test1.syms): New target.
4189 (discard_locals_relocatable_test.o): New target.
4190 (discard_locals_relocatable_test1.out): New target.
4191 (discard_locals_relocatable_test2.syms): New target.
4192 (discard_locals_relocatable_test2.out): New target.
4193 (various): Add missing ../ld-new dependencies.
4194 * testsuite/Makefile.in: Rebuild.
4195
4196 2010-03-03 Nick Clifton <nickc@redhat.com>
4197
4198 * po/fi.po: New Finnish translation.
4199
4200 2010-03-01 Doug Kwan <dougkwan@google.com>
4201
4202 * layout.cc (Layout::Layout): Force section types of .init_array*,
4203 .preinit_array* and .fini_array* sections.
4204 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4205 Fix check of return value of std::string::find.().
4206 (Output_section::Input_section_sort_compare::operator()): Remove
4207 comment about .init_array.
4208 (Output_section::Input_section_sort_init_fini_compare::operator()):
4209 New method.
4210 (Output_section::sort_attached_input_sections): Handle .init_array
4211 and .fini_array specially.
4212 * output.h (Output_section::Inut_section_sort_compare): Update
4213 comment.
4214 (Output_section::Input_section_sort_init_fini_compare): New struct.
4215
4216 2010-02-26 Doug Kwan <dougkwan@google.com>
4217
4218 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4219 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4220 * testsuite/debug_msg.sh: Avoid matching source line number for
4221 use of global variable undef_int.
4222
4223 2010-02-26 Doug Kwan <dougkwan@google.com>
4224
4225 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4226 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4227 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4228 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4229 * options.cc (General_options::General_options): Initialize member
4230 fix_v4bx_.
4231 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4232 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4233 and rm_no_fix_v4bx.stdout
4234 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4235 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4236 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4237 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4238 and arm_no_fix_v4bx.
4239 * Makefile.in: Regenerate.
4240 * testsuite/arm_fix_v4bx.s: New file.
4241 * testsuite/arm_fix_v4bx.sh: Ditto.
4242
4243 2010-02-24 Doug Kwan <dougkwan@google.com>
4244
4245 * arm.cc (Target_arm::got_section): Make the .got section the first
4246 non RELRO section in the data segment.
4247 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4248 suffixes of section names.
4249
4250 2010-02-24 Doug Kwan <dougkwan@google.com>
4251
4252 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4253 flags and attributes merging if an input file is a binary file.
4254 * fileread.cc (Input_file::open): Record format of original file.
4255 * fileread.h (Input_file::Format): New enum type.
4256 (Input_file::Input_file): Initialize data member format_.
4257 (Input_file::format): New method definition.
4258 (Input_file::format_):: New data member.
4259
4260 2010-02-24 Doug Kwan <dougkwan@google.com>
4261
4262 * arm.cc (Arm_output_data_got): New class.
4263 (ARM_TCB_SIZE): New constant
4264 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4265 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4266 If user uses a script with a SECTIONS clause, issue only a warning
4267 for a misplaced EXIDX input section. Otherwise, issue an error.
4268 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4269 garbage collection.
4270 (Target_arm::got_mode_index_entry): Handle static linking.
4271 (Target_arm::Scan::local): Ditto.
4272 (Target_arm::Scan::global): Ditto.
4273 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4274 all incorrectly implemented relocations.
4275 (Target_arm::fix_exidx_coverage): Pass layout to
4276 Arm_output_section::fix_exidx_coverage.
4277 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4278 from ".ARM.exidx." and ".ARM.extab.".
4279
4280 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4281
4282 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4283 section if it does not already exist.
4284 * attributes.cc (Attributes_section_data::Attributes_section_data):
4285 Don't crash if size is zero.
4286
4287 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4288 Ian Lance Taylor <iant@google.com>
4289
4290 * gold.cc (queue_middle_tasks): If no input files were opened,
4291 exit.
4292 * workqueue.h (Task_function::Task_function): Assert that there is
4293 a blocker.
4294
4295 2010-02-22 Doug Kwan <dougkwan@google.com>
4296
4297 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4298 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4299 types to avoid warnings due to different uint64_t implementations
4300 on different hosts.
4301
4302 2010-02-21 Doug Kwan <dougkwan@google.com>
4303
4304 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4305 handling of the maximum backward branch offset.
4306 (Arm_relocate_functions::thumb_branch_common): Ditto.
4307 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4308 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4309 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4310 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4311 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4312 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4313 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4314 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4315 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4316 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4317 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4318 thumb2_bl_out_of_range.o): New rules.
4319 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4320 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4321 thumb2_bl_out_of_range
4322 * testsuite/Makefile.in: Regenerate.
4323 * testsuite/arm_bl_in_range.s: New file.
4324 * testsuite/arm_bl_out_of_range.s: Ditto.
4325 * testsuite/arm_branch_in_range.sh: Ditto.
4326 * testsuite/arm_branch_range.t: Ditto.
4327 * testsuite/thumb2_branch_range.t: Ditto.
4328 * testsuite/thumb_bl_in_range.s: Ditto.
4329 * testsuite/thumb_bl_out_of_range.s: Ditto.
4330 * testsuite/thumb_branch_range.t: Ditto.
4331
4332 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4333
4334 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4335 Add reloc offset information.
4336 * icf.cc (get_section_contents): Change iterators to point to the new
4337 vectors. Add reloc offset information to the contents.
4338 * icf.h (Icf::Sections_reachable_info): New typedef.
4339 (Icf::Sections_reachable_list): New typedef.
4340 (Icf::Offset_info): New typedef.
4341 (Icf::Reloc_info): New struct typedef.
4342 (Icf::Reloc_info_list): New typedef.
4343 (Icf::symbol_reloc_list): Delete method.
4344 (Icf::addend_reloc_list): Delete method.
4345 (Icf::section_reloc_list): Delete method.
4346 (Icf::reloc_info_list): New method.
4347 (Icf::reloc_info_list_): New member.
4348
4349 2010-02-19 Doug Kwan <dougkwan@google.com>
4350
4351 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4352 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4353 * arm.cc (Arm_relocation_functions): New forward declaration.
4354 (Target_arm::Target_arm): Initialize new data members
4355 got_mod_index_offset_ and tls_base_symbol_defined_.
4356 (Target_arm::Relocate::relocate_tls): New method.
4357 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4358 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4359 New methods.
4360 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4361 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4362 (Target_arm::got_mod_index_offset_,
4363 Target_arm::tls_base_symbol_defined_): New data members.
4364 (Target_arm::Scan::local, Target::Scan::global,
4365 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4366 relocations.
4367
4368 2010-02-18 Doug Kwan <dougkwan@google.com>
4369
4370 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4371 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4372 text section as a parameter becuase some broken tools may not set
4373 the link in section header.
4374 (Target_arm::has_got_section): New method.
4375 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4376 without any mapping symbol as data only. Remove warning.
4377 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4378 link in its section header, try to discover the link by inspecting the
4379 REL31 relocation at the beginning of the section.
4380 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4381 in error message.
4382 (Target_arm::Scan::global): Treat any reference to the symbol
4383 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4384
4385 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4386
4387 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4388 (Scan::global_reloc_may_be_function_pointer): New function.
4389 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4390 (Scan::global_reloc_may_be_function_pointer): New function.
4391 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4392 (Scan::global_reloc_may_be_function_pointer): New function.
4393 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4394 (Scan::global_reloc_may_be_function_pointer): New function.
4395 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4396 (Scan::global_reloc_may_be_function_pointer): New function.
4397 (Scan::possible_function_pointer_reloc): New function.
4398 (Target_x86_64::can_check_for_function_pointers): New function.
4399 * gc.h (gc_process_relocs): Scan relocation types to determine if
4400 function pointers were taken for targets that support it.
4401 * icf.cc (Icf::find_identical_sections): Include functions for
4402 folding in safe ICF whose pointer is not taken.
4403 * icf.h (Secn_fptr_taken_set): New typedef.
4404 (fptr_section_id_): New member.
4405 (section_has_function_pointers): New function.
4406 (set_section_has_function_pointers): New function.
4407 (check_section_for_function_pointers): New function.
4408 * options.h: Fix comment for safe ICF option.
4409 * target.h (can_check_for_function_pointers): New function.
4410 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4411 Modify icf_safe_test for X86-64.
4412 * testsuite/Makefile.in: Regenerate.
4413 * testsuite/icf_safe_so_test.cc: New file.
4414 * testsuite/icf_safe_so_test.sh: New file.
4415 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4416 (main): Change to take pointer to function kept_func_3.
4417 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4418 folding is done correctly for X86-64.
4419
4420 2010-02-12 David S. Miller <davem@davemloft.net>
4421
4422 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4423 is_symbolless parameter.
4424 (Output_reloc<SHT_REL>::is_symbolless): New.
4425 (Output_reloc<SHT_REL>::is_symbolless_): New.
4426 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4427 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4428 (Output_reloc<SHT_RELA>::is_symbolless): New.
4429 (Output_data_reloc::add_global): Handle is_symbolless.
4430 (Output_data_reloc::add_global_relative): Likewise.
4431 (Output_data_reloc::add_local): Likewise.
4432 (Output_data_reloc::add_local_relative): Likewise.
4433 (Output_data_reloc::add_symbolless_global_addend): New.
4434 (Output_data_reloc::add_symbolless_local_addend): New.
4435 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4436 is_symbolless.
4437 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4438 instead of ->is_relative_
4439 (Output_reloc::write): Likewise.
4440 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4441 (Output_reloc::write_rel): Simplify.
4442
4443 * sparc.cc (Target_sparc::Scan::local): Use
4444 ->add_symbolless_local_addend as needed.
4445 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4446 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4447 based upon relocation offset.
4448
4449 2010-02-11 Doug Kwan <dougkwan@google.com>
4450
4451 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4452 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4453 beginning of function.
4454 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4455 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4456 parameter is_32bit in calls to should_apply_static_reloc.
4457 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4458 (check_DATA): Add arm_abs_global.stdout.
4459 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4460 arm_abs_global.stdout): New rules.
4461 (MOSTLLYCLEANFILES): Add arm_abs_global
4462 * Makefile.in: Regenerate.
4463 * testsuite/arm_abs_global.s: New file.
4464 * testsuite/arm_abs_global.sh: Ditto.
4465 * testsuite/arm_abs_lib.s: Ditto.
4466
4467 2010-02-11 Ian Lance Taylor <iant@google.com>
4468
4469 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4470 Read_relocs task.
4471 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4472 Allocate_commons_task first.
4473 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4474 task, rather than symtab_lock_.
4475 (Gc_process_relocs::~Gc_process_relocs): New function.
4476 (Gc_process_relocs::is_runnable): Check this_blocker_.
4477 (Gc_process_relocs::locks): Use next_blocker_ rather than
4478 blocker_.
4479 (Scan_relocs::~Scan_relocs): New function.
4480 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4481 symtab_lock_.
4482 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4483 next_blocker_.
4484 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4485 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4486 constructor accordingly.
4487 (class Gc_process_relocs): Likewise.
4488 (class Scan_relocs): Likewise.
4489 * common.h (class Allocate_commons_task): Remove symtab_lock_
4490 field, and corresponding constructor parameter.
4491 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4492 symtab_lock_.
4493 (Allocate_commons_task::locks): Likewise.
4494
4495 2010-02-11 Ian Lance Taylor <iant@google.com>
4496
4497 * gold-threads.h (class Once): Define.
4498 (class Initialize_lock): Rewrite as child of Once.
4499 * gold-threads.cc (class Once_initialize): Define.
4500 (once_pointer_control): New static variable.
4501 (once_pointer, once_arg): New static variables.
4502 (c_run_once): New static function.
4503 (Once::Once, Once::run_once, Once::internal_run): New functions.
4504 (class Initialize_lock_once): Remove.
4505 (initialize_lock_control): Remove.
4506 (initialize_lock_pointer): Remove.
4507 (initialize_lock_once): Remove.
4508 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4509 (Initialize_lock::initialize): Rewrite.
4510 (Initialize_lock::do_run_once): New function.
4511 * archive.cc (Archive::interpret_header): Only clear name if it is
4512 not already empty.
4513 * fileread.cc: Include "gold-threads.h"
4514 (file_counts_lock): New static variable.
4515 (file_counts_initialize_lock): Likewise.
4516 (File_read::release): Only increment counts when using --stats.
4517 Use a lock around the increment.
4518 * parameters.cc (class Set_parameters_target_once): Define.
4519 (set_parameters_target_once): New static variable.
4520 (Parameters::Parameters): Move here from parameters.h.
4521 (Parameters::set_target): Rewrite.
4522 (Parameters::set_target_once): New function.
4523 (Parameters::clear_target): Move here and rewrite.
4524 * parameters.h (class Parameters): Update declarations. Add
4525 set_parameters_target_once_ field.
4526 (Parameters::Parameters): Move to parameters.cc.
4527 (Parameters::clear_target): Likewise.
4528 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4529 task.
4530 (Start_group::~Start_group): New function.
4531 (Start_group::is_runnable): New function.
4532 (Start_group::locks, Start_group::run): New functions.
4533 (Finish_group::run): Change saw_undefined to size_t.
4534 * readsyms.h (class Start_group): Define.
4535 (class Finish_group): Change saw_undefined_ field to size_t.
4536 (Finish_group::Finish_group): Remove saw_undefined and
4537 this_blocker parameters. Change all callers.
4538 (Finish_group::set_saw_undefined): New function.
4539 (Finish_group::set_blocker): New function.
4540 * symtab.h (class Symbol_table): Change saw_undefined to return
4541 size_t. Change saw_undefined_ field to size_t.
4542 * target-select.cc (Set_target_once::do_run_once): New function.
4543 (Target_selector::Target_selector): Initialize set_target_once_
4544 field. Don't initialize lock_ and initialize_lock_ fields.
4545 (Target_selector::instantiate_target): Rewrite.
4546 (Target_selector::set_target): New function.
4547 * target-select.h (class Set_target_once): Define.
4548 (class Target_selector): Update declarations. Make
4549 Set_target_once a friend. Remove lock_ and initialize_lock_
4550 fields. Add set_target_once_ field.
4551
4552 2010-02-10 Ian Lance Taylor <iant@google.com>
4553
4554 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4555 queueing any tasks.
4556 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4557 (queue_middle_tasks): Add all blockers before queueing any tasks.
4558 (queue_final_tasks): Likewise.
4559 * token.h (Task_token::add_blockers): New function.
4560 * object.h (Input_objects::number_of_relobjs): New function.
4561
4562 2010-02-10 Ian Lance Taylor <iant@google.com>
4563
4564 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4565 shared, not if not position independent.
4566 * x86_64.cc (Relocate::relocate_tls): Likewise.
4567 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4568 (tls_pie_pic_test): New target.
4569 * testsuite/Makefile.in: Rebuild.
4570
4571 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4572 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4573 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4574 * testsuite/Makefile.in: Rebuild.
4575
4576 2010-02-09 David S. Miller <davem@davemloft.net>
4577
4578 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4579 R_SPARC_RELATIVE using ->add_local_relative().
4580 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4581
4582 * output.h (Output_data_dynamic::add_section_size): New method
4583 that takes two Output_data objects.
4584 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4585 entry param. Handle it in initializers.
4586 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4587 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4588 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4589 arg.
4590 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4591 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4592 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4593 for dynrel_includes_plt.
4594 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4595 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4596 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4597 before .rela.plt
4598 (Target_sparc::do_finalize_sections): Update to pass true for
4599 dynrel_includes_plt.
4600 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4601 output before .rela.plt
4602 (Target_powerpc::do_finalize_sections): Update to pass true for
4603 dynrel_includes_plt when 32-bit.
4604
4605 2010-02-08 Doug Kwan <dougkwan@google.com>
4606
4607 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4608 method.
4609 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4610 Arm_relobj::scan_section_for_cortex_a8_stubs,
4611 Arm_relobj::do_relocation_section): Instead of calling
4612 Output_section::output_address, use faster
4613 Arm_relobj::simple_input_section_output_address.
4614
4615 2010-02-08 David S. Miller <davem@davemloft.net>
4616
4617 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4618 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4619 relocation helper function.
4620
4621 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4622 just like R_SPARC_GOT{10,13,22}.
4623 (Target_sparc::Scan::local): Likewise.
4624 (Target_sparc::Relocate:relocate): Likewise.
4625
4626 2010-02-06 Ian Lance Taylor <iant@google.com>
4627
4628 * configure.ac: Rewrite targetobjs duplicate removal code to use
4629 only shell constructs.
4630 * configure: Rebuild.
4631
4632 2010-02-05 Doug Kwan <dougkwan@google.com>
4633
4634 PR 11247
4635 * arm.cc (Arm_relobj::section_is_scannable): New method.
4636 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4637 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4638
4639 2010-02-04 Doug Kwan <dougkwan@google.com>
4640
4641 PR 11247
4642 * arm-reloc-property.cc (cstdio): Include.
4643 * configure.ac (targetobjs): Remove duplicates.
4644 * configure: Regenerate.
4645 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4646 big and little endian version for a given address size.
4647
4648 2010-02-03 Doug Kwan <dougkwan@google.com>
4649
4650 * arm-reloc-property.cc
4651 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4652 definition.
4653 * arm-reloc-property.h
4654 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4655 New method definition.
4656 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4657 declaration.
4658 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4659 overflow to N.
4660 (GOT_PREL): Change implemented to Y.
4661 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4662 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4663 (Arm_relocate_functions::movw_abs_nc): Remove method.
4664 (Arm_relocate_functions::movt_abs): Ditto.
4665 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4666 (Arm_relocate_functions::thm_movt_abs): Ditto.
4667 (Arm_relocate_functions::movw_rel_nc): Ditto.
4668 (Arm_relocate_functions::movw_rel): Ditto.
4669 (Arm_relocate_functions::movt_rel): Ditto.
4670 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4671 (Arm_relocate_functions:thm_movw_rel): Ditto.
4672 (Arm_relocate_functions:thm_movt_rel): Ditto.
4673 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4674 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4675 New method definitions.
4676 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4677 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4678 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4679 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4680 (Target_arm::Relocate::relocate): Check for non-static or
4681 unimplemented relocation code and exit early. Change calls to
4682 Target_arm::reloc_uses_thumb_bit and
4683 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4684 instead. Refactor code to handle similar relocations to increase
4685 code sharing. Remove check for unsupported relocation code in switch
4686 statement.
4687 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4688 relocation property table to find out size. Change error message to
4689 print out the name of a relocation code instead of the numeric value.
4690 (Target_arm::scan_reloc_for_stub): Use relocation property table
4691 instead of calling Target_arm::reloc_uses_thumb_bit().
4692
4693 2010-02-02 Doug Kwan <dougkwan@google.com>
4694
4695 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4696 types of relaxed input section.
4697
4698 2010-02-02 Doug Kwan <dougkwan@google.com>
4699
4700 * Makefile.am (HFILES): Add arm-reloc-property.h.
4701 (DEFFILES): New.
4702 (TARGETSOURCES): Add arm-reloc-property.cc
4703 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4704 (libgold_a_SOURCES): $(DEFFILES)
4705 * Makefile.in: Regenerate.
4706 * arm-reloc-property.cc: New file.
4707 * arm-reloc-property.h: New file.
4708 * arm-reloc.def: New file.
4709 * arm.cc: Update comments.
4710 (arm-reloc-property.h): New included header.
4711 (arm_reloc_property_table): New global variable.
4712 (Target_arm::do_select_as_default_target): New method definition.
4713 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4714 arm-reloc-property to targ_extra_obj.
4715 * parameters.cc (set_parameters_target): Call
4716 Target::select_as_default_target().
4717 * target.h (Target::select_as_default_target): New method definition.
4718 (Target::do_select_as_default_target): Same.
4719
4720 2010-02-01 Doug Kwan <dougkwan@google.com>
4721
4722 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4723 first_output_text_section_.
4724 (Arm_exidx_fixup::first_output_text_section): New method definition.
4725 (Arm_exidx_fixup::first_output_text_section_): New data member.
4726 (Arm_exidx_fixup::process_exidx_section): Record the first text
4727 output section seen.
4728 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4729 and entsize in output section header.
4730
4731 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4732
4733 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4734 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4735 (Arm_relocate_functions::thm_alu11): New Method.
4736 (Arm_relocate_functions::thm_pc8): New Method.
4737 (Arm_relocate_functions::thm_pc12): New Method.
4738 (Target_arm::Scan::local): Handle the relocations.
4739 (Target_arm::Scan::global): Likewise.
4740 (Target_arm::Relocate::relocate): Likewise.
4741 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4742
4743 2010-01-29 Doug Kwan <dougkwan@google.com>
4744
4745 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4746 of relocation types as ld.
4747
4748 2010-01-29 Doug Kwan <dougkwan@google.com>
4749
4750 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4751 to public.
4752 (Arm_relocate_functions::thumb_branch_common): Ditto.
4753 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4754 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4755 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4756 Arm_relocate_functions::jump24): Remove.
4757 (Target_arm::Relocate::relocate): Adjust code to call
4758 Arm_relocation_functions::arm_branch_common and
4759 Arm_relocation_functions::thumb_branch_common instead of their removed
4760 wrappers. Merge switch-cases together to reduce source code size.
4761
4762 2010-01-29 Doug Kwan <dougkwan@google.com>
4763
4764 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4765 output_local_symbol_count_needs_update_.
4766 (Arm_relobj::output_local_symbol_count_needs_update,
4767 Arm_relobj::set_output_local_symbol_count_needs_update,
4768 Arm_relobj::update_output_local_symbol_count): New methods.
4769 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4770 member.
4771 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4772 of pointed function as in a R_ARM_PREL31 relocation.
4773 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4774 for output local symbol count updating.
4775 (Target_arm::do_relax): Update output local symbol counts in objects
4776 if necessary.
4777 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4778
4779 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4780
4781 * arm.cc: Added support for the ARM relocations:
4782 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4783 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4784 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4785 movw_prel_nc).
4786 (Arm_relocate_functions::movw_rel): New method.
4787 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4788 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4789 thm_movw_prel_nc).
4790 (Arm_relocate_functions::thm_movw_rel): New method.
4791 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4792 thm_movt_prel).
4793 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4794 relocations.
4795 (Target_arm::Scan::global): Likewise.
4796 (Target_arm::Relocate::relocate): Likewise.
4797 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4798 Likewise.
4799
4800 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4801
4802 * arm.cc: Added support for ARM group relocations.
4803 (Target_arm::reloc_needs_sym_origin): New method.
4804 (Arm_relocate_functions::calc_grp_kn): New method.
4805 (Arm_relocate_functions::calc_grp_residual): New method.
4806 (Arm_relocate_functions::calc_grp_gn): New method.
4807 (Arm_relocate_functions::arm_grp_alu): New Method.
4808 (Arm_relocate_functions::arm_grp_ldr): New Method.
4809 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4810 (Arm_relocate_functions::arm_grp_ldc): New Method.
4811 (Target_arm::Scan::local): Handle the ARM group relocations.
4812 (Target_arm::Scan::global): Likewise.
4813 (Target_arm::Relocate::relocate): Likewise.
4814 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4815 Likewise.
4816
4817 2010-01-26 Doug Kwan <dougkwan@google.com>
4818
4819 * arm.cc (set): Include.
4820 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4821 pointer type.
4822 (Arm_output_section::Text_section_list): New type.
4823 (Arm_output_section::append_text_sections_to_list): New method.
4824 (Arm_output_section::fix_exidx_coverage): Ditto.
4825 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4826 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4827 Relobj::set_section_offset() instead of
4828 Sized_relobj::invalidate_section_offset().
4829 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4830 parameter for section headers. Ignore relocation sections for
4831 unallocated sections and EXIDX sections.
4832 (Target_arm::fix_exidx_coverage): New method.
4833 (Target_arm::output_section_address_less_than): New type.
4834 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4835 linked text section instead of the EXIDX section.
4836 (Arm_output_section::create_stub_group): Add an assertion to check
4837 that this is not an EXIDX output section.
4838 (Arm_output_section::append_text_sections_to_list): New method.
4839 (Arm_output_section::fix_exidx_coverage): Ditto.
4840 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4841 Arm_relobj::section_needs_reloc_stub_scanning.
4842 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4843 first pass.
4844 (Target_arm::fix_exidx_coverage): New method.
4845 * object.h (Relobj::set_output_section): New method.
4846 (Sized_relobj::invalidate_section_offset): Remove method.
4847 (Sized_relobj::do_invalidate_section_offset): Remove method.
4848 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4849
4850 2010-01-25 Doug Kwan <dougkwan@google.com>
4851
4852 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4853 Fix warning due to signed and unsigned comparison on a 32-bit host.
4854
4855 2010-01-22 Doug Kwan <dougkwan@google.com>
4856
4857 * arm.cc (Target_arm::do_relax): Record an output section for section
4858 offset adjustment it contains any stub table that has changed.
4859 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4860 offsets in an output section if necessary.
4861 * output.cc (Output_section::Output_section): Initialize
4862 section_offsets_need_adjustments_.
4863 (Output_section::add_input_section_for_script): Renamed to
4864 Output_section::add_simple_input_section.
4865 (Output_section::save_states): Add a comment.
4866 (Output_section::discard_states): New method defintion.
4867 (Output_section::adjust_section_offsets): Same.
4868 * output.h (Output_section::add_input_section_for_script): Renamed to
4869 Output_section::add_simple_input_section.
4870 (Output_section::discard_states): New method declaration.
4871 (Output_section::adjust_section_offsets): Same.
4872 (Output_section::section_offsets_need_adjustment,
4873 Output_section::set_section_offsets_need_adjustment): New method
4874 definitions.
4875 (Output_section::section_offsets_need_adjustment_): New data member.
4876 * script-sections.cc
4877 (Output_section_element_input::set_section_address): Adjust code for
4878 renaming of Output_section::add_input_section_for_script.
4879 (Orphan_output_section::set_section_address): Same.
4880
4881 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4882
4883 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4884 Fix_v4bx enum values .
4885 * gold/options.h (General_options): New option definitions.
4886 (General_options::fix_v4bx): New method.
4887 (General_options::Fix_v4bx): New enum.
4888 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4889 (General_options::parse_fix_v4bx_interworking): New method.
4890
4891 2010-01-22 Doug Kwan <dougkwan@google.com>
4892
4893 * arm.cc (Arm_exidx_fixup): New class.
4894
4895 2010-01-21 Doug Kwan <dougkwan@google.com>
4896
4897 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4898 classes.
4899 (Arm_exidx_section_offset_map): New type.
4900
4901 2010-01-21 Doug Kwan <dougkwan@google.com>
4902
4903 * arm.cc (Arm_exidx_input_section): New class.
4904 (Arm_relobj::exidx_input_section_by_link,
4905 Arm_relobj::exidx_input_section_by_shndx,
4906 Arm_relobj::make_exidx_input_section): New methods.
4907 (read_arm_attributes_section): Remove.
4908 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4909 information about them.
4910 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4911 to here.
4912
4913 2010-01-20 Doug Kwan <dougkwan@google.com>
4914
4915 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4916 Input_section_specifier to Section_id.
4917 (Target_arm::new_arm_input_section: Adjust code for change of key
4918 type.
4919 (Target_arm::find_arm_input_section): Ditto.
4920 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4921 (Section_id): Remove.
4922 (Garbage_collection::Section_id_hash): Remove.
4923 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4924 (Section_id): Remove.
4925 (Icf::Section_id_hash): Remove.
4926 * object.h (Section_id, Const_section_id, Section_id_hash,
4927 Const_section_id_hash): New type definitions.
4928 * output.cc (Output_section::add_relaxed_input_section): Change to
4929 use Const_section_id instead of Input_section_specifier as key type.
4930 (Output_section::add_merge_input_section): Ditto.
4931 (Output_section::build_relaxation_map): Change to use Section_id
4932 instead of Input_section_specifier as key type.
4933 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4934 Ditto.
4935 (Output_section::convert_input_sections_to_relaxed_sections): Change
4936 to use Const_section_id instead of Input_section_specifier as key type.
4937 (Output_section::find_merge_section): Ditto.
4938 (Output_section::find_relaxed_input_section): Ditto.
4939 * output.h (Input_section_specifier): Remove class.
4940 (Output_section::Output_section_data_by_input_section_map): Change
4941 key type to Const_section_id.
4942 (Output_section::Output_relaxed_input_section_by_input_section_map):
4943 Ditto.
4944 (Output_section::Relaxation_map): Change key type to Section_id.
4945
4946 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4947
4948 * gold/arm.cc: Added support for R_ARM_V4BX relocation
4949 (class Arm_v4bx_stub): New class.
4950 (DEF_STUBS): Updated definition to support v4_veneer_bx.
4951 (Stub_factory::make_arm_v4bx_stub): New method.
4952 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
4953 (Stub_table::empty): Handle v4bx stubs.
4954 (Stub_table::add_arm_v4bx_stub): New method.
4955 (Stub_table::find_arm_v4bx_stub): New method.
4956 (Arm_relocate_functions::v4bx): New method.
4957 (Target_arm::fix_v4bx): New method.
4958 (Target_arm::Target_arm): Handle R_ARM_V4BX.
4959 (Stub_table::relocate_stubs): Likewise.
4960 (Stub_table::do_write): Likewise.
4961 (Stub_table::update_data_size_and_addralign): Likewise.
4962 (Stub_table::finalize_stubs): Likewise.
4963 (Target_arm::Scan::local): Likewise.
4964 (Target_arm::Scan::global): Likewise.
4965 (Target_arm::do_finalize_sections): Likewise.
4966 (Target_arm::Relocate::relocate): Likewise.
4967 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4968 Likewise.
4969 (Target_arm::scan_reloc_for_stub): Likewise.
4970 (Target_arm::scan_reloc_section_for_stubs): Likewise.
4971
4972 2010-01-19 Ian Lance Taylor <iant@google.com>
4973
4974 * output.cc (Output_section_headers::do_sized_write): Write large
4975 segment count to sh_info field.
4976 (Output_file_header::do_sized_write): For large segment count,
4977 write PN_XNUM to e_phnum field.
4978
4979 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4980
4981 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
4982 (Arm_relocate_functions::thm_jump8): New function.
4983 (Arm_relocate_functions::thm_jump11): New function.
4984 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
4985 R_ARM_THM_JUMP11.
4986 (Target_arm::Scan::global): Likewise.
4987 (Target_arm::Relocate::relocate): Likewise.
4988 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4989 Likewise.
4990
4991 2010-01-14 Doug Kwan <dougkwan@google.com>
4992
4993 * arm.cc (map, utility): Include headers.
4994 (Target_arm::apply_cortex_a8_workaround): New method.
4995 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
4996 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
4997 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
4998 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
4999 the --[no-]fix-cortex-a8 command line options.
5000 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5001 (Target_arm::relocate_stub): Use addend in instruction template.
5002 * options.h (DEFINE_bool): Set the user-set flag.
5003 (General_options): Add --[no-]-fix-cortex options.
5004 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5005 : Update fast look-up map after conversion.
5006
5007 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5008
5009 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5010 in the first pass of do_layout.
5011
5012 2010-01-13 Doug Kwan <dougkwan@google.com>
5013
5014 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5015 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5016 apparent compiler problem of not folding static constant integral
5017 data members of elfcpp::Elf_sizes<32>.
5018
5019 2010-01-13 Doug Kwan <dougkwan@google.com>
5020
5021 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5022 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5023 Arm_relobj::scan_section_for_cortex_a8_erratum,
5024 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5025 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5026 sections to scan for relocation stubs into a new method
5027 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5028 relocation and Cortex-A8 stub scanning.
5029 (Target_arm::do_relax): Force stubs to be after stubbed sections
5030 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5031 the beginning of a new relaxation pass. Update a comment.
5032 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5033
5034 2010-01-12 Ian Lance Taylor <iant@google.com>
5035
5036 * target-reloc.h (visibility_error): New inline function.
5037 (relocate_section): Call visibility_error.
5038 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5039 (MOSTLYCLEANFILES): Likewise.
5040 (protected_4_pic.o, protected_3.err): New targets.
5041 * testsuite/protected_4.cc: New file.
5042
5043 2010-01-12 Doug Kwan <dougkwan@google.com>
5044
5045 * arm.cc (Cortex_a8_reloc): New class.
5046 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5047 and cortex_a8_relocs_info_.
5048 (Target_arm::fix_cortex_a8): New method definition.
5049 (Target_arm::Cortex_a8_relocs_info): New type.
5050 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5051 New data member declarations.
5052 (Target_arm::scan_reloc_for_stub): Record information about
5053 relocations for THUMB branches that might be exempted from the
5054 Cortex-A8 workaround.
5055 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5056 at the beginning of a relaxation pass.
5057
5058 2010-01-12 Doug Kwan <dougkwan@google.com>
5059
5060 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5061 (Arm_relobj::Mapping_symbol_position,
5062 Arm_reloj::Mapping_symbol_position_less,
5063 Arm_relobj::Mapping_symbols_info): New types.
5064 (Target_arm::is_mapping_symbol_name): New method definition.
5065 (Arm_relobj::do_count_local_symbols): Save information about mapping
5066 symbols.
5067
5068 2010-01-11 Doug Kwan <dougkwan@google.com>
5069
5070 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5071 Arm_relocate_functions::thumb32_branch_upper,
5072 Arm_relocate_functions::thumb32_branch_lower,
5073 Arm_relocate_functions::thumb32_cond_branch_offset,
5074 Arm_relocate_functions::thumb32_cond_branch_upper,
5075 Arm_relocate_functions::thumb32_cond_branch_lower,
5076 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5077 branch offset encoding.
5078 (Arm_relocate_functions::thumb_branch_common): Use new branch
5079 offset encoding methods to avoid code duplication.
5080 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5081 (Stub_addend_reader::operator()): Use new branch encoding method
5082 to avoid code duplication.
5083
5084 2010-01-11 Doug Kwan <dougkwan@google.com>
5085
5086 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5087 (Target_arm::do_finalize_sections): Define special EXIDX section
5088 symbols only if referenced.
5089 * gc.h (Garbage_collection::add_reference): New method.
5090 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5091 code duplication.
5092
5093 2010-01-11 Ian Lance Taylor <iant@google.com>
5094
5095 * script.cc (Version_script_info::build_expression_list_lookup):
5096 Change complaing about duplicate wildcard match from error to
5097 warning.
5098
5099 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5100 of 2009-12-30.
5101 (Version_script_info::Version_script_info): Initialize globs_,
5102 default_version_, default_is_global_, and exact_. Don't
5103 initialize globals_ or locals_.
5104 (Version_script_info::build_lookup_tables): Build local symbols
5105 first.
5106 (Version_script_info::unquote): New function.
5107 (Version_script_info::add_exact_match): New function.
5108 (Version_script_info::build_expression_list_lookup): Remove lookup
5109 parameter. Add is_global parameter. Change all callers. Handle
5110 wildcard pattern specially. Unquote pattern. Call
5111 add_exact_match.
5112 (Version_script_info::get_name_to_match): New function.
5113 (Version_script_info::get_symbol_version): New function.
5114 (Version_script_info::get_symbol_version_helper): Remove.
5115 (Version_script_info::check_unmatched_names): Call unquote.
5116 * script.h (class Version_script_info): Change get_symbol_version
5117 to be non-inline and add is_global parameter; change all callers.
5118 Rewrite symbol_is_local. Update declarations. Define struct
5119 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5120 Remove globals_ and locals_ members. Add exact_, globs_,
5121 default_version_, is_global_.
5122 (Version_script_info::Glob): Remove pattern, add expression and
5123 is_global. Update constructor. Change all callers.
5124 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5125 default version.
5126 (Versions::symbol_section_contents): If a symbol is undefined, or
5127 defined in a dynamic object, set the version index to
5128 VER_NDX_LOCAL.
5129 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5130 symbol_is_local.
5131 (Symbol_table::add_from_pluginobj): Likewise.
5132 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5133
5134 2010-01-11 Doug Kwan <dougkwan@google.com>
5135
5136 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5137 (incremental_dump_LDADD): Add linking option for libintl.
5138 * Makefile.in: Regenerate.
5139
5140 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5141
5142 PR gold/11144
5143 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5144 instead of -Ds.
5145 * testsuite/Makefile.in: Regenerated.
5146
5147 2010-01-10 Doug Kwan <dougkwan@google.com>
5148
5149 * options.h (DEFINE_var): Use parentheses around argument varname__
5150 in macro body to avoid any unintended subsequent substitutions.
5151
5152 2010-01-10 Ian Lance Taylor <iant@google.com>
5153
5154 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5155 candidates before doing symbol resolution.
5156
5157 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5158 ODR candidates if only one is weak.
5159
5160 2010-01-08 Ian Lance Taylor <iant@google.com>
5161
5162 * script.cc (Version_script_info::build_expression_list_lookup):
5163 Don't warn about ambiguous version, just record the ambiguity.
5164 (Version_script_info::get_symbol_version_helper): Give error if
5165 version is ambiguous.
5166
5167 2010-01-08 Doug Kwan <dougkwan@google.com>
5168
5169 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5170 prev_data_size_ and prev_addralign_. Remove initializer for
5171 deleted data member has_been_changed_.
5172 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5173 to determine if the table is empty.
5174 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5175 Remove.
5176 (Stub_table::add_reloc_stub): Define method in class definition
5177 instead of just declaring it there.
5178 (Stub_table::add_cortex_a8_stub): New method definition.
5179 (Stub_table::update_data_size_and_addralign): Ditto.
5180 (Stub_table::finalize_stubs): Ditto.
5181 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5182 (Stub_table::do_addralign_): Return address alignment in the
5183 (Stub_table::do_reset_address_and_file_offset): Define method in
5184 class definition instead of declaring it there. Set current data
5185 size to be the data size of the previous pass.
5186 (Stub_table::set_final_data_size): Use current data size as the
5187 final data size.
5188 (Stub_table::relocate_stub): Change parameter type of stub from
5189 Reloc_stub pointer to Stub pointer.
5190 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5191 (Stub_table::Cortex_a8_stub_list): New typedef.
5192 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5193 Stub_table::prev_addralign_): New data member.
5194 (Arm_relobj::Arm_relobj): Initialize data member
5195 section_has_cortex_a8_workaround_.
5196 (Arm_relobj::section_has_cortex_a8_workaround,
5197 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5198 definitions.
5199 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5200 declarations.
5201 (Target_arm::relocate_stub): Change parameter type of stub from
5202 Reloc_stub pointer to Stub pointer.
5203 (Insn_template::size, Insn_template::alignment): Handle
5204 THUMB16_SPECIAL_TYPE.
5205 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5206 Stub_table::update_data_size_and_addralign,
5207 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5208 definitions.
5209 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5210 (Stub_table::do_write): Ditto.
5211 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5212
5213 2010-01-08 Ian Lance Taylor <iant@google.com>
5214
5215 PR 11108
5216 * symtab.h (class Symbol): Remove fields is_target_special_ and
5217 has_plt_offset_. Add field is_defined_in_discarded_section_.
5218 (Symbol::is_defined_in_discarded_section): New function.
5219 (Symbol::set_is_defined_in_discarded_section): New function.
5220 (Symbol::has_plt_offset): Rewrite.
5221 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5222 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5223 Don't initialize is_target_special_ or has_plt_offset_.
5224 Initialize is_defined_in_discarded_section_.
5225 (Symbol_table::add_from_relobj): If appropriate, set
5226 is_defined_in_discarded_section.
5227 * resolve.cc (Symbol::override_base_with_special): Don't test
5228 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5229 * target-reloc.h (relocate_section): Do special handling for
5230 symbols defined in discarded sections for global symbols as well
5231 as local symbols.
5232
5233 2010-01-08 Ian Lance Taylor <iant@google.com>
5234
5235 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5236 the SHT_SYMTAB case.
5237
5238 2010-01-08 Ian Lance Taylor <iant@google.com>
5239
5240 * object.cc (Sized_relobj::do_layout): Don't get confused if
5241 layout_eh_frame returns NULL.
5242
5243 2010-01-08 Ian Lance Taylor <iant@google.com>
5244
5245 PR 11084
5246 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5247 dynamic symbol table, use the normal symbol table.
5248 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5249 symbol table.
5250
5251 2010-01-08 Ian Lance Taylor <iant@google.com>
5252
5253 PR 11072
5254 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5255 sections.
5256
5257 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5258
5259 * version.cc (print_version): Change to "Copyright 2010".
5260
5261 2010-01-08 Ian Lance Taylor <iant@google.com>
5262
5263 PR 10287
5264 PR 11063
5265 * i386.cc (class Target_i386): Change return type of plt_section
5266 to be non-const.
5267 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5268 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5269 tls_desc_rel_ field.
5270 (Output_data_plt_i386::rel_tls_desc): New function.
5271 (Target_i386::rel_tls_desc_section): New function.
5272 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5273 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5274 R_386_TLS_DESC reloc in rel_tls_desc_section.
5275 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5276 Define struct Tlsdesc_info.
5277 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5278 (Target_x86_64::do_reloc_symbol_index): New function.
5279 (Target_x86_64::add_tlsdesc_info): New function.
5280 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5281 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5282 tlsdesc_rel_ field.
5283 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5284 all callers.
5285 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5286 (Target_x86_64::rela_tlsdesc_section): New function.
5287 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5288 handling.
5289 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5290 (Target_x86_64::do_reloc_addend): New function.
5291 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5292 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5293 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5294 (Output_reloc::type): New function.
5295 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5296 (Output_reloc::is_target_specific): New function.
5297 (Output_reloc::target_arg): New function.
5298 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5299 absolute relocs and target specific relocs.
5300 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5301 add_target_specific.
5302 (class Output_data_reloc) [SHT_RELA]: Likewise.
5303 * output.cc (Output_reloc::Output_reloc): Add four new versions
5304 for absolute relocs and target specific relocs.
5305 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5306 (Output_reloc::get_symbol_index): Likewise.
5307 (Output_reloc::local_section_offset): Check that local_sym_index_
5308 is not TARGET_CODE or 0.
5309 (Output_reloc::symbol_value): Likewise.
5310 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5311 reloc.
5312 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5313 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5314 functions.
5315 * layout.cc (add_target_dynamic_tags): Use output section for
5316 DT_PLTRELSZ and DT_JMPREL.
5317
5318 2010-01-07 Ian Lance Taylor <iant@google.com>
5319
5320 PR 11061
5321 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5322 function.
5323 (class Output_data_reloc_generic): Define.
5324 (class Output_data_reloc_base): Change base class to
5325 Output_data_reloc_generic. Change add() method to call
5326 bump_relative_reloc_count for a relative reloc. Remove
5327 sort_relocs_ field.
5328 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5329 to sort_relocs().
5330 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5331 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5332 appropriate.
5333 * layout.h (class Layout): Update declaration.
5334
5335 2010-01-07 Ian Lance Taylor <iant@google.com>
5336
5337 * output.h (class Output_data): Add const version of
5338 output_section and do_output_section.
5339 (class Output_section_data): Add const version of
5340 do_output_section.
5341 (class Output_section): Likewise.
5342 * layout.cc (Layout::add_target_dynamic_tags): New function.
5343 * layout.h (class Layout): Update declarations.
5344 * arm.cc (Target_arm::do_finalize_sections): Use
5345 add_target_dynamic_tags.
5346 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5347 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5348 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5349 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5350
5351 2010-01-07 Ian Lance Taylor <iant@google.com>
5352
5353 PR 11042
5354 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5355 object as needed.
5356
5357 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5358 Ian Lance Taylor <iant@google.com>
5359
5360 PR 11019
5361 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5362 Xindex::read_symtab_xindex.
5363
5364 2010-01-07 Doug Kwan <dougkwan@google.com>
5365
5366 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5367 (Insn_template::thumb16_bcond_insn): New method declaration.
5368 (Insn_template): Fix spelling.
5369 (Stub::thumb16_special): New method declaration.
5370 (Stub::do_write): Define virtual method which was previously pure
5371 virtual.
5372 (Stub::do_thumb16_special): New method declaration.
5373 (Stub::do_fixed_endian_write): New template member.
5374 (Reloc_stub::do_write): Remove.
5375 (Reloc_stub::do_fixed_endian_write): Remove.
5376 (Cortex_a8_stub): New class definition.
5377 (Stub_factory::make_cortex_a8_stub): New method definition.
5378 (Stub_factory::Stub_factory): Add missing static storage class
5379 qualifier for elf32_arm_stub_a8_veneer_blx.
5380
5381 2010-01-07 Ian Lance Taylor <iant@google.com>
5382
5383 PR 10980
5384 * options.h (class General_options): Add --warn-unresolved-symbols
5385 and --error-unresolved-symbols.
5386 * errors.cc (Errors::undefined_symbol): Implement
5387 --warn-unresolved-symbols.
5388
5389 * options.h (class General_options): Add -z text and -z textoff.
5390 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5391
5392 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5393
5394 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5395 (Garbage_collection::cident_sections): New function.
5396 (Garbage_collection::add_cident_section): New function.
5397 (Garbage_collection::cident_sections_): New member.
5398 (gc_process_relocs): Add references to sections whose names are C
5399 identifiers.
5400 * gold.h (cident_section_start_prefix): New constant.
5401 (cident_section_stop_prefix): New constant.
5402 (is_cident): New function.
5403 * layout.cc (Layout::define_section_symbols): Replace string constants
5404 with the newly defined constants.
5405 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5406 C identifiers.
5407 * testsuite/Makefile.am: Add gc_orphan_section_test.
5408 * testsuite/Makefile.in: Regenerate.
5409 * testsuite/gc_orphan_section_test.cc: New file.
5410 * testsuite/gc_orphan_section_test.sh: New file.
5411
5412 2010-01-06 Ian Lance Taylor <iant@google.com>
5413
5414 PR 10980
5415 * options.h (class General_options): Add --warn-shared-textrel.
5416 * layout.cc (Layout::finish_dynamic_section): Implement
5417 --warn-shared-textrel.
5418
5419 PR 10980
5420 * options.h (class General_options): Add --warn-multiple-gp.
5421
5422 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5423
5424 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5425 $(THREADSLIB) and $(LIBDL).
5426 * Makefile.in: Rebuild.
5427
5428 2010-01-06 Ian Lance Taylor <iant@google.com>
5429
5430 PR 10980
5431 * options.cc (General_options::parse_section_start): New function.
5432 (General_options::section_start): New function.
5433 (General_options::General_options): Initialize all members.
5434 * options.h: Include <map>
5435 (class General_options): Add --section-start. Add section_starts_
5436 member.
5437 * layout.cc (Layout::attach_allocated_section_to_segment): If
5438 --section-start was used, set the address of the segment. Remove
5439 local sort_sections.
5440 (Layout::relaxation_loop_body): If the address of the load segment
5441 has been set by --section-start, don't use it.
5442 * output.h (Output_segment::update_flags_for_output_section): New
5443 function.
5444 * output.cc (Output_segment::add_output_section): Call
5445 update_flags_for_output_section.
5446
5447 2010-01-05 Ian Lance Taylor <iant@google.com>
5448
5449 PR 10980
5450 * options.h (class General_options): Add --undefined-version.
5451 * script.cc (struct Version_expression): Add was_matched_by_symbol
5452 field.
5453 (Version_script_info::matched_symbol): New function.
5454 (Version_script_info::get_symbol_version_helper): Call
5455 matched_symbol.
5456 (Version_script_info::check_unmatched_names): New function.
5457 * script.h (class Version_script_info): Update declarations.
5458 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5459
5460 * options.h (class General_options): Use DEFINE_bool_alias for
5461 allow_multiple_definition.
5462 * resolve.cc (Symbol_table::should_override): Don't test
5463 allow_multiple_definition.
5464
5465 PR 10980
5466 * options.h (class General_options): Add --cref.
5467 * main.cc (main): Print cref table if --cref. Don't close mapfile
5468 until after printing cref table.
5469 * cref.cc: Include "symtab.h".
5470 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5471 (Cref_table_compare::operator()): New function.
5472 (Cref_inputs::gather_cref): New function.
5473 (filecol): New static const.
5474 (Cref_inputs::print_cref): New function.
5475 (Cref::print_cref): New function.
5476 * cref.h: Include <cstdio>.
5477 (class Cref): Update declarations.
5478 * mapfile.h (Mapfile::file): New function.
5479 * object.h (class Object): Define Symbols. Declare virtual
5480 do_get_global_symbols.
5481 (Object::get_global_symbols): New function.
5482 * object.cc (Input_objects::add_object): Pass object to cref_ if
5483 --cref.
5484 (Input_objects::archive_start): Likewise.
5485 (Input_objects::archive_stop): Likewise.
5486 (Input_objects::print_cref): New function.
5487 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5488 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5489 --cref.
5490 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5491 function.
5492 * plugin.h (class Sized_pluginobj): Update declarations.
5493
5494 2010-01-05 Ian Lance Taylor <iant@google.com>
5495
5496 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5497 to is_default_version. Rename insdef to insdefault.
5498 (Symbol_table::add_from_relobj): Rename def to is_default_version
5499 and local to is_forced_local.
5500 (Symbol_table::add_from_pluginobj): Likewise.
5501 (Symbol_table::add_from_dynobj): Likewise.
5502 (Symbol_table::define_special_symbol): Rename insdef to
5503 insdefault.
5504
5505 2010-01-04 Ian Lance Taylor <iant@google.com>
5506
5507 PR 10980
5508 * options.h (class General_options): Add
5509 --allow-multiple-definition and -z muldefs.
5510 * resolve.cc (Symbol_table::should_override): Don't warn about a
5511 multiple symbol definition if --allow-multiple-definition or -z
5512 muldefs.
5513
5514 PR 10980
5515 * options.h (class General_options): Add --add-needed and
5516 --copy-dt-needed-entries. Tweak --as-needed help entry.
5517 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5518 error if --copy-dt-needed-entries aka --add-needed is used and
5519 would cause a change in behaviour.
5520
5521 PR 10980
5522 * options.h (class General_options): Add -G as a short version of
5523 --shared. Add no-op options -assert, -g, and -i.
5524
5525 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5526
5527 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5528 check for .text or .gnu.linkonce.t sections.
5529 * icf.cc (Icf::find_identical_sections): Ditto.
5530 Change the detection for mangled function name within the section
5531 name.
5532 * icf.h (is_section_foldable_candidate): New function.
5533
5534 2009-12-30 Ian Lance Taylor <iant@google.com>
5535
5536 PR 10980
5537 * options.h (class General_options): Permit two dashes with
5538 --retain-symbols-file.
5539
5540 2009-12-30 Ian Lance Taylor <iant@google.com>
5541
5542 PR 10979
5543 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5544 don't put the file header and segment headers in the text
5545 segment.
5546
5547 PR 10979
5548 * common.cc (Sort_commons::operator()): Stabilize sort when both
5549 entries are NULL.
5550 (Symbol_table::do_allocate_commons_list): When allocating common
5551 symbols, skip a symbol which is no longer common.
5552 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5553 an object before checking its type.
5554 * testsuite/common_test_2.c: New file.
5555 * testsuite/common_test_3.c: New file.
5556 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5557 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5558 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5559 (common_test_2_pic.o, common_test_2.so): New targets.
5560 (common_test_3_pic.o, common_test_3.so): New targets.
5561 * testsuite/Makefile.in: Rebuild.
5562
5563 PR 10979
5564 * script.cc (read_input_script): If we see a new SECTIONS clause,
5565 and we have added an input section, give an error.
5566 * layout.h (class Layout): Add have_added_input_section function.
5567 Add have_added_input_section_ field.
5568 * layout.cc (Layout::Layout): Initialize
5569 have_added_input_section_.
5570 (Layout::layout): Set have_added_input_section_.
5571 (Layout::layout_eh_frame): Likewise.
5572
5573 2009-12-30 Ian Lance Taylor <iant@google.com>
5574
5575 PR 10931
5576 * options.h (class General_options): Add --sort-common option.
5577 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5578 * common.cc (Sort_common): Add sort_order parameter to
5579 constructor. Add sort_order_ field.
5580 (Sort_commons::operator): Check sort_order_.
5581 (Symbol_table::allocate_commons): Determine the sort order.
5582 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5583 Change all callers.
5584 (Symbol_table::do_allocate_commons_list): Likewise.
5585
5586 2009-12-30 Ian Lance Taylor <iant@google.com>
5587
5588 PR 10916
5589 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5590 symbols from this object, don't change the visibility of an
5591 undefined symbol.
5592 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5593
5594 2009-12-30 Ian Lance Taylor <iant@google.com>
5595
5596 PR 10861
5597 * script.h (class Version_script_info): Define Language enum.
5598 Update declarations. Define Glob, Exact, and Lookup types. Add
5599 new fields globals_, locals_, and is_finalized_.
5600 * script.cc: Various formatting fixes.
5601 (class Parser_closure): Change language_stack_ from a vector of
5602 std::string to one of Version_script_info::Language. Adjust all
5603 uses accordingly.
5604 (class Lazy_demangler): Remove.
5605 (struct Version_expression): Change language from std::string to
5606 Version_script_info::Language.
5607 (Version_script_info::Version_script_info): New function.
5608 (Version_script_info::~Version_script_info): Don't call clear.
5609 (Version_script_info::finalize): New function.
5610 (Version_script_info::build_lookup_tables): New function.
5611 (Version_script_info::build_expression_list_lookup): New
5612 function.
5613 (Version_script_info::get_symbol_version_helper): Rewrite to use
5614 lookup tables.
5615 (Version_script_info::print_expression_list): Adjust to use
5616 Version_script_info::Language.
5617 (script_push_lex_into_version_mode): Check that the version script
5618 has not been finalized.
5619 (version_script_push_lang): Change language string to
5620 Version_script_info::Language.
5621 * options.cc (Command_line::version_script): New function.
5622 * options.h (class General_options): Add finalize_dynamic_list
5623 function. Change version_script from declaration to definition.
5624 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5625 * testsuite/version_script.map: Remove duplicate def of foo.
5626 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5627 version_script.map.
5628 * testsuite/Makefile.in: Rebuild.
5629
5630 2009-12-30 Ian Lance Taylor <iant@google.com>
5631
5632 PR 10843
5633 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5634 if the input symbol index is 0, make the output symbol index 0.
5635
5636 2009-12-30 Ian Lance Taylor <iant@google.com>
5637
5638 PR 10670
5639 * options.h (class General_options): Add -x/--discard-all.
5640 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5641 --discard-all. If the local symbol needs a dynamic entry, check
5642 that before handling --discard-locals.
5643
5644 2009-12-30 Ian Lance Taylor <iant@google.com>
5645
5646 PR 10450
5647 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5648 flags to PF_R.
5649 (Output_segment::add_output_section): Don't change the flags if
5650 the type is PT_TLS.
5651
5652 PR 10450
5653 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5654 GNU hash table if they need a dynamic value. Otherwise, don't add
5655 them if they are defined in a dynamic object or are forced local.
5656
5657 2009-12-29 Ian Lance Taylor <iant@google.com>
5658
5659 PR 10450
5660 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5661 .gnu.hash table for a 32-bit target.
5662
5663 PR 10450
5664 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5665 regular and a dynamic object only needs a dynamic symbol table
5666 entry if it is externally visible.
5667
5668 PR 10450
5669 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5670 constructor. Add global_offset_table_ field.
5671 (Target_i386::got_section): Set global_offset_table_.
5672 (Target_i386::do_finalize_sections): Set global_offset_table_
5673 size.
5674 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5675 in constructor. Add global_offset_table_ field.
5676 (Target_x86_64::got_section): Set global_offset_table_.
5677 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5678 size.
5679
5680 * layout.cc (Layout::Layout): Initialize increase_relro_.
5681 (Layout::get_output_section): Add is_relro, is_last_relro, and
5682 is_first_non_relro parameters. Change all callers.
5683 (Layout::choose_output_section): Likewise.
5684 (Layout::add_output_section_data): Likewise.
5685 (Layout::make_output_section): Likewise.
5686 (Layout::set_segment_offsets): Clear increase_relro when using a
5687 linker script.
5688 * layout.h (class Layout): Add increase_relro method. Add
5689 increase_relro_ field. Update declarations.
5690 * output.cc (Output_section::Output_section): Initialize
5691 is_last_relro_ and is_first_non_relro_.
5692 (Output_segment::add_output_section): Group relro sections is
5693 do_sort is true. Handle is_last_relro and is_first_non_relro.
5694 (Output_segment::maximum_alignment): Remove relro handling.
5695 (Output_segment::set_section_addresses): Add increase_relro
5696 parameter. Change all callers. Add initial alignment to align
5697 relro sections on separate page. Remove old relro handling.
5698 (Output_segment::set_section_list_addresses): Remove in_relro
5699 parameter. Change all callers.
5700 (Output_segment::set_offset): Add increase parameter. Change all
5701 callers. Remove old relro handling.
5702 * output.h (class Output_section): Add new methods: is_last_relro,
5703 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5704 Add is_last_relro_ and is_first_non_relro_ fields.
5705 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5706 Create separate .got.plt section. Call increase_relro.
5707 * x86_64.cc (Target_x86_64::got_section): Likewise.
5708 * testsuite/relro_script_test.t: Add .got.plt.
5709
5710 PR 10450
5711 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5712 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5713 (Layout::finalize): Call set_dynamic_symbol_size.
5714 (Layout::set_dynamic_symbol_size): New function.
5715 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5716 set_dynamic_symbol_size.
5717
5718 PR 10450
5719 * output.h (class Output_section): Add is_entsize_zero_ field.
5720 * output.cc (Output_section::Output_section): Initialize
5721 is_entsize_zero_.
5722 (Output_section::set_entsize): If two different entsizes are
5723 requested, force it to zero.
5724 (Output_section::add_input_section): Set flags for .debug_str
5725 before updating section flags. Set entsize.
5726 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5727 and SHF_STRING if all input sections have those flags.
5728
5729 2009-12-29 Rafael Espindola <espindola@google.com>
5730
5731 * main.cc (main): Fix the sys time reporting.
5732 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5733 reporting.
5734
5735 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5736
5737 * options.cc (General_options::parse_version): Allow -v to exit
5738 without an error if there is nothing to link.
5739
5740 2009-12-29 Ian Lance Taylor <iant@google.com>
5741
5742 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5743 using a version of gcc before 4.1.
5744 * configure: Rebuild.
5745
5746 2009-12-28 Chris Demetriou <cgd@google.com>
5747
5748 * attributes.cc (Output_attributes_section_data::do_write): Use
5749 std::vector::front rather than std::vector::data.
5750
5751 2009-12-28 Ian Lance Taylor <iant@google.com>
5752
5753 * symtab.h (class Symbol_table): Add enum Defined.
5754 * resolve.cc (Symbol_table::should_override): Add defined
5755 parameter. Change all callers. Test whether object is NULL
5756 before calling a method on it.
5757 (Symbol_table::report_resolve_problem): Add defined parameter.
5758 Change all callers.
5759 (Symbol_table::should_override_with_special): Likewise.
5760 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5761 parameter. Change all callers.
5762 (Symbol_table::do_define_in_output_data): Likewise.
5763 (Symbol_table::define_in_output_segment): Likewise.
5764 (Symbol_table::do_define_in_output_segment): Likewise.
5765 (Symbol_table::define_as_constant): Likewise.
5766 (Symbol_table::do_define_as_constant): Likewise.
5767 * script.h (class Symbol_assignment): Add is_defsym parameter to
5768 constructor; change all callers.
5769 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5770 parameter. Change all callers. Add is_defsym_ field.
5771 (class Parser_closure): Add parsing_defsym parameter to
5772 constructor; change all callers. Add parsing_defsym accessor
5773 function. Add parsing_defsym_ field.
5774
5775 2009-12-28 Ian Lance Taylor <iant@google.com>
5776
5777 * gold.cc (queue_middle_tasks): Fix formatting.
5778 * object.cc (Relobj::is_section_name_included): Likewise.
5779
5780 2009-12-23 Ian Lance Taylor <iant@google.com>
5781
5782 * i386.cc (Target_i386::do_calls_non_split): Recognize
5783 -fsplit-stack prologue for a function with a static chain.
5784 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5785 -fsplit-stack prologue when using %r11.
5786
5787 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5788
5789 * options.cc (General_options::parse_version): Make -v continue and do
5790 the link like GNU ld does.
5791
5792 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5793
5794 * Makefile.am (CCFILES): Add timer.cc.
5795 (HFILES): Add timer.h.
5796 * configure.ac: Check for sysconf and times.
5797 * main.cc: include timer.h.
5798 (main): Use Timer instead of get_run_time.
5799 * timer.cc: New.
5800 * timer.h: New.
5801 * workqueue.cc: include timer.h.
5802 (Workqueue::find_and_run_task):
5803 Report user, sys and wall time.
5804 * Makefile.in: Regenerate.
5805 * config.in: Regenerate.
5806 * configure: Regenerate.
5807
5808 2009-12-16 Doug Kwan <dougkwan@google.com>
5809
5810 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5811 sections.
5812 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5813 relaxed input sections.
5814 * output.cc (Output_section::find_relaxed_input_section): Change
5815 return type to Output_relaxed_input_section pointer. Adjust code
5816 for new type of relaxed_input_section_map_.
5817 * output.h (Output_section::find_relaxed_input_section): Change
5818 return type to Output_relaxed_input_section pointer.
5819 (Output_section::Output_relaxed_input_section_by_input_section_map):
5820 New type.
5821 (Output_section::relaxed_input_section_map_): Change type to
5822 Output_section::Output_relaxed_input_section_by_input_section_map.
5823 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5824 input section.
5825
5826 2009-12-15 Ian Lance Taylor <iant@google.com>
5827
5828 * layout.cc (Layout::create_shstrtab): Only write out after input
5829 sections if we are compressing debug sections.
5830
5831 2009-12-15 Ian Lance Taylor <iant@google.com>
5832
5833 * archive.cc (Archive::add_symbols): Only look up a symbol without
5834 a version if there is, in fact, a version.
5835
5836 2009-12-14 Ian Lance Taylor <iant@google.com>
5837
5838 Revert -Wshadow changes, all changes from:
5839 2009-12-11 Doug Kwan <dougkwan@google.com>
5840 2009-12-11 Nick Clifton <nickc@redhat.com>
5841 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5842
5843 2009-12-11 Doug Kwan <dougkwan@google.com>
5844
5845 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5846 due to -Wshadow.
5847 * attributes.cc (Object_attribute::size): Ditto.
5848 (Attributes_section_data::size): Ditto.
5849 (Attributes_section_data::Attributes_section_data): Ditto.
5850 (Output_attributes_section_data::do_write): Ditto.
5851 * attributes.h (Object_attribute::set_type): Ditto.
5852 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5853
5854 2009-12-11 Nick Clifton <nickc@redhat.com>
5855
5856 * archive.cc: Fix shadowed variable warnings.
5857 * arm.cc: Likewise.
5858 * compressed_output.cc: Likewise.
5859 * compressed_output.h: Likewise.
5860 * configure: Likewise.
5861 * dwarf_reader.cc: Likewise.
5862 * dynobj.cc: Likewise.
5863 * dynobj.h: Likewise.
5864 * ehframe.cc: Likewise.
5865 * ehframe.h: Likewise.
5866 * errors.cc: Likewise.
5867 * expression.cc: Likewise.
5868 * fileread.cc: Likewise.
5869 * fileread.h: Likewise.
5870 * freebsd.h: Likewise.
5871 * i386.cc: Likewise.
5872 * icf.cc: Likewise.
5873 * incremental.h: Likewise.
5874 * layout.cc: Likewise.
5875 * layout.h: Likewise.
5876 * mapfile.cc: Likewise.
5877 * merge.cc: Likewise.
5878 * merge.h: Likewise.
5879 * object.cc: Likewise.
5880 * object.h: Likewise.
5881 * options.h: Likewise.
5882 * output.cc: Likewise.
5883 * output.h: Likewise.
5884 * parameters.cc: Likewise.
5885 * plugin.cc: Likewise.
5886 * powerpc.cc: Likewise.
5887 * reduced_debug_output.cc: Likewise.
5888 * reduced_debug_output.h: Likewise.
5889 * reloc.cc: Likewise.
5890 * reloc.h: Likewise.
5891 * resolve.cc: Likewise.
5892 * script-sections.cc: Likewise.
5893 * script.cc: Likewise.
5894 * script.h: Likewise.
5895 * sparc.cc: Likewise.
5896 * symtab.cc: Likewise.
5897 * symtab.h: Likewise.
5898 * target-select.cc: Likewise.
5899 * target-select.h: Likewise.
5900 * token.h: Likewise.
5901 * workqueue.cc: Likewise.
5902 * workqueue.h: Likewise.
5903 * x86_64.cc: Likewise.
5904
5905 2009-12-10 Doug Kwan <dougkwan@google.com>
5906
5907 * arm.cc (attributes.h): New include.
5908 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5909 (Arm_relobj::~Arm_relobj): Delete object pointed by
5910 attributes_section_data_.
5911 (Arm_relobj::attributes_section_data): New method definition.
5912 (Arm_relobj::attributes_section_data_): New data member declaration.
5913 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5914 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5915 attributes_section_data_.
5916 (Arm_dynobj::attributes_section_data): New method definition.
5917 (Arm_dynobj::attributes_section_data_): New data member declaration.
5918 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5919 initialization value of may_use_blx_ to false.
5920 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5921 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5922 object attributes to compute results instead of hard-coding.
5923 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5924 Target_arm::get_secondary_compatible_arch,
5925 Target_arm::set_secondary_compatible_arch
5926 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5927 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5928 New method declarations.
5929 (Target_arm::get_aeabi_object_attribute): New method definition.
5930 (Target_arm::attributes_section_data_): New data member declaration.
5931 (read_arm_attributes_section): New template definition.
5932 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5933 (Arm_dynobj::do_read_symbols): Ditto.
5934 (Target_arm::do_finalize_sections): Merge attributes sections from
5935 input. Check for BLX use after attributes section merging.
5936 Fix __exidx_start and __exidx_end visibility. Create an
5937 .ARM.attributes section if necessary.
5938 (Target_arm::get_secondary_compatible_arch,
5939 Target_arm::set_secondary_compatible_arch,
5940 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5941 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5942 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5943 New method definitions.
5944
5945 2009-12-09 Ian Lance Taylor <iant@google.com>
5946
5947 * plugin.cc (Plugin::load): Don't cast from void* to a function
5948 pointer.
5949
5950 2009-12-09 Ian Lance Taylor <iant@google.com>
5951
5952 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
5953 information fields.
5954
5955 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
5956
5957 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
5958 Replace two_file_shared_1.so with two_file_shared_2.so.
5959 * testsuite/Makefile.in: Regenerated.
5960
5961 2009-12-08 Doug Kwan <dougkwan@google.com>
5962
5963 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
5964 (HFILES): Add attributes.h and int_encoding.h.
5965 * Makefile.in: Regenerate.
5966 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
5967 function definitions to int_encoding.cc
5968 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
5969 prototypes to int_encoding.h
5970 * reduced_debug_output.cc (int_encoding.h): New include.
5971 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
5972 function definitions to int_encoding.cc
5973 (insert_into_vector, read_from_pointer): Move template definitions to
5974 int_encoding.h
5975 * attributes.cc: New file.
5976 * attributes.h: New file.
5977 * int_encoding.cc: New file.
5978 * int_encoding.h: New file.
5979
5980 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
5981
5982 PR gold/11055
5983 * incremental-dump.cc (dump_incremental_inputs): New.
5984 (main): Use dump_incremental_inputs.
5985
5986 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
5987
5988 PR gold/10893
5989 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
5990 checking elfcpp::STT_FUNC.
5991 (Target_i386::Relocate::relocate): Likewise.
5992 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5993
5994 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
5995 symbols from shared libraries into normal FUNC symbols.
5996
5997 * symtab.h (Symbol): Add is_func and use it.
5998
5999 2009-12-05 Doug Kwan <dougkwan@google.com>
6000
6001 * arm.cc (Target_arm::arm_info): Initialize new fields
6002 attributes_section and attributes_vendor.
6003 * i386.cc (Target_i386::i386_info): Same.
6004 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6005 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6006 fields attributes_section and attributes_vendor.
6007 * sparc.cc (Target_sparc::sparc_info): Same.
6008 * target.h (Target::attributes_section, Target::attributes_vendor,
6009 Target::is_attributes_section, Target::attribute_arg_type,
6010 Target::attributes_order): New method definitions.
6011 (Target::Target_info::attributes_section,
6012 Target::Target_info::attributes_vendor): New fields.
6013 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6014 virtual method definitions.
6015 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6016 attributes_section and attributes_vendor.
6017 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6018
6019 2009-12-05 Doug Kwan <dougkwan@google.com>
6020
6021 * arm.cc: Update comments about interworking and stub generation.
6022 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6023 considered as non-PIC.
6024 (Arm_relocate_functions::base_abs): Fix formatting.
6025 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6026 of function to use GOT entry address instead of offset.
6027 (Target_arm::Scan::global): Issue an error if a symbol would need a
6028 PLT does not get one because it is untyped. Remove code to create
6029 dynamic symbols for relative branches.
6030 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6031 takes unsigned integer instead of boolean.
6032
6033 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6034
6035 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6036 (two_file_test_LDADD): Likewise.
6037 (common_test_1_LDADD): Likewise.
6038 (exception_test_LDADD) Likewise.
6039 (weak_test_LDADD): Likewise.
6040 (many_sections_test_LDADD): Likewise.
6041 (initpri1_LDADD): Likewise.
6042 (script_test_1_LDADD): Likewise.
6043 (script_test_2_LDADD): Likewise.
6044 (justsyms_LDADD): Likewise.
6045 (binary_test_LDADD): Likewise.
6046 (large_LDADD): Likewise.
6047 * testsuite/Makefile.in: Regenerated.
6048
6049 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6050
6051 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6052 (Symbol_table::override_with_special): Likewise.
6053 (Symbol_table::add_from_object): Likewise.
6054
6055 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6056
6057 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6058 Don't set the data_offset twice.
6059
6060 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6061
6062 * testsuite/Makefile.in: Regenerate.
6063
6064 2009-12-03 Doug Kwan <dougkwan@google.com>
6065
6066 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6067 (Target_arm::do_finalize_sections): Add parameter for symbol table
6068 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6069 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6070 parameter for symbol table pointer.
6071 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6072 an additional parameter for a pointer to symbol table.
6073 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6074 parameter for a symbol table pointer.
6075 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6076 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6077 Ditto.
6078 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6079 parameter for a symbol table pointer.
6080
6081 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6082
6083 * incremental.cc (Incremental_inputs_header)
6084 (Incremental_inputs_header_write, Incremental_inputs_entry)
6085 (Incremental_inputs_entry_write): Move ...
6086 * incremental.h (Incremental_inputs_header)
6087 (Incremental_inputs_header_write, Incremental_inputs_entry)
6088 (Incremental_inputs_entry_write): here.
6089
6090 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6091
6092 * incremental.cc (make_sized_incremental_binary): Set the target.
6093 Error if it is incompatible.
6094 * output.h (Output_file): Add filename method.
6095
6096 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6097
6098 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6099 from the get_* methods.
6100
6101 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6102
6103 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6104 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6105 Write 0 for the data_offset of scripts.
6106
6107 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6108
6109 * testsuite/Makefile.am: Add the incremental_test.sh test.
6110 * testsuite/incremental_test.sh: New.
6111 * testsuite/incremental_test_1.c: New.
6112 * testsuite/incremental_test_2.c: New.
6113
6114 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6115
6116 * incremental-dump.cc (main): Fix typos.
6117
6118 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6119
6120 PR gold/11025
6121 * incremental-dump.cc (main): Use llu to print 64 bit values.
6122
6123 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6124 H.J. Lu <hongjiu.lu@intel.com>
6125
6126 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6127 $(LIBDL).
6128 (incremental_dump_LDADD): Likewise.
6129 * Makefile.in: Regenerated.
6130
6131 2009-11-25 Doug Kwan <dougkwan@google.com>
6132
6133 Revert:
6134
6135 2009-11-25 Doug Kwan <dougkwan@google.com>
6136
6137 * arm.cc (Target_arm::Target_arm): Move method definition
6138 outside of class definition. Add code to handle
6139 --target1-rel, --target1-abs and --target2= options.
6140 (Target_arm::get_reloc_reloc_type): Change method to be
6141 non-static and const.
6142 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6143 New data member declaration.
6144 (Target_arm::Scan::local, Target_arm::Scan::global,
6145 Target_arm::Relocate::relocate,
6146 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6147 Adjust call to Target_arm::get_real_reloc_type.
6148 (Target_arm::get_real_reloc_type): Use command line options
6149 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6150 * options.h (--target1-rel, --target1-abs, --target2): New
6151 ARM-only options.
6152
6153 2009-11-25 Doug Kwan <dougkwan@google.com>
6154
6155 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6156 class definition. Add code to handle --target1-rel, --target1-abs
6157 and --target2= options.
6158 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6159 and const.
6160 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6161 member declaration.
6162 (Target_arm::Scan::local, Target_arm::Scan::global,
6163 Target_arm::Relocate::relocate,
6164 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6165 call to Target_arm::get_real_reloc_type.
6166 (Target_arm::get_real_reloc_type): Use command line options to
6167 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6168 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6169 options.
6170
6171 2009-11-25 Doug Kwan <dougkwan@google.com>
6172
6173 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6174 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6175 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6176 formatting.
6177 (Arm_relocate_functions::thm_call): Replace body with a call to
6178 Arm_relocate_functions::thumb_branch_common.
6179 (Arm_relocate_functions::thm_jump24,
6180 Arm_relocate_functions::thm_xpc22): New method definitions.
6181 (Arm_relocate_functions::thumb_branch_common): New method definition.
6182 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6183 operator.
6184 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6185 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6186
6187 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6188
6189 * Makefile.am: Build incremental-dump
6190 * Makefile.in: Regenerate.
6191 * incremental-dump.cc: New.
6192 * incremental.cc (Incremental_inputs_header_data,
6193 Incremental_inputs_entry_data): Move to incremental.h
6194 * incremental.h: (Incremental_inputs_header_data,
6195 Incremental_inputs_entry_data): Move from incremental.cc
6196
6197 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6198
6199 * incremental.cc (Incremental_inputs_header,
6200 Incremental_inputs_header_write, Incremental_inputs_entry,
6201 Incremental_inputs_entry_write): Add a typedef with the data type.
6202
6203 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6204
6205 * incremental.cc (Incremental_inputs_header,
6206 Incremental_inputs_header_write, Incremental_inputs_entry,
6207 Incremental_inputs_entry_write): Update comment about which
6208 type has the filed descriptions.
6209
6210 2009-11-15 Doug Kwan <dougkwan@google.com>
6211
6212 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6213 (Arm_relocate_functions::arm_branch_common): Change method defintion
6214 in class definition to a method declaration and update list of formal
6215 parameters.
6216 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6217 Arm_relocation_functions::jump24): Adjust call to
6218 Arm_relocate_functions::arm_branch_common. Update list of formal
6219 parameters.
6220 (Arm_relocate_functions::xpc25): New method definition.
6221 (Arm_relocate_functions::arm_branch_common): Move method defintion
6222 out from class definition. Use stubs for mode-switching and extending
6223 branch ranges.
6224 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6225 specially. Change code to enable use of stubs in ARM branches.
6226
6227 2009-11-10 Doug Kwan <dougkwan@google.com>
6228
6229 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6230 in method declaration.
6231 (Target_arm::relocate_stub): New method declaration.
6232 (Target_arm::default_target): Change to return a pointer instead of
6233 a const reference.
6234 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6235 Target_arm::default_target.
6236 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6237 method definition.
6238 (Target_arm::relocate_section): Adjust view.
6239 (Target_arm::relocate_stub): New method definition.
6240
6241 2009-11-10 Doug Kwan <dougkwan@google.com>
6242
6243 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6244 a format warning.
6245 * incremental.cc (open_incremental_binary): Initialized local
6246 variables to avoid warnings.
6247 * object.cc (make_elf_object): Ditto.
6248 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6249 a format warning.
6250
6251 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6252
6253 PR gold/10930
6254 * testsuite/plugin_test.c: Include "config.h".
6255
6256 2009-11-09 Doug Kwan <dougkwan@google.com>
6257
6258 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6259 (arm_symbol_value): Remove.
6260 (Arm_relocate_functions::arm_branch_common,
6261 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6262 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6263 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6264 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6265 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6266 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6267 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6268 Arm_relocate_functions::thm_mobw_abs_nc,
6269 Arm_relocate_functions::thm_mov_abs,
6270 Arm_relocate_functions::movw_prel_nc,
6271 Arm_relocate_functions::thm_movt_abs,
6272 Arm_relocate_functions::movt_prel,
6273 Arm_relocate_functions::thm_movw_prel_nc,
6274 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6275 (Target_arm::Relocate::relocate): Only decompose address into two
6276 parts if relocation type uses the thumb-bit and pass the actual
6277 bit instead of a flag indicating that the thumb-bit is used. Adjust
6278 calls to methods in Arm_relocate_functions for this change.
6279
6280 2009-11-08 Ian Lance Taylor <iant@google.com>
6281
6282 PR 10925
6283 * reloc.cc: Instantiate
6284 Sized_relobj::initialize_input_to_output_maps and
6285 Sized_relobj:free_input_to_output_maps.
6286
6287 2009-11-06 Ian Lance Taylor <iant@google.com>
6288
6289 PR 10876
6290 * defstd.cc (in_segment): Set only_if_ref true for "end".
6291
6292 2009-11-06 Doug Kwan <dougkwan@google.com>
6293
6294 * arm.cc (class Reloc_stub): Correct a comment.
6295 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6296 (Target_arm::scan_section_for_stubs): New method declaration.
6297 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6298 Change methods from private to protected.
6299 (Target_arm::do_may_relax): New method definition.
6300 (Target_arm::do_relax, Target_arm::group_sections,
6301 Target_arm::scan_reloc_for_stub,
6302 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6303 (Target_arm::arm_input_section_map_): New data member declaration.
6304 (Target_arm::scan_reloc_for_stub,
6305 Target_arm::scan_reloc_section_for_stubs,
6306 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6307 Target_arm::do_relax): New method definitions.
6308
6309 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6310
6311 * configure.ac: Check for (struct stat)::st_mtim
6312 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6313 * config.in: Regenerate.
6314 * configure: Regenerate.
6315
6316 2009-11-05 Ian Lance Taylor <iant@google.com>
6317
6318 PR 10910
6319 * output.cc (Output_segment::add_output_section): Add missing
6320 return statement.
6321
6322 2009-11-04 Ian Lance Taylor <iant@google.com>
6323
6324 PR 10880
6325 * object.h (class Object): Add is_needed and set_is_needed
6326 methods. Add is_needed_ field. Make bool fields into bitfields.
6327 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6328 defined in a dynamic object and referenced by a regular object,
6329 set is_needed for the dynamic object.
6330 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6331 if the file is marked with as_needed and it is not needed.
6332
6333 2009-11-04 Ian Lance Taylor <iant@google.com>
6334
6335 PR 10887
6336 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6337 tags if data is discarded by linker script.
6338 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6339 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6340 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6341 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6342
6343 2009-11-04 Ian Lance Taylor <iant@google.com>
6344
6345 * layout.cc (Layout::get_output_section): Add is_interp and
6346 is_dynamic_linker_section parameters. Change all callers.
6347 (Layout::choose_output_section): Likewise.
6348 (Layout::make_output_section): Likewise.
6349 (Layout::add_output_section_data): Add is_dynamic_linker_section
6350 parameter. Change all callers.
6351 * layout.h (class Layout): Update declarations.
6352 * output.h (class Output_section): Add is_interp, set_is_interp,
6353 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6354 Add is_interp_, is_dynamic_linker_section_ fields. Change
6355 generate_code_fills_at_write_ to a bitfield.
6356 * output.cc (Output_section::Output_sections): Initialize new
6357 fields.
6358 (Output_segment::add_output_section): Add do_sort parameter.
6359 Change all callers.
6360
6361 2009-11-03 Ian Lance Taylor <iant@google.com>
6362
6363 PR 10860
6364 * options.h (class General_options): Add --warn-common.
6365 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6366 merging two common symbols.
6367 (Symbol_table::should_override): Handle --warn-common when merging
6368 a common symbol with a defined symbol. Use report_resolve_problem
6369 for multiple definitions.
6370 (Symbol_table::report_resolve_problem): New function.
6371 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6372
6373 2009-11-03 Doug Kwan <dougkwan@google.com>
6374
6375 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6376 stub_factory_.
6377 (Target_arm::stub_factory): New method definition.
6378 (Target_arm::new_arm_input_section,
6379 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6380 Target_arm::reloc_uses_thumb_bit): New method declarations.
6381 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6382 New type definitions.
6383 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6384 member declarations.
6385 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6386 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6387 New method definitions.
6388
6389 2009-11-03 Ian Lance Taylor <iant@google.com>
6390
6391 * options.h (class General_options): Add --warn_constructors.
6392
6393 2009-11-03 Ian Lance Taylor <iant@google.com>
6394
6395 PR 10893
6396 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6397 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6398
6399 2009-11-03 Ian Lance Taylor <iant@google.com>
6400
6401 PR 10895
6402 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6403 --msgid-bugs-address.
6404 (install-pdf): New target.
6405 (install-data_yes): Look up one directory to find mkinstalldirs.
6406
6407 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6408
6409 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6410 tree.
6411
6412 2009-10-30 Doug Kwan <dougkwan@google.com>
6413
6414 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6415
6416 2009-10-30 Doug Kwan <dougkwan@google.com>
6417
6418 * arm.cc (Stub_addend_reader): New struct template definition
6419 and partial specializations.
6420 (Stub_addend_reader::operator()): New method definition for a
6421 partially specialized template.
6422
6423 2009-10-30 Doug Kwan <dougkwan@google.com>
6424
6425 * arm.cc (Arm_relobj::processor_specific_flags): New method
6426 definition.
6427 (Arm_relobj::do_read_symbols): New method declaration.
6428 (Arm_relobj::processor_specific_flags_): New data member declaration.
6429 (Arm_dynobj): New class definition.
6430 (Target_arm::do_finalize_sections): Add input_objects parameter.
6431 (Target_arm::do_adjust_elf_header): New method declaration.
6432 (Target_arm::are_eabi_versions_compatible,
6433 (Target_arm::merge_processor_specific_flags): New method declaration.
6434 (Target_arm::do_make_elf_object): New overloaded method definitions
6435 and declaration.
6436 (Arm_relobj::do_read_symbols): New method definition.
6437 (Arm_dynobj::do_read_symbols): Ditto.
6438 (Target_arm::do_finalize_sections): Add input_objects parameters.
6439 Merge processor-specific flags from all input objects.
6440 (Target_arm::are_eabi_versions_compatible,
6441 Target_arm::merge_processor_specific_flags,
6442 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6443 New method definitions.
6444 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6445 Input_objects pointer type parameter.
6446 * layout.cc (Layout::finalize): Pass input objects to target's.
6447 finalize_sections function.
6448 * output.cc (Output_file_header::do_sized_write): Set ELF file
6449 header's processor-specific flags.
6450 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6451 Input_objects pointer type parameter.
6452 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6453 * target.h (Input_objects): New forward class declaration.
6454 (Target::processor_specific_flags,
6455 Target::are_processor_specific_flags_sect): New method definitions.
6456 (Target::finalize_sections): Add input_objects parameter.
6457 (Target::Target): Initialize processor_specific_flags_ and
6458 are_processor_specific_flags_set_.
6459 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6460 parameter.
6461 (Target::set_processor_specific_flags): New method definition.
6462 (Target::processor_specific_flags_,
6463 Target::are_processor_specific_flags_set_): New data member
6464 declarations.
6465 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6466 Input_objects pointer type parameter.
6467
6468 2009-10-30 Doug Kwan <dougkwan@google.com>
6469
6470 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6471
6472 2009-10-28 Ian Lance Taylor <iant@google.com>
6473
6474 * object.h (class Relobj): Drop options parameter from
6475 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6476 do_scan_relocs, do_relocate. Change all callers.
6477 (class Sized_relobj): Drop options parameters from
6478 do_gc_process_relocs, do_scan_relocs, do_relocate,
6479 do_relocate_sections, relocate_sections, emit_relocs_scan,
6480 emit_relocs_scan_reltype. Change all callers.
6481 (struct Relocate_info): Remove options field and all references to
6482 it.
6483 * reloc.h (class Read_relocs): Remove options constructor
6484 parameter and options_ field. Change all callers.
6485 (class Gc_process_relocs, class Scan_relocs): Likewise.
6486 (class Relocate_task): Likewise.
6487 * target-reloc.h (scan_relocs): Remove options parameter. Change
6488 all callers.
6489 (scan_relocatable_relocs): Likewise.
6490 * target.h (class Sized_target): Remove options parameter from
6491 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6492 all callers.
6493 * gc.h (gc_process_relocs): Remove options parameter. Change all
6494 callers.
6495 * arm.cc: Update functions to remove options parameters.
6496 * i386.cc: Likewise.
6497 * powerpc.cc: Likewise.
6498 * sparc.cc: Likewise.
6499 * x86_64.cc: Likewise.
6500 * testsuite/testfile.cc: Likewise.
6501
6502 2009-10-28 Doug Kwan <dougkwan@google.com>
6503
6504 * arm.cc (Arm_relobj): New class definition.
6505 (Arm_relobj::scan_sections_for_stubs,
6506 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6507 New method definitions.
6508
6509 2009-10-28 Cary Coutant <ccoutant@google.com>
6510
6511 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6512 (Plugin::cleanup_done_): New member.
6513 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6514 (Plugin_manager::cleanup_done_): Remove.
6515 (Plugin_manager::add_input_file): Edit error message.
6516 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6517 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6518
6519 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6520
6521 * fileread.cc: (File_read::View::~View): Use the new
6522 data_ownership_ filed.
6523 (File_read::~File_read): Dispose the new whole_file_view_.
6524 (File_read::open): Mmap the whole file if needed.
6525 (File_read::open): Use whole_file_view_ instead of contents_.
6526 (File_read::find_view): Use whole_file_view_ if applicable.
6527 (File_read::do_read): Use whole_file_view_ instead of contents_.
6528 (File_read::make_view): Use whole_file_view_ instead of contents_,
6529 update File_read::View::View call.
6530 (File_read::find_or_make_view): Update File_read::View::View
6531 call.
6532 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6533 remove contents_
6534 (File_read::View::Data_ownership): New enum.
6535 (File_read::View::View): Replace bool mapped_ with Data_ownership
6536 argument.
6537 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6538 (File_read::View::data_ownership_): New field.
6539 (File_read::contents_): Remove (replaced by whole_file_view_).
6540 (File_read::whole_file_view_): New field.
6541 * options.h (class General_options): Add --keep-files-mapped.
6542
6543 2009-10-27 Cary Coutant <ccoutant@google.com>
6544
6545 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6546 * testsuite/Makefile.am (plugin_test_5): New test case.
6547 * testsuite/Makefile.in: Regenerate.
6548
6549 2009-10-25 Doug Kwan <dougkwan@google.com>
6550
6551 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6552 from private to protected to allow access by child class.
6553 (Sized_relobj::do_relocate_sections): New method declaration.
6554 (Sized_relobj::relocate_sections): Virtualize.
6555 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6556 Sized_relobj::relocate_sections. Instantiate template explicitly
6557 for different target sizes and endianity.
6558
6559 2009-10-24 Doug Kwan <dougkwan@google.com>
6560
6561 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6562 (Arm_input_section::as_arm_input_section): New method.
6563 (Arm_output_section): New class definition.
6564 (Arm_output_section::create_stub_group,
6565 Arm_output_section::group_sections): New method definitions.
6566
6567 2009-10-22 Doug Kwan <dougkwan@google.com>
6568
6569 * arm.cc (Arm_input_section): New class definition.
6570 (Arm_input_section::init, Arm_input_section:do_write,
6571 Arm_input_section::set_final_data_size,
6572 Arm_input_section::do_reset_address_and_file_offset): New method
6573 definitions.
6574
6575 2009-10-21 Doug Kwan <dougkwan@google.com>
6576
6577 * arm.cc (Stub_table, Arm_input_section): New forward class
6578 declarations.
6579 (Stub_table): New class defintion.
6580 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6581 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6582 New method definition.
6583
6584 2009-10-21 Doug Kwan <dougkwan@google.com>
6585
6586 * arm.cc: Update copyright comments.
6587 (Target_arm): New forward class template declaration.
6588 (Arm_address): New type.
6589 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6590 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6591 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6592 constants.
6593 (Insn_template): Same.
6594 (DEF_STUBS): New macro.
6595 (Stub_type): New enum type.
6596 (Stub_template): New class definition.
6597 (Stub): Same.
6598 (Reloc_stub): Same.
6599 (Stub_factory): Same.
6600 (Target_arm::Target_arm): Initialize may_use_blx_ and
6601 should_force_pic_veneer_.
6602 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6603 Target_arm::should_force_pic_veneer,
6604 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6605 Target_arm::using_thumb_only, Target_arm:;default_target): New
6606 method defintions.
6607 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6608 New data member declarations.
6609 (Insn_template::size, Insn_template::alignment): New method defintions.
6610 (Stub_template::Stub_template): New method definition.
6611 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6612 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6613 (Stub_factory::Stub_factory): New method definition.
6614 * gold.h (string_hash): New template.
6615 * output.h (Input_section_specifier::hash_value): Use
6616 gold::string_hash.
6617 (Input_section_specifier::string_hash): Remove.
6618 * stringpool.cc (Stringpool_template::string_hash): Use
6619 gold::string_hash.
6620
6621 2009-10-20 Doug Kwan <dougkwan@google.com>
6622
6623 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6624 symbols of relaxed input sections.
6625 * output.h (Output_section::find_relaxed_input_section): Make
6626 method public.
6627
6628 2009-10-16 Doug Kwan <dougkwan@google.com>
6629
6630 * dynobj.cc (Versions::Versions): Initialize version_script_.
6631 Only insert base version symbol definition for a shared object
6632 if version script defines any version versions.
6633 (Versions::define_base_version): New method definition.
6634 (Versions::add_def): Check that base version is not needed.
6635 (Versions::add_need): Define base version lazily.
6636 * dynobj.h (Versions::define_base_version): New method declaration.
6637 (Versions::needs_base_version_): New data member declaration.
6638 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6639 (check_DATA): Add no_version_test.stdout.
6640 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6641 New make rules.
6642 * testsuite/Makefile.in: Regenerate.
6643 * testsuite/no_version_test.c: New file.
6644 * testsuite/no_version_test.sh: Ditto.
6645
6646 2009-10-16 Doug Kwan <dougkwan@google.com>
6647
6648 * expression.cc (class Segment_start_expression): New class definition.
6649 (Segment_start_expression::value): New method definition.
6650 (script_exp_function_segment_start): Return a new
6651 Segment_start_expression.
6652 * gold/script-c.h (script_saw_segment_start_expression): New function
6653 prototype.
6654 * script-sections.cc (Script_sections::Script_sections): Initialize
6655 SAW_SEGMENT_START_EXPRESSION_ to false.
6656 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6657 and -Tbbs options to specify section addresses if given in
6658 command line and no SEGMENT_START expression is seen in a script.
6659 * script-sections.h (Script_sections::saw_segment_start_expression,
6660 Script_sections::set_saw_segment_start_expression): New method
6661 definition.
6662 (Script_sections::saw_segment_start_expression_): New data member
6663 declaration.
6664 * script.cc (script_saw_segment_start_expression): New function.
6665 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6666 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6667 script_test_7.sh and script_test_8.sh.
6668 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6669 script_test_8.stdout.
6670 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6671 (script_test_6, script_test_6.stdout, script_test_7,
6672 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6673 * Makefile.in: Regenerate.
6674 * testsuite/script_test_6.sh: New file.
6675 * testsuite/script_test_6.t: Same.
6676 * testsuite/script_test_7.sh: Same.
6677 * testsuite/script_test_7.t: Same.
6678 * testsuite/script_test_8.sh: Same.
6679
6680 2009-10-16 Doug Kwan <dougkwan@google.com>
6681
6682 * output.cc (Output_segment::set_section_list_address): Cast
6683 expressions to unsigned long long type to avoid format warnings.
6684
6685 2009-10-15 Ian Lance Taylor <iant@google.com>
6686
6687 * script.cc (Script_options::add_symbol_assignment): Always add a
6688 dot assignment to script_sections_.
6689 * script-sections.cc (Script_sections::add_dot_assignment):
6690 Initialize if necessary.
6691
6692 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6693 program headers with no load segment if there is a linker script.
6694
6695 * layout.cc (Layout::set_segment_offsets): Align the file offset
6696 to the segment aligment for -N or -n with no load segment.
6697 * output.cc (Output_segment::add_output_section): Don't crash if
6698 the first section is a TLS section.
6699 (Output_segment::set_section_list_addresses): Print an error
6700 message if the address moves backward in a linker script.
6701 * script-sections.cc
6702 (Output_section_element_input::set_section_addresses): Don't
6703 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6704 (Orphan_output_section::set_section_addresses): Likewise.
6705
6706 2009-10-15 Doug Kwan <dougkwan@google.com>
6707
6708 * layout.cc (Layout::finish_dynamic_section): Generate tags
6709 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6710 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6711 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6712
6713 2009-10-14 Ian Lance Taylor <iant@google.com>
6714
6715 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6716 fields.
6717 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6718 data_shdr fields of relinfo.
6719 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6720 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6721 R_386_TLS_LDO_32, adjust based on section flags.
6722 (Target_i386::Relocate::fix_up_ldo): Remove.
6723
6724 2009-10-13 Ian Lance Taylor <iant@google.com>
6725
6726 Add support for -pie.
6727 * options.h (class General_options): Add -pie and
6728 --pic-executable.
6729 (General_options::output_is_position_independent): Test -pie.
6730 (General_options::output_is_executable): Return true if not shared
6731 and not relocatable.
6732 (General_options::output_is_pie): Remove.
6733 * options.cc (General_options::finalize): Reject incompatible uses
6734 of -pie.
6735 * gold.cc (queue_middle_tasks): A -pie link is not static.
6736 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6737 * symtab.cc (Symbol::final_value_is_known): Return false if
6738 output_is_position_independent.
6739 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6740 output_is_position_independent.
6741 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6742 output_is_position_independent.
6743 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6744 output_is_position_independent.
6745 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6746 two_file_pie_test.
6747 (basic_pie_test.o, basic_pie_test): New targets.
6748 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6749 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6750 (two_file_pie_test): New target.
6751 * testsuite/Makefile.in: Rebuild.
6752 * README: Remove note saying that -pie is not supported.
6753
6754 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6755
6756 * options.h (class General_options): Add -init and -fini.
6757 * layout.cc (Layout::finish_dynamic_section): Emit
6758 given init and fini functions.
6759
6760 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6761
6762 * gc.h (gc_process_relocs): Check if icf is enabled using new
6763 function.
6764 * gold.cc (queue_initial_tasks): Likewise.
6765 (queue_middle_tasks): Likewise.
6766 * object.cc (do_layout): Likewise.
6767 * symtab.cc (is_section_folded): Likewise.
6768 * main.cc (main): Likewise.
6769 * reloc.cc (Read_relocs::run): Likewise.
6770 (Sized_relobj::do_scan_relocs): Likewise.
6771 * icf.cc (is_function_ctor_or_dtor): New function.
6772 (Icf::find_identical_sections): Check if function is ctor or dtor when
6773 safe icf is chosen.
6774 * options.h (General_options::icf): Change option to be an enum.
6775 (Icf_status): New enum.
6776 (icf_enabled): New method.
6777 (icf_safe_folding): New method.
6778 (set_icf_status): New method.
6779 (icf_status_): New variable.
6780 * (options.cc) (General_options::finalize): Set icf_status_.
6781 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6782 icf_test and icf_keep_unique_test to use the --icf enum flag.
6783 * testsuite/icf_safe_test.sh: New file.
6784 * testsuite/icf_safe_test.cc: New file.
6785
6786 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6787
6788 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6789 includes to gc.h and icf.h.
6790 * arm.cc: Include gc.h.
6791 * gold.cc: Likewise.
6792 * i386.cc: Likewise.
6793 * powerpc.cc: Likewise.
6794 * sparc.cc: Likewise.
6795 * x86_64.cc: Likewise.
6796 * gc.h: Include icf.h.
6797
6798 2009-10-11 Ian Lance Taylor <iant@google.com>
6799
6800 * plugin.cc: Include "gold.h" before other header files.
6801
6802 2009-10-10 Chris Demetriou <cgd@google.com>
6803
6804 * options.h (Input_file_argument::Input_file_type): New enum.
6805 (Input_file_argument::is_lib_): Replace with...
6806 (Input_file_argument::type_): New member.
6807 (Input_file_argument::Input_file_argument): Take Input_file_type
6808 'type' rather than boolean 'is_lib' as second argument.
6809 (Input_file_argument::is_lib): Use type_.
6810 (Input_file_argument::is_searched_file): New function.
6811 (Input_file_argument::may_need_search): Handle is_searched_file.
6812 * options.cc (General_options::parse_library): Support -l:filename.
6813 (General_options::parse_just_symbols): Update for Input_file_argument
6814 changes.
6815 (Command_line::process): Likewise.
6816 * archive.cc (Archive::get_file_and_offset): Likewise.
6817 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6818 * script.cc (read_script_file, script_add_file): Likewise.
6819 * fileread.cc (Input_file::Input_file): Likewise.
6820 (Input_file::will_search_for): Handle is_searched_file.
6821 (Input_file::open): Likewise.
6822 * readsyms.cc (Read_symbols::get_name): Likewise.
6823 * testsuite/Makefile.am (searched_file_test): New test.
6824 * testsuite/Makefile.in: Regenerate.
6825 * testsuite/searched_file_test.cc: New file.
6826 * testsuite/searched_file_test_lib.cc: New file.
6827
6828 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6829 Ian Lance Taylor <iant@google.com>
6830
6831 * descriptor.cc: Include <cstdio> and "binary-io.h".
6832 (Descriptors::open): Open the files in binary mode always.
6833 * script.cc (Lex::get_token): Treat \r as whitespace.
6834
6835 2009-10-09 Ian Lance Taylor <iant@google.com>
6836
6837 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6838
6839 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6840 Ian Lance Taylor <iant@google.com>
6841
6842 * configure.ac: Check for readv function also.
6843 * fileread.cc (readv): Define if not HAVE_READV.
6844 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6845 does not exist.
6846 * config.in: Regenerate.
6847 * configure: Regenerate.
6848
6849 2009-10-09 Doug Kwan <dougkwan@google.com>
6850
6851 * layout.cc (Layout::make_output_section): Call target hook to make
6852 ordinary output section.
6853 (Layout::finalize): Adjust parameter list of call the
6854 Target::may_relax().
6855 * layout.h (class Layout::section_list): New method.
6856 * merge.h (Output_merge_base::entsize): Change visibility to public.
6857 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6858 New methods.
6859 (Output_merge_string::do_is_string): New method.
6860 * object.cc (Sized_relobj::do_setup): renamed from
6861 Sized_relobj::set_up.
6862 * object.h (Sized_relobj::adjust_shndx,
6863 Sized_relobj::initializ_input_to_output_maps,
6864 Sized_relobj::free_input_to_output_maps): Change visibilities to
6865 protected.
6866 (Sized_relobj::setup): Virtualize.
6867 (Sized_relobj::do_setup): New method declaration.
6868 (Sized_relobj::invalidate_section_offset,
6869 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6870 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6871 * options.cc (parse_int): New function.
6872 * options.h (parse_int): New declaration.
6873 (DEFINE_int): New macro.
6874 (stub_group_size): New option.
6875 * output.cc (Output_section::Output_section): Initialize memebers
6876 merge_section_map_, merge_section_by_properties_map_,
6877 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6878 (Output_section::add_input_section): Handled deferred code-fill
6879 generation and remove an old comment.
6880 (Output_section::add_relaxed_input_section): New method definition.
6881 (Output_section::add_merge_input_section): Use merge section by
6882 properties map to speed to search. Update merge section maps
6883 as appropriate.
6884 (Output_section::build_relaxation_map): New method definition.
6885 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6886 Same.
6887 (Output_section::relax_input_section): Renamed to
6888 Output_section::convert_input_sections_to_relaxed_sections and change
6889 interface to take a vector of pointers to relaxed sections.
6890 (Output_section::find_merge_section,
6891 Output_section::find_relaxed_input_section): New method definitions.
6892 (Output_section::is_input_address_mapped,
6893 Output_section::output_offset, Output_section::output_address):
6894 Use output section data maps to speed up searching.
6895 (Output_section::find_starting_output_address): Add comments.
6896 (Output_section::do_write,
6897 Output_section::write_to_postprocessing_buffer): Do code-fill
6898 generation as appropriate.
6899 (Output_section::get_input_sections): Invalidate relaxed input section
6900 map.
6901 (Output_section::restore_states): Adjust type of checkpoint .
6902 Invalidate relaxed input section map.
6903 * output.h (Output_merge_base): New class declaration.
6904 (Input_section_specifier): New class defintion.
6905 (class Output_relaxed_input_section) Change base class to
6906 Output_section_data_build.
6907 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6908 base class initializer.
6909 (Output_section::add_relaxed_input_section): New method declaration.
6910 (Output_section::Input_section): Change visibility to protected.
6911 (Output_section::Input_section::relobj,
6912 Output_section::Input_section::shndx): Handle relaxed input sections.
6913 Output_section::input_sections) Change visibility to protected. Also
6914 define overload to return a non-const pointer.
6915 (Output_section::Merge_section_properties): New class defintion.
6916 (Output_section::Merge_section_by_properties_map,
6917 Output_section::Output_section_data_by_input_section_map,
6918 Output_section::Relaxation_map): New types.
6919 (Output_section::relax_input_section): Rename method to
6920 Output_section::convert_input_sections_to_relaxed_sections and change
6921 interface to take a vector of relaxed section pointers.
6922 (Output_section::find_merge_section,
6923 Output_section::find_relaxed_input_section,
6924 Output_section::build_relaxation_map,
6925 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6926 New method declarations.
6927 (Output_section::merge_section_map_
6928 Output_section::merge_section_by_properties_map_,
6929 Output_section::relaxed_input_section_map_,
6930 Output_section::is_relaxed_input_section_map_valid_,
6931 Output_section::generate_code_fills_at_write_): New data members.
6932 * script-sections.cc
6933 (Output_section_element_input::set_section_addresses): Call
6934 current_data_size and addralign methods of relaxed input sections.
6935 (Orphan_output_section::set_section_addresses): Call current_data_size
6936 and addralign methods of relaxed input sections.
6937 * symtab.cc (Symbol_table::compute_final_value): Extract template
6938 from the body of Symbol_table::sized_finalize_symbol.
6939 (Symbol_table::sized_finalized_symbol): Call
6940 Symbol_table::compute_final_value.
6941 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6942 (Symbol_table::compute_final_value): New templated method declaration.
6943 * target.cc (Target::do_make_output_section): New method defintion.
6944 * target.h (Target::make_output_section): New method declaration.
6945 (Target::relax): Add more parameters for input objects, symbol table
6946 and layout. Adjust call to do_relax.
6947 (Target::do_make_output_section): New method declaration.
6948 (Target::do_relax): Add parameters for input objects, symbol table
6949 and layout.
6950
6951 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6952
6953 * pread.c: Include stdio.h.
6954
6955 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6956
6957 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
6958 defined.
6959
6960 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6961
6962 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6963 Change read_shndx type to unsigned int.
6964 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6965 int.
6966 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6967 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
6968 Change read_shndx type to unsigned int.
6969 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
6970 int.
6971 (Sized_dwarf_line_info::read_line_mappings): Likewise.
6972 * layout.cc (Layout::create_symtab_sections): Cast the result of
6973 local_symcount * symsize to off_t in the gold_assert.
6974
6975 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6976
6977 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
6978 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
6979 R_ARM_BASE_ABS.
6980 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
6981 (Arm_relocate_functions::thm_abs5): New function.
6982 (Arm_relocate_functions::abs12): New function.
6983 (Arm_relocate_functions::abs16): New function.
6984 (Arm_relocate_functions::base_abs): New function.
6985 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
6986 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
6987 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
6988 R_ARM_BASE_ABS.
6989 (Scan::global): Likewise.
6990 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
6991 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
6992 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
6993 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
6994 R_ARM_BASE_ABS.
6995
6996 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6997
6998 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
6999 (Arm_relocate_functions::movt_prel): New function.
7000 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7001 (Arm_relocate_functions::thm_movt_prel): New function.
7002 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7003 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7004 (Scan::global, Relocate::relocate): Likewise.
7005 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7006
7007 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7008
7009 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7010 Incremental_checker.
7011 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7012 unsigned int.
7013 (class Incremental_inputs_header): New class.
7014 (Incremental_inputs_header_writer): Edit comment.
7015 (Incremental_inputs_entry): New class.
7016 (Incremental_inputs_entry_writer): Edit comment.
7017 (Sized_incremental_binary::do_find_incremental_inputs_section):
7018 Add *strtab_shndx parameter, fill it.
7019 (Sized_incremental_binary::do_check_inputs): New method.
7020 (Incremental_checker::can_incrementally_link_output_file): Use
7021 Sized_incremental_binary::check_inputs.
7022 (Incremental_inputs::report_command_line): Save command line in
7023 command_line_.
7024 * incremental.h:
7025 (Incremental_binary::find_incremental_inputs_section): New
7026 method.
7027 (Incremental_binary::do_find_incremental_inputs_section): Add
7028 strtab_shndx parameter.
7029 (Incremental_binary::do_check_inputs): New pure virtual method.
7030 (Sized_incremental_binary::do_check_inputs): Declare.
7031 (Incremental_checker::Incremental_checker): Add incremental_inputs
7032 parameter, use it to initialize incremental_inputs_.
7033 (Incremental_checker::incremental_inputs_): New field.
7034 (Incremental_checker::command_line): New method.
7035 (Incremental_checker::inputs): New method.
7036 (Incremental_checker::command_line_): New field.
7037
7038 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7039
7040 * incremental.cc: Include <cstdarg> and "target-select.h".
7041 (vexplain_no_incremental): New function.
7042 (explain_no_incremental): New function.
7043 (Incremental_binary::error): New method.
7044 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7045 method.
7046 (make_sized_incremental_binary): New function.
7047 (open_incremental_binary): New function.
7048 (can_incrementally_link_file): Add checks if output is ELF and has
7049 inputs section.
7050 * incremental.h: Include "elfcpp_file.h" and "output.h".
7051 (Incremental_binary): New class.
7052 (Sized_incremental_binary): New class.
7053 (open_incremental_binary): Declare.
7054 * object.cc (is_elf_object): Use
7055 elfcpp::Elf_recognizer::is_elf_file.
7056 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7057 * output.h (Output_file::filesize): New method.
7058
7059 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7060
7061 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7062 New function.
7063 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7064 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7065 function.
7066 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7067 function.
7068 (Arm_relocate_functions::movw_abs_nc): New function.
7069 (Arm_relocate_functions::movt_abs): New function.
7070 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7071 (Arm_relocate_functions::thm_movt_abs): New function.
7072 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7073 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7074 (Scan::global): Likewise.
7075 (Relocate::relocate): Likewise.
7076 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7077
7078 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7079
7080 * arm.cc (Arm_relocate_functions::got_prel) New function.
7081 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7082 (Relocate::relocate): Likewise.
7083 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7084
7085 2009-10-06 Ian Lance Taylor <iant@google.com>
7086
7087 * options.h (class General_options): Define
7088 split_stack_adjust_size parameter.
7089 * object.h (class Object): Add uses_split_stack_ and
7090 has_no_split_stack_ fields. Add uses_split_stack and
7091 has_no_split_stack accessor functions. Declare
7092 handle_split_stack_section.
7093 (class Reloc_symbol_changes): Define.
7094 (class Sized_relobj): Define Function_offsets. Declare
7095 split_stack_adjust, split_stack_adjust_reltype, and
7096 find_functions.
7097 * object.cc (Object::handle_split_stack_section): New function.
7098 (Sized_relobj::do_layout): Call handle_split_stack_section.
7099 * dynobj.cc (Sized_dynobj::do_layout): Call
7100 handle_split_stack_section.
7101 * reloc.cc (Sized_relobj::relocate_sections): Call
7102 split_stack_adjust for executable sections in split_stack
7103 objects. Pass reloc_map to relocate_section.
7104 (Sized_relobj::split_stack_adjust): New function.
7105 (Sized_relobj::split_stack_adjust_reltype): New function.
7106 (Sized_relobj::find_functions): New function.
7107 * target-reloc.h: Include "object.h".
7108 (relocate_section): Add reloc_symbol_changes parameter. Change
7109 all callers.
7110 * target.h (class Target): Add calls_non_split method. Declare
7111 do_calls_non_split virtual method. Declare match_view and
7112 set_view_to_nop.
7113 * target.cc: Include "elfcpp.h".
7114 (Target::do_calls_non_split): New function.
7115 (Target::match_view): New function.
7116 (Target::set_view_to_nop): New function.
7117 * gold.cc (queue_middle_tasks): Give an error if mixing
7118 split-stack and non-split-stack objects with -r.
7119 * i386.cc (Target_i386::relocate_section): Add
7120 reloc_symbol_changes parameter.
7121 (Target_i386::do_calls_non_split): New function.
7122 * x86_64.cc (Target_x86_64::relocate_section): Add
7123 reloc_symbol_changes parameter.
7124 (Target_x86_64::do_calls_non_split): New function.
7125 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7126 parameter.
7127 * powerpc.cc (Target_powerpc::relocate_section): Add
7128 reloc_symbol_changes parameter.
7129 * sparc.cc (Target_sparc::relocate_section): Add
7130 reloc_symbol_changes parameter.
7131 * configure.ac: Call AM_CONDITIONAL for the default target.
7132 * configure: Rebuild.
7133 * testsuite/Makefile.am (TEST_AS): New variable.
7134 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7135 (check_DATA): Add split_i386 and split_x86_64 files.
7136 (SPLIT_DEFSYMS): Define.
7137 (split_i386_[1234n].o): New targets.
7138 (split_i386_[124]): New targets.
7139 (split_i386_[1234r].stdout): New targets.
7140 (split_x86_64_[1234n].o): New targets.
7141 (split_x86_64_[124]): New targets.
7142 (split_x86_64_[1234r].stdout): New targets.
7143 (MOSTLYCLEANFILES): Add new executables.
7144 * testsuite/split_i386.sh: New file.
7145 * testsuite/split_x86_64.sh: New file.
7146 * testsuite/split_i386_1.s: New file.
7147 * testsuite/split_i386_2.s: New file.
7148 * testsuite/split_i386_3.s: New file.
7149 * testsuite/split_i386_4.s: New file.
7150 * testsuite/split_i386_n.s: New file.
7151 * testsuite/split_x86_64_1.s: New file.
7152 * testsuite/split_x86_64_2.s: New file.
7153 * testsuite/split_x86_64_3.s: New file.
7154 * testsuite/split_x86_64_4.s: New file.
7155 * testsuite/split_x86_64_n.s: New file.
7156 * testsuite/testfile.cc (Target_test): Update relocation_section
7157 function.
7158 * testsuite/Makefile.in: Rebuild.
7159
7160 2009-10-06 Ian Lance Taylor <iant@google.com>
7161
7162 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7163 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7164 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7165 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7166 the address on ldo_addrs_.
7167 (Target_i386::Relocate::fix_up_ldo): New function.
7168
7169 2009-10-06 Rafael Espindola <espindola@google.com>
7170
7171 * plugin.cc (add_input_library): New.
7172 (Plugin::load): Add add_input_library to tv.
7173 (Plugin_manager::add_input_file): Add the is_lib argument.
7174 (add_input_file): Update call to Plugin_manager::add_input_file.
7175 (add_input_library): New.
7176 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7177
7178 2009-09-30 Doug Kwan <dougkwan@google.com>
7179
7180 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7181 symbol and call Symbol::may_need_copy_reloc to determine if
7182 a copy reloc is needed.
7183 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7184 nocopyreloc is given in command line.
7185 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7186 given in command line.
7187 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7188 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7189 of the removed Target_i386::may_need_copy_reloc.
7190 * options.h (copyreloc): New option with default value false.
7191 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7192 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7193 instead of the removed Target_powerpc::may_need_copy_reloc.
7194 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7195 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7196 instead of the removed Target_sparc::may_need_copy_reloc.
7197 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7198 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7199 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7200 instead of the removed Target_x86_64::may_need_copy_reloc.
7201
7202 2009-09-30 Ian Lance Taylor <iant@google.com>
7203
7204 * object.h (class Object): Remove target_ field, and target,
7205 sized_target, and set_target methods.
7206 (Object::sized_target): Remove.
7207 (class Sized_relobj): Update declarations. Remove sized_target.
7208 * object.cc (Sized_relobj::setup): Remove target parameter.
7209 Change all callers.
7210 (Input_objects::add_object): Don't do anything with the target.
7211 (make_elf_sized_object): Add punconfigured parameter. Change all
7212 callers. Set or test parameter target.
7213 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7214 Change all callers.
7215 * parameters.cc (Parameters::set_target): Change parameter type to
7216 be non-const.
7217 (Parameters::default_target): Remove.
7218 (set_parameters_target): Change parameter type to be non-const.
7219 (parameters_force_valid_target): New function.
7220 (parameters_clear_target): New function.
7221 * parameters.h (class Parameters): Update declarations. Remove
7222 default_target method. Add sized_target and clear_target
7223 methods. Change target_ to be non-const.
7224 (set_parameters_target): Update declaration.
7225 (parameters_force_valid_target): Declare.
7226 (parameters_clear_target): Declare.
7227 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7228 as NULL if we aren't searching.
7229 (Add_symbols::run): Don't check for compatible target.
7230 * fileread.cc (Input_file::open_binary): Call
7231 parameters_force_valid_target.
7232 * gold.cc (queue_middle_tasks): Likewise.
7233 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7234 set_target on object.
7235 * dynobj.h (class Sized_dynobj): Update declarations.
7236 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7237 make_elf_object returns NULL.
7238 (Archive::include_member): Don't check whether object target is
7239 compatible.
7240 * output.cc (Output_section::add_input_section): Get target from
7241 parameters.
7242 (Output_section::relax_input_section): Likewise.
7243 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7244 parameters.
7245 (Sized_relobj::do_scan_relocs): Likewise.
7246 (Sized_relobj::relocate_sections): Likewise.
7247 * resolve.cc (Symbol_table::resolve): Likewise.
7248 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7249 parameter. Change all callers.
7250 (Symbol_table::add_from_object): Get target from parameters.
7251 (Symbol_table::add_from_relobj): Don't check object target.
7252 (Symbol_table::add_from_dynobj): Likewise.
7253 (Symbol_table::define_special_symbol): Get target from
7254 parameters.
7255 * symtab.h (class Symbol_table): Update declaration.
7256 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7257 parameter. Change all callers. Clear parameter target.
7258 (Binary_test): Test target here.
7259 * testsuite/object_unittest.cc (gold_testsuite): Remove
7260 target_test_pointer parameter. Change all callers.
7261 (Object_test): Test target here.
7262
7263 2009-09-26 Ian Lance Taylor <iant@google.com>
7264
7265 * testsuite/initpri1.c: Don't try to use constructor priorities if
7266 compiling with gcc before 4.3.
7267
7268 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7269
7270 * testsuite/retain_symbols_file_test.sh (check_present): Change
7271 output file name to retain_symbols_file_test.stdout.
7272 (check_absent): Likewise.
7273
7274 2009-09-18 Craig Silverstein <csilvers@google.com>
7275
7276 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7277 * options.cc: Include <cerrno> and <fstream>.
7278 (General_options::finalize): Parse -retain-symbols-file tag.
7279 * options.h: New flag.
7280 (General_options): New method should_retain_symbol, new
7281 variable symbols_to_retain.
7282 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7283 should_retain_symbol map.
7284 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7285 * testsuite/Makefile.in: Regenerate.
7286 * testsuite/retain_symbols_file_test.sh: New file.
7287
7288 2009-09-18 Nick Clifton <nickc@redhat.com>
7289
7290 * po/es.po: Updated Spanish translation.
7291
7292 2009-09-17 Doug Kwan <dougkwan@google.com>
7293
7294 * debug.h (DEBUG_RELAXATION): New constant.
7295 (DEBUG_ALL): Add DEBUG_RELAXATION.
7296 (debug_string_to_enum): Add relaxation debug option.
7297 * layout.cc
7298 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7299 Layout::Relaxation_debug_check::read_sections,
7300 Layout::Relaxation_debug_check::read_sections): New method definitions.
7301 (Layout::Layout): Initialize data members
7302 record_output_section_data_from_scrips_,
7303 script_output_section_data_list_ and relaxation_debug_check_.
7304 (Layout::save_segments, Layout::restore_segments,
7305 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7306 Layout::relaxation_loop_body): New method definitions.
7307 (Layout::finalize): Support relaxation. Move section layout code to
7308 Layout::relaxation_loop_body.
7309 (Layout::set_asection_address_from_script): Move code for orphan
7310 section placement out.
7311 (Layout::place_orphan_sections_in_script): New method definition.
7312 * layout.h (Output_segment_headers, Output_file_header):
7313 New forward class declarations.
7314 (Layout::~Layout): Define.
7315 (Layout::new_output_section_data_from_script): New method definition.
7316 (Layout::place_orphan_sections_in_script): New method declaration.
7317 (Layout::Segment_states): New type declaration.
7318 (Layout::save_segments, Layout::restore_segments,
7319 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7320 Layout::relaxation_loop_body): New method declarations.
7321 (Layout::Output_section_data_list): New type declaration.
7322 (Layout::Relaxation_debug_check): New class definition.
7323 (Layout::record_output_section_data_from_script_,
7324 Layout::script_output_section_data_list_, Layout::segment_states_,
7325 Layout::relaxation_debug_check_): New data members.
7326 * output.cc: (Output_section_headers::do_size): New method definition.
7327 (Output_section_headers::Output_section_headers): Move size
7328 computation to Output_section_headers::do_size.
7329 (Output_segment_headers::do_size): New method definition.
7330 (Output_file_header::Output_file_header): Move size computation to
7331 Output_file_header::do_size and call it.
7332 (Output_file_header::do_size): New method definition.
7333 (Output_data_group::Output_data_group): Adjust call to
7334 Output_section_data.
7335 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7336 (Output_symtab_xindex::do_write): Add array bound check.
7337 (Output_section::Input_section::print_to_mapfile): Handle
7338 RELAXED_INPUT_SECTION_CODE.
7339 (Output_section::Output_section): Initialize data member checkpoint_.
7340 (Output_section::~Output_section): Delete checkpoint object pointed
7341 by checkpoint_.
7342 (Output_section::add_input_section): Always add an Input_section if
7343 relaxing.
7344 (Output_section::add_merge_input_section): Add assert.
7345 (Output_section::relax_input_section): New method definition.
7346 (Output_section::set_final_data_size): Set load address to zero for
7347 an unallocated section.
7348 (Output_section::do_address_and_file_offset_have_reset_values):
7349 New method definition.
7350 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7351 Handle relaxed input section.
7352 (Output_section::sort_attached_input_sections): Checkpoint input
7353 section list lazily.
7354 (Output_section::get_input_sections): Change type of input_sections to
7355 list of Simple_input_section pointers. Checkpoint input section list
7356 lazily. Also handle relaxed input sections.
7357 (Output_section::add_input_section_for_script): Take a reference to
7358 a Simple_input_section object instead of Relobj pointer and section
7359 index as parameter. Handle relaxed input sections.
7360 (Output_section::save_states, Output_section::restore_states): New
7361 method definitions.
7362 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7363 (Output_data::is_data_size_fixed): New method definition.
7364 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7365 if it is fixed.
7366 (Output_data::address_and_file_offset_have_reset_values): New method
7367 definition.
7368 (Output_data::do_address_and_file_offset_have_reset_values): New method
7369 definition.
7370 (Output_data::set_data_size): Check that data size is not fixed.
7371 (Output_data::fix_data_size): New method definition.
7372 (Output_data::is_data_size_fixed_): New data member.
7373 (Output_section_headers::set_final_data_size): New method definition.
7374 (Output_section_headers::do_size): New method declaration.
7375 (Output_segment_headers::set_final_data_size): New method definition.
7376 (Output_segment_headers::do_size): New method declaration.
7377 (Output_file_header::set_final_data_size)::New method definition.
7378 (Output_file_header::do_size)::New method declaration.
7379 (Output_section_data::Output_section_data): Add new parameter
7380 is_data_size_fixed and use it to fix data size.
7381 (Output_data_const::Output_data_const): Adjust call to base class
7382 constructor and fix data size.
7383 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7384 base class constructor and fix data size.
7385 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7386 base class constructor and fix data size.
7387 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7388 class constructor and fix data size.
7389 (Output_data_group::set_final_data_size): New method definition.
7390 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7391 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7392 class constructor and fix data size.
7393 (Output_relaxed_input_section): New class definition.
7394 (Output_section::Simple_input_section): New class definition.
7395 (Output_section::get_input_sections): Adjust parameter list.
7396 (Output_section::add_input_section_for_script): Same.
7397 (Output_section::save_states, Output_section::restore_states,
7398 Output_section::do_address_and_file_offset_have_reset_values,
7399 (Output_section::Input_section::Input_section): Handle
7400 RELAXED_INPUT_SECTION_CODE. Add new overload for
7401 Output_relaxed_input_section.
7402 (Output_section::Input_section::is_input_section,
7403 Output_section::Input_section::set_output_section): Handle relaxed
7404 input section.
7405 (Output_section::Input_section::is_relaxed_input_section,
7406 Output_section::Input_section::output_section_data,
7407 Output_section::Input_section::relaxed_input_section): New method
7408 definitions.
7409 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7410 value.
7411 (Output_section::Input_section::u1_): Update comments.
7412 (Output_section::Input_section::u2_): Add new union member poris.
7413 (Output_section::Checkpoint_output_section): New classs definition.
7414 (Output_section::relax_input_section): New method declaration.
7415 (Output_section::checkpoint_): New data member.
7416 (Output_segment): Update comments.
7417 (Output_segment::Output_segment): Un-privatize copy constructor.
7418 (Output_segment::operator=): Un-privatize.
7419 * script-sections.cc (Output_section_element::Input_section_list):
7420 Change element type to Output_section::Simple_input_section.
7421 (Output_section_element_dot_assignment::set_section_addresses):
7422 Register output section data for relaxation clean up.
7423 (Output_data_exression::Output_data_expression): Adjust call to base
7424 constructor to fix data size.
7425 (Output_section_element_data::set_section_addresses): Register
7426 Output_data_expression object for relaxation clean up.
7427 (struct Input_section_info): Replace Relobj pointer and section index
7428 pair with Output_section::Simple_input_section and Convert struct to a
7429 class.
7430 (Input_section_sorter::operator()): Adjust access to
7431 Input_section_info data member to use accessors.
7432 (Output_section_element_input::set_section_addresses): Use layout
7433 parameter. Adjust code to use Output_section::Simple_input_section
7434 and Input_secction_info classes. Register filler for relaxation
7435 clean up.
7436 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7437 and section index pair with Output_section::Simple_input_section
7438 class. Adjust code accordingly.
7439 (Phdrs_element::release_segment): New method definition.
7440 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7441 segment list.
7442 (Script_sections::release_segments): New method definition.
7443 * gold/script-sections.h (Script_sections::release_segments): New
7444 method declaration.
7445 * gold/target.h (Target::may_relax, Target::relax,
7446 Target::do_may_relax, Target::do_relax): New method definitions.
7447
7448 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7449
7450 * arm.cc (has_signed_unsigned_overflow): New function.
7451 (Arm_relocate_functions::abs8): New function.
7452 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7453 (Target_arm::Scan::global): Likewise.
7454 (Target_arm::relocate::relocate): Likewise.
7455 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7456 Likewise.
7457
7458 2009-09-16 Cary Coutant <ccoutant@google.com>
7459
7460 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7461 * testsuite/Makefile.in: Regenerate.
7462
7463 2009-09-11 Nick Clifton <nickc@redhat.com>
7464
7465 * po/gold.pot: Updated by the Translation project.
7466
7467 2009-09-08 Cary Coutant <ccoutant@google.com>
7468
7469 * output.cc (Output_file::open): Add execute permission to empty file.
7470 * testsuite/Makefile.am (permission_test): New test.
7471 * testsuite/Makefile.in: Regenerate.
7472
7473 2009-09-02 Ian Lance Taylor <iant@google.com>
7474
7475 * output.cc (Output_file::resize): Call map_no_anonymous rather
7476 than map.
7477
7478 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7479
7480 * gold.cc: Include "incremental.h".
7481 (queue_initial_tasks): Call Incremental_checker methods.
7482 * incremental.cc: Include "output.h".
7483 (Incremental_checker::can_incrementally_link_output_file): New
7484 method.
7485 * incremental.h (Incremental_checker): New class.
7486
7487 * output.cc (Output_file::open_for_modification): New method.
7488 (Output_file::map_anonymous): Changed return type to bool. Record
7489 map in base_ field.
7490 (Output_file::map_no_anonymous): New method, broken out of map.
7491 (Output_file::map): Use map_no_anonymous and map_anonymous.
7492 * output.h (class Output_file): Update declarations.
7493
7494 2009-08-24 Cary Coutant <ccoutant@google.com>
7495
7496 * options.h (Command_line::Pre_options): New class.
7497 (Command_line::pre_options): New member.
7498 * options.cc (gold::options::ready_to_register): New variable.
7499 (One_option::register_option): Do nothing if not registering options.
7500 Assert if same short option registered twice.
7501 (General_options::General_options): Turn off option registration when
7502 done constructing.
7503 (Command_line::Pre_options::Pre_options): New constructor.
7504
7505 2009-08-24 Cary Coutant <ccoutant@google.com>
7506
7507 * options.h (General_options::no_keep_memory): Remove incorrect
7508 short option.
7509
7510 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7511
7512 * Makefile.am (am__skiplex, am__skipyacc): New.
7513 * Makefile.in: Regenerate.
7514
7515 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7516
7517 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7518 (INCLUDES): ... this.
7519 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7520 (AM_CPPFLAGS): Renamed from ...
7521 (INCLUDE): ... this.
7522 * Makefile.in, testsuite/Makefile.in: Regenerate.
7523
7524 * Makefile.in: Regenerate.
7525 * aclocal.m4: Likewise.
7526 * config.in: Likewise.
7527 * configure: Likewise.
7528 * testsuite/Makefile.in: Likewise.
7529
7530 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7531 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7532 * Makefile.in: Regenerate.
7533 * testsuite/Makefile.in: Regenerate.
7534
7535 2009-08-19 Cary Coutant <ccoutant@google.com>
7536
7537 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7538 symbols in shared libraries overridden by hidden or internal symbols
7539 in the main program.
7540
7541 2009-08-19 Chris Demetriou <cgd@google.com>
7542
7543 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7544 checking source file names in error messages.
7545
7546 2009-08-18 Doug Kwan <dougkwan@google.com>
7547
7548 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7549 an elcpp::Ehdr as parameter. Adjust call to set_target.
7550 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7551 an elfcpp::Ehdr as parameter.
7552 * object.cc (Object::set_target): Remove the version that looks up
7553 a target and sets it.
7554 (Sized_relobj::setup): Take a Target object instead of
7555 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7556 (make_elf_sized_object): Find target and ask target to
7557 make an ELF object.
7558 * object.h: (Object::set_target): Remove the version that looks up
7559 a target and sets it.
7560 (Sized_relobj::setup): Take a Target object instead of
7561 an elfcpp:Ehdr as parameter.
7562 * target.cc: Include dynobj.h.
7563 (Target::do_make_elf_object_implementation): New.
7564 (Target::do_make_elf_object): New.
7565 * target.h (Target::make_elf_object): New template declaration.
7566 (Target::do_make_elf_object): New method declarations.
7567 (Target::do_make_elf_object_implementation): New template declaration.
7568
7569 2009-08-14 Ian Lance Taylor <iant@google.com>
7570
7571 * gold.h (FUNCTION_NAME): Define.
7572 (gold_unreachable): Use FUNCTION_NAME.
7573
7574 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7575
7576 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7577 symbol in the --keep-unique list is not found.
7578
7579 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7580
7581 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7582 been maked as --keep-unique.
7583 (Icf::unfold_section): New function.
7584 * icf.h (Icf::unfold_section): New function.
7585 * options.h (General_options::keep_unique): New option.
7586 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7587 * testsuite/Makefile.in: Regenerate.
7588 * testsuite/icf_keep_unique_test.sh: New file.
7589 * testsuite/icf_keep_unique_test.cc: New file.
7590
7591 2009-08-12 Cary Coutant <ccoutant@google.com>
7592
7593 PR 10471
7594 * resolve.cc (Symbol_table::resolve): Check for references from
7595 dynamic objects to hidden and internal symbols.
7596 * testsuite/Makefile.am (hidden_test.sh): New test.
7597 * testsuite/Makefile.in: Regenerate.
7598 * testsuite/hidden_test.sh: New script.
7599 * testsuite/hidden_test_1.c: New test source.
7600 * testsuite/hidden_test_main.c: New test source.
7601
7602 2009-08-11 Doug Kwan <dougkwan@google.com>
7603
7604 * arm.cc: Update comments.
7605 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7606 segment to locate the .ARM.exidx section if present.
7607
7608 2009-08-09 Doug Kwan <dougkwan@google.com>
7609
7610 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7611 patch.
7612
7613 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7614 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7615 compiler warnings.
7616
7617 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7618
7619 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7620 valid tls_segment only for non-debug-section relocations.
7621 * testsuite/Makefile.am: Add gc_tls_test.
7622 * testsuite/Makefile.in: Regenerate.
7623 * testsuite/gc_tls_test.cc: New file.
7624 * testsuite/gc_tls_test.sh: New file.
7625
7626 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7627
7628 * icf.cc: New file.
7629 * icf.h: New file.
7630 * Makefile.am (CCFILES): Add icf.cc.
7631 (HFILES): Add icf.h
7632 * Makefile.in: Regenerate.
7633 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7634 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7635 section, symbol and addend information for the relocs.
7636 * gold.cc (queue_middle_tasks): Call identical code folding.
7637 * gold.h: Add defines for multimap.
7638 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7639 to the call of finalize_local_symbols.
7640 * main.cc (main): Create object of class Icf.
7641 * object.cc (Sized_relobj::do_layout): Allow this function to be
7642 called twice during icf.
7643 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7644 to sections marked as identical by icf.
7645 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7646 when available.
7647 (Sized_relobj::do_section_entsize): New function.
7648 * object.h (Object::section_entsize): New function.
7649 (Object::do_section_entsize): New pure virtual function.
7650 (Relobj::finalize_local_symbols): Add new parameter.
7651 (Relobj::do_section_entsize): New function.
7652 * options.h (General_options::icf): New option.
7653 (General_options::icf_iterations): New option.
7654 (General_options::print_icf_sections): New option.
7655 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7656 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7657 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7658 icf.
7659 * symtab.cc (Symbol_table::is_section_folded): New function.
7660 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7661 to sections marked as identical by icf.
7662 * symtab.h (Symbol_table::set_icf): New function.
7663 (Symbol_table::icf): New function.
7664 (Symbol_table::is_section_folded): New function.
7665 (Symbol_table::icf_): New data member.
7666 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7667 * testsuite/Makefile.am: Add commands to build icf_test.
7668 * testsuite/Makefile.in: Regenerate.
7669 * testsuite/icf_test.sh: New file.
7670 * testsuite/icf_test.cc: New file.
7671
7672 2009-07-24 Chris Demetriou <cgd@google.com>
7673
7674 * layout.cc (is_compressible_debug_section): Fix incorrect
7675 comment about compressed section names.
7676
7677 2009-07-20 Ian Lance Taylor <ian@airs.com>
7678
7679 PR 10419
7680 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7681
7682 2009-07-16 Ian Lance Taylor <iant@google.com>
7683
7684 PR 10400
7685 * layout.h: #include <map>.
7686 (class Kept_section): Change from struct to class. Add accessors
7687 and setters. Add section size to Comdat_group mapping. Change
7688 Comdat_group to std::map. Add is_comdat_ field. Add
7689 linkonce_size field in union.
7690 (class Layout): Update declaration of find_or_add_kept_section.
7691 Don't declare find_kept_object.
7692 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7693 parameter. Add object, shndx, is_comdat, and is_group_name
7694 parameters. Change all callers. Adjust for new Kept_section.
7695 (Layout::find_kept_object): Remove.
7696 * object.cc (Sized_relobj::include_section_group): Update use of
7697 Kept_section. Rename secnum to shndx. Only record
7698 Kept_comdat_section if sections are the same size.
7699 (Sized_relobj::include_linkonce_section): Update use of
7700 Kept_section. Only record Kept_comdat_section if sections are the
7701 same size. Set size of linkonce section.
7702 (Sized_relobj::map_to_kept_section): Update call to
7703 get_kept_comdat_section.
7704 * object.h (class Sized_relobj): Rename fields in
7705 Kept_comdat_section to drop trailing underscores; change object
7706 field to Relobj*. Change Kept_comdat_section_table to store
7707 struct rather than pointer.
7708 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7709 Add kept_object and kept_shndx parameters. Change all callers.
7710 (Sized_relobj::get_kept_comdat_section): Change return type to
7711 bool. Add kept_object and kept_shndx parameters. Change all
7712 callers.
7713 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7714 Layout::find_or_add_kept_section.
7715
7716 2009-07-09 Ian Lance Taylor <iant@google.com>
7717
7718 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7719 Reserve space in the hash table.
7720
7721 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7722
7723 * fileread.cc (File_read::get_mtime): New method.
7724 * fileread.h (Timespec): New structure.
7725 (File_read::get_mtime): New method.
7726 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7727 Renamed from timestamp_nsec.
7728 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7729 Elf_Xword.
7730 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7731 timestamp_nsec.
7732 (Incremental_inputs::report_archive): Save mtime; style fix.
7733 (Incremental_inputs::report_obejct): Save mtime; style fix.
7734 (Incremental_inputs::report_script): Save mtime; style fix.
7735 (Incremental_inputs::finalize_inputs): Style fix.
7736 (Incremental_inputs::finalize): Style fix.
7737 (Incremental_inputs::create_input_section_data): Store inputs
7738 mtime.
7739 * incremental.h (Incremental_inputs::report_script): Add mtime
7740 argument.
7741 (Incremental_inputs::Input_info::Input_info): Intialize only one
7742 union member.
7743 (Incremental_inputs::Input_info::archive): Move to nameless
7744 union.
7745 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7746 (Incremental_inputs::Input_info::script): Move to nameless union.
7747 (Incremental_inputs::mtime): New field.
7748 * script.cc (read_input_script): Pass file mtime to
7749 Incremental_input.
7750 * script.h (Script_info::inputs): Style fix.
7751
7752 2009-07-01 Ian Lance Taylor <ian@airs.com>
7753
7754 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7755 instead of 32.
7756
7757 2009-06-24 Ian Lance Taylor <iant@google.com>
7758
7759 PR 10156
7760 * layout.cc (Layout::choose_output_section): If we find an
7761 existing section, update the flags.
7762 (Layout::create_notes): New function, broken out of
7763 Layout::finalize.
7764 (Layout::finalize): Don't create note sections.
7765 (Layout::create_note): Don't crash if linker script discards
7766 section.
7767 (Layout::create_gold_note): Likewise.
7768 (Layout::create_build_id): Likewise. Don't set
7769 after_input_sections on the section.
7770 (Layout::create_executable_stack_info): Remove target parameter.
7771 Change caller.
7772 * layout.h (class Layout): Declare create_notes. Update
7773 declaration of create_executable_stack_info.
7774 * gold.cc (queue_middle_tasks): Call create_notes.
7775 * output.cc (Output_section::update_flags_for_input_section): Move
7776 here from output.h. If SHF_ALLOC flag is newly set, mark address
7777 invalid.
7778 * output.h (Output_data::mark_address_invalid): New function.
7779 (class Output_section): Only declare, not define,
7780 update_flags_for_input_section. Remove set_flags.
7781
7782 2009-06-24 Ian Lance Taylor <iant@google.com>
7783
7784 * script-sections.cc (Output_section_definition::
7785 set_section_addresses): Rename shadowing local load_address to
7786 laddr.
7787
7788 2009-06-24 Ian Lance Taylor <iant@google.com>
7789
7790 PR 10244
7791 * reloc.cc (relocate_sections): Skip empty relocation sections.
7792
7793 2009-06-23 Ian Lance Taylor <iant@google.com>
7794
7795 PR 10156
7796 * layout.cc (Layout::create_note): Use choose_output_section
7797 rather than make_output_section.
7798
7799 2009-06-23 Ian Lance Taylor <iant@google.com>
7800
7801 PR 10237
7802 * options.cc (General_options::parse_V): Set printed_version_.
7803 (General_options::General_options): Initialize printed_version_.
7804 * options.h (class General_options): Add printed_version_ field.
7805 * gold.cc (queue_initial_tasks): If there are no input files,
7806 don't give a fatal error if we printed the version information.
7807 (queue_middle_tasks): If using -r with a shared object, give a
7808 fatal error rather than an ordinary error.
7809
7810 2009-06-23 Ian Lance Taylor <iant@google.com>
7811
7812 PR 10219
7813 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7814 (Layout::make_output_section): Set have_stabstr_section_ if we see
7815 a .stab*str section.
7816 (Layout::finalize): Call link_stabs_sections.
7817 (Layout::link_stabs_sections): New file.
7818 * layout.h (class Layout): Add have_stabstr_section_ field.
7819 Declare link_stabs_sections.
7820
7821 2009-06-23 Doug Kwan <dougkwan@google.com>
7822
7823 * Makefile.am (libgold_a_LIBADD): New.
7824 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7825 * Makefile.in: Regenerate.
7826 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7827 * configure: Regenerate.
7828 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7829 * fileread.cc: Include sys/state.h
7830 * gold.h: Declare memmem and strndup if found missing.
7831 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7832
7833 2009-06-23 Ian Lance Taylor <iant@google.com>
7834
7835 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7836 * configure: Rebuild.
7837
7838 2009-06-23 Ian Lance Taylor <iant@google.com>
7839
7840 PR 10147
7841 * object.cc (Object::section_contents): Don't try to get a view if
7842 the section has length zero.
7843 (Object::handle_gnu_warning_section): If the section is empty, use
7844 the name of the section as the warning.
7845
7846 2009-06-23 Ian Lance Taylor <iant@google.com>
7847
7848 PR 10133
7849 * stringpool.h (class Stringpool_template): Add optimize_ field.
7850 (Stringpool_template::set_optimize): New function.
7851 * stringpool.cc (Stringpool_template::Stringpool_template):
7852 Initialize optimize_ field.
7853 (Stringpool_template::set_string_offsets): Test local optimize
7854 fild rather than parameter.
7855 * layout.cc (Layout::Layout): Call set_optimize on the section
7856 name stringpool.
7857
7858 2009-06-22 Ian Lance Taylor <iant@google.com>
7859
7860 PR 10030
7861 * yyscript.y: Parse TARGET.
7862 * script.cc (script_set_target): New function.
7863 * script-c.h (script_set_target): Declare.
7864 * options.cc (General_options::string_to_object_format): Rename
7865 from string_to_object_format in anonymous namespace. Change
7866 callers.
7867 * options.h (class General_options): Declare
7868 string_to_object_format.
7869
7870 2009-06-22 Ian Lance Taylor <iant@google.com>
7871
7872 * script-sections.cc (Script_sections::create_segments): Don't put
7873 program headers in a PT_LOAD segment if -n or -N.
7874
7875 2009-06-22 Ian Lance Taylor <iant@google.com>
7876
7877 PR 10141
7878 * options.h (class General_options): Add -z lazy and -z now. Sort
7879 -z options into alphabetical order.
7880 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7881
7882 2009-06-21 Ian Lance Taylor <iant@google.com>
7883
7884 * layout.cc (Layout::make_output_section): Call
7885 Target::new_output_section.
7886 (Layout::attach_allocated_section_to_segment): Put large section
7887 sections in a separate load segment with the large segment flag
7888 set.
7889 (Layout::segment_precedes): Sort large data segments after other
7890 load segments.
7891 (align_file_offset): New static function.
7892 (Layout::set_segment_offsets): Use align_file_offset.
7893 * output.h (class Output_section): Add is_small_section_ and
7894 is_large_section_ fields.
7895 (Output_section::is_small_section): New function.
7896 (Output_section::set_is_small_section): New function.
7897 (Output_section::is_large_section): New function.
7898 (Output_section::set_is_large_section): New function.
7899 (Output_section::is_large_data_section): New function.
7900 (class Output_segment): Add is_large_data_segment_ field.
7901 (Output_segment::is_large_data_segment): New function.
7902 (Output_segment::set_is_large_data_segment): New function.
7903 * output.cc (Output_section::Output_section): Initialize new
7904 fields.
7905 (Output_segment::Output_segment): Likewise.
7906 (Output_segment::add_output_section): Add assertion that large
7907 data sections always go in large data segments. Force small data
7908 sections to the end of the list of data sections. Force small BSS
7909 sections to the start of the list of BSS sections. For large BSS
7910 sections to the end of the list of BSS sections.
7911 * symtab.h (class Symbol): Declare is_common_shndx.
7912 (Symbol::is_defined): Check Symbol::is_common_shndx.
7913 (Symbol::is_common): Likewise.
7914 (class Symbol_table): Define enum Commons_section_type. Update
7915 declarations. Add small_commons_ and large_commons_ fields.
7916 * symtab.cc (Symbol::is_common_shndx): New function.
7917 (Symbol_table::Symbol_table): Initialize new fields.
7918 (Symbol_table::add_from_object): Put small and large common
7919 symbols in the right list.
7920 (Symbol_table::sized_finalized_symbol): Check
7921 Symbol::is_common_shndx.
7922 (Symbol_table::sized_write_globals): Likewise.
7923 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7924 common symbol lists. Don't call do_allocate_commons_list if the
7925 list is empty.
7926 (Symbol_table::do_allocate_commons_list): Remove is_tls
7927 parameter. Add comons_section_type parameter. Change all
7928 callers. Handle small and large common symbols.
7929 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7930 Symbol::is_common_shndx.
7931 * resolve.cc (symbol_to_bits): Likewise.
7932 * target.h (Target::small_common_shndx): New function.
7933 (Target::small_common_section_flags): New function.
7934 (Target::large_common_shndx): New function.
7935 (Target::large_common_section_flags): New function.
7936 (Target::new_output_section): New function.
7937 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7938 small_common_section_flags, and large_common_section_flags
7939 fields.
7940 (Target::do_new_output_section): New virtual function.
7941 * arm.cc (Target_arm::arm_info): Initialize new fields.
7942 * i386.cc (Target_i386::i386_info): Likewise.
7943 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
7944 Likewise.
7945 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
7946 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
7947 (Target_x86_64::do_new_output_section): New function.
7948 * configure.ac: Define conditional MCMODEL_MEDIUM.
7949 * testsuite/Makefile.am (check_PROGRAMS): Add large.
7950 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
7951 (large_LDFLAGS): Define.
7952 * testsuite/large.c: New file.
7953 * testsuite/testfile.cc (Target_test::test_target_info):
7954 Initialize new fields.
7955 * configure, testsuite/Makefile.in: Rebuild.
7956
7957 2009-06-05 Doug Kwan <dougkwan@google.com>
7958
7959 * Makefile.am (CCFILES): Add target.cc.
7960 * Makefile.in: Regenerate.
7961 * i386.cc (class Target_i386): Define new virtual method to
7962 override do_is_local_label_name in parent.
7963 * object.cc (Sized_relobj::do_count_local_symbols): Discard
7964 local symbols if --discard-locals or -X is given.
7965 * options.h (class General_options): Declare new options
7966 '--discard-locals' and '-X' for discarding locals.
7967 * target.h (class Target): Define new methods is_local_label_name.
7968 Declare new virtual method do_is_local_label_name.
7969 * target.cc: New file.
7970 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
7971 (check_SCRIPTS): Add discard_locals_test.sh.
7972 (check_DATA): Add discard_local_tests.syms.
7973 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
7974 (discard_local_tests.syms, discard_locals_test.o): New make rules.
7975 * testsuite/Makefile.in: Regenerate.
7976 * testsuite/discard_locals_test.c: New file.
7977 * testsuite/discard_locals_test.sh: Same.
7978
7979 2009-06-05 Doug Kwan <dougkwan@google.com>
7980
7981 * object.cc (Sized_relobj::Sized_relobj): Initialize
7982 discarded_eh_frame_shndx_ to -1U.
7983 (Sized_relobj::do_layout): Record index of a discard .eh_frame
7984 section.
7985 (Sized_relobj::do_count_local_symbols): Skip local symbols in
7986 a discarded .eh_frame section.
7987 (Sized_relobj::do_finalize_local_symbols): Ditto.
7988 * object.h (class Sized_relobj): Declare new member
7989 discarded_eh_frame_shndx_.
7990 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
7991 (local_labels_test.o, local_labels_test): New rules.
7992 * testsuite/Makefile.in: Regenerate.
7993
7994 2009-06-04 Doug Kwan <dougkwan@google.com>
7995
7996 * layout.cc (Layout::section_name_mapping): Add mapping for
7997 special ARM sections.
7998
7999 2009-06-03 Doug Kwan <dougkwan@google.com>
8000
8001 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8002 (utils::has_overflow): Same.
8003
8004 2009-06-03 Ian Lance Taylor <iant@google.com>
8005
8006 * layout.cc (Layout::section_name_mapping): New array, replacing
8007 Layout::linkonce_mapping.
8008 (Layout::section_name_mapping_count): New variable, replacing
8009 Layout::linkonce_mapping_count.
8010 (Layout::linkonce_output_name): Remove.
8011 (Layout::output_section_name): Rewrite.
8012 * layout.h (class Layout): Rename Linkonce_mapping to
8013 Section_name_mapping, linkonce_mapping to section_name_mapping,
8014 linkonce_mapping_count to section_name_mapping_count. Don't
8015 declare linkonce_output_name.
8016
8017 2009-06-03 Doug Kwan <dougkwan@google.com>
8018
8019 * gold/arm.cc (namespace utils): New.
8020 (Target_arm::reloc_is_non_pic): Define new method.
8021 (class Arm_relocate_functions): New.
8022 (Target_arm::Relocate::relocate): Handle relocation types used by
8023 Android.
8024
8025 2009-06-03 Ian Lance Taylor <iant@google.com>
8026
8027 * arm.cc (Target_arm::scan::global): Use || instead of |.
8028
8029 2009-06-02 Doug Kwan <dougkwan@google.com>
8030
8031 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8032 issued_non_pic_error_.
8033 (class Target_arm::Scan): Declare new method check_non_pic.
8034 Define new method symbol_needs_plt_entry.
8035 Declare new data member issued_non_pic_error_.
8036 (class Target_arm::Relocate): Declare new method
8037 should_apply_static_reloc.
8038 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8039 (Target_arm::Scan::check_non_pic): Define new method.
8040 (Target_arm::Scan::local): Handle a small subset of reloc types used
8041 by Android.
8042 (Target_arm::Scan::local): Same.
8043 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8044
8045 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8046
8047 * incremental.cc (Incremental_inputs::report_command_line): Filter
8048 out --incremental-* options.
8049
8050 2009-05-29 Doug Kwan <dougkwan@google.com>
8051
8052 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8053 template class.
8054 (class Target_arm): Update comment.
8055 (Target_arm::Target_arm): Initialize new data members GOT_,
8056 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8057 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8058 and Target_arm::rel_dyn_section.
8059 Declare new_enum Target_arm::Got_type.
8060 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8061 and DYNBSS_.
8062 Update commments for member do_dynsym_value.
8063 (Target_arm::got_size, Target_arm::plt_section,
8064 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8065 new methods inside class defintion.
8066 (Target_arm::got_section): Define new method.
8067 (Target_arm::rel_dyn_section): Same.
8068 (Output_data_plt_arm): New template class.
8069 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8070 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8071 (Output_data_plt_arm::add_entry): Same.
8072 (Output_data_plt_arm::first_plt_entry): Define new
8073 static data member for PLT instruction template.
8074 (Output_data_plt_arm::plt_entry): Same.
8075 (Output_data_plt_arm::do_write): Define new method.
8076 (Target_arm::make_plt_entry): Same.
8077 (Target_arm::do_finalize_sections): Same.
8078 (Target_arm::do_dynsym_value): Same.
8079
8080 2009-05-28 Doug Kwan <dougkwan@google.com>
8081
8082 * Makefile.am (TARGETSOURCES): Add arm.cc.
8083 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8084 * Makefile.in: Regenerate.
8085 * arm.cc: New file.
8086 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8087
8088 2009-05-26 Doug Kwan <dougkwan@google.com>
8089
8090 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8091 (General_options::check_excluded_libs): Strip off directories in
8092 archive name before matching like GNU ld does.
8093 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8094 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8095 (exclude_libs_test_LDFLAGS): Add linker option
8096 -Wl,--exclude-libs,libexclude_libs_test_3
8097 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8098 an explicit archive without using -l.
8099 (alt/libexclude_libs_test_3.a): New make rule.
8100 * testsuite/Makefile.in: Regenerate.
8101 * testsuite/exclude_libs_test.c : Declare lib3_default().
8102 (main): Call it.
8103 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8104 * exclude_libs_test_3.c: New file.
8105
8106 2009-05-26 Nick Clifton <nickc@redhat.com>
8107
8108 * po/id.po: New Indonesian translation.
8109 * po/gold.pot: Updated template file.
8110
8111 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8112
8113 * testsuite/Makefile.am: Add -ffunction-sections to compile
8114 gc_comdat_test files. Add -Wl,--gc-sections to build
8115 gc_comdat_test.
8116 * testsuite/Makefile.in: Regenerate.
8117 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8118
8119 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8120
8121 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8122 kept comdat section was garbage collected.
8123 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8124 * testsuite/Makefile.in: Regenerate.
8125 * testsuite/gc_comdat_test.sh: New file.
8126 * testsuite/gc_comdat_test_1.cc: New file.
8127 * testsuite/gc_comdat_test_2.cc: New file.
8128
8129 2009-05-19 Doug Kwan <dougkwan@google.com>
8130
8131 * archive.cc (Archive::Archive): Move constructor from archive.h
8132 to here. Initialize no_export_.
8133 (Archive::get_elf_object_for_member): Set no_export flag of object.
8134 * archive.h (Archive::Archive): Move constructor body to
8135 archive.cc.
8136 (Archive::no_export): New method.
8137 (Archive::no_export_): New field.
8138 * object.h (Object::Object): Initialize no_export_ to false.
8139 (Object::no_export, Object::set_no_export): New methods.
8140 (Object::no_export_): New field.
8141 * options.cc (General_options::parse_exclude_libs): New method.
8142 (General_options::check_excluded_libs) Same.
8143 * options.h (exclude_libs): New option.
8144 (General_options::check_excluded_libs): New method declaration.
8145 (General_options::excluded_libs_): New field.
8146 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8147 default or protected visibility if an object has no-export flag set.
8148 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8149 (check_SCRIPTS): Add exclude_libs_test.sh.
8150 (check_DATA): Add exclude_libs_test.syms.
8151 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8152 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8153 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8154 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8155 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8156 libexclude_libs_test_2.a): New rules.
8157 * testsuite/Makefile.in: Regenerate.
8158 * testsuite/exclude_libs_test.c: New file.
8159 * testsuite/exclude_libs_test.sh: Ditto.
8160 * testsuite/exclude_libs_test_1.c: Ditto.
8161 * testsuite/exclude_libs_test_2.c: Ditto.
8162
8163 2009-05-15 Ian Lance Taylor <iant@google.com>
8164
8165 * configure.ac: Check for declarations for cases where libiberty.h
8166 checks HAVE_DECL_xxx.
8167 * configure, config.in: Rebuild.
8168
8169 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8170
8171 * gold.h (Incremental_argument_list): Remove (invalid) forward
8172 declaration.
8173 * incremental.cc (Incremental_inputs::report_achive): New method.
8174 (Incremental_inputs::report_object): New method.
8175 (Incremental_inputs::report_script): New method.
8176 (Incremental_inputs::finalize_inputs): New method.
8177 (Incremental_inputs::finalize): Call finalize_inputs().
8178 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8179 Create inputs entries.
8180 * incremental.h (Incremental_input_type): New enum.
8181 (Incremental_inputs::Incremental_input): Initialize new fields.
8182 (Incremental_inputs::report_inputs): New method.
8183 (Incremental_inputs::report_achive): New method.
8184 (Incremental_inputs::report_object): New method.
8185 (Incremental_inputs::report_script): New method.
8186 (Incremental_inputs::finalize_inputs): New method.
8187 (Incremental_inputs::Input_info): New struct.
8188 (Incremental_inputs::Input_info_map): New typedef.
8189 (Incremental_inputs::lock_): New field.
8190 (Incremental_inputs::Inputs_): New field.
8191 (Incremental_inputs::Inputs_map): New field.
8192 * main.cc (main): Call Incremental_input::report_inputs.
8193 * options.h (Input_argument_list): Typedef moved from
8194 Input_arguments.
8195 (Input_file_group::Files): Remove, use ::Input_argument_list.
8196 (Input_file_group::Input_argument_list): Remove, use
8197 ::Input_argument_list.
8198 * plugin.cc (Plugin_manager::add_input_file): Add error in
8199 incremental build.
8200 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8201 functions.
8202 * script.cc (read_input_script): Call
8203 Incremental_input::report_script.
8204 * script.h (Script_info): New class.
8205
8206 2009-04-27 Ian Lance Taylor <iant@google.com>
8207
8208 * x86_64.cc (do_adjust_output_section): Set entsize to
8209 plt_entry_size.
8210
8211 2009-04-23 Elliott Hughes <enh@google.com>
8212
8213 * output.cc (Output_file::close): After short writes, continue
8214 writing from the correct offset in the buffer being written.
8215
8216 2009-04-23 Chris Demetriou <cgd@google.com>
8217
8218 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8219 * configure: Regenerate.
8220 * config.in: Regenerate.
8221 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8222 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8223
8224 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8225
8226 * incremental.cc (Incremental_inputs_header_data): Renamed from
8227 Incremental_input_header_data.
8228 (Incremental_inputs_header_data::data_size): New field.
8229 (Incremental_inputs_header_data::put_input_file_count): Renamed
8230 from input_file_count.
8231 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8232 from command_line_offset.
8233 (Incremental_inputs_header_data::put_reserved): Renamed from
8234 put_reserved.
8235 (Incremental_inputs_entry_data): Renamed from
8236 Incremental_input_entry_data.
8237 (Incremental_inputs_entry_data::data_size): New field.
8238 (Incremental_inputs::report_command_line): New method.
8239 (Incremental_inputs::finalize): New method.
8240 (Incremental_inputs::create_incremental_inputs_data): New method.
8241 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8242 * incremental.h: New file.
8243 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8244 (Layout::finalize): Create incremental inputs section in
8245 incremental builds.
8246 (Layout::create_incremental_info_sections): New method.
8247 * layout.h (Layout::incremental_inputs): New method.
8248 (Layout::create_incremental_info_sections): New method.
8249 (Layout::incremental_inputs_): New field.
8250 * main.cc (main): Notify Incremental_input of the command line.
8251
8252 2009-04-01 Ian Lance Taylor <iant@google.com>
8253 Mikolaj Zalewski <mikolajz@google.com>
8254
8255 * gold.h (reserve_unordered_map): Define, three versions, one for
8256 each version of Unordered_map.
8257 * layout.cc (Layout::Layout): Remove options parameter. Add
8258 number_of_input_files parameter. Don't initialize options_.
8259 Initialize number_of_input_files_ and resized_signatures_. Move
8260 sections_are_attached_.
8261 (Layout::layout_group): Reserve space for group_signatures_.
8262 (Layout::find_or_add_kept_section): Change name parameter to be a
8263 reference. Resize signatures_ map when it gets large enough.
8264 (Layout::layout_eh_frame): Use parameters->options() instead of
8265 this->options_.
8266 (Layout::make_output_section): Likewise.
8267 (Layout::attach_allocated_section_to_segment): Likewise.
8268 (Layout::finalize, Layout::create_executable_stack): Likewise.
8269 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8270 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8271 * layout.h (class Layout): Update declarations. Remove options_
8272 field. Add number_of_input_files_ and resized_signatures_
8273 fields. Move sections_are_attached_ field.
8274 * main.cc (main): Pass number of input files to Layout
8275 constructor. Don't pass options.
8276
8277 2009-03-30 Ian Lance Taylor <iant@google.com>
8278
8279 * ffsll.c (ffsll): Correct implementation.
8280
8281 2009-03-27 Ian Lance Taylor <iant@google.com>
8282
8283 * ffsll.c: New file.
8284 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8285 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8286 * ftruncate.c (ftruncate): Declare before definition.
8287 * mremap.c (mremap): Likewise.
8288 * pread.c (pread): Likewise.
8289 * configure, Makefile.in, config.in: Rebuild.
8290
8291 * mremap.c: New file.
8292 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8293 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8294 (mremap): Declare if HAVE_MREMAP is not defined.
8295 * configure, Makefile.in, config.in: Rebuild.
8296
8297 2009-03-27 Cary Coutant <ccoutant@google.com>
8298
8299 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8300 position independent.
8301 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8302 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8303
8304 2009-03-24 Cary Coutant <ccoutant@google.com>
8305
8306 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8307 an executable.
8308 (needs_dynamic_reloc): Likewise.
8309
8310 2009-03-24 Ian Lance Taylor <iant@google.com>
8311
8312 * yyscript.y (file_cmd): Recognize EXTERN.
8313 (extern_name_list, extern_name_list_body): New nonterminals.
8314 * script.cc (script_add_extern): Define.
8315 * script-c.h (script_add_extern): Declare.
8316
8317 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8318
8319 * object.cc (is_elf_object): Define.
8320 * object.h (is_elf_object): Declare.
8321 * archive.cc (Archive::get_elf_object_for_member): Call
8322 is_elf_object.
8323 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8324
8325 2009-03-24 Elliott Hughes <enh@google.com>
8326
8327 * output.cc (Output_file::map_anonymous): Define.
8328 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8329 try an anonymous one. Report the size if the mmap fails.
8330 * output.h (class Output_file): Declare map_anonymous.
8331
8332 2009-03-24 Ian Lance Taylor <iant@google.com>
8333
8334 * target-select.cc (instantiate_target): Don't acquire the lock if
8335 the instantiated_target_ field has already been set.
8336
8337 2009-03-23 Ian Lance Taylor <iant@google.com>
8338
8339 * gold-threads.h (class Initialize_lock): Define.
8340 * gold-threads.cc (class Initialize_lock_once): Define.
8341 (initialize_lock_control): New static variable.
8342 (initialize_lock_pointer): New static variable.
8343 (initialize_lock_once): New static function.
8344 (Initialize_lock::Initialize_lock): Define.
8345 (Initialize_lock::initialize): Define.
8346 * target-select.h: Include "gold-threads.h".
8347 (class Target_selector): Add lock_ and initialize_lock_ fields.
8348 Don't define instantiate_target, just declare it.
8349 * target-select.cc (Target_selector::Target_selector): Initialize
8350 new fields.
8351 (Target_selector::instantiate_target): Define.
8352 * descriptors.h: Include "gold-threads.h".
8353 (class Descriptors): Add initialize_lock_ field.
8354 * descriptors.cc (Descriptors::Descriptors): Initialize new
8355 field.
8356 (Descriptors::open): Use initialize_lock_ field
8357 * errors.h (class Errors): Add initialize_lock_ field.
8358 * errors.cc (Errors::Errors): Initialize new field.
8359 (Errors::initialize_lock): Use initialize_lock_ field.
8360 * powerpc.cc (class Target_selector_powerpc): Remove
8361 instantiated_target_ field. In do_recognize call
8362 instantiate_target rather than do_instantiate_target. In
8363 do_instantiate_target just allocate a new target.
8364 * sparc.cc (class Target_selector_sparc): Likewise.
8365
8366 * freebsd.h: New file.
8367 * i386.cc: Include "freebsd.h".
8368 (Target_i386): Derive from Target_freebsd rather than
8369 Sized_target.
8370 (Target_selector_i386): Derive from Target_selector_freebsd rather
8371 than Target_selector.
8372 * x86_64.cc: Include "freebsd.h".
8373 (Target_x86_64): Derive from Target_freebsd rather than
8374 Sized_target.
8375 (Target_selector_x86_64): Derive from Target_selector_freebsd
8376 rather than Target_selector.
8377 * target.h (class Target): Add adjust_elf_header and
8378 do_adjust_elf_header.
8379 * output.cc (Output_file_header:: do_sized_write): Call target
8380 adjust_elf_header routine.
8381 * configure.tgt: Set targ_osabi.
8382 * configure.ac: Define GOLD_DEFAULT_OSABI.
8383 * parameters.cc (Parameters::default_target): Pass
8384 GOLD_DEFAULT_OSABI to select_target.
8385 * target-select.h (class Target_selector): Make instantiate_target
8386 protected rather than private.
8387 * Makefile.am (HFILES): Add freebsd.h.
8388 * configure, Makefile.in, config.in: Rebuild.
8389
8390 * merge.cc (do_add_input_section): Correct pend value. Change
8391 message about last entry not being null terminated from error to
8392 warning.
8393
8394 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8395
8396 * incremental.cc: New file.
8397 * Makefile.am (CCFILES): Add incremental.cc.
8398 * Makefile.in: Rebuild.
8399
8400 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8401
8402 * layout.cc (Layout::output_section_name): Preserve names
8403 of '.note.' sections.
8404
8405 2009-03-19 Ian Lance Taylor <iant@google.com>
8406
8407 * descriptors.cc (Descriptors::open): Check that the options are
8408 valid before using them.
8409
8410 2009-03-18 Ian Lance Taylor <iant@google.com>
8411
8412 * script-sections.h: Include <list>.
8413 (class Script_sections): Change Sections_elements from std::vector
8414 to std::list. Typedef public Elements_iterator. Add
8415 orphan_section_placement_, data_segment_align_start_, and
8416 saw_data_segment_align_ fields. Remove data_segment_align_index_
8417 field.
8418 * script-sections.cc (class Orphan_section_placement): New class.
8419 (class Sections_element): Add virtual functions is_relro and
8420 orphan_section_init. Remove virtual function place_orphan_here.
8421 (class Output_section_definition): Add is_relro and
8422 orphan_section_init. Remove place_orphan_here.
8423 (class Orphan_output_section): Likewise.
8424 (Script_sections::Script_sections): Update for field changes.
8425 (Script_sections::data_segment_align): Set saw_data_segment_align_
8426 and data_segment_align_start_, not data_segment_align_index.
8427 (Script_sections::data_segment_relro_end): Check
8428 saw_data_segment_align_. Use data_segment_align_start_ rather
8429 than data_segment_align_index_.
8430 (Script_sections::place_orphan): Rewrite to use
8431 Orphan_section_placement.
8432
8433 2009-03-17 Ian Lance Taylor <iant@google.com>
8434
8435 * archive.cc (Archive::add_symbols): Check for a version attached
8436 to the symbol name in the archive map.
8437 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8438 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8439 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8440 (ver_test_11.a): New target.
8441 * testsuite/Makefile.in: Rebuild.
8442
8443 * configure.ac: Check for chsize and posix_fallocate. Replace
8444 ftruncate.
8445 * ftruncate.c: New file, from gnulib.
8446 * output.cc (posix_fallocate): Define dummy version if not
8447 HAVE_POSIX_FALLOCATE.
8448 (Output_file::map): Call posix_fallocate rather than lseek and
8449 write.
8450 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8451 * configure, Makefile.in, config.in: Rebuild.
8452
8453 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8454
8455 * layout.h (Layout::create_note): Add section_name parameter.
8456 * layout.cc (Layout::create_note): Likewise.
8457 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8458
8459 2009-03-17 Ian Lance Taylor <iant@google.com>
8460
8461 * descriptors.cc: Include "options.h".
8462 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8463 (Descriptors::open): Always use O_CLOEXEC when opening a new
8464 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8465 then set FD_CLOEXEC.
8466
8467 * sparc.cc (class Target_sparc): Add has_got_section.
8468 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8469 make sure we have a GOT section.
8470
8471 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8472 (Target_sparc::Scan::local): Likewise.
8473 (Target_sparc::Scan::global): Likewise.
8474 (Target_sparc::Relocate::relocate): Likewise.
8475 (Target_sparc::Relocate::relocate_tls): Likewise.
8476
8477 * symtab.cc (Symbol_table::define_default_version): New function,
8478 broken out of add_from_object.
8479 (Symbol_table::add_from_object): Call define_default_version.
8480 (Symbol_table::define_special_symbol): Add resolve_oldsym
8481 parameter. Change all callers. If the version for a symbol comes
8482 from a version script, resolve it with the symbol with the same
8483 name with no version. Also add the symbol without a version if
8484 appropriate.
8485 (do_define_in_output_data): If resolving with oldsym, don't delete
8486 sym.
8487 (do_define_in_output_segment): Likewise.
8488 (do_define_as_constant): Likewise.
8489 * symtab.h (class Symbol_table): Update declarations.
8490
8491 2009-03-13 Ian Lance Taylor <iant@google.com>
8492
8493 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8494 (Read_symbols::requeue): New function.
8495 (Read_symbols::do_read_symbols): If make_elf_object fails because
8496 the target type is not configured, and the file was searched for,
8497 issue a warning and retry with the next directory.
8498 (Add_symbols::run): If the file has an incompatible format, and
8499 it was searched for, requeue the Read_symbols task. On error,
8500 release the object.
8501 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8502 dirindex parameter to constructor. Change all callers. Declare
8503 incompatible_warning and requeue.
8504 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8505 input_argument_ and input_group_ fields. Add them to
8506 constructor. Change all callers.
8507 (class Read_script): Add dirindex_ field. Add it to constructor.
8508 Change all callers.
8509 * archive.cc (Archive::setup): Remove input_objects parameter.
8510 Change all callers.
8511 (Archive::get_file_and_offset): Likewise.
8512 (Archive::read_all_symbols): Likewise.
8513 (Archive::read_symbols): Likewise.
8514 (Archive::get_elf_object_for_member): Remove input_objects
8515 parameter. Add punconfigured parameter. Change all callers.
8516 (Archive::add_symbols): Change return type to bool. Check return
8517 value of include_member.
8518 (Archive::include_all_members): Likewise.
8519 (Archive::include_member): Change return type to bool. Return
8520 false if first included object has incompatible target. Set
8521 included_member_ field.
8522 (Add_archive_symbols::run): If add_symbols returns false, requeue
8523 Read_symbols task.
8524 * archive.h (class Archive): Add included_member_ field.
8525 Initialize it in constructor. Add input_file and searched_for
8526 methods. Update declarations.
8527 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8528 input_argument_ fields. Add them to constructor. Change all
8529 callers.
8530 * script.cc: Include "target-select.h".
8531 (class Parser_closure): Add skip_on_incompatible_target_ and
8532 found_incompatible_target_ fields. Add
8533 skip_on_incompatible_target parameter to constructor. Change all
8534 callers. Add methods skip_on_incompatible_target,
8535 clear_skip_on_incompatible_target, found_incompatible_target, and
8536 set_found_incompatible_target.
8537 (read_input_script): Add dirindex parameter. Change all callers.
8538 If parser finds an incompatible target, requeue Read_symbols
8539 task.
8540 (script_set_symbol): Clear skip_on_incompatible_target in
8541 closure.
8542 (script_add_assertion, script_parse_option): Likewise.
8543 (script_start_sections, script_add_phdr): Likewise.
8544 (script_check_output_format): New function.
8545 * script.h (read_input_script): Update declaration.
8546 * script-c.h (script_check_output_format): Declare.
8547 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8548 (ignore_cmd): Remove OUTPUT_FORMAT.
8549 * fileread.cc (Input_file::Input_file): Add explicit this.
8550 (Input_file::will_search_for): New function.
8551 (Input_file::open): Add pindex parameter. Change all callers.
8552 * fileread.h (class Input_file): Add input_file_argument method.
8553 Declare will_search_for. Update declarations.
8554 * object.cc (make_elf_object): Add punconfigured parameter.
8555 Change all callers.
8556 * object.h (class Object): Make input_file public. Add
8557 searched_for method.
8558 (make_elf_object): Update declaration.
8559 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8560 restart search.
8561 * dirsearch.h (class Dirsearch): Update declaration.
8562 * options.h (class General_options): Add --warn-search-mismatch.
8563 * parameters.cc (Parameters::is_compatible_target): New function.
8564 * parameters.h (class Parameters): Declare is_compatible_target.
8565 * workqueue.cc (Workqueue::add_blocker): New function.
8566 * workqueue.h (class Workqueue): Declare add_blocker.
8567
8568 * fileread.cc (Input_file::open): Remove options parameter.
8569 Change all callers.
8570 (Input_file::open_binary): Likewise.
8571 * script.cc (read_input_script): Likewise.
8572 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8573 options parameter from constructor. Change all callers.
8574 (class Read_script): Likewise.
8575 * fileread.h (class Input_file): Update declarations.
8576 * script.h (read_input_script): Update declaration.
8577
8578 2009-03-10 Nick Clifton <nickc@redhat.com>
8579
8580 * po/es.po: New Spanish translation.
8581
8582 2009-03-06 Cary Coutant <ccoutant@google.com>
8583
8584 * options.cc (parse_short_option): Keep dash_z from registering itself.
8585
8586 2009-03-03 Ian Lance Taylor <iant@google.com>
8587
8588 PR 9918
8589 * target-reloc.h (relocate_section): Pass output_section to
8590 relocate.
8591 * i386.cc (Target_i386::should_apply_static_reloc): Add
8592 output_section parameter. Change all callers.
8593 (Target_i386::Relocate::relocate): Add output_section parameter.
8594 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8595 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8596 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8597 * testsuite/two_file_shared.sh: New script.
8598 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8599 (check_DATA): Add two_file_shared.dbg.
8600 (two_file_shared.dbg): New target.
8601 * testsuite/Makefile.in: Rebuild.
8602
8603 2009-03-01 Ian Lance Taylor <iant@google.com>
8604
8605 * configure.ac: Check for byteswap.h.
8606 * configure: Rebuild.
8607 * config.in: Rebuild.
8608
8609 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8610
8611 * layout.cc (Layout::find_or_add_kept_section): New function.
8612 (Layout::add_comdat): Removed.
8613 * layout.h (struct Kept_section): Move out of class Layout.
8614 Remove trailing underscores from field names. Add group_sections
8615 field. Rename group_ field to is_group. Change all uses.
8616 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8617 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8618 comdat_groups_ field.
8619 (Sized_relobj::include_section_group): Use
8620 find_or_add_kept_section and Kept_section::group_sections.
8621 (Sized_relobj::include_linkonce_section): Likewise.
8622 * object.cc (class Sized_relobj): Don't define Comdat_group or
8623 Comdat_group_table. Remove find_comdat_group and
8624 add_comdat_group. Remove comdat_groups_ field.
8625 * plugin.cc (include_comdat_group): Use
8626 Layout::find_or_add_kept_section.
8627
8628 2009-02-28 Ian Lance Taylor <iant@google.com>
8629
8630 * README: --gc-sections and map files are now supported. Document
8631 some build requirements.
8632
8633 PR 6992
8634 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8635 relocatable link set the value of the section symbol to zero.
8636 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8637 relocatable link don't include the section address in the local
8638 symbol value.
8639
8640 2009-02-27 Ian Lance Taylor <iant@google.com>
8641
8642 PR 6811
8643 * options.h (class Search_directory): Add is_system_directory.
8644 (class General_options): Declare is_in_system_directory.
8645 * options.cc (get_relative_sysroot): Make static.
8646 (get_default_sysroot): Make static.
8647 (General_optoins::is_in_system_directory): New function.
8648 * fileread.cc (Input_file::is_in_system_directory): New function.
8649 * fileread.h (class Input_file): Declare is_in_system_directory.
8650 * object.h (class Object): Add is_in_system_directory.
8651 (class Input_objects): Remove system_library_directory_ field.
8652 * object.cc (Input_objects::add_object): Don't set
8653 system_library_directory_.
8654 (input_objects::found_in_system_library_directory): Remove.
8655 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8656 parameter. Change all callers.
8657 (Symbol_table::sized_write_globals): Likewise.
8658 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8659 Call Object::is_in_system_directory.
8660 * symtab.h (class Symbol_table): Update declarations.
8661
8662 PR 5990
8663 * descriptors.h (Open_descriptor): Add is_on_stack field.
8664 * descriptors.cc (Descriptors::open): If the descriptor is on the
8665 top of the stack, remove it. Initialize is_on_stack field.
8666 (Descriptors::release): Only add pod to stack if it is not on the
8667 stack already.
8668 (Descriptors::close_some_descriptor): Clear stack_next and
8669 is_on_stack fields.
8670
8671 PR 7091
8672 * output.cc (Output_section::find_starting_output_address): Rename
8673 from starting_output_address; add PADDR parameter; change return
8674 type.
8675 * output.h (class Output_section): Declare
8676 find_starting_output_address instead of starting_output_address.
8677 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8678 section symbol for which we can't find a merge section.
8679
8680 PR 9836
8681 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8682 hidden or internal, force the symbol to be local.
8683 * resolve.cc (Symbol::override_visibility): Define.
8684 (Symbol::override_base): Use override_visibility.
8685 (Symbol_table::resolve): Likewise.
8686 (Symbol::override_base_with_special): Likewise.
8687 (Symbol_table::override_with_special): If the visibility is hidden
8688 or internal, force the symbol to be local.
8689 * symtab.h (class Symbol): Add set_visibility and
8690 override_visibility.
8691 * testsuite/ver_test_1.sh: New file.
8692 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8693 (check_DATA): Add ver_test_1.syms.
8694 (ver_test_1.syms): New target.
8695 * testsuite/Makefile.in: Rebuild.
8696
8697 2009-02-25 Cary Coutant <ccoutant@google.com>
8698
8699 * layout.cc (Layout::choose_output_section): Don't rename sections
8700 when using a linker script that has a SECTIONS clause.
8701 * Makefile.in: Regenerate.
8702
8703 * testsuite/Makefile.am (script_test_5.sh): New test case.
8704 * testsuite/Makefile.in: Regenerate.
8705 * testsuite/script_test_5.cc: New file.
8706 * testsuite/script_test_5.sh: New file.
8707 * testsuite/script_test_5.t: New file.
8708
8709 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8710
8711 * archive.cc (Archive::include_member): Update calls to add_symbols.
8712 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8713 the Layout argument.
8714 * dynobj.h (do_add_symbols): Add the Layout argument.
8715 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8716 Layout argument.
8717 * object.h (Object::add_symbols): Add the Layout argument.
8718 (Object::do_add_symbols): Add the Layout argument.
8719 (Sized_relobj::do_add_symbols): Add the Layout argument.
8720 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8721 Unify the two versions.
8722 (Add_plugin_symbols): Remove.
8723 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8724 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8725 (Add_plugin_symbols): Remove.
8726 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8727 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8728 (Add_symbols::run): Make it work with Pulginobj.
8729
8730 2009-02-06 Ian Lance Taylor <iant@google.com>
8731
8732 * object.cc (Sized_relobj::do_layout): Make info message start
8733 with lower case letter.
8734
8735 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8736
8737 * binary.cc: Fix file comment.
8738
8739 * options.h (enum Incremental_disposition): Define.
8740 (class General_options): Add new options: --incremental,
8741 --incremental_changed, --incremental_unchanged,
8742 --incremental_unknown. Add incremental_disposition_ and
8743 implicit_incremental_ fields.
8744 (General_options::incremental_disposition): New function.
8745 (class Position_dependent_options): Add incremental_disposition
8746 option.
8747 (Position_dependent_options::copy_from_options): Set incremental
8748 dispositions.
8749 * options.cc (General_options::parse_incremental_changed): New
8750 function.
8751 (General_options::parse_incremental_unchanged): New function.
8752 (General_options::parse_incremental_unknown): New function.
8753 (General_options::General_options): Initialize new fields
8754 incremental_disposition_ and implicit_incremental_.
8755 (General_options::finalize): Check for uasge of --incremental-*
8756 without --incremental.
8757
8758 2009-02-06 Chris Demetriou <cgd@google.com>
8759
8760 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8761 pointer and to report location as the file name associated with
8762 the symbol.
8763 (gold_undefined_symbol_at_location): New function to replace the
8764 old gold_undefined_symbol functionality.
8765 * target-reloc.h (relocate_section): Update to use
8766 gold_undefined_symbol_at_location.
8767 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8768 Call gold_undefined_symbol function rather than gold_error.
8769 * errors.h (Errors::undefined_symbol): Take location as a
8770 string, rather than calculating it from a relocation.
8771 * errors.cc (Errors::fatal): Print "fatal error:" before the
8772 formatted message.
8773 (Errors::error, Errors::error_at_location): Print "error: "
8774 before the formatted message.
8775 (Errors::undefined_symbol): Take location as a string, rather
8776 than calculating it from a relocation.
8777 (gold_undefined_symbol_at_location): New function akin to
8778 old gold_undefined_symbol, calculates location from relocation.
8779 (gold_undefined_symbol): Change to take only a Symbol pointer
8780 and to report location as the file name associated with the symbol.
8781 * testsuite/debug_msg.sh: Update for changed error messages.
8782 * testsuite/undef_symbol.sh: Likewise.
8783
8784 2009-02-04 Duncan Sands <baldrick@free.fr>
8785
8786 PR 9812
8787 * reduced_debug_output.h
8788 (Output_reduced_debug_abbrev_section::failed): Use format for
8789 gold_warning.
8790 (Output_reduced_debug_info_section::faild): Likewise.
8791
8792 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8793
8794 * script.cc (Lazy_demangler): New class.
8795 (Version_script_info::get_symbol_version_helper): Demangle a
8796 symbol only once.
8797
8798 2009-01-29 Cary Coutant <ccoutant@google.com>
8799
8800 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8801 to __tls_get_addr.
8802 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8803
8804 2009-01-28 Ian Lance Taylor <iant@google.com>
8805
8806 * version.cc (version_string): Bump to 1.9.
8807
8808 * gold.h: Include <cstring> and <stdint.h>.
8809 * version.cc: Include <cstdio>.
8810 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8811 warning.
8812 * reduced_debug_output.cc (insert_into_vector): Rename from
8813 Insert_into_vector; change all callers. Use Swap_unaligned to
8814 avoid aliasing issue; remove union since it is unnecessary.
8815
8816 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8817
8818 * Makefile.am (CCFILES): Add gc.cc.
8819 (HFILES): Add gc.h.
8820 * Makefile.in: Regenerate.
8821 * gold.cc (Gc_runner): New class.
8822 (queue_initial_tasks): Call garbage collection related tasks
8823 when corresponding options are invoked.
8824 (queue_middle_gc_tasks): New function.
8825 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8826 processed early before laying out sections during garbage collection.
8827 * gold.h (queue_middle_gc_tasks): New function.
8828 (is_prefix_of): Move from "layout.cc".
8829 * i386.cc (Target_i386::gc_process_relocs): New function.
8830 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8831 * main.cc (main): Create object of class "Garbage_collection".
8832 * object.cc (Relobj::copy_symbols_data): New function.
8833 (Relobj::is_section_name_included): New function.
8834 (Sized_relobj::do_layout): Allow this function to be called twice
8835 during garbage collection and defer layout of section during the
8836 first call.
8837 * object.h (Relobj::get_symbols_data): New function.
8838 (Relobj::is_section_name_included): New function.
8839 (Relobj::copy_symbols_data): New function.
8840 (Relobj::set_symbols_data): New function.
8841 (Relobj::get_relocs_data): New function.
8842 (Relobj::set_relocs_data): New function.
8843 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8844 (Relobj::gc_process_relocs): New function.
8845 (Relobj::do_gc_process_relocs): New pure virtual function.
8846 (Relobj::sd_): New data member.
8847 (Sized_relobj::is_output_section_offset_invalid): New function.
8848 (Sized_relobj::do_gc_process_relocs): New function.
8849 * options.h (General_options::gc_sections): Modify to not be a no-op.
8850 (General_options::print_gc_sections): New option.
8851 * plugin.cc (Plugin_finish::run): Remove function call to
8852 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8853 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8854 * reloc.cc (Read_relocs::run): Add task to process relocs and
8855 determine unreferenced sections when doing garbage collection.
8856 (Gc_process_relocs): New class.
8857 (Sized_relobj::do_gc_process_relocs): New function.
8858 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8859 sections that are garbage collected.
8860 * reloc.h (Gc_process_relocs): New class.
8861 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8862 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8863 symbols whose corresponding sections are garbage collected.
8864 (Symbol_table::Symbol_table): Add new parameter for the garbage
8865 collection object.
8866 (Symbol_table::gc_mark_undef_symbols): New function.
8867 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8868 (Symbol_table::gc_mark_dyn_syms): New function.
8869 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8870 as garbage.
8871 (Symbol_table::add_from_object): Likewise.
8872 (Symbol_table::add_from_relobj): When building shared objects, do not
8873 treat externally visible symbols as garbage.
8874 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8875 table information for static and relocatable links.
8876 * symtab.h (Symbol_table::set_gc): New function.
8877 (Symbol_table::gc): New function.
8878 (Symbol_table::gc_mark_undef_symbols): New function.
8879 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8880 (Symbol_table::gc_mark_dyn_syms): New function.
8881 (Symbol_table::gc_): New data member.
8882 * target.h (Sized_target::gc_process_relocs): New pure virtual
8883 function.
8884 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8885 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8886
8887 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8888
8889 * options.h (General_options::gc_sections): Define as a no-op for now.
8890 (General_options::no_keep_memory): Ditto.
8891 (General_options::Bshareable): Define.
8892 * options.cc (General_options::finalize): Honor -Bshareable.
8893
8894 2009-01-20 Andreas Schwab <schwab@suse.de>
8895
8896 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8897 read the value in the contents, since we don't use it. Use the
8898 template endianness when writing.
8899 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8900
8901 2009-01-19 Andreas Schwab <schwab@suse.de>
8902
8903 * configure.tgt (powerpc64-*): Fix targ_obj.
8904
8905 2009-01-15 Ian Lance Taylor <iant@google.com>
8906
8907 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8908 local symbols when stripping all symbols.
8909
8910 2009-01-14 Cary Coutant <ccoutant@google.com>
8911
8912 * output.cc (Output_reloc): Add explicit instantiations.
8913
8914 2009-01-14 Cary Coutant <ccoutant@google.com>
8915
8916 * archive.cc (Archive::get_elf_object_for_member): Remove call
8917 to File_read::claim_for_plugin.
8918 * descriptors.cc (Descriptors::open): Remove reference to
8919 is_claimed.
8920 (Descriptors::claim_for_plugin): Remove.
8921 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8922 (Descriptors::is_claimed): Remove.
8923 (claim_descriptor_for_plugin): Remove.
8924 * fileread.cc (File_read::claim_for_plugin): Remove.
8925 * fileread.h (File_read::claim_for_plugin): Remove.
8926 (File_read::descriptor): Reopen descriptor if necessary.
8927 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8928 (Plugin_manager::all_symbols_read): Add task parameter. Change
8929 all callers.
8930 (Plugin_manager::get_input_file): New function.
8931 (Plugin_manager::release_input_file): New function.
8932 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8933 corresponding data member.
8934 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8935 and pass to base constructor. Change all callers.
8936 (get_input_file, release_input_file): New functions.
8937 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8938 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8939 (Plugin_manager::all_symbols_read): Add task parameter.
8940 (Plugin_manager::get_input_file): New function.
8941 (Plugin_manager::release_input_file): New function.
8942 (Plugin_manager::task_): New data member.
8943 (Pluginobj::Pluginobj): Add filesize parameter.
8944 (Pluginobj::filename): New function.
8945 (Pluginobj::descriptor): New function.
8946 (Pluginobj::filesize): New function.
8947 (Pluginobj::filesize_): New data member.
8948 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
8949 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
8950 File_read::claim_for_plugin; use Object::unlock to unlock the file.
8951
8952 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
8953 with archive libraries.
8954 * testsuite/Makefile.in: Regenerate.
8955 * testsuite/plugin_test.c (struct sym_info): New type.
8956 (get_input_file, release_input_file): New static variables.
8957 (onload): Capture new transfer vector entries.
8958 (claim_file_hook): Stop reading at end of file according to filesize.
8959 Factor out parsing of readelf output into separate function.
8960 (all_symbols_read_hook): Exercise get_input_file and release_input_file
8961 APIs and get the source file name from the symbol table. Convert
8962 source file name to corresponding object file name. Print info
8963 message when adding new input files.
8964 (parse_readelf_line): New function.
8965 * testsuite/plugin_test_1.sh: Add checks for new info messages.
8966 * testsuite/plugin_test_2.sh: Likewise.
8967 * testsuite/plugin_test_3.sh: Likewise.
8968 * testsuite/plugin_test_4.sh: New test case.
8969
8970 2009-01-07 Ian Lance Taylor <iant@google.com>
8971
8972 * version.cc (version_string): Bump to 1.8.
8973
8974 2008-12-23 Cary Coutant <ccoutant@google.com>
8975
8976 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
8977 * plugin.cc (Plugin_manager::finish): Rename as
8978 layout_deferred_objects. Move cleanup to separate function.
8979 (Plugin_manager::cleanup): New function.
8980 (Plugin_finish::run): Call layout_deferred_objects and cleanup
8981 separately.
8982 * plugin.h (Plugin_manager::finish): Rename as
8983 layout_deferred_objects.
8984 (Plugin_manager::cleanup): New function.
8985 (Plugin_manager::cleanup_done): New field.
8986
8987 2008-12-23 Cary Coutant <ccoutant@google.com>
8988
8989 * plugin.cc (is_visible_from_outside): New function.
8990 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
8991 so we don't return "IR only" status for exported symbols or -r links.
8992
8993 * testsuite/Makefile.am (plugin_test_3): New test case.
8994 * testsuite/Makefile.in: Regenerate.
8995 * testsuite/plugin_test_3.sh: New file.
8996
8997 2008-12-22 Cary Coutant <ccoutant@google.com>
8998
8999 * object.cc (Sized_relobj::layout_section): New function.
9000 (Sized_relobj::do_layout): Defer layout of input sections until after
9001 plugin has provided replacement files.
9002 (Sized_relobj::do_layout_deferred_sections): New function.
9003 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9004 (Relobj::layout_deferred_sections): New function.
9005 (Relobj::do_layout_deferred_sections): New function.
9006 (Sized_relobj::do_layout_deferred_sections): New function.
9007 (Sized_relobj::layout_section): New function.
9008 (Sized_relobj::Deferred_layout): New structure.
9009 (Sized_relobj::deferred_layout_): New field.
9010 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9011 Change all callers. Layout deferred sections.
9012 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9013 references.
9014 (Plugin_hook::run): Move code from do_plugin_hook inline.
9015 (Plugin_hook::do_plugin_hook): Remove.
9016 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9017 (Plugin_manager::finish): Renamed, was cleanup.
9018 (Plugin_manager::should_defer_layout): New function.
9019 (Plugin_manager::add_deferred_layout_object): New function.
9020 (Plugin_manager::Deferred_layout_list): New type.
9021 (Plugin_manager::deferred_layout_objects_): New field.
9022 (Plugin_hook::do_plugin_hook): Remove.
9023
9024 2008-12-17 Ian Lance Taylor <iant@google.com>
9025
9026 * options.h (class General_options): Add --no case for
9027 --export-dynamic.
9028
9029 2008-12-16 Cary Coutant <ccoutant@google.com>
9030
9031 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9032 vector.
9033 (Plugin_manager::claim_file): Create plugin object even if
9034 plugin did not call the add_symbols callback.
9035 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9036 asking for more symbols than were added.
9037 * testsuite/Makefile.am (plugin_test_1): Add test case with
9038 no global symbols.
9039 (empty.syms): New target.
9040 * testsuite/Makefile.in: Regenerate.
9041 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9042 message. Don't call add_symbols if no globals.
9043 (all_symbols_read_hook): Don't provide replacement for empty
9044 claimed file.
9045
9046 2008-12-12 Ian Lance Taylor <iant@google.com>
9047
9048 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9049 r_type == 0 for a local symbol with r_sym == 0.
9050 (scan_relocatable_relocs): Pass r_sym to
9051 local_non_section_strategy.
9052 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9053 r_sym parameter.
9054
9055 * configure.ac: Update test for TLS descriptors: they are
9056 supported as of glibc 2.9.
9057 * configure: Rebuild.
9058
9059 2008-12-11 Ian Lance Taylor <iant@google.com>
9060
9061 PR 7091
9062 * target-reloc.h (Default_scan_relocatable_relocs): For each
9063 function, map r_type == 0 to RELOC_DISCARD.
9064
9065 2008-12-10 Cary Coutant <ccoutant@google.com>
9066
9067 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9068 object to override a kept COMDAT group from a plugin object.
9069
9070 2008-12-09 Ian Lance Taylor <iant@google.com>
9071
9072 PR 7088
9073 * yyscript.y (file_cmd): Handle INPUT.
9074
9075 * testsuite/initpri1.c: Change all declarations to be full
9076 prototypes by adding void, to avoid compiler warnings.
9077
9078 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9079
9080 * options.cc (General_options::parse_plugin_opt): New.
9081 (General_options::add_plugin): The argument now is just the filename.
9082 (General_options::add_plugin_option): New.
9083 * options.h (plugin_opt): New.
9084 (add_plugin): Change argument name.
9085 (add_plugin_option): New.
9086 * plugin.cc (Plugin::load): Don't parse the plugin option.
9087 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9088 (Plugin::add_option): New.
9089 (Plugin::args_): Change type.
9090 (Plugin::filename_): New.
9091 (Plugin_manager::add_plugin_option): New.
9092 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9093 * testsuite/Makefile.in: Regenerate.
9094
9095 2008-12-05 Cary Coutant <ccoutant@google.com>
9096
9097 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9098 Handle --strip-lto-sections option.
9099 * options.h (strip_lto_sections): New option.
9100
9101 2008-12-01 Cary Coutant <ccoutant@google.com>
9102
9103 * plugin.cc (ld_plugin_message): Change format parameter to const.
9104 Fix mismatch between new[] and delete.
9105
9106 2008-11-14 Cary Coutant <ccoutant@google.com>
9107
9108 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9109 instead of -1U.
9110
9111 2008-11-05 Craig Silverstein <csilvers@google.com>
9112
9113 * options.cc (General_options::parse_dynamic_list): New function.
9114 * options.h (General_options): New flags dynamic_list,
9115 dynamic_list_data, dynamic_list_cpp_new, and
9116 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9117 (General_options::in_dynamic_list): New function.
9118 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9119 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9120 (Lex::can_continue_name): Likewise.
9121 (yylex): Likewise.
9122 (read_script_file): New parameter script_options.
9123 (read_dynamic_list): New function.
9124 (Script_options::define_dynamic_list): New function.
9125 (dynamic_list_keyword_parsecodes): New variable.
9126 (dynamic_list_keywords): New variable.
9127 * script.h (Script_options::define_dynamic_list): New function
9128 prototype.
9129 (read_dynamic_list): New function prototype.
9130 * symtab.cc (strprefix): New macro.
9131 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9132 dynamic_list_data, dynamic_list_cpp_new, and
9133 dynamic_list_cpp_typeinfo.
9134 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9135 (dynamic_list_expr): New rule.
9136 (dynamic_list_nodes): Likewise.
9137 (dynamic_list_node): Likewise.
9138 * testsuite/Makefile.am (dynamic_list): New test.
9139 * testsuite/Makefile.in: Regenerated.
9140 * testsuite/dynamic_list.t: New file.
9141 * testsuite/dynamic_list.sh: New file.
9142
9143 2008-11-05 Craig Silverstein <csilvers@google.com>
9144
9145 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9146 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9147 (t11_last): Likewise.
9148 * testsuite/ver_test_6.c (main): Likewise.
9149
9150 2008-10-07 Cary Coutant <ccoutant@google.com>
9151
9152 * options.c (General_options::finalize): Add check for -static and
9153 -shared.
9154 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9155 is not empty.
9156
9157 2008-10-02 Cary Coutant <ccoutant@google.com>
9158
9159 * plugin.cc (make_sized_plugin_object): Fix conditional
9160 compilation to work when not all targets are enabled.
9161
9162 2008-09-29 Cary Coutant <ccoutant@google.com>
9163
9164 * archive.cc (Archive::get_file_and_offset): Use filename instead
9165 of name to get library path.
9166 (Archive::include_member): Unlock external member of a thin archive.
9167
9168 * testsuite/Makefile.am (TEST_AR): New variable.
9169 (thin_archive_test_1): New test.
9170 (thin_archive_test_2): New test.
9171 * testsuite/Makefile.in: Regenerate.
9172 * testsuite/thin_archive_main.cc: New file.
9173 * testsuite/thin_archive_test_1.cc: New file.
9174 * testsuite/thin_archive_test_2.cc: New file.
9175 * testsuite/thin_archive_test_3.cc: New file.
9176 * testsuite/thin_archive_test_4.cc: New file.
9177
9178 2008-09-29 Cary Coutant <ccoutant@google.com>
9179
9180 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9181 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9182 instead of -1U.
9183 (Sized_relobj::do_finalize_local_symbols): Likewise.
9184 (Sized_relobj::map_to_kept_section): Likewise.
9185 * object.h (Sized_relobj::invalid_address): New constant.
9186 (Sized_relobj::do_output_section_offset): Check for invalid_address
9187 and return -1ULL.
9188 * output.cc (Output_reloc::local_section_offset): Use constant
9189 invalid_address instead of -1U.
9190 (Output_reloc::get_address): Likewise.
9191 (Output_section::output_address): Change -1U to -1ULL.
9192 * output.h (Output_reloc::invalid_address): New constant.
9193 * reloc.cc (Sized_relobj::write_sections): Use constant
9194 invalid_address instead of -1U.
9195 (Sized_relobj::relocate_sections): Likewise.
9196 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9197 values for merge sections.
9198 * target-reloc.h (relocate_for_relocatable): Use constant
9199 invalid_address instead of -1U.
9200
9201 2008-09-19 Cary Coutant <ccoutant@google.com>
9202
9203 Add plugin functionality for link-time optimization (LTO).
9204 * configure.ac (plugins): Add --enable-plugins option.
9205 * configure: Regenerate.
9206 * config.in: Regenerate.
9207 * Makefile.am (LIBDL): New variable.
9208 (CCFILES): Add plugin.cc.
9209 (HFILES): Add plugin.h.
9210 (ldadd_var): Add LIBDL.
9211 * Makefile.in: Regenerate.
9212
9213 * archive.cc: Include "plugin.h".
9214 (Archive::setup): Don't preread archive symbols when using a plugin.
9215 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9216 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9217 files.
9218 (Archive::include_member): Add symbols from plugin objects.
9219 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9220 * descriptors.cc (Descriptors::open): Check for file descriptors
9221 abandoned by plugins.
9222 (Descriptors::claim_for_plugin): New function.
9223 * descriptors.h (Descriptors::claim_for_plugin): New function.
9224 (Open_descriptor::is_claimed): New field.
9225 (claim_descriptor_for_plugin): New function.
9226 * fileread.cc (File_read::claim_for_plugin): New function.
9227 * fileread.h (File_read::claim_for_plugin): New function.
9228 (File_read::descriptor): New function.
9229 * gold.cc: Include "plugin.h".
9230 (queue_initial_tasks): Add task to call plugin hooks for generating
9231 new object files.
9232 * main.cc: Include "plugin.h".
9233 (main): Load plugin libraries.
9234 * object.h (Pluginobj): Declare.
9235 (Object::pluginobj): New function.
9236 (Object::do_pluginobj): New function.
9237 (Object::set_target): New function.
9238 * options.cc: Include "plugin.h".
9239 (General_options::parse_plugin): New function.
9240 (General_options::General_options): Initialize plugins_ field.
9241 (General_options::add_plugin): New function.
9242 * options.h (Plugin_manager): Declare.
9243 (General_options): Add --plugin option.
9244 (General_options::has_plugins): New function.
9245 (General_options::plugins): New function.
9246 (General_options::add_plugin): New function.
9247 (General_options::plugins_): New field.
9248 * plugin.cc: New file.
9249 * plugin.h: New file.
9250 * readsyms.cc: Include "plugin.h".
9251 (Read_symbols::do_read_symbols): Check for archive before checking
9252 for ELF file. Call plugin hooks to claim files.
9253 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9254 from a real object file; force override when processing replacement
9255 files.
9256 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9257 (Symbol::init_base_object): Likewise.
9258 (Symbol::init_base_output_data): Likewise.
9259 (Symbol::init_base_output_segment): Likewise.
9260 (Symbol::init_base_constant): Likewise.
9261 (Symbol::init_base_undefined): Likewise.
9262 (Symbol::output_section): Assert that object is not a plugin.
9263 (Symbol_table::add_from_pluginobj): New function.
9264 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9265 undefined.
9266 (Symbol_table::sized_write_globals): Likewise.
9267 (Symbol_table::add_from_pluginobj): Instantiate template.
9268 * symtab.h (Sized_pluginobj): Declare.
9269 (Symbol::in_real_elf): New function.
9270 (Symbol::set_in_real_elf): New function.
9271 (Symbol::in_real_elf_): New field.
9272 (Symbol_table::add_from_pluginobj): New function.
9273
9274 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9275 (LIBDL): New variable.
9276 (LDADD): Add LIBDL.
9277 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9278 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9279 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9280 (MOSTLYCLEANFILES): Likewise.
9281 * testsuite/Makefile.in: Regenerate.
9282 * testsuite/plugin_test.c: New file.
9283 * testsuite/plugin_test_1.sh: New file.
9284 * testsuite/plugin_test_2.sh: New file.
9285
9286 2008-09-16 Ian Lance Taylor <iant@google.com>
9287
9288 * target-reloc.h (relocate_section): Check whether a symbol is
9289 defined by the ABI before reporting an undefined symbol error.
9290 * target.h (Target::is_defined_by_abi): Make parameter const.
9291 (Target::do_is_defined_by_abi): Likewise.
9292 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9293 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9294 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9295 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9296 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9297 * testsuite/Makefile.in: Rebuild.
9298
9299 * fileread.cc (make_view): Add casts to avoid warning.
9300
9301 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9302
9303 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9304 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9305
9306 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9307
9308 * options.h (General_options::output_is_executable): New.
9309 (General_options::output_is_pie): New.
9310 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9311 for shared libraries.
9312 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9313
9314 2008-09-11 Chris Demetriou <cgd@google.com>
9315
9316 * options.h (origin): New -z option.
9317 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9318 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9319 in DT_FLAGS_1.
9320
9321 2008-09-05 Cary Coutant <ccoutant@google.com>
9322
9323 * fileread.cc (File_read::make_view): Add check for attempt to map
9324 beyond end of file.
9325
9326 2008-09-05 Cary Coutant <ccoutant@google.com>
9327
9328 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9329 explicit instantiations.
9330
9331 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9332
9333 PR gold/6858
9334 * options.cc (General_options::finalize): Allow undefined symbols
9335 in shlibs if linking -shared.
9336
9337 PR gold/6859
9338 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9339 symbols as not needing a dynsym entry.
9340
9341 2008-08-20 Craig Silverstein <csilvers@google.com>
9342
9343 * fileread.cc (File_read::open): Do not lock the file unless it
9344 was successfully opened.
9345
9346 2008-08-14 Cary Coutant <ccoutant@google.com>
9347
9348 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9349 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9350 * testsuite/tls_test.cc (struct int128): 128-bit struct
9351 for testing TLS relocs with non-zero addend.
9352 (v12): New TLS variable.
9353 (t12): New test.
9354 (t_last): Add check for v12.
9355 * testsuite/tls_test.h (t12): New function.
9356 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9357
9358 2008-08-13 Ian Lance Taylor <iant@google.com>
9359
9360 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9361 set tls_segment_ or relro_segment_.
9362 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9363 when appropriate.
9364 * output.h (Output_section::clear_is_relro): New function.
9365 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9366 sections specially even when output_data_ is empty.
9367 (Output_segment::maximum_alignment): When first section is relro,
9368 only force alignment for PT_LOAD segments.
9369 * script.cc (script_data_segment_align): New function.
9370 (script_data_segment_relro_end): New function.
9371 * script-c.h (script_data_segment_align): Declare.
9372 (script_data_segment_relro_end): Declare.
9373 * script-sections.h (class Script_sections): Declare
9374 data_segment_align and data_segment_relro_end. Add fields
9375 segment_align_index_ and saw_relro_end_.
9376 * script-sections.cc (class Sections_element): Add set_is_relro
9377 virtual function. Add new bool* parameter to place_orphan_here.
9378 Add get_output_section virtual function.
9379 (class Output_section_definition): Add set_is_relro. Add new
9380 bool* parameter to place_orphan_here. Add get_output_section.
9381 Add is_relro_ field.
9382 (Output_section_definition::Output_section_definition): Initialize
9383 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9384 and is_relro_ fields.
9385 (Output_section_definition::place_orphan_here): Add is_relro
9386 parameter.
9387 (Output_section_definition::set_section_addresses): Set relro for
9388 output section.
9389 (Output_section_definition::alternate_constraint): Likewise.
9390 (class Orphan_output_section): Add new bool* parameter to
9391 place_orphan_here. Add get_output_section.
9392 (Orphan_output_section::place_orphan_here): Add is_relro
9393 parameter.
9394 (Script_sections::Script_sections): Initialize
9395 data_segment_align_index_ and saw_relro_end_.
9396 (Script_sections::data_segment_align): New function.
9397 (Script_sections::data_segment_relro_end): New function.
9398 (Script_sections::place_orphan): Set or clear is_relro.
9399 (Script_sections::set_section_addresses): Force alignment of first
9400 TLS section.
9401 * yyscript.y (exp): Call script_data_segment_align and
9402 script_data_segment_relro_end.
9403 * testsuite/relro_script_test.t: New file.
9404 * testsuite/relro_test.cc (using_script): Declare.
9405 (t1, t2): Test using_script.
9406 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9407 (relro_script_test_SOURCES): Define.
9408 (relro_script_test_DEPENDENCIES): Define.
9409 (relro_script_test_LDFLAGS): Define.
9410 (relro_script_test_LDADD): Define.
9411 (relro_script_test.so): New target.
9412 * testsuite/Makefile.in: Rebuild.
9413
9414 2008-08-06 Cary Coutant <ccoutant@google.com>
9415
9416 * archive.cc (Archive::total_archives, Archive::total_members)
9417 (Archive::total_members_loaded): New variables.
9418 (Archive::setup): Add parameter. Add option to preread
9419 archive symbols.
9420 (Archive::read_armap): Add counter.
9421 (Archive::get_file_and_offset): New function.
9422 (Archive::get_elf_object_for_member): New function.
9423 (Archive::read_all_symbols): New function.
9424 (Archive::read_symbols): New function.
9425 (Archive::add_symbols): Add counters.
9426 (Archive::include_all_members): Use armap to find members if it's
9427 already built.
9428 (Archive::include_member): Skip reading symbols if already read.
9429 Factored code into Archive::get_file_and_offset and
9430 Archive::get_elf_object_for_member. Changed call to
9431 Mapfile::report_include_archive_member.
9432 (Archive::print_stats): New function.
9433 * archive.h: Declare Object and Read_symbols_data classes.
9434 (Archive::Archive): Add initializers for new members.
9435 (Archive::setup): Add parameter.
9436 (Archive::print_stats): New function.
9437 (Archive::total_archives, Archive::total_members)
9438 (Archive::total_members_loaded): New variables.
9439 (Archive::get_file_and_offset): New function.
9440 (Archive::get_elf_object_for_member): New function.
9441 (Archive::read_all_symbols): New function.
9442 (Archive::read_symbols): New function.
9443 (Archive::Archive_member): New class.
9444 (Archive::members_): New member.
9445 (Archive::num_members_): New member.
9446 * main.cc: Include archive.h.
9447 (main): Call Archive::print_stats.
9448 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9449 archive parameter; member_name is now the fully-decorated name.
9450 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9451 * options.h: (General_options): Add --preread-archive-symbols option.
9452 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9453 Archive::setup.
9454
9455 2008-08-04 Ian Lance Taylor <iant@google.com>
9456
9457 * symtab.h (Symbol::use_plt_offset): New function.
9458 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9459 * powerpc.cc (Relocate::relocate): Likewise.
9460 * sparc.cc (Relocate::relocate): Likewise.
9461 * x86_64.cc (Relocate::relocate): Likewise.
9462 * testsuite/weak_plt.sh: New test.
9463 * testsuite/weak_plt_main.cc: New test.
9464 * testsuite/weak_plt_shared.cc: New test.
9465 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9466 (check_PROGRAMS): Add weak_plt.
9467 (check_DATA): Add weak_plt_shared.so.
9468 (weak_plt_main_pic.o, weak_plt): New targets.
9469 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9470 * testsuite/Makefile.in: Rebuild.
9471
9472 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9473 gcctestdir/ld.
9474 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9475 * testsuite/Makefile.in: Rebuild.
9476
9477 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9478
9479 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9480 * Makefile.in: Regenerate.
9481 * po/POTFILES.in: Regenerate.
9482
9483 2008-07-29 Ian Lance Taylor <iant@google.com>
9484
9485 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9486 symbols before other symbols.
9487 * testsuite/script_test_2.cc (test_addr): Declare.
9488 (test_addr_alias): Declare.
9489 (main): Check that test_addr and test_addr_alias have the right
9490 values.
9491 * testsuite/script_test_2.t: Define test_addr_alias and
9492 test_addr.
9493
9494 2008-07-24 Ian Lance Taylor <iant@google.com>
9495
9496 PR 5990
9497 * descriptors.cc: New file.
9498 * descriptors.h: New file.
9499 * gold-threads.h (class Hold_optional_lock): New class.
9500 * fileread.cc: Include "descriptors.h".
9501 (File_read::~File_read): Release descriptor rather than closing
9502 it.
9503 (File_read::open) [file]: Call open_descriptor rather than open.
9504 Set is_descriptor_opened_.
9505 (File_read::open) [memory]: Assert that descriptor is not open.
9506 (File_read::reopen_descriptor): New function.
9507 (File_read::release): Release descriptor.
9508 (File_read::do_read): Make non-const. Reopen descriptor.
9509 (File_read::read): Make non-const.
9510 (File_read::make_view): Reopen descriptor.
9511 (File_read::do_readv): Likewise.
9512 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9513 Update declarations.
9514 * layout.cc: Include "descriptors.h".
9515 (Layout::create_build_id): Use open_descriptor rather than open.
9516 * output.cc: Include "descriptors.h".
9517 (Output_file::open): Use open_descriptor rather than open.
9518 * archive.cc (Archive::const_iterator): Change Archive to be
9519 non-const.
9520 (Archive::begin, Archive::end): Make non-const.
9521 (Archive::count_members): Likewise.
9522 * archive.h (class Archive): Update declarations.
9523 * object.h (Object::read): Make non-const.
9524 * Makefile.am (CCFILES): Add descriptors.cc.
9525 (HFILES): Add descriptors.h.
9526 * Makefile.in: Rebuild.
9527
9528 PR 6716
9529 * gold.h: Always include <clocale>. Add Solaris workarounds
9530 following code in binutils/sysdep.h.
9531
9532 PR 6048
9533 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9534 this->eh_frame_hdr_ is NULL before using it.
9535
9536 * dynobj.cc (Versions::Versions): Update comment.
9537
9538 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9539 the base version name.
9540
9541 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9542 array size plus one.
9543 (Stringpool_template::set_string_offsets): Subtract one from key
9544 before using it as an array index.
9545 (Stringpool_template::get_offset_with_length): Likewise.
9546 (Stringpool_template::write_to_buffer): Likewise.
9547 * stringpool.h (Stringpool_template::get_offset_from_key):
9548 Likewise.
9549
9550 2008-07-23 Ian Lance Taylor <iant@google.com>
9551
9552 PR 6658
9553 * object.h (Merged_symbol_value::value): Do our best to handle a
9554 negative addend.
9555
9556 PR 6647
9557 * script.cc (Version_script_info::get_versions): Don't add empty
9558 version tag to return value.
9559 (Version_script_info::get_symbol_version_helper): Change return
9560 type to bool. Add pversion parameter. Change all callers.
9561 (script_register_vers_node): Don't require a non-NULL tag.
9562 * script.h (class Version_script_info): Update declarations.
9563 (Version_script_info::get_symbol_version): Change return type to
9564 bool. Add version parameter. Change all callers.
9565 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9566 handling. Handle an empty version from a version script.
9567 (Symbol_table::define_special_symbol): Likewise.
9568 * testsuite/ver_test_10.script: New file.
9569 * testsuite/ver_test_10.sh: New file.
9570 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9571 (check_DATA): Add ver_test_10.syms.
9572 (ver_test_10.syms, ver_test_10.so): New target.
9573 * testsuite/Makefile.in: Rebuild.
9574
9575 2008-07-23 Simon Baldwin <simonb@google.com>
9576
9577 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9578 to zero for undefined symbols from dynamic libraries.
9579
9580 2008-07-23 Ian Lance Taylor <iant@google.com>
9581
9582 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9583 Change all callers.
9584 * symtab.h (class Symbol_table): Update declaration.
9585 * testsuite/ver_test_9.cc: New file.
9586 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9587 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9588 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9589 (ver_test_9.so, ver_test_9.o): New targets.
9590 * testsuite/Makefile.in: Rebuild.
9591
9592 2008-07-22 Ian Lance Taylor <iant@google.com>
9593
9594 * options.h (class General_options): Define --check-sections.
9595 * layout.cc (Layout::set_segment_offsets): Handle
9596 --check-sections.
9597
9598 * options.h (class General_options): Define -n/--nmagic and
9599 -N/--omagic.
9600 * options.cc (General_options::finalize): For -n/--nmagic or
9601 -N/--omagic, set -static.
9602 * layout.cc (Layout::attach_allocated_section_to_segment): If
9603 -N/--omagic, don't put read-only and read-write sections in
9604 different segments.
9605 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9606 finding a read-only segment.
9607 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9608 don't set the minimum segment alignment to the common page size,
9609 and don't set the file offset to the address modulo the page size.
9610 * script-sections.cc (Script_sections::create_segments): If
9611 -n/--omagic, don't put read-only and read-write sections in
9612 different segments.
9613
9614 * cref.cc: New file.
9615 * cref.h: New file.
9616 * options.h (class General_options): Add --print-symbol-counts.
9617 * main.cc (main): Issue defined symbol report if requested.
9618 * archive.cc (Archive::interpret_header): Make into a const member
9619 function.
9620 (Archive::add_symbols): Call Input_objects::archive_start and
9621 archive_stop.
9622 (Archive::const_iterator): Define new class.
9623 (Archive::begin, Archive::end): New functions.
9624 (Archive::include_all_members): Rewrite to use iterator.
9625 (Archive::count_members): New function.
9626 * archive.h (class Archive): Update declarations.
9627 (Archive::filename): New function.
9628 * object.cc: Include "cref.h".
9629 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9630 (Sized_relobj::do_get_global_symbol_counts): New function.
9631 (Input_objects::add_object): Add object to cross-referencer.
9632 (Input_objects::archive_start): New function.
9633 (Input_objects::archive_stop): New function.
9634 (Input_objects::print_symbol_counts): New function.
9635 * object.h: Declare Cref and Archive.
9636 (Object::get_global_symbol_counts): New function.
9637 (Object::do_get_global_symbol_counts): New pure virtual function.
9638 (class Sized_relobj): Add defined_count_ field. Update
9639 declarations.
9640 (class Input_objects): Add cref_ field. Update constructor.
9641 Update declarations.
9642 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9643 defined_count_.
9644 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9645 symbol counts.
9646 (Sized_dynobj::do_get_global_symbol_counts): New function.
9647 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9648 defined_count_. Update declarations. Define Symbols typedef.
9649 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9650 parameter. Change all callers.
9651 (Symbol_table::add_from_dynobj): Add sympointers and defined
9652 parameters. Change all callers.
9653 * symtab.h (class Symbol_table): Update declarations.
9654 * Makefile.am (CCFILES): Add cref.cc.
9655 (HFILES): Add cref.h.
9656 * Makefile.in: Rebuild.
9657
9658 2008-07-22 Simon Baldwin <simonb@google.com>
9659
9660 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9661 to zero when writing undefined symbols.
9662
9663 2008-07-22 Ian Lance Taylor <iant@google.com>
9664
9665 * output.cc (Output_section::add_input_section): Don't try to
9666 merge empty merge sections.
9667
9668 2008-07-21 Craig Silverstein <csilvers@google.com>
9669
9670 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9671 Include symbol version in error message.
9672
9673 2008-07-20 Chris Demetriou <cgd@google.com>
9674
9675 * configure.ac (gold_cv_c_random_seed): New configured variable.
9676 (RANDOM_SEED_CFLAGS): New substituted variable.
9677 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9678 * configure: Rebuild.
9679 * Makefile.in: Likewise.
9680 * testsuite/Makefile.in: Likewise.
9681
9682 2008-07-18 Ian Lance Taylor <iant@google.com>
9683
9684 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9685 where we see NAME/NULL and NAME/VERSION as separate symbols.
9686 * testsuite/ver_test_main.cc (main): Call t4.
9687 (t4, t4_2a): Define.
9688 * testsuite/ver_test_2.cc (t4_2): Define.
9689 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9690 * testsuite/ver_test_4.cc (t4_2a): Define.
9691 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9692 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9693
9694 2008-07-17 Ian Lance Taylor <iant@google.com>
9695
9696 * dynobj.cc (Versions::add_def): If we give an error about a
9697 missing version, go ahead and create the version anyhow.
9698
9699 2008-07-10 Ian Lance Taylor <iant@google.com>
9700
9701 Handle output sections with more than 0x7fffffff bytes.
9702 * object.h (class Relobj): Change map_to_output_ to
9703 output_sections_, and just keep a section pointer. Change all
9704 uses. Move comdat group support to Sized_relobj.
9705 (Relobj::is_section_specially_mapped): Remove.
9706 (Relobj::output_section): Remove poff parameter. Change all
9707 callers.
9708 (Relobj::output_section_offset): New function.
9709 (Relobj::set_section_offset): Rewrite.
9710 (Relobj::map_to_output): Remove.
9711 (Relobj::output_sections): New function.
9712 (Relobj::do_output_section_offset): New pure virtual function.
9713 (Relobj::do_set_section_offset): Likewise.
9714 (class Sized_relobj): Add section_offsets_ field. Add comdat
9715 group support from Relobj. Update declarations.
9716 (Sized_relobj::get_output_section_offset): New function.
9717 (Sized_relobj::do_output_section_offset): New function.
9718 (Sized_relobj::do_set_section_offset): New function.
9719 * object.cc (Relobj::output_section_address): Remove.
9720 (Sized_relobj::Sized_relobj): Initialize new fields.
9721 (Sized_relobj::include_section_group): Cast find_kept_object to
9722 Sized_relobj.
9723 (Sized_relobj::include_linkonce_section): Likewise.
9724 (Sized_relobj::do_layout): Use separate arrays for output section
9725 and output offset.
9726 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9727 output_sections.
9728 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9729 output_sections and section_offsets.
9730 (Sized_relobj::write_local_symbols): Likewise.
9731 (map_to_kept_section): Compute output address directly.
9732 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9733 output_sections and section_offsets.
9734 (Sized_relobj::write_sections): Likewise.
9735 (Sized_relobj::relocate_sections): Likewise.
9736 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9737 * output.h (class Output_reloc): Update declarations. Change
9738 u2_.relobj to Sized_relobj*.
9739 (class Output_data_reloc): Change add functions to use
9740 Sized_relobj*.
9741 * output.cc (Output_reloc::Output_reloc): Change relobj to
9742 Sized_relobj*.
9743 (Output_reloc::local_section_offset): Change return type to
9744 Elf_Addr. Use get_output_section_offset.
9745 (Output_reloc::get_address): Likewise.
9746 (Output_section::is_input_address_mapped): Don't call
9747 is_section_specially_mapped.
9748 (Output_section::output_offset): Likewise.
9749 (Output_section::output_address): Likewise.
9750 (Output_section::starting_output_address): Likewise.
9751 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9752 parameter to Sized_relobj*.
9753 (Copy_relocs::need_copy_reloc): Likewise.
9754 (Copy_relocs::save): Likewise.
9755 * copy-relocs.h (class Copy_relocs): Update declarations.
9756 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9757 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9758 * target-reloc.h (relocate_for_relocatable): Change
9759 offset_in_output_section type to Elf_Addr. Change code that uses
9760 it as well.
9761 * layout.cc (Layout::layout): Always set *off.
9762 * mapfile.cc (Mapfile::print_input_section): Use
9763 output_section_offset.
9764 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9765 Sized_relobj*.
9766 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9767 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9768 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9769
9770 2008-07-03 Ian Lance Taylor <iant@google.com>
9771
9772 * layout.cc (Layout::include_section): Do not discard unrecognized
9773 SHT_STRTAB sections.
9774
9775 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9776
9777 * script.cc (Lex::can_continue_name): Make '?' allowable in
9778 version-script names.
9779 * testsuite/version_script.map: Change glob pattern to use '?'
9780
9781 2008-06-30 Manish Singh <yosh@gimp.org>
9782
9783 PR 6585
9784 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9785 Correct typo.
9786
9787 2008-06-30 Ian Lance Taylor <iant@google.com>
9788
9789 PR 6660
9790 PR 6682
9791 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9792 versions]: Don't try to read the value in the contents, since we
9793 don't use it. Use the template endianness when writing.
9794
9795 2008-06-25 Cary Coutant <ccoutant@google.com>
9796
9797 * fileread.cc (File_read::make_view): Assert on zero-length view.
9798 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9799 symbol table when there are no symbols to read.
9800
9801 2008-06-23 Craig Silverstein <csilvers@google.com>
9802
9803 * version.cc (version_string): Bump to 1.7
9804
9805 2008-06-18 Craig Silverstein <csilvers@google.com>
9806
9807 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9808 constant 0xFFFF to type Valtype.
9809 (Powerpc_relocate_functions::rel16_ha): Likewise.
9810
9811 2008-06-17 Ian Lance Taylor <iant@google.com>
9812
9813 * output.h (Output_section::Input_section): Initialize p2align_ to
9814 zero for Output_section_data constructors.
9815 (Output_section::Input_section::addralign): If not an input
9816 section, return the alignment of the Output_section_data.
9817 * testsuite/copy_test.cc: New file.
9818 * testsuite/copy_test_1.cc: New file.
9819 * testsuite/copy_test_2.cc: New file.
9820 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9821 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9822 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9823 (copy_test_1_pic.o, copy_test_1.so): New targets.
9824 (copy_test_2_pic.o, copy_test_2.so): New targets.
9825 * testsuite/Makefile.in: Rebuild.
9826
9827 * script-sections.cc (Script_sections::place_orphan): Initialize
9828 local variable exact.
9829
9830 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9831
9832 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9833
9834 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9835 David S. Miller <davem@davemloft.net>
9836
9837 * powerpc.cc: New file.
9838 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9839 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9840 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9841 * Makefile.in: Rebuild.
9842
9843 2008-06-09 Ian Lance Taylor <iant@google.com>
9844
9845 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9846 <exception>.
9847 (throwing, orig_terminate): New static variables.
9848 (terminate_handler): New static function.
9849 (t2): Set terminate handler.
9850
9851 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9852
9853 PR 6584
9854 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9855 alignment.
9856
9857 2008-05-30 Cary Coutant <ccoutant@google.com>
9858
9859 * archive.cc (Archive::include_all_members) Correct to step
9860 over symbol table and extended name table in thin archives.
9861
9862 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9863
9864 PR 6407
9865 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9866 calculation.
9867
9868 2008-05-28 Caleb Howe <cshowe@google.com>
9869
9870 * reduced_debug_output.cc: New file.
9871 * reduced_debug_output.h: New file.
9872 * options.h (class General_options): Add --strip-debug-non-line.
9873 * options.cc (General_options::finalize): Add strip_debug_non_line
9874 to the strip heirarchy.
9875 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9876 fields.
9877 * layout.cc: Include "reduced_debug_output.h".
9878 (Layout::Layout): Initialize new fields.
9879 (line_only_debug_sections): New static array.
9880 (is_lines_only_debug_sections): New static inline function.
9881 (Layout::include_section): Handle --strip-debug-non-line.
9882 (Layout::make_output_section): If --strip-debug-non-line, build
9883 new output sections for .debug_abbrev and .debug_info.
9884 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9885 gold. Warn about possible overflow.
9886 (read_signed_LEB_128): Likewise.
9887 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9888 (read_signed_LEB_128): Declare.
9889 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9890 (HFILES): Add reduced_debug_output.h.
9891 * Makefile.in: Rebuild.
9892
9893 2008-05-21 Ian Lance Taylor <iant@google.com>
9894
9895 * mapfile.cc: New file.
9896 * mapfile.h: New file.
9897 * options.h (class General_options): Add -M/--print-map and -Map.
9898 * options.cc (General_options::finalize): Make -M equivalent to
9899 -Map -.
9900 * main.cc: Include <cstdio> and "mapfile.h".
9901 (main): Open mapfile if requested.
9902 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9903 constructor. Change caller.
9904 (queue_initial_tasks): Add mapfile parameter. Change caller.
9905 (queue_middle_tasks): Likewise.
9906 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9907 declarations.
9908 * archive.cc: Include "mapfile.h".
9909 (Archive::add_symbols): Add mapfile parameter. Change all
9910 callers. Pass mapfile, symbol, and reason to include_member.
9911 (Archive::include_all_members): Add mapfile parameter. Change all
9912 callers.
9913 (Archive::include_member): Add mapfile, sym, and why parameters.
9914 Change all callers. Report inclusion to map file.
9915 * archive.h: Include "fileread.h".
9916 (class Archive): Update declarations.
9917 (Archive::file): New const method.
9918 (class Add_archive_symbols): Add mapfile_ field. Update
9919 constructor. Change all callers.
9920 * readsyms.h (class Read_symbols): Likewise.
9921 (class Finish_group): Likewise.
9922 (class Read_script): Likewise.
9923 * common.cc: Include "mapfile.h".
9924 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9925 all callers.
9926 (Symbol_table::do_allocate_commons): Likewise.
9927 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9928 symbol allocation to mapfile.
9929 * common.h (class Allocate_commons_task): Add mapfile_ field.
9930 Update constructor. Change all callers.
9931 * symtab.h (class Symbol_table): Update declarations.
9932 * layout.cc: Include "mapfile.h".
9933 (Layout_task_runner::run): Print information to mapfile.
9934 (Layout::create_gold_note): Change Output_data_fixed_space to
9935 Output_data_zero_fill.
9936 (Layout::create_build_id): Likewise.
9937 (Layout::print_to_mapfile): New function.
9938 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9939 constructor. Change caller.
9940 (class Layout): Declare print_to_mapfile.
9941 * output.cc (Output_section::Input_section::print_to_mapfile): New
9942 function.
9943 (Output_section::add_input_section): If producing a map, always
9944 add to input_sections_ list.
9945 (Output_section::do_print_to_mapfile): New function.
9946 (Output_segment::print_sections_to_mapfile): New function.
9947 (Output_segment::print_section_list_to_mapfile): New function.
9948 * output.h: Include "mapfile.h".
9949 (Output_data::print_to_mapfile): New function.
9950 (Output_data::do_print_to_mapfile): New virtual function.
9951 (Output_segment_headers::do_print_to_mapfile): New function.
9952 (Output_file_header::do_print_to_mapfile): New function.
9953 (Output_data_const::do_print_to_mapfile): New function.
9954 (class Output_data_const_buffer): Add map_name_ field. Update
9955 constructor. Change all callers. Add do_print_to_mapfile
9956 function.
9957 (class Output_data_fixed_space): Likewise.
9958 (class Output_data_space): Likewise.
9959 (class Output_data_zero_fill): New class.
9960 (Output_data_strtab::do_print_to_mapfile): New function.
9961 (Output_data_reloc_base::do_print_to_mapfile): New function.
9962 (Output_relocatable_relocs::do_print_to_mapfile): New function.
9963 (Output_data_group::do_print_to_mapfile): New function.
9964 (Output_data_got::do_print_to_mapfile): New function.
9965 (Output_data_dynamic::do_print_to_mapfile): New function.
9966 (Output_symtab_xindex::do_print_to_mapfile): New function.
9967 (class Output_section): Declare do_print_to_mapflie. Declare
9968 print_to_mapfile in Input_section.
9969 (class Output_segment): Declare new functions.
9970 * object.h (Sized_relobj::symbol_count): New function.
9971 * script-sections.cc
9972 (Output_section_element_dot_assignment::set_section_addresses):
9973 Change Output_data_fixed_space to Output_data_zero_fill.
9974 (Output_data_expression::do_print_to_mapfile): New function.
9975 * script.cc (read_input_script): Add mapfile parameter. Change
9976 all callers.
9977 * script.h (read_input_script): Update declaration.
9978 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
9979 (Eh_frame::do_print_to_mapfile): New function.
9980 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
9981 (Output_merge_string::do_print_to_mapfile): New function.
9982 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
9983 function.
9984 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
9985 function.
9986 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
9987 function.
9988 * Makefile.am (CCFILES): Add mapfile.cc.
9989 (HFILES): Add mapfile.h.
9990 * Makefile.in: Rebuild.
9991
9992 2008-05-19 Ian Lance Taylor <iant@google.com>
9993
9994 * options.h (class General_options): Add -z relro.
9995 * layout.cc (Layout::Layout): Initialize relro_segment_.
9996 (Layout::add_output_section_data): Return the output section.
9997 (Layout::make_output_section): Rcognize relro sections and mark
9998 them appropriately.
9999 (Layout::attach_allocated_section_to_segment): Put relro sections
10000 in a PT_GNU_RELRO segment.
10001 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10002 section as relro.
10003 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10004 PT_TLS segments.
10005 (Layout::linkonce_mapping): Map d.rel.ro.local to
10006 .data.rel.ro.local.
10007 (Layout::output_section_name): Us .data.rel.ro.local for any
10008 section which begins with that.
10009 * layout.h (class Layout): Update add_output_section_data
10010 declaration. Add relro_segment_ field.
10011 * output.cc (Output_section::Output_section): Initialize is_relro_
10012 and is_relro_local_ fields.
10013 (Output_segment::add_output_section): Group relro sections.
10014 (Output_segment::is_first_section_relro): New function.
10015 (Output_segment::maximum_alignment): If there is a relro section,
10016 align the segment to the common page size.
10017 (Output_segment::set_section_addresses): Track whether we are
10018 looking at relro sections. If the last section is a relro
10019 section, align to the common page size.
10020 (Output_segment::set_section_list_addresses): Add in_relro
10021 parameter. Change all callers. Align to the page size when
10022 moving from relro to non-relro section.
10023 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10024 segment.
10025 * output.h (class Output_section): Add is_relro_ and
10026 is_relro_local_ fields.
10027 (Output_section::is_relro): New function.
10028 (Output_section::set_is_relro): New function.
10029 (Output_section::is_relro_local): New function.
10030 (Output_section::set_is_relro_local): New function.
10031 (class Output_segment): Update declarations.
10032 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10033 * sparc.cc (Target_sparc::got_section): Likewise.
10034 * x86_64.cc (Target_x86_64::got_section): Likewise.
10035 * testsuite/relro_test_main.cc: New file.
10036 * testsuite/relro_test.cc: New file.
10037 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10038 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10039 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10040 (relro_test.so, relro_test_pic.o): New targets.
10041 * testsuite/Makefile.in: Rebuild.
10042
10043 2008-05-16 Ian Lance Taylor <iant@google.com>
10044
10045 * output.cc (Output_segment::add_output_section): Remove front
10046 parameter.
10047 * output.h (class Output_segment): Remove
10048 add_initial_output_section and overloaded add_output_section.
10049 Update declaration of remaining add_output_section.
10050 * layout.cc (Layout::create_interp): Call add_output_section
10051 rather than add_initial_output_section.
10052 (Layout::finish_dynamic_section): Likewise.
10053
10054 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10055 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10056 know the dynamic type.
10057 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10058 field. Initialize it in constructor.
10059 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10060 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10061 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10062 reloc.
10063
10064 * output.cc (Output_reloc::get_address): Change return type to
10065 Elf_Addr.
10066 * output.h (class Output_reloc): Update get_address declaration.
10067 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10068 for section addresses.
10069
10070 2008-05-09 Ian Lance Taylor <iant@google.com>
10071
10072 PR 6493
10073 * gold.cc (gold_nomem): Use return value of write.
10074
10075 2008-05-08 Ian Lance Taylor <iant@google.com>
10076
10077 * symtab.c (Symbol::init_base_output_data): Add version
10078 parameter. Change all callers.
10079 (Symbol::init_base_output_segment): Likewise.
10080 (Symbol::init_base_constant): Likewise.
10081 (Symbol::init_base_undefined): Likewise.
10082 (Sized_symbol::init_output_data): Likewise.
10083 (Sized_symbol::init_output_segment): Likewise.
10084 (Sized_symbol::init_constant): Likewise.
10085 (Sized_symbol::init_undefined): Likewise.
10086 (Symbol_table::do_define_in_output_data): If the new symbol has a
10087 version, mark it as the default.
10088 (Symbol_table::do_define_in_output_segment): Likewise.
10089 (Symbol_table::do_define_as_constant): Likewise.
10090 * symtab.h (class Symbol): Update declarations.
10091 (class Sized_symbol): Likewise.
10092 * resolve.cc (Symbol::override_version): New function.
10093 (Symbol::override_base): Call override_version.
10094 (Symbol::override_base_with_special): Likewise.
10095 * testsuite/ver_script_8.script: New file.
10096 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10097 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10098 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10099 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10100
10101 2008-05-06 Ian Lance Taylor <iant@google.com>
10102
10103 PR 6049
10104 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10105 functions.
10106 (class General_options): Remove existing --undefined, and add
10107 --no-undefined instead. Add new --undefined as synonym for -u.
10108 * archive.cc (Archive::add_symbols): Check whether symbol was
10109 named with -u.
10110 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10111 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10112 all uses. Add IS_UNDEFINED. Update declarations to split
10113 different versions of init_base. Declare init_base_undefined.
10114 (Symbol::is_defined): Handle IS_UNDEFINED.
10115 (Symbol::is_undefined): Likewise.
10116 (Symbol::is_weak_undefined): Call is_undefined.
10117 (Symbol::is_absolute): Handle IS_CONSTANT.
10118 (class Sized_symbol): Update declarations to split different
10119 versions of init. Declare init_undefined.
10120 (class Symbol_table): Declare new functions.
10121 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10122 Change all callers.
10123 (Symbol::init_base_output_data): Likewise.
10124 (Symbol::init_base_output_segment): Likewise.
10125 (Symbol::init_base_constant): Likewise.
10126 (Symbol::init_base_undefined): New function.
10127 (Sized_symbol::init_object): Rename from init. Change all
10128 callers.
10129 (Sized_symbol::init_output_data): Likewise.
10130 (Sized_symbol::init_output_segment): Likewise.
10131 (Sized_symbol::init_constant): Likewise.
10132 (Sized_symbol::init_undefined): New function.
10133 (Symbol_table::add_undefined_symbols_from_command_line): New
10134 function.
10135 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10136 function.
10137 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10138 (Symbol::output_section): Likewise.
10139 (Symbol::set_output_section): Likewise.
10140 (Symbol_table::sized_finalize_symbol): Likewise.
10141 (Symbol_table::sized_write_globals): Likewise.
10142 * resolve.cc (Symbol_table::should_override): Likewise.
10143 (Symbol::override_base_with_special): Likewise.
10144
10145 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10146 symbol, change it to have default visibility.
10147 * testsuite/protected_1.cc: New file.
10148 * testsuite/protected_2.cc: New file.
10149 * testsuite/protected_3.cc: New file.
10150 * testsuite/protected_main_1.cc: New file.
10151 * testsuite/protected_main_2.cc: New file.
10152 * testsuite/protected_main_3.cc: New file.
10153 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10154 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10155 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10156 (protected_1.so): New target.
10157 (protected_1_pic.o, protected_2_pic.o): New targets.
10158 (protected_3_pic.o): New target.
10159 (check_PROGRAMS): Add protected_2.
10160 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10161 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10162 * testsuite/Makefile.in: Rebuild.
10163
10164 * options.h (DEFINE_var): Add set_user_set_##varname__.
10165 (DEFINE_bool_alias): New macro.
10166 (class General_options): Define -Bstatic using DEFINE_bool_alias
10167 rather than DEFINE_special. Add --undefined as an alias for -z
10168 defs.
10169 * options.cc (General_options::parse_Bstatic): Remove.
10170
10171 * options.h (class General_options): Add --fatal-warnings.
10172 * main.cc (main): Implement --fatal-warnings.
10173 * errors.h (Errors::warning_count): New function.
10174
10175 * options.h (class General_options): Add -Bsymbolic-functions.
10176 * symtab.h (Symbol::is_preemptible): Check for
10177 -Bsymbolic-functions.
10178
10179 2008-05-05 Ian Lance Taylor <iant@google.com>
10180
10181 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10182 as noVARNAME rather than no-VARNAME.
10183 (class General_options): Add option -z combreloc.
10184 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10185 get_address.
10186 (Output_reloc::sort_before) [SHT_REL]: New function.
10187 (Output_reloc::sort_before) [SHT_RELA]: New function.
10188 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10189 Sort_relocs_comparison.
10190 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10191 parameter. Change all callers.
10192 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10193 sort_relocs parameter. Change all callers.
10194 * output.cc (Output_reloc::get_address): New function, broken out
10195 of write_rel.
10196 (Output_reloc::write_rel): Call it.
10197 (Output_reloc::compare): New function.
10198 (Output_data_reloc_base::do_write): Optionally sort relocs.
10199
10200 * configure.ac: If targ_extra_obj is set, link it in.
10201 * configure.tgt: Initialize all variables.
10202 (x86_64*): Set targ_extra_obj and targ_extra_size.
10203 * configure: Rebuild.
10204
10205 * object.cc (Sized_relobj::include_section_group): Adjust section
10206 indexes read from group data. Build vector to pass to
10207 layout_group.
10208 * layout.cc (Layout::layout_group): Add flags and shndxes
10209 parameters. Remove contents parameter. Change caller. Update
10210 explicit instantiations.
10211 * layout.h (class Layout): Update layout_group declaration.
10212 * output.cc (Output_data_group::Output_data_group): Add flags and
10213 input_shndxes parameters. Remove contents parameter. Change
10214 caller.
10215 (Output_data_group::do_write): Change input_sections_ to
10216 input_shndxes_.
10217 * output.h (class Output_data_group): Update constructor
10218 declaration. Rename input_sections_ to input_shndxes_.
10219 * testsuite/many_sections_test.cc: Add template.
10220
10221 2008-04-30 Cary Coutant <ccoutant@google.com>
10222
10223 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10224
10225 * layout.cc (Layout::include_section): Refactored check for debug
10226 info section.
10227 (Layout::add_comdat): Add new parameters. Change type
10228 of signature parameter. Add object and shndx to signatures table.
10229 (Layout::find_kept_object): New function.
10230 * layout.h: Include <cstring>.
10231 (Layout::is_debug_info_section): New function.
10232 (Layout::add_comdat): Add new parameters.
10233 (Layout::find_kept_object): New function.
10234 (Layout::Kept_section): New struct.
10235 (Layout::Signatures): Change type of map range.
10236 * object.cc (Relobj::output_section_address): New function.
10237 (Sized_relobj::include_section_group): Add new parameters. Change
10238 calls to Layout::add_comdat. Change to build table of kept comdat
10239 groups and table mapping discarded sections to kept sections.
10240 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10241 (Sized_relobj::do_layout): Change calls to include_section_group and
10242 include_linkonce_section.
10243 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10244 value to zero when section is discarded.
10245 (Sized_relobj::map_to_kept_section): New function.
10246 * object.h (Relobj::output_section_address): New function.
10247 (Relobj::Comdat_group): New type.
10248 (Relobj::find_comdat_group): New function.
10249 (Relobj::Comdat_group_table): New type.
10250 (Relobj::Kept_comdat_section): New type.
10251 (Relobj::Kept_comdat_section_table): New type.
10252 (Relobj::add_comdat_group): New function.
10253 (Relobj::set_kept_comdat_section): New function.
10254 (Relobj::get_kept_comdat_section): New function.
10255 (Relobj::comdat_groups_): New field.
10256 (Relobj::kept_comdat_sections_): New field.
10257 (Symbol_value::input_value): Update comment.
10258 (Sized_relobj::map_to_kept_section) New function.
10259 (Sized_relobj::include_linkonce_section): Add new parameter.
10260 * target-reloc.h (Comdat_behavior): New type.
10261 (get_comdat_behavior): New function.
10262 (relocate_section): Add code to map a discarded section to the
10263 corresponding kept section when applying a relocation.
10264
10265 2008-04-30 Craig Silverstein <csilvers@google.com>
10266
10267 * dwarf_reader.cc (next_generation_count): New static var.
10268 (Addr2line_cache_entry): New struct.
10269 (addr2line_cache): New static var.
10270 (Dwarf_line_info::one_addr2line): Added caching.
10271 (Dwarf_line_info::clear_addr2line_cache): New function.
10272 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10273 cache-size parameter.
10274 (Dwarf_line_info::one_addr2line_cache): New function.
10275 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10276 new cache-size argument to one_addr2line(), and clear cache.
10277
10278 2008-04-28 Cary Coutant <ccoutant@google.com>
10279
10280 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10281 R_386_PC8 relocations.
10282
10283 2008-04-23 Ian Lance Taylor <iant@google.com>
10284
10285 * object.cc (Sized_relobj::include_section_group): Check for
10286 invalid section group.
10287
10288 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10289 header size.
10290
10291 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10292 than read for file header.
10293 * archive.cc (Archive::include_member): Likewise.
10294
10295 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10296
10297 * aclocal.m4: Regenerate.
10298 * configure: Regenerate.
10299
10300 2008-04-19 Ian Lance Taylor <iant@google.com>
10301
10302 * version.cc (version_string): Bump to 1.6.
10303
10304 * testsuite/Makefile.am (many_sections_r_test): New target.
10305 (many_sections_r_test_SOURCES): Remove.
10306 (many_sections_r_test_DEPENDENCIES): Remove.
10307 (many_sections_r_test_LDFLAGS): Remove.
10308 (many_sections_r_test_LDADD): Remove.
10309
10310 * object.cc (Sized_relobj::do_add_symbols): Always pass
10311 local_symbol_count_ to add_from_relobj.
10312
10313 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10314 every thousand variables.
10315 * testsuite/Makefile.in: Rebuild.
10316
10317 * object.cc (Xindex::initialize_symtab_xindex): New function.
10318 (Xindex::read_symtab_xindex): New function.
10319 (Xindex::sym_xindex_to_shndx): New function.
10320 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10321 available.
10322 (Sized_relobj::do_initialize_xindex): New function.
10323 (Sized_relobj::do_read_symbols): Adjust section links.
10324 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10325 parameter. Change all callers.
10326 (Sized_relobj::include_section_group): Adjust section links and
10327 symbol section indexes.
10328 (Sized_relobj::do_layout): Adjust section links.
10329 (Sized_relobj::do_count_local_symbols): Adjust section links and
10330 symbol section indexes.
10331 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10332 ordinary and special symbols.
10333 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10334 dynsym_xindex parameters. Change all callers. Adjust section
10335 links. Use SHN_XINDEX when needed.
10336 (Sized_relobj::get_symbol_location_info): Adjust section links.
10337 Don't get fooled by special symbols.
10338 * object.h (class Xindex): Define.
10339 (class Object): Add xindex_ parameter. Declare virtual functoin
10340 do_initialize_xindex.
10341 (Object::adjust_sym_shndx): New function.
10342 (Object::set_xindex): New protected function.
10343 (class Symbol_value): Add is_ordinary_shndx_ field.
10344 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10345 (Symbol_value::value): Assert ordinary section.
10346 (Symbol_value::initialize_input_to_output_map): Likewise.
10347 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10348 Change all callers.
10349 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10350 all callers.
10351 (class Sized_relobj): Update declarations.
10352 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10353 parameter. Change all callers.
10354 (Sized_relobj::adjust_shndx): New function.
10355 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10356 field.
10357 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10358 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10359 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10360 (Sized_dynobj::read_dynsym_section): Adjust section links.
10361 (Sized_dynobj::read_dynamic): Likewise.
10362 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10363 section links.
10364 (Sized_dynobj::do_initialize_xindex): New function.
10365 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10366 do_initialize_xindex.
10367 (Sized_dynobj::adjust_shndx): New function.
10368 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10369 dynsym_xindex_ fields.
10370 (Layout::finalize): Add a call to set_section_indexes before
10371 creating the symtab sections.
10372 (Layout::set_section_indexes): Don't do anything if the section
10373 already has a section index.
10374 (Layout::create_symtab_sections): Add shnum parameter. Change
10375 caller. Create .symtab_shndx section if needed.
10376 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10377 caller.
10378 (Layout::allocated_output_section_count): New function.
10379 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10380 needed.
10381 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10382 fields. Update declarations.
10383 (Layout::symtab_xindex): New function.
10384 (Layout::dynsym_xindex): New function.
10385 (class Write_symbols_task): Add layout_ field.
10386 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10387 Change caller.
10388 * output.cc (Output_section_headers::Output_section_headers): Add
10389 shstrtab_section parameter. Change all callers.
10390 (Output_section_headers::do_sized_write): Store overflow values
10391 for section count and section string table section index in
10392 section header zero.
10393 (Output_file_header::do_sized_write): Check for overflow of
10394 section count and section string table section index.
10395 (Output_symtab_xindex::do_write): New function.
10396 (Output_symtab_xindex::endian_do_write): New function.
10397 * output.h (class Output_section_headers): Add shstrtab_section_.
10398 Update declarations.
10399 (class Output_symtab_xindex): Define.
10400 (Output_section::has_out_shndx): New function.
10401 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10402 field.
10403 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10404 Change all callers.
10405 (Sized_symbol::init): Likewise.
10406 (Symbol::output_section): Check for ordinary symbol.
10407 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10408 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10409 callers.
10410 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10411 Change all callers. Simplify handling of symbols from sections
10412 not included in the link.
10413 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10414 distinction.
10415 (Weak_alias_sorter::operator()): Assert that symbols are
10416 ordinary.
10417 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10418 distinction.
10419 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10420 parameters. Change all callers.
10421 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10422 symbol distinction. Use SHN_XINDEX when needed.
10423 (Symbol_table::write_section_symbol): Add symtab_xindex
10424 parameter. Change all callers.
10425 (Symbol_table::sized_write_section_symbol): Likewise. Use
10426 SHN_XINDEX when needed.
10427 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10428 declarations.
10429 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10430 (Symbol::is_defined): Check is_ordinary.
10431 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10432 (Symbol::is_absolute, Symbol::is_common): Likewise.
10433 (class Sized_symbol): Update declarations.
10434 (class Symbol_table): Update declarations.
10435 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10436 parameters. Change all callers.
10437 (Sized_symbol::override): Likewise.
10438 (Symbol_table::override): Likewise.
10439 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10440 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10441 is_ordinary, and orig_st_shndx parameters. Change all callers.
10442 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10443 to be in an ordinary section.
10444 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10445 object and is_ordinary parameters. Change all callers.
10446 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10447 Change all callers. Don't add undefined or non-ordinary symbols
10448 to reloc_map_.
10449 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10450 Change all callers.
10451 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10452 declarations.
10453 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10454 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10455 (Sized_relobj::relocate_sections): Likewise.
10456 * target-reloc.h (scan_relocs): Adjust section symbol index.
10457 (scan_relocatable_relocs): Likewise.
10458 * i386.cc (Scan::local): Check for ordinary symbols.
10459 * sparc.cc (Scan::local): Likewise.
10460 * x86_64.cc (Scan::local): Likewise.
10461 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10462 to symbol_section_and_value.
10463 * testsuite/many_sections_test.cc: New file.
10464 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10465 (check_PROGRAMS): Add many_sections_test.
10466 (many_sections_test_SOURCES): Define.
10467 (many_sections_test_DEPENDENCIES): Define.
10468 (many_sections_test_LDFLAGS): Define.
10469 (BUILT_SOURCES): Add many_sections_define.h.
10470 (many_sections_define.h): New target.
10471 (BUILT_SOURCES): Add many_sections_check.h.
10472 (many_sections_check.h): New target.
10473 (check_PROGRAMS): Add many_sections_r_test.
10474 (many_sections_r_test_SOURCES): Define.
10475 (many_sections_r_test_DEPENDENCIES): Define.
10476 (many_sections_r_test_LDFLAGS): Define.
10477 (many_sections_r_test_LDADD): Define.
10478 (many_sections_r_test.o): New target.
10479 * testsuite/Makefile.in: Rebuild.
10480
10481 2008-04-17 Cary Coutant <ccoutant@google.com>
10482
10483 * errors.cc (Errors::info): New function.
10484 (gold_info): New function.
10485 * errors.h (Errors::info): New function.
10486 * gold.h (gold_info): New function.
10487 * object.cc (Input_objects::add_object): Print trace output.
10488 * options.cc (options::parse_set): New function.
10489 (General_options::parse_wrap): Deleted.
10490 (General_options::General_options): Deleted initializer.
10491 * options.h (options::String_set): New typedef.
10492 (options::parse_set): New function.
10493 (DEFINE_set): New macro.
10494 (General_options::wrap): Changed to use DEFINE_set. Changed
10495 callers of any_wrap_symbols and is_wrap_symbol.
10496 (General_options::trace, General_options::trace_symbol):
10497 New options.
10498 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10499 (General_options::wrap_symbols_): Deleted.
10500 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10501
10502 2008-04-17 David S. Miller <davem@davemloft.net>
10503
10504 * options.cc (General_options::parse_V): New function.
10505 * options.h: Add entries for -V and -Qy.
10506
10507 2008-04-17 Ian Lance Taylor <iant@google.com>
10508
10509 * common.cc (Symbol_table::allocate_commons): Remove options
10510 parameter. Change caller.
10511 (Symbol_table::do_allocate_commons): Remove options parameter.
10512 Change caller. Just call do_allocate_commons_list twice.
10513 (Symbol_table::do_allocate_commons_list): New function, broken out
10514 of do_allocate_commons.
10515 * common.h (class Allocate_commons_task): Remove options_ field.
10516 Update constructor.
10517 * symtab.cc (Symbol_table::Symbol_table): Initialize
10518 tls_commons_.
10519 (Symbol_table::add_from_object): Put TLS common symbols on
10520 tls_commons_ list.
10521 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10522 which are IN_OUTPUT_DATA.
10523 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10524 allocate_commons and do_allocate_commons declarations. Declare
10525 do_allocate_commons_list.
10526 * gold.cc (queue_middle_tasks): Update creation of
10527 Allocate_commons_task to not pass options.
10528 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10529 (TLS_TEST_C_FLAGS): New variable.
10530 (tls_test_c_pic.o): New target.
10531 (tls_test_shared.so): Link in tls_test_c_pic.o.
10532 (tls_test_c_pic_ie.o): New target.
10533 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10534 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10535 (tls_test_c.o): New target.
10536 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10537 (tls_pic_test_LDADD): Likewise.
10538 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10539 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10540 (tls_test_c_gnu2.o): New target.
10541 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10542 tls_test_c_gnu2.o.
10543 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10544 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10545 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10546 * testsuite/tls_test.cc: Include "config.h".
10547 (t_last): Call t11_last.
10548 * testsuite/tls_test.h (t11, t11_last): Declare.
10549 * testsuite/tls_test_c.c: New file.
10550 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10551 * configure.ac: Check for OpenMP support.
10552 * configure, config.in, Makefile.in: Rebuild.
10553 * testsuite/Makefile.in: Rebuild.
10554
10555 2008-04-16 Cary Coutant <ccoutant@google.com>
10556
10557 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10558 (Target_i386::tls_base_symbol_defined_): New field.
10559 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10560 (Target_i386::Scan::global): Likewise.
10561 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10562 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10563 (Target_x86_64::tls_base_symbol_defined_): New field.
10564 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10565 (Target_x86_64::Scan::global): Likewise.
10566
10567 2008-04-16 Cary Coutant <ccoutant@google.com>
10568
10569 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10570 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10571 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10572 building shared libraries.
10573 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10574 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10575 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10576 * testsuite/Makefile.in: Rebuild.
10577 * testsuite/weak_undef.h: New file.
10578 * testsuite/weak_undef_file1.cc: Add extra test cases.
10579 * testsuite/weak_undef_file2.cc: Likewise.
10580 * testsuite/weak_undef_test.cc: Likewise.
10581
10582 2008-04-16 David S. Miller <davem@davemloft.net>
10583
10584 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10585 Add issued_non_pic_error_ field. Declare check_non_pic.
10586 (Target_sparc::Scan::check_non_pic): New function.
10587 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10588 (Target_sparc::Scan::global): Likewise.
10589
10590 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10591 * configure: Rebuild.
10592
10593 * options.h (DEFINE_enable): New macro.
10594 (new_dtags): New enable option.
10595 (initfirst, interpose, loadfltr, nodefaultlib,
10596 nodelete, nodlopen, nodump): New -z options.
10597 * layout.cc (Layout:finish_dynamic_section): If new
10598 dtags enabled, emit DT_RUNPATH. Also, emit a
10599 DT_FLAGS_1 containing any specified -z flags.
10600
10601 2008-04-16 Ian Lance Taylor <iant@google.com>
10602
10603 * copy-relocs.cc: New file.
10604 * copy-relocs.h: New file.
10605 * reloc.cc: Remove Copy_relocs code.
10606 * reloc.h: Likewise.
10607 * reloc-types.h (struct Reloc_types) [both versions]: Add
10608 get_reloc_addend_noerror.
10609 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10610 variants of add_global which take an addend which must be zero.
10611 * i386.cc: Include "copy-relocs.h".
10612 (class Target_i386): Change type of copy_relocs_ to variable,
10613 update initializer.
10614 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10615 Change all callers.
10616 (Target_i386::do_finalize_sections): Change handling of
10617 copy_relocs_.
10618 * sparc.cc: Include "copy-relocs.h".
10619 (class Target_sparc): Change type of copy_relocs_ to variable,
10620 update initializer.
10621 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10622 Change all callers.
10623 (Target_sparc::do_finalize_sections): Change handling of
10624 copy_relocs_.
10625 * x86_64.cc: Include "copy-relocs.h".
10626 (class Target_x86_64): Change type of copy_relocs_ to variable,
10627 update initializer.
10628 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10629 class. Change all callers.
10630 (Target_x86_64::do_finalize_sections): Change handling of
10631 copy_relocs_.
10632 * Makefile.am (CCFILES): Add copy-relocs.cc.
10633 (HFILES): Add copy-relocs.h.
10634
10635 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10636
10637 * testsuite/script_test_4.sh: Permit leading zeroes.
10638
10639 2008-04-15 Ian Lance Taylor <iant@google.com>
10640
10641 * script-sections.cc (Script_sections::create_segments): Use
10642 header_size_adjustment even when there is enough room for the
10643 headers.
10644 * testsuite/script_test_4.sh: New file.
10645 * testsuite/script_test_4.t: New file.
10646 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10647 (check_DATA): Add script_test_4.stdout.
10648 (MOSTLYCLEANFILES): Likewise.
10649 (script_test_4): New target.
10650 (script_test_4.stdout): New target.
10651 * testsuite/Makefile.in: Rebuild.
10652
10653 * sparc.cc: Add definitions for Output_data_plt_sparc class
10654 constants.
10655
10656 2008-04-14 David S. Miller <davem@davemloft.net>
10657
10658 * sparc.cc: New file.
10659 * Makefile.am (TARGETSOURCES): Add sparc.cc
10660 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10661 * configure.tgt: Document targ_extra_size and
10662 targ_extra_big_endian. Add entries for sparc-* and
10663 sparc64-*.
10664 * configure.ac: Handle targ_extra_size and
10665 targ_extra_big_endian.
10666 * Makefile.in: Rebuild.
10667 * configure: Likewise.
10668 * po/POTFILES.in: Likewise.
10669 * po/gold.pot: Likewise.
10670
10671 2008-04-14 Ian Lance Taylor <iant@google.com>
10672
10673 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10674 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10675 in the name/type/flags to section mapping. Don't call
10676 allocate_output_section.
10677 (Layout::choose_output_section): Change parameter from adjust_name
10678 to is_input_section. Don't permit input sections after sections
10679 are attached to segments. Don't call allocate_output_section.
10680 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10681 not write_enable_output_section.
10682 (Layout::make_output_section): Don't push to
10683 unattached_section_list_ nor call attach_to_segment. Call
10684 attach_section_to_segment if sections are attached.
10685 (Layout::attach_sections_to_segments): New function.
10686 (Layout::attach_section_to_segment): New function.
10687 (Layout::attach_allocated_section_to_segment): Rename from
10688 attach_to_segment. Remove flags parameter.
10689 (Layout::allocate_output_section): Remove function.
10690 (Layout::write_enable_output_section): Remove function.
10691 * layout.h (class Layout): Update for above changes. Add new
10692 field sections_are_attached_.
10693 * output.h (Output_section::update_flags_for_input_section): New
10694 function.
10695 * output.cc (Output_section::add_input_section): Call
10696 update_flags_for_input_section.
10697 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10698
10699 2008-04-11 Cary Coutant <ccoutant@google.com>
10700
10701 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10702 thought unnecessary.
10703 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10704
10705 2008-04-11 Ian Lance Taylor <iant@google.com>
10706
10707 * output.h (class Output_section_data): Remove inline definition
10708 of set_addralign.
10709 * output.cc (Output_section_data::set_addralign): New function.
10710
10711 2008-04-11 Cary Coutant <ccoutant@google.com>
10712
10713 Add support for TLS descriptors for i386 and x86_64.
10714 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10715 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10716 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10717 GOT_TYPE_TLS_DESC.
10718 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10719 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10720 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10721 relocations.
10722 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10723 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10724 Fix problem with initial-exec relocations.
10725 (Target_i386::Relocate::relocate_tls): Likewise.
10726 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10727 relaxation.
10728 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10729 support for section-plus-offset dynamic table entries.
10730 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10731 (Output_data_dynamic::Dynamic_entry): Add support for
10732 section-plus-offset dynamic table entries.
10733 (Output_data_dynamic::Classification): Likewise.
10734 (Output_data_dynamic::classification_): Renamed offset_.
10735 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10736 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10737 (Target_x86_64::make_plt_section): New function.
10738 (Target_x86_64::reserve_tlsdesc_entries): New function.
10739 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10740 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10741 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10742 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10743 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10744 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10745 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10746 add extra PLT entry for TLS descriptors.
10747 (Output_data_plt_x86_64::got_): New field.
10748 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10749 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10750 fields.
10751 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10752 descriptors.
10753 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10754 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10755 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10756 R_386_TLS_DESC_CALL relocations.
10757 (Target_x86_64::Scan::global): Likewise.
10758 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10759 for TLS descriptors.
10760 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10761 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10762 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10763 GD-to-IE relaxation.
10764 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10765 and TLS_DESCRIPTORS.
10766 * Makefile.in: Rebuild.
10767 * configure: Rebuild.
10768 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10769 (tls_test_shared2.so): New target.
10770 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10771 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10772 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10773 (tls_shared_gd_to_ie_test_LDADD): New variable.
10774 (tls_shared_gnu2_gd_to_ie_test): New target.
10775 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10776 New targets.
10777 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10778 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10779 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10780 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10781 (tls_shared_gnu2_test): New target.
10782 (tls_test_gnu2_shared.so): New target.
10783 (tls_shared_gnu2_test_SOURCES): New variable.
10784 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10785 (tls_shared_gnu2_test_LDFLAGS): New variable.
10786 (tls_shared_gnu2_test_LDADD): New variable.
10787 * testsuite/Makefile.in: Rebuild.
10788 * testsuite/Makefile.
10789
10790 2008-04-11 Ian Lance Taylor <iant@google.com>
10791
10792 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10793 justsyms.t.
10794 * testsuite/Makefile.in: Rebuild.
10795
10796 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10797 long.
10798 * testsuite/script_test_2.cc (main): Adjust test.
10799
10800 2008-04-11 David S. Miller <davem@davemloft.net>
10801 Ian Lance Taylor <iant@google.com>
10802
10803 * options.h (General_options): Add entries for '-Y' and
10804 '-relax'.
10805 * options.cc (General_options:finalize): If -Y was used, add those
10806 entries to the library path instead of the default "/lib" and
10807 "/usr/lib".
10808
10809 2008-04-11 David S. Miller <davem@davemloft.net>
10810
10811 * testsuite/justsyms.t: Start at 0x100.
10812 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10813 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10814 long.
10815 * testsuite/script_test_2.cc: Adjust string and section length
10816 checks.
10817
10818 2008-04-09 Ian Lance Taylor <iant@google.com>
10819
10820 PR gold/5996
10821 * script-sections.cc (Sections_element::allocate_to_segment): Add
10822 orphan parameter.
10823 (Output_section_definition::allocate_to_segment): Likewise.
10824 (Orphan_output_section::allocate_to_segment): Likewise.
10825 (Script_sections::attach_sections_using_phdrs_clause): Don't
10826 propagate non-PT_LOAD segments to orphan sections.
10827 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10828 readelf rather than objdump.
10829 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10830 .interp section and PT_INTERP segment are the same size.
10831 * testsuite/Makefile.in: Rebuild.
10832
10833 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10834 aliases for symbols defined in the same object.
10835 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10836 (weak_alias_test_SOURCES): New variable.
10837 (weak_alias_test_DEPENDENCIES): New variable.
10838 (weak_alias_test_LDFLAGS): New variable.
10839 (weak_alias_test_LDADD): New variable.
10840 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10841 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10842 (weak_alias_test_3.o): New target.
10843 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10844 * testsuite/weak_alias_test_main.cc: New file.
10845 * testsuite/weak_alias_test_1.cc: New file.
10846 * testsuite/weak_alias_test_2.cc: New file.
10847 * testsuite/weak_alias_test_3.cc: New file.
10848
10849 2008-04-08 Ian Lance Taylor <iant@google.com>
10850
10851 * options.h (class General_options): Add --noinhibit-exec option.
10852 * main.cc (main): Check --noinhibit-exec.
10853
10854 * options.h (class General_options): Define --wrap as a special
10855 option. Add wrap_symbols_ field.
10856 (General_options::any_wrap_symbols): New function.
10857 (General_options::is_wrap_symbol): New function.
10858 * options.cc (General_options::parse_wrap): New function.
10859 (General_options::General_options): Initialize wrap_symbols_.
10860 * symtab.cc (Symbol_table::wrap_symbol): New function.
10861 (Symbol_table::add_from_object): Handle --wrap.
10862 * symtab.h (class Symbol_table): Declare wrap_symbol.
10863 * target.h (Target::wrap_char): New function.
10864 (Target::Target_info): Add wrap_char field.
10865 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10866 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10867 * testsuite/testfile.cc (Target_test::test_target_info):
10868 Likewise.
10869
10870 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10871 there is one.
10872
10873 * layout.h (class Layout): Add added_eh_frame_data_ field.
10874 * layout.cc (Layout::Layout): Initialize new field.
10875 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10876 output section until we find a section we merged successfully.
10877 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10878 that the size be non-zero.
10879
10880 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10881 qualifier.
10882
10883 2008-04-08 Craig Silverstein <csilvers@google.com>
10884
10885 * configure.ac: Export new conditional variable HAVE_ZLIB.
10886 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10887 on HAVE_ZLIB.
10888 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10889 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10890
10891 2008-04-07 Ian Lance Taylor <iant@google.com>
10892
10893 * version.cc (version_string): Set to "1.5".
10894
10895 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10896 Add issued_non_pic_error_ field. Declare check_non_pic.
10897 (Target_x86_64::Scan::check_non_pic): New function.
10898 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10899 (Target_x86_64::Scan::global): Likewise.
10900
10901 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10902 addend parameter. Change caller. Handle merge sections.
10903 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10904 Address to Addend. Don't add in the result of
10905 local_section_offset, pass down the addend and use the returned
10906 value.
10907 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10908 Update declarations of local_section_offset and symbol_value.
10909 * testsuite/two_file_test_1.cc (t18): New function.
10910 * testsuite/two_file_test_2.cc (f18): New function.
10911 * testsuite/two_file_test_main.cc (main): Call t18.
10912 * testsuite/two_file_test.h (t18, f18): Declare.
10913
10914 * configure.ac: Don't test for objdump, c++filt, or readelf.
10915 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10916 conditionals.
10917 (TEST_READELF): New variable.
10918 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10919 (check_PROGRAMS): Add two_file_strip_test.
10920 (two_file_strip_test): New target.
10921 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10922 (two_file_same_shared_strip_test_SOURCES): New variable.
10923 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10924 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10925 (two_file_same_shared_strip_test_LDADD): New variable.
10926 (two_file_shared_strip.so): New target.
10927 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10928 (ver_test_5.syms, ver_test_7.syms): Likewise.
10929 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10930 (strip_test_3.stdout): Use TEST_OBJDUMP.
10931 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10932
10933 2008-04-04 Cary Coutant <ccoutant@google.com>
10934
10935 * symtab.h (Symbol::is_weak_undefined): New function.
10936 (Symbol::is_strong_undefined): New function.
10937 (Symbol::is_absolute): New function.
10938 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10939 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10940 absolute symbols.
10941 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10942 (weak_undef_test): New target.
10943 * testsuite/Makefile.in: Rebuild.
10944 * testsuite/weak_undef_file1.cc: New file.
10945 * testsuite/weak_undef_file2.cc: New file.
10946 * testsuite/weak_undef_test.cc: New file.
10947
10948 2008-04-03 Craig Silverstein <csilvers@google.com>
10949
10950 * compressed_output.h (class Output_compressed_section): Use
10951 unsigned buffer.
10952 * compressed_output.cc (zlib_compress): Use unsigned buffers,
10953 add zlib header.
10954 (zlib_compressed_suffix): Removed.
10955 (Output_compressed_section::set_final_data_size): Use unsigned
10956 buffers.
10957 * testsuite/Makefile.am (flagstest_compress_debug_sections):
10958 Fix linker invocation.
10959 (flagstest_o_specialfile_and_compress_debug_sections):
10960 Likewise.
10961 * testsuite/Makefile.in: Regenerated.
10962
10963 2008-04-02 David S. Miller <davem@davemloft.net>
10964
10965 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
10966 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
10967
10968 2008-04-02 Craig Silverstein <csilvers@google.com>
10969
10970 * TODO: New file.
10971
10972 2008-04-02 Ian Lance Taylor <iant@google.com>
10973
10974 * fileread.cc (File_read::find_view): Add byteshift and vshifted
10975 parameters. Update for new key type to views_. Change all
10976 callers.
10977 (File_read::read): Adjust for byteshift in returned view.
10978 (File_read::add_view): New function, broken out of
10979 find_and_make_view.
10980 (File_read::make_view): New function, broken out of
10981 find_and_make_view.
10982 (File_read::find_or_make_view): Add offset and aligned
10983 parameters. Rewrite accordingly. Change all callers.
10984 (File_read::get_view): Add offset and aligned parameters. Adjust
10985 for byteshift in return value.
10986 (File_read::get_lasting_view): Likewise.
10987 * fileread.h (class File_read): Update declarations.
10988 (class File_read::View): Add byteshift_ field. Add byteshift to
10989 constructor. Add byteshift method.
10990 * archive.h (Archive::clear_uncached_views): New function.
10991 (Archive::get_view): Add aligned parameter. Change all callers.
10992 * object.h (Object::get_view): Add aligned parameter. Change all
10993 callers.
10994 (Object::get_lasting_view): Likewise.
10995
10996 * fileread.cc (File_read::release): Don't call clear_views if
10997 there are multiple objects.
10998 * fileread.h (File_read::clear_uncached_views): New function.
10999 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11000 on the archive.
11001
11002 2008-03-31 Cary Coutant <ccoutant@google.com>
11003
11004 Add thin archive support.
11005 * archive.cc (Archive::armagt): New const.
11006 (Archive::setup): Remove task parameter and calls to unlock.
11007 (Archive::unlock_nested_archives): New function.
11008 (Archive::read_header): Add nested_off parameter. Change
11009 all callers.
11010 (Archive::interpret_header): Likewise.
11011 (Archive::include_all_members): Change to handle thin
11012 archives.
11013 (Archive::include_member): Likewise.
11014 * archive.h (Archive::Archive): Add new parameters and
11015 initializers.
11016 (Archive::armagt): New const.
11017 (Archive::setup): Remove task parameter.
11018 (Archive::unlock_nested_archives): New function.
11019 (Archive::read_header): Add nested_off parameter.
11020 (Archive::interpret_header): Likewise.
11021 (Archive::Nested_archive_table): New typedef.
11022 (Archive::is_thin_archive_): New field.
11023 (Archive::nested_archives_): New field.
11024 (Archive::options_): New field.
11025 (Archive::dirpath_): New field.
11026 (Archive::task_): New field.
11027 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11028 for thin archives. Pass additional parameters to
11029 Archive::Archive. Unlock the archive file after calling
11030 Archive::setup.
11031
11032 2008-03-29 Ian Lance Taylor <iant@google.com>
11033
11034 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11035 version symbol to be local.
11036 * testsuite/ver_test_4.sh: New file.
11037 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11038 (check_DATA): Add ver_test_4.syms.
11039 (ver_test_4.syms): New target.
11040 * testsuite/Makefile.in: Rebuild.
11041
11042 * output.cc
11043 (Output_section::Input_section_sort_entry::has_priority): New
11044 function.
11045 (Output_section::Input_section_sort_entry::match_file_name): New
11046 function.
11047 (Output_section::Input_section_sort_entry::match_section_name):
11048 Remove.
11049 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11050 Remove.
11051 (Output_section::Input_section_sort_entry::match_section_file):
11052 Remove.
11053 (Output_section::Input_section_sort_compare::operator()): Rewrite
11054 using new Input_section_sort_entry functions. Sort crtbegin and
11055 crtend first. Sort sections with no priority before sections with
11056 a priority.
11057 * testsuite/initpri1.c (d3): Check j != 4.
11058 (cd5): New constructor/destructor function.
11059 (main): Check j != 2.
11060
11061 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11062 new symbol when resolving, don't call set_is_default.
11063 * testsuite/ver_test_7.cc: New file.
11064 * testsuite/ver_test_7.sh: New file.
11065 * testsuite/Makefile.am (ver_test_7.so): New target.
11066 (ver_test_7.o): New target.
11067 (check_SCRIPTS): Add ver_test_7.sh.
11068 (check_DATA): Add ver_test_7.syms.
11069 (ver_test_7.syms): New target.
11070
11071 2008-03-28 Ian Lance Taylor <iant@google.com>
11072
11073 * layout.cc (Layout::layout): If we see an input section with a
11074 name that needs sorting, set the must_sort flag for the output
11075 section.
11076 (Layout::make_output_section): If the name of the output section
11077 indicates that it might require sorting, set the may_sort flag.
11078 * output.h (Output_section::may_sort_attached_input_sections): New
11079 function.
11080 (Output_section::set_may_sort_attached_input_sections): New
11081 function.
11082 (Output_section::must_sort_attached_input_sections): New
11083 function.
11084 (Output_section::set_must_sort_attached_input_sections): New
11085 function.
11086 (class Output_section): Declare Input_section_sort_entry. Define
11087 Input_section_sort_compare. Declare
11088 sort_attached_input_sections. Add new fields:
11089 may_sort_attached_input_sections_,
11090 must_sort_attached_input_sections_,
11091 attached_input_sections_are_sorted_.
11092 * output.cc (Output_section::Output_section): Initialize new
11093 fields.
11094 (Output_section::add_input_section): Add an entry to
11095 input_sections_ if may_sort or must_sort are true.
11096 (Output_section::set_final_data_size): Call
11097 sort_attached_input_sections if necessary.
11098 (Output_section::Input_section_sort_entry): Define new class.
11099 (Output_section::Input_section_sort_compare::operator()): New
11100 function.
11101 (Output_section::sort_attached_input_sections): New function.
11102 * configure.ac: Check whether the compiler supports constructor
11103 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11104 * testsuite/initpri1.c: New file.
11105 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11106 CONSTRUCTOR_PRIORITY.
11107 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11108 (initpri1_LDFLAGS): New variable.
11109 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11110
11111 2008-03-27 Ian Lance Taylor <iant@google.com>
11112
11113 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11114 * testsuite/common_test_1.c: New file.
11115 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11116 (common_test_1_SOURCES): New variable.
11117 (common_test_1_DEPENDENCIES): New variable.
11118 (common_test_1_LDFLAGS): New variable.
11119
11120 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11121 and commons_ correctly when NAME/VERSION does not override
11122 NAME/NULL.
11123 * testsuite/ver_test_6.c: New file.
11124 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11125 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11126 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11127
11128 2008-03-26 Ian Lance Taylor <iant@google.com>
11129
11130 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11131 of an undefined symbol from a version script.
11132 * testsuite/Makefile.am (ver_test_5.so): New target.
11133 (ver_test_5.o): New target.
11134 (check_SCRIPTS): Add ver_test_5.sh.
11135 (check_DATA): Add ver_test_5.syms.
11136 (ver_test_5.syms): New target.
11137 * testsuite/ver_test_5.cc: New file.
11138 * testsuite/ver_test_5.script: New file.
11139 * testsuite/ver_test_5.sh: New file.
11140 * Makefile.in, testsuite/Makefile.in: Rebuild.
11141
11142 PR gold/5986
11143 Fix problems building gold with gcc 4.3.0.
11144 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11145 (gold_error_at_location, gold_warning_at_location): Use it.
11146 * configure.ac: Check whether we can compile and use a template
11147 function with a printf attribute.
11148 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11149 when jumping over bytes.
11150 * object.cc: Instantiate Object::read_section_data.
11151 * debug.h: Include <cstring>
11152 * dwarf_reader.cc: Include <algorithm>
11153 * main.cc: Include <cstring>.
11154 * options.cc: Include <cstring>.
11155 * output.cc: Include <cstring>.
11156 * script.cc: Include <cstring>.
11157 * script.h: Include <string>.
11158 * symtab.cc: Include <cstring> and <algorithm>.
11159 * target-select.cc: Include <cstring>.
11160 * version.cc: Include <string>.
11161 * testsuite/testmain.cc: Include <cstdlib>.
11162 * configure, config.in: Rebuild.
11163
11164 2008-03-25 Ian Lance Taylor <iant@google.com>
11165
11166 * options.cc: Include "../bfd/bfdver.h".
11167 (options::help): Print bug reporting address.
11168
11169 * version.cc (print_version): Adjust output for current value of
11170 BFD_VERSION_STRING.
11171
11172 * NEWS: New file.
11173
11174 * options.cc (options::help): Print list of supported targets.
11175 * target-select.h: Include <vector>.
11176 (class Target_selector): Make machine_, size_, and is_big_endian_
11177 fields const. Add bfd_name_ and instantiated_target_ fields.
11178 (Target_selector::Target_selector): Add bfd_name parameter.
11179 (Target_selector::recognize): Make non-virtual, call
11180 do_recognize.
11181 (Target_selector::recognize_by_name): Make non-virtual, call
11182 do_recognize_by_name.
11183 (Target_selector::supported_names): New function.
11184 (Target_selector::bfd_name): New function.
11185 (Target_selector::do_instantiate_target): New pure virtual
11186 function.
11187 (Target_selector::do_recognize): New virtual function.
11188 (Target_selector::do_recognize_by_name): New virtual function.
11189 (Target_selector::instantiate_target): New private function.
11190 (supported_target_names): Declare.
11191 * target-select.cc (Target_selector::Target_selector): Update for
11192 new parameter and fields.
11193 (select_target_by_name): Check that the name matches before
11194 calling recognize_by_name.
11195 (supported_target_names): New function.
11196 * i386.cc (class Target_selector_i386): Update Target_selector
11197 constructor call. Remove recognize and recognize_by_name. Add
11198 do_instantiate_target.
11199 * x86_64.cc (class Target_selector_x86_64): Likewise.
11200 * testsuite/testfile.cc (class Target_selector_test): Update for
11201 changes to Target_selector.
11202
11203 * README: Rewrite, with some notes on unsupported features.
11204
11205 2008-03-24 Cary Coutant <ccoutant@google.com>
11206
11207 * i386.cc (Target_i386::Got_type): New enum declaration.
11208 (Target_i386::Scan::local): Updated callers of Output_data_got
11209 member functions.
11210 (Target_i386::Scan::global): Likewise.
11211 (Target_i386::Relocate::relocate): Likewise.
11212 (Target_i386::Relocate::relocate_tls): Likewise.
11213 * object.h (Got_offset_list): New class.
11214 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11215 (Sized_relobj::local_got_offset): Likewise.
11216 (Sized_relobj::set_local_got_offset): Likewise.
11217 (Sized_relobj::local_has_tls_got_offset): Removed.
11218 (Sized_relobj::local_tls_got_offset): Removed.
11219 (Sized_relobj::set_local_tls_got_offset): Removed.
11220 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11221 * output.cc (Output_data_got::add_global): Added got_type parameter.
11222 (Output_data_got::add_global_with_rel): Likewise.
11223 (Output_data_got::add_global_with_rela): Likewise.
11224 (Output_data_got::add_global_pair_with_rel): New function.
11225 (Output_data_got::add_global_pair_with_rela): New function.
11226 (Output_data_got::add_local): Added got_type parameter.
11227 (Output_data_got::add_local_with_rel): Likewise.
11228 (Output_data_got::add_local_with_rela): Likewise.
11229 (Output_data_got::add_local_pair_with_rel): New function.
11230 (Output_data_got::add_local_pair_with_rela): New function.
11231 (Output_data_got::add_global_tls): Removed.
11232 (Output_data_got::add_global_tls_with_rel): Removed.
11233 (Output_data_got::add_global_tls_with_rela): Removed.
11234 (Output_data_got::add_local_tls): Removed.
11235 (Output_data_got::add_local_tls_with_rel): Removed.
11236 (Output_data_got::add_local_tls_with_rela): Removed.
11237 * output.h (Output_data_got::add_global): Added got_type parameter.
11238 (Output_data_got::add_global_with_rel): Likewise.
11239 (Output_data_got::add_global_with_rela): Likewise.
11240 (Output_data_got::add_global_pair_with_rel): New function.
11241 (Output_data_got::add_global_pair_with_rela): New function.
11242 (Output_data_got::add_local): Added got_type parameter.
11243 (Output_data_got::add_local_with_rel): Likewise.
11244 (Output_data_got::add_local_with_rela): Likewise.
11245 (Output_data_got::add_local_pair_with_rel): New function.
11246 (Output_data_got::add_local_pair_with_rela): New function.
11247 (Output_data_got::add_global_tls): Removed.
11248 (Output_data_got::add_global_tls_with_rel): Removed.
11249 (Output_data_got::add_global_tls_with_rela): Removed.
11250 (Output_data_got::add_local_tls): Removed.
11251 (Output_data_got::add_local_tls_with_rel): Removed.
11252 (Output_data_got::add_local_tls_with_rela): Removed.
11253 * resolve.cc (Symbol::override_base_with_special): Removed
11254 reference to has_got_offset_ field.
11255 * symtab.cc (Symbol::init_fields): Replaced initialization
11256 of got_offset_ with got_offsets_. Removed initialization
11257 of has_got_offset_
11258 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11259 (Symbol::got_offset): Likewise.
11260 (Symbol::set_got_offset): Likewise.
11261 (Symbol::has_tls_got_offset): Removed.
11262 (Symbol::tls_got_offset): Removed.
11263 (Symbol::set_tls_got_offset): Removed.
11264 (Symbol::got_offset_): Removed.
11265 (Symbol::tls_mod_got_offset_): Removed.
11266 (Symbol::tls_pair_got_offset_): Removed.
11267 (Symbol::got_offsets_): New field.
11268 (Symbol::has_got_offset): Removed.
11269 (Symbol::has_tls_mod_got_offset): Removed.
11270 (Symbol::has_tls_pair_got_offset): Removed.
11271 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11272 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11273 member functions.
11274 (Target_x86_64::Scan::global): Likewise.
11275 (Target_x86_64::Relocate::relocate): Likewise.
11276 (Target_x86_64::Relocate::relocate_tls): Likewise.
11277
11278 2008-03-25 Ben Elliston <bje@au.ibm.com>
11279
11280 * yyscript.y: Fix spelling error in comment.
11281
11282 2008-03-24 Ian Lance Taylor <iant@google.com>
11283
11284 * options.h (class General_options): Define build_id option.
11285 * layout.h (class Layout): Declare write_build_id, create_note,
11286 create_build_id. Add build_id_note_ member.
11287 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11288 "libiberty.h", "md5.h", "sha1.h".
11289 (Layout::Layout): Initialize eh_frame_data_,
11290 eh_frame_hdr_section_, and build_id_note_.
11291 (Layout::finalize): Call create_build_id.
11292 (Layout::create_note): New function, broken out of
11293 Layout::create_gold_note.
11294 (Layout::create_gold_note): Call create_note.
11295 (Layout::create_build_id): New function.
11296 (Layout::write_build_id): New function.
11297 (Close_task_runner::run): Call write_build_id.
11298
11299 * x86_64.cc: Correct license to GPLv3.
11300
11301 2008-03-23 Ian Lance Taylor <iant@google.com>
11302
11303 * options.cc: Include "demangle.h".
11304 (parse_optional_string): New function.
11305 (parse_long_option): Handle takes_optional_argument.
11306 (parse_short_option): Update dash_z initializer. Handle
11307 takes_optional_argument.
11308 (General_options::General_options): Initialize do_demangle_.
11309 (General_options::finalize): Set do_demangle_. Handle demangling
11310 style.
11311 * options.h (parse_optional_string): Declare.
11312 (struct One_option): Add optional_arg field. Update constructor.
11313 Update call constructor calls. Add takes_optional_argument
11314 function.
11315 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11316 (DEFINE_optional_string): Define.
11317 (General_options::demangle): Change from DEFINE_bool to
11318 DEFINE_optional_string.
11319 (General_options::no_demangle): New function.
11320 (General_options::do_demangle): New function.
11321 (General_options::set_do_demangle): New function.
11322 (General_options::execstack_status_): Move definition to end of
11323 class definition.
11324 (General_options::static_): Likewise.
11325 (General_options::do_demangle_): New field.
11326 * object.cc (big_endian>::get_symbol_location_info): Call
11327 Options::do_demangle, not Options::demangle.
11328 * symtab.cc (demangle): Likewise.
11329
11330 2008-03-22 Ian Lance Taylor <iant@google.com>
11331
11332 * gold.h: Include <cstddef> and <sys/types.h>
11333 * options.h: Include <cstring>.
11334
11335 2008-03-21 Ian Lance Taylor <iant@google.com>
11336
11337 * Added source code to GNU binutils.
This page took 0.310885 seconds and 5 git commands to generate.