62ee3cad8be379b00d3190cac4a635c827605288
[deliverable/binutils-gdb.git] / gold / ChangeLog
1 2011-06-29 Ian Lance Taylor <iant@google.com>
2
3 PR gold/12629
4 * object.cc (Sized_relobj_file::layout_section): Change shdr
5 parameter to be const.
6 (Sized_relobj_file::layout_eh_frame_section): New function, broken
7 out of do_layout.
8 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
9 appropriate. Call layout_eh_frame_section.
10 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
11 sections.
12 * object.h (class Sized_relobj_file): Update declarations.
13
14 2011-06-29 Ian Lance Taylor <iant@google.com>
15
16 PR gold/12652
17 * script.cc (Token::integer_value): Accept trailing M/m/K/k
18 modifier.
19 (Lex::gather_token): Accept trailing M/m/K/k for integers.
20
21 2011-06-29 Ian Lance Taylor <iant@google.com>
22
23 PR gold/12675
24 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
25 SHT_X86_64_UNWIND.
26 * layout.cc (Layout::layout_eh_frame): Likewise.
27
28 2011-06-29 Ian Lance Taylor <iant@google.com>
29
30 PR gold/12695
31 * layout.cc (Layout::symtab_section_shndx): New function.
32 * layout.h (class Layout): Declare symtab_section_shndx.
33 * output.cc (Output_section::write_header): Call it.
34
35 2011-06-29 Ian Lance Taylor <iant@google.com>
36
37 PR gold/12818
38 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
39 symbols which are not used in a relocation.
40
41 2011-06-28 Ian Lance Taylor <iant@google.com>
42
43 PR gold/12898
44 * layout.cc (Layout::segment_precedes): Don't crash if a linker
45 script create indistinguishable segments.
46 (Layout::set_segment_offsets): Use stable_sort when sorting
47 segments. Pass this to Compare_segments constructor.
48 * layout.h (class Layout): Make segment_precedes non-static.
49 (class Compare_segments): Change from struct to class. Add
50 layout_ field. Add constructor.
51 * script-sections.cc
52 (Script_sections::attach_sections_using_phdrs_clause): Rename
53 local orphan to is_orphan. Don't report failure to put empty
54 section in segment. On attachment failure, report name of
55 section, and attach to first PT_LOAD segment.
56
57 2011-06-28 Ian Lance Taylor <iant@google.com>
58
59 PR gold/12934
60 * target-select.cc (Target_selector::Target_selector): Add
61 emulation parameter. Change all callers.
62 (select_target_by_bfd_name): Rename from select_target_by_name.
63 Change all callers.
64 (select_target_by_emulation): New function.
65 (supported_emulation_names): New function.
66 * target-select.h (class Target_selector): Add emulation_ field.
67 Update declarations.
68 (Target_selector::recognize_by_bfd_name): Rename from
69 recognize_by_name. Change all callers.
70 (Target_selector::supported_bfd_names): Rename from
71 supported_names. Change all callers.
72 (Target_selector::recognize_by_emulation): New function.
73 (Target_selector::supported_emulations): New function.
74 (Target_selector::emulation): New function.
75 (Target_selector::do_recognize_by_bfd_name): Rename from
76 do_recognize_by_name. Change all callers.
77 (Target_selector::do_supported_bfd_names): Rename from
78 do_supported_names. Change all callers.
79 (Target_selector::do_recognize_by_emulation): New function.
80 (Target_selector::do_supported_emulations): New function.
81 (select_target_by_bfd_name): Change name in declaration.
82 (select_target_by_emulation): Declare.
83 (supported_emulation_names): Declare.
84 * parameters.cc (parameters_force_valid_target): Try to find
85 target based on emulation from -m option.
86 * options.h (class General_options): Change doc string for -m.
87 * options.cc (help): Print emulations.
88 (General_options::parse_V): Likewise.
89 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
90 Add emulation parameter. Change all callers.
91
92 2011-06-28 Ian Lance Taylor <iant@google.com>
93
94 * target.h (class Target): Add osabi_ field.
95 (Target::osabi): New function.
96 (Target::set_osabi): New function.
97 (Target::Target): Initialize osabi_.
98 (Target::do_adjust_elf_header): Make pure virtual.
99 (Sized_target::do_adjust_elf_header): Declare.
100 * target.cc (Sized_target::do_adjust_elf_header): New function.
101 (class Sized_target): Instantiate all versions.
102 * freebsd.h (class Target_freebsd): Remove.
103 (Target_selector_freebsd::do_recognize): Call set_osabi on
104 Target.
105 (Target_selector_freebsd::do_recognize_by_name): Likewise.
106 (Target_selector_freebsd::set_osabi): Remove.
107 * i386.cc (class Target_i386): Inherit from Sized_target rather
108 than Target_freebsd.
109 * x86_64.cc (class Target_x86_64): Likewise.
110
111 2011-06-28 Ian Lance Taylor <iant@google.com>
112
113 * target.h (Target::can_check_for_function_pointers): Rewrite.
114 Make non-virtual.
115 (Target::can_icf_inline_merge_sections): Likewise.
116 (Target::section_may_have_icf_unsafe_poineters): Likewise.
117 (Target::Target_info): Add can_icf_inline_merge_sections field.
118 (Target::do_can_check_for_function_pointers): New virtual
119 function.
120 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
121 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
122 from can_check_for_function_pointers, move in file.
123 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
124 section_may_have_icf_unsafe_poineters, move in file.
125 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
126 * i386.cc (Target_i386::do_can_check_for_function_pointers):
127 Rename from can_check_for_function_pointers, move in file.
128 (Target_i386::can_icf_inline_merge_sections): Remove.
129 (Target_i386::i386_info): Initialize
130 can_icf_inline_merge_sections.
131 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
132 Initialize can_icf_inline_merge_sections.
133 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
134 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
135 Rename from can_check_for_function_pointers, move in file.
136 (Target_x86_64::can_icf_inline_merge_sections): Remove.
137 (Target_x86_64::x86_64_info): Initialize
138 can_icf_inline_merge_sections.
139 * testsuite/testfile.cc (Target_test::test_target_info):
140 Likewise.
141 * icf.cc (get_section_contents): Correct formatting.
142
143 2011-06-27 Ian Lance Taylor <iant@google.com>
144
145 * symtab.cc (Symbol::versioned_name): New function.
146 (Symbol_table::add_to_final_symtab): Use versioned_name when
147 appropriate.
148 (Symbol_table::sized_write_symbol): Likewise.
149 * symtab.h (class Symbol): Declare versioned_name.
150 * stringpool.h (class Stringpool_template): Add variant of add
151 which takes a std::basic_string.
152 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
153 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
154 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
155 (ver_test_12.o): New target.
156 * testsuite/Makefile.in: Rebuild.
157
158 2011-06-27 Doug Kwan <dougkwan@google.com>
159
160 * arm.cc (Arm_relocate_functions::thm_jump8,
161 Arm_relocate_functions::thm_jump11): Use a wider signed
162 type to compute offset.
163 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
164 arm_thm_jump8.
165 * testsuite/Makefile.in: Regenerate.
166 * testsuite/arm_branch_in_range.sh: Check test results of
167 arm_thm_jump11 and arm_thm_jump8.
168 * testsuite/arm_thm_jump11.s: New test source file.
169 * testsuite/arm_thm_jump11.t: New linker script.
170 * testsuite/arm_thm_jump8.s: New test source file.
171 * testsuite/arm_thm_jump8.t: New linker script.
172
173 2011-06-24 Ian Lance Taylor <iant@google.com>
174
175 * layout.cc: Include "object.h".
176 (ctors_sections_in_init_array): New static variable.
177 (Layout::is_ctors_in_init_array): New function.
178 (Layout::layout): Add entry to ctors_sections_in_init_array if
179 appropriate.
180 * layout.h (class Layout): Declare is_ctors_in_init_array.
181 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
182 is_ctors_reverse_view is set.
183 (Sized_relobj_file::write_sections): Add layout parameter. Change
184 all callers. Set is_ctors_reverse_view field of View_size.
185 (Sized_relobj_file::reverse_words): New function.
186 * object.h (Sized_relobj_file::View_size): Add
187 is_ctors_reverse_view field.
188 (class Sized_relobj_file): Update declarations.
189 * testsuite/initpri3.c: New test.
190 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
191 initpri3b.
192 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
193 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
194 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
195 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
196 * testsuite/Makefile.in: Rebuild.
197
198 2011-06-24 Cary Coutant <ccoutant@google.com>
199
200 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
201 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
202 (debug_msg_cdebug.err): New targets.
203 * testsuite/Makefile.in: Regenerate.
204 * testsuite/debug_msg.sh: Check output of link with compressed debug.
205 Fix checks for link with shared library.
206
207 2011-06-24 Doug Kwan <dougkwan@google.com>
208
209 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
210 skip empty text sections.
211 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
212
213 2011-06-22 Ian Lance Taylor <iant@google.com>
214
215 PR gold/12910
216 * options.h (class General_options): Add --ctors-in-init-array.
217 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
218 friends as SHT_PROGBITS for merging sections.
219 (Layout::layout): Remove special handling of .init_array and
220 friends. Don't sort if doing relocatable link. Sort for .ctors
221 and .dtors if ctors_in_init_array.
222 (Layout::make_output_section): Force correct section types for
223 .init_array and friends. Don't sort if doing relocatable link,
224 Don't sort .ctors and .dtors if ctors_in_init_array.
225 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
226 (Layout::output_section_name): Add relobj parameter. Change all
227 callers. Handle .ctors. and .dtors. in code rather than table.
228 Handle .ctors and .dtors if ctors_in_init_array.
229 (Layout::match_file_name): New function, moved from output.cc.
230 * layout.h (class Layout): Update declarations.
231 * output.cc: Include "layout.h".
232 (Input_section_sort_entry::get_priority): New function.
233 (Input_section_sort_entry::match_file_name): Just call
234 Layout::match_file_name.
235 (Output_section::Input_section_sort_init_fini_compare::operator()):
236 Handle .ctors and .dtors. Sort by explicit priority rather than
237 by name.
238 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
239 * testsuite/initpri2.c: New test.
240 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
241 (check_PROGRAMS): Add initpri2.
242 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
243 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
244 * configure, testsuite/Makefile.in: Rebuild.
245
246 2011-06-19 Ian Lance Taylor <iant@google.com>
247
248 PR gold/12880
249 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
250 .interp section to a PT_INTERP segment even if we have seen a
251 --dynamic-linker option. Don't do it if we have seen a PHDRS
252 clause in a linker script.
253 (Layout::finalize): Don't create a .interp section if we've
254 already create a PT_INTERP segment.
255 (Layout::create_interp): Always call choose_output_section (revert
256 patch of 2011-06-17). Don't create PT_INTERP segment.
257 * script-sections.cc
258 (Script_sections::create_note_and_tls_segments): Add a .interp
259 section to a PT_INTERP segment even if we have seen a
260 --dynamic-linker option.
261
262 2011-06-18 Ian Lance Taylor <iant@google.com>
263
264 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
265 merely because a non-PT_LOAD segment has a dynamic reloc.
266
267 2011-06-18 Ian Lance Taylor <iant@google.com>
268
269 * layout.cc (Layout::finish_dynamic_section): Don't create
270 DT_FLAGS entry if not needed.
271
272 2011-06-18 Ian Lance Taylor <iant@google.com>
273
274 PR gold/12745
275 * layout.cc (Layout::layout_eh_frame): Correct handling of
276 writable .eh_frame section.
277
278 2011-06-17 Ian Lance Taylor <iant@google.com>
279
280 PR gold/12893
281 * resolve.cc (Symbol_table::resolve): Don't give an error if a
282 symbol is redefined with the exact same object and value.
283
284 2011-06-17 Ian Lance Taylor <iant@google.com>
285
286 PR gold/12880
287 * layout.h (class Layout): Add interp_segment_ field.
288 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
289 (Layout::attach_allocated_section_to_segment): If making shared
290 library, put .interp section in PT_INTERP segment.
291 (Layout::finalize): Also call create_interp if -dynamic-linker
292 option was used.
293 (Layout::create_interp): Assert that there is no PT_INTERP
294 segment. If not using a SECTIONS clause, use make_output_section.
295 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
296 * script-sections.cc
297 (Script_sections::create_note_and_tls_segments): If making shared
298 library, put .interp section in PT_INTERP segment.
299
300 2011-06-17 Ian Lance Taylor <iant@google.com>
301
302 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
303 when making a shared library.
304
305 2011-06-17 Ian Lance Taylor <iant@google.com>
306
307 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
308 parameter. Change all callers. Don't issue warning about PC32
309 against locally defined symbol.
310
311 2011-06-16 Ian Lance Taylor <iant@google.com>
312
313 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
314 occurs in same object.
315
316 2011-06-14 Alan Modra <amodra@gmail.com>
317
318 * po/POTFILES.in: Regenerate.
319
320 2011-06-09 Ian Lance Taylor <iant@google.com>
321
322 * script-sections.cc
323 (Orphan_output_section::set_section_addresses): For a relocatable
324 link set address to 0.
325
326 2011-06-09 Cary Coutant <ccoutant@google.com>
327
328 PR gold/12804
329 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
330 used with --compress-debug-sections.
331 * gold/object.cc (Sized_relobj_file::do_layout): Report
332 uncompressed size of compressed input sections.
333
334 2011-06-08 Cary Coutant <ccoutant@google.com>
335
336 PR gold/12804
337 * testsuite/two_file_test_2_v1.cc: Change initialization of
338 v2 to keep it in .data.
339
340 2011-06-07 Cary Coutant <ccoutant@google.com>
341
342 * common.cc (Symbol_table::do_allocate_commons_list): Call
343 gold_fallback.
344 * errors.cc (Errors::fatal): Adjust call to gold_exit.
345 (Errors::fallback): New function.
346 (gold_fallback): New function.
347 * errors.h (Errors::fallback): New function.
348 * gold.cc (gold_exit): Change status parameter to enum; adjust
349 all callers.
350 (queue_initial_tasks): Call gold_fallback.
351 * gold.h: Include cstdlib.
352 (Exit_status): New enum type.
353 (gold_exit): Change status parameter to enum.
354 (gold_fallback): New function.
355 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
356 (Layout::create_symtab_sections): Likewise.
357 (Layout::create_shdrs): Likewise.
358 * main.cc (main): Adjust call to gold_exit.
359 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
360 (Output_data_got::add_got_entry_pair): Likewise.
361 (Output_section::add_input_section): Likewise.
362 (Output_section::add_output_section_data): Likewise.
363 (Output_segment::set_section_list_addresses): Likewise.
364 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
365
366 2011-06-07 Cary Coutant <ccoutant@google.com>
367
368 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
369 for incremental links.
370 * output.cc (Output_segment::set_section_list_addresses): Remove
371 FIXME and test for TLS or BSS.
372
373 2011-06-07 Cary Coutant <ccoutant@google.com>
374
375 * testsuite/Makefile.am: Add incremental_copy_test,
376 incremental_common_test_1.
377 * testsuite/Makefile.in: Regenerate.
378 * testsuite/common_test_1_v1.c: New source file.
379 * testsuite/common_test_1_v2.c: New source file.
380 * testsuite/copy_test_v1.cc: New source file.
381
382 2011-06-07 Cary Coutant <ccoutant@google.com>
383
384 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
385 update, allocate common from bss section's free list.
386 * incremental-dump.cc (dump_incremental_inputs): Print flag for
387 linker-defined symbols.
388 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
389 Skip GOT and PLT entries that are no longer referenced.
390 (Output_section_incremental_inputs::write_info_blocks): Mark
391 linker-defined symbols.
392 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
393 * output.cc (Output_section::allocate): New function.
394 * output.h (Output_section::allocate): New function.
395 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
396 linker-defined symbols.
397 (Symbol::override_base_with_special): Copy is_predefined_ flag.
398 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
399 (Symbol::init_base_output_data): Likewise.
400 (Symbol::init_base_output_segment): Likewise.
401 (Symbol::init_base_constant): Likewise.
402 (Sized_symbol::init_output_data): Likewise.
403 (Sized_symbol::init_output_segment): Likewise.
404 (Sized_symbol::init_constant): Likewise.
405 (Symbol_table::do_define_in_output_data): Likewise.
406 (Symbol_table::do_define_in_output_segment): Likewise.
407 (Symbol_table::do_define_as_constant): Likewise.
408 * symtab.h (Symbol::is_predefined): New function.
409 (Symbol::init_base_output_data): Add is_predefined parameter.
410 (Symbol::init_base_output_segment): Likewise.
411 (Symbol::init_base_constant): Likewise.
412 (Symbol::is_predefined_): New data member.
413 (Sized_symbol::init_output_data): Add is_predefined parameter.
414 (Sized_symbol::init_output_segment): Likewise.
415 (Sized_symbol::init_constant): Likewise.
416 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
417
418 2011-06-07 Cary Coutant <ccoutant@google.com>
419
420 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
421 instead of emit_copy_reloc.
422 (Copy_relocs::emit_copy_reloc): Refactor.
423 (Copy_relocs::make_copy_reloc): New function.
424 (Copy_relocs::add_copy_reloc): Remove.
425 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
426 section.
427 (Copy_relocs::make_copy_reloc): New function.
428 (Copy_relocs::add_copy_reloc): Remove.
429 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
430 unchanged input files.
431 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
432 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
433 Reserve BSS space for COPY relocations.
434 (Sized_incremental_binary::do_emit_copy_relocs): New function.
435 (Output_section_incremental_inputs::write_info_blocks): Record
436 whether a symbol is copied from a shared object.
437 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
438 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
439 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
440 (Incremental_input_entry_reader::get_output_symbol_index): Add
441 is_copy parameter.
442 (Incremental_binary::emit_copy_relocs): New function.
443 (Incremental_binary::do_emit_copy_relocs): New function.
444 (Sized_incremental_binary::Sized_incremental_binary): Initialize
445 new data member.
446 (Sized_incremental_binary::add_copy_reloc): New function.
447 (Sized_incremental_binary::do_emit_copy_relocs): New function.
448 (Sized_incremental_binary::Copy_reloc): New struct.
449 (Sized_incremental_binary::Copy_relocs): New typedef.
450 (Sized_incremental_binary::copy_relocs_): New data member.
451 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
452 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
453 * target.h (Sized_target::emit_copy_reloc): New function.
454 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
455
456 2011-06-02 Cary Coutant <ccoutant@google.com>
457
458 PR gold/12163
459 * gold/archive.cc (Archive::Archive): Initialize new data member.
460 (Archive::include_all_members): Return if archive has already been
461 included.
462 * gold/archive.h (Archive::include_all_members_): New data member.
463
464 2011-06-02 Nick Clifton <nickc@redhat.com>
465
466 * dynobj.h: Fix spelling mistake in comment.
467 * output.cc: Likewise.
468
469 2011-05-31 Doug Kwan <dougkwan@google.com>
470 Asier Llano
471
472 PR gold/12826
473 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
474 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
475 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
476 redundant arm_exidx_test.so.
477 * testsuite/Makefile.in: Regenerate.
478 (check_SCRIPTS): Add pr12826.sh
479 (check_DATA): Add pr12826.stdout
480 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
481 * testsuite/pr12826.sh: New file.
482 * testsuite/pr12826_1.s: Ditto.
483 * testsuite/pr12826_1.s: Ditto.
484
485 2011-05-30 Ian Lance Taylor <iant@google.com>
486
487 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
488 sections.
489
490 2011-05-29 Ian Lance Taylor <iant@google.com>
491
492 PR gold/12804
493 * testsuite/Makefile.am: Use different file name for two_file_test
494 temporary file for each incremental test.
495 * testsuite/Makefile.in: Rebuild.
496
497 2011-05-29 Ian Lance Taylor <iant@google.com>
498
499 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
500 binary input file is empty.
501
502 2011-05-27 Ian Lance Taylor <iant@google.com>
503
504 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
505 (ver_test_9.so): Likewise.
506 * testsuite/Makefile.in: Rebuild.
507
508 2011-05-26 Cary Coutant <ccoutant@google.com>
509
510 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
511 * incremental.cc (Incremental_inputs::report_input_section): Fix
512 comment, indentation.
513 (Incremental_inputs::report_comdat_group): New function.
514 (Output_section_incremental_inputs::set_final_data_size): Adjust size
515 of data for incremental input file entry.
516 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
517 group count, COMDAT group signatures.
518 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
519 an unchanged input file.
520 * incremental.h (Incremental_object_entry::Incremental_object_entry):
521 Initialize new data member.
522 (Incremental_object_entry::add_comdat_group): New function.
523 (Incremental_object_entry::get_comdat_group_count): New function.
524 (Incremental_object_entry::get_comdat_signature_key): New function.
525 (Incremental_object_entry::groups_): New data member.
526 (Incremental_inputs::report_comdat_group): New function.
527 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
528 data for incremental input file entry.
529 (Incremental_input_entry_reader::get_comdat_group_count): New function.
530 (Incremental_input_entry_reader::get_input_section): Adjust size of
531 data for incremental input file entry.
532 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
533 (Incremental_input_entry_reader::get_comdat_group_signature): New
534 function.
535 * object.cc (Sized_relobj::include_section_group): Report kept
536 COMDAT groups for incremental links.
537
538 2011-05-24 David Meyer <pdox@google.com>
539
540 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
541 with name parameter. Add found_name parameter.
542 * fileread.cc (Input_file::find_file): Adjust code accordingly.
543 * dirsearch.h (class Dirsearch): Update declaration.
544
545 2011-05-24 Ian Lance Taylor <iant@google.com>
546
547 * archive.cc (Library_base::should_include_member): Pull in object
548 from archive if it defines the entry symbol.
549 * parameters.cc (Parameters::entry): New function.
550 * parameters.h (class Parameters): Declare entry.
551 * output.h (class Output_file_header): Remove entry_ field.
552 * output.cc (Output_file_header::Output_file_header): Remove entry
553 parameter. Change all callers.
554 (Output_file_header::entry): Use parameters->entry.
555 * gold.cc (queue_middle_tasks): Likewise.
556 * plugin.cc (Plugin_hook::run): Likewise.
557
558 2011-05-24 Cary Coutant <ccoutant@google.com>
559
560 * gold.cc (queue_initial_tasks): Pass incremental base filename
561 to Output_file::open_base_file; don't print error message.
562 * incremental-dump.cc (main): Adjust call to
563 Output_file::open_for_modification.
564 * incremental-dump.cc (main): Likewise.
565 * incremental.cc (Incremental_inputs::report_command_line):
566 Ignore --incremental-base option when comparing command lines.
567 Ignore parameter when given as separate argument.
568 * options.h (class General_options): Add --incremental-base.
569 * output.cc (Output_file::Output_file):
570 (Output_file::open_base_file): Add base_name and writable parameters;
571 read base file into new file; print error message here.
572 (Output_file::map_no_anonymous): Add writable parameter; adjust all
573 callers.
574 * output.h (Output_file::open_for_modification): Rename to...
575 (Output_file::open_base_file): ...this; add base_name and
576 writable parameters; adjust all callers.
577 (Output_file::map_no_anonymous): Add writable parameter; adjust all
578 callers.
579 * testsuite/Makefile.am (incremental_test_4): Test
580 --incremental-base.
581 * testsuite/Makefile.in: Regenerate.
582
583 2011-05-24 Cary Coutant <ccoutant@google.com>
584
585 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
586 incremental_test_4.
587 * testsuite/Makefile.in: Regenerate.
588 * testsuite/two_file_test_1_v1.cc: New test source file.
589 * testsuite/two_file_test_1b_v1.cc: New test source file.
590 * testsuite/two_file_test_2_v1.cc: New test source file.
591
592 2011-05-24 Cary Coutant <ccoutant@google.com>
593
594 * dynobj.h (Dynobj::do_dynobj): New function.
595 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
596 flag and soname for shared objects.
597 * incremental.cc (Incremental_inputs::report_object): Make
598 either Incremental_object_entry or Incremental_dynobj_entry; add
599 soname to string table.
600 (Incremental_inputs::report_input_section): Add assertion.
601 (Output_section_incremental_inputs::set_final_data_size): Adjust
602 type of input file entry for shared libraries; adjust size of
603 shared library info entry.
604 (Output_section_incremental_inputs::write_input_files): Write
605 as_needed flag for shared libraries.
606 (Output_section_incremental_inputs::write_info_blocks): Adjust type
607 of input file entry for shared libraries; write soname.
608 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
609 soname from incremental info.
610 * incremental.h (enum Incremental_input_flags): Add
611 INCREMENTAL_INPUT_AS_NEEDED.
612 (Incremental_input_entry::Incremental_input_entry): Initialize new
613 data member.
614 (Incremental_input_entry::set_as_needed): New function.
615 (Incremental_input_entry::as_needed): New function.
616 (Incremental_input_entry::do_dynobj_entry): New function.
617 (Incremental_input_entry::as_needed_): New data member.
618 (Incremental_object_entry::Incremental_object_entry): Don't check
619 for shared library.
620 (Incremental_object_entry::do_type): Likewise.
621 (class Incremental_dynobj_entry): New class.
622 (Incremental_input_entry_reader::as_needed): New function.
623 (Incremental_input_entry_reader::get_soname): New function.
624 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
625 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
626 size of shared library info entry.
627 * layout.cc (Layout::finish_dynamic_section): Don't test for
628 incremental link when adding DT_NEEDED entries.
629 * object.h (Object::Object): Initialize new data member.
630 (Object::dynobj): New function.
631 (Object::set_as_needed): New function.
632 (Object::as_needed): New function.
633 (Object::do_dynobj): New function.
634 (Object::as_needed_): New data member.
635
636 2011-05-24 Cary Coutant <ccoutant@google.com>
637
638 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
639 info; adjust display of GOT entries.
640 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
641 vector of input objects; remove file_status_.
642 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
643 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
644 got_plt reader; call target hooks to reserve GOT entries.
645 (Output_section_incremental_inputs::set_final_data_size): Adjust size
646 of input file info header and GOT info entry.
647 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
648 relocation info.
649 (Got_plt_view_info::got_descriptor): Remove.
650 (Got_plt_view_info::sym_index): New data member.
651 (Got_plt_view_info::input_index): New data member.
652 (Local_got_offset_visitor::visit): Write input file index.
653 (Global_got_offset_visitor::visit): Write 0 for input file index.
654 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
655 with sym_index and input_index.
656 (Output_section_incremental_inputs::write_got_plt): Adjust size of
657 incremental info GOT entry; replace got_descriptor with input_index.
658 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
659 map from input file index to object.
660 (Sized_relobj_incr::do_layout): Replace direct data member reference
661 with accessor function.
662 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
663 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
664 Adjust size of input file info header.
665 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
666 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
667 (Incremental_input_entry_reader::get_input_section): Adjust size of
668 input file info header.
669 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
670 of incremental info GOT entry.
671 (Incremental_got_plt_reader::get_got_desc): Remove.
672 (Incremental_got_plt_reader::get_got_symndx): New function.
673 (Incremental_got_plt_reader::get_got_input_index): New function.
674 (Sized_incremental_binary::Sized_incremental_binary): Remove
675 file_status_; add input_objects_.
676 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
677 (Sized_incremental_binary::set_file_is_unchanged): Remove.
678 (Sized_incremental_binary::file_is_unchanged): Remove.
679 (Sized_incremental_binary::set_input_object): New function.
680 (Sized_incremental_binary::input_object): New function.
681 (Sized_incremental_binary::file_status_): Remove.
682 (Sized_incremental_binary::input_objects_): New data member.
683 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
684 references.
685 (Sized_relobj_incr::invalid_address): Move to base class.
686 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
687 class.
688 (Sized_relobj_incr::do_output_section_offset): Likewise.
689 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
690 (Sized_relobj_incr::section_offsets_): Likewise.
691 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
692 function.
693 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
694 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
695 with accessor function.
696 (Sized_relobj_file::do_layout): Likewise.
697 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
698 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
699 (Sized_relobj_file::compute_final_local_value): Replace refs to
700 section_offsets_ with accessor function.
701 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
702 * object.h (Relobj::Relobj): Initialize new data members.
703 (Relobj::add_dyn_reloc): New function.
704 (Relobj::first_dyn_reloc): New function.
705 (Relobj::dyn_reloc_count): New function.
706 (Relobj::first_dyn_reloc_): New data member.
707 (Relobj::dyn_reloc_count_): New data member.
708 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
709 references.
710 (Sized_relobj::Address): New typedef.
711 (Sized_relobj::invalid_address): Move here from child class.
712 (Sized_relobj::Sized_relobj): Initialize new data members.
713 (Sized_relobj::sized_relobj): New function.
714 (Sized_relobj::is_output_section_offset_invalid): Move here from
715 child class.
716 (Sized_relobj::get_output_section_offset): Likewise.
717 (Sized_relobj::local_has_got_offset): Likewise.
718 (Sized_relobj::local_got_offset): Likewise.
719 (Sized_relobj::set_local_got_offset): Likewise.
720 (Sized_relobj::do_for_all_local_got_entries): Likewise.
721 (Sized_relobj::clear_got_offsets): New function.
722 (Sized_relobj::section_offsets): Move here from child class.
723 (Sized_relobj::do_output_section_offset): Likewise.
724 (Sized_relobj::do_set_section_offset): Likewise.
725 (Sized_relobj::Local_got_offsets): Likewise.
726 (Sized_relobj::local_got_offsets_): Likewise.
727 (Sized_relobj::section_offsets_): Likewise.
728 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
729 references.
730 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
731 class.
732 (Sized_relobj_file::sized_relobj): New function
733 (Sized_relobj_file::local_has_got_offset): Move to base class.
734 (Sized_relobj_file::local_got_offset): Likewise.
735 (Sized_relobj_file::set_local_got_offset): Likewise.
736 (Sized_relobj_file::get_output_section_offset): Likewise.
737 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
738 (Sized_relobj_file::do_output_section_offset): Likewise.
739 (Sized_relobj_file::do_set_section_offset): Likewise.
740 (Sized_relobj_file::Local_got_offsets): Likewise.
741 (Sized_relobj_file::local_got_offsets_): Likewise.
742 (Sized_relobj_file::section_offsets_): Likewise.
743 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
744 (all constructors).
745 (set_needs_dynsym_index): Convert relobj to derived class pointer.
746 (Output_reloc::get_symbol_index): Likewise.
747 (Output_reloc::local_section_offset): Likewise.
748 (Output_reloc::get_address): Likewise.
749 (Output_reloc::symbol_value): Likewise.
750 (Output_data_got::reserve_slot): Move to class definition.
751 (Output_data_got::reserve_local): New function.
752 (Output_data_got::reserve_slot_for_global): Remove.
753 (Output_data_got::reserve_global): New function.
754 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
755 (all constructors, two instantiations).
756 (Output_reloc::get_relobj): New function (two instantiations).
757 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
758 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
759 (Output_data_reloc::add_global): Adjust type of relobj.
760 (Output_data_reloc::add_global_relative): Likewise.
761 (Output_data_reloc::add_symbolless_global_addend): Likewise.
762 (Output_data_reloc::add_local): Likewise.
763 (Output_data_reloc::add_local_relative): Likewise.
764 (Output_data_reloc::add_symbolless_local_addend): Likewise.
765 (Output_data_reloc::add_local_section): Likewise.
766 (Output_data_reloc::add_output_section): Likewise.
767 (Output_data_reloc::add_absolute): Likewise.
768 (Output_data_reloc::add_target_specific): Likewise.
769 (Output_data_got::reserve_slot): Move definition here.
770 (Output_data_got::reserve_local): New function.
771 (Output_data_got::reserve_global): New function.
772 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
773 section_offsets_ with accessor function.
774 (Sized_relobj_file::write_sections): Likewise.
775 (Sized_relobj_file::do_relocate_sections): Likewise.
776 * target.h (Sized_target::reserve_local_got_entry): New function.
777 (Sized_target::reserve_global_got_entry): New function.
778 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
779 (Target_x86_64::reserve_global_got_entry): New function.
780 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
781
782 2011-05-23 Cary Coutant <ccoutant@google.com>
783
784 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
785 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
786 bit when checking got_type.
787 * incremental.cc (Sized_incremental_binary::setup_readers):
788 Store symbol table and string table locations; initialize bit vector
789 of file status flags.
790 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
791 unchanged files.
792 (Sized_incremental_binary::do_process_got_plt): New function.
793 (Sized_incremental_binary::get_symtab_view): Use stored locations.
794 (Output_section_incremental_inputs::set_final_data_size): Record
795 file index for each input file.
796 (Output_section_incremental_inputs::write_got_plt): Store file index
797 instead of input entry offset for each GOT entry.
798 * incremental.h
799 (Incremental_input_entry::Incremental_input_entry): Initialize new
800 data member.
801 (Incremental_input_entry::set_offset): Store file index.
802 (Incremental_input_entry::get_file_index): New function.
803 (Incremental_input_entry::file_index_): New data member.
804 (Incremental_binary::process_got_plt): New function.
805 (Incremental_binary::do_process_got_plt): New function.
806 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
807 data members.
808 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
809 (Sized_incremental_binary::set_file_is_unchanged): New function.
810 (Sized_incremental_binary::file_is_unchanged): New function.
811 (Sized_incremental_binary::do_process_got_plt): New function.
812 (Sized_incremental_binary::file_status_): New data member.
813 (Sized_incremental_binary::main_symtab_loc_): New data member.
814 (Sized_incremental_binary::main_strtab_loc_): New data member.
815 * output.cc (Output_data_got::Got_entry::write): Add case
816 RESERVED_CODE.
817 (Output_data_got::add_global): Call add_got_entry.
818 (Output_data_got::add_global_plt): Likewise.
819 (Output_data_got::add_global_with_rel): Likewise.
820 (Output_data_got::add_global_with_rela): Likewise.
821 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
822 (Output_data_got::add_global_pair_with_rela): Likewise.
823 (Output_data_got::add_local): Call add_got_entry.
824 (Output_data_got::add_local_plt): Likewise.
825 (Output_data_got::add_local_with_rel): Likewise.
826 (Output_data_got::add_local_with_rela): Likewise.
827 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
828 (Output_data_got::add_local_pair_with_rela): Likewise.
829 (Output_data_got::reserve_slot): New function.
830 (Output_data_got::reserve_slot_for_global): New function.
831 (Output_data_got::add_got_entry): New function.
832 (Output_data_got::add_got_entry_pair): New function.
833 (Output_section::add_output_section_data): Edit FIXME.
834 * output.h
835 (Output_section_data_build::Output_section_data_build): New
836 constructor with size parameter.
837 (Output_data_space::Output_data_space): Likewise.
838 (Output_data_got::Output_data_got): Initialize new data member; new
839 constructor with size parameter.
840 (Output_data_got::add_constant): Call add_got_entry.
841 (Output_data_got::reserve_slot): New function.
842 (Output_data_got::reserve_slot_for_global): New function.
843 (class Output_data_got::Got_entry): Add RESERVED_CODE.
844 (Output_data_got::add_got_entry): New function.
845 (Output_data_got::add_got_entry_pair): New function.
846 (Output_data_got::free_list_): New data member.
847 * target.h (Sized_target::init_got_plt_for_update): New function.
848 (Sized_target::register_global_plt_entry): New function.
849 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
850 Initialize new data member; call init; add constructor with PLT count.
851 (Output_data_plt_x86_64::init): New function.
852 (Output_data_plt_x86_64::add_relocation): New function.
853 (Output_data_plt_x86_64::reserve_slot): New function.
854 (Output_data_plt_x86_64::free_list_): New data member.
855 (Target_x86_64::init_got_plt_for_update): New function.
856 (Target_x86_64::register_global_plt_entry): New function.
857 (Output_data_plt_x86_64::add_entry): Allocate from free list for
858 incremental updates.
859 (Output_data_plt_x86_64::add_relocation): New function.
860 * testsuite/object_unittest.cc (Object_test): Set default options.
861
862 2011-05-16 Ian Lance Taylor <iant@google.com>
863
864 * options.h (class General_options): Make -i a synonym for -r.
865
866 2011-05-16 Ian Lance Taylor <iant@google.com>
867
868 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
869
870 2011-05-10 Cary Coutant <ccoutant@google.com>
871
872 * object.cc (Sized_relobj::do_count_local_symbols): Check for
873 strip_all (-s).
874
875 2011-05-06 Ian Lance Taylor <iant@google.com>
876
877 * layout.cc (Layout::layout): If the output section flags change,
878 update the ordering.
879
880 2011-04-25 Cary Coutant <ccoutant@google.com>
881
882 * incremental-dump.cc (dump_incremental_inputs): Print local
883 symbol info for each input file.
884 * incremental.cc
885 (Output_section_incremental_inputs::set_final_data_size): Add local
886 symbol info to input file entries in incremental info.
887 (Output_section_incremental_inputs::write_info_blocks): Likewise.
888 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
889 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
890 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
891 implementation.
892 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
893 (Sized_incr_relobj::do_relocate): Write the local symbols.
894 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
895 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
896 Adjust size of input file header.
897 (Incremental_inputs_reader::get_local_symbol_offset): New function.
898 (Incremental_inputs_reader::get_local_symbol_count): New function.
899 (Incremental_inputs_reader::get_input_section): Adjust size of input
900 file header.
901 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
902 (Sized_incr_relobj::This): New typedef.
903 (Sized_incr_relobj::sym_size): New const data member.
904 (Sized_incr_relobj::Local_symbol): New struct.
905 (Sized_incr_relobj::do_output_local_symbol_count): New function.
906 (Sized_incr_relobj::do_local_symbol_offset): New function.
907 (Sized_incr_relobj::local_symbol_count_): New data member.
908 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
909 (Sized_incr_relobj::local_symbol_index_): New data member.
910 (Sized_incr_relobj::local_symbol_offset_): New data member.
911 (Sized_incr_relobj::local_dynsym_offset_): New data member.
912 (Sized_incr_relobj::local_symbols_): New data member.
913 * object.h (Relobj::output_local_symbol_count): New function.
914 (Relobj::local_symbol_offset): New function.
915 (Relobj::do_output_local_symbol_count): New function.
916 (Relobj::do_local_symbol_offset): New function.
917 (Sized_relobj::do_output_local_symbol_count): New function.
918 (Sized_relobj::do_local_symbol_offset): New function.
919
920 2011-04-22 Vladimir Simonov <sv@sw.ru>
921
922 * descriptors.cc (set_close_on_exec): New function.
923 (Descriptors::open): Use set_close_on_exec.
924 * output.cc (S_ISLNK): Define if not defined.
925
926 2011-04-22 Cary Coutant <ccoutant@google.com>
927
928 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
929 global symbol map.
930 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
931 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
932 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
933 relocations.
934 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
935 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
936 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
937 * incremental.h
938 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
939 function.
940 (Incremental_binary::apply_incremental_relocs): New function.
941 (Incremental_binary::do_apply_incremental_relocs): New function.
942 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
943 data member.
944 (Sized_incremental_binary::add_global_symbol): New function.
945 (Sized_incremental_binary::global_symbol): New function.
946 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
947 (Sized_incremental_binary::symbol_map_): New data member.
948 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
949 * target.h (Sized_target::apply_relocation): New function.
950 * target-reloc.h (apply_relocation): New function.
951 * x86_64.cc (Target_x86_64::apply_relocation): New function.
952
953 2011-04-22 Doug Kwan <dougkwan@google.com>
954
955 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
956 flag of a SHT_ARM_EXIDX section.
957 * testsuite/Makefile.am (arm_exidx_test): New test rules.
958 * testsuite/Makefile.in: Regenerate.
959 * testsuite/arm_exidx_test.s: New file.
960 * testsuite/arm_exidx_test.sh: Same.
961
962 2011-04-20 Cary Coutant <ccoutant@google.com>
963
964 PR gold/12689
965 * archive.h (Incremental_archive_entry::Archive_member):
966 Initialize arg_serial_ (second constructor).
967
968 2011-04-17 Ian Lance Taylor <iant@google.com>
969
970 * object.cc (Relocate_info::location): Simplify location string.
971 * errors.cc (Errors::error_at_location): Don't print program
972 name.
973 (Errors::warning_at_location): Likewise.
974 (Errors::undefined_symbol): Likewise.
975 * testsuite/debug_msg.sh: Update accordingly.
976
977 2011-04-14 Cary Coutant <ccoutant@google.com>
978
979 * gold/layout.cc (Layout::symtab_section_offset): New function.
980 * gold/layout.h (Layout::symtab_section_offset): New function.
981 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
982
983 2011-04-12 Ian Lance Taylor <iant@google.com>
984
985 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
986 with MREMAP_MAYMOVE.
987 * output.h (class Output_file): Add map_is_allocated_ field.
988 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
989 not available, provide stubs. If mremap is not available, #define
990 it to gold_mremap.
991 (MREMAP_MAYMOVE): Define if not defined.
992 (Output_file::Output_file): Initialize map_is_allocated_.
993 (Output_file::resize): Check map_is_allocated_.
994 (Output_file::map_anonymous): If mmap fails, use malloc.
995 (Output_file::unmap): Don't do anything for an anonymous map.
996 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
997 is not available, provide stubs.
998 (File_read::View::~View): Use free rather than delete[].
999 (File_read::make_view): Use malloc rather than new[]. If mmap
1000 fails, use malloc.
1001 (File_read::find_or_make_view): Use malloc rather than new[].
1002 * gold.h: Remove HAVE_REMAP code.
1003 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
1004 exists. Rename mremap to gold_mremap. If mmap is not available
1005 don't do anything.
1006 * configure, config.in: Rebuild.
1007
1008 2011-04-11 Ian Lance Taylor <iant@google.com>
1009
1010 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
1011 initialize local variable v.
1012
1013 2011-04-11 Cary Coutant <ccoutant@google.com>
1014
1015 * archive.cc (Archive::include_member): Adjust call to
1016 report_object.
1017 (Add_archive_symbols::run): Track argument serial numbers.
1018 (Lib_group::include_member): Likewise.
1019 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
1020 * archive.h (Incremental_archive_entry::Archive_member):
1021 Initialize arg_serial_.
1022 (Archive_member::arg_serial_): New data member.
1023 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
1024 (Sized_dynobj::do_add_symbols): Track symbols when doing an
1025 incremental link.
1026 (Sized_dynobj::do_for_all_local_got_entries): New function.
1027 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
1028 function.
1029 * fileread.cc (get_mtime): New function.
1030 * fileread.h (get_mtime): New function.
1031 * gold.cc (queue_initial_tasks): Check for incremental update.
1032 (process_incremental_input): New function.
1033 (queue_middle_tasks): Don't force valid target for incremental
1034 update.
1035 * incremental-dump.cc (find_input_containing_global): Adjust
1036 size of symbol info entry.
1037 (dump_incremental_inputs): Dump argument serial number and
1038 in_system_directory flag; bias shndx by 1; print symbol names
1039 when dumping per-file symbol lists; use new symbol info readers.
1040 * incremental.cc
1041 (Output_section_incremental_inputs:update_data_size): New function.
1042 (Sized_incremental_binary::setup_readers): Setup input readers
1043 for each input file; build maps for files added from libraries
1044 and scripts.
1045 (Sized_incremental_binary::check_input_args): New function.
1046 (Sized_incremental_binary::do_check_inputs): Build map of argument
1047 serial numbers to input arguments.
1048 (Sized_incremental_binary::do_file_has_changed): Rename
1049 do_file_is_unchanged to this; compare file modification times.
1050 (Sized_incremental_binary::do_init_layout): New function.
1051 (Sized_incremental_binary::do_reserve_layout): New function.
1052 (Sized_incremental_binary::do_get_input_reader): Remove.
1053 (Sized_incremental_binary::get_symtab_view): New function.
1054 (Incremental_checker::can_incrementally_link_output_file): Remove.
1055 (Incremental_inputs::report_command_line): Exclude --debug options.
1056 (Incremental_inputs::report_archive_begin): Add parameter; track
1057 argument serial numbers; don't put input file entry for archive
1058 before archive members.
1059 (Incremental_inputs::report_archive_end): Put input file entry
1060 for archive after archive members.
1061 (Incremental_inputs::report_object): Add parameter; track argument
1062 serial numbers and in_system_directory flag.
1063 (Incremental_inputs::report_script): Add parameter; track argument
1064 serial numbers.
1065 (Output_section_incremental_inputs::set_final_data_size): Adjust
1066 size of symbol info entry; check for forwarding symbols.
1067 (Output_section_incremental_inputs::write_input_files): Write
1068 in_system_directory flag and argument serial number.
1069 (Output_section_incremental_inputs::write_info_blocks): Map section
1070 indices between incremental info and original input file; store
1071 input section index for each symbol.
1072 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
1073 change operator() to visit().
1074 (class Global_got_offset_visitor): Likewise.
1075 (class Global_symbol_visitor_got_plt):
1076 (Output_section_incremental_inputs::write_got_plt): Use new visitor
1077 classes.
1078 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
1079 (Sized_incr_relobj::do_read_symbols): New function.
1080 (Sized_incr_relobj::do_layout): New function.
1081 (Sized_incr_relobj::do_layout_deferred_sections): New function.
1082 (Sized_incr_relobj::do_add_symbols): New function.
1083 (Sized_incr_relobj::do_should_include_member): New function.
1084 (Sized_incr_relobj::do_for_all_global_symbols): New function.
1085 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
1086 (Sized_incr_relobj::do_section_size): New function.
1087 (Sized_incr_relobj::do_section_name): New function.
1088 (Sized_incr_relobj::do_section_contents): New function.
1089 (Sized_incr_relobj::do_section_flags): New function.
1090 (Sized_incr_relobj::do_section_entsize): New function.
1091 (Sized_incr_relobj::do_section_address): New function.
1092 (Sized_incr_relobj::do_section_type): New function.
1093 (Sized_incr_relobj::do_section_link): New function.
1094 (Sized_incr_relobj::do_section_info): New function.
1095 (Sized_incr_relobj::do_section_addralign): New function.
1096 (Sized_incr_relobj::do_initialize_xindex): New function.
1097 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
1098 (Sized_incr_relobj::do_read_relocs): New function.
1099 (Sized_incr_relobj::do_gc_process_relocs): New function.
1100 (Sized_incr_relobj::do_scan_relocs): New function.
1101 (Sized_incr_relobj::do_count_local_symbols): New function.
1102 (Sized_incr_relobj::do_finalize_local_symbols): New function.
1103 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
1104 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
1105 (Sized_incr_relobj::do_relocate): New function.
1106 (Sized_incr_relobj::do_set_section_offset): New function.
1107 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
1108 (Sized_incr_dynobj::do_read_symbols): New function.
1109 (Sized_incr_dynobj::do_layout): New function.
1110 (Sized_incr_dynobj::do_add_symbols): New function.
1111 (Sized_incr_dynobj::do_should_include_member): New function.
1112 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
1113 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
1114 (Sized_incr_dynobj::do_section_size): New function.
1115 (Sized_incr_dynobj::do_section_name): New function.
1116 (Sized_incr_dynobj::do_section_contents): New function.
1117 (Sized_incr_dynobj::do_section_flags): New function.
1118 (Sized_incr_dynobj::do_section_entsize): New function.
1119 (Sized_incr_dynobj::do_section_address): New function.
1120 (Sized_incr_dynobj::do_section_type): New function.
1121 (Sized_incr_dynobj::do_section_link): New function.
1122 (Sized_incr_dynobj::do_section_info): New function.
1123 (Sized_incr_dynobj::do_section_addralign): New function.
1124 (Sized_incr_dynobj::do_initialize_xindex): New function.
1125 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
1126 (make_sized_incremental_object): New function.
1127 (Incremental_library::copy_unused_symbols): New function.
1128 (Incremental_library::do_for_all_unused_symbols): New function.
1129 * incremental.h (enum Incremental_input_flags): New type.
1130 (class Incremental_checker): Remove.
1131 (Incremental_input_entry::Incremental_input_entry): Add argument
1132 serial number.
1133 (Incremental_input_entry::arg_serial): New function.
1134 (Incremental_input_entry::set_is_in_system_directory): New function.
1135 (Incremental_input_entry::is_in_system_directory): New function.
1136 (Incremental_input_entry::arg_serial_): New data member.
1137 (Incremental_input_entry::is_in_system_directory_): New data member.
1138 (class Script_info): Move here from script.h.
1139 (Script_info::Script_info): Add filename parameter.
1140 (Script_info::filename): New function.
1141 (Script_info::filename_): New data member.
1142 (Incremental_script_entry::Incremental_script_entry): Add argument
1143 serial number.
1144 (Incremental_object_entry::Incremental_object_entry): Likewise.
1145 (Incremental_object_entry::add_input_section): Build list of input
1146 sections with map to original shndx.
1147 (Incremental_object_entry::get_input_section_index): New function.
1148 (Incremental_object_entry::shndx_): New data member.
1149 (Incremental_object_entry::name_key_): Rename; adjust all refs.
1150 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
1151 (Incremental_archive_entry::Incremental_archive_entry): Add argument
1152 serial number.
1153 (Incremental_inputs::report_archive_begin): Likewise.
1154 (Incremental_inputs::report_object): Likewise.
1155 (Incremental_inputs::report_script): Likewise.
1156 (class Incremental_global_symbol_reader): New class.
1157 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
1158 and store flags and input file type.
1159 (Incremental_input_entry_reader::arg_serial): New function.
1160 (Incremental_input_entry_reader::type): Extract type from flags.
1161 (Incremental_input_entry_reader::is_in_system_directory): New function.
1162 (Incremental_input_entry_reader::get_input_section_count): Call
1163 accessor function for type.
1164 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
1165 function for type; adjust size of global symbol entry.
1166 (Incremental_input_entry_reader::get_global_symbol_count): Call
1167 accessor function for type.
1168 (Incremental_input_entry_reader::get_object_count): Likewise.
1169 (Incremental_input_entry_reader::get_object_offset): Likewise.
1170 (Incremental_input_entry_reader::get_member_count): Likewise.
1171 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
1172 (Incremental_input_entry_reader::get_member_offset): Likewise.
1173 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
1174 (Incremental_input_entry_reader::Global_symbol_info): Remove.
1175 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
1176 (Incremental_input_entry_reader::get_global_symbol_reader): New
1177 function.
1178 (Incremental_input_entry_reader::get_output_symbol_index): New
1179 function.
1180 (Incremental_input_entry_reader::type_): Remove.
1181 (Incremental_input_entry_reader::flags_): New data member.
1182 (Incremental_inputs_reader::input_file_offset): New function.
1183 (Incremental_inputs_reader::input_file_index): New function.
1184 (Incremental_inputs_reader::input_file): Call input_file_offset.
1185 (Incremental_inputs_reader::input_file_at_offset): New function.
1186 (Incremental_relocs_reader::get_r_type): Reformat.
1187 (Incremental_relocs_reader::get_r_shndx): Reformat.
1188 (Incremental_relocs_reader::get_r_offset): Reformat.
1189 (Incremental_relocs_reader::data): New function.
1190 (Incremental_binary::Incremental_binary): Initialize new data members.
1191 (Incremental_binary::check_inputs): Add cmdline parameter.
1192 (Incremental_binary::file_is_unchanged): Remove.
1193 (Input_reader::arg_serial): New function.
1194 (Input_reader::get_unused_symbol_count): New function.
1195 (Input_reader::get_unused_symbol): New function.
1196 (Input_reader::do_arg_serial): New function.
1197 (Input_reader::do_get_unused_symbol_count): New function.
1198 (Input_reader::do_get_unused_symbol): New function.
1199 (Incremental_binary::input_file_count): New function.
1200 (Incremental_binary::get_input_reader): Change signature to use
1201 index instead of filename.
1202 (Incremental_binary::file_has_changed): New function.
1203 (Incremental_binary::get_input_argument): New function.
1204 (Incremental_binary::get_library): New function.
1205 (Incremental_binary::get_script_info): New function.
1206 (Incremental_binary::init_layout): New function.
1207 (Incremental_binary::reserve_layout): New function.
1208 (Incremental_binary::output_file): New function.
1209 (Incremental_binary::do_check_inputs): New function.
1210 (Incremental_binary::do_file_is_unchanged): Remove.
1211 (Incremental_binary::do_file_has_changed): New function.
1212 (Incremental_binary::do_init_layout): New function.
1213 (Incremental_binary::do_reserve_layout): New function.
1214 (Incremental_binary::do_input_file_count): New function.
1215 (Incremental_binary::do_get_input_reader): Change signature.
1216 (Incremental_binary::input_args_map_): New data member.
1217 (Incremental_binary::library_map_): New data member.
1218 (Incremental_binary::script_map_): New data member.
1219 (Sized_incremental_binary::Sized_incremental_binary): Initialize
1220 new data members.
1221 (Sized_incremental_binary::output_section): New function.
1222 (Sized_incremental_binary::inputs_reader): Add const.
1223 (Sized_incremental_binary::symtab_reader): Add const.
1224 (Sized_incremental_binary::relocs_reader): Add const.
1225 (Sized_incremental_binary::got_plt_reader): Add const.
1226 (Sized_incremental_binary::get_symtab_view): New function.
1227 (Sized_incremental_binary::Inputs_reader): New typedef.
1228 (Sized_incremental_binary::Input_entry_reader): New typedef.
1229 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
1230 (Sized_incremental_binary::do_file_is_unchanged): Remove.
1231 (Sized_incremental_binary::do_file_has_changed): New function.
1232 (Sized_incremental_binary::do_init_layout): New function.
1233 (Sized_incremental_binary::do_reserve_layout): New function.
1234 (Sized_input_reader::Inputs_reader): Remove.
1235 (Sized_input_reader::Input_entry_reader): Remove.
1236 (Sized_input_reader::do_arg_serial): New function.
1237 (Sized_input_reader::do_get_unused_symbol_count): New function.
1238 (Sized_input_reader::do_get_unused_symbol): New function.
1239 (Sized_incremental_binary::do_input_file_count): New function.
1240 (Sized_incremental_binary::do_get_input_reader): Change signature;
1241 use index instead of filename.
1242 (Sized_incremental_binary::section_map_): New data member.
1243 (Sized_incremental_binary::input_entry_readers_): New data member.
1244 (class Sized_incr_relobj): New class.
1245 (class Sized_incr_dynobj): New class.
1246 (make_sized_incremental_object): New function.
1247 (class Incremental_library): New class.
1248 * layout.cc (Free_list::num_lists): New static data member.
1249 (Free_list::num_nodes): New static data member.
1250 (Free_list::num_removes): New static data member.
1251 (Free_list::num_remove_visits): New static data member.
1252 (Free_list::num_allocates): New static data member.
1253 (Free_list::num_allocate_visits): New static data member.
1254 (Free_list::init): New function.
1255 (Free_list::remove): New function.
1256 (Free_list::allocate): New function.
1257 (Free_list::dump): New function.
1258 (Free_list::print_stats): New function.
1259 (Layout_task_runner::run): Resize output file for incremental updates.
1260 (Layout::Layout): Initialize new data members.
1261 (Layout::set_incremental_base): New function.
1262 (Layout::init_fixed_output_section): New function.
1263 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
1264 incremental updates.
1265 (Layout::create_gold_note): Do not create gold note section for
1266 incremental updates.
1267 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
1268 for incremental updates.
1269 (Layout::set_section_offsets): For incremental updates, allocate space
1270 from free list.
1271 (Layout::create_symtab_sections): Layout with offsets relative to
1272 start of section; for incremental updates, allocate space from free
1273 list.
1274 (Layout::create_shdrs): For incremental updates, allocate space from
1275 free list.
1276 (Layout::finish_dynamic_section): For incremental updates, do not
1277 check --as-needed (fixed in subsequent patch).
1278 * layout.h (class Free_list): New class.
1279 (Layout::set_incremental_base): New function.
1280 (Layout::incremental_base): New function.
1281 (Layout::init_fixed_output_section): New function.
1282 (Layout::allocate): New function.
1283 (Layout::incremental_base_): New data member.
1284 (Layout::free_list_): New data member.
1285 * main.cc (main): Print Free_list statistics.
1286 * object.cc (Relobj::finalize_incremental_relocs): Add
1287 clear_counts parameter; clear counts only when clear_counts is set.
1288 (Sized_relobj::Sized_relobj): Initialize new base class.
1289 (Sized_relobj::do_layout): Don't report special sections.
1290 (Sized_relobj::do_for_all_local_got_entries): New function.
1291 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
1292 symtab_off to all symbol table offsets.
1293 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
1294 * object.h (class Got_offset_list): Move to top of file.
1295 (Object::Object): Allow case where input_file == NULL.
1296 (Object::~Object): Likewise.
1297 (Object::input_file): Assert that input_file != NULL.
1298 (Object::lock): Allow case where input_file == NULL.
1299 (Object::unlock): Likewise.
1300 (Object::is_locked): Likewise.
1301 (Object::token): Likewise.
1302 (Object::release): Likewise.
1303 (Object::is_incremental): New function.
1304 (Object::get_mtime): New function.
1305 (Object::for_all_local_got_entries): New function.
1306 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
1307 (Object::set_is_in_system_directory): New function.
1308 (Object::is_in_system_directory): New function.
1309 (Object::do_is_incremental): New function.
1310 (Object::do_get_mtime): New function.
1311 (Object::do_for_all_local_got_entries): New function.
1312 (Object::is_in_system_directory_): New data member.
1313 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
1314 (class Sized_relobj_base): New class.
1315 (class Sized_relobj): Derive from Sized_relobj_base.
1316 (class Sized_relobj::Symbols): Redeclare from base class.
1317 (class Sized_relobj::local_got_offset_list): Remove.
1318 (class Sized_relobj::Output_sections): Redeclare from base class.
1319 (class Sized_relobj::do_for_all_local_got_entries): New function.
1320 (class Sized_relobj::write_local_symbols): Add offset parameter.
1321 (class Sized_relobj::local_symbol_offset_): Update comment.
1322 (class Sized_relobj::local_dynsym_offset_): Update comment.
1323 * options.cc (Input_arguments::add_file): Remove const.
1324 * options.h (Input_file_argument::Input_file_argument):
1325 Initialize arg_serial_ (all constructors).
1326 (Input_file_argument::set_arg_serial): New function.
1327 (Input_file_argument::arg_serial): New function.
1328 (Input_file_argument::arg_serial_): New data member.
1329 (Input_arguments::Input_arguments): Initialize file_count_.
1330 (Input_arguments::add_file): Remove const.
1331 (Input_arguments::number_of_input_files): New function.
1332 (Input_arguments::file_count_): New data member.
1333 (Command_line::number_of_input_files): Call
1334 Input_arguments::number_of_input_files.
1335 * output.cc (Output_segment_headers::Output_segment_headers):
1336 Set current size.
1337 (Output_section::Input_section::current_data_size): New function.
1338 (Output_section::Output_section): Initialize new data members.
1339 (Output_section::add_input_section): Don't do merge sections for
1340 an incremental link; allocate space from free list for an
1341 incremental update.
1342 (Output_section::add_output_section_data): Allocate space from
1343 free list for an incremental update.
1344 (Output_section::update_data_size): New function.
1345 (Output_section::set_fixed_layout): New function.
1346 (Output_section::reserve): New function.
1347 (Output_segment::set_section_addresses): Remove const.
1348 (Output_segment::set_section_list_addresses): Remove const; allocate
1349 space from free list for an incremental update.
1350 (Output_segment::set_offset): Adjust size of RELRO segment for an
1351 incremental update.
1352 * output.h (Output_data::current_data_size): Move here from
1353 child classes.
1354 (Output_data::pre_finalize_data_size): New function.
1355 (Output_data::update_data_size): New function.
1356 (Output_section_headers::update_data_size): new function.
1357 (Output_section_data_build::current_data_size): Move to Output_data.
1358 (Output_data_strtab::update_data_size): New function.
1359 (Output_section::current_data_size): Move to Output_data.
1360 (Output_section::set_fixed_layout): New function.
1361 (Output_section::has_fixed_layout): New function.
1362 (Output_section::reserve): New function.
1363 (Output_section::update_data_size): New function.
1364 (Output_section::has_fixed_layout_): New data member.
1365 (Output_section::free_list_): New data member.
1366 (Output_segment::set_section_addresses): Remove const.
1367 (Output_segment::set_section_list_addresses): Remove const.
1368 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
1369 New function.
1370 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
1371 New function.
1372 * readsyms.cc (Read_symbols::do_read_symbols): Add library
1373 parameter when calling Add_symbols constructor; store argument
1374 serial number for members of a lib group.
1375 (Add_symbols::locks): Allow case where token == NULL.
1376 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
1377 (Read_member::~Read_member): New function.
1378 (Read_member::is_runnable): New function.
1379 (Read_member::locks): New function.
1380 (Read_member::run): New function.
1381 (Check_script::~Check_script): New function.
1382 (Check_script::is_runnable): New function.
1383 (Check_script::locks): New function.
1384 (Check_script::run): New function.
1385 (Check_library::~Check_library): New function.
1386 (Check_library::is_runnable): New function.
1387 (Check_library::locks): New function.
1388 (Check_library::run): New function.
1389 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
1390 (Add_symbols::library_): New data member.
1391 (class Read_member): New class.
1392 (class Check_script): New class.
1393 (class Check_library): New class.
1394 * reloc.cc (Read_relocs::is_runnable): Allow case where
1395 token == NULL.
1396 (Read_relocs::locks): Likewise.
1397 (Scan_relocs::locks): Likewise.
1398 (Relocate_task::locks): Likewise.
1399 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
1400 to clear counters.
1401 (Sized_relobj::incremental_relocs_scan): Fix comment.
1402 (Sized_relobj::do_relocate): Pass output file offset to
1403 write_local_symbols.
1404 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
1405 from class declaration.
1406 * script.cc (read_input_script): Allocate Script_info; pass
1407 argument serial number to report_script.
1408 * script.h (class Script_info): Move to incremental.h.
1409 * symtab.cc (Symbol_table::add_from_incrobj): New function.
1410 * symtab.h (Symbol_table::add_from_incrobj): New function.
1411 (Symbol_table::set_file_offset): New function.
1412
1413 2011-04-05 Cary Coutant <ccoutant@google.com>
1414
1415 * incremental-dump.cc (dump_incremental_inputs): Change signature
1416 to take a Sized_incremental_binary; change caller. Use readers
1417 in Sized_incremental_binary.
1418 * incremental.cc
1419 (Sized_incremental_binary::find_incremental_inputs_sections):
1420 Rename do_find_incremental_inputs_sections to this.
1421 (Sized_incremental_binary::setup_readers): New function.
1422 (Sized_incremental_binary::do_check_inputs): Check
1423 has_incremental_info_ flag; move setup code to setup_readers;
1424 use input readers.
1425 (Sized_incremental_binary::do_file_is_unchanged): New function.
1426 (Sized_incremental_binary::do_get_input_reader): New function.
1427 * incremental.h (class Incremental_binary): Move to end of file.
1428 (Incremental_binary::file_is_unchanged): New function.
1429 (Incremental_binary::do_file_is_unchanged): New function.
1430 (Incremental_binary::Input_reader): New class.
1431 (Incremental_binary::get_input_reader): New function.
1432 (class Sized_incremental_binary): Move to end of file.
1433 (Sized_incremental_binary::Sized_incremental_binary): Setup the
1434 input section reader classes.
1435 (Sized_incremental_binary::has_incremental_info): New function.
1436 (Sized_incremental_binary::inputs_reader): New function.
1437 (Sized_incremental_binary::symtab_reader): New function.
1438 (Sized_incremental_binary::relocs_reader): New function.
1439 (Sized_incremental_binary::got_plt_reader): New function.
1440 (Sized_incremental_binary::do_file_is_unchanged): New function.
1441 (Sized_incremental_binary::Sized_input_reader): New class.
1442 (Sized_incremental_binary::get_input_reader): New function.
1443 (Sized_incremental_binary::find_incremental_inputs_sections):
1444 Rename do_find_incremental_inputs_sections to this.
1445 (Sized_incremental_binary::setup_readers): New function.
1446 (Sized_incremental_binary::has_incremental_info_): New data member.
1447 (Sized_incremental_binary::inputs_reader_): New data member.
1448 (Sized_incremental_binary::symtab_reader_): New data member.
1449 (Sized_incremental_binary::relocs_reader_): New data member.
1450 (Sized_incremental_binary::got_plt_reader_): New data member.
1451 (Sized_incremental_binary::current_input_file_): New data member.
1452
1453 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
1454
1455 PR gold/12640
1456 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
1457 violation.
1458
1459 2011-03-30 Cary Coutant <ccoutant@google.com>
1460
1461 * archive.cc (Archive::include_member): Adjust call to report_object.
1462 (Add_archive_symbols::run): Add script_info to call to
1463 report_archive_begin.
1464 (Lib_group::include_member): Adjust call to report_object.
1465 (Add_lib_group_symbols::run): Adjust call to report_object.
1466 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
1467 blocks. Add object count for script input files.
1468 * incremental.cc (Incremental_inputs::report_archive_begin): Add
1469 script_info parameter; change all callers.
1470 (Incremental_inputs::report_object): Add script_info parameter;
1471 change all callers.
1472 (Incremental_inputs::report_script): Store backpointer to
1473 incremental info entry.
1474 (Output_section_incremental_inputs::set_final_data_size): Record
1475 additional information for scripts.
1476 (Output_section_incremental_inputs::write_info_blocks): Likewise.
1477 * incremental.h (Incremental_script_entry::add_object): New function.
1478 (Incremental_script_entry::get_object_count): New function.
1479 (Incremental_script_entry::get_object): New function.
1480 (Incremental_script_entry::objects_): New data member; adjust
1481 constructor.
1482 (Incremental_inputs::report_archive_begin): Add script_info parameter.
1483 (Incremental_inputs::report_object): Add script_info parameter.
1484 (Incremental_inputs_reader::get_object_count): New function.
1485 (Incremental_inputs_reader::get_object_offset): New function.
1486 * options.cc (Input_arguments::add_file): Return reference to
1487 new input argument.
1488 * options.h (Input_argument::set_script_info): New function.
1489 (Input_argument::script_info): New function.
1490 (Input_argument::script_info_): New data member; adjust all
1491 constructors.
1492 (Input_file_group::add_file): Return reference to new input argument.
1493 (Input_file_lib::add_file): Likewise.
1494 (Input_arguments::add_file): Likewise.
1495 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
1496 * script.cc (Parser_closure::Parser_closure): Add script_info
1497 parameter; adjust all callers.
1498 (Parser_closure::script_info): New function.
1499 (Parser_closure::script_info_): New data member.
1500 (read_input_script): Report scripts earlier to incremental info.
1501 (script_add_file): Set script_info in Input_argument.
1502 (script_add_library): Likewise.
1503 * script.h (Script_options::Script_info): Rewrite class.
1504
1505 2011-03-29 Cary Coutant <ccoutant@google.com>
1506
1507 * archive.cc (Library_base::should_include_member): Move
1508 method here from class Archive.
1509 (Archive::Archive): Initialize base class.
1510 (Archive::should_include_member): Move to base class.
1511 (Archive::do_for_all_unused_symbols): New function.
1512 (Add_archive_symbols::run): Remove redundant access to
1513 incremental_inputs.
1514 (Lib_group::Lib_group): Initialize base class.
1515 (Lib_group::do_filename): New function.
1516 (Lib_group::include_member): Pass pointer to Lib_group to
1517 report_object.
1518 (Lib_group::do_for_all_unused_symbols): New function.
1519 (Add_lib_group_symbols::run): Report archive information for
1520 incremental links.
1521 * archive.h (class Library_base): New base class.
1522 (class Archive): Derive from Library_base.
1523 (Archive::filename): Move to base class.
1524 (Archive::set_incremental_info): Likewise.
1525 (Archive::incremental_info): Likewise.
1526 (Archive::Should_include): Likewise.
1527 (Archive::should_include_member): Likewise.
1528 (Archive::Armap_entry): Remove.
1529 (Archive::Unused_symbol_iterator): Remove.
1530 (Archive::unused_symbols_begin): Remove.
1531 (Archive::unused_symbols_end): Remove.
1532 (Archive::do_filename): New function.
1533 (Archive::do_get_mtime): New function.
1534 (Archive::do_for_all_unused_symbols): New function.
1535 (Archive::task_): Move to base class.
1536 (Archive::incremental_info_): Likewise.
1537 (class Lib_group): Derive from Library_base.
1538 (Lib_group::do_filename): New function.
1539 (Lib_group::do_get_mtime): New function.
1540 (Lib_group::do_for_all_unused_symbols): New function.
1541 (Lib_group::task_): Move to base class.
1542 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
1543 function.
1544 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
1545 function.
1546 * incremental.cc (Incremental_inputs::report_archive_begin):
1547 Use Library_base; call library's get_mtime; add incremental inputs
1548 entry before members.
1549 (class Unused_symbol_visitor): New class.
1550 (Incremental_inputs::report_archive_end): Use Library_base; use
1551 visitor class to record unused symbols; don't add incremental inputs
1552 entry after members.
1553 (Incremental_inputs::report_object): Use Library_base.
1554 * incremental.h
1555 (Incremental_archive_entry::Incremental_archive_entry): Remove
1556 unused Archive parameter.
1557 (Incremental_inputs::report_archive_begin): Use Library_base.
1558 (Incremental_inputs::report_archive_end): Likewise.
1559 (Incremental_inputs::report_object): Likewise.
1560 * object.cc (Sized_relobj::do_for_all_global_symbols): New
1561 function.
1562 * object.h (Object::for_all_global_symbols): New function.
1563 (Object::do_for_all_global_symbols): New function.
1564 (Sized_relobj::do_for_all_global_symbols): New function.
1565 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
1566 function.
1567 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
1568 function.
1569
1570 2011-03-27 Ian Lance Taylor <iant@google.com>
1571
1572 * archive.cc (Archive::interpret_header): Return -1 if something
1573 goes wrong. Change callers accordingly.
1574
1575 2011-03-25 Cary Coutant <ccoutant@google.com>
1576
1577 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
1578 * testsuite/Makefile.in: Regenerate.
1579
1580 2010-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
1581
1582 * plugin.cc (get_view): New.
1583 (Plugin::load): Pass get_view to the plugin.
1584 (Plugin_manager::get_view): New.
1585
1586 2011-03-21 Ian Lance Taylor <iant@google.com>
1587
1588 * testsuite/final_layout.sh: Rewrite to not use dc.
1589 * testsuite/relro_test.sh: Fail if dc is not present.
1590
1591 2011-03-21 Sriraman Tallam <tmsriram@google.com>
1592
1593 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
1594 Change == to -eq.
1595 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
1596 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
1597 Change == to -eq.
1598 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
1599 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
1600
1601 2011-03-14 Ian Lance Taylor <iant@google.com>
1602
1603 * script-sections.cc (Sort_output_sections::script_compare):
1604 Rename from is_before, change return type.
1605 (Sort_output_sections::operator()): Adjust accordingly.
1606
1607 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
1608
1609 PR gold/12572
1610 * testsuite/odr_violation2.cc: Add comment to make all error line
1611 numbers double digits.
1612 * testsuite/debug_msg.sh: Adjust expected errors.
1613
1614 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
1615
1616 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
1617 but mark earlier ones as non-canonical
1618 (offset_to_iterator): Update search target and example
1619 (do_addr2line): Return extra lines in a vector*
1620 (format_file_lineno): Extract from do_addr2line
1621 (one_addr2line): Add vector* out-param
1622 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
1623 when a lineno entry appeared last for its instruction
1624 (Dwarf_line_info): Add vector* out-param
1625 * object.cc (Relocate_info): Pass NULL for the vector* out-param
1626 * symtab.cc (Odr_violation_compare): Include the lineno in the
1627 comparison again.
1628 (linenos_from_loc): New. Combine the canonical line for an
1629 address with its other lines.
1630 (True_if_intersect): New. Helper functor to make
1631 std::set_intersection a query.
1632 (detect_odr_violations): Compare sets of lines instead of just
1633 one line for each function. This became less deterministic, but
1634 has fewer false positives.
1635 * symtab.h: Declarations.
1636 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
1637 mix an optimized and non-optimized object in the same binary
1638 (odr_violation2.so): Same.
1639 * testsuite/Makefile.in: Regenerate from Makefile.am.
1640 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
1641 * testsuite/debug_msg.sh: Update line numbers and add
1642 assertions.
1643 * testsuite/odr_violation1.cc: Use OdrDerived, in a
1644 non-optimized context.
1645 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
1646 isn't inlined, and use OdrDerived in an optimized context.
1647 * testsuite/odr_header1.h: Defines OdrDerived, where
1648 optimization will change the
1649 first-instruction-in-the-destructor's file and line number.
1650 * testsuite/odr_header2.h: Defines OdrBase.
1651
1652 2011-03-09 Ian Lance Taylor <iant@google.com>
1653
1654 * fileread.cc (File_read::clear_views): Don't delete the whole
1655 file view.
1656
1657 2011-03-08 Ian Lance Taylor <iant@google.com>
1658
1659 PR gold/12525
1660 * fileread.cc: #include <climits>.
1661 (GOLD_IOV_MAX): Define.
1662 (File_read::read_multiple): Limit number of entries by iov_max.
1663 * fileread.h (class File_read): Always set max_readv_entries to
1664 128.
1665
1666 2011-03-07 Ian Lance Taylor <iant@google.com>
1667
1668 PR gold/12525
1669 * options.h (class General_options): Add -dy and -dn.
1670
1671 2011-03-02 Cary Coutant <ccoutant@google.com>
1672
1673 * testsuite/script_test_9.t: Add TLS segment.
1674
1675 2011-03-02 Simon Baldwin <simonb@google.com>
1676
1677 * configure.ac: Add check for gnu_indirect_function support in
1678 the toolchain building binutils.
1679 * configure: Rebuild.
1680
1681 2010-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
1682
1683 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
1684 plugin only symbols.
1685 (Symbol_table::sized_finalize_symbol) Mark symbol only present
1686 in plugin files as not needed in the symbol table.
1687
1688 2011-02-11 Sriraman Tallam <tmsriram@google.com>
1689
1690 * output.cc (Output_section::add_input_section): Delay fill
1691 generation for section ordering.
1692
1693 2011-02-09 Ian Lance Taylor <iant@google.com>
1694
1695 PR gold/12316
1696 * object.h (class Sized_relobj): Remove clear_local_symbols.
1697 * reloc.cc (Sized_relobj::do_relocate): Don't call
1698 clear_local_symbols.
1699
1700 2010-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
1701
1702 * plugin.cc (is_visible_from_outside): Return true for symbols
1703 in the -u option.
1704
1705 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
1706
1707 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
1708 filename.
1709
1710 2011-02-02 Sriraman Tallam <tmsriram@google.com>
1711
1712 * icf.h (is_section_foldable_candidate): Change type of parameter
1713 to std::string.
1714 * icf.cc (Icf::find_identical_sections): Change type of local variable
1715 section_name to be std::string.
1716 (is_function_ctor_or_dtor): Change type of parameter to std::string.
1717
1718 2011-01-25 Ian Lance Taylor <iant@google.com>
1719
1720 * script.cc (script_add_extern): Rewrite to use
1721 add_symbol_reference.
1722
1723 2011-01-25 Doug Kwan <dougkwan@google.com>
1724
1725 * icf.cc (get_section_contents): Always lock section's object.
1726
1727 2011-01-24 Ian Lance Taylor <iant@google.com>
1728
1729 * options.h (class General_options): Accept
1730 --no-detect-odr-violations.
1731
1732 2011-01-24 Ian Lance Taylor <iant@google.com>
1733
1734 * version.cc (version_string): Bump to 1.11.
1735
1736 2011-01-24 Ian Lance Taylor <iant@google.com>
1737
1738 * plugin.cc (class Plugin_rescan): Define new class.
1739 (Plugin_manager::claim_file): Set any_claimed_.
1740 (Plugin_manager::save_archive): New function.
1741 (Plugin_manager::save_input_group): New function.
1742 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
1743 necessary.
1744 (Plugin_manager::new_undefined_symbol): New function.
1745 (Plugin_manager::rescan): New function.
1746 (Plugin_manager::rescannable_defines): New function.
1747 (Plugin_manager::add_input_file): Set any_added_.
1748 * plugin.h (class Plugin_manager): define new fields rescannable_,
1749 undefined_symbols_, any_claimed_, and any_added_. Declare
1750 Plugin_rescan as friend. Declare new functions.
1751 (Plugin_manager::Rescannable): Define type.
1752 (Plugin_manager::Rescannable_list): Define type.
1753 (Plugin_manager::Undefined_symbol_list): Define type.
1754 (Plugin_manager::Plugin_manager): Initialize new fields.
1755 * archive.cc (Archive::defines_symbol): New function.
1756 (Add_archive_symbols::run): Pass archive to plugins if any.
1757 * archive.h (class Archive): Declare defines_symbol.
1758 * readsyms.cc (Input_group::~Input_group): New function.
1759 (Finish_group::run): Pass input_group to plugins if any.
1760 * readsyms.h (class Input_group): Declare destructor.
1761 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
1762 any.
1763
1764 2011-01-10 Ian Lance Taylor <iant@google.com>
1765
1766 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
1767 section as relro.
1768 (Layout::set_segment_offsets): Reset increase_relro before calling
1769 set_section_addresses a second time.
1770
1771 2011-01-04 Cary Coutant <ccoutant@google.com>
1772
1773 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
1774 sections before NOBITS sections.
1775
1776 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
1777
1778 * version.cc (print_version): Update copyright to 2011.
1779
1780 2010-12-23 Cary Coutant <ccoutant@google.com>
1781
1782 * output.h (Output_data_reloc::add_output_section): Pass OD instead
1783 of OS to this->add. Add OD parameter to second form of the function.
1784
1785 2010-12-20 Ian Lance Taylor <iant@google.com>
1786
1787 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
1788 second of two consecutive entries with same offset.
1789
1790 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1791
1792 * testsuite/Makefile.am (ifuncmain2static_LDADD)
1793 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
1794 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
1795 to avoid unneeded links against $(LDADD).
1796 * testsuite/Makefile.in: Regenerate.
1797
1798 2010-12-15 Ian Lance Taylor <iant@google.com>
1799
1800 PR gold/12324
1801 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
1802 for R_X86_64_32 and R_X86_64_PC32.
1803 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
1804 ver_matching_def_pic.o.
1805 (ver_matching_def_pic.o): New target.
1806
1807 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1808
1809 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
1810 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
1811 Move definition before File_read::View member definitions.
1812 (File_read::View::~View): Initialize and hold lock before
1813 updating current_mapped_bytes.
1814
1815 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1816
1817 * dwarf_reader.cc: Remove outdated comment.
1818 * gold-threads.cc: Fix typo in error message.
1819 * archive.cc: Fix typos in comments.
1820 * archive.h: Likewise.
1821 * arm-reloc-property.cc: Likewise.
1822 * arm-reloc-property.h: Likewise.
1823 * arm-reloc.def: Likewise.
1824 * arm.cc: Likewise.
1825 * attributes.h: Likewise.
1826 * cref.cc: Likewise.
1827 * ehframe.cc: Likewise.
1828 * fileread.h: Likewise.
1829 * gold.h: Likewise.
1830 * i386.cc: Likewise.
1831 * icf.cc: Likewise.
1832 * incremental.h: Likewise.
1833 * int_encoding.cc: Likewise.
1834 * layout.h: Likewise.
1835 * main.cc: Likewise.
1836 * merge.h: Likewise.
1837 * object.cc: Likewise.
1838 * object.h: Likewise.
1839 * options.cc: Likewise.
1840 * readsyms.cc: Likewise.
1841 * reduced_debug_output.cc: Likewise.
1842 * reloc.cc: Likewise.
1843 * script-sections.cc: Likewise.
1844 * sparc.cc: Likewise.
1845 * symtab.h: Likewise.
1846 * target-reloc.h: Likewise.
1847 * target.cc: Likewise.
1848 * target.h: Likewise.
1849 * timer.cc: Likewise.
1850 * timer.h: Likewise.
1851 * x86_64.cc: Likewise.
1852
1853 2010-12-09 Cary Coutant <ccoutant@google.com>
1854
1855 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
1856 stack.
1857 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
1858 parameter; change all callers.
1859 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
1860 * options.h (warn_execstack): New option.
1861
1862 2010-12-07 Doug Kwan <dougkwan@google.com>
1863
1864 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
1865 like function call relocations.
1866
1867 2010-12-07 Ian Lance Taylor <iant@google.com>
1868
1869 * archive.cc (Archive::get_elf_object_for_member): Permit
1870 punconfigured to be NULL.
1871 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
1872 (Archive::include_member): Pass NULL to get_elf_object_for_member
1873 if we searched for the archive and this is the first included
1874 object.
1875
1876 2010-12-01 Ian Lance Taylor <iant@google.com>
1877
1878 * dwarf_reader.h (class Sized_dwarf_line_info): Add
1879 track_relocs_type_ field.
1880 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1881 Set track_relocs_type_.
1882 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
1883 contents when using RELA relocs.
1884 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
1885 reloc_map_.
1886 * reloc.cc (Track_relocs::next_addend): New function.
1887 * reloc.h (class Track_relocs): Declare next_addend.
1888
1889 2010-12-01 Ian Lance Taylor <iant@google.com>
1890
1891 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
1892 virtual destructor.
1893
1894 2010-12-01 Ian Lance Taylor <iant@google.com>
1895
1896 * README: Update compilers known to work and fail.
1897
1898 2010-11-23 Matthias Klose <doko@ubuntu.com>
1899
1900 * configure.in: For --enable-gold, handle value `default' instead of
1901 `both*'. Always install ld as ld.bfd, install as ld if gold is
1902 not the default.
1903 * configure: Regenerate.
1904
1905 2010-11-18 Doug Kwan <dougkwan@google.com>
1906
1907 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
1908 and right_alignment to be zero. Store result alignment only if it is
1909 greater than existing alignment.
1910
1911 2010-11-16 Cary Coutant <ccoutant@google.com>
1912
1913 PR gold/12220
1914 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1915 Check for ".zdebug_line".
1916
1917 2010-11-16 Doug Kwan <dougkwan@google.com>
1918 Cary Coutant <ccoutant@google.com>
1919
1920 * output.h (Output_segment::set_section_addresses): Pass increase_relro
1921 by reference; adjust all callers.
1922 * output.cc (Output_segment::set_section_addresses): Adjust references
1923 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
1924 list is empty.
1925 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
1926 end at page boundary.
1927
1928 2010-11-16 Cary Coutant <ccoutant@google.com>
1929
1930 PR gold/12220
1931 * layout.cc (Layout::choose_output_section): Transform names of
1932 compressed sections even when using a script with a SECTIONS clause.
1933 (Layout::output_section_name): Remove code to transform
1934 compressed debug section names.
1935 * output.cc (Output_section::add_input_section): Use uncompressed
1936 section size when tracking input sections.
1937
1938 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
1939
1940 * symtab.h (Symbol::NON_PIC_REF): Remove.
1941 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
1942 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
1943 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
1944 (Symbol::use_plt_offset): Take a flags argument and pass it
1945 directly to needs_dynamic_reloc. Restrict check for undefined
1946 weak symbols to function calls.
1947 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
1948 (Target_arm::Scan::global): Use it.
1949 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
1950 (Target_arm::Relocate::relocate): Likewise.
1951 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
1952 parameter with an r_type parameter. Use get_reference_flags
1953 to get the flags.
1954 (Target_arm::Relocate::relocate): Update accordingly.
1955 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
1956 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
1957 (Target_i386::Scan::global): Likewise.
1958 (Target_i386::Relocate::relocate): Likewise.
1959 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
1960 parameter with an r_type parameter. Use get_reference_flags
1961 to get the flags.
1962 (Target_i386::Relocate::relocate): Update accordingly.
1963 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
1964 (Target_powerpc::Scan::global): Use it.
1965 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
1966 (Target_powerpc::Relocate::relocate): Likewise.
1967 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
1968 (Target_sparc::Scan::global): Use it.
1969 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
1970 (Target_sparc::Relocate::relocate): Likewise.
1971 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
1972 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
1973 (Target_x86_64::Scan::global): Likewise.
1974 (Target_x86_64::Relocate::relocate): Likewise.
1975
1976 2010-11-08 Doug Kwan <dougkwan@google.com>
1977 Cary Coutant <ccoutant@google.com>
1978
1979 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
1980 (Arm_exidx_merge_section::section_contents_): New data member.
1981 (Arm_input_section::Arm_input_section): Initialize original_contents_.
1982 (Arm_input_section::~Arm_input_section): De-allocate memory.
1983 (Arm_input_section::original_contents_): New data member.
1984 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
1985 in parameters instead of calling Object::section_contents without
1986 locking.
1987 (Arm_output_section::group_section): New parameter TASK. Pass it
1988 to callees that need locking objects.
1989 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
1990 to lock EXIDX input sections. Fix a formatting issue. Call
1991 Arm_exidx_merged_section::build_contents to create merged section
1992 contents.
1993 (Arm_output_section::create_stub_group): New parameter TASK. Use it
1994 to lock object of stub table owner.
1995 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
1996 TEXT_SIZE to initialize data member TEXT_SIZE_.
1997 (Arm_exidx_input_section::addralign): Fix typo in comment.
1998 (Arm_exidx_input_section::text_size): New method.
1999 (Target_arm::do_relax): New parameter TASK. Pass it to callees
2000 that require locking objects. Lock objects before scanning for stubs
2001 and updating local symbols.
2002 (Arm_input_section<big_endian>::init): Copy contents of original
2003 input section.
2004 (Arm_input_section<big_endian>::do_write): Use saved contents of
2005 original input section instead of calling Object::section_contents
2006 without locking.
2007 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
2008 size without calling Object::section_size().
2009 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
2010 for size. Allocate a buffer for merged EXIDX entries.
2011 (Arm_exidx_merged_section::build_contents): New method.
2012 (Arm_exidx_merged_section::do_write): Move merge section contents
2013 building code to Arm_exidx_merged_section::build_contetns. Write
2014 out contetns in buffer instead of building it on the fly.
2015 (Arm_relobj::make_exidx_input_section): Also pass text section size
2016 to Arm_exidx_input_section constructor.
2017 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
2018 (Arm_dynobj::do_read_symbols): Fix memory leak.
2019 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
2020 * target.h: (class Task): Add forward declaration.
2021 (Target::relax): Add new parameter TASK and pass it to
2022 Target::do_relax().
2023 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
2024
2025 2010-11-05 Cary Coutant <ccoutant@google.com>
2026
2027 PR gold/10708
2028 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
2029 object when reading from the file.
2030 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
2031 second layout pass.
2032 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
2033 when reading section contents.
2034 (get_section_contents): Likewise.
2035 (icf::find_identical_sections): Likewise.
2036 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
2037 object when reading from the file.
2038 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
2039 the object when doing deferred section layout.
2040
2041 2010-11-03 Nick Clifton <nickc@redhat.com>
2042
2043 PR gold/12001
2044 * script.h (class Symbol_assignment: name): New member. Returns
2045 the name of the symbol.
2046 * scrfipt.cc (Script_options::is_pending_assignment): New member.
2047 Returns true if the given symbol name is on the list of
2048 assignments wating to be processed.
2049 * archive.cc (should_incldue_member): If the symbol is undefined,
2050 check to see if it is on the list of symbols pending assignment.
2051
2052 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
2053
2054 * script-sections.cc (Script_sections::find_memory_region): Check
2055 for a NULL output section pointer.
2056
2057 2010-10-29 Doug Kwan <dougkwan@google.com>
2058
2059 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
2060 Output_section::add_relaxed_input_section.
2061 * output.cc (Output_section::add_relaxed_input_section): Add new
2062 arguments LAYOUT and NAME. Set section order index.
2063 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2064 Copy section order index.
2065 * output.h (Output_section::add_relaxed_input_section): Add new
2066 arguments LAYOUT and NAME.
2067
2068 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2069
2070 * testsuite/Makefile.am: Move gcctestdir/ld rule to
2071 NATIVE_OR_CROSS_LINKER.
2072 * testsuite/Makefile.in: Regenerate.
2073
2074 2010-10-20 Doug Kwan <dougkwan@google.com>
2075
2076 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
2077 without SHF_LINK_ORDER flags.
2078 * layout.cc (Layout::choose_output_section): Do not filter
2079 SHF_LINK_ORDER flag in a relocatable link.
2080
2081 2010-10-17 Cary Coutant <ccoutant@google.com>
2082
2083 * output.h (Output_segment::set_section_addresses): Change function
2084 signature. Update all callers.
2085 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
2086 sections.
2087 (Output_segment::set_section_addresses): Align after last TLS
2088 section. Add padding before last relro section instead of after.
2089
2090 2010-10-17 Doug Kwan <dougkwan@google.com>
2091
2092 * gold/arm.cc (Target_arm::got_section): Use correct order and set
2093 GOT output section to be writable.
2094
2095 2010-10-14 Cary Coutant <ccoutant@google.com>
2096
2097 * debug.h (DEBUG_INCREMENTAL): New flag.
2098 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
2099 * gold.cc (queue_initial_tasks): Check parameters for incremental link
2100 mode.
2101 * incremental.cc (report_command_line): Ignore all forms of
2102 --incremental.
2103 * layout.cc (Layout::Layout): Check parameters for incremental link
2104 mode.
2105 * options.cc (General_options::parse_incremental): New function.
2106 (General_options::parse_no_incremental): New function.
2107 (General_options::parse_incremental_full): New function.
2108 (General_options::parse_incremental_update): New function.
2109 (General_options::incremental_mode_): New data member.
2110 (General_options::finalize): Check incremental_mode_.
2111 * options.h (General_options): Update help text for --incremental.
2112 Add --no-incremental, --incremental-full, --incremental-update.
2113 (General_options::Incremental_mode): New enum type.
2114 (General_options::incremental_mode): New function.
2115 (General_options::incremental_mode_): New data member.
2116 * parameters.cc (Parameters::incremental_mode_): New data member.
2117 (Parameters::set_options): Set incremental_mode_.
2118 (Parameters::set_incremental_full): New function.
2119 (Parameters::incremental): New function.
2120 (Parameters::incremental_update): New function.
2121 (set_parameters_incremental_full): New function.
2122 * parameters.h (Parameters::set_incremental_full): New function.
2123 (Parameters::incremental): New function.
2124 (Parameters::incremental_update): New function.
2125 (Parameters::incremental_mode_): New data member.
2126 (set_parameters_incremental_full): New function.
2127 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
2128 incremental link mode.
2129 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
2130 (Sized_relobj::do_relocate_sections): Likewise.
2131 * testsuite/Makefile.am (incremental_test): Use --incremental-full
2132 option.
2133 * testsuite/Makefile.in: Regenerate.
2134 * testsuite/incremental_test.sh: Filter all forms of --incremental.
2135
2136 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2137
2138 * script-sections.h (class Script_sections): Make
2139 Sections_elements typedef public.
2140 * script-sections.cc (class Sort_output_sections): Add elements_
2141 field. Add constructor which sets it; change all callers.
2142 (Sort_output_sections::is_before): New function.
2143 (Sort_output_sections::operator()): Call is_before.
2144 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
2145 conditional.
2146 * testsuite/script_test_10.sh: New test. Test script section
2147 order.
2148 * testsuite/script_test_10.t: Likewise.
2149 * testsuite/script_test_10.s: Likewise.
2150 * testsuite/Makefile.am: Wrap the cross linker tests and the
2151 common tests into NATIVE_OR_CROSS_LINKER.
2152 (check_SCRIPTS): Add script_test_10.sh.
2153 (check_DATA): Add script_test_10.stdout.
2154 (script_test_10.o, script_test_10): New targets.
2155 (script_test_10.stdout): New target.
2156 * configure, testsuite/Makefile.in: Regenerate.
2157
2158 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2159
2160 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
2161 error for the deprecated relocations.
2162 (Target_arm::Scan::global): Likewise.
2163 (Target_arm::Relocate::relocate): Likewise.
2164
2165 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
2166
2167 * fileread.cc (Input_file::find_file): Initialize *found_name
2168 and *namep when using the fallback search for case 4.
2169
2170 2010-10-11 Cary Coutant <ccoutant@google.com>
2171
2172 * options.h (class General_options): Redefine -z lazy as an alias for
2173 the negation of -z now.
2174
2175 2010-10-11 Ian Lance Taylor <iant@google.com>
2176
2177 * resolve.cc (symbol_to_bits): Report the value of the unsupported
2178 binding.
2179
2180 2010-10-06 Nick Clifton <nickc@redhat.com>
2181
2182 * script-sections.cc(class Memory_region): Remove
2183 current_lma_offset_ field. Rename current_vma_offset_ to
2184 current_offset_. Add last_section_ field.
2185 (Memory_region::get_current_vma_address): Rename to
2186 get_current_address.
2187 (Memory_region::get_current_lma_address): Delete.
2188 (Memory_region::increment_vma_offset): Rename to
2189 increment_offset.
2190 (Memory_region::increment_lma_offset): Delete.
2191 (Memory_region::attributes_compatible): New method. Returns
2192 true if the provided section is compatible with the region.
2193 (Memory_region::get_last_section): New method. Returns the last
2194 section to use the region.
2195 (Memory_region::set_last_section): New method. Stores the last
2196 section to use the region.
2197 (Script_sections::block_in_region): New method. Returns true if
2198 a block of memory is contained within a region.
2199 (Script_sections::find_memory_region): New method. Locates a
2200 memory region to be used to set a VMA or LMA address.
2201 (Output_section_definition::set_section_addresses): Add code to
2202 check for addresses set by memory regions.
2203 (Output_segment::set_section_addresses): Remove memory region
2204 walking code.
2205 (Script_sections::create_segment): Add a warning if a header
2206 segment is created outside of any region.
2207 * script-sections.h (class Script_sections): Add prototypes for
2208 find_memory_region and block_in_region methods.
2209 * testsuite/memory_test.s: Use .long instead of .word.
2210 * testsuite/memory_test.t: Add some more output sections.
2211 * testsuite/memory_test.sh: Update expected output.
2212
2213 2010-10-02 Doug Kwan <dougkwan@google.com>
2214
2215 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
2216 defintion to symtab.h
2217 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
2218 declaration to defintion.
2219
2220 2010-10-01 Nick Clifton <nickc@redhat.com>
2221
2222 * expression.cc (eval): Replace dummy argument with NULL.
2223 (eval_maybe_dot): Check for a NULL result section pointer.
2224 (Symbol_expression::value): Likewise.
2225 (Dot_expression::value): Likewise.
2226 (BINARY_EXPRESSION): Likewise.
2227 (Max_expression::value): Likewise.
2228 (Min_expression::value): Likewise.
2229 (Absolute_expression::value): Likewise.
2230 (Addr_expression::value_from_output_section): Likewise.
2231 (Loaddddr_expression::value_from_output_section): Likewise.
2232 (Segment_start_expression::value): Likewise.
2233 * script-sections.cc
2234 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
2235 argument with NULL.
2236 (Sections_elememt_dot_assignment::set_section_addresses):
2237 Likewise.
2238 (Output_data_expression::do_write_to_buffer): Likewise.
2239 (Output_section_definition::finalize_symbols): Likewise.
2240 (Output_section_definition::set_section_addresses): Likewise.
2241
2242 2010-09-30 Doug Kwan <dougkwan@google.com>
2243
2244 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
2245
2246 2010-09-28 Sriraman Tallam <tmsriram@google.com>
2247
2248 * target.h (Target::can_icf_inline_merge_sections): New virtual
2249 function.
2250 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
2251 virtual function.
2252 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
2253 virtual function.
2254 * icf.cc (get_section_contents): Inline merge sections only when
2255 target allows it.
2256
2257 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2258
2259 * configure: Regenerate.
2260
2261 2010-09-17 Ian Lance Taylor <iant@google.com>
2262
2263 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
2264 * testsuite/Makefile.am (memory_test.o): New target.
2265 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
2266 memory_test.t.
2267 * testsuite/Makefile.in: Rebuild.
2268
2269 2010-09-17 Doug Kwan <dougkwan@google.com>
2270
2271 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
2272 defintion if relocation uses GOT entries of the symbol.
2273 * testsuite/icf_safe_test.sh: Fix test.
2274 * testsuite/icf_safe_so_test.sh: Fix test.
2275
2276 2010-09-16 Cary Coutant <ccoutant@google.com>
2277
2278 * script_sections.cc (class Memory_region): Remove "NULL" from
2279 vector initializations.
2280
2281 2010-09-15 Cary Coutant <ccoutant@google.com>
2282
2283 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
2284 Resolve forwarding symbols.
2285
2286 2010-09-15 Doug Kwan <dougkwan@google.com>
2287
2288 * gold/testsuite/script_test_3.t: Add ARM special sections.
2289 * gold/testsuite/script_test_4.t: Same.
2290 * gold/testsuite/script_test_5.t: Same.
2291 * gold/testsuite/script_test_6.t: Same.
2292 * gold/testsuite/script_test_7.t: Same.
2293 * gold/testsuite/script_test_7.t: Same.
2294 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
2295
2296 2010-09-14 Cary Coutant <ccoutant@google.com>
2297
2298 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
2299 (Target_x86_64::Relocate::relocate_tls): Replace check for
2300 saw_tls_block_reloc_ with test for executable section.
2301
2302 2010-09-12 Cary Coutant <ccoutant@google.com>
2303
2304 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
2305 position-independent executables to shared libraries need dynamic
2306 relocations.
2307 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
2308 position-independent executables.
2309 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
2310 * testsuite/Makefile.in: Regenerate.
2311
2312 2010-09-10 Nick Clifton <nickc@redhat.com>
2313
2314 PR gold/11997
2315 * testsuite/memory_test.t: Discard any sections that are not
2316 needed.
2317
2318 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
2319
2320 PR gold/11996
2321 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
2322 "This::" to work around a bug in gcc 4.2.
2323
2324 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
2325
2326 2010-09-09 Rafael Espindola <espindola@google.com>
2327
2328 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
2329 sections with different PF_X flags in the same segment.
2330 (Layout::find_first_load_seg): Search all segments to find the first
2331 one.
2332 * options.h (rosegment): New.
2333
2334 2010-09-08 Rafael Espindola <espindola@google.com>
2335
2336 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
2337
2338 2010-09-08 Doug Kwan <dougkwan@google.com>
2339
2340 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
2341 (Arm_relobj::do_relocate_sections): Add new parameter for output
2342 file to match the parent.
2343 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
2344 of local symbols instead of input values. Update code to track
2345 changes in gold::relocate_section.
2346 * object.cc (Sized_relobj::compute_final_local_value): New methods.
2347 (Sized_relobj::compute_final_local_value_internal): New methods.
2348 (Sized_relobj::do_finalize_local_symbols): Move code from loop
2349 body into private version of Sized_relobj::compute_final_local_value.
2350 Call the inline method.
2351 * object.h (Symbol_value::Symbol_value): Define destructor. Free
2352 merged symbol value if there is one.
2353 (Symbol_value::has_output_value): New method defintiion.
2354 (Sized_relobj::Compute_final_local_value_status): New enum type.
2355 (Sized_relobj::compute_final_local_value): New methods.
2356 (Sized_relobj::compute_final_local_value_internal): New methods.
2357 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
2358 and arm_cortex_a8.sh.
2359 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
2360 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
2361 New tests.
2362 * Makefile.in: Regenerate.
2363 * testsuite/arm_bl_out_of_range.s: Update test.
2364 * testsuite/thumb_bl_out_of_range.s: Ditto.
2365 * testsuite/thumb_blx_out_of_range.s: Ditto.
2366 * testsuite/arm_branch_out_of_range.sh: New file.
2367 * testsuite/arm_cortex_a8.sh: Ditto.
2368 * testsuite/arm_cortex_a8_b.s: Ditto.
2369 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
2370 * testsuite/arm_cortex_a8_b_local.s: Ditto.
2371 * testsuite/arm_cortex_a8_bl.s: Ditto.
2372 * testsuite/arm_cortex_a8_blx.s: Ditto.
2373 * testsuite/arm_cortex_a8_local.s: Ditto.
2374 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
2375 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
2376
2377 2010-09-08 Rafael Espindola <espindola@google.com>
2378
2379 * Makefile.am (memory_test.stdout): Run readelf with -W.
2380 * Makefile.in: Regenerate.
2381 * testsuite/memory_test.sh: Make the regexps accept both 32 and
2382 64 bit output.
2383
2384 2010-09-08 Rafael Espindola <espindola@google.com>
2385
2386 * script-sections.cc (Script_sections::add_memory_region): Convert
2387 field precision to int.
2388 * script.cc (script_set_section_region, script_set_section_region):
2389 Convert field precision to int.
2390
2391 2010-09-08 Rafael Espindola <espindola@google.com>
2392
2393 * arm.cc (do_finalize_sections): Create the __exidx_start and
2394 __exdix_end symbols even when the section is missing.
2395
2396 2010-09-08 Nick Clifton <nickc@redhat.com>
2397
2398 * README: Remove claim that MEMORY is not supported.
2399 * expression.cc (script_exp_function_origin)
2400 (script_exp_function_length): Move from here to ...
2401 * script.cc: ... here.
2402 (script_set_section_region, script_add_memory)
2403 (script_parse_memory_attr, script_include_directive): New
2404 functions.
2405 * script-sections.cc
2406 (class Memory_region): New class.
2407 (class Output_section_definition): Add set_memory_region,
2408 set_section_vma, set_section_lma and get_section_name methods.
2409 (class Script_Sections): Add add_memory_region,
2410 find_memory_region, find_memory_region_origin,
2411 find_memory_region_length and set_memory_region methods.
2412 Have set_section_addresses method walk the list of set memory
2413 regions.
2414 Extend the print methos to display memory regions.
2415 * script-sections.h: Add prototypes for new methods.
2416 Add enum for MEMORY region attributes.
2417 * yyscript.y: Add support for parsing MEMORY regions.
2418 * script-c.h: Add prototypes for new functions.
2419 * testsuite/Makefile.am: Add test of MEMORY region functionality.
2420 * testsuite/Makefile.in: Regenerate.
2421 * testsuite/memory_test.sh: New script.
2422 * testsuite/memory_test.s: New assembler source file.
2423 * testsuite/memory_test.t: New linker script.
2424
2425 2010-08-27 Doug Kwan <dougkwan@google.com>
2426
2427 * gold/resolve.cc (Symbol_table::should_override): Let a weak
2428 reference override an existing dynamic weak reference.
2429 * testsuite/Makefile.am: Add new test dyn_weak_ref.
2430 * testsuite/Makefile.in: Regenerate.
2431 * testsuite/dyn_weak_ref.sh: New file.
2432 * testsuite/dyn_weak_ref_1.c: Ditto.
2433 * testsuite/dyn_weak_ref_2.c: Ditto.
2434
2435 2010-08-27 Ian Lance Taylor <iant@google.com>
2436
2437 * incremental.h (class Incremental_input_entry): Add virtual
2438 destructor.
2439
2440 2010-08-27 Ian Lance Taylor <iant@google.com>
2441
2442 * testsuite/start_lib_test_3.c: Mark t3 as used.
2443
2444 2010-08-27 Nick Clifton <nickc@redhat.com>
2445
2446 * options.cc (version_script): Fix small typo in previous
2447 whitespace tidyup.
2448
2449 2010-08-25 Nick Clifton <nickc@redhat.com>
2450
2451 * archive.cc: Formatting fixes: Remove whitespace between
2452 typename and following asterisk. Remove whitespace between
2453 function name and opening parenthesis.
2454 * archive.h: Likewise.
2455 * arm.cc: Likewise.
2456 * attributes.cc: Likewise.
2457 * attributes.h: Likewise.
2458 * common.cc: Likewise.
2459 * copy-relocs.cc: Likewise.
2460 * dirsearch.h: Likewise.
2461 * dynobj.cc: Likewise.
2462 * ehframe.cc: Likewise.
2463 * ehframe.h: Likewise.
2464 * expression.cc: Likewise.
2465 * fileread.cc: Likewise.
2466 * fileread.h: Likewise.
2467 * gc.h: Likewise.
2468 * gold-threads.cc: Likewise.
2469 * gold.cc: Likewise.
2470 * i386.cc: Likewise.
2471 * icf.h: Likewise.
2472 * incremental-dump.cc: Likewise.
2473 * incremental.cc: Likewise.
2474 * layout.cc: Likewise.
2475 * layout.h: Likewise.
2476 * main.cc: Likewise.
2477 * merge.cc: Likewise.
2478 * merge.h: Likewise.
2479 * object.cc: Likewise.
2480 * object.h: Likewise.
2481 * options.cc: Likewise.
2482 * options.h: Likewise.
2483 * output.cc: Likewise.
2484 * output.h: Likewise.
2485 * plugin.cc: Likewise.
2486 * plugin.h: Likewise.
2487 * powerpc.cc: Likewise.
2488 * reloc.cc: Likewise.
2489 * script-c.h: Likewise.
2490 * script-sections.cc: Likewise.
2491 * script.cc: Likewise.
2492 * stringpool.cc: Likewise.
2493 * symtab.cc: Likewise.
2494 * symtab.h: Likewise.
2495 * target.cc: Likewise.
2496 * timer.cc: Likewise.
2497 * timer.h: Likewise.
2498 * version.cc: Likewise.
2499 * x86_64.cc: Likewise.
2500
2501 2010-08-24 Nick Clifton <nickc@redhat.com>
2502
2503 PR 11899
2504 * layout.cc (segment_precedes): Sort segments by their physical
2505 addresses, if they have been set.
2506
2507 2010-08-23 Cary Coutant <ccoutant@google.com>
2508
2509 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
2510 symbols data.
2511 (Lib_group::include_member): Unlock object after deleting its
2512 symbols data.
2513 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
2514 the bug fixed here.
2515
2516 2010-08-19 Neil Vachharajani <nvachhar@google.com>
2517 Cary Coutant <ccoutant@google.com>
2518
2519 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
2520 constructor, and set_blocker.
2521 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
2522 readsyms_blocker_.
2523 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
2524 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
2525 * testsuite/Makefile.am (start_lib_test): New test case.
2526 * testsuite/Makefile.in: Regenerate.
2527 * testsuite/start_lib_test_main.c: New file.
2528 * testsuite/start_lib_test_1.c: New file.
2529 * testsuite/start_lib_test_2.c: New file.
2530 * testsuite/start_lib_test_3.c: New file.
2531
2532 2010-08-19 Ian Lance Taylor <iant@google.com>
2533
2534 * Makefile.in: Rebuild with automake 1.11.1.
2535 * aclocal.m4: Likewise.
2536 * testsuite/Makefile.in: Likewise.
2537
2538 2010-08-19 Ian Lance Taylor <iant@google.com>
2539
2540 PR 10893
2541 * i386.cc (class Output_data_plt_i386): Update declarations.
2542 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
2543 local_ifuncs_ fields.
2544 (Target_i386::do_plt_section_for_global): New function.
2545 (Target_i386::do_plt_section_for_local): New function.
2546 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
2547 parameter; change all callers. Initialize global_ifuncs_ and
2548 local_ifuncs_. If doing a static link define __rel_iplt_start and
2549 __rel_iplt_end.
2550 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
2551 (Output_data_plt_i386::add_local_ifunc_entry): New function.
2552 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
2553 symbols.
2554 (Target_i386::make_plt_section): New function, broken out of
2555 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
2556 (Target_i386::make_plt_entry): Call make_plt_section.
2557 (Target_i386::make_local_ifunc_plt_entry): New function.
2558 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
2559 (Target_i386::Scan::local): Handle IFUNC symbols. Add
2560 R_386_IRELATIVE to switch.
2561 (Target_i386::Scan::global): Likewise.
2562 (Target_i386::Relocate::relocate): Likewise.
2563 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
2564 switch.
2565 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
2566 (Target_x86_64::do_plt_section_for_global): New function.
2567 (Target_x86_64::do_plt_section_for_local): New function.
2568 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
2569 parameter; change all callers. If doing a static link define
2570 __rela_iplt_start and __rela_iplt_end.
2571 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
2572 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
2573 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
2574 to point to .plt.
2575 (Target_x86_64::make_local_ifunc_plt_entry): New function.
2576 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
2577 switch.
2578 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
2579 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
2580 R_X86_64_IRELATIVE to switch.
2581 (Target_x86_64::Scan::global): Likewise.
2582 (Target_x86_64::Relocate::relocate): Likewise.
2583 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
2584 switch.
2585 * target.h (class Target): Add plt_section_for_global and
2586 plt_section_for_local functions. Add do_plt_section_for_global
2587 and do_plt_section_for_local virtual functions.
2588 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
2589 clarifying comments.
2590 (Symbol::use_plt_offset): Handle IFUNC symbol.
2591 * object.cc (Sized_relobj::Sized_relobj): Initialize
2592 local_plt_offsets_.
2593 (Sized_relobj::local_has_plt_offset): New function.
2594 (Sized_relobj::local_plt_offset): New function.
2595 (Sized_relobj::set_local_plt_offset): New function.
2596 (Sized_relobj::do_count): Handle IFUNC symbol.
2597 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
2598 a bit away from input_shndx_ field. Add set_is_func_symbol and
2599 is_ifunc_symbol functions.
2600 (class Sized_relobj): Update declarations. Remove Tls_got_entry
2601 and Local_tls_got_offsets. Define Local_plt_offsets. Add
2602 local_plt_offsets_ field.
2603 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
2604 * output.h (class Output_section_data): Add non-const
2605 output_section function.
2606 (class Output_data_got): Update declarations.
2607 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
2608 Add use_plt_offset parameter to global and local constructors.
2609 Change all callers. Change local_sym_index_ field to 31 bits.
2610 Change GSYM_CODE and CONSTANT_CODE accordingly.
2611 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
2612 doing a static link don't set sh_link field.
2613 (Output_data_got::Got_entry::write): Use PLT offset if
2614 appropriate.
2615 (Output_data_got::add_global_plt): New function.
2616 (Output_data_got::add_local_plt): New function.
2617 * target-reloc.h (relocate_section): Handle IFUNC symbol.
2618 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
2619 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
2620 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
2621 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
2622 IFUNC conditional.
2623 * testsuite/ifunc-sel.h: New file.
2624 * testsuite/ifuncmain1.c: New file.
2625 * testsuite/ifuncmain1vis.c: New file.
2626 * testsuite/ifuncmod1.c: New file.
2627 * testsuite/ifuncdep2.c: New file.
2628 * testsuite/ifuncmain2.c: New file.
2629 * testsuite/ifuncmain3.c: New file.
2630 * testsuite/ifuncmod3.c: New file.
2631 * testsuite/ifuncmain4.c: New file.
2632 * testsuite/ifuncmain5.c: New file.
2633 * testsuite/ifuncmod5.c: New file.
2634 * testsuite/ifuncmain6pie.c: New file.
2635 * testsuite/ifuncmod6.c: New file.
2636 * testsuite/ifuncmain7.c: New file.
2637 * configure, testsuite/Makefile.in: Rebuild.
2638
2639 2010-08-18 Ian Lance Taylor <iant@google.com>
2640
2641 * incremental.cc
2642 (Output_section_incremental_inputs::write_input_files): Add cast
2643 to avoid signed/unsigned comparison warning.
2644 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2645
2646 2010-08-12 Cary Coutant <ccoutant@google.com>
2647
2648 * common.cc (Sort_commons::operator()): Remove unnecessary code.
2649
2650 2010-08-13 Ian Lance Taylor <iant@google.com>
2651
2652 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
2653
2654 2010-08-12 Cary Coutant <ccoutant@google.com>
2655 Doug Kwan <dougkwan@google.com>
2656
2657 * resolve.cc (Symbol_table::should_override): When a weak dynamic
2658 defintion overrides non-weak undef, remember that the original undef
2659 is not weak.
2660 * symtab.cc (Symbol_table::sized_write_global): For undef without
2661 an original weak binding, set binding to global in output.
2662 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
2663 * testsuite/Makefile.in: Regenerate.
2664 * testsuite/strong_ref_weak_def.sh: New file.
2665 * testsuite/strong_ref_weak_def_1.c: Ditto.
2666 * testsuite/strong_ref_weak_def_2.c: Ditto.
2667
2668 2010-08-12 Cary Coutant <ccoutant@google.com>
2669
2670 * testsuite/incremental_test.sh: Rewrite.
2671 * testsuite/incremental_test_1.c: Rewrite.
2672 * testsuite/incremental_test_2.c: Rewrite.
2673
2674 2010-08-12 Cary Coutant <ccoutant@google.com>
2675
2676 * arm.cc (Target_arm::got_size): Add const.
2677 (Target_arm::got_entry_count): New function.
2678 (Target_arm::plt_entry_count): New function.
2679 (Target_arm::first_plt_entry_offset): New function.
2680 (Target_arm::plt_entry_size): New function.
2681 (Output_data_plt_arm::entry_count): New function.
2682 (Output_data_plt_arm::first_plt_entry_offset): New function.
2683 (Output_data_plt_arm::get_plt_entry_size): New function.
2684 * i386.cc (Target_i386::got_size): Add const.
2685 (Target_i386::got_entry_count): New function.
2686 (Target_i386::plt_entry_count): New function.
2687 (Target_i386::first_plt_entry_offset): New function.
2688 (Target_i386::plt_entry_size): New function.
2689 (Output_data_plt_i386::entry_count): New function.
2690 (Output_data_plt_i386::first_plt_entry_offset): New function.
2691 (Output_data_plt_i386::get_plt_entry_size): New function.
2692 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
2693 find_incremental_inputs_sections. Dump incremental_got_plt section.
2694 * incremental.cc: Include target.h.
2695 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
2696 parameter. Adjust all callers. Find incremental_got_plt section.
2697 (Incremental_inputs::create_data_sections): Create incremental_got_plt
2698 section.
2699 (Output_section_incremental_inputs::set_final_data_size): Calculate
2700 size of incremental_got_plt section.
2701 (Output_section_incremental_inputs::do_write): Write the
2702 incremental_got_plt section.
2703 (Got_plt_view_info): New struct.
2704 (Local_got_offset_visitor): New class.
2705 (Global_got_offset_visitor): New class.
2706 (Global_symbol_visitor_got_plt): New class.
2707 (Output_section_incremental_inputs::write_got_plt): New function.
2708 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
2709 Add parameter. Adjust all callers.
2710 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2711 (Incremental_inputs::got_plt_section): New function.
2712 (Incremental_inputs::got_plt_section_): New data member.
2713 (Incremental_got_plt_reader): New class.
2714 * layout.cc (Layout::create_incremental_info_sections): Add the
2715 incremental_got_plt section.
2716 * object.h (Got_offset_list::get_list): New function.
2717 (Got offset_list::for_all_got_offsets): New function.
2718 (Sized_relobj::local_got_offset_list): New function.
2719 * powerpc.cc (Target_powerpc::got_size): Add const.
2720 (Target_powerpc::got_entry_count): New function.
2721 (Target_powerpc::plt_entry_count): New function.
2722 (Target_powerpc::first_plt_entry_offset): New function.
2723 (Target_powerpc::plt_entry_size): New function.
2724 (Output_data_plt_powerpc::entry_count): New function.
2725 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
2726 (Output_data_plt_powerpc::get_plt_entry_size): New function.
2727 * sparc.cc (Target_sparc::got_size): Add const.
2728 (Target_sparc::got_entry_count): New function.
2729 (Target_sparc::plt_entry_count): New function.
2730 (Target_sparc::first_plt_entry_offset): New function.
2731 (Target_sparc::plt_entry_size): New function.
2732 (Output_data_plt_sparc::entry_count): New function.
2733 (Output_data_plt_sparc::first_plt_entry_offset): New function.
2734 (Output_data_plt_sparc::get_plt_entry_size): New function.
2735 * symtab.h (Symbol::got_offset_list): New function.
2736 (Symbol_table::for_all_symbols): New function.
2737 * target.h (Sized_target::got_entry_count): New function.
2738 (Sized_target::plt_entry_count): New function.
2739 (Sized_target::plt_entry_size): New function.
2740 * x86_64.cc (Target_x86_64::got_size): Add const.
2741 (Target_x86_64::got_entry_count): New function.
2742 (Target_x86_64::plt_entry_count): New function.
2743 (Target_x86_64::first_plt_entry_offset): New function.
2744 (Target_x86_64::plt_entry_size): New function.
2745 (Output_data_plt_x86_64::entry_count): New function.
2746 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
2747 (Output_data_plt_x86_64::get_plt_entry_size): New function.
2748
2749 2010-08-12 Cary Coutant <ccoutant@google.com>
2750
2751 * archive.cc: Include incremental.h.
2752 (Archive::Archive): Initialize incremental_info_.
2753 (Archive::include_member): Record archive members in incremental info.
2754 (Add_archive_symbols::run): Record begin and end of an archive in
2755 incremental info.
2756 (Lib_group::include_member): Record objects in incremental info.
2757 * archive.h (Incremental_archive_entry): Forward declaration.
2758 (Archive::set_incremental_info): New member function.
2759 (Archive::incremental_info): New member function.
2760 (Archive::Unused_symbol_iterator): New class.
2761 (Archive::unused_symbols_begin): New member function.
2762 (Archive::unused_symbols_end): New member function.
2763 (Archive::incremental_info_): New data member.
2764 * incremental-dump.cc (find_input_containing_global): New function.
2765 (dump_incremental_inputs): Dump new incremental info sections.
2766 * incremental.cc: Include symtab.h.
2767 (Output_section_incremental_inputs): New class.
2768 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
2769 new incremental info sections.
2770 (Sized_incremental_binary::do_check_inputs): Likewise.
2771 (Incremental_inputs::report_archive): Remove.
2772 (Incremental_inputs::report_archive_begin): New function.
2773 (Incremental_inputs::report_archive_end): New function.
2774 (Incremental_inputs::report_object): New function.
2775 (Incremental_inputs::finalize_inputs): Remove.
2776 (Incremental_inputs::report_input_section): New function.
2777 (Incremental_inputs::report_script): Rewrite.
2778 (Incremental_inputs::finalize): Do nothing but finalize string table.
2779 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2780 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2781 (Incremental_inputs::create_data_sections): New function.
2782 (Incremental_inputs::relocs_entsize): New function.
2783 (Output_section_incremental_inputs::set_final_data_size): New function.
2784 (Output_section_incremental_inputs::do_write): New function.
2785 (Output_section_incremental_inputs::write_header): New function.
2786 (Output_section_incremental_inputs::write_input_files): New function.
2787 (Output_section_incremental_inputs::write_info_blocks): New function.
2788 (Output_section_incremental_inputs::write_symtab): New function.
2789 * incremental.h (Incremental_script_entry): Forward declaration.
2790 (Incremental_object_entry): Forward declaration.
2791 (Incremental_archive_entry): Forward declaration.
2792 (Incremental_inputs): Forward declaration.
2793 (Incremental_inputs_header_data): Remove.
2794 (Incremental_inputs_header): Remove.
2795 (Incremental_inputs_header_write): Remove.
2796 (Incremental_inputs_entry_data): Remove.
2797 (Incremental_inputs_entry): Remove.
2798 (Incremental_inputs_entry_write): Remove.
2799 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
2800 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
2801 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
2802 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
2803 Likewise.
2804 (Incremental_input_entry): New class.
2805 (Incremental_script_entry): New class.
2806 (Incremental_object_entry): New class.
2807 (Incremental_archive_entry): New class.
2808 (Incremental_inputs::Incremental_inputs): Initialize new data members.
2809 (Incremental_inputs::report_inputs): Remove.
2810 (Incremental_inputs::report_archive): Remove.
2811 (Incremental_inputs::report_archive_begin): New function.
2812 (Incremental_inputs::report_archive_end): New function.
2813 (Incremental_inputs::report_object): Change prototype.
2814 (Incremental_inputs::report_input_section): New function.
2815 (Incremental_inputs::report_script): Change prototype.
2816 (Incremental_inputs::get_reloc_count): New function.
2817 (Incremental_inputs::set_reloc_count): New function.
2818 (Incremental_inputs::create_data_sections): New function.
2819 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
2820 (Incremental_inputs::inputs_section): New function.
2821 (Incremental_inputs::symtab_section): New function.
2822 (Incremental_inputs::relocs_section): New function.
2823 (Incremental_inputs::get_stringpool): Add const.
2824 (Incremental_inputs::command_line): Add const.
2825 (Incremental_inputs::inputs): Remove.
2826 (Incremental_inputs::command_line_key): New function.
2827 (Incremental_inputs::input_file_count): New function.
2828 (Incremental_inputs::input_files): New function.
2829 (Incremental_inputs::relocs_entsize): New function.
2830 (Incremental_inputs::sized_create_inputs_section_data): Remove.
2831 (Incremental_inputs::finalize_inputs): Remove.
2832 (Incremental_inputs::Input_info): Remove.
2833 (Incremental_inputs::lock_): Remove.
2834 (Incremental_inputs::inputs_): Change type.
2835 (Incremental_inputs::inputs_map_): Remove.
2836 (Incremental_inputs::current_object_entry_): New data member.
2837 (Incremental_inputs::inputs_section_): New data member.
2838 (Incremental_inputs::symtab_section_): New data member.
2839 (Incremental_inputs::relocs_section_): New data member.
2840 (Incremental_inputs::reloc_count_): New data member.
2841 (Incremental_inputs_reader): New class.
2842 (Incremental_symtab_reader): New class.
2843 (Incremental_relocs_reader): New class.
2844 * layout.cc (Layout::finalize): Move finalization of incremental info
2845 and creation of incremental info sections to follow finalization of
2846 symbol table. Set offsets for postprocessing sections.
2847 (Layout::create_incremental_info_sections): Call
2848 Incremental_inputs::create_data_sections. Add incremental symtab
2849 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
2850 sections to layout after input sections.
2851 * layout.h (struct Timespec): Forward declaration.
2852 (Layout::incremental_inputs): Add const.
2853 (Layout::create_incremental_info_sections): Add parameter.
2854 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
2855 * object.cc: Include incremental.h.
2856 (Relobj::finalize_incremental_relocs): New function.
2857 (Sized_relobj::do_layout): Record input sections in incremental info.
2858 * object.h (Object::output_section): New function.
2859 (Object::output_section_offset): Moved from Relobj.
2860 (Object::get_incremental_reloc_base): New function.
2861 (Object::get_incremental_reloc_count): New function.
2862 (Object::do_output_section): New function.
2863 (Object::do_output_section_offset): Moved from Relobj.
2864 (Object::do_get_incremental_reloc_base): New function.
2865 (Object::do_get_incremental_reloc_count): New function.
2866 (Object::Object): Initialize new data members.
2867 (Relobj::output_section): Renamed do_output_section and moved to
2868 protected.
2869 (Relobj::output_section_offset): Moved to Object.
2870 (Relobj::do_get_incremental_reloc_base): New function.
2871 (Relobj::do_get_incremental_reloc_count): New function.
2872 (Relobj::allocate_incremental_reloc_counts): New function.
2873 (Relobj::count_incremental_reloc): New function.
2874 (Relobj::finalize_incremental_relocs): New function.
2875 (Relobj::next_incremental_reloc_index): New function.
2876 (Relobj::reloc_counts_): New data member.
2877 (Relobj::reloc_bases_): New data member.
2878 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
2879 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
2880 (Sized_relobj::incremental_relocs_scan): New function.
2881 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2882 (Sized_relobj::incremental_relocs_write): New function.
2883 (Sized_relobj::incremental_relocs_write_reltype): New function.
2884 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
2885 incremental link.
2886 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
2887 archives and object files elsewhere.
2888 (Add_symbols::run): Report object files here.
2889 (Finish_group::run): Report end of archive at end of group.
2890 * reloc.cc: Include layout.h, incremental.h.
2891 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
2892 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
2893 (Sized_relobj::incremental_relocs_scan): New function.
2894 (Sized_relobj::incremental_relocs_scan_reltype): New function.
2895 (Sized_relobj::do_relocate_sections): Write incremental relocations.
2896 (Sized_relobj::incremental_relocs_write): New function.
2897 (Sized_relobj::incremental_relocs_write_reltype): New function.
2898 * script.cc (read_input_script): Rewrite test for incremental link.
2899 Change call to Incremental_inputs::report_script.
2900 * symtab.h (Symbol_table::first_global_index): New function.
2901 (Symbol_table::output_count): New function.
2902
2903 2010-08-12 Doug Kwan <dougkwan@google.com>
2904
2905 * arm.cc (Target_arm::merge_object_attributes): Check command line
2906 options --no-wchar-size-warning and --no-enum-size-warning.
2907 * options.h (General_options): Add ld-compatible options
2908 --no-enum-size-warning and --no-wchar-size-warning.
2909
2910 2010-08-04 Ian Lance Taylor <iant@google.com>
2911
2912 * x86_64.cc (Target_x86_64::Scan::local): Use
2913 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
2914 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
2915 (Target_x86_64::Scan::global): Likewise.
2916 (Target_x86_64::Relocate::relocate): Likewise.
2917 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
2918 Likewise.
2919
2920 2010-08-03 Cary Coutant <ccoutant@google.com>
2921
2922 * merge.cc (Output_merge_string::do_add_input_section): Count strings
2923 to reserve space in merged_strings vector. Keep total input size
2924 for stats.
2925 (Output_merge_string::do_print_merge_stats): Print total input size.
2926 * merge.h (Output_merge_string): Add input_size_ field.
2927 * stringpool.cc (Stringpool_template::string_length): Move
2928 implementations out of Stringpool_template class and place in
2929 stringpool.h.
2930 * stringpool.h (string_length): Move out of Stringpool_template.
2931
2932 2010-08-03 Ian Lance Taylor <iant@google.com>
2933
2934 PR 11712
2935 * layout.cc (relaxation_loop_body): If address of load segment is
2936 set, adjust address to include headers if possible.
2937
2938 2010-08-03 Ian Lance Taylor <iant@google.com>
2939
2940 * version.cc (version_string): Bump to 1.10.
2941
2942 2010-08-03 Ian Lance Taylor <iant@google.com>
2943
2944 PR 11805
2945 * layout.h (enum Output_section_order): Define.
2946 (class Layout): Update declarations.
2947 * layout.cc (Layout::get_output_section): Add order parameter.
2948 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
2949 is_first_non_relro parameters. Change all callers.
2950 (Layout::choose_output_section): Likewise.
2951 (Layout::add_output_section_data): Likewise.
2952 (Layout::make_output_section): Likewise. Set order.
2953 (Layout::default_section_order): New function.
2954 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
2955 * output.cc (Output_section::Output_section): Initialize order_.
2956 Don't initialize deleted fields.
2957 (Output_segment::Output_segment): Don't initialize deleted
2958 fields.
2959 (Output_segment::add_output_section_to_load): New function
2960 replacing add_output_section. Change all callers to call this or
2961 add_output_section_to_nonload.
2962 (Output_segment::add_output_section_to_nonload): New function.
2963 (Output_segment::remove_output_section): Rewrite.
2964 (Output_segment::add_initial_output_data): Likewise.
2965 (Output_segment::has_any_data_sections): Likewise.
2966 (Output_segment::is_first_section_relro): Likewise.
2967 (Output_segment::maximum_alignment): Likewise.
2968 (Output_segment::has_dynamic_reloc): New function replacing
2969 dynamic_reloc_count. Change all callers.
2970 (Output_segment::has_dynamic_reloc_list): New function replacing
2971 dynamic_reloc_count_list. Change all callers.
2972 (Output_segment::set_section_addresses): Rewrite.
2973 (Output_segment::set_offset): Rewrite.
2974 (Output_segment::find_first_and_last_list): Remove.
2975 (Output_segment::set_tls_offsets): Rewrite.
2976 (Output_segment::first_section_load_address): Likewise.
2977 (Output_segment::output_section_count): Likewise.
2978 (Output_segment::section_with_lowest_load_address): Likewise.
2979 (Output_segment::write_section_headers): Likewise.
2980 (Output_segment::print_sections_to_map): Likewise.
2981 * output.h (class Output_data): Remove dynamic_reloc_count_
2982 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
2983 (Output_data::add_dynamic_reloc): Rewrite.
2984 (Output_data::has_dynamic_reloc): New function.
2985 (Output_data::dynamic_reloc_count): Remove.
2986 (class Output_section): Add order_ field. Remvoe is_relro_local_,
2987 is_last_relro_, is_first_non_relro_, is_interp_,
2988 is_dynamic_linker_section_ fields. Add order and set_order
2989 functions. Remove is_relro_local, set_is_relro_local,
2990 is_last_relro, set_is_last_relro, is_first_non_relro,
2991 set_is_first_non_relro functions, is_interp, set_is_interp,
2992 is_dynamic_linker_section, and set_is_dynamic_linker_section
2993 functions.
2994 (class Output_segment): Change Output_data_list from std::list to
2995 std:;vector. Add output_lists_ field. Remove output_data_ and
2996 output_bss_ fields. Update declarations.
2997
2998 2010-08-02 Ian Lance Taylor <iant@google.com>
2999
3000 * arm.cc (Target_arm::gc_process_relocs): Use typename.
3001 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
3002 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
3003
3004 2010-08-02 Ian Lance Taylor <iant@google.com>
3005
3006 PR 11855
3007 * script.cc (Script_options::Script_options): Initialize
3008 symbol_definitions_ and symbol_references_.
3009 (Script_options::add_symbol_assignment): Update
3010 symbol_definitions_ and symbol_references_.
3011 (Script_options::add_symbol_reference): New function.
3012 (script_symbol): New function.
3013 * script.h (class Script_options): Add symbol_definitions_ and
3014 symbol_references_ fields.
3015 (Script_options::referenced_const_iterator): New type.
3016 (Script_options::referenced_begin): New function.
3017 (Script_options::referenced_end): New function.
3018 (Script_options::is_referenced): New function.
3019 (Script_options::any_unreferenced): New function.
3020 * script-c.h (script_symbol): Declare.
3021 * yyscript.y (exp): Call script_symbol.
3022 * symtab.cc: Include "script.h".
3023 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
3024 Change all callers. Check symbols referenced by scripts.
3025 (Symbol_table::add_undefined_symbols_from_command_line): Add
3026 layout parameter. Change all callers.
3027 (Symbol_table::do_add_undefined_symbols_from_command_line):
3028 Likewise. Break out loop body. Check symbols referenced by
3029 scripts.
3030 (Symbol_table::add_undefined_symbol_from_command_line): New
3031 function broken out of
3032 do_add_undefined_symbols_from_command_line.
3033 * symtab.h (class Symbol_table): Update declarations.
3034 * archive.cc: Include "layout.h".
3035 (Archive::should_include_member): Add layout parameter. Change
3036 all callers. Check for symbol mentioned in expression.
3037 * archive.h (class Archive): Update declaration.
3038 * object.cc (Sized_relobj::do_should_include_member): Add layout
3039 parameter.
3040 * object.h (Object::should_include_member): Add layout parameter.
3041 Change all callers.
3042 (Object::do_should_include_member): Add layout parameter.
3043 (class Sized_relobj): Update declaration.
3044 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
3045 parameter.
3046 * dynobj.h (class Sized_dynobj): Update declaration.
3047 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
3048 layout parameter.
3049 * plugin.h (class Sized_pluginobj): Update declaration.
3050
3051 2010-08-02 Ian Lance Taylor <iant@google.com>
3052
3053 PR 11866
3054 * output.cc (Output_segment::set_offset): Search for the first and
3055 last sections rather than assuming that the list is in order.
3056 (Output_segment::find_first_and_last_list): New function.
3057 * output.h (class Output_segment): Update declarations.
3058 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
3059 (relro_strip_test_SOURCES): New variable.
3060 (relro_strip_test_DEPENDENCIES): New variable.
3061 (relro_strip_test_LDFLAGS): New variable.
3062 (relro_strip_test_LDADD): New variable.
3063 (relro_strip_test.so): New target.
3064
3065 2010-08-02 Ian Lance Taylor <iant@google.com>
3066
3067 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
3068 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
3069 (Target_i386::got_tlsdesc_section): New function.
3070 (Target_i386::got_section): Create space for GOT entries for
3071 TLSDESC relocations.
3072 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
3073 R_386_TLS_GOTDESC.
3074 (Target_i386::Scan::global): Likewise.
3075 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
3076 using TLSDESC GOT.
3077 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
3078 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
3079 (Target_x86_64::got_tlsdesc_section): New function.
3080 (Target_x86_64::got_section): Create space for GOT entries for
3081 TLSDESC relocations.
3082 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
3083 R_386_TLS_GOTDESC.
3084 (Target_x86_64::Scan::global): Likewise.
3085 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
3086 using TLSDESC GOT.
3087
3088 2010-08-02 Ian Lance Taylor <iant@google.com>
3089
3090 * testsuite/final_layout.sh: Use dc to convert from hex to
3091 decimal.
3092
3093 2010-07-29 Sriraman Tallam <tmsriram@google.com>
3094
3095 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
3096 paramter to the call to gold::gc_process_relocs.
3097 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
3098 paramter to the call to gold::gc_process_relocs.
3099 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
3100 parameter to the call to gold::gc_process_relocs.
3101 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
3102 template parameter to the call to gold::gc_process_relocs.
3103 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
3104 paramter to the call to gold::gc_process_relocs.
3105 * gc.h (get_embedded_addend_size): New function.
3106 (gc_process_relocs): Save the size of the reloc for use by ICF.
3107 * icf.cc (get_section_contents): Get the addend from the text section
3108 for SHT_REL relocation sections.
3109 * icf.h (Icf::Reloc_addend_size_info): New typedef.
3110 (Icf::Reloc_info): Add new member reloc_addend_size_info.
3111 * int_encoding.h (read_from_pointer): New overloaded function.
3112 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
3113 * testsuite/icf_sht_rel_addend_test.sh: New file.
3114 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
3115 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
3116
3117 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3118
3119 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
3120 * Makefile.in: Regenerate.
3121 * testsuite/Makefile.in: Regenerate.
3122
3123 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
3124
3125 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
3126 * gold/testsuite/debug_msg.cc: Likewise.
3127 * gold/testsuite/odr_violation1.cc
3128 * gold/testsuite/odr_violation2.cc
3129
3130 2010-07-21 Cary Coutant <ccoutant@google.com>
3131
3132 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
3133 string, and length fields.
3134 (Output_merge_string::Merged_strings_list): New type.
3135 (Output_merge_string::Merged_strings_lists): New typedef.
3136 (Output_merge_string): Replace merged_strings_ with
3137 merged_strings_lists_.
3138 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
3139 Merged_strings_list per input object and section. Don't store pointer
3140 to the string. Don't store length with each merged string entry.
3141 (Output_merge_string::finalize_merged_data): Loop over list of merged
3142 strings lists. Recompute length of each merged string.
3143
3144 2010-07-15 Cary Coutant <ccoutant@google.com>
3145
3146 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
3147 here.
3148
3149 2010-07-14 Ian Lance Taylor <iant@google.com>
3150
3151 * descriptors.cc (Descriptors::open): Report correct name in error
3152 message.
3153
3154 2010-07-13 Doug Kwan <dougkwan@google.com>
3155
3156 * arm.cc (Arm_input_section::Arm_input_section): For a
3157 SHT_ARM_EXIDX section, always keeps the input sections.
3158 (Arm_input_section::set_exidx_section_link): New method.
3159 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
3160 has_errors_ to false.
3161 (Arm_exidx_input_section::has_errors,
3162 Arm_exidx_input_section::set_has_errors): New methods.
3163 (Arm_exidx_input_section::has_errors_): New data member.
3164 (Arm_relobj::get_exidx_shndx_list): New method.
3165 (Arm_output_section::append_text_sections_to_list): Do not skip
3166 section without SHF_EXECINSTR.
3167 (Arm_output_section::fix_exidx_coverage): Skip input sections with
3168 errors.
3169 (Arm_relobj::make_exidx_input_section): Add new parameter for text
3170 section header. Make error messages more verbose. Check for
3171 a non-executable section linked to an EXIDX section.
3172 (Arm_relobj::do_read_symbols): Remove error checking, which has been
3173 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
3174 check that there is no deferred EXIDX section if we exit early.
3175 Instead of not making an EXIDX section in case of an error, make one
3176 and set the has_errors flag of it.
3177 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
3178 in a relocatable link.
3179 (Target_arm::do_relax): Look for the EXIDX output section instead of
3180 assuming that it is called .ARM.exidx.
3181 (Target_arm::fix_exidx_coverage): Add a new parameter for input
3182 section list. Do not check for SHF_EXECINSTR section flags but
3183 skip any input section with errors.
3184 * output.cc (Output_section::Output_section): Initialize
3185 always_keeps_input_sections_ to false.
3186 (Output_section::add_input_section): Check for
3187 always_keeps_input_sections_.
3188 * output.h (Output_section::always_keeps_input_sections,
3189 Output_section::set_always_keeps_input_sections): New methods.
3190 (Output_section::always_keeps_input_sections): New data member.
3191
3192 2010-07-13 Rafael Espindola <espindola@google.com>
3193
3194 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
3195 * fileread.h (Input_file): Add try_extra_search_path and find_file.
3196
3197 2010-07-13 Philip Herron <herron.philip@googlemail.com>
3198 Ian Lance Taylor <iant@google.com>
3199
3200 * output.h (Output_section_lookup_maps::add_merge_section):
3201 Correct check of whether value was inserted.
3202 (Output_section_lookup_maps::add_merge_input_section): Likewise.
3203 (Output_section_lookup_maps::add_relaxed_input_section):
3204 Likewise.
3205 * arm.cc (Target_arm::got_section): Remove used local os.
3206 * i386.cc (Target_i386::got_section): Likewise.
3207 * x86_64.cc (Target_x86_64::got_section): Likewise.
3208 * sparc.cc (Target_sparc::got_section): Likewise.
3209 (Target_sparc::relocate): Remove unused local have_got_offset.
3210 * powerpc.cc (Target_powerpc::relocate): Likewise.
3211
3212 2010-07-13 Ian Lance Taylor <iant@google.com>
3213
3214 * compressed_output.cc (zlib_decompress): Fix signature in
3215 !HAVE_ZLIB_H case.
3216
3217 * archive.cc (Archive::include_member): Unlock an external member
3218 of a thin archive. Don't bother to delete an object we know is
3219 NULL.
3220
3221 2010-07-12 Cary Coutant <ccoutant@google.com>
3222
3223 * compressed_output.cc (zlib_decompress): New function.
3224 (get_uncompressed_size): New function.
3225 (decompress_input_section): New function.
3226 * compressed_output.h (get_uncompressed_size): New function.
3227 (decompress_input_section): New function.
3228 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
3229 Handle compressed debug sections.
3230 * layout.cc (is_compressed_debug_section): New function.
3231 (Layout::output_section_name): Map compressed section names to
3232 canonical names.
3233 * layout.h (is_compressed_debug_section): New function.
3234 (is_debug_info_section): Recognize compressed debug sections.
3235 * merge.cc: Include compressed_output.h.
3236 (Output_merge_data::do_add_input_section): Handle compressed
3237 debug sections.
3238 (Output_merge_string::do_add_input_section): Handle compressed
3239 debug sections.
3240 * object.cc: Include compressed_output.h.
3241 (Sized_relobj::Sized_relobj): Initialize new data members.
3242 (build_compressed_section_map): New function.
3243 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
3244 * object.h (Object::section_is_compressed): New method.
3245 (Object::do_section_is_compressed): New method.
3246 (Sized_relobj::Compressed_section_map): New type.
3247 (Sized_relobj::do_section_is_compressed): New method.
3248 (Sized_relobj::compressed_sections_): New data member.
3249 * output.cc (Output_section::add_input_section): Handle compressed
3250 debug sections.
3251 * reloc.cc: Include compressed_output.h.
3252 (Sized_relobj::write_sections): Handle compressed debug sections.
3253
3254 2010-07-08 Cary Coutant <ccoutant@google.com>
3255
3256 * resolve.cc (Symbol_table::resolve): Remember whether undef was
3257 weak when resolving to a dynamic def.
3258 (Symbol_table::should_override): Add adjust_dyndef flag; set it
3259 for weak undef/dynamic def cases. Adjust callers.
3260 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
3261 undef_binding_weak_.
3262 (Symbol_table::sized_write_globals): Adjust symbol binding.
3263 (Symbol_table::sized_write_symbol): Add binding parameter.
3264 * symtab.h (Symbol::set_undef_binding): New method.
3265 (Symbol::is_undef_binding_weak): New method.
3266 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
3267 (Symbol_table::should_override): Add new parameter.
3268 (Symbol_table::sized_write_symbol): Add new parameter.
3269
3270 * testsuite/weak_undef_file1.cc: Add new test case.
3271 * testsuite/weak_undef_file2.cc: Fix header comment.
3272 * testsuite/weak_undef_test.cc: Add new test case.
3273
3274 2010-06-29 Doug Kwan <dougkwan@google.com>
3275
3276 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
3277 Initialize USE_SYMBOL_.
3278 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
3279 definition.
3280 (Arm_reloc_property::uses_symbol_): New data member declaration.
3281 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
3282 uses symbol value and symbol is undefined but not weakly undefined.
3283
3284 2010-06-28 Rafael Espindola <espindola@google.com>
3285
3286 * plugin.cc (Plugin::load): Use dlerror.
3287
3288 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
3289
3290 * symtab.cc (detect_odr_violations): When reporting an ODR
3291 violation, report an object where the symbol is defined.
3292
3293 2010-06-25 Doug Kwan <dougkwan@google.com>
3294
3295 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
3296 (Target_arm::section_may_have_icf_unsafe_pointers): New method
3297 definition.
3298 (Target_arm::Scan::local_reloc_may_be_function_pointer,
3299 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
3300 target hook to detect function points.
3301 (Target_arm::Scan::possible_function_pointer_reloc): New method.
3302 * icf.h (Icf::check_section_for_function_pointers): Change type of
3303 parameter SECTION_NAME to const reference to std::string. Use
3304 target hook to determine if section may have unsafe pointers.
3305 * target.h (Target::section_may_have_icf_unsafe_pointers): New
3306 method definition.
3307
3308 2010-06-21 Rafael Espindola <espindola@google.com>
3309
3310 * fileread.cc (Input_file::find_fie): New
3311 (Input_file::open): Use Input_file::find_fie.
3312 * fileread.h (Input_file::find_fie): New
3313 * plugin.cc (set_extra_library_path): New.
3314 (Plugin::load): Add set_extra_library_path to the transfer vector.
3315 (Plugin_manager::set_extra_library_path): New.
3316 (Plugin_manager::add_input_file): Use the extra search path if set.
3317 (set_extra_library_path(): New.
3318 * plugin.h (Plugin_manager): Add set_extra_library_path and
3319 extra_search_path_.
3320
3321 2010-06-19 Cary Coutant <ccoutant@google.com>
3322
3323 * layout.cc (gdb_sections): Add .debug_types.
3324 (lines_only_debug_sections): Likewise.
3325
3326 2010-06-18 Rafael Espindola <espindola@google.com>
3327
3328 * plugin.cc (add_input_file,add_input_library)
3329 (Plugin_manager::add_input_file): Make filename arguments const.
3330 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
3331 const.
3332
3333 2010-06-16 Doug Kwan <dougkwan@google.com>
3334
3335 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
3336 .ARM.attributes section if we have not merged any input
3337 attributes sections.
3338
3339 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3340
3341 * arm.cc: Allow combining objects with no EABI version
3342 information.
3343
3344 2010-06-15 Rafael Espindola <espindola@google.com>
3345
3346 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
3347
3348 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3349
3350 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
3351 (struct iovec): Correct !HAVE_READV definition.
3352
3353 2010-06-10 Cary Coutant <ccoutant@google.com>
3354
3355 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
3356 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
3357 reloc sections.
3358 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
3359
3360 PR 11683
3361 * symtab.h (Symbol::is_placeholder): New member function.
3362 * target-reloc.h (relocate_section): Check for placeholder symbols.
3363
3364 * testsuite/Makefile.am (plugin_test_8): New test.
3365 (plugin_test_9): New test.
3366 * testsuite/Makefile.in: Regenerate.
3367
3368 2010-06-09 Nick Clifton <nickc@redhat.com>
3369
3370 * yyscript.y (input_list_element): Allow strings prefixed with
3371 the '-' character. Treat these as libraries.
3372 * script.cc (script_add_library): New function. Adds a library
3373 specified by "-l<name>" found in an input script.
3374 * script-c.h: Add prototype for script_add_library.
3375
3376 2010-06-07 Doug Kwan <dougkwan@google.com>
3377
3378 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
3379 Restrict stub-group size to be within long conditional branch
3380 range when working around cortex-A8 erratum.
3381
3382 2010-06-07 Damien Diederen <dd@crosstwine.com>
3383
3384 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
3385 #ifdef typo.
3386
3387 2010-06-03 Sriraman Tallam <tmsriram@google.com>
3388
3389 PR gold/11658
3390 * output.cc
3391 (Output_section::Input_section_sort_entry::compare_section_ordering):
3392 Change to return non-zero correctly.
3393 (Output_section::Input_section_sort_section_order_index_compare
3394 ::operator()): Change to fix ambiguity in comparisons.
3395
3396 2010-06-01 Sriraman Tallam <tmsriram@google.com>
3397
3398 * gold.h (is_wildcard_string): New function.
3399 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
3400 (Layout::layout_eh_frame): Ditto.
3401 (Layout::find_section_order_index): New method.
3402 (Layout::read_layout_from_file): New method.
3403 * layout.h (Layout::find_section_order_index): New method.
3404 (Layout::read_layout_from_file): New method.
3405 (Layout::input_section_position_): New private member.
3406 (Layout::input_section_glob_): New private member.
3407 * main.cc (main): Call read_layout_from_file here.
3408 * options.h (--section-ordering-file): New option.
3409 * output.cc (Output_section::input_section_order_specified_): New
3410 member.
3411 (Output_section::Output_section): Initialize new member.
3412 (Output_section::add_input_section): Add new parameter.
3413 Keep input sections when --section-ordering-file is used.
3414 (Output_section::set_final_data_size): Sort input sections when
3415 section ordering file is specified.
3416 (Output_section::Input_section_sort_entry): Add new parameter.
3417 Check sorting type.
3418 (Output_section::Input_section_sort_entry::compare_section_ordering):
3419 New method.
3420 (Output_section::Input_section_sort_compare::operator()): Change to
3421 consider section_order_index.
3422 (Output_section::Input_section_sort_init_fini_compare::operator()):
3423 Change to consider section_order_index.
3424 (Output_section::Input_section_sort_section_order_index_compare
3425 ::operator()): New method.
3426 (Output_section::sort_attached_input_sections): Change to sort
3427 according to section order when specified.
3428 (Output_section::add_input_section<32, true>): Add new parameter.
3429 (Output_section::add_input_section<64, true>): Add new parameter.
3430 (Output_section::add_input_section<32, false>): Add new parameter.
3431 (Output_section::add_input_section<64, false>): Add new parameter.
3432 * output.h (Output_section::add_input_section): Add new parameter.
3433 (Output_section::input_section_order_specified): New
3434 method.
3435 (Output_section::set_input_section_order_specified): New method.
3436 (Input_section::Input_section): Initialize section_order_index_.
3437 (Input_section::section_order_index): New method.
3438 (Input_section::set_section_order_index): New method.
3439 (Input_section::section_order_index_): New member.
3440 (Input_section::Input_section_sort_section_order_index_compare): New
3441 struct.
3442 (Output_section::input_section_order_specified_): New member.
3443 * script-sections.cc (is_wildcard_string): Delete and move modified
3444 method to gold.h.
3445 (Output_section_element_input::Output_section_element_input): Modify
3446 call to is_wildcard_string.
3447 (Output_section_element_input::Input_section_pattern
3448 ::Input_section_pattern): Ditto.
3449 (Output_section_element_input::Output_section_element_input): Ditto.
3450 * testsuite/Makefile.am (final_layout): New test case.
3451 * testsuite/Makefile.in: Regenerate.
3452 * testsuite/final_layout.cc: New file.
3453 * testsuite/final_layout.sh: New file.
3454
3455 2010-06-01 Rafael Espindola <espindola@google.com>
3456
3457 * plugin.cc (Plugin::load): Pass the output name to the plugin.
3458
3459 2010-06-01 Rafael Espindola <espindola@google.com>
3460
3461 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
3462 visibility of symbols.
3463
3464 2010-05-27 Doug Kwan <dougkwan@google.com>
3465
3466 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
3467 from start of output section instead of address for a local symbol
3468 in a merged or relaxed section when doing a relocatable link.
3469
3470 2010-05-26 Rafael Espindola <espindola@google.com>
3471
3472 PR 11604
3473 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
3474 adding sections the garbage collector removed.
3475 * gold/testsuite/Makefile.am: Add test.
3476 * gold/testsuite/Makefile.in: Regenerate.
3477 * gold/testsuite/plugin_test_7.sh: New.
3478 * gold/testsuite/plugin_test_7_1.c: New.
3479 * gold/testsuite/plugin_test_7_2.c: New.
3480
3481 2010-05-26 Rafael Espindola <espindola@google.com>
3482
3483 * script-sections.cc (Output_section_definition::set_section_addresses):
3484 Check for --section-start.
3485
3486 2010-05-26 Doug Kwan <dougkwan@google.com>
3487
3488 * arm.cc (Arm_scan_relocatable_relocs): New class.
3489 (Target_arm::relocate_special_relocatable): New method.
3490 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
3491 (Arm_relocate_functions::thumb_branch_common): Same.
3492 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
3493 instead of Default_scan_relocatable_relocs.
3494 * target-reloc.h (relocate_for_relocatable): Let target handle
3495 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
3496 * target.h (Sized_target::relocate_special_relocatable): New method.
3497
3498 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
3499
3500 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
3501
3502 2010-05-23 Doug Kwan <dougkwan@google.com>
3503
3504 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
3505 instead of a cast.
3506 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
3507 with a direct branch, not a conditional branch, to a stub.
3508 * merge.cc (Output_merge_base::record_input_section): New method
3509 defintion.
3510 (Output_merge_data::do_add_input_section): Record input section if
3511 keeps-input-sections flag is set.
3512 (Output_merge_string::do_add_input_section): Ditto.
3513 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
3514 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
3515 INPUT_SECTIONS_.
3516 (Output_merge_base::keeps_input_sections,
3517 Output_merge_base::set_keeps_input_sections,
3518 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
3519 method definitions.
3520 (Output_merge_base::Input_sections): New type declaration.
3521 (Output_merge_base::input_sections_begin,
3522 Output_merge_base::input_sections_end,
3523 Output_merge_base::do_set_keeps_input_sections): New method definitions.
3524 (Output_merge_base::bool keeps_input_sections_,
3525 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
3526 Output_merge_base::input_sections_): New data members.
3527 (Output_merge_data::do_set_keeps_input_sections): New method
3528 defintion.
3529 (Output_merge_string::do_set_keeps_input_sections): Ditto.
3530 * output.cc (Output_section::Input_section::relobj): Move method
3531 defintion from class declaration to here and handle merge sections.
3532 (Output_section::Input_section::shndx): Ditto.
3533 (Output_section::Output_section): Remove initializations of removed
3534 data members and initialize new data member LOOKUP_MAPS_.
3535 (Output_section::add_input_section): Set keeps-input-sections flag
3536 for a newly created merge output section as appropriate. Adjust code
3537 to use Output_section_lookup_maps class.
3538 (Output_section::add_relaxed_input_section): Adjst code for lookup
3539 maps code refactoring.
3540 (Output_section::add_merge_input_section): Add a new parameter
3541 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
3542 class. If adding input section to a newly created merge output
3543 section fails, remove the new merge section.
3544 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
3545 Adjust code for use of the Output_section_lookup_maps class.
3546 (Output_section::find_merge_section): Ditto.
3547 (Output_section::build_lookup_maps): New method defintion.
3548 (Output_section::find_relaxed_input_section): Adjust code to use
3549 Output_section_lookup_maps class.
3550 (Output_section::get_input_sections): Export merge sections. Adjust
3551 code to use Output_section_lookup_maps class.
3552 (Output_section:::add_script_input_section): Adjust code to use
3553 Output_section_lookup_maps class. Update lookup maps for merge
3554 sections also.
3555 (Output_section::discard_states): Use Output_section_lookup_maps.
3556 (Output_section::restore_states): Same.
3557 * output.h (Merge_section_properties): Move class defintion out of
3558 Output_section.
3559 (Output_section_lookup_maps): New class.
3560 (Output_section::Input_section::is_merge_section): New method
3561 defintion.
3562 (Output_section::Input_section::relobj): Move defintion out of class
3563 defintion. Declare method only.
3564 (Output_section::Input_section::shndx): Ditto.
3565 (Output_section::Input_section::output_merge_base): New method defintion.
3566 (Output_section::Input_section::u2_.pomb): New union field.
3567 (Output_section::Merge_section_by_properties_map,
3568 Output_section::Output_section_data_by_input_section_map,
3569 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
3570 Remove types.
3571 (Output_section::add_merge_input_section): Add new parameter
3572 KEEPS_INPUT_SECTIONS.
3573 (Output_section::build_lookup_maps): New method declaration.
3574 (Output_section::merge_section_map_,
3575 Output_section::merge_section_by_properties_map_,
3576 Output_section::relaxed_input_section_map_,
3577 Output_section::is_relaxed_input_section_map_valid_): Remove data
3578 members.
3579 (Output_section::lookup_maps_): New data member.
3580
3581 2010-05-21 Doug Kwan <dougkwan@google.com>
3582
3583 PR gold/11619
3584 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
3585 avoid a compilation error.
3586
3587 2010-05-19 Rafael Espindola <espindola@google.com>
3588
3589 * script-sections.cc (Output_section_definition::allocate_to_segment):
3590 Update the phdrs_list even when the output section is NULL.
3591 * testsuite/Makefile.am: Add test.
3592 * testsuite/Makefile.in: Regenerate.
3593 * testsuite/script_test_9.cc: New.
3594 * testsuite/script_test_9.sh: New.
3595 * testsuite/script_test_9.t: New.
3596
3597 2010-05-19 Doug Kwan <dougkwan@google.com>
3598
3599 * arm.cc (Arm_input_section::original_size): New method.
3600 (Arm_input_section::do_addralign): Add a cast.
3601 (Arm_input_section::do_output_offset): Remove static cast.
3602 (Arm_input_section::original_addralign,
3603 Arm_input_section::original_size_): Change type to uint32_t.
3604 (Arm_input_section::init): Add safe casts for section alignment
3605 and size.
3606 (Arm_input_section::set_final_data_size): Do not set address and
3607 offset of stub table.
3608 (Arm_output_section::fix_exidx_coverage): Change use of of
3609 Output_section::Simple_input_section to that of
3610 Output_section::Input_section.
3611 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
3612 except for the first pass.
3613 * output.cc (Output_section::get_input_sections): Change type of
3614 input_sections to std::list<Input_section>.
3615 (Output_section::add_script_input_section): Rename from
3616 Output_section::add_simple_input_section. Change type of SIS
3617 parameter from Simple_input_section to Input_section.
3618 * output.h (Output_section::Simple_input_section): Remove class.
3619 (Output_section::Input_section): Change class visibility to public.
3620 (Output_section::Input_section::addralign): Use stored alignments
3621 for special input sections if set.
3622 (Output_section::Input_section::set_addralign): New method.
3623 (Output_section::get_input_sections): Change parameter type from
3624 list of Simple_input_section to list of Input_section.
3625 (Output_section::add_script_input_section): Rename from
3626 Output_section::add_simple_input_section. Change first parameter's
3627 type from Simple_input_section to Input_section and remove the
3628 second and third parameters.
3629 * script-sections.cc (Input_section::Input_section_list): Change
3630 type to list of Output_section::Input_section/
3631 (Input_section_info::Input_section_info): Change parameter type of
3632 INPUT_SECTION to Output_section::Input_section.
3633 (Input_section_info::input_section): Change return type.
3634 (Input_section_info::input_section_): Change type to
3635 Output_section::Input_section.
3636 (Output_section_element_input::set_section_addresses): Adjust code
3637 to use Output_section::Input_section instead of
3638 Output_section::Simple_input_section. Adjust code for renaming
3639 of Output_section::add_simple_input_section.
3640 (Orphan_output_section::set_section_addresses): Ditto.
3641
3642 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3643
3644 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
3645 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
3646
3647 2010-05-18 Rafael Espindola <espindola@google.com>
3648
3649 * options.cc (General_options::finalize): Handle -nostdlib.
3650 * options.h (nostdlib): New option.
3651 * script.cc (script_add_search_dir): Handle -nostdlib.
3652
3653 2010-05-12 Doug Kwan <dougkwan@google.com>
3654
3655 * arm.cc (Target_arm::do_finalize_sections): Create an empty
3656 attributes section only if there no attributes section after merging.
3657 (Target_arm::merge_object_attributes): Move value of
3658 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
3659 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
3660 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
3661 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
3662 and arm_attr_merge_7.stdout.
3663 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
3664 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
3665 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
3666 arm_attr_merge_7b.o): New rules.
3667 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
3668 arm_attr_merge_7
3669 * testsuite/Makefile.in: Regenerate.
3670 * testsuite/arm_attr_merge.sh: New file.
3671 * testsuite/arm_attr_merge_[67][ab].s: Same.
3672
3673 2010-05-05 Nick Clifton <nickc@redhat.com>
3674
3675 * po/es.po: Updated Spanish translation.
3676
3677 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3678
3679 * Makefile.am (install-exec-local): Properly install gold as
3680 default cross linker.
3681 * Makefile.in: Regenerated.
3682
3683 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
3684 Nick Clifton <nickc@redhat.com>
3685
3686 * configure.ac (install_as_default): Define and set to false
3687 unless --enable-gold or --enable-gold=both/gold has been
3688 specified.
3689 * configure: Regenerate.
3690
3691 * Makefile.am (install-exec-local): Install the executable as
3692 'ld.gold'. If install_as_default is true then also install it as
3693 'ld'.
3694 * Makefile.in: Regenerated.
3695
3696 2010-04-24 Ian Lance Taylor <iant@google.com>
3697
3698 * layout.cc (Layout::layout_reloc): In relocatable link don't
3699 combine reloc sections for grouped sections.
3700
3701 2010-04-23 Sriraman Tallam <tmsriram@google.com>
3702
3703 * gc.h (gc_process_relocs): Pass information on relocs pointing to
3704 sections that are not ordinary to icf.
3705 * icf.cc (get_section_contents): Handle relocation pointing to section
3706 with no object or shndx information.
3707 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
3708 * testsuite/Makefile.in: Regenerate.
3709 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
3710 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
3711
3712 2010-04-22 Ian Lance Taylor <iant@google.com>
3713
3714 * expression.cc (Expression::Expression_eval_info): Add
3715 result_alignment_pointer field.
3716 (Expression::eval_with_dot): Add result_alignment_pointer
3717 parameter. Change all callers.
3718 (Expression::eval_maybe_dot): Likewise.
3719 (class Binary_expression): Add alignment_pointer parameter to
3720 left_value and right_value. Change all callers.
3721 (BINARY_EXPRESSION): Set result alignment.
3722 (class Trinary_expression): Add alignment_pointer parameter to
3723 arg2_value and arg3_value. Change all callers.
3724 (Trinary_cond::value): Set result alignment.
3725 (Max_expression::value, Min_expression::value): Likewise.
3726 (Align_expression::value): Likewise.
3727 * script-sections.cc (class Sections_element): Add dot_alignment
3728 parameter to set_section_addresses virtual function. Update
3729 instantiations.
3730 (class Output_section_element): Likewise.
3731 (Script_sections::create_segments): Add dot_alignment parameter.
3732 Change all callers.
3733 (Script_sections::create_segments_from_phdrs_clause): Likewise.
3734 (Script_sections::set_phdrs_clause_addresses): Likewise.
3735 * script-sections.h: Update declarations.
3736 * script.h: Update declarations.
3737 * output.h (Output_segment::set_minimum_p_align): Don't decrease
3738 min_p_align.
3739 * testsuite/script_test_3.t: Set large alignment.
3740 * testsuite/script_test_3.sh: Make sure that at least one LOAD
3741 segment has expected alignment.
3742
3743 2010-04-22 Nick Clifton <nickc@redhat.com>
3744
3745 * po/gold.pot: Updated by the Translation project.
3746 * po/vi.po: Updated Vietnamese translation.
3747
3748 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
3749
3750 * testsuite/Makefile.am (check_PROGRAMS): Add
3751 icf_virtual_function_folding_test.
3752 * testsuite/Makefile.in: Regenerated.
3753
3754 2010-04-15 Andrew Haley <aph@redhat.com>
3755
3756 * options.h (merge_exidx_entries): New option.
3757 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
3758 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
3759 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
3760 (Target_arm::merge_exidx_entries): New function.
3761 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
3762 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
3763 to Arm_exidx_fixup constructor.
3764 Add new arg, merge_exidx_entries.
3765 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
3766 Arm_output_section::fix_exidx_coverage.
3767
3768 2010-04-18 Sriraman Tallam <tmsriram@google.com>
3769
3770 * icf.cc (get_section_contents): Check for preemptible functions.
3771 Ignore addend when appropriate.
3772 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
3773 section folded.
3774 (add_from_relobj): Check for section folded.
3775 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
3776 * symtab.h (should_add_dynsym_entry): Add new parameter.
3777 * target-reloc.h (scan_relocs): Check for section folded.
3778 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
3779 Check reloc types for function pointers in shared objects.
3780 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
3781 case.
3782 (icf_preemptible_functions_test): New test case.
3783 (icf_string_merge_test): New test case.
3784 * testsuite.Makefile.in: Regenerate.
3785 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
3786 bar_glob. Refactor code.
3787 * testsuite/icf_preemptible_functions_test.cc: New file.
3788 * testsuite/icf_preemptible_functions_test.sh: New file.
3789 * testsuite/icf_string_merge_test.cc: New file.
3790 * testsuite/icf_string_merge_test.sh: New file.
3791 * testsuite/icf_virtual_function_folding_test.cc: New file.
3792 * testsuite/icf_virtual_function_folding_test.sh: New file.
3793
3794 2010-04-14 Doug Kwan <dougkwan@google.com>
3795
3796 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
3797 for local symbol recounting if we remove a section due to ICF.
3798 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
3799 there are no regular objects in input.
3800
3801 2010-04-13 Doug Kwan <dougkwan@google.com>
3802
3803 * arm.cc (Arm_input_section::set_final_data_size): Compute
3804 accurate final data size instead of using current data size.
3805
3806 2010-04-09 Doug Kwan <dougkwan@google.com>
3807
3808 * layout.cc (Layout::choose_output_section): Handle script section
3809 types.
3810 (Layout::make_output_section_for_script): Add section type parameter.
3811 Handle script section types.
3812 * layout.h (Layout::make_output_section_for_script): Add section
3813 type parameter.
3814 * output.cc (Output_section::Output_section): Initialize data member
3815 is_noload_.
3816 (Output_section::do_reset_address_and_file_offset): Do not set address
3817 to 0 if section is a NOLOAD section.
3818 * output.h (Output_section::is_noload): New method.
3819 (Output_section::set_is_noload): Ditto.
3820 (Output_section::is_noload_): New data member.
3821 * script-c.h (Script_section_type): New enum type.
3822 (struct Parser_output_section_header): Add new file section_type.
3823 * script-sections.cc (Sections_element::output_section_name): Add
3824 parameter for returning script section type.
3825 (Output_section_definition::output_section_name): Ditto.
3826 (Output_section_definition::section_type)P; New method.
3827 (Output_section_definiton::script_section_type_name): Ditto.
3828 (Output_section_definition::script_section_type_): New data member.
3829 (Output_section_definition::Output_section_definition): Initialize
3830 data member Output_section_definition::script_section_type_.
3831 (Output_section_definition::create_sections): Pass script section type
3832 to Layout::make_output_section_for_script.
3833 (Output_section_definition::output_section_name): Return script
3834 section type to caller.
3835 (Output_section_definition::set_section_address): Do not advance
3836 dot value and load address if section type is NOLOAD. Set address
3837 of NOLOAD sections regardless of section flags.
3838 (Output_section_definition::print): Print section type if it is
3839 not SCRIPT_SECTION_TYPE_NONE.
3840 (Output_section_definition::section_type): New method.
3841 (Output_section_definition::script_section_type_name): Ditto.
3842 (Script_sections::output_section_name): Add new parameter
3843 PSECTION_TYPE for returning script section type. Pass it to
3844 section elements. Handle discard sections.
3845 (Sort_output_sections::operator()): Handle NOLOAD sections.
3846 * script-sections.h (Script_sections::Section_type): New enum type.
3847 (Script_sections::output_section_name): Add a new parameter for
3848 returning script section type.
3849 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
3850 INFO and NOLOAD.
3851 * yyscript.y (union): Add new field SECTION_TYPE.
3852 (COPY, DSECT, INFO, NOLOAD): New tokens.
3853 (opt_address_and_section_type): Change type to output_section_header.
3854 (section_type): New non-terminal
3855 (section_header): Handle section type.
3856 (opt_address_and_section_type): Return section type value.
3857
3858 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
3859
3860 * testsuite/plugin_common_test_1.c (foo): Add prototype.
3861 * testsuite/plugin_common_test_2.c (foo): Likewise.
3862
3863 2010-04-08 Doug Kwan <dougkwan@google.com>
3864
3865 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
3866 Output_merge_data.
3867 * output.cc (Output_section::add_merge_input_section): Simplify
3868 code and return status of Output_merge_base::add_input_section.
3869 Update merge section map only if Output_merge_base::add_input_section
3870 returns true.
3871
3872 2010-04-07 Doug Kwan <dougkwan@google.com>
3873
3874 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
3875 if section is marked as containing instructions but has no mapping
3876 symbols.
3877 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
3878 correct section index.
3879 (Arm_relobj::find_linked_text_section): Ditto.
3880
3881 2010-04-07 Cary Coutant <ccoutant@google.com>
3882
3883 * archive.cc (include_member): Destroy Read_symbols_data object before
3884 releasing file.
3885 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
3886 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
3887 (Read_symbols_data::~Read_symbols_data) New destructor.
3888 (Section_relocs::Section_relocs) New constructor.
3889 (Section_relocs::~Section_relocs) New destructor.
3890 (Read_relocs_data::Read_relocs_data) New constructor.
3891 (Read_relocs_data::~Read_relocs_data) New destructor.
3892 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
3893 pointers to NULL after deleting.
3894
3895 2010-04-07 Doug Kwan <dougkwan@google.com>
3896
3897 * arm.cc: Replace "endianity" with "endianness" in comments.
3898 (Arm_exidx_cantunwind): Ditto.
3899 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
3900 (Arm_relobj::merge_flags_and_attributes): New method.
3901 (Arm_relobj::merge_flags_and_attributes_): New data member.
3902 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
3903 (Arm_relobj::scan_sections_for_stubs): Ditto.
3904 (Arm_relobj::do_read_symbols): Check to see if we really want to
3905 merge processor-specific flags and attributes. Exit early if
3906 an object is empty except for section names and the undefined symbol.
3907 (Target_arm::do_finalize_sections): Move check for ELF format to
3908 Arm_relobj::do_read_symbols. Merge processor specific flags and
3909 attributes from a regular object only when we have determined that
3910 it is aapropriate. Do not create an .ARM.attributes section in
3911 output if there is no regular input object.
3912 (Target_arm::merge_processor_specific_flags): Check
3913 --warn-mismatch before printing any error.
3914 (Target_arm::merge_object_attributes): Ditto.
3915 * gold.cc (queue_middle_tasks): Handle the case in which there is
3916 no regular object in input.
3917 * options.cc (General_options::parse_EB): New method.
3918 (General_options::parse_EL): Same.
3919 (General_options::General_options): Initialize endianness_.
3920 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
3921 New options.
3922 (General_options::Endianness): New enum.
3923 (General_options::endianness): New method.
3924 (General_options::endianness_): New data member.
3925 * parameters.cc (Parameters::set_options): Check target endianness.
3926 (Parameters::set_target_once): Ditto.
3927 (Parameters::check_target_endianness): New method.
3928 (parameters_force_valid_target): If either -EL or -EB is specified,
3929 use it to define endianness of default target.
3930 * parameters.h (Parameters::check_target_endianness): New method
3931 declaration.
3932 * target.h (class Target): Change "endianity" to "endianness"
3933 in comments.
3934
3935 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3936
3937 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
3938 * configure: Regenerate.
3939 * Makefile.in: Regenerate.
3940 * testsuite/Makefile.in: Regenerate.
3941
3942 2010-04-06 Cary Coutant <ccoutant@google.com>
3943
3944 gcc PR lto/42757
3945 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
3946 prevailing definitions of common symbols.
3947 * testsuite/plugin_test_6.sh: New test case.
3948 * testsuite/plugin_common_test_1.c: New test case.
3949 * testsuite/plugin_common_test_2.c: New test case.
3950 * testsuite/Makefile.am (plugin_test_6): New test case.
3951 * testsuite/Makefile.in: Regenerate.
3952
3953 2010-04-06 Nick Clifton <nickc@redhat.com>
3954
3955 * po/vi.po: New Vietnamese translation.
3956
3957 2010-03-30 Doug Kwan <dougkwan@google.com>
3958
3959 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
3960
3961 2010-03-25 Doug Kwan <dougkwan@google.com>
3962
3963 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
3964 to avoid a conversion warning on a 32-bit host.
3965
3966 2010-03-24 Ian Lance Taylor <iant@google.com>
3967
3968 * testsuite/script_test_3.t: Add a TLS segment.
3969 * testsuite/Makefile.am (check_PROGRAMS): Add
3970 tls_phdrs_script_test.
3971 (tls_phdrs_script_test_SOURCES): Define.
3972 (tls_phdrs_script_test_DEPENDENCIES): Define.
3973 (tls_phdrs_script_test_LDFLAGS): Define.
3974 (tls_phdrs_script_test_LDADD): Define.
3975 * testsuite/Makefile.in: Rebuild.
3976
3977 2010-03-23 Cary Coutant <ccoutant@google.com>
3978
3979 * fileread.cc (find_or_make_view): Fix comment.
3980
3981 2010-03-23 Ian Lance Taylor <iant@google.com>
3982
3983 * script-sections.cc (class Orphan_section_placement): Define
3984 PLACE_TLS and PLACE_TLS_BSS.
3985 (Orphan_section_placement::Orphan_section_placement): Initialize
3986 new places.
3987 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
3988 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
3989 (tls_script_test_SOURCES): Define.
3990 (tls_script_test_DEPENDENCIES): Define.
3991 (tls_script_test_LDFLAGS): Define.
3992 (tls_script_test_LDADD): Define.
3993 * testsuite/Makefile.in: Rebuild.
3994
3995 2010-03-22 Doug Kwan <dougkwan@google.com>
3996
3997 * arm.cc (Arm_relocate_functions::abs8,
3998 Arm_relocate_functions::abs16): Use correct check for overflow
3999 specified in the ARM ELF specs.
4000 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
4001 target of a BLX instruction specially.
4002 (Reloc_stub::stub_type_for_reloc): Ditto.
4003 (Relocate::relocate): Use symbolic names instead of numeric relocation
4004 codes to report error.
4005 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
4006 workaround.
4007 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
4008 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
4009 thumb2_blx_out_of_range.stdout
4010 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
4011 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
4012 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
4013 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
4014 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
4015 thumb2_blx_in_range, thumb2_blx_in_range.o,
4016 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
4017 thumb2_blx_out_of_range.o): New rules.
4018 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
4019 thumb2_blx_in_range and thumb2_blx_out_of_range.
4020 * testsuite/Makefile.in: Regenerate.
4021 * arm_branch_in_range.sh: Add tests for THUMB BLX.
4022 * testsuite/thumb_blx_in_range.s: New file.
4023 * testsuite/thumb_blx_out_of_range.s: New file.
4024
4025 2010-03-22 Rafael Espindola <espindola@google.com>
4026
4027 * archive.cc (Should_include): Move to archive.h.
4028 (should_include_member): Make it a member of Archive.
4029 (Lib_group): New.
4030 (Add_lib_group_symbols): New.
4031 * archive.h: Include options.h.
4032 (Archive_member): Moved from Archive.
4033 (Should_include): Moved from archive.cc.
4034 (Lib_group): New.
4035 (Add_lib_group_symbols): New.
4036 * dynobj.cc (do_should_include_member): New.
4037 * dynobj.h (do_should_include_member): New.
4038 * gold.cc (queue_initial_tasks): Update call to queue.
4039 * main.cc (main): Print lib group stats.
4040 * object.cc (do_should_include_member): New.
4041 * object.h: Include archive.h.
4042 (Object::should_include_member): New.
4043 (Object::do_should_include_member): New.
4044 (Sized_relobj::do_should_include_member): New.
4045 * options.cc (General_options::parse_start_lib): New.
4046 (General_options::parse_end_lib): New.
4047 (Input_arguments::add_file): Handle lib groups.
4048 (Input_arguments::start_group): Check we are not in a lib.
4049 (Input_arguments::start_lib): New.
4050 (Input_arguments::end_lib): New.
4051 * options.h (General_options): Add start_lib and end_lib.
4052 (Input_argument::lib_): New.
4053 (Input_argument::lib): New.
4054 (Input_argument::is_lib): New.
4055 (Input_file_lib): New.
4056 (Input_arguments::in_lib_): New.
4057 (Input_arguments::in_lib): New.
4058 (Input_arguments::start_lib): New.
4059 (Input_arguments::end_lib_): New.
4060 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
4061 in unused members as preempted.
4062 (Sized_pluginobj::do_should_include_member): New.
4063 * plugin.h (Sized_pluginobj::do_should_include_member): New.
4064 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
4065 return the blocker.
4066 (Read_symbols::do_whole_lib_group): New.
4067 (Read_symbols::do_lib_group): New.
4068 (Read_symbols::do_read_symbols): Handle lib groups.
4069 (Read_symbols::get_name): Handle lib groups.
4070 * readsyms.h (Read_symbols): Add an archive member pointer.
4071 (Read_symbols::do_whole_lib_group): New.
4072 (Read_symbols::do_lib_group): New.
4073 (Read_symbols::member_): New.
4074 * script.cc (read_input_script): Update call to queue_soon.
4075
4076 2010-03-19 Doug Kwan <dougkwan@google.com>
4077
4078 * arm.cc (Stub_table::Stub_table): Initialize new data members
4079 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4080 (Stub_table::add_reloc_stub): Assign stub offset and update
4081 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
4082 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
4083 New data members.
4084 (Stub_table::update_data_size_and_addralign): Use
4085 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
4086 instead of going over all reloc stubs.
4087 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
4088 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4089 Stringpool_template::offset_ to size of Stringpool_char.
4090 (Stringpool_template::new_key_offset): Remove code to initialize
4091 Stringpool_template::offset_.
4092 * stringpool.h (Stringpool_template::set_no_zero_null): Set
4093 Stringpool_template::offset_ to zero.
4094
4095 2010-03-15 Doug Kwan <dougkwan@google.com>
4096
4097 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
4098 offset_.
4099 (Stringpool_template::new_key_offset): New method.
4100 (Stringpool_template::add_string): Assign offsets when adding new
4101 strings.
4102 (Stringpool_template::set_string_offsets): Do not set string offsets
4103 when not optimizing.
4104 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
4105 member size_.
4106 (Chunked_vector::clear): Clear size_.
4107 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
4108 (Chunked_vector::size): Return size_.
4109 (Chunked_vector::push_back): Use size_ to find insert position.
4110 (Chunked_vector::size_): New data member.
4111 (Stringpool_template::set_no_zero_null): Assert string set is empty.
4112 (Stringpool_template::new_key_offset): New method declaration.
4113 (Stringpool_template::offset_): New data member.
4114
4115 2010-03-15 Rafael Espindola <espindola@google.com>
4116
4117 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
4118 Add_symbols' constructor.
4119 * readsyms.h (Add_symbols): Remove the input_group member.
4120
4121 2010-03-10 Ian Lance Taylor <iant@google.com>
4122
4123 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
4124 target to ask whether a reference to a symbol requires a stack
4125 split.
4126 * target.h (Target::is_call_to_non_split): New function.
4127 (Target::do_is_call_to_non_split): Declare virtual function.
4128 * target.cc: Include "symtab.h".
4129 (Target::do_is_call_to_non_split): New function.
4130 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
4131
4132 2010-03-10 Cary Coutant <ccoutant@google.com>
4133
4134 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
4135 (File_read::open[1]): Remove initial mapping of whole_file_view_.
4136 (File_read::open[2]): Add whole_file_view_ to list of views.
4137 (File_read::make_view): Remove test of whole_file_view_.
4138 (File_read::find_or_make_view): Create whole_file_view_ if
4139 necessary.
4140 (File_read::clear_views): Replace bool parameter with enum;
4141 adjust all callers. Don't delete views with permanent data;
4142 do delete cached views and views from archives if
4143 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
4144 if clearing the corresponding view.
4145 * fileread.h (File_read::Clear_views_mode): New enum.
4146 (File_read::View::is_permanent_view): New method.
4147 (File_read::clear_views): Replace bool parameter
4148 with enum; adjust all callers.
4149 * options.h (General_options): Change keep_files_mapped option;
4150 add map_whole_files.
4151 * readsyms.cc (Add_symbols::run): Delete sd_ object before
4152 releasing the file.
4153 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
4154 the file.
4155
4156 2010-03-10 David S. Miller <davem@davemloft.net>
4157
4158 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
4159
4160 2010-03-09 Sriraman Tallam <tmsriram@google.com>
4161
4162 * icf.cc (get_section_contents): Add '@' marker after processing the
4163 merge reloc.
4164
4165 2010-03-08 Doug Kwan <dougkwan@google.com>
4166
4167 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
4168 due to a conversion warning.
4169 (Arm_relobj::update_output_local_symbol_count): Check for local
4170 symbol with unset output index.
4171
4172 2010-03-05 Ian Lance Taylor <iant@google.com>
4173
4174 * options.h (class General_options): Add --spare-dynamic-tags.
4175 * output.cc (Output_data_dynamic::set_final_data_size): Implement
4176 --spare-dynamic-tags.
4177
4178 2010-03-05 Ian Lance Taylor <iant@google.com>
4179
4180 * incremental.cc: Include "libiberty.h".
4181
4182 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
4183
4184 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
4185 function, is_info_ member.
4186 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
4187 (Versions::Versions): Update caller.
4188 (Versions::define_base_version): Likewise.
4189 (Versions::add_def): Likewise.
4190
4191 2010-03-03 Sriraman Tallam <tmsriram@google.com>
4192
4193 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
4194 (Scan::possible_function_pointer_reloc): New function.
4195 (Scan::local_reloc_may_be_function_pointer): Change to call
4196 possible_function_pointer_reloc.
4197 (Scan::global_reloc_may_be_function_pointer): Ditto.
4198 * icf.h (Icf::check_section_for_function_pointers): Change to reject
4199 relocations in ".data.rel.ro._ZTV" section.
4200 * testsuite/icf_safe_so_test.sh: Change to pass i386.
4201 * testsuite/icf_safe_so_test.cc: Ditto.
4202 * testsuite/icf_safe_test.cc: Ditto.
4203 * testsuite/icf_safe_test.sh: Ditto.
4204
4205 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4206 Ian Lance Taylor <iant@google.com>
4207
4208 * target-reloc.h (relocate_section): Check the symbol table index
4209 for -1U before setting the local symbol index.
4210 (scan_relocatable_relocs): If copying the relocation, record that
4211 the local symbol is required.
4212 * object.h (Symbol_value::is_output_symtab_index_set): New
4213 function.
4214 (Symbol_value::may_be_discarded_from_output_symtab): New
4215 function.
4216 (Symbol_value::has_output_symtab_entry): New function.
4217 (Symbol_value::needs_output_symtab_entry): Remove.
4218 (Symbol_value::output_symtab_index): Make sure the symbol index is
4219 set.
4220 (Symbol_value::set_output_symtab_index): Make sure the symbol
4221 index is not set. Make sure the new index is valid.
4222 (Symbol_value::set_must_have_output_symtab_entry): New function.
4223 (Symbol_value::has_output_dynsym_entry): New function.
4224 (Symbol_value::set_output_dynsym_index): Make sure the new index
4225 is valid.
4226 (Sized_relobj::set_must_have_output_symtab_entry): New function.
4227 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
4228 local symbol if permitted.
4229 (Sized_relobj::do_finalize_local_symbols): Call
4230 is_output_symtab_index_set rather than needs_output_symtab_entry.
4231 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
4232 rather than needs_output_symtab_entry. Call
4233 has_output_dynsym_entry rather than needs_output_dynsym_entry.
4234 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
4235 is_output_symtab_index_set rather than needs_output_symtab_entry.
4236 * testsuite/discard_locals_relocatable_test.c: New file.
4237 * testsuite/discard_locals_test.sh: Test -r.
4238 * testsuite/Makefile.am (check_DATA): Add
4239 discard_locals_relocatable_test1.syms,
4240 discard_local_relocatable_test2.syms.
4241 (MOSTLYCLEANFILES): Likewise. Also add
4242 discard_locals_relocatable_test1.lout and
4243 discard_locals_relocatable_test2.out.
4244 (discard_locals_relocatable_test1.syms): New target.
4245 (discard_locals_relocatable_test.o): New target.
4246 (discard_locals_relocatable_test1.out): New target.
4247 (discard_locals_relocatable_test2.syms): New target.
4248 (discard_locals_relocatable_test2.out): New target.
4249 (various): Add missing ../ld-new dependencies.
4250 * testsuite/Makefile.in: Rebuild.
4251
4252 2010-03-03 Nick Clifton <nickc@redhat.com>
4253
4254 * po/fi.po: New Finnish translation.
4255
4256 2010-03-01 Doug Kwan <dougkwan@google.com>
4257
4258 * layout.cc (Layout::Layout): Force section types of .init_array*,
4259 .preinit_array* and .fini_array* sections.
4260 * output.cc (Output_section::Input_section_sort_entry::has_priority):
4261 Fix check of return value of std::string::find.().
4262 (Output_section::Input_section_sort_compare::operator()): Remove
4263 comment about .init_array.
4264 (Output_section::Input_section_sort_init_fini_compare::operator()):
4265 New method.
4266 (Output_section::sort_attached_input_sections): Handle .init_array
4267 and .fini_array specially.
4268 * output.h (Output_section::Inut_section_sort_compare): Update
4269 comment.
4270 (Output_section::Input_section_sort_init_fini_compare): New struct.
4271
4272 2010-02-26 Doug Kwan <dougkwan@google.com>
4273
4274 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
4275 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
4276 * testsuite/debug_msg.sh: Avoid matching source line number for
4277 use of global variable undef_int.
4278
4279 2010-02-26 Doug Kwan <dougkwan@google.com>
4280
4281 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
4282 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
4283 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
4284 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
4285 * options.cc (General_options::General_options): Initialize member
4286 fix_v4bx_.
4287 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
4288 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
4289 and rm_no_fix_v4bx.stdout
4290 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
4291 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
4292 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
4293 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
4294 and arm_no_fix_v4bx.
4295 * Makefile.in: Regenerate.
4296 * testsuite/arm_fix_v4bx.s: New file.
4297 * testsuite/arm_fix_v4bx.sh: Ditto.
4298
4299 2010-02-24 Doug Kwan <dougkwan@google.com>
4300
4301 * arm.cc (Target_arm::got_section): Make the .got section the first
4302 non RELRO section in the data segment.
4303 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
4304 suffixes of section names.
4305
4306 2010-02-24 Doug Kwan <dougkwan@google.com>
4307
4308 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
4309 flags and attributes merging if an input file is a binary file.
4310 * fileread.cc (Input_file::open): Record format of original file.
4311 * fileread.h (Input_file::Format): New enum type.
4312 (Input_file::Input_file): Initialize data member format_.
4313 (Input_file::format): New method definition.
4314 (Input_file::format_):: New data member.
4315
4316 2010-02-24 Doug Kwan <dougkwan@google.com>
4317
4318 * arm.cc (Arm_output_data_got): New class.
4319 (ARM_TCB_SIZE): New constant
4320 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
4321 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
4322 If user uses a script with a SECTIONS clause, issue only a warning
4323 for a misplaced EXIDX input section. Otherwise, issue an error.
4324 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
4325 garbage collection.
4326 (Target_arm::got_mode_index_entry): Handle static linking.
4327 (Target_arm::Scan::local): Ditto.
4328 (Target_arm::Scan::global): Ditto.
4329 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
4330 all incorrectly implemented relocations.
4331 (Target_arm::fix_exidx_coverage): Pass layout to
4332 Arm_output_section::fix_exidx_coverage.
4333 * layout.cc (Layout::section_name_mapping): Remove trailing dots
4334 from ".ARM.exidx." and ".ARM.extab.".
4335
4336 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4337
4338 * arm.cc (Target_arm::do_finalize_sections): Create attribute
4339 section if it does not already exist.
4340 * attributes.cc (Attributes_section_data::Attributes_section_data):
4341 Don't crash if size is zero.
4342
4343 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4344 Ian Lance Taylor <iant@google.com>
4345
4346 * gold.cc (queue_middle_tasks): If no input files were opened,
4347 exit.
4348 * workqueue.h (Task_function::Task_function): Assert that there is
4349 a blocker.
4350
4351 2010-02-22 Doug Kwan <dougkwan@google.com>
4352
4353 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
4354 * icf.cc (get_section_contents): Cast snprintf arguments to long long
4355 types to avoid warnings due to different uint64_t implementations
4356 on different hosts.
4357
4358 2010-02-21 Doug Kwan <dougkwan@google.com>
4359
4360 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
4361 handling of the maximum backward branch offset.
4362 (Arm_relocate_functions::thumb_branch_common): Ditto.
4363 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
4364 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
4365 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
4366 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
4367 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
4368 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
4369 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
4370 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
4371 thumb_bl_out_of_range thumb_bl_out_of_range.o,
4372 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
4373 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
4374 thumb2_bl_out_of_range.o): New rules.
4375 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
4376 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
4377 thumb2_bl_out_of_range
4378 * testsuite/Makefile.in: Regenerate.
4379 * testsuite/arm_bl_in_range.s: New file.
4380 * testsuite/arm_bl_out_of_range.s: Ditto.
4381 * testsuite/arm_branch_in_range.sh: Ditto.
4382 * testsuite/arm_branch_range.t: Ditto.
4383 * testsuite/thumb2_branch_range.t: Ditto.
4384 * testsuite/thumb_bl_in_range.s: Ditto.
4385 * testsuite/thumb_bl_out_of_range.s: Ditto.
4386 * testsuite/thumb_branch_range.t: Ditto.
4387
4388 2010-02-20 Sriraman Tallam <tmsriram@google.com>
4389
4390 * gc.h (gc_process_relocs): Change vectors to point to the new list.
4391 Add reloc offset information.
4392 * icf.cc (get_section_contents): Change iterators to point to the new
4393 vectors. Add reloc offset information to the contents.
4394 * icf.h (Icf::Sections_reachable_info): New typedef.
4395 (Icf::Sections_reachable_list): New typedef.
4396 (Icf::Offset_info): New typedef.
4397 (Icf::Reloc_info): New struct typedef.
4398 (Icf::Reloc_info_list): New typedef.
4399 (Icf::symbol_reloc_list): Delete method.
4400 (Icf::addend_reloc_list): Delete method.
4401 (Icf::section_reloc_list): Delete method.
4402 (Icf::reloc_info_list): New method.
4403 (Icf::reloc_info_list_): New member.
4404
4405 2010-02-19 Doug Kwan <dougkwan@google.com>
4406
4407 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
4408 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
4409 * arm.cc (Arm_relocation_functions): New forward declaration.
4410 (Target_arm::Target_arm): Initialize new data members
4411 got_mod_index_offset_ and tls_base_symbol_defined_.
4412 (Target_arm::Relocate::relocate_tls): New method.
4413 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
4414 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
4415 New methods.
4416 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
4417 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
4418 (Target_arm::got_mod_index_offset_,
4419 Target_arm::tls_base_symbol_defined_): New data members.
4420 (Target_arm::Scan::local, Target::Scan::global,
4421 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
4422 relocations.
4423
4424 2010-02-18 Doug Kwan <dougkwan@google.com>
4425
4426 * arm.cc (Arm_relobj::find_linked_text_section): New method.
4427 (Arm_relobj::make_exidx_input_section): Pass section index of linked
4428 text section as a parameter becuase some broken tools may not set
4429 the link in section header.
4430 (Target_arm::has_got_section): New method.
4431 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
4432 without any mapping symbol as data only. Remove warning.
4433 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
4434 link in its section header, try to discover the link by inspecting the
4435 REL31 relocation at the beginning of the section.
4436 (Target_arm::Scan::check_non_pic): Report name of offending relocation
4437 in error message.
4438 (Target_arm::Scan::global): Treat any reference to the symbol
4439 _GLOBAL_OFFSET_TABLE_ as a GOT access.
4440
4441 2010-02-12 Sriraman Tallam <tmsriram@google.com>
4442
4443 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
4444 (Scan::global_reloc_may_be_function_pointer): New function.
4445 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4446 (Scan::global_reloc_may_be_function_pointer): New function.
4447 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
4448 (Scan::global_reloc_may_be_function_pointer): New function.
4449 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
4450 (Scan::global_reloc_may_be_function_pointer): New function.
4451 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
4452 (Scan::global_reloc_may_be_function_pointer): New function.
4453 (Scan::possible_function_pointer_reloc): New function.
4454 (Target_x86_64::can_check_for_function_pointers): New function.
4455 * gc.h (gc_process_relocs): Scan relocation types to determine if
4456 function pointers were taken for targets that support it.
4457 * icf.cc (Icf::find_identical_sections): Include functions for
4458 folding in safe ICF whose pointer is not taken.
4459 * icf.h (Secn_fptr_taken_set): New typedef.
4460 (fptr_section_id_): New member.
4461 (section_has_function_pointers): New function.
4462 (set_section_has_function_pointers): New function.
4463 (check_section_for_function_pointers): New function.
4464 * options.h: Fix comment for safe ICF option.
4465 * target.h (can_check_for_function_pointers): New function.
4466 * testsuite/Makefile.am: Add icf_safe_so_test test case.
4467 Modify icf_safe_test for X86-64.
4468 * testsuite/Makefile.in: Regenerate.
4469 * testsuite/icf_safe_so_test.cc: New file.
4470 * testsuite/icf_safe_so_test.sh: New file.
4471 * testsuite/icf_safe_test.cc (kept_func_3): New function.
4472 (main): Change to take pointer to function kept_func_3.
4473 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
4474 folding is done correctly for X86-64.
4475
4476 2010-02-12 David S. Miller <davem@davemloft.net>
4477
4478 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
4479 is_symbolless parameter.
4480 (Output_reloc<SHT_REL>::is_symbolless): New.
4481 (Output_reloc<SHT_REL>::is_symbolless_): New.
4482 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
4483 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
4484 (Output_reloc<SHT_RELA>::is_symbolless): New.
4485 (Output_data_reloc::add_global): Handle is_symbolless.
4486 (Output_data_reloc::add_global_relative): Likewise.
4487 (Output_data_reloc::add_local): Likewise.
4488 (Output_data_reloc::add_local_relative): Likewise.
4489 (Output_data_reloc::add_symbolless_global_addend): New.
4490 (Output_data_reloc::add_symbolless_local_addend): New.
4491 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
4492 is_symbolless.
4493 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
4494 instead of ->is_relative_
4495 (Output_reloc::write): Likewise.
4496 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
4497 (Output_reloc::write_rel): Simplify.
4498
4499 * sparc.cc (Target_sparc::Scan::local): Use
4500 ->add_symbolless_local_addend as needed.
4501 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
4502 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
4503 based upon relocation offset.
4504
4505 2010-02-11 Doug Kwan <dougkwan@google.com>
4506
4507 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
4508 (Target_arm::Scan::global): Ditto. Also remove a comment before the
4509 beginning of function.
4510 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
4511 and MOVT_ABS relocations. Those are non issued in scanning. Fix
4512 parameter is_32bit in calls to should_apply_static_reloc.
4513 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
4514 (check_DATA): Add arm_abs_global.stdout.
4515 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
4516 arm_abs_global.stdout): New rules.
4517 (MOSTLLYCLEANFILES): Add arm_abs_global
4518 * Makefile.in: Regenerate.
4519 * testsuite/arm_abs_global.s: New file.
4520 * testsuite/arm_abs_global.sh: Ditto.
4521 * testsuite/arm_abs_lib.s: Ditto.
4522
4523 2010-02-11 Ian Lance Taylor <iant@google.com>
4524
4525 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
4526 Read_relocs task.
4527 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
4528 Allocate_commons_task first.
4529 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
4530 task, rather than symtab_lock_.
4531 (Gc_process_relocs::~Gc_process_relocs): New function.
4532 (Gc_process_relocs::is_runnable): Check this_blocker_.
4533 (Gc_process_relocs::locks): Use next_blocker_ rather than
4534 blocker_.
4535 (Scan_relocs::~Scan_relocs): New function.
4536 (Scan_relocs::is_runnable): Check this_blocker_ rather than
4537 symtab_lock_.
4538 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
4539 next_blocker_.
4540 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
4541 fields. Add this_blocker_ and next_blocker_ fields. Adjust
4542 constructor accordingly.
4543 (class Gc_process_relocs): Likewise.
4544 (class Scan_relocs): Likewise.
4545 * common.h (class Allocate_commons_task): Remove symtab_lock_
4546 field, and corresponding constructor parameter.
4547 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
4548 symtab_lock_.
4549 (Allocate_commons_task::locks): Likewise.
4550
4551 2010-02-11 Ian Lance Taylor <iant@google.com>
4552
4553 * gold-threads.h (class Once): Define.
4554 (class Initialize_lock): Rewrite as child of Once.
4555 * gold-threads.cc (class Once_initialize): Define.
4556 (once_pointer_control): New static variable.
4557 (once_pointer, once_arg): New static variables.
4558 (c_run_once): New static function.
4559 (Once::Once, Once::run_once, Once::internal_run): New functions.
4560 (class Initialize_lock_once): Remove.
4561 (initialize_lock_control): Remove.
4562 (initialize_lock_pointer): Remove.
4563 (initialize_lock_once): Remove.
4564 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
4565 (Initialize_lock::initialize): Rewrite.
4566 (Initialize_lock::do_run_once): New function.
4567 * archive.cc (Archive::interpret_header): Only clear name if it is
4568 not already empty.
4569 * fileread.cc: Include "gold-threads.h"
4570 (file_counts_lock): New static variable.
4571 (file_counts_initialize_lock): Likewise.
4572 (File_read::release): Only increment counts when using --stats.
4573 Use a lock around the increment.
4574 * parameters.cc (class Set_parameters_target_once): Define.
4575 (set_parameters_target_once): New static variable.
4576 (Parameters::Parameters): Move here from parameters.h.
4577 (Parameters::set_target): Rewrite.
4578 (Parameters::set_target_once): New function.
4579 (Parameters::clear_target): Move here and rewrite.
4580 * parameters.h (class Parameters): Update declarations. Add
4581 set_parameters_target_once_ field.
4582 (Parameters::Parameters): Move to parameters.cc.
4583 (Parameters::clear_target): Likewise.
4584 * readsyms.cc (Read_symbols::do_group): Create a Start_group
4585 task.
4586 (Start_group::~Start_group): New function.
4587 (Start_group::is_runnable): New function.
4588 (Start_group::locks, Start_group::run): New functions.
4589 (Finish_group::run): Change saw_undefined to size_t.
4590 * readsyms.h (class Start_group): Define.
4591 (class Finish_group): Change saw_undefined_ field to size_t.
4592 (Finish_group::Finish_group): Remove saw_undefined and
4593 this_blocker parameters. Change all callers.
4594 (Finish_group::set_saw_undefined): New function.
4595 (Finish_group::set_blocker): New function.
4596 * symtab.h (class Symbol_table): Change saw_undefined to return
4597 size_t. Change saw_undefined_ field to size_t.
4598 * target-select.cc (Set_target_once::do_run_once): New function.
4599 (Target_selector::Target_selector): Initialize set_target_once_
4600 field. Don't initialize lock_ and initialize_lock_ fields.
4601 (Target_selector::instantiate_target): Rewrite.
4602 (Target_selector::set_target): New function.
4603 * target-select.h (class Set_target_once): Define.
4604 (class Target_selector): Update declarations. Make
4605 Set_target_once a friend. Remove lock_ and initialize_lock_
4606 fields. Add set_target_once_ field.
4607
4608 2010-02-10 Ian Lance Taylor <iant@google.com>
4609
4610 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
4611 queueing any tasks.
4612 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
4613 (queue_middle_tasks): Add all blockers before queueing any tasks.
4614 (queue_final_tasks): Likewise.
4615 * token.h (Task_token::add_blockers): New function.
4616 * object.h (Input_objects::number_of_relobjs): New function.
4617
4618 2010-02-10 Ian Lance Taylor <iant@google.com>
4619
4620 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
4621 shared, not if not position independent.
4622 * x86_64.cc (Relocate::relocate_tls): Likewise.
4623 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
4624 (tls_pie_pic_test): New target.
4625 * testsuite/Makefile.in: Rebuild.
4626
4627 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
4628 (tls_test_main_pie.o, tls_test_pie.o): New targets.
4629 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
4630 * testsuite/Makefile.in: Rebuild.
4631
4632 2010-02-09 David S. Miller <davem@davemloft.net>
4633
4634 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
4635 R_SPARC_RELATIVE using ->add_local_relative().
4636 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
4637
4638 * output.h (Output_data_dynamic::add_section_size): New method
4639 that takes two Output_data objects.
4640 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
4641 entry param. Handle it in initializers.
4642 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
4643 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
4644 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
4645 arg.
4646 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
4647 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
4648 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
4649 for dynrel_includes_plt.
4650 * i386.cc (Target_i386::do_finalize_sections): Likewise.
4651 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4652 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
4653 before .rela.plt
4654 (Target_sparc::do_finalize_sections): Update to pass true for
4655 dynrel_includes_plt.
4656 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
4657 output before .rela.plt
4658 (Target_powerpc::do_finalize_sections): Update to pass true for
4659 dynrel_includes_plt when 32-bit.
4660
4661 2010-02-08 Doug Kwan <dougkwan@google.com>
4662
4663 * arm.cc (Arm_relobj::simple_input_section_output_address): New
4664 method.
4665 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
4666 Arm_relobj::scan_section_for_cortex_a8_stubs,
4667 Arm_relobj::do_relocation_section): Instead of calling
4668 Output_section::output_address, use faster
4669 Arm_relobj::simple_input_section_output_address.
4670
4671 2010-02-08 David S. Miller <davem@davemloft.net>
4672
4673 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
4674 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
4675 relocation helper function.
4676
4677 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
4678 just like R_SPARC_GOT{10,13,22}.
4679 (Target_sparc::Scan::local): Likewise.
4680 (Target_sparc::Relocate:relocate): Likewise.
4681
4682 2010-02-06 Ian Lance Taylor <iant@google.com>
4683
4684 * configure.ac: Rewrite targetobjs duplicate removal code to use
4685 only shell constructs.
4686 * configure: Rebuild.
4687
4688 2010-02-05 Doug Kwan <dougkwan@google.com>
4689
4690 PR 11247
4691 * arm.cc (Arm_relobj::section_is_scannable): New method.
4692 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
4693 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
4694
4695 2010-02-04 Doug Kwan <dougkwan@google.com>
4696
4697 PR 11247
4698 * arm-reloc-property.cc (cstdio): Include.
4699 * configure.ac (targetobjs): Remove duplicates.
4700 * configure: Regenerate.
4701 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
4702 big and little endian version for a given address size.
4703
4704 2010-02-03 Doug Kwan <dougkwan@google.com>
4705
4706 * arm-reloc-property.cc
4707 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4708 definition.
4709 * arm-reloc-property.h
4710 (Arm_reloc_property_table::get_implemented_static_reloc_property):
4711 New method definition.
4712 (Arm_reloc_property_table::reloc_name_in_error_message): New method
4713 declaration.
4714 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
4715 overflow to N.
4716 (GOT_PREL): Change implemented to Y.
4717 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
4718 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
4719 (Arm_relocate_functions::movw_abs_nc): Remove method.
4720 (Arm_relocate_functions::movt_abs): Ditto.
4721 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
4722 (Arm_relocate_functions::thm_movt_abs): Ditto.
4723 (Arm_relocate_functions::movw_rel_nc): Ditto.
4724 (Arm_relocate_functions::movw_rel): Ditto.
4725 (Arm_relocate_functions::movt_rel): Ditto.
4726 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
4727 (Arm_relocate_functions:thm_movw_rel): Ditto.
4728 (Arm_relocate_functions:thm_movt_rel): Ditto.
4729 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
4730 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
4731 New method definitions.
4732 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
4733 (Arm_relocation_functions::arm_grp_ldr): Ditto.
4734 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
4735 (Arm_relocation_functions::arm_grp_ldc): Ditto.
4736 (Target_arm::Relocate::relocate): Check for non-static or
4737 unimplemented relocation code and exit early. Change calls to
4738 Target_arm::reloc_uses_thumb_bit and
4739 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
4740 instead. Refactor code to handle similar relocations to increase
4741 code sharing. Remove check for unsupported relocation code in switch
4742 statement.
4743 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
4744 relocation property table to find out size. Change error message to
4745 print out the name of a relocation code instead of the numeric value.
4746 (Target_arm::scan_reloc_for_stub): Use relocation property table
4747 instead of calling Target_arm::reloc_uses_thumb_bit().
4748
4749 2010-02-02 Doug Kwan <dougkwan@google.com>
4750
4751 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
4752 types of relaxed input section.
4753
4754 2010-02-02 Doug Kwan <dougkwan@google.com>
4755
4756 * Makefile.am (HFILES): Add arm-reloc-property.h.
4757 (DEFFILES): New.
4758 (TARGETSOURCES): Add arm-reloc-property.cc
4759 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
4760 (libgold_a_SOURCES): $(DEFFILES)
4761 * Makefile.in: Regenerate.
4762 * arm-reloc-property.cc: New file.
4763 * arm-reloc-property.h: New file.
4764 * arm-reloc.def: New file.
4765 * arm.cc: Update comments.
4766 (arm-reloc-property.h): New included header.
4767 (arm_reloc_property_table): New global variable.
4768 (Target_arm::do_select_as_default_target): New method definition.
4769 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
4770 arm-reloc-property to targ_extra_obj.
4771 * parameters.cc (set_parameters_target): Call
4772 Target::select_as_default_target().
4773 * target.h (Target::select_as_default_target): New method definition.
4774 (Target::do_select_as_default_target): Same.
4775
4776 2010-02-01 Doug Kwan <dougkwan@google.com>
4777
4778 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
4779 first_output_text_section_.
4780 (Arm_exidx_fixup::first_output_text_section): New method definition.
4781 (Arm_exidx_fixup::first_output_text_section_): New data member.
4782 (Arm_exidx_fixup::process_exidx_section): Record the first text
4783 output section seen.
4784 (Arm_output_section::fix_exidx_coverage): Set correct linked section
4785 and entsize in output section header.
4786
4787 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4788
4789 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
4790 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
4791 (Arm_relocate_functions::thm_alu11): New Method.
4792 (Arm_relocate_functions::thm_pc8): New Method.
4793 (Arm_relocate_functions::thm_pc12): New Method.
4794 (Target_arm::Scan::local): Handle the relocations.
4795 (Target_arm::Scan::global): Likewise.
4796 (Target_arm::Relocate::relocate): Likewise.
4797 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4798
4799 2010-01-29 Doug Kwan <dougkwan@google.com>
4800
4801 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
4802 of relocation types as ld.
4803
4804 2010-01-29 Doug Kwan <dougkwan@google.com>
4805
4806 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
4807 to public.
4808 (Arm_relocate_functions::thumb_branch_common): Ditto.
4809 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
4810 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
4811 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
4812 Arm_relocate_functions::jump24): Remove.
4813 (Target_arm::Relocate::relocate): Adjust code to call
4814 Arm_relocation_functions::arm_branch_common and
4815 Arm_relocation_functions::thumb_branch_common instead of their removed
4816 wrappers. Merge switch-cases together to reduce source code size.
4817
4818 2010-01-29 Doug Kwan <dougkwan@google.com>
4819
4820 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
4821 output_local_symbol_count_needs_update_.
4822 (Arm_relobj::output_local_symbol_count_needs_update,
4823 Arm_relobj::set_output_local_symbol_count_needs_update,
4824 Arm_relobj::update_output_local_symbol_count): New methods.
4825 (Arm_relobj::output_local_symbol_count_needs_update_): New data
4826 member.
4827 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
4828 of pointed function as in a R_ARM_PREL31 relocation.
4829 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
4830 for output local symbol count updating.
4831 (Target_arm::do_relax): Update output local symbol counts in objects
4832 if necessary.
4833 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
4834
4835 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4836
4837 * arm.cc: Added support for the ARM relocations:
4838 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
4839 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
4840 (Arm_relocate_functions::movw_rel_nc): Renamed (was
4841 movw_prel_nc).
4842 (Arm_relocate_functions::movw_rel): New method.
4843 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
4844 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
4845 thm_movw_prel_nc).
4846 (Arm_relocate_functions::thm_movw_rel): New method.
4847 (Arm_relocate_functions::thm_movt_rel): Renamed (was
4848 thm_movt_prel).
4849 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
4850 relocations.
4851 (Target_arm::Scan::global): Likewise.
4852 (Target_arm::Relocate::relocate): Likewise.
4853 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4854 Likewise.
4855
4856 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4857
4858 * arm.cc: Added support for ARM group relocations.
4859 (Target_arm::reloc_needs_sym_origin): New method.
4860 (Arm_relocate_functions::calc_grp_kn): New method.
4861 (Arm_relocate_functions::calc_grp_residual): New method.
4862 (Arm_relocate_functions::calc_grp_gn): New method.
4863 (Arm_relocate_functions::arm_grp_alu): New Method.
4864 (Arm_relocate_functions::arm_grp_ldr): New Method.
4865 (Arm_relocate_functions::arm_grp_ldrs): New Method.
4866 (Arm_relocate_functions::arm_grp_ldc): New Method.
4867 (Target_arm::Scan::local): Handle the ARM group relocations.
4868 (Target_arm::Scan::global): Likewise.
4869 (Target_arm::Relocate::relocate): Likewise.
4870 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4871 Likewise.
4872
4873 2010-01-26 Doug Kwan <dougkwan@google.com>
4874
4875 * arm.cc (set): Include.
4876 (class Arm_exidx_fixup): Change type of last_input_section_ to const
4877 pointer type.
4878 (Arm_output_section::Text_section_list): New type.
4879 (Arm_output_section::append_text_sections_to_list): New method.
4880 (Arm_output_section::fix_exidx_coverage): Ditto.
4881 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
4882 (Arm_relobj::convert_input_section_to_relaxed_section): Use
4883 Relobj::set_section_offset() instead of
4884 Sized_relobj::invalidate_section_offset().
4885 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
4886 parameter for section headers. Ignore relocation sections for
4887 unallocated sections and EXIDX sections.
4888 (Target_arm::fix_exidx_coverage): New method.
4889 (Target_arm::output_section_address_less_than): New type.
4890 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
4891 linked text section instead of the EXIDX section.
4892 (Arm_output_section::create_stub_group): Add an assertion to check
4893 that this is not an EXIDX output section.
4894 (Arm_output_section::append_text_sections_to_list): New method.
4895 (Arm_output_section::fix_exidx_coverage): Ditto.
4896 (Arm_relobj::scan_sections_for_stubs): Adjust call to
4897 Arm_relobj::section_needs_reloc_stub_scanning.
4898 (Target_arm::do_relax): Fix EXIDX output section coverage in the
4899 first pass.
4900 (Target_arm::fix_exidx_coverage): New method.
4901 * object.h (Relobj::set_output_section): New method.
4902 (Sized_relobj::invalidate_section_offset): Remove method.
4903 (Sized_relobj::do_invalidate_section_offset): Remove method.
4904 (Sized_relobj::do_set_section_offset): Handle offset value -1.
4905
4906 2010-01-25 Doug Kwan <dougkwan@google.com>
4907
4908 * arm.cc (Arm_exidx_merged_section::do_output_offset):
4909 Fix warning due to signed and unsigned comparison on a 32-bit host.
4910
4911 2010-01-22 Doug Kwan <dougkwan@google.com>
4912
4913 * arm.cc (Target_arm::do_relax): Record an output section for section
4914 offset adjustment it contains any stub table that has changed.
4915 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
4916 offsets in an output section if necessary.
4917 * output.cc (Output_section::Output_section): Initialize
4918 section_offsets_need_adjustments_.
4919 (Output_section::add_input_section_for_script): Renamed to
4920 Output_section::add_simple_input_section.
4921 (Output_section::save_states): Add a comment.
4922 (Output_section::discard_states): New method defintion.
4923 (Output_section::adjust_section_offsets): Same.
4924 * output.h (Output_section::add_input_section_for_script): Renamed to
4925 Output_section::add_simple_input_section.
4926 (Output_section::discard_states): New method declaration.
4927 (Output_section::adjust_section_offsets): Same.
4928 (Output_section::section_offsets_need_adjustment,
4929 Output_section::set_section_offsets_need_adjustment): New method
4930 definitions.
4931 (Output_section::section_offsets_need_adjustment_): New data member.
4932 * script-sections.cc
4933 (Output_section_element_input::set_section_address): Adjust code for
4934 renaming of Output_section::add_input_section_for_script.
4935 (Orphan_output_section::set_section_address): Same.
4936
4937 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4938
4939 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
4940 Fix_v4bx enum values .
4941 * gold/options.h (General_options): New option definitions.
4942 (General_options::fix_v4bx): New method.
4943 (General_options::Fix_v4bx): New enum.
4944 * gold/options.cc (General_options::parse_fix_v4bx): New method.
4945 (General_options::parse_fix_v4bx_interworking): New method.
4946
4947 2010-01-22 Doug Kwan <dougkwan@google.com>
4948
4949 * arm.cc (Arm_exidx_fixup): New class.
4950
4951 2010-01-21 Doug Kwan <dougkwan@google.com>
4952
4953 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
4954 classes.
4955 (Arm_exidx_section_offset_map): New type.
4956
4957 2010-01-21 Doug Kwan <dougkwan@google.com>
4958
4959 * arm.cc (Arm_exidx_input_section): New class.
4960 (Arm_relobj::exidx_input_section_by_link,
4961 Arm_relobj::exidx_input_section_by_shndx,
4962 Arm_relobj::make_exidx_input_section): New methods.
4963 (read_arm_attributes_section): Remove.
4964 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
4965 information about them.
4966 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
4967 to here.
4968
4969 2010-01-20 Doug Kwan <dougkwan@google.com>
4970
4971 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
4972 Input_section_specifier to Section_id.
4973 (Target_arm::new_arm_input_section: Adjust code for change of key
4974 type.
4975 (Target_arm::find_arm_input_section): Ditto.
4976 * gc.h (object.h): Include for Section_id nand Section_id_hash.
4977 (Section_id): Remove.
4978 (Garbage_collection::Section_id_hash): Remove.
4979 * icf.h (object.h): Include for Section_id nand Section_id_hash.
4980 (Section_id): Remove.
4981 (Icf::Section_id_hash): Remove.
4982 * object.h (Section_id, Const_section_id, Section_id_hash,
4983 Const_section_id_hash): New type definitions.
4984 * output.cc (Output_section::add_relaxed_input_section): Change to
4985 use Const_section_id instead of Input_section_specifier as key type.
4986 (Output_section::add_merge_input_section): Ditto.
4987 (Output_section::build_relaxation_map): Change to use Section_id
4988 instead of Input_section_specifier as key type.
4989 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4990 Ditto.
4991 (Output_section::convert_input_sections_to_relaxed_sections): Change
4992 to use Const_section_id instead of Input_section_specifier as key type.
4993 (Output_section::find_merge_section): Ditto.
4994 (Output_section::find_relaxed_input_section): Ditto.
4995 * output.h (Input_section_specifier): Remove class.
4996 (Output_section::Output_section_data_by_input_section_map): Change
4997 key type to Const_section_id.
4998 (Output_section::Output_relaxed_input_section_by_input_section_map):
4999 Ditto.
5000 (Output_section::Relaxation_map): Change key type to Section_id.
5001
5002 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5003
5004 * gold/arm.cc: Added support for R_ARM_V4BX relocation
5005 (class Arm_v4bx_stub): New class.
5006 (DEF_STUBS): Updated definition to support v4_veneer_bx.
5007 (Stub_factory::make_arm_v4bx_stub): New method.
5008 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
5009 (Stub_table::empty): Handle v4bx stubs.
5010 (Stub_table::add_arm_v4bx_stub): New method.
5011 (Stub_table::find_arm_v4bx_stub): New method.
5012 (Arm_relocate_functions::v4bx): New method.
5013 (Target_arm::fix_v4bx): New method.
5014 (Target_arm::Target_arm): Handle R_ARM_V4BX.
5015 (Stub_table::relocate_stubs): Likewise.
5016 (Stub_table::do_write): Likewise.
5017 (Stub_table::update_data_size_and_addralign): Likewise.
5018 (Stub_table::finalize_stubs): Likewise.
5019 (Target_arm::Scan::local): Likewise.
5020 (Target_arm::Scan::global): Likewise.
5021 (Target_arm::do_finalize_sections): Likewise.
5022 (Target_arm::Relocate::relocate): Likewise.
5023 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5024 Likewise.
5025 (Target_arm::scan_reloc_for_stub): Likewise.
5026 (Target_arm::scan_reloc_section_for_stubs): Likewise.
5027
5028 2010-01-19 Ian Lance Taylor <iant@google.com>
5029
5030 * output.cc (Output_section_headers::do_sized_write): Write large
5031 segment count to sh_info field.
5032 (Output_file_header::do_sized_write): For large segment count,
5033 write PN_XNUM to e_phnum field.
5034
5035 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5036
5037 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
5038 (Arm_relocate_functions::thm_jump8): New function.
5039 (Arm_relocate_functions::thm_jump11): New function.
5040 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
5041 R_ARM_THM_JUMP11.
5042 (Target_arm::Scan::global): Likewise.
5043 (Target_arm::Relocate::relocate): Likewise.
5044 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
5045 Likewise.
5046
5047 2010-01-14 Doug Kwan <dougkwan@google.com>
5048
5049 * arm.cc (map, utility): Include headers.
5050 (Target_arm::apply_cortex_a8_workaround): New method.
5051 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
5052 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
5053 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
5054 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
5055 the --[no-]fix-cortex-a8 command line options.
5056 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
5057 (Target_arm::relocate_stub): Use addend in instruction template.
5058 * options.h (DEFINE_bool): Set the user-set flag.
5059 (General_options): Add --[no-]-fix-cortex options.
5060 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
5061 : Update fast look-up map after conversion.
5062
5063 2010-01-14 Sriraman Tallam <tmsriram@google.com>
5064
5065 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
5066 in the first pass of do_layout.
5067
5068 2010-01-13 Doug Kwan <dougkwan@google.com>
5069
5070 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5071 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
5072 apparent compiler problem of not folding static constant integral
5073 data members of elfcpp::Elf_sizes<32>.
5074
5075 2010-01-13 Doug Kwan <dougkwan@google.com>
5076
5077 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
5078 Arm_relobj::section_needs_cortex_a8_stub_scanning,
5079 Arm_relobj::scan_section_for_cortex_a8_erratum,
5080 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
5081 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
5082 sections to scan for relocation stubs into a new method
5083 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
5084 relocation and Cortex-A8 stub scanning.
5085 (Target_arm::do_relax): Force stubs to be after stubbed sections
5086 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
5087 the beginning of a new relaxation pass. Update a comment.
5088 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
5089
5090 2010-01-12 Ian Lance Taylor <iant@google.com>
5091
5092 * target-reloc.h (visibility_error): New inline function.
5093 (relocate_section): Call visibility_error.
5094 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
5095 (MOSTLYCLEANFILES): Likewise.
5096 (protected_4_pic.o, protected_3.err): New targets.
5097 * testsuite/protected_4.cc: New file.
5098
5099 2010-01-12 Doug Kwan <dougkwan@google.com>
5100
5101 * arm.cc (Cortex_a8_reloc): New class.
5102 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
5103 and cortex_a8_relocs_info_.
5104 (Target_arm::fix_cortex_a8): New method definition.
5105 (Target_arm::Cortex_a8_relocs_info): New type.
5106 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
5107 New data member declarations.
5108 (Target_arm::scan_reloc_for_stub): Record information about
5109 relocations for THUMB branches that might be exempted from the
5110 Cortex-A8 workaround.
5111 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
5112 at the beginning of a relaxation pass.
5113
5114 2010-01-12 Doug Kwan <dougkwan@google.com>
5115
5116 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
5117 (Arm_relobj::Mapping_symbol_position,
5118 Arm_reloj::Mapping_symbol_position_less,
5119 Arm_relobj::Mapping_symbols_info): New types.
5120 (Target_arm::is_mapping_symbol_name): New method definition.
5121 (Arm_relobj::do_count_local_symbols): Save information about mapping
5122 symbols.
5123
5124 2010-01-11 Doug Kwan <dougkwan@google.com>
5125
5126 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
5127 Arm_relocate_functions::thumb32_branch_upper,
5128 Arm_relocate_functions::thumb32_branch_lower,
5129 Arm_relocate_functions::thumb32_cond_branch_offset,
5130 Arm_relocate_functions::thumb32_cond_branch_upper,
5131 Arm_relocate_functions::thumb32_cond_branch_lower,
5132 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
5133 branch offset encoding.
5134 (Arm_relocate_functions::thumb_branch_common): Use new branch
5135 offset encoding methods to avoid code duplication.
5136 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
5137 (Stub_addend_reader::operator()): Use new branch encoding method
5138 to avoid code duplication.
5139
5140 2010-01-11 Doug Kwan <dougkwan@google.com>
5141
5142 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
5143 (Target_arm::do_finalize_sections): Define special EXIDX section
5144 symbols only if referenced.
5145 * gc.h (Garbage_collection::add_reference): New method.
5146 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
5147 code duplication.
5148
5149 2010-01-11 Ian Lance Taylor <iant@google.com>
5150
5151 * script.cc (Version_script_info::build_expression_list_lookup):
5152 Change complaing about duplicate wildcard match from error to
5153 warning.
5154
5155 * script.cc (class Lazy_demangler): Recreate--revert part of patch
5156 of 2009-12-30.
5157 (Version_script_info::Version_script_info): Initialize globs_,
5158 default_version_, default_is_global_, and exact_. Don't
5159 initialize globals_ or locals_.
5160 (Version_script_info::build_lookup_tables): Build local symbols
5161 first.
5162 (Version_script_info::unquote): New function.
5163 (Version_script_info::add_exact_match): New function.
5164 (Version_script_info::build_expression_list_lookup): Remove lookup
5165 parameter. Add is_global parameter. Change all callers. Handle
5166 wildcard pattern specially. Unquote pattern. Call
5167 add_exact_match.
5168 (Version_script_info::get_name_to_match): New function.
5169 (Version_script_info::get_symbol_version): New function.
5170 (Version_script_info::get_symbol_version_helper): Remove.
5171 (Version_script_info::check_unmatched_names): Call unquote.
5172 * script.h (class Version_script_info): Change get_symbol_version
5173 to be non-inline and add is_global parameter; change all callers.
5174 Rewrite symbol_is_local. Update declarations. Define struct
5175 Version_tree_match, Exact, Globs. Don't define struct Lookup.
5176 Remove globals_ and locals_ members. Add exact_, globs_,
5177 default_version_, is_global_.
5178 (Version_script_info::Glob): Remove pattern, add expression and
5179 is_global. Update constructor. Change all callers.
5180 * dynobj.cc (Versions::finalize): Mark the version symbol as the
5181 default version.
5182 (Versions::symbol_section_contents): If a symbol is undefined, or
5183 defined in a dynamic object, set the version index to
5184 VER_NDX_LOCAL.
5185 * symtab.cc (Symbol_table::add_from_relobj): Don't call
5186 symbol_is_local.
5187 (Symbol_table::add_from_pluginobj): Likewise.
5188 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
5189
5190 2010-01-11 Doug Kwan <dougkwan@google.com>
5191
5192 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
5193 (incremental_dump_LDADD): Add linking option for libintl.
5194 * Makefile.in: Regenerate.
5195
5196 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
5197
5198 PR gold/11144
5199 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
5200 instead of -Ds.
5201 * testsuite/Makefile.in: Regenerated.
5202
5203 2010-01-10 Doug Kwan <dougkwan@google.com>
5204
5205 * options.h (DEFINE_var): Use parentheses around argument varname__
5206 in macro body to avoid any unintended subsequent substitutions.
5207
5208 2010-01-10 Ian Lance Taylor <iant@google.com>
5209
5210 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
5211 candidates before doing symbol resolution.
5212
5213 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
5214 ODR candidates if only one is weak.
5215
5216 2010-01-08 Ian Lance Taylor <iant@google.com>
5217
5218 * script.cc (Version_script_info::build_expression_list_lookup):
5219 Don't warn about ambiguous version, just record the ambiguity.
5220 (Version_script_info::get_symbol_version_helper): Give error if
5221 version is ambiguous.
5222
5223 2010-01-08 Doug Kwan <dougkwan@google.com>
5224
5225 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
5226 prev_data_size_ and prev_addralign_. Remove initializer for
5227 deleted data member has_been_changed_.
5228 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
5229 to determine if the table is empty.
5230 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
5231 Remove.
5232 (Stub_table::add_reloc_stub): Define method in class definition
5233 instead of just declaring it there.
5234 (Stub_table::add_cortex_a8_stub): New method definition.
5235 (Stub_table::update_data_size_and_addralign): Ditto.
5236 (Stub_table::finalize_stubs): Ditto.
5237 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
5238 (Stub_table::do_addralign_): Return address alignment in the
5239 (Stub_table::do_reset_address_and_file_offset): Define method in
5240 class definition instead of declaring it there. Set current data
5241 size to be the data size of the previous pass.
5242 (Stub_table::set_final_data_size): Use current data size as the
5243 final data size.
5244 (Stub_table::relocate_stub): Change parameter type of stub from
5245 Reloc_stub pointer to Stub pointer.
5246 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
5247 (Stub_table::Cortex_a8_stub_list): New typedef.
5248 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
5249 Stub_table::prev_addralign_): New data member.
5250 (Arm_relobj::Arm_relobj): Initialize data member
5251 section_has_cortex_a8_workaround_.
5252 (Arm_relobj::section_has_cortex_a8_workaround,
5253 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
5254 definitions.
5255 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
5256 declarations.
5257 (Target_arm::relocate_stub): Change parameter type of stub from
5258 Reloc_stub pointer to Stub pointer.
5259 (Insn_template::size, Insn_template::alignment): Handle
5260 THUMB16_SPECIAL_TYPE.
5261 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
5262 Stub_table::update_data_size_and_addralign,
5263 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
5264 definitions.
5265 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
5266 (Stub_table::do_write): Ditto.
5267 (Target_arm::do_relax): Adjust code for changes in Stub_table.
5268
5269 2010-01-08 Ian Lance Taylor <iant@google.com>
5270
5271 PR 11108
5272 * symtab.h (class Symbol): Remove fields is_target_special_ and
5273 has_plt_offset_. Add field is_defined_in_discarded_section_.
5274 (Symbol::is_defined_in_discarded_section): New function.
5275 (Symbol::set_is_defined_in_discarded_section): New function.
5276 (Symbol::has_plt_offset): Rewrite.
5277 (Symbol::set_plt_offset): Verify that new offset is not -1U.
5278 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
5279 Don't initialize is_target_special_ or has_plt_offset_.
5280 Initialize is_defined_in_discarded_section_.
5281 (Symbol_table::add_from_relobj): If appropriate, set
5282 is_defined_in_discarded_section.
5283 * resolve.cc (Symbol::override_base_with_special): Don't test
5284 is_target_special_. Change has_plt_offset_ to has_plt_offset().
5285 * target-reloc.h (relocate_section): Do special handling for
5286 symbols defined in discarded sections for global symbols as well
5287 as local symbols.
5288
5289 2010-01-08 Ian Lance Taylor <iant@google.com>
5290
5291 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
5292 the SHT_SYMTAB case.
5293
5294 2010-01-08 Ian Lance Taylor <iant@google.com>
5295
5296 * object.cc (Sized_relobj::do_layout): Don't get confused if
5297 layout_eh_frame returns NULL.
5298
5299 2010-01-08 Ian Lance Taylor <iant@google.com>
5300
5301 PR 11084
5302 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
5303 dynamic symbol table, use the normal symbol table.
5304 (Sized_dynobj::do_read_symbols): Remove assertion about type of
5305 symbol table.
5306
5307 2010-01-08 Ian Lance Taylor <iant@google.com>
5308
5309 PR 11072
5310 * layout.cc (Layout::include_section): Remove .gnu_debuglink
5311 sections.
5312
5313 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
5314
5315 * version.cc (print_version): Change to "Copyright 2010".
5316
5317 2010-01-08 Ian Lance Taylor <iant@google.com>
5318
5319 PR 10287
5320 PR 11063
5321 * i386.cc (class Target_i386): Change return type of plt_section
5322 to be non-const.
5323 (class Output_data_plt_i386): Add tls_desc_rel_ field.
5324 (Output_data_plt_i386::Output_data_plt_i386): Initialize
5325 tls_desc_rel_ field.
5326 (Output_data_plt_i386::rel_tls_desc): New function.
5327 (Target_i386::rel_tls_desc_section): New function.
5328 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
5329 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
5330 R_386_TLS_DESC reloc in rel_tls_desc_section.
5331 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
5332 Define struct Tlsdesc_info.
5333 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
5334 (Target_x86_64::do_reloc_symbol_index): New function.
5335 (Target_x86_64::add_tlsdesc_info): New function.
5336 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
5337 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
5338 tlsdesc_rel_ field.
5339 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
5340 all callers.
5341 (Output_data_plt_x86_64::rela_tlsdesc): New function.
5342 (Target_x86_64::rela_tlsdesc_section): New function.
5343 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
5344 handling.
5345 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
5346 (Target_x86_64::do_reloc_addend): New function.
5347 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
5348 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
5349 declarations. Define TARGET_CODE. Add arg field to u1_ union.
5350 (Output_reloc::type): New function.
5351 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
5352 (Output_reloc::is_target_specific): New function.
5353 (Output_reloc::target_arg): New function.
5354 (class Output_reloc) [SHT_RELA]: Add four new constructors for
5355 absolute relocs and target specific relocs.
5356 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
5357 add_target_specific.
5358 (class Output_data_reloc) [SHT_RELA]: Likewise.
5359 * output.cc (Output_reloc::Output_reloc): Add four new versions
5360 for absolute relocs and target specific relocs.
5361 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
5362 (Output_reloc::get_symbol_index): Likewise.
5363 (Output_reloc::local_section_offset): Check that local_sym_index_
5364 is not TARGET_CODE or 0.
5365 (Output_reloc::symbol_value): Likewise.
5366 (Output_reloc::write) [SHT_RELA]: Call target for target specific
5367 reloc.
5368 * target.h (class Target): Add reloc_symbol_index and reloc_addend
5369 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
5370 functions.
5371 * layout.cc (add_target_dynamic_tags): Use output section for
5372 DT_PLTRELSZ and DT_JMPREL.
5373
5374 2010-01-07 Ian Lance Taylor <iant@google.com>
5375
5376 PR 11061
5377 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
5378 function.
5379 (class Output_data_reloc_generic): Define.
5380 (class Output_data_reloc_base): Change base class to
5381 Output_data_reloc_generic. Change add() method to call
5382 bump_relative_reloc_count for a relative reloc. Remove
5383 sort_relocs_ field.
5384 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
5385 to sort_relocs().
5386 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
5387 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
5388 appropriate.
5389 * layout.h (class Layout): Update declaration.
5390
5391 2010-01-07 Ian Lance Taylor <iant@google.com>
5392
5393 * output.h (class Output_data): Add const version of
5394 output_section and do_output_section.
5395 (class Output_section_data): Add const version of
5396 do_output_section.
5397 (class Output_section): Likewise.
5398 * layout.cc (Layout::add_target_dynamic_tags): New function.
5399 * layout.h (class Layout): Update declarations.
5400 * arm.cc (Target_arm::do_finalize_sections): Use
5401 add_target_dynamic_tags.
5402 * i386.cc (Target_i386::do_finalize_sections): Likewise.
5403 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
5404 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
5405 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
5406
5407 2010-01-07 Ian Lance Taylor <iant@google.com>
5408
5409 PR 11042
5410 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
5411 object as needed.
5412
5413 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
5414 Ian Lance Taylor <iant@google.com>
5415
5416 PR 11019
5417 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
5418 Xindex::read_symtab_xindex.
5419
5420 2010-01-07 Doug Kwan <dougkwan@google.com>
5421
5422 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
5423 (Insn_template::thumb16_bcond_insn): New method declaration.
5424 (Insn_template): Fix spelling.
5425 (Stub::thumb16_special): New method declaration.
5426 (Stub::do_write): Define virtual method which was previously pure
5427 virtual.
5428 (Stub::do_thumb16_special): New method declaration.
5429 (Stub::do_fixed_endian_write): New template member.
5430 (Reloc_stub::do_write): Remove.
5431 (Reloc_stub::do_fixed_endian_write): Remove.
5432 (Cortex_a8_stub): New class definition.
5433 (Stub_factory::make_cortex_a8_stub): New method definition.
5434 (Stub_factory::Stub_factory): Add missing static storage class
5435 qualifier for elf32_arm_stub_a8_veneer_blx.
5436
5437 2010-01-07 Ian Lance Taylor <iant@google.com>
5438
5439 PR 10980
5440 * options.h (class General_options): Add --warn-unresolved-symbols
5441 and --error-unresolved-symbols.
5442 * errors.cc (Errors::undefined_symbol): Implement
5443 --warn-unresolved-symbols.
5444
5445 * options.h (class General_options): Add -z text and -z textoff.
5446 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
5447
5448 2010-01-06 Sriraman Tallam <tmsriram@google.com>
5449
5450 * gc.h (Garbage_collection::Cident_section_map): New typedef.
5451 (Garbage_collection::cident_sections): New function.
5452 (Garbage_collection::add_cident_section): New function.
5453 (Garbage_collection::cident_sections_): New member.
5454 (gc_process_relocs): Add references to sections whose names are C
5455 identifiers.
5456 * gold.h (cident_section_start_prefix): New constant.
5457 (cident_section_stop_prefix): New constant.
5458 (is_cident): New function.
5459 * layout.cc (Layout::define_section_symbols): Replace string constants
5460 with the newly defined constants.
5461 * object.cc (Sized_relobj::do_layout): Track sections whose names are
5462 C identifiers.
5463 * testsuite/Makefile.am: Add gc_orphan_section_test.
5464 * testsuite/Makefile.in: Regenerate.
5465 * testsuite/gc_orphan_section_test.cc: New file.
5466 * testsuite/gc_orphan_section_test.sh: New file.
5467
5468 2010-01-06 Ian Lance Taylor <iant@google.com>
5469
5470 PR 10980
5471 * options.h (class General_options): Add --warn-shared-textrel.
5472 * layout.cc (Layout::finish_dynamic_section): Implement
5473 --warn-shared-textrel.
5474
5475 PR 10980
5476 * options.h (class General_options): Add --warn-multiple-gp.
5477
5478 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5479
5480 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
5481 $(THREADSLIB) and $(LIBDL).
5482 * Makefile.in: Rebuild.
5483
5484 2010-01-06 Ian Lance Taylor <iant@google.com>
5485
5486 PR 10980
5487 * options.cc (General_options::parse_section_start): New function.
5488 (General_options::section_start): New function.
5489 (General_options::General_options): Initialize all members.
5490 * options.h: Include <map>
5491 (class General_options): Add --section-start. Add section_starts_
5492 member.
5493 * layout.cc (Layout::attach_allocated_section_to_segment): If
5494 --section-start was used, set the address of the segment. Remove
5495 local sort_sections.
5496 (Layout::relaxation_loop_body): If the address of the load segment
5497 has been set by --section-start, don't use it.
5498 * output.h (Output_segment::update_flags_for_output_section): New
5499 function.
5500 * output.cc (Output_segment::add_output_section): Call
5501 update_flags_for_output_section.
5502
5503 2010-01-05 Ian Lance Taylor <iant@google.com>
5504
5505 PR 10980
5506 * options.h (class General_options): Add --undefined-version.
5507 * script.cc (struct Version_expression): Add was_matched_by_symbol
5508 field.
5509 (Version_script_info::matched_symbol): New function.
5510 (Version_script_info::get_symbol_version_helper): Call
5511 matched_symbol.
5512 (Version_script_info::check_unmatched_names): New function.
5513 * script.h (class Version_script_info): Update declarations.
5514 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
5515
5516 * options.h (class General_options): Use DEFINE_bool_alias for
5517 allow_multiple_definition.
5518 * resolve.cc (Symbol_table::should_override): Don't test
5519 allow_multiple_definition.
5520
5521 PR 10980
5522 * options.h (class General_options): Add --cref.
5523 * main.cc (main): Print cref table if --cref. Don't close mapfile
5524 until after printing cref table.
5525 * cref.cc: Include "symtab.h".
5526 (class Cref_inputs): Define Cref_table_compare and Cref_table.
5527 (Cref_table_compare::operator()): New function.
5528 (Cref_inputs::gather_cref): New function.
5529 (filecol): New static const.
5530 (Cref_inputs::print_cref): New function.
5531 (Cref::print_cref): New function.
5532 * cref.h: Include <cstdio>.
5533 (class Cref): Update declarations.
5534 * mapfile.h (Mapfile::file): New function.
5535 * object.h (class Object): Define Symbols. Declare virtual
5536 do_get_global_symbols.
5537 (Object::get_global_symbols): New function.
5538 * object.cc (Input_objects::add_object): Pass object to cref_ if
5539 --cref.
5540 (Input_objects::archive_start): Likewise.
5541 (Input_objects::archive_stop): Likewise.
5542 (Input_objects::print_cref): New function.
5543 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
5544 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
5545 --cref.
5546 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
5547 function.
5548 * plugin.h (class Sized_pluginobj): Update declarations.
5549
5550 2010-01-05 Ian Lance Taylor <iant@google.com>
5551
5552 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
5553 to is_default_version. Rename insdef to insdefault.
5554 (Symbol_table::add_from_relobj): Rename def to is_default_version
5555 and local to is_forced_local.
5556 (Symbol_table::add_from_pluginobj): Likewise.
5557 (Symbol_table::add_from_dynobj): Likewise.
5558 (Symbol_table::define_special_symbol): Rename insdef to
5559 insdefault.
5560
5561 2010-01-04 Ian Lance Taylor <iant@google.com>
5562
5563 PR 10980
5564 * options.h (class General_options): Add
5565 --allow-multiple-definition and -z muldefs.
5566 * resolve.cc (Symbol_table::should_override): Don't warn about a
5567 multiple symbol definition if --allow-multiple-definition or -z
5568 muldefs.
5569
5570 PR 10980
5571 * options.h (class General_options): Add --add-needed and
5572 --copy-dt-needed-entries. Tweak --as-needed help entry.
5573 * object.cc (Input_objects::check_dynamic_dependencies): Give an
5574 error if --copy-dt-needed-entries aka --add-needed is used and
5575 would cause a change in behaviour.
5576
5577 PR 10980
5578 * options.h (class General_options): Add -G as a short version of
5579 --shared. Add no-op options -assert, -g, and -i.
5580
5581 2010-01-04 Sriraman Tallam <tmsriram@google.com>
5582
5583 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
5584 check for .text or .gnu.linkonce.t sections.
5585 * icf.cc (Icf::find_identical_sections): Ditto.
5586 Change the detection for mangled function name within the section
5587 name.
5588 * icf.h (is_section_foldable_candidate): New function.
5589
5590 2009-12-30 Ian Lance Taylor <iant@google.com>
5591
5592 PR 10980
5593 * options.h (class General_options): Permit two dashes with
5594 --retain-symbols-file.
5595
5596 2009-12-30 Ian Lance Taylor <iant@google.com>
5597
5598 PR 10979
5599 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
5600 don't put the file header and segment headers in the text
5601 segment.
5602
5603 PR 10979
5604 * common.cc (Sort_commons::operator()): Stabilize sort when both
5605 entries are NULL.
5606 (Symbol_table::do_allocate_commons_list): When allocating common
5607 symbols, skip a symbol which is no longer common.
5608 * symtab.h (Symbol::is_common): Test whether the symbol comes from
5609 an object before checking its type.
5610 * testsuite/common_test_2.c: New file.
5611 * testsuite/common_test_3.c: New file.
5612 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
5613 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
5614 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
5615 (common_test_2_pic.o, common_test_2.so): New targets.
5616 (common_test_3_pic.o, common_test_3.so): New targets.
5617 * testsuite/Makefile.in: Rebuild.
5618
5619 PR 10979
5620 * script.cc (read_input_script): If we see a new SECTIONS clause,
5621 and we have added an input section, give an error.
5622 * layout.h (class Layout): Add have_added_input_section function.
5623 Add have_added_input_section_ field.
5624 * layout.cc (Layout::Layout): Initialize
5625 have_added_input_section_.
5626 (Layout::layout): Set have_added_input_section_.
5627 (Layout::layout_eh_frame): Likewise.
5628
5629 2009-12-30 Ian Lance Taylor <iant@google.com>
5630
5631 PR 10931
5632 * options.h (class General_options): Add --sort-common option.
5633 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
5634 * common.cc (Sort_common): Add sort_order parameter to
5635 constructor. Add sort_order_ field.
5636 (Sort_commons::operator): Check sort_order_.
5637 (Symbol_table::allocate_commons): Determine the sort order.
5638 (Symbol_table::do_allocate_commons): Add sort_order parameter.
5639 Change all callers.
5640 (Symbol_table::do_allocate_commons_list): Likewise.
5641
5642 2009-12-30 Ian Lance Taylor <iant@google.com>
5643
5644 PR 10916
5645 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
5646 symbols from this object, don't change the visibility of an
5647 undefined symbol.
5648 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
5649
5650 2009-12-30 Ian Lance Taylor <iant@google.com>
5651
5652 PR 10861
5653 * script.h (class Version_script_info): Define Language enum.
5654 Update declarations. Define Glob, Exact, and Lookup types. Add
5655 new fields globals_, locals_, and is_finalized_.
5656 * script.cc: Various formatting fixes.
5657 (class Parser_closure): Change language_stack_ from a vector of
5658 std::string to one of Version_script_info::Language. Adjust all
5659 uses accordingly.
5660 (class Lazy_demangler): Remove.
5661 (struct Version_expression): Change language from std::string to
5662 Version_script_info::Language.
5663 (Version_script_info::Version_script_info): New function.
5664 (Version_script_info::~Version_script_info): Don't call clear.
5665 (Version_script_info::finalize): New function.
5666 (Version_script_info::build_lookup_tables): New function.
5667 (Version_script_info::build_expression_list_lookup): New
5668 function.
5669 (Version_script_info::get_symbol_version_helper): Rewrite to use
5670 lookup tables.
5671 (Version_script_info::print_expression_list): Adjust to use
5672 Version_script_info::Language.
5673 (script_push_lex_into_version_mode): Check that the version script
5674 has not been finalized.
5675 (version_script_push_lang): Change language string to
5676 Version_script_info::Language.
5677 * options.cc (Command_line::version_script): New function.
5678 * options.h (class General_options): Add finalize_dynamic_list
5679 function. Change version_script from declaration to definition.
5680 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
5681 * testsuite/version_script.map: Remove duplicate def of foo.
5682 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
5683 version_script.map.
5684 * testsuite/Makefile.in: Rebuild.
5685
5686 2009-12-30 Ian Lance Taylor <iant@google.com>
5687
5688 PR 10843
5689 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
5690 if the input symbol index is 0, make the output symbol index 0.
5691
5692 2009-12-30 Ian Lance Taylor <iant@google.com>
5693
5694 PR 10670
5695 * options.h (class General_options): Add -x/--discard-all.
5696 * object.cc (Sized_relobj::do_count_local_symbols): Handle
5697 --discard-all. If the local symbol needs a dynamic entry, check
5698 that before handling --discard-locals.
5699
5700 2009-12-30 Ian Lance Taylor <iant@google.com>
5701
5702 PR 10450
5703 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
5704 flags to PF_R.
5705 (Output_segment::add_output_section): Don't change the flags if
5706 the type is PT_TLS.
5707
5708 PR 10450
5709 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
5710 GNU hash table if they need a dynamic value. Otherwise, don't add
5711 them if they are defined in a dynamic object or are forced local.
5712
5713 2009-12-29 Ian Lance Taylor <iant@google.com>
5714
5715 PR 10450
5716 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
5717 .gnu.hash table for a 32-bit target.
5718
5719 PR 10450
5720 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
5721 regular and a dynamic object only needs a dynamic symbol table
5722 entry if it is externally visible.
5723
5724 PR 10450
5725 * i386.cc (class Target_i386): Initialize global_offset_table_ in
5726 constructor. Add global_offset_table_ field.
5727 (Target_i386::got_section): Set global_offset_table_.
5728 (Target_i386::do_finalize_sections): Set global_offset_table_
5729 size.
5730 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
5731 in constructor. Add global_offset_table_ field.
5732 (Target_x86_64::got_section): Set global_offset_table_.
5733 (Target_x86_64::do_finalize_sections): Set global_offset_table_
5734 size.
5735
5736 * layout.cc (Layout::Layout): Initialize increase_relro_.
5737 (Layout::get_output_section): Add is_relro, is_last_relro, and
5738 is_first_non_relro parameters. Change all callers.
5739 (Layout::choose_output_section): Likewise.
5740 (Layout::add_output_section_data): Likewise.
5741 (Layout::make_output_section): Likewise.
5742 (Layout::set_segment_offsets): Clear increase_relro when using a
5743 linker script.
5744 * layout.h (class Layout): Add increase_relro method. Add
5745 increase_relro_ field. Update declarations.
5746 * output.cc (Output_section::Output_section): Initialize
5747 is_last_relro_ and is_first_non_relro_.
5748 (Output_segment::add_output_section): Group relro sections is
5749 do_sort is true. Handle is_last_relro and is_first_non_relro.
5750 (Output_segment::maximum_alignment): Remove relro handling.
5751 (Output_segment::set_section_addresses): Add increase_relro
5752 parameter. Change all callers. Add initial alignment to align
5753 relro sections on separate page. Remove old relro handling.
5754 (Output_segment::set_section_list_addresses): Remove in_relro
5755 parameter. Change all callers.
5756 (Output_segment::set_offset): Add increase parameter. Change all
5757 callers. Remove old relro handling.
5758 * output.h (class Output_section): Add new methods: is_last_relro,
5759 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
5760 Add is_last_relro_ and is_first_non_relro_ fields.
5761 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
5762 Create separate .got.plt section. Call increase_relro.
5763 * x86_64.cc (Target_x86_64::got_section): Likewise.
5764 * testsuite/relro_script_test.t: Add .got.plt.
5765
5766 PR 10450
5767 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
5768 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
5769 (Layout::finalize): Call set_dynamic_symbol_size.
5770 (Layout::set_dynamic_symbol_size): New function.
5771 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
5772 set_dynamic_symbol_size.
5773
5774 PR 10450
5775 * output.h (class Output_section): Add is_entsize_zero_ field.
5776 * output.cc (Output_section::Output_section): Initialize
5777 is_entsize_zero_.
5778 (Output_section::set_entsize): If two different entsizes are
5779 requested, force it to zero.
5780 (Output_section::add_input_section): Set flags for .debug_str
5781 before updating section flags. Set entsize.
5782 (Output_section::update_flags_for_input_section): Set SHF_MERGE
5783 and SHF_STRING if all input sections have those flags.
5784
5785 2009-12-29 Rafael Espindola <espindola@google.com>
5786
5787 * main.cc (main): Fix the sys time reporting.
5788 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
5789 reporting.
5790
5791 2009-12-29 Sriraman Tallam <tmsriram@google.com>
5792
5793 * options.cc (General_options::parse_version): Allow -v to exit
5794 without an error if there is nothing to link.
5795
5796 2009-12-29 Ian Lance Taylor <iant@google.com>
5797
5798 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
5799 using a version of gcc before 4.1.
5800 * configure: Rebuild.
5801
5802 2009-12-28 Chris Demetriou <cgd@google.com>
5803
5804 * attributes.cc (Output_attributes_section_data::do_write): Use
5805 std::vector::front rather than std::vector::data.
5806
5807 2009-12-28 Ian Lance Taylor <iant@google.com>
5808
5809 * symtab.h (class Symbol_table): Add enum Defined.
5810 * resolve.cc (Symbol_table::should_override): Add defined
5811 parameter. Change all callers. Test whether object is NULL
5812 before calling a method on it.
5813 (Symbol_table::report_resolve_problem): Add defined parameter.
5814 Change all callers.
5815 (Symbol_table::should_override_with_special): Likewise.
5816 * symtab.cc (Symbol_table::define_in_output_data): Add defined
5817 parameter. Change all callers.
5818 (Symbol_table::do_define_in_output_data): Likewise.
5819 (Symbol_table::define_in_output_segment): Likewise.
5820 (Symbol_table::do_define_in_output_segment): Likewise.
5821 (Symbol_table::define_as_constant): Likewise.
5822 (Symbol_table::do_define_as_constant): Likewise.
5823 * script.h (class Symbol_assignment): Add is_defsym parameter to
5824 constructor; change all callers.
5825 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
5826 parameter. Change all callers. Add is_defsym_ field.
5827 (class Parser_closure): Add parsing_defsym parameter to
5828 constructor; change all callers. Add parsing_defsym accessor
5829 function. Add parsing_defsym_ field.
5830
5831 2009-12-28 Ian Lance Taylor <iant@google.com>
5832
5833 * gold.cc (queue_middle_tasks): Fix formatting.
5834 * object.cc (Relobj::is_section_name_included): Likewise.
5835
5836 2009-12-23 Ian Lance Taylor <iant@google.com>
5837
5838 * i386.cc (Target_i386::do_calls_non_split): Recognize
5839 -fsplit-stack prologue for a function with a static chain.
5840 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
5841 -fsplit-stack prologue when using %r11.
5842
5843 2009-12-21 Sriraman Tallam <tmsriram@google.com>
5844
5845 * options.cc (General_options::parse_version): Make -v continue and do
5846 the link like GNU ld does.
5847
5848 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
5849
5850 * Makefile.am (CCFILES): Add timer.cc.
5851 (HFILES): Add timer.h.
5852 * configure.ac: Check for sysconf and times.
5853 * main.cc: include timer.h.
5854 (main): Use Timer instead of get_run_time.
5855 * timer.cc: New.
5856 * timer.h: New.
5857 * workqueue.cc: include timer.h.
5858 (Workqueue::find_and_run_task):
5859 Report user, sys and wall time.
5860 * Makefile.in: Regenerate.
5861 * config.in: Regenerate.
5862 * configure: Regenerate.
5863
5864 2009-12-16 Doug Kwan <dougkwan@google.com>
5865
5866 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
5867 sections.
5868 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
5869 relaxed input sections.
5870 * output.cc (Output_section::find_relaxed_input_section): Change
5871 return type to Output_relaxed_input_section pointer. Adjust code
5872 for new type of relaxed_input_section_map_.
5873 * output.h (Output_section::find_relaxed_input_section): Change
5874 return type to Output_relaxed_input_section pointer.
5875 (Output_section::Output_relaxed_input_section_by_input_section_map):
5876 New type.
5877 (Output_section::relaxed_input_section_map_): Change type to
5878 Output_section::Output_relaxed_input_section_by_input_section_map.
5879 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
5880 input section.
5881
5882 2009-12-15 Ian Lance Taylor <iant@google.com>
5883
5884 * layout.cc (Layout::create_shstrtab): Only write out after input
5885 sections if we are compressing debug sections.
5886
5887 2009-12-15 Ian Lance Taylor <iant@google.com>
5888
5889 * archive.cc (Archive::add_symbols): Only look up a symbol without
5890 a version if there is, in fact, a version.
5891
5892 2009-12-14 Ian Lance Taylor <iant@google.com>
5893
5894 Revert -Wshadow changes, all changes from:
5895 2009-12-11 Doug Kwan <dougkwan@google.com>
5896 2009-12-11 Nick Clifton <nickc@redhat.com>
5897 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
5898
5899 2009-12-11 Doug Kwan <dougkwan@google.com>
5900
5901 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
5902 due to -Wshadow.
5903 * attributes.cc (Object_attribute::size): Ditto.
5904 (Attributes_section_data::size): Ditto.
5905 (Attributes_section_data::Attributes_section_data): Ditto.
5906 (Output_attributes_section_data::do_write): Ditto.
5907 * attributes.h (Object_attribute::set_type): Ditto.
5908 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
5909
5910 2009-12-11 Nick Clifton <nickc@redhat.com>
5911
5912 * archive.cc: Fix shadowed variable warnings.
5913 * arm.cc: Likewise.
5914 * compressed_output.cc: Likewise.
5915 * compressed_output.h: Likewise.
5916 * configure: Likewise.
5917 * dwarf_reader.cc: Likewise.
5918 * dynobj.cc: Likewise.
5919 * dynobj.h: Likewise.
5920 * ehframe.cc: Likewise.
5921 * ehframe.h: Likewise.
5922 * errors.cc: Likewise.
5923 * expression.cc: Likewise.
5924 * fileread.cc: Likewise.
5925 * fileread.h: Likewise.
5926 * freebsd.h: Likewise.
5927 * i386.cc: Likewise.
5928 * icf.cc: Likewise.
5929 * incremental.h: Likewise.
5930 * layout.cc: Likewise.
5931 * layout.h: Likewise.
5932 * mapfile.cc: Likewise.
5933 * merge.cc: Likewise.
5934 * merge.h: Likewise.
5935 * object.cc: Likewise.
5936 * object.h: Likewise.
5937 * options.h: Likewise.
5938 * output.cc: Likewise.
5939 * output.h: Likewise.
5940 * parameters.cc: Likewise.
5941 * plugin.cc: Likewise.
5942 * powerpc.cc: Likewise.
5943 * reduced_debug_output.cc: Likewise.
5944 * reduced_debug_output.h: Likewise.
5945 * reloc.cc: Likewise.
5946 * reloc.h: Likewise.
5947 * resolve.cc: Likewise.
5948 * script-sections.cc: Likewise.
5949 * script.cc: Likewise.
5950 * script.h: Likewise.
5951 * sparc.cc: Likewise.
5952 * symtab.cc: Likewise.
5953 * symtab.h: Likewise.
5954 * target-select.cc: Likewise.
5955 * target-select.h: Likewise.
5956 * token.h: Likewise.
5957 * workqueue.cc: Likewise.
5958 * workqueue.h: Likewise.
5959 * x86_64.cc: Likewise.
5960
5961 2009-12-10 Doug Kwan <dougkwan@google.com>
5962
5963 * arm.cc (attributes.h): New include.
5964 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
5965 (Arm_relobj::~Arm_relobj): Delete object pointed by
5966 attributes_section_data_.
5967 (Arm_relobj::attributes_section_data): New method definition.
5968 (Arm_relobj::attributes_section_data_): New data member declaration.
5969 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
5970 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
5971 attributes_section_data_.
5972 (Arm_dynobj::attributes_section_data): New method definition.
5973 (Arm_dynobj::attributes_section_data_): New data member declaration.
5974 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
5975 initialization value of may_use_blx_ to false.
5976 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
5977 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
5978 object attributes to compute results instead of hard-coding.
5979 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
5980 Target_arm::get_secondary_compatible_arch,
5981 Target_arm::set_secondary_compatible_arch
5982 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5983 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
5984 New method declarations.
5985 (Target_arm::get_aeabi_object_attribute): New method definition.
5986 (Target_arm::attributes_section_data_): New data member declaration.
5987 (read_arm_attributes_section): New template definition.
5988 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
5989 (Arm_dynobj::do_read_symbols): Ditto.
5990 (Target_arm::do_finalize_sections): Merge attributes sections from
5991 input. Check for BLX use after attributes section merging.
5992 Fix __exidx_start and __exidx_end visibility. Create an
5993 .ARM.attributes section if necessary.
5994 (Target_arm::get_secondary_compatible_arch,
5995 Target_arm::set_secondary_compatible_arch,
5996 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
5997 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
5998 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
5999 New method definitions.
6000
6001 2009-12-09 Ian Lance Taylor <iant@google.com>
6002
6003 * plugin.cc (Plugin::load): Don't cast from void* to a function
6004 pointer.
6005
6006 2009-12-09 Ian Lance Taylor <iant@google.com>
6007
6008 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
6009 information fields.
6010
6011 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
6012
6013 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
6014 Replace two_file_shared_1.so with two_file_shared_2.so.
6015 * testsuite/Makefile.in: Regenerated.
6016
6017 2009-12-08 Doug Kwan <dougkwan@google.com>
6018
6019 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
6020 (HFILES): Add attributes.h and int_encoding.h.
6021 * Makefile.in: Regenerate.
6022 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
6023 function definitions to int_encoding.cc
6024 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
6025 prototypes to int_encoding.h
6026 * reduced_debug_output.cc (int_encoding.h): New include.
6027 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
6028 function definitions to int_encoding.cc
6029 (insert_into_vector, read_from_pointer): Move template definitions to
6030 int_encoding.h
6031 * attributes.cc: New file.
6032 * attributes.h: New file.
6033 * int_encoding.cc: New file.
6034 * int_encoding.h: New file.
6035
6036 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
6037
6038 PR gold/11055
6039 * incremental-dump.cc (dump_incremental_inputs): New.
6040 (main): Use dump_incremental_inputs.
6041
6042 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
6043
6044 PR gold/10893
6045 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
6046 checking elfcpp::STT_FUNC.
6047 (Target_i386::Relocate::relocate): Likewise.
6048 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6049
6050 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
6051 symbols from shared libraries into normal FUNC symbols.
6052
6053 * symtab.h (Symbol): Add is_func and use it.
6054
6055 2009-12-05 Doug Kwan <dougkwan@google.com>
6056
6057 * arm.cc (Target_arm::arm_info): Initialize new fields
6058 attributes_section and attributes_vendor.
6059 * i386.cc (Target_i386::i386_info): Same.
6060 * object.cc (Sized_relobj::do_layout): Skip attribute section.
6061 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
6062 fields attributes_section and attributes_vendor.
6063 * sparc.cc (Target_sparc::sparc_info): Same.
6064 * target.h (Target::attributes_section, Target::attributes_vendor,
6065 Target::is_attributes_section, Target::attribute_arg_type,
6066 Target::attributes_order): New method definitions.
6067 (Target::Target_info::attributes_section,
6068 Target::Target_info::attributes_vendor): New fields.
6069 (Target::do_attribute_arg_type, Target::do_attributes_order): New
6070 virtual method definitions.
6071 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
6072 attributes_section and attributes_vendor.
6073 * testsuite/testfile.cc (Target_test::test_target_info): Same.
6074
6075 2009-12-05 Doug Kwan <dougkwan@google.com>
6076
6077 * arm.cc: Update comments about interworking and stub generation.
6078 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
6079 considered as non-PIC.
6080 (Arm_relocate_functions::base_abs): Fix formatting.
6081 (Arm_relocate_functions::got_prel): Fix comment. Change interface
6082 of function to use GOT entry address instead of offset.
6083 (Target_arm::Scan::global): Issue an error if a symbol would need a
6084 PLT does not get one because it is untyped. Remove code to create
6085 dynamic symbols for relative branches.
6086 (Target_arm::Relocate::relocate: Use 0 instead of false since function
6087 takes unsigned integer instead of boolean.
6088
6089 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
6090
6091 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
6092 (two_file_test_LDADD): Likewise.
6093 (common_test_1_LDADD): Likewise.
6094 (exception_test_LDADD) Likewise.
6095 (weak_test_LDADD): Likewise.
6096 (many_sections_test_LDADD): Likewise.
6097 (initpri1_LDADD): Likewise.
6098 (script_test_1_LDADD): Likewise.
6099 (script_test_2_LDADD): Likewise.
6100 (justsyms_LDADD): Likewise.
6101 (binary_test_LDADD): Likewise.
6102 (large_LDADD): Likewise.
6103 * testsuite/Makefile.in: Regenerated.
6104
6105 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
6106
6107 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
6108 (Symbol_table::override_with_special): Likewise.
6109 (Symbol_table::add_from_object): Likewise.
6110
6111 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6112
6113 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6114 Don't set the data_offset twice.
6115
6116 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
6117
6118 * testsuite/Makefile.in: Regenerate.
6119
6120 2009-12-03 Doug Kwan <dougkwan@google.com>
6121
6122 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
6123 (Target_arm::do_finalize_sections): Add parameter for symbol table
6124 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
6125 * i386.cc (Target_i386::do_finalize_sections): Add an additional
6126 parameter for symbol table pointer.
6127 * layout.cc (Layout::finalize): Call Target::finalize_sections with
6128 an additional parameter for a pointer to symbol table.
6129 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
6130 parameter for a symbol table pointer.
6131 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
6132 * target.h (Target::finalize_sections, Target::do_finalize_sections):
6133 Ditto.
6134 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
6135 parameter for a symbol table pointer.
6136
6137 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
6138
6139 * incremental.cc (Incremental_inputs_header)
6140 (Incremental_inputs_header_write, Incremental_inputs_entry)
6141 (Incremental_inputs_entry_write): Move ...
6142 * incremental.h (Incremental_inputs_header)
6143 (Incremental_inputs_header_write, Incremental_inputs_entry)
6144 (Incremental_inputs_entry_write): here.
6145
6146 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6147
6148 * incremental.cc (make_sized_incremental_binary): Set the target.
6149 Error if it is incompatible.
6150 * output.h (Output_file): Add filename method.
6151
6152 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6153
6154 * incremental.cc (Incremental_inputs_entry): Remove unused argument
6155 from the get_* methods.
6156
6157 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6158
6159 * incremental-dump.cc (main): Check that the offeset of a script is 0.
6160 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
6161 Write 0 for the data_offset of scripts.
6162
6163 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
6164
6165 * testsuite/Makefile.am: Add the incremental_test.sh test.
6166 * testsuite/incremental_test.sh: New.
6167 * testsuite/incremental_test_1.c: New.
6168 * testsuite/incremental_test_2.c: New.
6169
6170 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
6171
6172 * incremental-dump.cc (main): Fix typos.
6173
6174 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
6175
6176 PR gold/11025
6177 * incremental-dump.cc (main): Use llu to print 64 bit values.
6178
6179 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
6180 H.J. Lu <hongjiu.lu@intel.com>
6181
6182 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
6183 $(LIBDL).
6184 (incremental_dump_LDADD): Likewise.
6185 * Makefile.in: Regenerated.
6186
6187 2009-11-25 Doug Kwan <dougkwan@google.com>
6188
6189 Revert:
6190
6191 2009-11-25 Doug Kwan <dougkwan@google.com>
6192
6193 * arm.cc (Target_arm::Target_arm): Move method definition
6194 outside of class definition. Add code to handle
6195 --target1-rel, --target1-abs and --target2= options.
6196 (Target_arm::get_reloc_reloc_type): Change method to be
6197 non-static and const.
6198 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
6199 New data member declaration.
6200 (Target_arm::Scan::local, Target_arm::Scan::global,
6201 Target_arm::Relocate::relocate,
6202 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6203 Adjust call to Target_arm::get_real_reloc_type.
6204 (Target_arm::get_real_reloc_type): Use command line options
6205 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6206 * options.h (--target1-rel, --target1-abs, --target2): New
6207 ARM-only options.
6208
6209 2009-11-25 Doug Kwan <dougkwan@google.com>
6210
6211 * arm.cc (Target_arm::Target_arm): Move method definition outside of
6212 class definition. Add code to handle --target1-rel, --target1-abs
6213 and --target2= options.
6214 (Target_arm::get_reloc_reloc_type): Change method to be non-static
6215 and const.
6216 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
6217 member declaration.
6218 (Target_arm::Scan::local, Target_arm::Scan::global,
6219 Target_arm::Relocate::relocate,
6220 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
6221 call to Target_arm::get_real_reloc_type.
6222 (Target_arm::get_real_reloc_type): Use command line options to
6223 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
6224 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
6225 options.
6226
6227 2009-11-25 Doug Kwan <dougkwan@google.com>
6228
6229 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
6230 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
6231 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
6232 formatting.
6233 (Arm_relocate_functions::thm_call): Replace body with a call to
6234 Arm_relocate_functions::thumb_branch_common.
6235 (Arm_relocate_functions::thm_jump24,
6236 Arm_relocate_functions::thm_xpc22): New method definitions.
6237 (Arm_relocate_functions::thumb_branch_common): New method definition.
6238 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
6239 operator.
6240 (Target_arm::Relocate::relocate): Adjust call to thm_call.
6241 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
6242
6243 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6244
6245 * Makefile.am: Build incremental-dump
6246 * Makefile.in: Regenerate.
6247 * incremental-dump.cc: New.
6248 * incremental.cc (Incremental_inputs_header_data,
6249 Incremental_inputs_entry_data): Move to incremental.h
6250 * incremental.h: (Incremental_inputs_header_data,
6251 Incremental_inputs_entry_data): Move from incremental.cc
6252
6253 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6254
6255 * incremental.cc (Incremental_inputs_header,
6256 Incremental_inputs_header_write, Incremental_inputs_entry,
6257 Incremental_inputs_entry_write): Add a typedef with the data type.
6258
6259 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
6260
6261 * incremental.cc (Incremental_inputs_header,
6262 Incremental_inputs_header_write, Incremental_inputs_entry,
6263 Incremental_inputs_entry_write): Update comment about which
6264 type has the filed descriptions.
6265
6266 2009-11-15 Doug Kwan <dougkwan@google.com>
6267
6268 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
6269 (Arm_relocate_functions::arm_branch_common): Change method defintion
6270 in class definition to a method declaration and update list of formal
6271 parameters.
6272 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
6273 Arm_relocation_functions::jump24): Adjust call to
6274 Arm_relocate_functions::arm_branch_common. Update list of formal
6275 parameters.
6276 (Arm_relocate_functions::xpc25): New method definition.
6277 (Arm_relocate_functions::arm_branch_common): Move method defintion
6278 out from class definition. Use stubs for mode-switching and extending
6279 branch ranges.
6280 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
6281 specially. Change code to enable use of stubs in ARM branches.
6282
6283 2009-11-10 Doug Kwan <dougkwan@google.com>
6284
6285 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
6286 in method declaration.
6287 (Target_arm::relocate_stub): New method declaration.
6288 (Target_arm::default_target): Change to return a pointer instead of
6289 a const reference.
6290 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
6291 Target_arm::default_target.
6292 (Arm_Relobj::do_relocate_sections): Remove options paramater in
6293 method definition.
6294 (Target_arm::relocate_section): Adjust view.
6295 (Target_arm::relocate_stub): New method definition.
6296
6297 2009-11-10 Doug Kwan <dougkwan@google.com>
6298
6299 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
6300 a format warning.
6301 * incremental.cc (open_incremental_binary): Initialized local
6302 variables to avoid warnings.
6303 * object.cc (make_elf_object): Ditto.
6304 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
6305 a format warning.
6306
6307 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
6308
6309 PR gold/10930
6310 * testsuite/plugin_test.c: Include "config.h".
6311
6312 2009-11-09 Doug Kwan <dougkwan@google.com>
6313
6314 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
6315 (arm_symbol_value): Remove.
6316 (Arm_relocate_functions::arm_branch_common,
6317 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
6318 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
6319 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
6320 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
6321 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
6322 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
6323 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
6324 Arm_relocate_functions::thm_mobw_abs_nc,
6325 Arm_relocate_functions::thm_mov_abs,
6326 Arm_relocate_functions::movw_prel_nc,
6327 Arm_relocate_functions::thm_movt_abs,
6328 Arm_relocate_functions::movt_prel,
6329 Arm_relocate_functions::thm_movw_prel_nc,
6330 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
6331 (Target_arm::Relocate::relocate): Only decompose address into two
6332 parts if relocation type uses the thumb-bit and pass the actual
6333 bit instead of a flag indicating that the thumb-bit is used. Adjust
6334 calls to methods in Arm_relocate_functions for this change.
6335
6336 2009-11-08 Ian Lance Taylor <iant@google.com>
6337
6338 PR 10925
6339 * reloc.cc: Instantiate
6340 Sized_relobj::initialize_input_to_output_maps and
6341 Sized_relobj:free_input_to_output_maps.
6342
6343 2009-11-06 Ian Lance Taylor <iant@google.com>
6344
6345 PR 10876
6346 * defstd.cc (in_segment): Set only_if_ref true for "end".
6347
6348 2009-11-06 Doug Kwan <dougkwan@google.com>
6349
6350 * arm.cc (class Reloc_stub): Correct a comment.
6351 (Target_arm::Target_arm): Initialize arm_input_section_map_.
6352 (Target_arm::scan_section_for_stubs): New method declaration.
6353 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
6354 Change methods from private to protected.
6355 (Target_arm::do_may_relax): New method definition.
6356 (Target_arm::do_relax, Target_arm::group_sections,
6357 Target_arm::scan_reloc_for_stub,
6358 Target_arm::scan_reloc_section_for_stubs): New method declarations.
6359 (Target_arm::arm_input_section_map_): New data member declaration.
6360 (Target_arm::scan_reloc_for_stub,
6361 Target_arm::scan_reloc_section_for_stubs,
6362 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
6363 Target_arm::do_relax): New method definitions.
6364
6365 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
6366
6367 * configure.ac: Check for (struct stat)::st_mtim
6368 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
6369 * config.in: Regenerate.
6370 * configure: Regenerate.
6371
6372 2009-11-05 Ian Lance Taylor <iant@google.com>
6373
6374 PR 10910
6375 * output.cc (Output_segment::add_output_section): Add missing
6376 return statement.
6377
6378 2009-11-04 Ian Lance Taylor <iant@google.com>
6379
6380 PR 10880
6381 * object.h (class Object): Add is_needed and set_is_needed
6382 methods. Add is_needed_ field. Make bool fields into bitfields.
6383 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
6384 defined in a dynamic object and referenced by a regular object,
6385 set is_needed for the dynamic object.
6386 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
6387 if the file is marked with as_needed and it is not needed.
6388
6389 2009-11-04 Ian Lance Taylor <iant@google.com>
6390
6391 PR 10887
6392 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
6393 tags if data is discarded by linker script.
6394 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6395 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
6396 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
6397 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6398
6399 2009-11-04 Ian Lance Taylor <iant@google.com>
6400
6401 * layout.cc (Layout::get_output_section): Add is_interp and
6402 is_dynamic_linker_section parameters. Change all callers.
6403 (Layout::choose_output_section): Likewise.
6404 (Layout::make_output_section): Likewise.
6405 (Layout::add_output_section_data): Add is_dynamic_linker_section
6406 parameter. Change all callers.
6407 * layout.h (class Layout): Update declarations.
6408 * output.h (class Output_section): Add is_interp, set_is_interp,
6409 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
6410 Add is_interp_, is_dynamic_linker_section_ fields. Change
6411 generate_code_fills_at_write_ to a bitfield.
6412 * output.cc (Output_section::Output_sections): Initialize new
6413 fields.
6414 (Output_segment::add_output_section): Add do_sort parameter.
6415 Change all callers.
6416
6417 2009-11-03 Ian Lance Taylor <iant@google.com>
6418
6419 PR 10860
6420 * options.h (class General_options): Add --warn-common.
6421 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
6422 merging two common symbols.
6423 (Symbol_table::should_override): Handle --warn-common when merging
6424 a common symbol with a defined symbol. Use report_resolve_problem
6425 for multiple definitions.
6426 (Symbol_table::report_resolve_problem): New function.
6427 * symtab.h (class Symbol_table): Declare report_resolve_problem.
6428
6429 2009-11-03 Doug Kwan <dougkwan@google.com>
6430
6431 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
6432 stub_factory_.
6433 (Target_arm::stub_factory): New method definition.
6434 (Target_arm::new_arm_input_section,
6435 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
6436 Target_arm::reloc_uses_thumb_bit): New method declarations.
6437 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
6438 New type definitions.
6439 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
6440 member declarations.
6441 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
6442 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
6443 New method definitions.
6444
6445 2009-11-03 Ian Lance Taylor <iant@google.com>
6446
6447 * options.h (class General_options): Add --warn_constructors.
6448
6449 2009-11-03 Ian Lance Taylor <iant@google.com>
6450
6451 PR 10893
6452 * defstd.cc (in_section): Add entries for __rel_iplt_start,
6453 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
6454
6455 2009-11-03 Ian Lance Taylor <iant@google.com>
6456
6457 PR 10895
6458 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
6459 --msgid-bugs-address.
6460 (install-pdf): New target.
6461 (install-data_yes): Look up one directory to find mkinstalldirs.
6462
6463 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
6464
6465 * po/Make-in (.po.gmo): Don't generate .gmo files in source
6466 tree.
6467
6468 2009-10-30 Doug Kwan <dougkwan@google.com>
6469
6470 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
6471
6472 2009-10-30 Doug Kwan <dougkwan@google.com>
6473
6474 * arm.cc (Stub_addend_reader): New struct template definition
6475 and partial specializations.
6476 (Stub_addend_reader::operator()): New method definition for a
6477 partially specialized template.
6478
6479 2009-10-30 Doug Kwan <dougkwan@google.com>
6480
6481 * arm.cc (Arm_relobj::processor_specific_flags): New method
6482 definition.
6483 (Arm_relobj::do_read_symbols): New method declaration.
6484 (Arm_relobj::processor_specific_flags_): New data member declaration.
6485 (Arm_dynobj): New class definition.
6486 (Target_arm::do_finalize_sections): Add input_objects parameter.
6487 (Target_arm::do_adjust_elf_header): New method declaration.
6488 (Target_arm::are_eabi_versions_compatible,
6489 (Target_arm::merge_processor_specific_flags): New method declaration.
6490 (Target_arm::do_make_elf_object): New overloaded method definitions
6491 and declaration.
6492 (Arm_relobj::do_read_symbols): New method definition.
6493 (Arm_dynobj::do_read_symbols): Ditto.
6494 (Target_arm::do_finalize_sections): Add input_objects parameters.
6495 Merge processor-specific flags from all input objects.
6496 (Target_arm::are_eabi_versions_compatible,
6497 Target_arm::merge_processor_specific_flags,
6498 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
6499 New method definitions.
6500 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
6501 Input_objects pointer type parameter.
6502 * layout.cc (Layout::finalize): Pass input objects to target's.
6503 finalize_sections function.
6504 * output.cc (Output_file_header::do_sized_write): Set ELF file
6505 header's processor-specific flags.
6506 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
6507 Input_objects pointer type parameter.
6508 * sparc.cc (Target_sparc::do_finalize_sections): Same.
6509 * target.h (Input_objects): New forward class declaration.
6510 (Target::processor_specific_flags,
6511 Target::are_processor_specific_flags_sect): New method definitions.
6512 (Target::finalize_sections): Add input_objects parameter.
6513 (Target::Target): Initialize processor_specific_flags_ and
6514 are_processor_specific_flags_set_.
6515 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
6516 parameter.
6517 (Target::set_processor_specific_flags): New method definition.
6518 (Target::processor_specific_flags_,
6519 Target::are_processor_specific_flags_set_): New data member
6520 declarations.
6521 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
6522 Input_objects pointer type parameter.
6523
6524 2009-10-30 Doug Kwan <dougkwan@google.com>
6525
6526 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
6527
6528 2009-10-28 Ian Lance Taylor <iant@google.com>
6529
6530 * object.h (class Relobj): Drop options parameter from
6531 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
6532 do_scan_relocs, do_relocate. Change all callers.
6533 (class Sized_relobj): Drop options parameters from
6534 do_gc_process_relocs, do_scan_relocs, do_relocate,
6535 do_relocate_sections, relocate_sections, emit_relocs_scan,
6536 emit_relocs_scan_reltype. Change all callers.
6537 (struct Relocate_info): Remove options field and all references to
6538 it.
6539 * reloc.h (class Read_relocs): Remove options constructor
6540 parameter and options_ field. Change all callers.
6541 (class Gc_process_relocs, class Scan_relocs): Likewise.
6542 (class Relocate_task): Likewise.
6543 * target-reloc.h (scan_relocs): Remove options parameter. Change
6544 all callers.
6545 (scan_relocatable_relocs): Likewise.
6546 * target.h (class Sized_target): Remove options parameter from
6547 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
6548 all callers.
6549 * gc.h (gc_process_relocs): Remove options parameter. Change all
6550 callers.
6551 * arm.cc: Update functions to remove options parameters.
6552 * i386.cc: Likewise.
6553 * powerpc.cc: Likewise.
6554 * sparc.cc: Likewise.
6555 * x86_64.cc: Likewise.
6556 * testsuite/testfile.cc: Likewise.
6557
6558 2009-10-28 Doug Kwan <dougkwan@google.com>
6559
6560 * arm.cc (Arm_relobj): New class definition.
6561 (Arm_relobj::scan_sections_for_stubs,
6562 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
6563 New method definitions.
6564
6565 2009-10-28 Cary Coutant <ccoutant@google.com>
6566
6567 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
6568 (Plugin::cleanup_done_): New member.
6569 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
6570 (Plugin_manager::cleanup_done_): Remove.
6571 (Plugin_manager::add_input_file): Edit error message.
6572 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
6573 (Plugin_manager::cleanup): Remove use of cleanup_done_.
6574
6575 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
6576
6577 * fileread.cc: (File_read::View::~View): Use the new
6578 data_ownership_ filed.
6579 (File_read::~File_read): Dispose the new whole_file_view_.
6580 (File_read::open): Mmap the whole file if needed.
6581 (File_read::open): Use whole_file_view_ instead of contents_.
6582 (File_read::find_view): Use whole_file_view_ if applicable.
6583 (File_read::do_read): Use whole_file_view_ instead of contents_.
6584 (File_read::make_view): Use whole_file_view_ instead of contents_,
6585 update File_read::View::View call.
6586 (File_read::find_or_make_view): Update File_read::View::View
6587 call.
6588 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
6589 remove contents_
6590 (File_read::View::Data_ownership): New enum.
6591 (File_read::View::View): Replace bool mapped_ with Data_ownership
6592 argument.
6593 (File_read::View::mapped_): Remove (replaced by data_ownership_).
6594 (File_read::View::data_ownership_): New field.
6595 (File_read::contents_): Remove (replaced by whole_file_view_).
6596 (File_read::whole_file_view_): New field.
6597 * options.h (class General_options): Add --keep-files-mapped.
6598
6599 2009-10-27 Cary Coutant <ccoutant@google.com>
6600
6601 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
6602 * testsuite/Makefile.am (plugin_test_5): New test case.
6603 * testsuite/Makefile.in: Regenerate.
6604
6605 2009-10-25 Doug Kwan <dougkwan@google.com>
6606
6607 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
6608 from private to protected to allow access by child class.
6609 (Sized_relobj::do_relocate_sections): New method declaration.
6610 (Sized_relobj::relocate_sections): Virtualize.
6611 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
6612 Sized_relobj::relocate_sections. Instantiate template explicitly
6613 for different target sizes and endianity.
6614
6615 2009-10-24 Doug Kwan <dougkwan@google.com>
6616
6617 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
6618 (Arm_input_section::as_arm_input_section): New method.
6619 (Arm_output_section): New class definition.
6620 (Arm_output_section::create_stub_group,
6621 Arm_output_section::group_sections): New method definitions.
6622
6623 2009-10-22 Doug Kwan <dougkwan@google.com>
6624
6625 * arm.cc (Arm_input_section): New class definition.
6626 (Arm_input_section::init, Arm_input_section:do_write,
6627 Arm_input_section::set_final_data_size,
6628 Arm_input_section::do_reset_address_and_file_offset): New method
6629 definitions.
6630
6631 2009-10-21 Doug Kwan <dougkwan@google.com>
6632
6633 * arm.cc (Stub_table, Arm_input_section): New forward class
6634 declarations.
6635 (Stub_table): New class defintion.
6636 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
6637 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
6638 New method definition.
6639
6640 2009-10-21 Doug Kwan <dougkwan@google.com>
6641
6642 * arm.cc: Update copyright comments.
6643 (Target_arm): New forward class template declaration.
6644 (Arm_address): New type.
6645 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
6646 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
6647 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
6648 constants.
6649 (Insn_template): Same.
6650 (DEF_STUBS): New macro.
6651 (Stub_type): New enum type.
6652 (Stub_template): New class definition.
6653 (Stub): Same.
6654 (Reloc_stub): Same.
6655 (Stub_factory): Same.
6656 (Target_arm::Target_arm): Initialize may_use_blx_ and
6657 should_force_pic_veneer_.
6658 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
6659 Target_arm::should_force_pic_veneer,
6660 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
6661 Target_arm::using_thumb_only, Target_arm:;default_target): New
6662 method defintions.
6663 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
6664 New data member declarations.
6665 (Insn_template::size, Insn_template::alignment): New method defintions.
6666 (Stub_template::Stub_template): New method definition.
6667 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
6668 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
6669 (Stub_factory::Stub_factory): New method definition.
6670 * gold.h (string_hash): New template.
6671 * output.h (Input_section_specifier::hash_value): Use
6672 gold::string_hash.
6673 (Input_section_specifier::string_hash): Remove.
6674 * stringpool.cc (Stringpool_template::string_hash): Use
6675 gold::string_hash.
6676
6677 2009-10-20 Doug Kwan <dougkwan@google.com>
6678
6679 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
6680 symbols of relaxed input sections.
6681 * output.h (Output_section::find_relaxed_input_section): Make
6682 method public.
6683
6684 2009-10-16 Doug Kwan <dougkwan@google.com>
6685
6686 * dynobj.cc (Versions::Versions): Initialize version_script_.
6687 Only insert base version symbol definition for a shared object
6688 if version script defines any version versions.
6689 (Versions::define_base_version): New method definition.
6690 (Versions::add_def): Check that base version is not needed.
6691 (Versions::add_need): Define base version lazily.
6692 * dynobj.h (Versions::define_base_version): New method declaration.
6693 (Versions::needs_base_version_): New data member declaration.
6694 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
6695 (check_DATA): Add no_version_test.stdout.
6696 (libno_version_test.so, no_version_test.o no_version_test.stdout):
6697 New make rules.
6698 * testsuite/Makefile.in: Regenerate.
6699 * testsuite/no_version_test.c: New file.
6700 * testsuite/no_version_test.sh: Ditto.
6701
6702 2009-10-16 Doug Kwan <dougkwan@google.com>
6703
6704 * expression.cc (class Segment_start_expression): New class definition.
6705 (Segment_start_expression::value): New method definition.
6706 (script_exp_function_segment_start): Return a new
6707 Segment_start_expression.
6708 * gold/script-c.h (script_saw_segment_start_expression): New function
6709 prototype.
6710 * script-sections.cc (Script_sections::Script_sections): Initialize
6711 SAW_SEGMENT_START_EXPRESSION_ to false.
6712 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
6713 and -Tbbs options to specify section addresses if given in
6714 command line and no SEGMENT_START expression is seen in a script.
6715 * script-sections.h (Script_sections::saw_segment_start_expression,
6716 Script_sections::set_saw_segment_start_expression): New method
6717 definition.
6718 (Script_sections::saw_segment_start_expression_): New data member
6719 declaration.
6720 * script.cc (script_saw_segment_start_expression): New function.
6721 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
6722 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
6723 script_test_7.sh and script_test_8.sh.
6724 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
6725 script_test_8.stdout.
6726 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
6727 (script_test_6, script_test_6.stdout, script_test_7,
6728 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
6729 * Makefile.in: Regenerate.
6730 * testsuite/script_test_6.sh: New file.
6731 * testsuite/script_test_6.t: Same.
6732 * testsuite/script_test_7.sh: Same.
6733 * testsuite/script_test_7.t: Same.
6734 * testsuite/script_test_8.sh: Same.
6735
6736 2009-10-16 Doug Kwan <dougkwan@google.com>
6737
6738 * output.cc (Output_segment::set_section_list_address): Cast
6739 expressions to unsigned long long type to avoid format warnings.
6740
6741 2009-10-15 Ian Lance Taylor <iant@google.com>
6742
6743 * script.cc (Script_options::add_symbol_assignment): Always add a
6744 dot assignment to script_sections_.
6745 * script-sections.cc (Script_sections::add_dot_assignment):
6746 Initialize if necessary.
6747
6748 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
6749 program headers with no load segment if there is a linker script.
6750
6751 * layout.cc (Layout::set_segment_offsets): Align the file offset
6752 to the segment aligment for -N or -n with no load segment.
6753 * output.cc (Output_segment::add_output_section): Don't crash if
6754 the first section is a TLS section.
6755 (Output_segment::set_section_list_addresses): Print an error
6756 message if the address moves backward in a linker script.
6757 * script-sections.cc
6758 (Output_section_element_input::set_section_addresses): Don't
6759 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
6760 (Orphan_output_section::set_section_addresses): Likewise.
6761
6762 2009-10-15 Doug Kwan <dougkwan@google.com>
6763
6764 * layout.cc (Layout::finish_dynamic_section): Generate tags
6765 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
6766 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
6767 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
6768
6769 2009-10-14 Ian Lance Taylor <iant@google.com>
6770
6771 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
6772 fields.
6773 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
6774 data_shdr fields of relinfo.
6775 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
6776 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
6777 R_386_TLS_LDO_32, adjust based on section flags.
6778 (Target_i386::Relocate::fix_up_ldo): Remove.
6779
6780 2009-10-13 Ian Lance Taylor <iant@google.com>
6781
6782 Add support for -pie.
6783 * options.h (class General_options): Add -pie and
6784 --pic-executable.
6785 (General_options::output_is_position_independent): Test -pie.
6786 (General_options::output_is_executable): Return true if not shared
6787 and not relocatable.
6788 (General_options::output_is_pie): Remove.
6789 * options.cc (General_options::finalize): Reject incompatible uses
6790 of -pie.
6791 * gold.cc (queue_middle_tasks): A -pie link is not static.
6792 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
6793 * symtab.cc (Symbol::final_value_is_known): Return false if
6794 output_is_position_independent.
6795 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
6796 output_is_position_independent.
6797 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
6798 output_is_position_independent.
6799 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
6800 output_is_position_independent.
6801 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
6802 two_file_pie_test.
6803 (basic_pie_test.o, basic_pie_test): New targets.
6804 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
6805 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
6806 (two_file_pie_test): New target.
6807 * testsuite/Makefile.in: Rebuild.
6808 * README: Remove note saying that -pie is not supported.
6809
6810 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
6811
6812 * options.h (class General_options): Add -init and -fini.
6813 * layout.cc (Layout::finish_dynamic_section): Emit
6814 given init and fini functions.
6815
6816 2009-10-13 Sriraman Tallam <tmsriram@google.com>
6817
6818 * gc.h (gc_process_relocs): Check if icf is enabled using new
6819 function.
6820 * gold.cc (queue_initial_tasks): Likewise.
6821 (queue_middle_tasks): Likewise.
6822 * object.cc (do_layout): Likewise.
6823 * symtab.cc (is_section_folded): Likewise.
6824 * main.cc (main): Likewise.
6825 * reloc.cc (Read_relocs::run): Likewise.
6826 (Sized_relobj::do_scan_relocs): Likewise.
6827 * icf.cc (is_function_ctor_or_dtor): New function.
6828 (Icf::find_identical_sections): Check if function is ctor or dtor when
6829 safe icf is chosen.
6830 * options.h (General_options::icf): Change option to be an enum.
6831 (Icf_status): New enum.
6832 (icf_enabled): New method.
6833 (icf_safe_folding): New method.
6834 (set_icf_status): New method.
6835 (icf_status_): New variable.
6836 * (options.cc) (General_options::finalize): Set icf_status_.
6837 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
6838 icf_test and icf_keep_unique_test to use the --icf enum flag.
6839 * testsuite/icf_safe_test.sh: New file.
6840 * testsuite/icf_safe_test.cc: New file.
6841
6842 2009-10-12 Sriraman Tallam <tmsriram@google.com>
6843
6844 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
6845 includes to gc.h and icf.h.
6846 * arm.cc: Include gc.h.
6847 * gold.cc: Likewise.
6848 * i386.cc: Likewise.
6849 * powerpc.cc: Likewise.
6850 * sparc.cc: Likewise.
6851 * x86_64.cc: Likewise.
6852 * gc.h: Include icf.h.
6853
6854 2009-10-11 Ian Lance Taylor <iant@google.com>
6855
6856 * plugin.cc: Include "gold.h" before other header files.
6857
6858 2009-10-10 Chris Demetriou <cgd@google.com>
6859
6860 * options.h (Input_file_argument::Input_file_type): New enum.
6861 (Input_file_argument::is_lib_): Replace with...
6862 (Input_file_argument::type_): New member.
6863 (Input_file_argument::Input_file_argument): Take Input_file_type
6864 'type' rather than boolean 'is_lib' as second argument.
6865 (Input_file_argument::is_lib): Use type_.
6866 (Input_file_argument::is_searched_file): New function.
6867 (Input_file_argument::may_need_search): Handle is_searched_file.
6868 * options.cc (General_options::parse_library): Support -l:filename.
6869 (General_options::parse_just_symbols): Update for Input_file_argument
6870 changes.
6871 (Command_line::process): Likewise.
6872 * archive.cc (Archive::get_file_and_offset): Likewise.
6873 * plugin.cc (Plugin_manager::release_input_file): Likewise.
6874 * script.cc (read_script_file, script_add_file): Likewise.
6875 * fileread.cc (Input_file::Input_file): Likewise.
6876 (Input_file::will_search_for): Handle is_searched_file.
6877 (Input_file::open): Likewise.
6878 * readsyms.cc (Read_symbols::get_name): Likewise.
6879 * testsuite/Makefile.am (searched_file_test): New test.
6880 * testsuite/Makefile.in: Regenerate.
6881 * testsuite/searched_file_test.cc: New file.
6882 * testsuite/searched_file_test_lib.cc: New file.
6883
6884 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6885 Ian Lance Taylor <iant@google.com>
6886
6887 * descriptor.cc: Include <cstdio> and "binary-io.h".
6888 (Descriptors::open): Open the files in binary mode always.
6889 * script.cc (Lex::get_token): Treat \r as whitespace.
6890
6891 2009-10-09 Ian Lance Taylor <iant@google.com>
6892
6893 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
6894
6895 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
6896 Ian Lance Taylor <iant@google.com>
6897
6898 * configure.ac: Check for readv function also.
6899 * fileread.cc (readv): Define if not HAVE_READV.
6900 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
6901 does not exist.
6902 * config.in: Regenerate.
6903 * configure: Regenerate.
6904
6905 2009-10-09 Doug Kwan <dougkwan@google.com>
6906
6907 * layout.cc (Layout::make_output_section): Call target hook to make
6908 ordinary output section.
6909 (Layout::finalize): Adjust parameter list of call the
6910 Target::may_relax().
6911 * layout.h (class Layout::section_list): New method.
6912 * merge.h (Output_merge_base::entsize): Change visibility to public.
6913 (Output_merge_base::is_string, Output_merge_base::do_is_string):
6914 New methods.
6915 (Output_merge_string::do_is_string): New method.
6916 * object.cc (Sized_relobj::do_setup): renamed from
6917 Sized_relobj::set_up.
6918 * object.h (Sized_relobj::adjust_shndx,
6919 Sized_relobj::initializ_input_to_output_maps,
6920 Sized_relobj::free_input_to_output_maps): Change visibilities to
6921 protected.
6922 (Sized_relobj::setup): Virtualize.
6923 (Sized_relobj::do_setup): New method declaration.
6924 (Sized_relobj::invalidate_section_offset,
6925 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
6926 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
6927 * options.cc (parse_int): New function.
6928 * options.h (parse_int): New declaration.
6929 (DEFINE_int): New macro.
6930 (stub_group_size): New option.
6931 * output.cc (Output_section::Output_section): Initialize memebers
6932 merge_section_map_, merge_section_by_properties_map_,
6933 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
6934 (Output_section::add_input_section): Handled deferred code-fill
6935 generation and remove an old comment.
6936 (Output_section::add_relaxed_input_section): New method definition.
6937 (Output_section::add_merge_input_section): Use merge section by
6938 properties map to speed to search. Update merge section maps
6939 as appropriate.
6940 (Output_section::build_relaxation_map): New method definition.
6941 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6942 Same.
6943 (Output_section::relax_input_section): Renamed to
6944 Output_section::convert_input_sections_to_relaxed_sections and change
6945 interface to take a vector of pointers to relaxed sections.
6946 (Output_section::find_merge_section,
6947 Output_section::find_relaxed_input_section): New method definitions.
6948 (Output_section::is_input_address_mapped,
6949 Output_section::output_offset, Output_section::output_address):
6950 Use output section data maps to speed up searching.
6951 (Output_section::find_starting_output_address): Add comments.
6952 (Output_section::do_write,
6953 Output_section::write_to_postprocessing_buffer): Do code-fill
6954 generation as appropriate.
6955 (Output_section::get_input_sections): Invalidate relaxed input section
6956 map.
6957 (Output_section::restore_states): Adjust type of checkpoint .
6958 Invalidate relaxed input section map.
6959 * output.h (Output_merge_base): New class declaration.
6960 (Input_section_specifier): New class defintion.
6961 (class Output_relaxed_input_section) Change base class to
6962 Output_section_data_build.
6963 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
6964 base class initializer.
6965 (Output_section::add_relaxed_input_section): New method declaration.
6966 (Output_section::Input_section): Change visibility to protected.
6967 (Output_section::Input_section::relobj,
6968 Output_section::Input_section::shndx): Handle relaxed input sections.
6969 Output_section::input_sections) Change visibility to protected. Also
6970 define overload to return a non-const pointer.
6971 (Output_section::Merge_section_properties): New class defintion.
6972 (Output_section::Merge_section_by_properties_map,
6973 Output_section::Output_section_data_by_input_section_map,
6974 Output_section::Relaxation_map): New types.
6975 (Output_section::relax_input_section): Rename method to
6976 Output_section::convert_input_sections_to_relaxed_sections and change
6977 interface to take a vector of relaxed section pointers.
6978 (Output_section::find_merge_section,
6979 Output_section::find_relaxed_input_section,
6980 Output_section::build_relaxation_map,
6981 Output_section::convert_input_sections_in_list_to_relaxed_sections):
6982 New method declarations.
6983 (Output_section::merge_section_map_
6984 Output_section::merge_section_by_properties_map_,
6985 Output_section::relaxed_input_section_map_,
6986 Output_section::is_relaxed_input_section_map_valid_,
6987 Output_section::generate_code_fills_at_write_): New data members.
6988 * script-sections.cc
6989 (Output_section_element_input::set_section_addresses): Call
6990 current_data_size and addralign methods of relaxed input sections.
6991 (Orphan_output_section::set_section_addresses): Call current_data_size
6992 and addralign methods of relaxed input sections.
6993 * symtab.cc (Symbol_table::compute_final_value): Extract template
6994 from the body of Symbol_table::sized_finalize_symbol.
6995 (Symbol_table::sized_finalized_symbol): Call
6996 Symbol_table::compute_final_value.
6997 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
6998 (Symbol_table::compute_final_value): New templated method declaration.
6999 * target.cc (Target::do_make_output_section): New method defintion.
7000 * target.h (Target::make_output_section): New method declaration.
7001 (Target::relax): Add more parameters for input objects, symbol table
7002 and layout. Adjust call to do_relax.
7003 (Target::do_make_output_section): New method declaration.
7004 (Target::do_relax): Add parameters for input objects, symbol table
7005 and layout.
7006
7007 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7008
7009 * pread.c: Include stdio.h.
7010
7011 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7012
7013 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
7014 defined.
7015
7016 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
7017
7018 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
7019 Change read_shndx type to unsigned int.
7020 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7021 int.
7022 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7023 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
7024 Change read_shndx type to unsigned int.
7025 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
7026 int.
7027 (Sized_dwarf_line_info::read_line_mappings): Likewise.
7028 * layout.cc (Layout::create_symtab_sections): Cast the result of
7029 local_symcount * symsize to off_t in the gold_assert.
7030
7031 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7032
7033 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
7034 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
7035 R_ARM_BASE_ABS.
7036 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
7037 (Arm_relocate_functions::thm_abs5): New function.
7038 (Arm_relocate_functions::abs12): New function.
7039 (Arm_relocate_functions::abs16): New function.
7040 (Arm_relocate_functions::base_abs): New function.
7041 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
7042 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
7043 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
7044 R_ARM_BASE_ABS.
7045 (Scan::global): Likewise.
7046 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
7047 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
7048 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
7049 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
7050 R_ARM_BASE_ABS.
7051
7052 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7053
7054 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
7055 (Arm_relocate_functions::movt_prel): New function.
7056 (Arm_relocate_functions::thm_movw_prel_nc): New function.
7057 (Arm_relocate_functions::thm_movt_prel): New function.
7058 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
7059 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
7060 (Scan::global, Relocate::relocate): Likewise.
7061 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7062
7063 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7064
7065 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
7066 Incremental_checker.
7067 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
7068 unsigned int.
7069 (class Incremental_inputs_header): New class.
7070 (Incremental_inputs_header_writer): Edit comment.
7071 (Incremental_inputs_entry): New class.
7072 (Incremental_inputs_entry_writer): Edit comment.
7073 (Sized_incremental_binary::do_find_incremental_inputs_section):
7074 Add *strtab_shndx parameter, fill it.
7075 (Sized_incremental_binary::do_check_inputs): New method.
7076 (Incremental_checker::can_incrementally_link_output_file): Use
7077 Sized_incremental_binary::check_inputs.
7078 (Incremental_inputs::report_command_line): Save command line in
7079 command_line_.
7080 * incremental.h:
7081 (Incremental_binary::find_incremental_inputs_section): New
7082 method.
7083 (Incremental_binary::do_find_incremental_inputs_section): Add
7084 strtab_shndx parameter.
7085 (Incremental_binary::do_check_inputs): New pure virtual method.
7086 (Sized_incremental_binary::do_check_inputs): Declare.
7087 (Incremental_checker::Incremental_checker): Add incremental_inputs
7088 parameter, use it to initialize incremental_inputs_.
7089 (Incremental_checker::incremental_inputs_): New field.
7090 (Incremental_checker::command_line): New method.
7091 (Incremental_checker::inputs): New method.
7092 (Incremental_checker::command_line_): New field.
7093
7094 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
7095
7096 * incremental.cc: Include <cstdarg> and "target-select.h".
7097 (vexplain_no_incremental): New function.
7098 (explain_no_incremental): New function.
7099 (Incremental_binary::error): New method.
7100 (Sized_incremental_binary::do_find_incremental_inputs_section): New
7101 method.
7102 (make_sized_incremental_binary): New function.
7103 (open_incremental_binary): New function.
7104 (can_incrementally_link_file): Add checks if output is ELF and has
7105 inputs section.
7106 * incremental.h: Include "elfcpp_file.h" and "output.h".
7107 (Incremental_binary): New class.
7108 (Sized_incremental_binary): New class.
7109 (open_incremental_binary): Declare.
7110 * object.cc (is_elf_object): Use
7111 elfcpp::Elf_recognizer::is_elf_file.
7112 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
7113 * output.h (Output_file::filesize): New method.
7114
7115 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7116
7117 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
7118 New function.
7119 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
7120 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
7121 function.
7122 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
7123 function.
7124 (Arm_relocate_functions::movw_abs_nc): New function.
7125 (Arm_relocate_functions::movt_abs): New function.
7126 (Arm_relocate_functions::thm_movw_abs_nc): New function.
7127 (Arm_relocate_functions::thm_movt_abs): New function.
7128 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
7129 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
7130 (Scan::global): Likewise.
7131 (Relocate::relocate): Likewise.
7132 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7133
7134 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7135
7136 * arm.cc (Arm_relocate_functions::got_prel) New function.
7137 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
7138 (Relocate::relocate): Likewise.
7139 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7140
7141 2009-10-06 Ian Lance Taylor <iant@google.com>
7142
7143 * options.h (class General_options): Define
7144 split_stack_adjust_size parameter.
7145 * object.h (class Object): Add uses_split_stack_ and
7146 has_no_split_stack_ fields. Add uses_split_stack and
7147 has_no_split_stack accessor functions. Declare
7148 handle_split_stack_section.
7149 (class Reloc_symbol_changes): Define.
7150 (class Sized_relobj): Define Function_offsets. Declare
7151 split_stack_adjust, split_stack_adjust_reltype, and
7152 find_functions.
7153 * object.cc (Object::handle_split_stack_section): New function.
7154 (Sized_relobj::do_layout): Call handle_split_stack_section.
7155 * dynobj.cc (Sized_dynobj::do_layout): Call
7156 handle_split_stack_section.
7157 * reloc.cc (Sized_relobj::relocate_sections): Call
7158 split_stack_adjust for executable sections in split_stack
7159 objects. Pass reloc_map to relocate_section.
7160 (Sized_relobj::split_stack_adjust): New function.
7161 (Sized_relobj::split_stack_adjust_reltype): New function.
7162 (Sized_relobj::find_functions): New function.
7163 * target-reloc.h: Include "object.h".
7164 (relocate_section): Add reloc_symbol_changes parameter. Change
7165 all callers.
7166 * target.h (class Target): Add calls_non_split method. Declare
7167 do_calls_non_split virtual method. Declare match_view and
7168 set_view_to_nop.
7169 * target.cc: Include "elfcpp.h".
7170 (Target::do_calls_non_split): New function.
7171 (Target::match_view): New function.
7172 (Target::set_view_to_nop): New function.
7173 * gold.cc (queue_middle_tasks): Give an error if mixing
7174 split-stack and non-split-stack objects with -r.
7175 * i386.cc (Target_i386::relocate_section): Add
7176 reloc_symbol_changes parameter.
7177 (Target_i386::do_calls_non_split): New function.
7178 * x86_64.cc (Target_x86_64::relocate_section): Add
7179 reloc_symbol_changes parameter.
7180 (Target_x86_64::do_calls_non_split): New function.
7181 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
7182 parameter.
7183 * powerpc.cc (Target_powerpc::relocate_section): Add
7184 reloc_symbol_changes parameter.
7185 * sparc.cc (Target_sparc::relocate_section): Add
7186 reloc_symbol_changes parameter.
7187 * configure.ac: Call AM_CONDITIONAL for the default target.
7188 * configure: Rebuild.
7189 * testsuite/Makefile.am (TEST_AS): New variable.
7190 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
7191 (check_DATA): Add split_i386 and split_x86_64 files.
7192 (SPLIT_DEFSYMS): Define.
7193 (split_i386_[1234n].o): New targets.
7194 (split_i386_[124]): New targets.
7195 (split_i386_[1234r].stdout): New targets.
7196 (split_x86_64_[1234n].o): New targets.
7197 (split_x86_64_[124]): New targets.
7198 (split_x86_64_[1234r].stdout): New targets.
7199 (MOSTLYCLEANFILES): Add new executables.
7200 * testsuite/split_i386.sh: New file.
7201 * testsuite/split_x86_64.sh: New file.
7202 * testsuite/split_i386_1.s: New file.
7203 * testsuite/split_i386_2.s: New file.
7204 * testsuite/split_i386_3.s: New file.
7205 * testsuite/split_i386_4.s: New file.
7206 * testsuite/split_i386_n.s: New file.
7207 * testsuite/split_x86_64_1.s: New file.
7208 * testsuite/split_x86_64_2.s: New file.
7209 * testsuite/split_x86_64_3.s: New file.
7210 * testsuite/split_x86_64_4.s: New file.
7211 * testsuite/split_x86_64_n.s: New file.
7212 * testsuite/testfile.cc (Target_test): Update relocation_section
7213 function.
7214 * testsuite/Makefile.in: Rebuild.
7215
7216 2009-10-06 Ian Lance Taylor <iant@google.com>
7217
7218 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
7219 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
7220 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
7221 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
7222 the address on ldo_addrs_.
7223 (Target_i386::Relocate::fix_up_ldo): New function.
7224
7225 2009-10-06 Rafael Espindola <espindola@google.com>
7226
7227 * plugin.cc (add_input_library): New.
7228 (Plugin::load): Add add_input_library to tv.
7229 (Plugin_manager::add_input_file): Add the is_lib argument.
7230 (add_input_file): Update call to Plugin_manager::add_input_file.
7231 (add_input_library): New.
7232 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
7233
7234 2009-09-30 Doug Kwan <dougkwan@google.com>
7235
7236 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
7237 symbol and call Symbol::may_need_copy_reloc to determine if
7238 a copy reloc is needed.
7239 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
7240 nocopyreloc is given in command line.
7241 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
7242 given in command line.
7243 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
7244 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
7245 of the removed Target_i386::may_need_copy_reloc.
7246 * options.h (copyreloc): New option with default value false.
7247 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7248 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
7249 instead of the removed Target_powerpc::may_need_copy_reloc.
7250 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
7251 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
7252 instead of the removed Target_sparc::may_need_copy_reloc.
7253 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
7254 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
7255 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
7256 instead of the removed Target_x86_64::may_need_copy_reloc.
7257
7258 2009-09-30 Ian Lance Taylor <iant@google.com>
7259
7260 * object.h (class Object): Remove target_ field, and target,
7261 sized_target, and set_target methods.
7262 (Object::sized_target): Remove.
7263 (class Sized_relobj): Update declarations. Remove sized_target.
7264 * object.cc (Sized_relobj::setup): Remove target parameter.
7265 Change all callers.
7266 (Input_objects::add_object): Don't do anything with the target.
7267 (make_elf_sized_object): Add punconfigured parameter. Change all
7268 callers. Set or test parameter target.
7269 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
7270 Change all callers.
7271 * parameters.cc (Parameters::set_target): Change parameter type to
7272 be non-const.
7273 (Parameters::default_target): Remove.
7274 (set_parameters_target): Change parameter type to be non-const.
7275 (parameters_force_valid_target): New function.
7276 (parameters_clear_target): New function.
7277 * parameters.h (class Parameters): Update declarations. Remove
7278 default_target method. Add sized_target and clear_target
7279 methods. Change target_ to be non-const.
7280 (set_parameters_target): Update declaration.
7281 (parameters_force_valid_target): Declare.
7282 (parameters_clear_target): Declare.
7283 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
7284 as NULL if we aren't searching.
7285 (Add_symbols::run): Don't check for compatible target.
7286 * fileread.cc (Input_file::open_binary): Call
7287 parameters_force_valid_target.
7288 * gold.cc (queue_middle_tasks): Likewise.
7289 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
7290 set_target on object.
7291 * dynobj.h (class Sized_dynobj): Update declarations.
7292 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
7293 make_elf_object returns NULL.
7294 (Archive::include_member): Don't check whether object target is
7295 compatible.
7296 * output.cc (Output_section::add_input_section): Get target from
7297 parameters.
7298 (Output_section::relax_input_section): Likewise.
7299 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
7300 parameters.
7301 (Sized_relobj::do_scan_relocs): Likewise.
7302 (Sized_relobj::relocate_sections): Likewise.
7303 * resolve.cc (Symbol_table::resolve): Likewise.
7304 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
7305 parameter. Change all callers.
7306 (Symbol_table::add_from_object): Get target from parameters.
7307 (Symbol_table::add_from_relobj): Don't check object target.
7308 (Symbol_table::add_from_dynobj): Likewise.
7309 (Symbol_table::define_special_symbol): Get target from
7310 parameters.
7311 * symtab.h (class Symbol_table): Update declaration.
7312 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
7313 parameter. Change all callers. Clear parameter target.
7314 (Binary_test): Test target here.
7315 * testsuite/object_unittest.cc (gold_testsuite): Remove
7316 target_test_pointer parameter. Change all callers.
7317 (Object_test): Test target here.
7318
7319 2009-09-26 Ian Lance Taylor <iant@google.com>
7320
7321 * testsuite/initpri1.c: Don't try to use constructor priorities if
7322 compiling with gcc before 4.3.
7323
7324 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
7325
7326 * testsuite/retain_symbols_file_test.sh (check_present): Change
7327 output file name to retain_symbols_file_test.stdout.
7328 (check_absent): Likewise.
7329
7330 2009-09-18 Craig Silverstein <csilvers@google.com>
7331
7332 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
7333 * options.cc: Include <cerrno> and <fstream>.
7334 (General_options::finalize): Parse -retain-symbols-file tag.
7335 * options.h: New flag.
7336 (General_options): New method should_retain_symbol, new
7337 variable symbols_to_retain.
7338 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
7339 should_retain_symbol map.
7340 * testsuite/Makefile.am (retain_symbols_file_test): New test.
7341 * testsuite/Makefile.in: Regenerate.
7342 * testsuite/retain_symbols_file_test.sh: New file.
7343
7344 2009-09-18 Nick Clifton <nickc@redhat.com>
7345
7346 * po/es.po: Updated Spanish translation.
7347
7348 2009-09-17 Doug Kwan <dougkwan@google.com>
7349
7350 * debug.h (DEBUG_RELAXATION): New constant.
7351 (DEBUG_ALL): Add DEBUG_RELAXATION.
7352 (debug_string_to_enum): Add relaxation debug option.
7353 * layout.cc
7354 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
7355 Layout::Relaxation_debug_check::read_sections,
7356 Layout::Relaxation_debug_check::read_sections): New method definitions.
7357 (Layout::Layout): Initialize data members
7358 record_output_section_data_from_scrips_,
7359 script_output_section_data_list_ and relaxation_debug_check_.
7360 (Layout::save_segments, Layout::restore_segments,
7361 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7362 Layout::relaxation_loop_body): New method definitions.
7363 (Layout::finalize): Support relaxation. Move section layout code to
7364 Layout::relaxation_loop_body.
7365 (Layout::set_asection_address_from_script): Move code for orphan
7366 section placement out.
7367 (Layout::place_orphan_sections_in_script): New method definition.
7368 * layout.h (Output_segment_headers, Output_file_header):
7369 New forward class declarations.
7370 (Layout::~Layout): Define.
7371 (Layout::new_output_section_data_from_script): New method definition.
7372 (Layout::place_orphan_sections_in_script): New method declaration.
7373 (Layout::Segment_states): New type declaration.
7374 (Layout::save_segments, Layout::restore_segments,
7375 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
7376 Layout::relaxation_loop_body): New method declarations.
7377 (Layout::Output_section_data_list): New type declaration.
7378 (Layout::Relaxation_debug_check): New class definition.
7379 (Layout::record_output_section_data_from_script_,
7380 Layout::script_output_section_data_list_, Layout::segment_states_,
7381 Layout::relaxation_debug_check_): New data members.
7382 * output.cc: (Output_section_headers::do_size): New method definition.
7383 (Output_section_headers::Output_section_headers): Move size
7384 computation to Output_section_headers::do_size.
7385 (Output_segment_headers::do_size): New method definition.
7386 (Output_file_header::Output_file_header): Move size computation to
7387 Output_file_header::do_size and call it.
7388 (Output_file_header::do_size): New method definition.
7389 (Output_data_group::Output_data_group): Adjust call to
7390 Output_section_data.
7391 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
7392 (Output_symtab_xindex::do_write): Add array bound check.
7393 (Output_section::Input_section::print_to_mapfile): Handle
7394 RELAXED_INPUT_SECTION_CODE.
7395 (Output_section::Output_section): Initialize data member checkpoint_.
7396 (Output_section::~Output_section): Delete checkpoint object pointed
7397 by checkpoint_.
7398 (Output_section::add_input_section): Always add an Input_section if
7399 relaxing.
7400 (Output_section::add_merge_input_section): Add assert.
7401 (Output_section::relax_input_section): New method definition.
7402 (Output_section::set_final_data_size): Set load address to zero for
7403 an unallocated section.
7404 (Output_section::do_address_and_file_offset_have_reset_values):
7405 New method definition.
7406 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
7407 Handle relaxed input section.
7408 (Output_section::sort_attached_input_sections): Checkpoint input
7409 section list lazily.
7410 (Output_section::get_input_sections): Change type of input_sections to
7411 list of Simple_input_section pointers. Checkpoint input section list
7412 lazily. Also handle relaxed input sections.
7413 (Output_section::add_input_section_for_script): Take a reference to
7414 a Simple_input_section object instead of Relobj pointer and section
7415 index as parameter. Handle relaxed input sections.
7416 (Output_section::save_states, Output_section::restore_states): New
7417 method definitions.
7418 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
7419 (Output_data::is_data_size_fixed): New method definition.
7420 (Output_data::reset_addresss_and_file_offset): Do not reset data size
7421 if it is fixed.
7422 (Output_data::address_and_file_offset_have_reset_values): New method
7423 definition.
7424 (Output_data::do_address_and_file_offset_have_reset_values): New method
7425 definition.
7426 (Output_data::set_data_size): Check that data size is not fixed.
7427 (Output_data::fix_data_size): New method definition.
7428 (Output_data::is_data_size_fixed_): New data member.
7429 (Output_section_headers::set_final_data_size): New method definition.
7430 (Output_section_headers::do_size): New method declaration.
7431 (Output_segment_headers::set_final_data_size): New method definition.
7432 (Output_segment_headers::do_size): New method declaration.
7433 (Output_file_header::set_final_data_size)::New method definition.
7434 (Output_file_header::do_size)::New method declaration.
7435 (Output_section_data::Output_section_data): Add new parameter
7436 is_data_size_fixed and use it to fix data size.
7437 (Output_data_const::Output_data_const): Adjust call to base class
7438 constructor and fix data size.
7439 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
7440 base class constructor and fix data size.
7441 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
7442 base class constructor and fix data size.
7443 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
7444 class constructor and fix data size.
7445 (Output_data_group::set_final_data_size): New method definition.
7446 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
7447 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
7448 class constructor and fix data size.
7449 (Output_relaxed_input_section): New class definition.
7450 (Output_section::Simple_input_section): New class definition.
7451 (Output_section::get_input_sections): Adjust parameter list.
7452 (Output_section::add_input_section_for_script): Same.
7453 (Output_section::save_states, Output_section::restore_states,
7454 Output_section::do_address_and_file_offset_have_reset_values,
7455 (Output_section::Input_section::Input_section): Handle
7456 RELAXED_INPUT_SECTION_CODE. Add new overload for
7457 Output_relaxed_input_section.
7458 (Output_section::Input_section::is_input_section,
7459 Output_section::Input_section::set_output_section): Handle relaxed
7460 input section.
7461 (Output_section::Input_section::is_relaxed_input_section,
7462 Output_section::Input_section::output_section_data,
7463 Output_section::Input_section::relaxed_input_section): New method
7464 definitions.
7465 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
7466 value.
7467 (Output_section::Input_section::u1_): Update comments.
7468 (Output_section::Input_section::u2_): Add new union member poris.
7469 (Output_section::Checkpoint_output_section): New classs definition.
7470 (Output_section::relax_input_section): New method declaration.
7471 (Output_section::checkpoint_): New data member.
7472 (Output_segment): Update comments.
7473 (Output_segment::Output_segment): Un-privatize copy constructor.
7474 (Output_segment::operator=): Un-privatize.
7475 * script-sections.cc (Output_section_element::Input_section_list):
7476 Change element type to Output_section::Simple_input_section.
7477 (Output_section_element_dot_assignment::set_section_addresses):
7478 Register output section data for relaxation clean up.
7479 (Output_data_exression::Output_data_expression): Adjust call to base
7480 constructor to fix data size.
7481 (Output_section_element_data::set_section_addresses): Register
7482 Output_data_expression object for relaxation clean up.
7483 (struct Input_section_info): Replace Relobj pointer and section index
7484 pair with Output_section::Simple_input_section and Convert struct to a
7485 class.
7486 (Input_section_sorter::operator()): Adjust access to
7487 Input_section_info data member to use accessors.
7488 (Output_section_element_input::set_section_addresses): Use layout
7489 parameter. Adjust code to use Output_section::Simple_input_section
7490 and Input_secction_info classes. Register filler for relaxation
7491 clean up.
7492 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
7493 and section index pair with Output_section::Simple_input_section
7494 class. Adjust code accordingly.
7495 (Phdrs_element::release_segment): New method definition.
7496 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
7497 segment list.
7498 (Script_sections::release_segments): New method definition.
7499 * gold/script-sections.h (Script_sections::release_segments): New
7500 method declaration.
7501 * gold/target.h (Target::may_relax, Target::relax,
7502 Target::do_may_relax, Target::do_relax): New method definitions.
7503
7504 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7505
7506 * arm.cc (has_signed_unsigned_overflow): New function.
7507 (Arm_relocate_functions::abs8): New function.
7508 (Target_arm::Scan::local): Handle R_ARM_ABS8.
7509 (Target_arm::Scan::global): Likewise.
7510 (Target_arm::relocate::relocate): Likewise.
7511 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7512 Likewise.
7513
7514 2009-09-16 Cary Coutant <ccoutant@google.com>
7515
7516 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
7517 * testsuite/Makefile.in: Regenerate.
7518
7519 2009-09-11 Nick Clifton <nickc@redhat.com>
7520
7521 * po/gold.pot: Updated by the Translation project.
7522
7523 2009-09-08 Cary Coutant <ccoutant@google.com>
7524
7525 * output.cc (Output_file::open): Add execute permission to empty file.
7526 * testsuite/Makefile.am (permission_test): New test.
7527 * testsuite/Makefile.in: Regenerate.
7528
7529 2009-09-02 Ian Lance Taylor <iant@google.com>
7530
7531 * output.cc (Output_file::resize): Call map_no_anonymous rather
7532 than map.
7533
7534 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
7535
7536 * gold.cc: Include "incremental.h".
7537 (queue_initial_tasks): Call Incremental_checker methods.
7538 * incremental.cc: Include "output.h".
7539 (Incremental_checker::can_incrementally_link_output_file): New
7540 method.
7541 * incremental.h (Incremental_checker): New class.
7542
7543 * output.cc (Output_file::open_for_modification): New method.
7544 (Output_file::map_anonymous): Changed return type to bool. Record
7545 map in base_ field.
7546 (Output_file::map_no_anonymous): New method, broken out of map.
7547 (Output_file::map): Use map_no_anonymous and map_anonymous.
7548 * output.h (class Output_file): Update declarations.
7549
7550 2009-08-24 Cary Coutant <ccoutant@google.com>
7551
7552 * options.h (Command_line::Pre_options): New class.
7553 (Command_line::pre_options): New member.
7554 * options.cc (gold::options::ready_to_register): New variable.
7555 (One_option::register_option): Do nothing if not registering options.
7556 Assert if same short option registered twice.
7557 (General_options::General_options): Turn off option registration when
7558 done constructing.
7559 (Command_line::Pre_options::Pre_options): New constructor.
7560
7561 2009-08-24 Cary Coutant <ccoutant@google.com>
7562
7563 * options.h (General_options::no_keep_memory): Remove incorrect
7564 short option.
7565
7566 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7567
7568 * Makefile.am (am__skiplex, am__skipyacc): New.
7569 * Makefile.in: Regenerate.
7570
7571 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
7572
7573 * Makefile.am (AM_CPPFLAGS): Renamed from ...
7574 (INCLUDES): ... this.
7575 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
7576 (AM_CPPFLAGS): Renamed from ...
7577 (INCLUDE): ... this.
7578 * Makefile.in, testsuite/Makefile.in: Regenerate.
7579
7580 * Makefile.in: Regenerate.
7581 * aclocal.m4: Likewise.
7582 * config.in: Likewise.
7583 * configure: Likewise.
7584 * testsuite/Makefile.in: Likewise.
7585
7586 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7587 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
7588 * Makefile.in: Regenerate.
7589 * testsuite/Makefile.in: Regenerate.
7590
7591 2009-08-19 Cary Coutant <ccoutant@google.com>
7592
7593 * resolve.cc (Symbol_table::resolve): Don't complain about defined
7594 symbols in shared libraries overridden by hidden or internal symbols
7595 in the main program.
7596
7597 2009-08-19 Chris Demetriou <cgd@google.com>
7598
7599 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
7600 checking source file names in error messages.
7601
7602 2009-08-18 Doug Kwan <dougkwan@google.com>
7603
7604 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
7605 an elcpp::Ehdr as parameter. Adjust call to set_target.
7606 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
7607 an elfcpp::Ehdr as parameter.
7608 * object.cc (Object::set_target): Remove the version that looks up
7609 a target and sets it.
7610 (Sized_relobj::setup): Take a Target object instead of
7611 an elfcpp::Ehdr as parameter. Adjust call to set_target.
7612 (make_elf_sized_object): Find target and ask target to
7613 make an ELF object.
7614 * object.h: (Object::set_target): Remove the version that looks up
7615 a target and sets it.
7616 (Sized_relobj::setup): Take a Target object instead of
7617 an elfcpp:Ehdr as parameter.
7618 * target.cc: Include dynobj.h.
7619 (Target::do_make_elf_object_implementation): New.
7620 (Target::do_make_elf_object): New.
7621 * target.h (Target::make_elf_object): New template declaration.
7622 (Target::do_make_elf_object): New method declarations.
7623 (Target::do_make_elf_object_implementation): New template declaration.
7624
7625 2009-08-14 Ian Lance Taylor <iant@google.com>
7626
7627 * gold.h (FUNCTION_NAME): Define.
7628 (gold_unreachable): Use FUNCTION_NAME.
7629
7630 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7631
7632 * icf.cc (Icf::find_identical_sections): Issue a warning when a
7633 symbol in the --keep-unique list is not found.
7634
7635 2009-08-12 Sriraman Tallam <tmsriram@google.com>
7636
7637 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
7638 been maked as --keep-unique.
7639 (Icf::unfold_section): New function.
7640 * icf.h (Icf::unfold_section): New function.
7641 * options.h (General_options::keep_unique): New option.
7642 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
7643 * testsuite/Makefile.in: Regenerate.
7644 * testsuite/icf_keep_unique_test.sh: New file.
7645 * testsuite/icf_keep_unique_test.cc: New file.
7646
7647 2009-08-12 Cary Coutant <ccoutant@google.com>
7648
7649 PR 10471
7650 * resolve.cc (Symbol_table::resolve): Check for references from
7651 dynamic objects to hidden and internal symbols.
7652 * testsuite/Makefile.am (hidden_test.sh): New test.
7653 * testsuite/Makefile.in: Regenerate.
7654 * testsuite/hidden_test.sh: New script.
7655 * testsuite/hidden_test_1.c: New test source.
7656 * testsuite/hidden_test_main.c: New test source.
7657
7658 2009-08-11 Doug Kwan <dougkwan@google.com>
7659
7660 * arm.cc: Update comments.
7661 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
7662 segment to locate the .ARM.exidx section if present.
7663
7664 2009-08-09 Doug Kwan <dougkwan@google.com>
7665
7666 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
7667 patch.
7668
7669 2009-08-07 Sriraman Tallam <tmsriram@google.com>
7670 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
7671 compiler warnings.
7672
7673 2009-08-06 Sriraman Tallam <tmsriram@google.com>
7674
7675 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
7676 valid tls_segment only for non-debug-section relocations.
7677 * testsuite/Makefile.am: Add gc_tls_test.
7678 * testsuite/Makefile.in: Regenerate.
7679 * testsuite/gc_tls_test.cc: New file.
7680 * testsuite/gc_tls_test.sh: New file.
7681
7682 2009-08-05 Sriraman Tallam <tmsriram@google.com>
7683
7684 * icf.cc: New file.
7685 * icf.h: New file.
7686 * Makefile.am (CCFILES): Add icf.cc.
7687 (HFILES): Add icf.h
7688 * Makefile.in: Regenerate.
7689 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
7690 * gc.h (gc_process_relocs): Populate lists used by icf to contain
7691 section, symbol and addend information for the relocs.
7692 * gold.cc (queue_middle_tasks): Call identical code folding.
7693 * gold.h: Add defines for multimap.
7694 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
7695 to the call of finalize_local_symbols.
7696 * main.cc (main): Create object of class Icf.
7697 * object.cc (Sized_relobj::do_layout): Allow this function to be
7698 called twice during icf.
7699 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
7700 to sections marked as identical by icf.
7701 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
7702 when available.
7703 (Sized_relobj::do_section_entsize): New function.
7704 * object.h (Object::section_entsize): New function.
7705 (Object::do_section_entsize): New pure virtual function.
7706 (Relobj::finalize_local_symbols): Add new parameter.
7707 (Relobj::do_section_entsize): New function.
7708 * options.h (General_options::icf): New option.
7709 (General_options::icf_iterations): New option.
7710 (General_options::print_icf_sections): New option.
7711 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
7712 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
7713 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
7714 icf.
7715 * symtab.cc (Symbol_table::is_section_folded): New function.
7716 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
7717 to sections marked as identical by icf.
7718 * symtab.h (Symbol_table::set_icf): New function.
7719 (Symbol_table::icf): New function.
7720 (Symbol_table::is_section_folded): New function.
7721 (Symbol_table::icf_): New data member.
7722 * target-reloc.h (relocate_section): Ignore sections folded by icf.
7723 * testsuite/Makefile.am: Add commands to build icf_test.
7724 * testsuite/Makefile.in: Regenerate.
7725 * testsuite/icf_test.sh: New file.
7726 * testsuite/icf_test.cc: New file.
7727
7728 2009-07-24 Chris Demetriou <cgd@google.com>
7729
7730 * layout.cc (is_compressible_debug_section): Fix incorrect
7731 comment about compressed section names.
7732
7733 2009-07-20 Ian Lance Taylor <ian@airs.com>
7734
7735 PR 10419
7736 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
7737
7738 2009-07-16 Ian Lance Taylor <iant@google.com>
7739
7740 PR 10400
7741 * layout.h: #include <map>.
7742 (class Kept_section): Change from struct to class. Add accessors
7743 and setters. Add section size to Comdat_group mapping. Change
7744 Comdat_group to std::map. Add is_comdat_ field. Add
7745 linkonce_size field in union.
7746 (class Layout): Update declaration of find_or_add_kept_section.
7747 Don't declare find_kept_object.
7748 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
7749 parameter. Add object, shndx, is_comdat, and is_group_name
7750 parameters. Change all callers. Adjust for new Kept_section.
7751 (Layout::find_kept_object): Remove.
7752 * object.cc (Sized_relobj::include_section_group): Update use of
7753 Kept_section. Rename secnum to shndx. Only record
7754 Kept_comdat_section if sections are the same size.
7755 (Sized_relobj::include_linkonce_section): Update use of
7756 Kept_section. Only record Kept_comdat_section if sections are the
7757 same size. Set size of linkonce section.
7758 (Sized_relobj::map_to_kept_section): Update call to
7759 get_kept_comdat_section.
7760 * object.h (class Sized_relobj): Rename fields in
7761 Kept_comdat_section to drop trailing underscores; change object
7762 field to Relobj*. Change Kept_comdat_section_table to store
7763 struct rather than pointer.
7764 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
7765 Add kept_object and kept_shndx parameters. Change all callers.
7766 (Sized_relobj::get_kept_comdat_section): Change return type to
7767 bool. Add kept_object and kept_shndx parameters. Change all
7768 callers.
7769 * plugin.cc (Pluginobj::include_comdat_group): Update call to
7770 Layout::find_or_add_kept_section.
7771
7772 2009-07-09 Ian Lance Taylor <iant@google.com>
7773
7774 * merge.cc (Object_merge_map::initialize_input_to_output_map):
7775 Reserve space in the hash table.
7776
7777 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
7778
7779 * fileread.cc (File_read::get_mtime): New method.
7780 * fileread.h (Timespec): New structure.
7781 (File_read::get_mtime): New method.
7782 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
7783 Renamed from timestamp_nsec.
7784 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
7785 Elf_Xword.
7786 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
7787 timestamp_nsec.
7788 (Incremental_inputs::report_archive): Save mtime; style fix.
7789 (Incremental_inputs::report_obejct): Save mtime; style fix.
7790 (Incremental_inputs::report_script): Save mtime; style fix.
7791 (Incremental_inputs::finalize_inputs): Style fix.
7792 (Incremental_inputs::finalize): Style fix.
7793 (Incremental_inputs::create_input_section_data): Store inputs
7794 mtime.
7795 * incremental.h (Incremental_inputs::report_script): Add mtime
7796 argument.
7797 (Incremental_inputs::Input_info::Input_info): Intialize only one
7798 union member.
7799 (Incremental_inputs::Input_info::archive): Move to nameless
7800 union.
7801 (Incremental_inputs::Input_info::obejct): Move to nameless union.
7802 (Incremental_inputs::Input_info::script): Move to nameless union.
7803 (Incremental_inputs::mtime): New field.
7804 * script.cc (read_input_script): Pass file mtime to
7805 Incremental_input.
7806 * script.h (Script_info::inputs): Style fix.
7807
7808 2009-07-01 Ian Lance Taylor <ian@airs.com>
7809
7810 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
7811 instead of 32.
7812
7813 2009-06-24 Ian Lance Taylor <iant@google.com>
7814
7815 PR 10156
7816 * layout.cc (Layout::choose_output_section): If we find an
7817 existing section, update the flags.
7818 (Layout::create_notes): New function, broken out of
7819 Layout::finalize.
7820 (Layout::finalize): Don't create note sections.
7821 (Layout::create_note): Don't crash if linker script discards
7822 section.
7823 (Layout::create_gold_note): Likewise.
7824 (Layout::create_build_id): Likewise. Don't set
7825 after_input_sections on the section.
7826 (Layout::create_executable_stack_info): Remove target parameter.
7827 Change caller.
7828 * layout.h (class Layout): Declare create_notes. Update
7829 declaration of create_executable_stack_info.
7830 * gold.cc (queue_middle_tasks): Call create_notes.
7831 * output.cc (Output_section::update_flags_for_input_section): Move
7832 here from output.h. If SHF_ALLOC flag is newly set, mark address
7833 invalid.
7834 * output.h (Output_data::mark_address_invalid): New function.
7835 (class Output_section): Only declare, not define,
7836 update_flags_for_input_section. Remove set_flags.
7837
7838 2009-06-24 Ian Lance Taylor <iant@google.com>
7839
7840 * script-sections.cc (Output_section_definition::
7841 set_section_addresses): Rename shadowing local load_address to
7842 laddr.
7843
7844 2009-06-24 Ian Lance Taylor <iant@google.com>
7845
7846 PR 10244
7847 * reloc.cc (relocate_sections): Skip empty relocation sections.
7848
7849 2009-06-23 Ian Lance Taylor <iant@google.com>
7850
7851 PR 10156
7852 * layout.cc (Layout::create_note): Use choose_output_section
7853 rather than make_output_section.
7854
7855 2009-06-23 Ian Lance Taylor <iant@google.com>
7856
7857 PR 10237
7858 * options.cc (General_options::parse_V): Set printed_version_.
7859 (General_options::General_options): Initialize printed_version_.
7860 * options.h (class General_options): Add printed_version_ field.
7861 * gold.cc (queue_initial_tasks): If there are no input files,
7862 don't give a fatal error if we printed the version information.
7863 (queue_middle_tasks): If using -r with a shared object, give a
7864 fatal error rather than an ordinary error.
7865
7866 2009-06-23 Ian Lance Taylor <iant@google.com>
7867
7868 PR 10219
7869 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
7870 (Layout::make_output_section): Set have_stabstr_section_ if we see
7871 a .stab*str section.
7872 (Layout::finalize): Call link_stabs_sections.
7873 (Layout::link_stabs_sections): New file.
7874 * layout.h (class Layout): Add have_stabstr_section_ field.
7875 Declare link_stabs_sections.
7876
7877 2009-06-23 Doug Kwan <dougkwan@google.com>
7878
7879 * Makefile.am (libgold_a_LIBADD): New.
7880 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
7881 * Makefile.in: Regenerate.
7882 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
7883 * configure: Regenerate.
7884 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
7885 * fileread.cc: Include sys/state.h
7886 * gold.h: Declare memmem and strndup if found missing.
7887 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
7888
7889 2009-06-23 Ian Lance Taylor <iant@google.com>
7890
7891 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
7892 * configure: Rebuild.
7893
7894 2009-06-23 Ian Lance Taylor <iant@google.com>
7895
7896 PR 10147
7897 * object.cc (Object::section_contents): Don't try to get a view if
7898 the section has length zero.
7899 (Object::handle_gnu_warning_section): If the section is empty, use
7900 the name of the section as the warning.
7901
7902 2009-06-23 Ian Lance Taylor <iant@google.com>
7903
7904 PR 10133
7905 * stringpool.h (class Stringpool_template): Add optimize_ field.
7906 (Stringpool_template::set_optimize): New function.
7907 * stringpool.cc (Stringpool_template::Stringpool_template):
7908 Initialize optimize_ field.
7909 (Stringpool_template::set_string_offsets): Test local optimize
7910 fild rather than parameter.
7911 * layout.cc (Layout::Layout): Call set_optimize on the section
7912 name stringpool.
7913
7914 2009-06-22 Ian Lance Taylor <iant@google.com>
7915
7916 PR 10030
7917 * yyscript.y: Parse TARGET.
7918 * script.cc (script_set_target): New function.
7919 * script-c.h (script_set_target): Declare.
7920 * options.cc (General_options::string_to_object_format): Rename
7921 from string_to_object_format in anonymous namespace. Change
7922 callers.
7923 * options.h (class General_options): Declare
7924 string_to_object_format.
7925
7926 2009-06-22 Ian Lance Taylor <iant@google.com>
7927
7928 * script-sections.cc (Script_sections::create_segments): Don't put
7929 program headers in a PT_LOAD segment if -n or -N.
7930
7931 2009-06-22 Ian Lance Taylor <iant@google.com>
7932
7933 PR 10141
7934 * options.h (class General_options): Add -z lazy and -z now. Sort
7935 -z options into alphabetical order.
7936 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
7937
7938 2009-06-21 Ian Lance Taylor <iant@google.com>
7939
7940 * layout.cc (Layout::make_output_section): Call
7941 Target::new_output_section.
7942 (Layout::attach_allocated_section_to_segment): Put large section
7943 sections in a separate load segment with the large segment flag
7944 set.
7945 (Layout::segment_precedes): Sort large data segments after other
7946 load segments.
7947 (align_file_offset): New static function.
7948 (Layout::set_segment_offsets): Use align_file_offset.
7949 * output.h (class Output_section): Add is_small_section_ and
7950 is_large_section_ fields.
7951 (Output_section::is_small_section): New function.
7952 (Output_section::set_is_small_section): New function.
7953 (Output_section::is_large_section): New function.
7954 (Output_section::set_is_large_section): New function.
7955 (Output_section::is_large_data_section): New function.
7956 (class Output_segment): Add is_large_data_segment_ field.
7957 (Output_segment::is_large_data_segment): New function.
7958 (Output_segment::set_is_large_data_segment): New function.
7959 * output.cc (Output_section::Output_section): Initialize new
7960 fields.
7961 (Output_segment::Output_segment): Likewise.
7962 (Output_segment::add_output_section): Add assertion that large
7963 data sections always go in large data segments. Force small data
7964 sections to the end of the list of data sections. Force small BSS
7965 sections to the start of the list of BSS sections. For large BSS
7966 sections to the end of the list of BSS sections.
7967 * symtab.h (class Symbol): Declare is_common_shndx.
7968 (Symbol::is_defined): Check Symbol::is_common_shndx.
7969 (Symbol::is_common): Likewise.
7970 (class Symbol_table): Define enum Commons_section_type. Update
7971 declarations. Add small_commons_ and large_commons_ fields.
7972 * symtab.cc (Symbol::is_common_shndx): New function.
7973 (Symbol_table::Symbol_table): Initialize new fields.
7974 (Symbol_table::add_from_object): Put small and large common
7975 symbols in the right list.
7976 (Symbol_table::sized_finalized_symbol): Check
7977 Symbol::is_common_shndx.
7978 (Symbol_table::sized_write_globals): Likewise.
7979 * common.cc (Symbol_table::do_allocate_commons): Allocate new
7980 common symbol lists. Don't call do_allocate_commons_list if the
7981 list is empty.
7982 (Symbol_table::do_allocate_commons_list): Remove is_tls
7983 parameter. Add comons_section_type parameter. Change all
7984 callers. Handle small and large common symbols.
7985 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
7986 Symbol::is_common_shndx.
7987 * resolve.cc (symbol_to_bits): Likewise.
7988 * target.h (Target::small_common_shndx): New function.
7989 (Target::small_common_section_flags): New function.
7990 (Target::large_common_shndx): New function.
7991 (Target::large_common_section_flags): New function.
7992 (Target::new_output_section): New function.
7993 (Target::Target_info): Add small_common_shndx, large_common_shndx,
7994 small_common_section_flags, and large_common_section_flags
7995 fields.
7996 (Target::do_new_output_section): New virtual function.
7997 * arm.cc (Target_arm::arm_info): Initialize new fields.
7998 * i386.cc (Target_i386::i386_info): Likewise.
7999 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
8000 Likewise.
8001 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
8002 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8003 (Target_x86_64::do_new_output_section): New function.
8004 * configure.ac: Define conditional MCMODEL_MEDIUM.
8005 * testsuite/Makefile.am (check_PROGRAMS): Add large.
8006 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
8007 (large_LDFLAGS): Define.
8008 * testsuite/large.c: New file.
8009 * testsuite/testfile.cc (Target_test::test_target_info):
8010 Initialize new fields.
8011 * configure, testsuite/Makefile.in: Rebuild.
8012
8013 2009-06-05 Doug Kwan <dougkwan@google.com>
8014
8015 * Makefile.am (CCFILES): Add target.cc.
8016 * Makefile.in: Regenerate.
8017 * i386.cc (class Target_i386): Define new virtual method to
8018 override do_is_local_label_name in parent.
8019 * object.cc (Sized_relobj::do_count_local_symbols): Discard
8020 local symbols if --discard-locals or -X is given.
8021 * options.h (class General_options): Declare new options
8022 '--discard-locals' and '-X' for discarding locals.
8023 * target.h (class Target): Define new methods is_local_label_name.
8024 Declare new virtual method do_is_local_label_name.
8025 * target.cc: New file.
8026 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
8027 (check_SCRIPTS): Add discard_locals_test.sh.
8028 (check_DATA): Add discard_local_tests.syms.
8029 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
8030 (discard_local_tests.syms, discard_locals_test.o): New make rules.
8031 * testsuite/Makefile.in: Regenerate.
8032 * testsuite/discard_locals_test.c: New file.
8033 * testsuite/discard_locals_test.sh: Same.
8034
8035 2009-06-05 Doug Kwan <dougkwan@google.com>
8036
8037 * object.cc (Sized_relobj::Sized_relobj): Initialize
8038 discarded_eh_frame_shndx_ to -1U.
8039 (Sized_relobj::do_layout): Record index of a discard .eh_frame
8040 section.
8041 (Sized_relobj::do_count_local_symbols): Skip local symbols in
8042 a discarded .eh_frame section.
8043 (Sized_relobj::do_finalize_local_symbols): Ditto.
8044 * object.h (class Sized_relobj): Declare new member
8045 discarded_eh_frame_shndx_.
8046 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
8047 (local_labels_test.o, local_labels_test): New rules.
8048 * testsuite/Makefile.in: Regenerate.
8049
8050 2009-06-04 Doug Kwan <dougkwan@google.com>
8051
8052 * layout.cc (Layout::section_name_mapping): Add mapping for
8053 special ARM sections.
8054
8055 2009-06-03 Doug Kwan <dougkwan@google.com>
8056
8057 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
8058 (utils::has_overflow): Same.
8059
8060 2009-06-03 Ian Lance Taylor <iant@google.com>
8061
8062 * layout.cc (Layout::section_name_mapping): New array, replacing
8063 Layout::linkonce_mapping.
8064 (Layout::section_name_mapping_count): New variable, replacing
8065 Layout::linkonce_mapping_count.
8066 (Layout::linkonce_output_name): Remove.
8067 (Layout::output_section_name): Rewrite.
8068 * layout.h (class Layout): Rename Linkonce_mapping to
8069 Section_name_mapping, linkonce_mapping to section_name_mapping,
8070 linkonce_mapping_count to section_name_mapping_count. Don't
8071 declare linkonce_output_name.
8072
8073 2009-06-03 Doug Kwan <dougkwan@google.com>
8074
8075 * gold/arm.cc (namespace utils): New.
8076 (Target_arm::reloc_is_non_pic): Define new method.
8077 (class Arm_relocate_functions): New.
8078 (Target_arm::Relocate::relocate): Handle relocation types used by
8079 Android.
8080
8081 2009-06-03 Ian Lance Taylor <iant@google.com>
8082
8083 * arm.cc (Target_arm::scan::global): Use || instead of |.
8084
8085 2009-06-02 Doug Kwan <dougkwan@google.com>
8086
8087 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
8088 issued_non_pic_error_.
8089 (class Target_arm::Scan): Declare new method check_non_pic.
8090 Define new method symbol_needs_plt_entry.
8091 Declare new data member issued_non_pic_error_.
8092 (class Target_arm::Relocate): Declare new method
8093 should_apply_static_reloc.
8094 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
8095 (Target_arm::Scan::check_non_pic): Define new method.
8096 (Target_arm::Scan::local): Handle a small subset of reloc types used
8097 by Android.
8098 (Target_arm::Scan::local): Same.
8099 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
8100
8101 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
8102
8103 * incremental.cc (Incremental_inputs::report_command_line): Filter
8104 out --incremental-* options.
8105
8106 2009-05-29 Doug Kwan <dougkwan@google.com>
8107
8108 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
8109 template class.
8110 (class Target_arm): Update comment.
8111 (Target_arm::Target_arm): Initialize new data members GOT_,
8112 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
8113 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
8114 and Target_arm::rel_dyn_section.
8115 Declare new_enum Target_arm::Got_type.
8116 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
8117 and DYNBSS_.
8118 Update commments for member do_dynsym_value.
8119 (Target_arm::got_size, Target_arm::plt_section,
8120 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
8121 new methods inside class defintion.
8122 (Target_arm::got_section): Define new method.
8123 (Target_arm::rel_dyn_section): Same.
8124 (Output_data_plt_arm): New template class.
8125 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
8126 (Output_data_plt_arm:do_adjust_output_section): Define new method.
8127 (Output_data_plt_arm::add_entry): Same.
8128 (Output_data_plt_arm::first_plt_entry): Define new
8129 static data member for PLT instruction template.
8130 (Output_data_plt_arm::plt_entry): Same.
8131 (Output_data_plt_arm::do_write): Define new method.
8132 (Target_arm::make_plt_entry): Same.
8133 (Target_arm::do_finalize_sections): Same.
8134 (Target_arm::do_dynsym_value): Same.
8135
8136 2009-05-28 Doug Kwan <dougkwan@google.com>
8137
8138 * Makefile.am (TARGETSOURCES): Add arm.cc.
8139 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
8140 * Makefile.in: Regenerate.
8141 * arm.cc: New file.
8142 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
8143
8144 2009-05-26 Doug Kwan <dougkwan@google.com>
8145
8146 * options.cc (General_options::parse_exclude_libs). Fix a comment.
8147 (General_options::check_excluded_libs): Strip off directories in
8148 archive name before matching like GNU ld does.
8149 * testsuite/Makefile.am (MOSTLYCLEANFILES,
8150 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
8151 (exclude_libs_test_LDFLAGS): Add linker option
8152 -Wl,--exclude-libs,libexclude_libs_test_3
8153 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
8154 an explicit archive without using -l.
8155 (alt/libexclude_libs_test_3.a): New make rule.
8156 * testsuite/Makefile.in: Regenerate.
8157 * testsuite/exclude_libs_test.c : Declare lib3_default().
8158 (main): Call it.
8159 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
8160 * exclude_libs_test_3.c: New file.
8161
8162 2009-05-26 Nick Clifton <nickc@redhat.com>
8163
8164 * po/id.po: New Indonesian translation.
8165 * po/gold.pot: Updated template file.
8166
8167 2009-05-22 Sriraman Tallam <tmsriram@google.com>
8168
8169 * testsuite/Makefile.am: Add -ffunction-sections to compile
8170 gc_comdat_test files. Add -Wl,--gc-sections to build
8171 gc_comdat_test.
8172 * testsuite/Makefile.in: Regenerate.
8173 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
8174
8175 2009-05-21 Sriraman Tallam <tmsriram@google.com>
8176
8177 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
8178 kept comdat section was garbage collected.
8179 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
8180 * testsuite/Makefile.in: Regenerate.
8181 * testsuite/gc_comdat_test.sh: New file.
8182 * testsuite/gc_comdat_test_1.cc: New file.
8183 * testsuite/gc_comdat_test_2.cc: New file.
8184
8185 2009-05-19 Doug Kwan <dougkwan@google.com>
8186
8187 * archive.cc (Archive::Archive): Move constructor from archive.h
8188 to here. Initialize no_export_.
8189 (Archive::get_elf_object_for_member): Set no_export flag of object.
8190 * archive.h (Archive::Archive): Move constructor body to
8191 archive.cc.
8192 (Archive::no_export): New method.
8193 (Archive::no_export_): New field.
8194 * object.h (Object::Object): Initialize no_export_ to false.
8195 (Object::no_export, Object::set_no_export): New methods.
8196 (Object::no_export_): New field.
8197 * options.cc (General_options::parse_exclude_libs): New method.
8198 (General_options::check_excluded_libs) Same.
8199 * options.h (exclude_libs): New option.
8200 (General_options::check_excluded_libs): New method declaration.
8201 (General_options::excluded_libs_): New field.
8202 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
8203 default or protected visibility if an object has no-export flag set.
8204 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
8205 (check_SCRIPTS): Add exclude_libs_test.sh.
8206 (check_DATA): Add exclude_libs_test.syms.
8207 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
8208 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
8209 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
8210 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
8211 (exclude_libs_test.syms, libexclude_libs_test_1.a,
8212 libexclude_libs_test_2.a): New rules.
8213 * testsuite/Makefile.in: Regenerate.
8214 * testsuite/exclude_libs_test.c: New file.
8215 * testsuite/exclude_libs_test.sh: Ditto.
8216 * testsuite/exclude_libs_test_1.c: Ditto.
8217 * testsuite/exclude_libs_test_2.c: Ditto.
8218
8219 2009-05-15 Ian Lance Taylor <iant@google.com>
8220
8221 * configure.ac: Check for declarations for cases where libiberty.h
8222 checks HAVE_DECL_xxx.
8223 * configure, config.in: Rebuild.
8224
8225 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
8226
8227 * gold.h (Incremental_argument_list): Remove (invalid) forward
8228 declaration.
8229 * incremental.cc (Incremental_inputs::report_achive): New method.
8230 (Incremental_inputs::report_object): New method.
8231 (Incremental_inputs::report_script): New method.
8232 (Incremental_inputs::finalize_inputs): New method.
8233 (Incremental_inputs::finalize): Call finalize_inputs().
8234 (Incremental_inputs::sized_create_incremental_inputs_section_data):
8235 Create inputs entries.
8236 * incremental.h (Incremental_input_type): New enum.
8237 (Incremental_inputs::Incremental_input): Initialize new fields.
8238 (Incremental_inputs::report_inputs): New method.
8239 (Incremental_inputs::report_achive): New method.
8240 (Incremental_inputs::report_object): New method.
8241 (Incremental_inputs::report_script): New method.
8242 (Incremental_inputs::finalize_inputs): New method.
8243 (Incremental_inputs::Input_info): New struct.
8244 (Incremental_inputs::Input_info_map): New typedef.
8245 (Incremental_inputs::lock_): New field.
8246 (Incremental_inputs::Inputs_): New field.
8247 (Incremental_inputs::Inputs_map): New field.
8248 * main.cc (main): Call Incremental_input::report_inputs.
8249 * options.h (Input_argument_list): Typedef moved from
8250 Input_arguments.
8251 (Input_file_group::Files): Remove, use ::Input_argument_list.
8252 (Input_file_group::Input_argument_list): Remove, use
8253 ::Input_argument_list.
8254 * plugin.cc (Plugin_manager::add_input_file): Add error in
8255 incremental build.
8256 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
8257 functions.
8258 * script.cc (read_input_script): Call
8259 Incremental_input::report_script.
8260 * script.h (Script_info): New class.
8261
8262 2009-04-27 Ian Lance Taylor <iant@google.com>
8263
8264 * x86_64.cc (do_adjust_output_section): Set entsize to
8265 plt_entry_size.
8266
8267 2009-04-23 Elliott Hughes <enh@google.com>
8268
8269 * output.cc (Output_file::close): After short writes, continue
8270 writing from the correct offset in the buffer being written.
8271
8272 2009-04-23 Chris Demetriou <cgd@google.com>
8273
8274 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
8275 * configure: Regenerate.
8276 * config.in: Regenerate.
8277 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
8278 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
8279
8280 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
8281
8282 * incremental.cc (Incremental_inputs_header_data): Renamed from
8283 Incremental_input_header_data.
8284 (Incremental_inputs_header_data::data_size): New field.
8285 (Incremental_inputs_header_data::put_input_file_count): Renamed
8286 from input_file_count.
8287 (Incremental_inputs_header_data::put_command_line_offset): Renamed
8288 from command_line_offset.
8289 (Incremental_inputs_header_data::put_reserved): Renamed from
8290 put_reserved.
8291 (Incremental_inputs_entry_data): Renamed from
8292 Incremental_input_entry_data.
8293 (Incremental_inputs_entry_data::data_size): New field.
8294 (Incremental_inputs::report_command_line): New method.
8295 (Incremental_inputs::finalize): New method.
8296 (Incremental_inputs::create_incremental_inputs_data): New method.
8297 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
8298 * incremental.h: New file.
8299 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
8300 (Layout::finalize): Create incremental inputs section in
8301 incremental builds.
8302 (Layout::create_incremental_info_sections): New method.
8303 * layout.h (Layout::incremental_inputs): New method.
8304 (Layout::create_incremental_info_sections): New method.
8305 (Layout::incremental_inputs_): New field.
8306 * main.cc (main): Notify Incremental_input of the command line.
8307
8308 2009-04-01 Ian Lance Taylor <iant@google.com>
8309 Mikolaj Zalewski <mikolajz@google.com>
8310
8311 * gold.h (reserve_unordered_map): Define, three versions, one for
8312 each version of Unordered_map.
8313 * layout.cc (Layout::Layout): Remove options parameter. Add
8314 number_of_input_files parameter. Don't initialize options_.
8315 Initialize number_of_input_files_ and resized_signatures_. Move
8316 sections_are_attached_.
8317 (Layout::layout_group): Reserve space for group_signatures_.
8318 (Layout::find_or_add_kept_section): Change name parameter to be a
8319 reference. Resize signatures_ map when it gets large enough.
8320 (Layout::layout_eh_frame): Use parameters->options() instead of
8321 this->options_.
8322 (Layout::make_output_section): Likewise.
8323 (Layout::attach_allocated_section_to_segment): Likewise.
8324 (Layout::finalize, Layout::create_executable_stack): Likewise.
8325 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
8326 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
8327 * layout.h (class Layout): Update declarations. Remove options_
8328 field. Add number_of_input_files_ and resized_signatures_
8329 fields. Move sections_are_attached_ field.
8330 * main.cc (main): Pass number of input files to Layout
8331 constructor. Don't pass options.
8332
8333 2009-03-30 Ian Lance Taylor <iant@google.com>
8334
8335 * ffsll.c (ffsll): Correct implementation.
8336
8337 2009-03-27 Ian Lance Taylor <iant@google.com>
8338
8339 * ffsll.c: New file.
8340 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
8341 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
8342 * ftruncate.c (ftruncate): Declare before definition.
8343 * mremap.c (mremap): Likewise.
8344 * pread.c (pread): Likewise.
8345 * configure, Makefile.in, config.in: Rebuild.
8346
8347 * mremap.c: New file.
8348 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
8349 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
8350 (mremap): Declare if HAVE_MREMAP is not defined.
8351 * configure, Makefile.in, config.in: Rebuild.
8352
8353 2009-03-27 Cary Coutant <ccoutant@google.com>
8354
8355 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
8356 position independent.
8357 * sparc.cc (Target_sparc::check_non_pic): Likewise.
8358 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
8359
8360 2009-03-24 Cary Coutant <ccoutant@google.com>
8361
8362 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
8363 an executable.
8364 (needs_dynamic_reloc): Likewise.
8365
8366 2009-03-24 Ian Lance Taylor <iant@google.com>
8367
8368 * yyscript.y (file_cmd): Recognize EXTERN.
8369 (extern_name_list, extern_name_list_body): New nonterminals.
8370 * script.cc (script_add_extern): Define.
8371 * script-c.h (script_add_extern): Declare.
8372
8373 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
8374
8375 * object.cc (is_elf_object): Define.
8376 * object.h (is_elf_object): Declare.
8377 * archive.cc (Archive::get_elf_object_for_member): Call
8378 is_elf_object.
8379 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
8380
8381 2009-03-24 Elliott Hughes <enh@google.com>
8382
8383 * output.cc (Output_file::map_anonymous): Define.
8384 (Output_file::map): Use map_anonymous. If the regular mmap fails,
8385 try an anonymous one. Report the size if the mmap fails.
8386 * output.h (class Output_file): Declare map_anonymous.
8387
8388 2009-03-24 Ian Lance Taylor <iant@google.com>
8389
8390 * target-select.cc (instantiate_target): Don't acquire the lock if
8391 the instantiated_target_ field has already been set.
8392
8393 2009-03-23 Ian Lance Taylor <iant@google.com>
8394
8395 * gold-threads.h (class Initialize_lock): Define.
8396 * gold-threads.cc (class Initialize_lock_once): Define.
8397 (initialize_lock_control): New static variable.
8398 (initialize_lock_pointer): New static variable.
8399 (initialize_lock_once): New static function.
8400 (Initialize_lock::Initialize_lock): Define.
8401 (Initialize_lock::initialize): Define.
8402 * target-select.h: Include "gold-threads.h".
8403 (class Target_selector): Add lock_ and initialize_lock_ fields.
8404 Don't define instantiate_target, just declare it.
8405 * target-select.cc (Target_selector::Target_selector): Initialize
8406 new fields.
8407 (Target_selector::instantiate_target): Define.
8408 * descriptors.h: Include "gold-threads.h".
8409 (class Descriptors): Add initialize_lock_ field.
8410 * descriptors.cc (Descriptors::Descriptors): Initialize new
8411 field.
8412 (Descriptors::open): Use initialize_lock_ field
8413 * errors.h (class Errors): Add initialize_lock_ field.
8414 * errors.cc (Errors::Errors): Initialize new field.
8415 (Errors::initialize_lock): Use initialize_lock_ field.
8416 * powerpc.cc (class Target_selector_powerpc): Remove
8417 instantiated_target_ field. In do_recognize call
8418 instantiate_target rather than do_instantiate_target. In
8419 do_instantiate_target just allocate a new target.
8420 * sparc.cc (class Target_selector_sparc): Likewise.
8421
8422 * freebsd.h: New file.
8423 * i386.cc: Include "freebsd.h".
8424 (Target_i386): Derive from Target_freebsd rather than
8425 Sized_target.
8426 (Target_selector_i386): Derive from Target_selector_freebsd rather
8427 than Target_selector.
8428 * x86_64.cc: Include "freebsd.h".
8429 (Target_x86_64): Derive from Target_freebsd rather than
8430 Sized_target.
8431 (Target_selector_x86_64): Derive from Target_selector_freebsd
8432 rather than Target_selector.
8433 * target.h (class Target): Add adjust_elf_header and
8434 do_adjust_elf_header.
8435 * output.cc (Output_file_header:: do_sized_write): Call target
8436 adjust_elf_header routine.
8437 * configure.tgt: Set targ_osabi.
8438 * configure.ac: Define GOLD_DEFAULT_OSABI.
8439 * parameters.cc (Parameters::default_target): Pass
8440 GOLD_DEFAULT_OSABI to select_target.
8441 * target-select.h (class Target_selector): Make instantiate_target
8442 protected rather than private.
8443 * Makefile.am (HFILES): Add freebsd.h.
8444 * configure, Makefile.in, config.in: Rebuild.
8445
8446 * merge.cc (do_add_input_section): Correct pend value. Change
8447 message about last entry not being null terminated from error to
8448 warning.
8449
8450 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
8451
8452 * incremental.cc: New file.
8453 * Makefile.am (CCFILES): Add incremental.cc.
8454 * Makefile.in: Rebuild.
8455
8456 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
8457
8458 * layout.cc (Layout::output_section_name): Preserve names
8459 of '.note.' sections.
8460
8461 2009-03-19 Ian Lance Taylor <iant@google.com>
8462
8463 * descriptors.cc (Descriptors::open): Check that the options are
8464 valid before using them.
8465
8466 2009-03-18 Ian Lance Taylor <iant@google.com>
8467
8468 * script-sections.h: Include <list>.
8469 (class Script_sections): Change Sections_elements from std::vector
8470 to std::list. Typedef public Elements_iterator. Add
8471 orphan_section_placement_, data_segment_align_start_, and
8472 saw_data_segment_align_ fields. Remove data_segment_align_index_
8473 field.
8474 * script-sections.cc (class Orphan_section_placement): New class.
8475 (class Sections_element): Add virtual functions is_relro and
8476 orphan_section_init. Remove virtual function place_orphan_here.
8477 (class Output_section_definition): Add is_relro and
8478 orphan_section_init. Remove place_orphan_here.
8479 (class Orphan_output_section): Likewise.
8480 (Script_sections::Script_sections): Update for field changes.
8481 (Script_sections::data_segment_align): Set saw_data_segment_align_
8482 and data_segment_align_start_, not data_segment_align_index.
8483 (Script_sections::data_segment_relro_end): Check
8484 saw_data_segment_align_. Use data_segment_align_start_ rather
8485 than data_segment_align_index_.
8486 (Script_sections::place_orphan): Rewrite to use
8487 Orphan_section_placement.
8488
8489 2009-03-17 Ian Lance Taylor <iant@google.com>
8490
8491 * archive.cc (Archive::add_symbols): Check for a version attached
8492 to the symbol name in the archive map.
8493 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
8494 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
8495 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
8496 (ver_test_11.a): New target.
8497 * testsuite/Makefile.in: Rebuild.
8498
8499 * configure.ac: Check for chsize and posix_fallocate. Replace
8500 ftruncate.
8501 * ftruncate.c: New file, from gnulib.
8502 * output.cc (posix_fallocate): Define dummy version if not
8503 HAVE_POSIX_FALLOCATE.
8504 (Output_file::map): Call posix_fallocate rather than lseek and
8505 write.
8506 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
8507 * configure, Makefile.in, config.in: Rebuild.
8508
8509 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
8510
8511 * layout.h (Layout::create_note): Add section_name parameter.
8512 * layout.cc (Layout::create_note): Likewise.
8513 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
8514
8515 2009-03-17 Ian Lance Taylor <iant@google.com>
8516
8517 * descriptors.cc: Include "options.h".
8518 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
8519 (Descriptors::open): Always use O_CLOEXEC when opening a new
8520 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
8521 then set FD_CLOEXEC.
8522
8523 * sparc.cc (class Target_sparc): Add has_got_section.
8524 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
8525 make sure we have a GOT section.
8526
8527 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
8528 (Target_sparc::Scan::local): Likewise.
8529 (Target_sparc::Scan::global): Likewise.
8530 (Target_sparc::Relocate::relocate): Likewise.
8531 (Target_sparc::Relocate::relocate_tls): Likewise.
8532
8533 * symtab.cc (Symbol_table::define_default_version): New function,
8534 broken out of add_from_object.
8535 (Symbol_table::add_from_object): Call define_default_version.
8536 (Symbol_table::define_special_symbol): Add resolve_oldsym
8537 parameter. Change all callers. If the version for a symbol comes
8538 from a version script, resolve it with the symbol with the same
8539 name with no version. Also add the symbol without a version if
8540 appropriate.
8541 (do_define_in_output_data): If resolving with oldsym, don't delete
8542 sym.
8543 (do_define_in_output_segment): Likewise.
8544 (do_define_as_constant): Likewise.
8545 * symtab.h (class Symbol_table): Update declarations.
8546
8547 2009-03-13 Ian Lance Taylor <iant@google.com>
8548
8549 * readsyms.cc (Read_symbols::incompatible_warning): New function.
8550 (Read_symbols::requeue): New function.
8551 (Read_symbols::do_read_symbols): If make_elf_object fails because
8552 the target type is not configured, and the file was searched for,
8553 issue a warning and retry with the next directory.
8554 (Add_symbols::run): If the file has an incompatible format, and
8555 it was searched for, requeue the Read_symbols task. On error,
8556 release the object.
8557 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
8558 dirindex parameter to constructor. Change all callers. Declare
8559 incompatible_warning and requeue.
8560 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
8561 input_argument_ and input_group_ fields. Add them to
8562 constructor. Change all callers.
8563 (class Read_script): Add dirindex_ field. Add it to constructor.
8564 Change all callers.
8565 * archive.cc (Archive::setup): Remove input_objects parameter.
8566 Change all callers.
8567 (Archive::get_file_and_offset): Likewise.
8568 (Archive::read_all_symbols): Likewise.
8569 (Archive::read_symbols): Likewise.
8570 (Archive::get_elf_object_for_member): Remove input_objects
8571 parameter. Add punconfigured parameter. Change all callers.
8572 (Archive::add_symbols): Change return type to bool. Check return
8573 value of include_member.
8574 (Archive::include_all_members): Likewise.
8575 (Archive::include_member): Change return type to bool. Return
8576 false if first included object has incompatible target. Set
8577 included_member_ field.
8578 (Add_archive_symbols::run): If add_symbols returns false, requeue
8579 Read_symbols task.
8580 * archive.h (class Archive): Add included_member_ field.
8581 Initialize it in constructor. Add input_file and searched_for
8582 methods. Update declarations.
8583 (class Add_archive_symbols): Add dirpath_, dirindex_, and
8584 input_argument_ fields. Add them to constructor. Change all
8585 callers.
8586 * script.cc: Include "target-select.h".
8587 (class Parser_closure): Add skip_on_incompatible_target_ and
8588 found_incompatible_target_ fields. Add
8589 skip_on_incompatible_target parameter to constructor. Change all
8590 callers. Add methods skip_on_incompatible_target,
8591 clear_skip_on_incompatible_target, found_incompatible_target, and
8592 set_found_incompatible_target.
8593 (read_input_script): Add dirindex parameter. Change all callers.
8594 If parser finds an incompatible target, requeue Read_symbols
8595 task.
8596 (script_set_symbol): Clear skip_on_incompatible_target in
8597 closure.
8598 (script_add_assertion, script_parse_option): Likewise.
8599 (script_start_sections, script_add_phdr): Likewise.
8600 (script_check_output_format): New function.
8601 * script.h (read_input_script): Update declaration.
8602 * script-c.h (script_check_output_format): Declare.
8603 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
8604 (ignore_cmd): Remove OUTPUT_FORMAT.
8605 * fileread.cc (Input_file::Input_file): Add explicit this.
8606 (Input_file::will_search_for): New function.
8607 (Input_file::open): Add pindex parameter. Change all callers.
8608 * fileread.h (class Input_file): Add input_file_argument method.
8609 Declare will_search_for. Update declarations.
8610 * object.cc (make_elf_object): Add punconfigured parameter.
8611 Change all callers.
8612 * object.h (class Object): Make input_file public. Add
8613 searched_for method.
8614 (make_elf_object): Update declaration.
8615 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
8616 restart search.
8617 * dirsearch.h (class Dirsearch): Update declaration.
8618 * options.h (class General_options): Add --warn-search-mismatch.
8619 * parameters.cc (Parameters::is_compatible_target): New function.
8620 * parameters.h (class Parameters): Declare is_compatible_target.
8621 * workqueue.cc (Workqueue::add_blocker): New function.
8622 * workqueue.h (class Workqueue): Declare add_blocker.
8623
8624 * fileread.cc (Input_file::open): Remove options parameter.
8625 Change all callers.
8626 (Input_file::open_binary): Likewise.
8627 * script.cc (read_input_script): Likewise.
8628 * readsyms.h (class Read_symbols): Remove options_ field. Remove
8629 options parameter from constructor. Change all callers.
8630 (class Read_script): Likewise.
8631 * fileread.h (class Input_file): Update declarations.
8632 * script.h (read_input_script): Update declaration.
8633
8634 2009-03-10 Nick Clifton <nickc@redhat.com>
8635
8636 * po/es.po: New Spanish translation.
8637
8638 2009-03-06 Cary Coutant <ccoutant@google.com>
8639
8640 * options.cc (parse_short_option): Keep dash_z from registering itself.
8641
8642 2009-03-03 Ian Lance Taylor <iant@google.com>
8643
8644 PR 9918
8645 * target-reloc.h (relocate_section): Pass output_section to
8646 relocate.
8647 * i386.cc (Target_i386::should_apply_static_reloc): Add
8648 output_section parameter. Change all callers.
8649 (Target_i386::Relocate::relocate): Add output_section parameter.
8650 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8651 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
8652 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
8653 * testsuite/two_file_shared.sh: New script.
8654 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
8655 (check_DATA): Add two_file_shared.dbg.
8656 (two_file_shared.dbg): New target.
8657 * testsuite/Makefile.in: Rebuild.
8658
8659 2009-03-01 Ian Lance Taylor <iant@google.com>
8660
8661 * configure.ac: Check for byteswap.h.
8662 * configure: Rebuild.
8663 * config.in: Rebuild.
8664
8665 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
8666
8667 * layout.cc (Layout::find_or_add_kept_section): New function.
8668 (Layout::add_comdat): Removed.
8669 * layout.h (struct Kept_section): Move out of class Layout.
8670 Remove trailing underscores from field names. Add group_sections
8671 field. Rename group_ field to is_group. Change all uses.
8672 (class Layout): Declare find_or_add_kept_section, not add_comdat.
8673 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
8674 comdat_groups_ field.
8675 (Sized_relobj::include_section_group): Use
8676 find_or_add_kept_section and Kept_section::group_sections.
8677 (Sized_relobj::include_linkonce_section): Likewise.
8678 * object.cc (class Sized_relobj): Don't define Comdat_group or
8679 Comdat_group_table. Remove find_comdat_group and
8680 add_comdat_group. Remove comdat_groups_ field.
8681 * plugin.cc (include_comdat_group): Use
8682 Layout::find_or_add_kept_section.
8683
8684 2009-02-28 Ian Lance Taylor <iant@google.com>
8685
8686 * README: --gc-sections and map files are now supported. Document
8687 some build requirements.
8688
8689 PR 6992
8690 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
8691 relocatable link set the value of the section symbol to zero.
8692 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
8693 relocatable link don't include the section address in the local
8694 symbol value.
8695
8696 2009-02-27 Ian Lance Taylor <iant@google.com>
8697
8698 PR 6811
8699 * options.h (class Search_directory): Add is_system_directory.
8700 (class General_options): Declare is_in_system_directory.
8701 * options.cc (get_relative_sysroot): Make static.
8702 (get_default_sysroot): Make static.
8703 (General_optoins::is_in_system_directory): New function.
8704 * fileread.cc (Input_file::is_in_system_directory): New function.
8705 * fileread.h (class Input_file): Declare is_in_system_directory.
8706 * object.h (class Object): Add is_in_system_directory.
8707 (class Input_objects): Remove system_library_directory_ field.
8708 * object.cc (Input_objects::add_object): Don't set
8709 system_library_directory_.
8710 (input_objects::found_in_system_library_directory): Remove.
8711 * symtab.cc (Symbol_table::write_globals): Remove input_objects
8712 parameter. Change all callers.
8713 (Symbol_table::sized_write_globals): Likewise.
8714 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
8715 Call Object::is_in_system_directory.
8716 * symtab.h (class Symbol_table): Update declarations.
8717
8718 PR 5990
8719 * descriptors.h (Open_descriptor): Add is_on_stack field.
8720 * descriptors.cc (Descriptors::open): If the descriptor is on the
8721 top of the stack, remove it. Initialize is_on_stack field.
8722 (Descriptors::release): Only add pod to stack if it is not on the
8723 stack already.
8724 (Descriptors::close_some_descriptor): Clear stack_next and
8725 is_on_stack fields.
8726
8727 PR 7091
8728 * output.cc (Output_section::find_starting_output_address): Rename
8729 from starting_output_address; add PADDR parameter; change return
8730 type.
8731 * output.h (class Output_section): Declare
8732 find_starting_output_address instead of starting_output_address.
8733 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
8734 section symbol for which we can't find a merge section.
8735
8736 PR 9836
8737 * symtab.cc (Symbol_table::add_from_object): If the visibility is
8738 hidden or internal, force the symbol to be local.
8739 * resolve.cc (Symbol::override_visibility): Define.
8740 (Symbol::override_base): Use override_visibility.
8741 (Symbol_table::resolve): Likewise.
8742 (Symbol::override_base_with_special): Likewise.
8743 (Symbol_table::override_with_special): If the visibility is hidden
8744 or internal, force the symbol to be local.
8745 * symtab.h (class Symbol): Add set_visibility and
8746 override_visibility.
8747 * testsuite/ver_test_1.sh: New file.
8748 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
8749 (check_DATA): Add ver_test_1.syms.
8750 (ver_test_1.syms): New target.
8751 * testsuite/Makefile.in: Rebuild.
8752
8753 2009-02-25 Cary Coutant <ccoutant@google.com>
8754
8755 * layout.cc (Layout::choose_output_section): Don't rename sections
8756 when using a linker script that has a SECTIONS clause.
8757 * Makefile.in: Regenerate.
8758
8759 * testsuite/Makefile.am (script_test_5.sh): New test case.
8760 * testsuite/Makefile.in: Regenerate.
8761 * testsuite/script_test_5.cc: New file.
8762 * testsuite/script_test_5.sh: New file.
8763 * testsuite/script_test_5.t: New file.
8764
8765 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
8766
8767 * archive.cc (Archive::include_member): Update calls to add_symbols.
8768 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
8769 the Layout argument.
8770 * dynobj.h (do_add_symbols): Add the Layout argument.
8771 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
8772 Layout argument.
8773 * object.h (Object::add_symbols): Add the Layout argument.
8774 (Object::do_add_symbols): Add the Layout argument.
8775 (Sized_relobj::do_add_symbols): Add the Layout argument.
8776 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
8777 Unify the two versions.
8778 (Add_plugin_symbols): Remove.
8779 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
8780 (Sized_pluginobj::do_add_symbols): Unify the two versions.
8781 (Add_plugin_symbols): Remove.
8782 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
8783 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
8784 (Add_symbols::run): Make it work with Pulginobj.
8785
8786 2009-02-06 Ian Lance Taylor <iant@google.com>
8787
8788 * object.cc (Sized_relobj::do_layout): Make info message start
8789 with lower case letter.
8790
8791 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
8792
8793 * binary.cc: Fix file comment.
8794
8795 * options.h (enum Incremental_disposition): Define.
8796 (class General_options): Add new options: --incremental,
8797 --incremental_changed, --incremental_unchanged,
8798 --incremental_unknown. Add incremental_disposition_ and
8799 implicit_incremental_ fields.
8800 (General_options::incremental_disposition): New function.
8801 (class Position_dependent_options): Add incremental_disposition
8802 option.
8803 (Position_dependent_options::copy_from_options): Set incremental
8804 dispositions.
8805 * options.cc (General_options::parse_incremental_changed): New
8806 function.
8807 (General_options::parse_incremental_unchanged): New function.
8808 (General_options::parse_incremental_unknown): New function.
8809 (General_options::General_options): Initialize new fields
8810 incremental_disposition_ and implicit_incremental_.
8811 (General_options::finalize): Check for uasge of --incremental-*
8812 without --incremental.
8813
8814 2009-02-06 Chris Demetriou <cgd@google.com>
8815
8816 * gold.h (gold_undefined_symbol): Change to take only a Symbol
8817 pointer and to report location as the file name associated with
8818 the symbol.
8819 (gold_undefined_symbol_at_location): New function to replace the
8820 old gold_undefined_symbol functionality.
8821 * target-reloc.h (relocate_section): Update to use
8822 gold_undefined_symbol_at_location.
8823 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
8824 Call gold_undefined_symbol function rather than gold_error.
8825 * errors.h (Errors::undefined_symbol): Take location as a
8826 string, rather than calculating it from a relocation.
8827 * errors.cc (Errors::fatal): Print "fatal error:" before the
8828 formatted message.
8829 (Errors::error, Errors::error_at_location): Print "error: "
8830 before the formatted message.
8831 (Errors::undefined_symbol): Take location as a string, rather
8832 than calculating it from a relocation.
8833 (gold_undefined_symbol_at_location): New function akin to
8834 old gold_undefined_symbol, calculates location from relocation.
8835 (gold_undefined_symbol): Change to take only a Symbol pointer
8836 and to report location as the file name associated with the symbol.
8837 * testsuite/debug_msg.sh: Update for changed error messages.
8838 * testsuite/undef_symbol.sh: Likewise.
8839
8840 2009-02-04 Duncan Sands <baldrick@free.fr>
8841
8842 PR 9812
8843 * reduced_debug_output.h
8844 (Output_reduced_debug_abbrev_section::failed): Use format for
8845 gold_warning.
8846 (Output_reduced_debug_info_section::faild): Likewise.
8847
8848 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
8849
8850 * script.cc (Lazy_demangler): New class.
8851 (Version_script_info::get_symbol_version_helper): Demangle a
8852 symbol only once.
8853
8854 2009-01-29 Cary Coutant <ccoutant@google.com>
8855
8856 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
8857 to __tls_get_addr.
8858 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
8859
8860 2009-01-28 Ian Lance Taylor <iant@google.com>
8861
8862 * version.cc (version_string): Bump to 1.9.
8863
8864 * gold.h: Include <cstring> and <stdint.h>.
8865 * version.cc: Include <cstdio>.
8866 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
8867 warning.
8868 * reduced_debug_output.cc (insert_into_vector): Rename from
8869 Insert_into_vector; change all callers. Use Swap_unaligned to
8870 avoid aliasing issue; remove union since it is unnecessary.
8871
8872 2009-01-27 Sriraman Tallam <tmsriram@google.com>
8873
8874 * Makefile.am (CCFILES): Add gc.cc.
8875 (HFILES): Add gc.h.
8876 * Makefile.in: Regenerate.
8877 * gold.cc (Gc_runner): New class.
8878 (queue_initial_tasks): Call garbage collection related tasks
8879 when corresponding options are invoked.
8880 (queue_middle_gc_tasks): New function.
8881 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
8882 processed early before laying out sections during garbage collection.
8883 * gold.h (queue_middle_gc_tasks): New function.
8884 (is_prefix_of): Move from "layout.cc".
8885 * i386.cc (Target_i386::gc_process_relocs): New function.
8886 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
8887 * main.cc (main): Create object of class "Garbage_collection".
8888 * object.cc (Relobj::copy_symbols_data): New function.
8889 (Relobj::is_section_name_included): New function.
8890 (Sized_relobj::do_layout): Allow this function to be called twice
8891 during garbage collection and defer layout of section during the
8892 first call.
8893 * object.h (Relobj::get_symbols_data): New function.
8894 (Relobj::is_section_name_included): New function.
8895 (Relobj::copy_symbols_data): New function.
8896 (Relobj::set_symbols_data): New function.
8897 (Relobj::get_relocs_data): New function.
8898 (Relobj::set_relocs_data): New function.
8899 (Relobj::is_output_section_offset_invalid): New pure virtual function.
8900 (Relobj::gc_process_relocs): New function.
8901 (Relobj::do_gc_process_relocs): New pure virtual function.
8902 (Relobj::sd_): New data member.
8903 (Sized_relobj::is_output_section_offset_invalid): New function.
8904 (Sized_relobj::do_gc_process_relocs): New function.
8905 * options.h (General_options::gc_sections): Modify to not be a no-op.
8906 (General_options::print_gc_sections): New option.
8907 * plugin.cc (Plugin_finish::run): Remove function call to
8908 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
8909 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
8910 * reloc.cc (Read_relocs::run): Add task to process relocs and
8911 determine unreferenced sections when doing garbage collection.
8912 (Gc_process_relocs): New class.
8913 (Sized_relobj::do_gc_process_relocs): New function.
8914 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
8915 sections that are garbage collected.
8916 * reloc.h (Gc_process_relocs): New class.
8917 * sparc.cc (Target_sparc::gc_process_relocs): New function.
8918 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
8919 symbols whose corresponding sections are garbage collected.
8920 (Symbol_table::Symbol_table): Add new parameter for the garbage
8921 collection object.
8922 (Symbol_table::gc_mark_undef_symbols): New function.
8923 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8924 (Symbol_table::gc_mark_dyn_syms): New function.
8925 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
8926 as garbage.
8927 (Symbol_table::add_from_object): Likewise.
8928 (Symbol_table::add_from_relobj): When building shared objects, do not
8929 treat externally visible symbols as garbage.
8930 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
8931 table information for static and relocatable links.
8932 * symtab.h (Symbol_table::set_gc): New function.
8933 (Symbol_table::gc): New function.
8934 (Symbol_table::gc_mark_undef_symbols): New function.
8935 (Symbol_table::gc_mark_symbol_for_shlib): New function.
8936 (Symbol_table::gc_mark_dyn_syms): New function.
8937 (Symbol_table::gc_): New data member.
8938 * target.h (Sized_target::gc_process_relocs): New pure virtual
8939 function.
8940 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
8941 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
8942
8943 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
8944
8945 * options.h (General_options::gc_sections): Define as a no-op for now.
8946 (General_options::no_keep_memory): Ditto.
8947 (General_options::Bshareable): Define.
8948 * options.cc (General_options::finalize): Honor -Bshareable.
8949
8950 2009-01-20 Andreas Schwab <schwab@suse.de>
8951
8952 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
8953 read the value in the contents, since we don't use it. Use the
8954 template endianness when writing.
8955 (Relocate::relocate): Use it for R_PPC_REL16_HA.
8956
8957 2009-01-19 Andreas Schwab <schwab@suse.de>
8958
8959 * configure.tgt (powerpc64-*): Fix targ_obj.
8960
8961 2009-01-15 Ian Lance Taylor <iant@google.com>
8962
8963 * object.cc (Sized_relobj::write_local_symbols): Don't write out
8964 local symbols when stripping all symbols.
8965
8966 2009-01-14 Cary Coutant <ccoutant@google.com>
8967
8968 * output.cc (Output_reloc): Add explicit instantiations.
8969
8970 2009-01-14 Cary Coutant <ccoutant@google.com>
8971
8972 * archive.cc (Archive::get_elf_object_for_member): Remove call
8973 to File_read::claim_for_plugin.
8974 * descriptors.cc (Descriptors::open): Remove reference to
8975 is_claimed.
8976 (Descriptors::claim_for_plugin): Remove.
8977 * descriptors.h (Descriptors::claim_for_plugin): Remove.
8978 (Descriptors::is_claimed): Remove.
8979 (claim_descriptor_for_plugin): Remove.
8980 * fileread.cc (File_read::claim_for_plugin): Remove.
8981 * fileread.h (File_read::claim_for_plugin): Remove.
8982 (File_read::descriptor): Reopen descriptor if necessary.
8983 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
8984 (Plugin_manager::all_symbols_read): Add task parameter. Change
8985 all callers.
8986 (Plugin_manager::get_input_file): New function.
8987 (Plugin_manager::release_input_file): New function.
8988 (Pluginobj::Pluginobj): Add filesize parameter and initialize
8989 corresponding data member.
8990 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
8991 and pass to base constructor. Change all callers.
8992 (get_input_file, release_input_file): New functions.
8993 (make_sized_plugin_object): Add filesize parameter. Change all callers.
8994 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
8995 (Plugin_manager::all_symbols_read): Add task parameter.
8996 (Plugin_manager::get_input_file): New function.
8997 (Plugin_manager::release_input_file): New function.
8998 (Plugin_manager::task_): New data member.
8999 (Pluginobj::Pluginobj): Add filesize parameter.
9000 (Pluginobj::filename): New function.
9001 (Pluginobj::descriptor): New function.
9002 (Pluginobj::filesize): New function.
9003 (Pluginobj::filesize_): New data member.
9004 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
9005 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
9006 File_read::claim_for_plugin; use Object::unlock to unlock the file.
9007
9008 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
9009 with archive libraries.
9010 * testsuite/Makefile.in: Regenerate.
9011 * testsuite/plugin_test.c (struct sym_info): New type.
9012 (get_input_file, release_input_file): New static variables.
9013 (onload): Capture new transfer vector entries.
9014 (claim_file_hook): Stop reading at end of file according to filesize.
9015 Factor out parsing of readelf output into separate function.
9016 (all_symbols_read_hook): Exercise get_input_file and release_input_file
9017 APIs and get the source file name from the symbol table. Convert
9018 source file name to corresponding object file name. Print info
9019 message when adding new input files.
9020 (parse_readelf_line): New function.
9021 * testsuite/plugin_test_1.sh: Add checks for new info messages.
9022 * testsuite/plugin_test_2.sh: Likewise.
9023 * testsuite/plugin_test_3.sh: Likewise.
9024 * testsuite/plugin_test_4.sh: New test case.
9025
9026 2009-01-07 Ian Lance Taylor <iant@google.com>
9027
9028 * version.cc (version_string): Bump to 1.8.
9029
9030 2008-12-23 Cary Coutant <ccoutant@google.com>
9031
9032 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
9033 * plugin.cc (Plugin_manager::finish): Rename as
9034 layout_deferred_objects. Move cleanup to separate function.
9035 (Plugin_manager::cleanup): New function.
9036 (Plugin_finish::run): Call layout_deferred_objects and cleanup
9037 separately.
9038 * plugin.h (Plugin_manager::finish): Rename as
9039 layout_deferred_objects.
9040 (Plugin_manager::cleanup): New function.
9041 (Plugin_manager::cleanup_done): New field.
9042
9043 2008-12-23 Cary Coutant <ccoutant@google.com>
9044
9045 * plugin.cc (is_visible_from_outside): New function.
9046 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
9047 so we don't return "IR only" status for exported symbols or -r links.
9048
9049 * testsuite/Makefile.am (plugin_test_3): New test case.
9050 * testsuite/Makefile.in: Regenerate.
9051 * testsuite/plugin_test_3.sh: New file.
9052
9053 2008-12-22 Cary Coutant <ccoutant@google.com>
9054
9055 * object.cc (Sized_relobj::layout_section): New function.
9056 (Sized_relobj::do_layout): Defer layout of input sections until after
9057 plugin has provided replacement files.
9058 (Sized_relobj::do_layout_deferred_sections): New function.
9059 * object.h (Relobj::set_section_offset): Remove virtual keyword.
9060 (Relobj::layout_deferred_sections): New function.
9061 (Relobj::do_layout_deferred_sections): New function.
9062 (Sized_relobj::do_layout_deferred_sections): New function.
9063 (Sized_relobj::layout_section): New function.
9064 (Sized_relobj::Deferred_layout): New structure.
9065 (Sized_relobj::deferred_layout_): New field.
9066 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
9067 Change all callers. Layout deferred sections.
9068 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
9069 references.
9070 (Plugin_hook::run): Move code from do_plugin_hook inline.
9071 (Plugin_hook::do_plugin_hook): Remove.
9072 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
9073 (Plugin_manager::finish): Renamed, was cleanup.
9074 (Plugin_manager::should_defer_layout): New function.
9075 (Plugin_manager::add_deferred_layout_object): New function.
9076 (Plugin_manager::Deferred_layout_list): New type.
9077 (Plugin_manager::deferred_layout_objects_): New field.
9078 (Plugin_hook::do_plugin_hook): Remove.
9079
9080 2008-12-17 Ian Lance Taylor <iant@google.com>
9081
9082 * options.h (class General_options): Add --no case for
9083 --export-dynamic.
9084
9085 2008-12-16 Cary Coutant <ccoutant@google.com>
9086
9087 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
9088 vector.
9089 (Plugin_manager::claim_file): Create plugin object even if
9090 plugin did not call the add_symbols callback.
9091 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
9092 asking for more symbols than were added.
9093 * testsuite/Makefile.am (plugin_test_1): Add test case with
9094 no global symbols.
9095 (empty.syms): New target.
9096 * testsuite/Makefile.in: Regenerate.
9097 * testsuite/plugin_test.c (claim_file_hook): Add new debug
9098 message. Don't call add_symbols if no globals.
9099 (all_symbols_read_hook): Don't provide replacement for empty
9100 claimed file.
9101
9102 2008-12-12 Ian Lance Taylor <iant@google.com>
9103
9104 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
9105 r_type == 0 for a local symbol with r_sym == 0.
9106 (scan_relocatable_relocs): Pass r_sym to
9107 local_non_section_strategy.
9108 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
9109 r_sym parameter.
9110
9111 * configure.ac: Update test for TLS descriptors: they are
9112 supported as of glibc 2.9.
9113 * configure: Rebuild.
9114
9115 2008-12-11 Ian Lance Taylor <iant@google.com>
9116
9117 PR 7091
9118 * target-reloc.h (Default_scan_relocatable_relocs): For each
9119 function, map r_type == 0 to RELOC_DISCARD.
9120
9121 2008-12-10 Cary Coutant <ccoutant@google.com>
9122
9123 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
9124 object to override a kept COMDAT group from a plugin object.
9125
9126 2008-12-09 Ian Lance Taylor <iant@google.com>
9127
9128 PR 7088
9129 * yyscript.y (file_cmd): Handle INPUT.
9130
9131 * testsuite/initpri1.c: Change all declarations to be full
9132 prototypes by adding void, to avoid compiler warnings.
9133
9134 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
9135
9136 * options.cc (General_options::parse_plugin_opt): New.
9137 (General_options::add_plugin): The argument now is just the filename.
9138 (General_options::add_plugin_option): New.
9139 * options.h (plugin_opt): New.
9140 (add_plugin): Change argument name.
9141 (add_plugin_option): New.
9142 * plugin.cc (Plugin::load): Don't parse the plugin option.
9143 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
9144 (Plugin::add_option): New.
9145 (Plugin::args_): Change type.
9146 (Plugin::filename_): New.
9147 (Plugin_manager::add_plugin_option): New.
9148 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
9149 * testsuite/Makefile.in: Regenerate.
9150
9151 2008-12-05 Cary Coutant <ccoutant@google.com>
9152
9153 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
9154 Handle --strip-lto-sections option.
9155 * options.h (strip_lto_sections): New option.
9156
9157 2008-12-01 Cary Coutant <ccoutant@google.com>
9158
9159 * plugin.cc (ld_plugin_message): Change format parameter to const.
9160 Fix mismatch between new[] and delete.
9161
9162 2008-11-14 Cary Coutant <ccoutant@google.com>
9163
9164 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
9165 instead of -1U.
9166
9167 2008-11-05 Craig Silverstein <csilvers@google.com>
9168
9169 * options.cc (General_options::parse_dynamic_list): New function.
9170 * options.h (General_options): New flags dynamic_list,
9171 dynamic_list_data, dynamic_list_cpp_new, and
9172 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
9173 (General_options::in_dynamic_list): New function.
9174 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
9175 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
9176 (Lex::can_continue_name): Likewise.
9177 (yylex): Likewise.
9178 (read_script_file): New parameter script_options.
9179 (read_dynamic_list): New function.
9180 (Script_options::define_dynamic_list): New function.
9181 (dynamic_list_keyword_parsecodes): New variable.
9182 (dynamic_list_keywords): New variable.
9183 * script.h (Script_options::define_dynamic_list): New function
9184 prototype.
9185 (read_dynamic_list): New function prototype.
9186 * symtab.cc (strprefix): New macro.
9187 (Symbol::should_add_dynsym_entry): Support dynamic_list,
9188 dynamic_list_data, dynamic_list_cpp_new, and
9189 dynamic_list_cpp_typeinfo.
9190 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
9191 (dynamic_list_expr): New rule.
9192 (dynamic_list_nodes): Likewise.
9193 (dynamic_list_node): Likewise.
9194 * testsuite/Makefile.am (dynamic_list): New test.
9195 * testsuite/Makefile.in: Regenerated.
9196 * testsuite/dynamic_list.t: New file.
9197 * testsuite/dynamic_list.sh: New file.
9198
9199 2008-11-05 Craig Silverstein <csilvers@google.com>
9200
9201 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
9202 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
9203 (t11_last): Likewise.
9204 * testsuite/ver_test_6.c (main): Likewise.
9205
9206 2008-10-07 Cary Coutant <ccoutant@google.com>
9207
9208 * options.c (General_options::finalize): Add check for -static and
9209 -shared.
9210 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
9211 is not empty.
9212
9213 2008-10-02 Cary Coutant <ccoutant@google.com>
9214
9215 * plugin.cc (make_sized_plugin_object): Fix conditional
9216 compilation to work when not all targets are enabled.
9217
9218 2008-09-29 Cary Coutant <ccoutant@google.com>
9219
9220 * archive.cc (Archive::get_file_and_offset): Use filename instead
9221 of name to get library path.
9222 (Archive::include_member): Unlock external member of a thin archive.
9223
9224 * testsuite/Makefile.am (TEST_AR): New variable.
9225 (thin_archive_test_1): New test.
9226 (thin_archive_test_2): New test.
9227 * testsuite/Makefile.in: Regenerate.
9228 * testsuite/thin_archive_main.cc: New file.
9229 * testsuite/thin_archive_test_1.cc: New file.
9230 * testsuite/thin_archive_test_2.cc: New file.
9231 * testsuite/thin_archive_test_3.cc: New file.
9232 * testsuite/thin_archive_test_4.cc: New file.
9233
9234 2008-09-29 Cary Coutant <ccoutant@google.com>
9235
9236 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
9237 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
9238 instead of -1U.
9239 (Sized_relobj::do_finalize_local_symbols): Likewise.
9240 (Sized_relobj::map_to_kept_section): Likewise.
9241 * object.h (Sized_relobj::invalid_address): New constant.
9242 (Sized_relobj::do_output_section_offset): Check for invalid_address
9243 and return -1ULL.
9244 * output.cc (Output_reloc::local_section_offset): Use constant
9245 invalid_address instead of -1U.
9246 (Output_reloc::get_address): Likewise.
9247 (Output_section::output_address): Change -1U to -1ULL.
9248 * output.h (Output_reloc::invalid_address): New constant.
9249 * reloc.cc (Sized_relobj::write_sections): Use constant
9250 invalid_address instead of -1U.
9251 (Sized_relobj::relocate_sections): Likewise.
9252 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
9253 values for merge sections.
9254 * target-reloc.h (relocate_for_relocatable): Use constant
9255 invalid_address instead of -1U.
9256
9257 2008-09-19 Cary Coutant <ccoutant@google.com>
9258
9259 Add plugin functionality for link-time optimization (LTO).
9260 * configure.ac (plugins): Add --enable-plugins option.
9261 * configure: Regenerate.
9262 * config.in: Regenerate.
9263 * Makefile.am (LIBDL): New variable.
9264 (CCFILES): Add plugin.cc.
9265 (HFILES): Add plugin.h.
9266 (ldadd_var): Add LIBDL.
9267 * Makefile.in: Regenerate.
9268
9269 * archive.cc: Include "plugin.h".
9270 (Archive::setup): Don't preread archive symbols when using a plugin.
9271 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
9272 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
9273 files.
9274 (Archive::include_member): Add symbols from plugin objects.
9275 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
9276 * descriptors.cc (Descriptors::open): Check for file descriptors
9277 abandoned by plugins.
9278 (Descriptors::claim_for_plugin): New function.
9279 * descriptors.h (Descriptors::claim_for_plugin): New function.
9280 (Open_descriptor::is_claimed): New field.
9281 (claim_descriptor_for_plugin): New function.
9282 * fileread.cc (File_read::claim_for_plugin): New function.
9283 * fileread.h (File_read::claim_for_plugin): New function.
9284 (File_read::descriptor): New function.
9285 * gold.cc: Include "plugin.h".
9286 (queue_initial_tasks): Add task to call plugin hooks for generating
9287 new object files.
9288 * main.cc: Include "plugin.h".
9289 (main): Load plugin libraries.
9290 * object.h (Pluginobj): Declare.
9291 (Object::pluginobj): New function.
9292 (Object::do_pluginobj): New function.
9293 (Object::set_target): New function.
9294 * options.cc: Include "plugin.h".
9295 (General_options::parse_plugin): New function.
9296 (General_options::General_options): Initialize plugins_ field.
9297 (General_options::add_plugin): New function.
9298 * options.h (Plugin_manager): Declare.
9299 (General_options): Add --plugin option.
9300 (General_options::has_plugins): New function.
9301 (General_options::plugins): New function.
9302 (General_options::add_plugin): New function.
9303 (General_options::plugins_): New field.
9304 * plugin.cc: New file.
9305 * plugin.h: New file.
9306 * readsyms.cc: Include "plugin.h".
9307 (Read_symbols::do_read_symbols): Check for archive before checking
9308 for ELF file. Call plugin hooks to claim files.
9309 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
9310 from a real object file; force override when processing replacement
9311 files.
9312 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
9313 (Symbol::init_base_object): Likewise.
9314 (Symbol::init_base_output_data): Likewise.
9315 (Symbol::init_base_output_segment): Likewise.
9316 (Symbol::init_base_constant): Likewise.
9317 (Symbol::init_base_undefined): Likewise.
9318 (Symbol::output_section): Assert that object is not a plugin.
9319 (Symbol_table::add_from_pluginobj): New function.
9320 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
9321 undefined.
9322 (Symbol_table::sized_write_globals): Likewise.
9323 (Symbol_table::add_from_pluginobj): Instantiate template.
9324 * symtab.h (Sized_pluginobj): Declare.
9325 (Symbol::in_real_elf): New function.
9326 (Symbol::set_in_real_elf): New function.
9327 (Symbol::in_real_elf_): New field.
9328 (Symbol_table::add_from_pluginobj): New function.
9329
9330 * testsuite/Makefile.am (AM_CFLAGS): New variable.
9331 (LIBDL): New variable.
9332 (LDADD): Add LIBDL.
9333 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
9334 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
9335 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
9336 (MOSTLYCLEANFILES): Likewise.
9337 * testsuite/Makefile.in: Regenerate.
9338 * testsuite/plugin_test.c: New file.
9339 * testsuite/plugin_test_1.sh: New file.
9340 * testsuite/plugin_test_2.sh: New file.
9341
9342 2008-09-16 Ian Lance Taylor <iant@google.com>
9343
9344 * target-reloc.h (relocate_section): Check whether a symbol is
9345 defined by the ABI before reporting an undefined symbol error.
9346 * target.h (Target::is_defined_by_abi): Make parameter const.
9347 (Target::do_is_defined_by_abi): Likewise.
9348 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
9349 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
9350 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
9351 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
9352 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
9353 * testsuite/Makefile.in: Rebuild.
9354
9355 * fileread.cc (make_view): Add casts to avoid warning.
9356
9357 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9358
9359 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
9360 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9361
9362 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
9363
9364 * options.h (General_options::output_is_executable): New.
9365 (General_options::output_is_pie): New.
9366 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
9367 for shared libraries.
9368 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
9369
9370 2008-09-11 Chris Demetriou <cgd@google.com>
9371
9372 * options.h (origin): New -z option.
9373 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
9374 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
9375 in DT_FLAGS_1.
9376
9377 2008-09-05 Cary Coutant <ccoutant@google.com>
9378
9379 * fileread.cc (File_read::make_view): Add check for attempt to map
9380 beyond end of file.
9381
9382 2008-09-05 Cary Coutant <ccoutant@google.com>
9383
9384 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
9385 explicit instantiations.
9386
9387 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
9388
9389 PR gold/6858
9390 * options.cc (General_options::finalize): Allow undefined symbols
9391 in shlibs if linking -shared.
9392
9393 PR gold/6859
9394 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
9395 symbols as not needing a dynsym entry.
9396
9397 2008-08-20 Craig Silverstein <csilvers@google.com>
9398
9399 * fileread.cc (File_read::open): Do not lock the file unless it
9400 was successfully opened.
9401
9402 2008-08-14 Cary Coutant <ccoutant@google.com>
9403
9404 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
9405 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
9406 * testsuite/tls_test.cc (struct int128): 128-bit struct
9407 for testing TLS relocs with non-zero addend.
9408 (v12): New TLS variable.
9409 (t12): New test.
9410 (t_last): Add check for v12.
9411 * testsuite/tls_test.h (t12): New function.
9412 * testsuite/tls_test_main.cc (thread_routine): Call new test.
9413
9414 2008-08-13 Ian Lance Taylor <iant@google.com>
9415
9416 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
9417 set tls_segment_ or relro_segment_.
9418 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
9419 when appropriate.
9420 * output.h (Output_section::clear_is_relro): New function.
9421 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
9422 sections specially even when output_data_ is empty.
9423 (Output_segment::maximum_alignment): When first section is relro,
9424 only force alignment for PT_LOAD segments.
9425 * script.cc (script_data_segment_align): New function.
9426 (script_data_segment_relro_end): New function.
9427 * script-c.h (script_data_segment_align): Declare.
9428 (script_data_segment_relro_end): Declare.
9429 * script-sections.h (class Script_sections): Declare
9430 data_segment_align and data_segment_relro_end. Add fields
9431 segment_align_index_ and saw_relro_end_.
9432 * script-sections.cc (class Sections_element): Add set_is_relro
9433 virtual function. Add new bool* parameter to place_orphan_here.
9434 Add get_output_section virtual function.
9435 (class Output_section_definition): Add set_is_relro. Add new
9436 bool* parameter to place_orphan_here. Add get_output_section.
9437 Add is_relro_ field.
9438 (Output_section_definition::Output_section_definition): Initialize
9439 evaluated_address_, evaluated_load_address, evaluated_addralign_,
9440 and is_relro_ fields.
9441 (Output_section_definition::place_orphan_here): Add is_relro
9442 parameter.
9443 (Output_section_definition::set_section_addresses): Set relro for
9444 output section.
9445 (Output_section_definition::alternate_constraint): Likewise.
9446 (class Orphan_output_section): Add new bool* parameter to
9447 place_orphan_here. Add get_output_section.
9448 (Orphan_output_section::place_orphan_here): Add is_relro
9449 parameter.
9450 (Script_sections::Script_sections): Initialize
9451 data_segment_align_index_ and saw_relro_end_.
9452 (Script_sections::data_segment_align): New function.
9453 (Script_sections::data_segment_relro_end): New function.
9454 (Script_sections::place_orphan): Set or clear is_relro.
9455 (Script_sections::set_section_addresses): Force alignment of first
9456 TLS section.
9457 * yyscript.y (exp): Call script_data_segment_align and
9458 script_data_segment_relro_end.
9459 * testsuite/relro_script_test.t: New file.
9460 * testsuite/relro_test.cc (using_script): Declare.
9461 (t1, t2): Test using_script.
9462 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
9463 (relro_script_test_SOURCES): Define.
9464 (relro_script_test_DEPENDENCIES): Define.
9465 (relro_script_test_LDFLAGS): Define.
9466 (relro_script_test_LDADD): Define.
9467 (relro_script_test.so): New target.
9468 * testsuite/Makefile.in: Rebuild.
9469
9470 2008-08-06 Cary Coutant <ccoutant@google.com>
9471
9472 * archive.cc (Archive::total_archives, Archive::total_members)
9473 (Archive::total_members_loaded): New variables.
9474 (Archive::setup): Add parameter. Add option to preread
9475 archive symbols.
9476 (Archive::read_armap): Add counter.
9477 (Archive::get_file_and_offset): New function.
9478 (Archive::get_elf_object_for_member): New function.
9479 (Archive::read_all_symbols): New function.
9480 (Archive::read_symbols): New function.
9481 (Archive::add_symbols): Add counters.
9482 (Archive::include_all_members): Use armap to find members if it's
9483 already built.
9484 (Archive::include_member): Skip reading symbols if already read.
9485 Factored code into Archive::get_file_and_offset and
9486 Archive::get_elf_object_for_member. Changed call to
9487 Mapfile::report_include_archive_member.
9488 (Archive::print_stats): New function.
9489 * archive.h: Declare Object and Read_symbols_data classes.
9490 (Archive::Archive): Add initializers for new members.
9491 (Archive::setup): Add parameter.
9492 (Archive::print_stats): New function.
9493 (Archive::total_archives, Archive::total_members)
9494 (Archive::total_members_loaded): New variables.
9495 (Archive::get_file_and_offset): New function.
9496 (Archive::get_elf_object_for_member): New function.
9497 (Archive::read_all_symbols): New function.
9498 (Archive::read_symbols): New function.
9499 (Archive::Archive_member): New class.
9500 (Archive::members_): New member.
9501 (Archive::num_members_): New member.
9502 * main.cc: Include archive.h.
9503 (main): Call Archive::print_stats.
9504 * mapfile.cc (Mapfile::report_include_archive_member): Delete
9505 archive parameter; member_name is now the fully-decorated name.
9506 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
9507 * options.h: (General_options): Add --preread-archive-symbols option.
9508 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
9509 Archive::setup.
9510
9511 2008-08-04 Ian Lance Taylor <iant@google.com>
9512
9513 * symtab.h (Symbol::use_plt_offset): New function.
9514 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
9515 * powerpc.cc (Relocate::relocate): Likewise.
9516 * sparc.cc (Relocate::relocate): Likewise.
9517 * x86_64.cc (Relocate::relocate): Likewise.
9518 * testsuite/weak_plt.sh: New test.
9519 * testsuite/weak_plt_main.cc: New test.
9520 * testsuite/weak_plt_shared.cc: New test.
9521 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
9522 (check_PROGRAMS): Add weak_plt.
9523 (check_DATA): Add weak_plt_shared.so.
9524 (weak_plt_main_pic.o, weak_plt): New targets.
9525 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
9526 * testsuite/Makefile.in: Rebuild.
9527
9528 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
9529 gcctestdir/ld.
9530 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
9531 * testsuite/Makefile.in: Rebuild.
9532
9533 2008-08-04 Alan Modra <amodra@bigpond.net.au>
9534
9535 * Makefile.am (POTFILES.in): Set LC_ALL=C.
9536 * Makefile.in: Regenerate.
9537 * po/POTFILES.in: Regenerate.
9538
9539 2008-07-29 Ian Lance Taylor <iant@google.com>
9540
9541 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
9542 symbols before other symbols.
9543 * testsuite/script_test_2.cc (test_addr): Declare.
9544 (test_addr_alias): Declare.
9545 (main): Check that test_addr and test_addr_alias have the right
9546 values.
9547 * testsuite/script_test_2.t: Define test_addr_alias and
9548 test_addr.
9549
9550 2008-07-24 Ian Lance Taylor <iant@google.com>
9551
9552 PR 5990
9553 * descriptors.cc: New file.
9554 * descriptors.h: New file.
9555 * gold-threads.h (class Hold_optional_lock): New class.
9556 * fileread.cc: Include "descriptors.h".
9557 (File_read::~File_read): Release descriptor rather than closing
9558 it.
9559 (File_read::open) [file]: Call open_descriptor rather than open.
9560 Set is_descriptor_opened_.
9561 (File_read::open) [memory]: Assert that descriptor is not open.
9562 (File_read::reopen_descriptor): New function.
9563 (File_read::release): Release descriptor.
9564 (File_read::do_read): Make non-const. Reopen descriptor.
9565 (File_read::read): Make non-const.
9566 (File_read::make_view): Reopen descriptor.
9567 (File_read::do_readv): Likewise.
9568 * fileread.h (class File_read): Add is_descriptor_opened_ field.
9569 Update declarations.
9570 * layout.cc: Include "descriptors.h".
9571 (Layout::create_build_id): Use open_descriptor rather than open.
9572 * output.cc: Include "descriptors.h".
9573 (Output_file::open): Use open_descriptor rather than open.
9574 * archive.cc (Archive::const_iterator): Change Archive to be
9575 non-const.
9576 (Archive::begin, Archive::end): Make non-const.
9577 (Archive::count_members): Likewise.
9578 * archive.h (class Archive): Update declarations.
9579 * object.h (Object::read): Make non-const.
9580 * Makefile.am (CCFILES): Add descriptors.cc.
9581 (HFILES): Add descriptors.h.
9582 * Makefile.in: Rebuild.
9583
9584 PR 6716
9585 * gold.h: Always include <clocale>. Add Solaris workarounds
9586 following code in binutils/sysdep.h.
9587
9588 PR 6048
9589 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
9590 this->eh_frame_hdr_ is NULL before using it.
9591
9592 * dynobj.cc (Versions::Versions): Update comment.
9593
9594 * dynobj.cc (Versions::Versions): If there is an soname, use it as
9595 the base version name.
9596
9597 * stringpool.cc (Stringpool_template::add_with_length): Set key to
9598 array size plus one.
9599 (Stringpool_template::set_string_offsets): Subtract one from key
9600 before using it as an array index.
9601 (Stringpool_template::get_offset_with_length): Likewise.
9602 (Stringpool_template::write_to_buffer): Likewise.
9603 * stringpool.h (Stringpool_template::get_offset_from_key):
9604 Likewise.
9605
9606 2008-07-23 Ian Lance Taylor <iant@google.com>
9607
9608 PR 6658
9609 * object.h (Merged_symbol_value::value): Do our best to handle a
9610 negative addend.
9611
9612 PR 6647
9613 * script.cc (Version_script_info::get_versions): Don't add empty
9614 version tag to return value.
9615 (Version_script_info::get_symbol_version_helper): Change return
9616 type to bool. Add pversion parameter. Change all callers.
9617 (script_register_vers_node): Don't require a non-NULL tag.
9618 * script.h (class Version_script_info): Update declarations.
9619 (Version_script_info::get_symbol_version): Change return type to
9620 bool. Add version parameter. Change all callers.
9621 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
9622 handling. Handle an empty version from a version script.
9623 (Symbol_table::define_special_symbol): Likewise.
9624 * testsuite/ver_test_10.script: New file.
9625 * testsuite/ver_test_10.sh: New file.
9626 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
9627 (check_DATA): Add ver_test_10.syms.
9628 (ver_test_10.syms, ver_test_10.so): New target.
9629 * testsuite/Makefile.in: Rebuild.
9630
9631 2008-07-23 Simon Baldwin <simonb@google.com>
9632
9633 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
9634 to zero for undefined symbols from dynamic libraries.
9635
9636 2008-07-23 Ian Lance Taylor <iant@google.com>
9637
9638 * symtab.cc (Symbol_table::resolve): Remove version parameter.
9639 Change all callers.
9640 * symtab.h (class Symbol_table): Update declaration.
9641 * testsuite/ver_test_9.cc: New file.
9642 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
9643 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
9644 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
9645 (ver_test_9.so, ver_test_9.o): New targets.
9646 * testsuite/Makefile.in: Rebuild.
9647
9648 2008-07-22 Ian Lance Taylor <iant@google.com>
9649
9650 * options.h (class General_options): Define --check-sections.
9651 * layout.cc (Layout::set_segment_offsets): Handle
9652 --check-sections.
9653
9654 * options.h (class General_options): Define -n/--nmagic and
9655 -N/--omagic.
9656 * options.cc (General_options::finalize): For -n/--nmagic or
9657 -N/--omagic, set -static.
9658 * layout.cc (Layout::attach_allocated_section_to_segment): If
9659 -N/--omagic, don't put read-only and read-write sections in
9660 different segments.
9661 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
9662 finding a read-only segment.
9663 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
9664 don't set the minimum segment alignment to the common page size,
9665 and don't set the file offset to the address modulo the page size.
9666 * script-sections.cc (Script_sections::create_segments): If
9667 -n/--omagic, don't put read-only and read-write sections in
9668 different segments.
9669
9670 * cref.cc: New file.
9671 * cref.h: New file.
9672 * options.h (class General_options): Add --print-symbol-counts.
9673 * main.cc (main): Issue defined symbol report if requested.
9674 * archive.cc (Archive::interpret_header): Make into a const member
9675 function.
9676 (Archive::add_symbols): Call Input_objects::archive_start and
9677 archive_stop.
9678 (Archive::const_iterator): Define new class.
9679 (Archive::begin, Archive::end): New functions.
9680 (Archive::include_all_members): Rewrite to use iterator.
9681 (Archive::count_members): New function.
9682 * archive.h (class Archive): Update declarations.
9683 (Archive::filename): New function.
9684 * object.cc: Include "cref.h".
9685 (Sized_relobj::Sized_relobj): Initialize defined_count_.
9686 (Sized_relobj::do_get_global_symbol_counts): New function.
9687 (Input_objects::add_object): Add object to cross-referencer.
9688 (Input_objects::archive_start): New function.
9689 (Input_objects::archive_stop): New function.
9690 (Input_objects::print_symbol_counts): New function.
9691 * object.h: Declare Cref and Archive.
9692 (Object::get_global_symbol_counts): New function.
9693 (Object::do_get_global_symbol_counts): New pure virtual function.
9694 (class Sized_relobj): Add defined_count_ field. Update
9695 declarations.
9696 (class Input_objects): Add cref_ field. Update constructor.
9697 Update declarations.
9698 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
9699 defined_count_.
9700 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
9701 symbol counts.
9702 (Sized_dynobj::do_get_global_symbol_counts): New function.
9703 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
9704 defined_count_. Update declarations. Define Symbols typedef.
9705 * symtab.cc (Symbol_table::add_from_relobj): Add defined
9706 parameter. Change all callers.
9707 (Symbol_table::add_from_dynobj): Add sympointers and defined
9708 parameters. Change all callers.
9709 * symtab.h (class Symbol_table): Update declarations.
9710 * Makefile.am (CCFILES): Add cref.cc.
9711 (HFILES): Add cref.h.
9712 * Makefile.in: Rebuild.
9713
9714 2008-07-22 Simon Baldwin <simonb@google.com>
9715
9716 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
9717 to zero when writing undefined symbols.
9718
9719 2008-07-22 Ian Lance Taylor <iant@google.com>
9720
9721 * output.cc (Output_section::add_input_section): Don't try to
9722 merge empty merge sections.
9723
9724 2008-07-21 Craig Silverstein <csilvers@google.com>
9725
9726 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
9727 Include symbol version in error message.
9728
9729 2008-07-20 Chris Demetriou <cgd@google.com>
9730
9731 * configure.ac (gold_cv_c_random_seed): New configured variable.
9732 (RANDOM_SEED_CFLAGS): New substituted variable.
9733 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
9734 * configure: Rebuild.
9735 * Makefile.in: Likewise.
9736 * testsuite/Makefile.in: Likewise.
9737
9738 2008-07-18 Ian Lance Taylor <iant@google.com>
9739
9740 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
9741 where we see NAME/NULL and NAME/VERSION as separate symbols.
9742 * testsuite/ver_test_main.cc (main): Call t4.
9743 (t4, t4_2a): Define.
9744 * testsuite/ver_test_2.cc (t4_2): Define.
9745 * testsuite/ver_test_2.script: Put t4_2a in VER2.
9746 * testsuite/ver_test_4.cc (t4_2a): Define.
9747 * testsuite/ver_test_4.script: Put t4_2a in VER2.
9748 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
9749
9750 2008-07-17 Ian Lance Taylor <iant@google.com>
9751
9752 * dynobj.cc (Versions::add_def): If we give an error about a
9753 missing version, go ahead and create the version anyhow.
9754
9755 2008-07-10 Ian Lance Taylor <iant@google.com>
9756
9757 Handle output sections with more than 0x7fffffff bytes.
9758 * object.h (class Relobj): Change map_to_output_ to
9759 output_sections_, and just keep a section pointer. Change all
9760 uses. Move comdat group support to Sized_relobj.
9761 (Relobj::is_section_specially_mapped): Remove.
9762 (Relobj::output_section): Remove poff parameter. Change all
9763 callers.
9764 (Relobj::output_section_offset): New function.
9765 (Relobj::set_section_offset): Rewrite.
9766 (Relobj::map_to_output): Remove.
9767 (Relobj::output_sections): New function.
9768 (Relobj::do_output_section_offset): New pure virtual function.
9769 (Relobj::do_set_section_offset): Likewise.
9770 (class Sized_relobj): Add section_offsets_ field. Add comdat
9771 group support from Relobj. Update declarations.
9772 (Sized_relobj::get_output_section_offset): New function.
9773 (Sized_relobj::do_output_section_offset): New function.
9774 (Sized_relobj::do_set_section_offset): New function.
9775 * object.cc (Relobj::output_section_address): Remove.
9776 (Sized_relobj::Sized_relobj): Initialize new fields.
9777 (Sized_relobj::include_section_group): Cast find_kept_object to
9778 Sized_relobj.
9779 (Sized_relobj::include_linkonce_section): Likewise.
9780 (Sized_relobj::do_layout): Use separate arrays for output section
9781 and output offset.
9782 (Sized_relobj::do_count_local_symbols): Change map_to_output to
9783 output_sections.
9784 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
9785 output_sections and section_offsets.
9786 (Sized_relobj::write_local_symbols): Likewise.
9787 (map_to_kept_section): Compute output address directly.
9788 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
9789 output_sections and section_offsets.
9790 (Sized_relobj::write_sections): Likewise.
9791 (Sized_relobj::relocate_sections): Likewise.
9792 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
9793 * output.h (class Output_reloc): Update declarations. Change
9794 u2_.relobj to Sized_relobj*.
9795 (class Output_data_reloc): Change add functions to use
9796 Sized_relobj*.
9797 * output.cc (Output_reloc::Output_reloc): Change relobj to
9798 Sized_relobj*.
9799 (Output_reloc::local_section_offset): Change return type to
9800 Elf_Addr. Use get_output_section_offset.
9801 (Output_reloc::get_address): Likewise.
9802 (Output_section::is_input_address_mapped): Don't call
9803 is_section_specially_mapped.
9804 (Output_section::output_offset): Likewise.
9805 (Output_section::output_address): Likewise.
9806 (Output_section::starting_output_address): Likewise.
9807 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
9808 parameter to Sized_relobj*.
9809 (Copy_relocs::need_copy_reloc): Likewise.
9810 (Copy_relocs::save): Likewise.
9811 * copy-relocs.h (class Copy_relocs): Update declarations.
9812 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
9813 Sized_relobj*. Change relobj_ field to Sized_relobj*.
9814 * target-reloc.h (relocate_for_relocatable): Change
9815 offset_in_output_section type to Elf_Addr. Change code that uses
9816 it as well.
9817 * layout.cc (Layout::layout): Always set *off.
9818 * mapfile.cc (Mapfile::print_input_section): Use
9819 output_section_offset.
9820 * i386.cc (Target_i386::copy_reloc): Change object parameter to
9821 Sized_relobj*.
9822 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
9823 * sparc.cc (Target_sparc::copy_reloc): Likewise.
9824 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
9825
9826 2008-07-03 Ian Lance Taylor <iant@google.com>
9827
9828 * layout.cc (Layout::include_section): Do not discard unrecognized
9829 SHT_STRTAB sections.
9830
9831 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
9832
9833 * script.cc (Lex::can_continue_name): Make '?' allowable in
9834 version-script names.
9835 * testsuite/version_script.map: Change glob pattern to use '?'
9836
9837 2008-06-30 Manish Singh <yosh@gimp.org>
9838
9839 PR 6585
9840 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
9841 Correct typo.
9842
9843 2008-06-30 Ian Lance Taylor <iant@google.com>
9844
9845 PR 6660
9846 PR 6682
9847 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
9848 versions]: Don't try to read the value in the contents, since we
9849 don't use it. Use the template endianness when writing.
9850
9851 2008-06-25 Cary Coutant <ccoutant@google.com>
9852
9853 * fileread.cc (File_read::make_view): Assert on zero-length view.
9854 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
9855 symbol table when there are no symbols to read.
9856
9857 2008-06-23 Craig Silverstein <csilvers@google.com>
9858
9859 * version.cc (version_string): Bump to 1.7
9860
9861 2008-06-18 Craig Silverstein <csilvers@google.com>
9862
9863 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
9864 constant 0xFFFF to type Valtype.
9865 (Powerpc_relocate_functions::rel16_ha): Likewise.
9866
9867 2008-06-17 Ian Lance Taylor <iant@google.com>
9868
9869 * output.h (Output_section::Input_section): Initialize p2align_ to
9870 zero for Output_section_data constructors.
9871 (Output_section::Input_section::addralign): If not an input
9872 section, return the alignment of the Output_section_data.
9873 * testsuite/copy_test.cc: New file.
9874 * testsuite/copy_test_1.cc: New file.
9875 * testsuite/copy_test_2.cc: New file.
9876 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
9877 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
9878 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
9879 (copy_test_1_pic.o, copy_test_1.so): New targets.
9880 (copy_test_2_pic.o, copy_test_2.so): New targets.
9881 * testsuite/Makefile.in: Rebuild.
9882
9883 * script-sections.cc (Script_sections::place_orphan): Initialize
9884 local variable exact.
9885
9886 2008-06-13 David Edelsohn <edelsohn@gnu.org>
9887
9888 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
9889
9890 2008-06-12 David Edelsohn <edelsohn@gnu.org>
9891 David S. Miller <davem@davemloft.net>
9892
9893 * powerpc.cc: New file.
9894 * Makefile.am (TARGETSOURCES): Add powerpc.cc
9895 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
9896 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
9897 * Makefile.in: Rebuild.
9898
9899 2008-06-09 Ian Lance Taylor <iant@google.com>
9900
9901 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
9902 <exception>.
9903 (throwing, orig_terminate): New static variables.
9904 (terminate_handler): New static function.
9905 (t2): Set terminate handler.
9906
9907 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
9908
9909 PR 6584
9910 * binary.cc (Binary_to_elf::sized_convert): Fix .data
9911 alignment.
9912
9913 2008-05-30 Cary Coutant <ccoutant@google.com>
9914
9915 * archive.cc (Archive::include_all_members) Correct to step
9916 over symbol table and extended name table in thin archives.
9917
9918 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
9919
9920 PR 6407
9921 * target-reloc.h (relocate_for_relocatable): Fix new_offset
9922 calculation.
9923
9924 2008-05-28 Caleb Howe <cshowe@google.com>
9925
9926 * reduced_debug_output.cc: New file.
9927 * reduced_debug_output.h: New file.
9928 * options.h (class General_options): Add --strip-debug-non-line.
9929 * options.cc (General_options::finalize): Add strip_debug_non_line
9930 to the strip heirarchy.
9931 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
9932 fields.
9933 * layout.cc: Include "reduced_debug_output.h".
9934 (Layout::Layout): Initialize new fields.
9935 (line_only_debug_sections): New static array.
9936 (is_lines_only_debug_sections): New static inline function.
9937 (Layout::include_section): Handle --strip-debug-non-line.
9938 (Layout::make_output_section): If --strip-debug-non-line, build
9939 new output sections for .debug_abbrev and .debug_info.
9940 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
9941 gold. Warn about possible overflow.
9942 (read_signed_LEB_128): Likewise.
9943 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
9944 (read_signed_LEB_128): Declare.
9945 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
9946 (HFILES): Add reduced_debug_output.h.
9947 * Makefile.in: Rebuild.
9948
9949 2008-05-21 Ian Lance Taylor <iant@google.com>
9950
9951 * mapfile.cc: New file.
9952 * mapfile.h: New file.
9953 * options.h (class General_options): Add -M/--print-map and -Map.
9954 * options.cc (General_options::finalize): Make -M equivalent to
9955 -Map -.
9956 * main.cc: Include <cstdio> and "mapfile.h".
9957 (main): Open mapfile if requested.
9958 * gold.cc (class Middle_runner): Add mapfile_ field. Update
9959 constructor. Change caller.
9960 (queue_initial_tasks): Add mapfile parameter. Change caller.
9961 (queue_middle_tasks): Likewise.
9962 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
9963 declarations.
9964 * archive.cc: Include "mapfile.h".
9965 (Archive::add_symbols): Add mapfile parameter. Change all
9966 callers. Pass mapfile, symbol, and reason to include_member.
9967 (Archive::include_all_members): Add mapfile parameter. Change all
9968 callers.
9969 (Archive::include_member): Add mapfile, sym, and why parameters.
9970 Change all callers. Report inclusion to map file.
9971 * archive.h: Include "fileread.h".
9972 (class Archive): Update declarations.
9973 (Archive::file): New const method.
9974 (class Add_archive_symbols): Add mapfile_ field. Update
9975 constructor. Change all callers.
9976 * readsyms.h (class Read_symbols): Likewise.
9977 (class Finish_group): Likewise.
9978 (class Read_script): Likewise.
9979 * common.cc: Include "mapfile.h".
9980 (Symbol_table::allocate_commons): Add mapfile parameter. Change
9981 all callers.
9982 (Symbol_table::do_allocate_commons): Likewise.
9983 (Symbol_table::do_allocate_commons_list): Likewise. Report common
9984 symbol allocation to mapfile.
9985 * common.h (class Allocate_commons_task): Add mapfile_ field.
9986 Update constructor. Change all callers.
9987 * symtab.h (class Symbol_table): Update declarations.
9988 * layout.cc: Include "mapfile.h".
9989 (Layout_task_runner::run): Print information to mapfile.
9990 (Layout::create_gold_note): Change Output_data_fixed_space to
9991 Output_data_zero_fill.
9992 (Layout::create_build_id): Likewise.
9993 (Layout::print_to_mapfile): New function.
9994 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
9995 constructor. Change caller.
9996 (class Layout): Declare print_to_mapfile.
9997 * output.cc (Output_section::Input_section::print_to_mapfile): New
9998 function.
9999 (Output_section::add_input_section): If producing a map, always
10000 add to input_sections_ list.
10001 (Output_section::do_print_to_mapfile): New function.
10002 (Output_segment::print_sections_to_mapfile): New function.
10003 (Output_segment::print_section_list_to_mapfile): New function.
10004 * output.h: Include "mapfile.h".
10005 (Output_data::print_to_mapfile): New function.
10006 (Output_data::do_print_to_mapfile): New virtual function.
10007 (Output_segment_headers::do_print_to_mapfile): New function.
10008 (Output_file_header::do_print_to_mapfile): New function.
10009 (Output_data_const::do_print_to_mapfile): New function.
10010 (class Output_data_const_buffer): Add map_name_ field. Update
10011 constructor. Change all callers. Add do_print_to_mapfile
10012 function.
10013 (class Output_data_fixed_space): Likewise.
10014 (class Output_data_space): Likewise.
10015 (class Output_data_zero_fill): New class.
10016 (Output_data_strtab::do_print_to_mapfile): New function.
10017 (Output_data_reloc_base::do_print_to_mapfile): New function.
10018 (Output_relocatable_relocs::do_print_to_mapfile): New function.
10019 (Output_data_group::do_print_to_mapfile): New function.
10020 (Output_data_got::do_print_to_mapfile): New function.
10021 (Output_data_dynamic::do_print_to_mapfile): New function.
10022 (Output_symtab_xindex::do_print_to_mapfile): New function.
10023 (class Output_section): Declare do_print_to_mapflie. Declare
10024 print_to_mapfile in Input_section.
10025 (class Output_segment): Declare new functions.
10026 * object.h (Sized_relobj::symbol_count): New function.
10027 * script-sections.cc
10028 (Output_section_element_dot_assignment::set_section_addresses):
10029 Change Output_data_fixed_space to Output_data_zero_fill.
10030 (Output_data_expression::do_print_to_mapfile): New function.
10031 * script.cc (read_input_script): Add mapfile parameter. Change
10032 all callers.
10033 * script.h (read_input_script): Update declaration.
10034 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
10035 (Eh_frame::do_print_to_mapfile): New function.
10036 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
10037 (Output_merge_string::do_print_to_mapfile): New function.
10038 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
10039 function.
10040 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
10041 function.
10042 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
10043 function.
10044 * Makefile.am (CCFILES): Add mapfile.cc.
10045 (HFILES): Add mapfile.h.
10046 * Makefile.in: Rebuild.
10047
10048 2008-05-19 Ian Lance Taylor <iant@google.com>
10049
10050 * options.h (class General_options): Add -z relro.
10051 * layout.cc (Layout::Layout): Initialize relro_segment_.
10052 (Layout::add_output_section_data): Return the output section.
10053 (Layout::make_output_section): Rcognize relro sections and mark
10054 them appropriately.
10055 (Layout::attach_allocated_section_to_segment): Put relro sections
10056 in a PT_GNU_RELRO segment.
10057 (Layout::create_initial_dynamic_sections): Mark the .dynamic
10058 section as relro.
10059 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
10060 PT_TLS segments.
10061 (Layout::linkonce_mapping): Map d.rel.ro.local to
10062 .data.rel.ro.local.
10063 (Layout::output_section_name): Us .data.rel.ro.local for any
10064 section which begins with that.
10065 * layout.h (class Layout): Update add_output_section_data
10066 declaration. Add relro_segment_ field.
10067 * output.cc (Output_section::Output_section): Initialize is_relro_
10068 and is_relro_local_ fields.
10069 (Output_segment::add_output_section): Group relro sections.
10070 (Output_segment::is_first_section_relro): New function.
10071 (Output_segment::maximum_alignment): If there is a relro section,
10072 align the segment to the common page size.
10073 (Output_segment::set_section_addresses): Track whether we are
10074 looking at relro sections. If the last section is a relro
10075 section, align to the common page size.
10076 (Output_segment::set_section_list_addresses): Add in_relro
10077 parameter. Change all callers. Align to the page size when
10078 moving from relro to non-relro section.
10079 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
10080 segment.
10081 * output.h (class Output_section): Add is_relro_ and
10082 is_relro_local_ fields.
10083 (Output_section::is_relro): New function.
10084 (Output_section::set_is_relro): New function.
10085 (Output_section::is_relro_local): New function.
10086 (Output_section::set_is_relro_local): New function.
10087 (class Output_segment): Update declarations.
10088 * i386.cc (Target_i386::got_section): Mark .got section as relro.
10089 * sparc.cc (Target_sparc::got_section): Likewise.
10090 * x86_64.cc (Target_x86_64::got_section): Likewise.
10091 * testsuite/relro_test_main.cc: New file.
10092 * testsuite/relro_test.cc: New file.
10093 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
10094 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
10095 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
10096 (relro_test.so, relro_test_pic.o): New targets.
10097 * testsuite/Makefile.in: Rebuild.
10098
10099 2008-05-16 Ian Lance Taylor <iant@google.com>
10100
10101 * output.cc (Output_segment::add_output_section): Remove front
10102 parameter.
10103 * output.h (class Output_segment): Remove
10104 add_initial_output_section and overloaded add_output_section.
10105 Update declaration of remaining add_output_section.
10106 * layout.cc (Layout::create_interp): Call add_output_section
10107 rather than add_initial_output_section.
10108 (Layout::finish_dynamic_section): Likewise.
10109
10110 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
10111 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
10112 know the dynamic type.
10113 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
10114 field. Initialize it in constructor.
10115 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
10116 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
10117 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
10118 reloc.
10119
10120 * output.cc (Output_reloc::get_address): Change return type to
10121 Elf_Addr.
10122 * output.h (class Output_reloc): Update get_address declaration.
10123 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
10124 for section addresses.
10125
10126 2008-05-09 Ian Lance Taylor <iant@google.com>
10127
10128 PR 6493
10129 * gold.cc (gold_nomem): Use return value of write.
10130
10131 2008-05-08 Ian Lance Taylor <iant@google.com>
10132
10133 * symtab.c (Symbol::init_base_output_data): Add version
10134 parameter. Change all callers.
10135 (Symbol::init_base_output_segment): Likewise.
10136 (Symbol::init_base_constant): Likewise.
10137 (Symbol::init_base_undefined): Likewise.
10138 (Sized_symbol::init_output_data): Likewise.
10139 (Sized_symbol::init_output_segment): Likewise.
10140 (Sized_symbol::init_constant): Likewise.
10141 (Sized_symbol::init_undefined): Likewise.
10142 (Symbol_table::do_define_in_output_data): If the new symbol has a
10143 version, mark it as the default.
10144 (Symbol_table::do_define_in_output_segment): Likewise.
10145 (Symbol_table::do_define_as_constant): Likewise.
10146 * symtab.h (class Symbol): Update declarations.
10147 (class Sized_symbol): Likewise.
10148 * resolve.cc (Symbol::override_version): New function.
10149 (Symbol::override_base): Call override_version.
10150 (Symbol::override_base_with_special): Likewise.
10151 * testsuite/ver_script_8.script: New file.
10152 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
10153 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
10154 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
10155 (ver_test_8_1.so, ver_test_8_2.so): New targets.
10156
10157 2008-05-06 Ian Lance Taylor <iant@google.com>
10158
10159 PR 6049
10160 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
10161 functions.
10162 (class General_options): Remove existing --undefined, and add
10163 --no-undefined instead. Add new --undefined as synonym for -u.
10164 * archive.cc (Archive::add_symbols): Check whether symbol was
10165 named with -u.
10166 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
10167 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
10168 all uses. Add IS_UNDEFINED. Update declarations to split
10169 different versions of init_base. Declare init_base_undefined.
10170 (Symbol::is_defined): Handle IS_UNDEFINED.
10171 (Symbol::is_undefined): Likewise.
10172 (Symbol::is_weak_undefined): Call is_undefined.
10173 (Symbol::is_absolute): Handle IS_CONSTANT.
10174 (class Sized_symbol): Update declarations to split different
10175 versions of init. Declare init_undefined.
10176 (class Symbol_table): Declare new functions.
10177 * symtab.cc (Symbol::init_base_object): Rename from init_base.
10178 Change all callers.
10179 (Symbol::init_base_output_data): Likewise.
10180 (Symbol::init_base_output_segment): Likewise.
10181 (Symbol::init_base_constant): Likewise.
10182 (Symbol::init_base_undefined): New function.
10183 (Sized_symbol::init_object): Rename from init. Change all
10184 callers.
10185 (Sized_symbol::init_output_data): Likewise.
10186 (Sized_symbol::init_output_segment): Likewise.
10187 (Sized_symbol::init_constant): Likewise.
10188 (Sized_symbol::init_undefined): New function.
10189 (Symbol_table::add_undefined_symbols_from_command_line): New
10190 function.
10191 (Symbol_table::do_add_undefined_symbols_from_command_line): New
10192 function.
10193 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
10194 (Symbol::output_section): Likewise.
10195 (Symbol::set_output_section): Likewise.
10196 (Symbol_table::sized_finalize_symbol): Likewise.
10197 (Symbol_table::sized_write_globals): Likewise.
10198 * resolve.cc (Symbol_table::should_override): Likewise.
10199 (Symbol::override_base_with_special): Likewise.
10200
10201 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
10202 symbol, change it to have default visibility.
10203 * testsuite/protected_1.cc: New file.
10204 * testsuite/protected_2.cc: New file.
10205 * testsuite/protected_3.cc: New file.
10206 * testsuite/protected_main_1.cc: New file.
10207 * testsuite/protected_main_2.cc: New file.
10208 * testsuite/protected_main_3.cc: New file.
10209 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
10210 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
10211 (protected_1_LDFLAGS, protected_1_LDADD): Define.
10212 (protected_1.so): New target.
10213 (protected_1_pic.o, protected_2_pic.o): New targets.
10214 (protected_3_pic.o): New target.
10215 (check_PROGRAMS): Add protected_2.
10216 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
10217 (protected_2_LDFLAGS, protected_2_LDADD): Define.
10218 * testsuite/Makefile.in: Rebuild.
10219
10220 * options.h (DEFINE_var): Add set_user_set_##varname__.
10221 (DEFINE_bool_alias): New macro.
10222 (class General_options): Define -Bstatic using DEFINE_bool_alias
10223 rather than DEFINE_special. Add --undefined as an alias for -z
10224 defs.
10225 * options.cc (General_options::parse_Bstatic): Remove.
10226
10227 * options.h (class General_options): Add --fatal-warnings.
10228 * main.cc (main): Implement --fatal-warnings.
10229 * errors.h (Errors::warning_count): New function.
10230
10231 * options.h (class General_options): Add -Bsymbolic-functions.
10232 * symtab.h (Symbol::is_preemptible): Check for
10233 -Bsymbolic-functions.
10234
10235 2008-05-05 Ian Lance Taylor <iant@google.com>
10236
10237 * options.h (DEFINE_bool): For DASH_Z, create the negative option
10238 as noVARNAME rather than no-VARNAME.
10239 (class General_options): Add option -z combreloc.
10240 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
10241 get_address.
10242 (Output_reloc::sort_before) [SHT_REL]: New function.
10243 (Output_reloc::sort_before) [SHT_RELA]: New function.
10244 (class Output_data_reloc_base): Add sort_relocs_ field. Define
10245 Sort_relocs_comparison.
10246 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
10247 parameter. Change all callers.
10248 (Output_data_reloc::Output_data_reloc) [both versions]: Add
10249 sort_relocs parameter. Change all callers.
10250 * output.cc (Output_reloc::get_address): New function, broken out
10251 of write_rel.
10252 (Output_reloc::write_rel): Call it.
10253 (Output_reloc::compare): New function.
10254 (Output_data_reloc_base::do_write): Optionally sort relocs.
10255
10256 * configure.ac: If targ_extra_obj is set, link it in.
10257 * configure.tgt: Initialize all variables.
10258 (x86_64*): Set targ_extra_obj and targ_extra_size.
10259 * configure: Rebuild.
10260
10261 * object.cc (Sized_relobj::include_section_group): Adjust section
10262 indexes read from group data. Build vector to pass to
10263 layout_group.
10264 * layout.cc (Layout::layout_group): Add flags and shndxes
10265 parameters. Remove contents parameter. Change caller. Update
10266 explicit instantiations.
10267 * layout.h (class Layout): Update layout_group declaration.
10268 * output.cc (Output_data_group::Output_data_group): Add flags and
10269 input_shndxes parameters. Remove contents parameter. Change
10270 caller.
10271 (Output_data_group::do_write): Change input_sections_ to
10272 input_shndxes_.
10273 * output.h (class Output_data_group): Update constructor
10274 declaration. Rename input_sections_ to input_shndxes_.
10275 * testsuite/many_sections_test.cc: Add template.
10276
10277 2008-04-30 Cary Coutant <ccoutant@google.com>
10278
10279 * target-reloc.h (relocate_section): Fix dead-pointer bug.
10280
10281 * layout.cc (Layout::include_section): Refactored check for debug
10282 info section.
10283 (Layout::add_comdat): Add new parameters. Change type
10284 of signature parameter. Add object and shndx to signatures table.
10285 (Layout::find_kept_object): New function.
10286 * layout.h: Include <cstring>.
10287 (Layout::is_debug_info_section): New function.
10288 (Layout::add_comdat): Add new parameters.
10289 (Layout::find_kept_object): New function.
10290 (Layout::Kept_section): New struct.
10291 (Layout::Signatures): Change type of map range.
10292 * object.cc (Relobj::output_section_address): New function.
10293 (Sized_relobj::include_section_group): Add new parameters. Change
10294 calls to Layout::add_comdat. Change to build table of kept comdat
10295 groups and table mapping discarded sections to kept sections.
10296 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
10297 (Sized_relobj::do_layout): Change calls to include_section_group and
10298 include_linkonce_section.
10299 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
10300 value to zero when section is discarded.
10301 (Sized_relobj::map_to_kept_section): New function.
10302 * object.h (Relobj::output_section_address): New function.
10303 (Relobj::Comdat_group): New type.
10304 (Relobj::find_comdat_group): New function.
10305 (Relobj::Comdat_group_table): New type.
10306 (Relobj::Kept_comdat_section): New type.
10307 (Relobj::Kept_comdat_section_table): New type.
10308 (Relobj::add_comdat_group): New function.
10309 (Relobj::set_kept_comdat_section): New function.
10310 (Relobj::get_kept_comdat_section): New function.
10311 (Relobj::comdat_groups_): New field.
10312 (Relobj::kept_comdat_sections_): New field.
10313 (Symbol_value::input_value): Update comment.
10314 (Sized_relobj::map_to_kept_section) New function.
10315 (Sized_relobj::include_linkonce_section): Add new parameter.
10316 * target-reloc.h (Comdat_behavior): New type.
10317 (get_comdat_behavior): New function.
10318 (relocate_section): Add code to map a discarded section to the
10319 corresponding kept section when applying a relocation.
10320
10321 2008-04-30 Craig Silverstein <csilvers@google.com>
10322
10323 * dwarf_reader.cc (next_generation_count): New static var.
10324 (Addr2line_cache_entry): New struct.
10325 (addr2line_cache): New static var.
10326 (Dwarf_line_info::one_addr2line): Added caching.
10327 (Dwarf_line_info::clear_addr2line_cache): New function.
10328 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
10329 cache-size parameter.
10330 (Dwarf_line_info::one_addr2line_cache): New function.
10331 * symtab.cc (Symbol_table::detect_odr_violations): Pass
10332 new cache-size argument to one_addr2line(), and clear cache.
10333
10334 2008-04-28 Cary Coutant <ccoutant@google.com>
10335
10336 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
10337 R_386_PC8 relocations.
10338
10339 2008-04-23 Ian Lance Taylor <iant@google.com>
10340
10341 * object.cc (Sized_relobj::include_section_group): Check for
10342 invalid section group.
10343
10344 * object.cc (make_elf_object): Correct test for 64-bit ELF file
10345 header size.
10346
10347 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
10348 than read for file header.
10349 * archive.cc (Archive::include_member): Likewise.
10350
10351 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
10352
10353 * aclocal.m4: Regenerate.
10354 * configure: Regenerate.
10355
10356 2008-04-19 Ian Lance Taylor <iant@google.com>
10357
10358 * version.cc (version_string): Bump to 1.6.
10359
10360 * testsuite/Makefile.am (many_sections_r_test): New target.
10361 (many_sections_r_test_SOURCES): Remove.
10362 (many_sections_r_test_DEPENDENCIES): Remove.
10363 (many_sections_r_test_LDFLAGS): Remove.
10364 (many_sections_r_test_LDADD): Remove.
10365
10366 * object.cc (Sized_relobj::do_add_symbols): Always pass
10367 local_symbol_count_ to add_from_relobj.
10368
10369 * testsuite/Makefile.am (many_sections_check.h): Only check one in
10370 every thousand variables.
10371 * testsuite/Makefile.in: Rebuild.
10372
10373 * object.cc (Xindex::initialize_symtab_xindex): New function.
10374 (Xindex::read_symtab_xindex): New function.
10375 (Xindex::sym_xindex_to_shndx): New function.
10376 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
10377 available.
10378 (Sized_relobj::do_initialize_xindex): New function.
10379 (Sized_relobj::do_read_symbols): Adjust section links.
10380 (Sized_relobj::symbol_section_and_value): Add is_ordinary
10381 parameter. Change all callers.
10382 (Sized_relobj::include_section_group): Adjust section links and
10383 symbol section indexes.
10384 (Sized_relobj::do_layout): Adjust section links.
10385 (Sized_relobj::do_count_local_symbols): Adjust section links and
10386 symbol section indexes.
10387 (Sized_relobj::do_finalize_local_symbols): Distinguish between
10388 ordinary and special symbols.
10389 (Sized_relobj::write_local_symbols): Add symtab_xindex and
10390 dynsym_xindex parameters. Change all callers. Adjust section
10391 links. Use SHN_XINDEX when needed.
10392 (Sized_relobj::get_symbol_location_info): Adjust section links.
10393 Don't get fooled by special symbols.
10394 * object.h (class Xindex): Define.
10395 (class Object): Add xindex_ parameter. Declare virtual functoin
10396 do_initialize_xindex.
10397 (Object::adjust_sym_shndx): New function.
10398 (Object::set_xindex): New protected function.
10399 (class Symbol_value): Add is_ordinary_shndx_ field.
10400 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
10401 (Symbol_value::value): Assert ordinary section.
10402 (Symbol_value::initialize_input_to_output_map): Likewise.
10403 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
10404 Change all callers.
10405 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
10406 all callers.
10407 (class Sized_relobj): Update declarations.
10408 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
10409 parameter. Change all callers.
10410 (Sized_relobj::adjust_shndx): New function.
10411 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
10412 field.
10413 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
10414 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
10415 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
10416 (Sized_dynobj::read_dynsym_section): Adjust section links.
10417 (Sized_dynobj::read_dynamic): Likewise.
10418 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
10419 section links.
10420 (Sized_dynobj::do_initialize_xindex): New function.
10421 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
10422 do_initialize_xindex.
10423 (Sized_dynobj::adjust_shndx): New function.
10424 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
10425 dynsym_xindex_ fields.
10426 (Layout::finalize): Add a call to set_section_indexes before
10427 creating the symtab sections.
10428 (Layout::set_section_indexes): Don't do anything if the section
10429 already has a section index.
10430 (Layout::create_symtab_sections): Add shnum parameter. Change
10431 caller. Create .symtab_shndx section if needed.
10432 (Layout::create_shdrs): Add shstrtab_section parameter. Change
10433 caller.
10434 (Layout::allocated_output_section_count): New function.
10435 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
10436 needed.
10437 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
10438 fields. Update declarations.
10439 (Layout::symtab_xindex): New function.
10440 (Layout::dynsym_xindex): New function.
10441 (class Write_symbols_task): Add layout_ field.
10442 (Write_symbols_task::Write_symbols_task): Add layout parameter.
10443 Change caller.
10444 * output.cc (Output_section_headers::Output_section_headers): Add
10445 shstrtab_section parameter. Change all callers.
10446 (Output_section_headers::do_sized_write): Store overflow values
10447 for section count and section string table section index in
10448 section header zero.
10449 (Output_file_header::do_sized_write): Check for overflow of
10450 section count and section string table section index.
10451 (Output_symtab_xindex::do_write): New function.
10452 (Output_symtab_xindex::endian_do_write): New function.
10453 * output.h (class Output_section_headers): Add shstrtab_section_.
10454 Update declarations.
10455 (class Output_symtab_xindex): Define.
10456 (Output_section::has_out_shndx): New function.
10457 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
10458 field.
10459 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
10460 Change all callers.
10461 (Sized_symbol::init): Likewise.
10462 (Symbol::output_section): Check for ordinary symbol.
10463 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
10464 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
10465 callers.
10466 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
10467 Change all callers. Simplify handling of symbols from sections
10468 not included in the link.
10469 (Symbol_table::add_from_dynobj): Handle ordinary symbol
10470 distinction.
10471 (Weak_alias_sorter::operator()): Assert that symbols are
10472 ordinary.
10473 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
10474 distinction.
10475 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
10476 parameters. Change all callers.
10477 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
10478 symbol distinction. Use SHN_XINDEX when needed.
10479 (Symbol_table::write_section_symbol): Add symtab_xindex
10480 parameter. Change all callers.
10481 (Symbol_table::sized_write_section_symbol): Likewise. Use
10482 SHN_XINDEX when needed.
10483 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
10484 declarations.
10485 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
10486 (Symbol::is_defined): Check is_ordinary.
10487 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
10488 (Symbol::is_absolute, Symbol::is_common): Likewise.
10489 (class Sized_symbol): Update declarations.
10490 (class Symbol_table): Update declarations.
10491 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
10492 parameters. Change all callers.
10493 (Sized_symbol::override): Likewise.
10494 (Symbol_table::override): Likewise.
10495 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
10496 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
10497 is_ordinary, and orig_st_shndx parameters. Change all callers.
10498 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
10499 to be in an ordinary section.
10500 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
10501 object and is_ordinary parameters. Change all callers.
10502 (Sized_dwarf_line_info::read_relocs): Add object parameter.
10503 Change all callers. Don't add undefined or non-ordinary symbols
10504 to reloc_map_.
10505 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
10506 Change all callers.
10507 * dwarf_reader.h (class Sized_dwarf_line_info): Update
10508 declarations.
10509 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
10510 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
10511 (Sized_relobj::relocate_sections): Likewise.
10512 * target-reloc.h (scan_relocs): Adjust section symbol index.
10513 (scan_relocatable_relocs): Likewise.
10514 * i386.cc (Scan::local): Check for ordinary symbols.
10515 * sparc.cc (Scan::local): Likewise.
10516 * x86_64.cc (Scan::local): Likewise.
10517 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
10518 to symbol_section_and_value.
10519 * testsuite/many_sections_test.cc: New file.
10520 * testsuite/Makefile.am (BUILT_SOURCES): Define.
10521 (check_PROGRAMS): Add many_sections_test.
10522 (many_sections_test_SOURCES): Define.
10523 (many_sections_test_DEPENDENCIES): Define.
10524 (many_sections_test_LDFLAGS): Define.
10525 (BUILT_SOURCES): Add many_sections_define.h.
10526 (many_sections_define.h): New target.
10527 (BUILT_SOURCES): Add many_sections_check.h.
10528 (many_sections_check.h): New target.
10529 (check_PROGRAMS): Add many_sections_r_test.
10530 (many_sections_r_test_SOURCES): Define.
10531 (many_sections_r_test_DEPENDENCIES): Define.
10532 (many_sections_r_test_LDFLAGS): Define.
10533 (many_sections_r_test_LDADD): Define.
10534 (many_sections_r_test.o): New target.
10535 * testsuite/Makefile.in: Rebuild.
10536
10537 2008-04-17 Cary Coutant <ccoutant@google.com>
10538
10539 * errors.cc (Errors::info): New function.
10540 (gold_info): New function.
10541 * errors.h (Errors::info): New function.
10542 * gold.h (gold_info): New function.
10543 * object.cc (Input_objects::add_object): Print trace output.
10544 * options.cc (options::parse_set): New function.
10545 (General_options::parse_wrap): Deleted.
10546 (General_options::General_options): Deleted initializer.
10547 * options.h (options::String_set): New typedef.
10548 (options::parse_set): New function.
10549 (DEFINE_set): New macro.
10550 (General_options::wrap): Changed to use DEFINE_set. Changed
10551 callers of any_wrap_symbols and is_wrap_symbol.
10552 (General_options::trace, General_options::trace_symbol):
10553 New options.
10554 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
10555 (General_options::wrap_symbols_): Deleted.
10556 * symtab.cc (Symbol_table::add_from_object): Print trace output.
10557
10558 2008-04-17 David S. Miller <davem@davemloft.net>
10559
10560 * options.cc (General_options::parse_V): New function.
10561 * options.h: Add entries for -V and -Qy.
10562
10563 2008-04-17 Ian Lance Taylor <iant@google.com>
10564
10565 * common.cc (Symbol_table::allocate_commons): Remove options
10566 parameter. Change caller.
10567 (Symbol_table::do_allocate_commons): Remove options parameter.
10568 Change caller. Just call do_allocate_commons_list twice.
10569 (Symbol_table::do_allocate_commons_list): New function, broken out
10570 of do_allocate_commons.
10571 * common.h (class Allocate_commons_task): Remove options_ field.
10572 Update constructor.
10573 * symtab.cc (Symbol_table::Symbol_table): Initialize
10574 tls_commons_.
10575 (Symbol_table::add_from_object): Put TLS common symbols on
10576 tls_commons_ list.
10577 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
10578 which are IN_OUTPUT_DATA.
10579 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
10580 allocate_commons and do_allocate_commons declarations. Declare
10581 do_allocate_commons_list.
10582 * gold.cc (queue_middle_tasks): Update creation of
10583 Allocate_commons_task to not pass options.
10584 * testsuite/Makefile.am (INCLUDES): Add -I.. .
10585 (TLS_TEST_C_FLAGS): New variable.
10586 (tls_test_c_pic.o): New target.
10587 (tls_test_shared.so): Link in tls_test_c_pic.o.
10588 (tls_test_c_pic_ie.o): New target.
10589 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
10590 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
10591 (tls_test_c.o): New target.
10592 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
10593 (tls_pic_test_LDADD): Likewise.
10594 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
10595 (tls_shared_gd_to_ie_test_LDADD): Likewise.
10596 (tls_test_c_gnu2.o): New target.
10597 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
10598 tls_test_c_gnu2.o.
10599 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
10600 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
10601 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
10602 * testsuite/tls_test.cc: Include "config.h".
10603 (t_last): Call t11_last.
10604 * testsuite/tls_test.h (t11, t11_last): Declare.
10605 * testsuite/tls_test_c.c: New file.
10606 * testsuite/tls_test_main.cc (thread_routine): Call t11.
10607 * configure.ac: Check for OpenMP support.
10608 * configure, config.in, Makefile.in: Rebuild.
10609 * testsuite/Makefile.in: Rebuild.
10610
10611 2008-04-16 Cary Coutant <ccoutant@google.com>
10612
10613 * i386.cc (Target_i386::define_tls_base_symbol): New function.
10614 (Target_i386::tls_base_symbol_defined_): New field.
10615 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10616 (Target_i386::Scan::global): Likewise.
10617 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
10618 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
10619 (Target_x86_64::tls_base_symbol_defined_): New field.
10620 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
10621 (Target_x86_64::Scan::global): Likewise.
10622
10623 2008-04-16 Cary Coutant <ccoutant@google.com>
10624
10625 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
10626 (Symbol::needs_plt_entry): Allow weak undefined symbols.
10627 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
10628 building shared libraries.
10629 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
10630 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
10631 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
10632 * testsuite/Makefile.in: Rebuild.
10633 * testsuite/weak_undef.h: New file.
10634 * testsuite/weak_undef_file1.cc: Add extra test cases.
10635 * testsuite/weak_undef_file2.cc: Likewise.
10636 * testsuite/weak_undef_test.cc: Likewise.
10637
10638 2008-04-16 David S. Miller <davem@davemloft.net>
10639
10640 * sparc.cc (Target_sparc::Scan): Change from struct to class.
10641 Add issued_non_pic_error_ field. Declare check_non_pic.
10642 (Target_sparc::Scan::check_non_pic): New function.
10643 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
10644 (Target_sparc::Scan::global): Likewise.
10645
10646 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
10647 * configure: Rebuild.
10648
10649 * options.h (DEFINE_enable): New macro.
10650 (new_dtags): New enable option.
10651 (initfirst, interpose, loadfltr, nodefaultlib,
10652 nodelete, nodlopen, nodump): New -z options.
10653 * layout.cc (Layout:finish_dynamic_section): If new
10654 dtags enabled, emit DT_RUNPATH. Also, emit a
10655 DT_FLAGS_1 containing any specified -z flags.
10656
10657 2008-04-16 Ian Lance Taylor <iant@google.com>
10658
10659 * copy-relocs.cc: New file.
10660 * copy-relocs.h: New file.
10661 * reloc.cc: Remove Copy_relocs code.
10662 * reloc.h: Likewise.
10663 * reloc-types.h (struct Reloc_types) [both versions]: Add
10664 get_reloc_addend_noerror.
10665 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
10666 variants of add_global which take an addend which must be zero.
10667 * i386.cc: Include "copy-relocs.h".
10668 (class Target_i386): Change type of copy_relocs_ to variable,
10669 update initializer.
10670 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
10671 Change all callers.
10672 (Target_i386::do_finalize_sections): Change handling of
10673 copy_relocs_.
10674 * sparc.cc: Include "copy-relocs.h".
10675 (class Target_sparc): Change type of copy_relocs_ to variable,
10676 update initializer.
10677 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
10678 Change all callers.
10679 (Target_sparc::do_finalize_sections): Change handling of
10680 copy_relocs_.
10681 * x86_64.cc: Include "copy-relocs.h".
10682 (class Target_x86_64): Change type of copy_relocs_ to variable,
10683 update initializer.
10684 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
10685 class. Change all callers.
10686 (Target_x86_64::do_finalize_sections): Change handling of
10687 copy_relocs_.
10688 * Makefile.am (CCFILES): Add copy-relocs.cc.
10689 (HFILES): Add copy-relocs.h.
10690
10691 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
10692
10693 * testsuite/script_test_4.sh: Permit leading zeroes.
10694
10695 2008-04-15 Ian Lance Taylor <iant@google.com>
10696
10697 * script-sections.cc (Script_sections::create_segments): Use
10698 header_size_adjustment even when there is enough room for the
10699 headers.
10700 * testsuite/script_test_4.sh: New file.
10701 * testsuite/script_test_4.t: New file.
10702 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
10703 (check_DATA): Add script_test_4.stdout.
10704 (MOSTLYCLEANFILES): Likewise.
10705 (script_test_4): New target.
10706 (script_test_4.stdout): New target.
10707 * testsuite/Makefile.in: Rebuild.
10708
10709 * sparc.cc: Add definitions for Output_data_plt_sparc class
10710 constants.
10711
10712 2008-04-14 David S. Miller <davem@davemloft.net>
10713
10714 * sparc.cc: New file.
10715 * Makefile.am (TARGETSOURCES): Add sparc.cc
10716 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
10717 * configure.tgt: Document targ_extra_size and
10718 targ_extra_big_endian. Add entries for sparc-* and
10719 sparc64-*.
10720 * configure.ac: Handle targ_extra_size and
10721 targ_extra_big_endian.
10722 * Makefile.in: Rebuild.
10723 * configure: Likewise.
10724 * po/POTFILES.in: Likewise.
10725 * po/gold.pot: Likewise.
10726
10727 2008-04-14 Ian Lance Taylor <iant@google.com>
10728
10729 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
10730 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
10731 in the name/type/flags to section mapping. Don't call
10732 allocate_output_section.
10733 (Layout::choose_output_section): Change parameter from adjust_name
10734 to is_input_section. Don't permit input sections after sections
10735 are attached to segments. Don't call allocate_output_section.
10736 (Layout::layout_eh_frame): Call update_flags_for_input_section,
10737 not write_enable_output_section.
10738 (Layout::make_output_section): Don't push to
10739 unattached_section_list_ nor call attach_to_segment. Call
10740 attach_section_to_segment if sections are attached.
10741 (Layout::attach_sections_to_segments): New function.
10742 (Layout::attach_section_to_segment): New function.
10743 (Layout::attach_allocated_section_to_segment): Rename from
10744 attach_to_segment. Remove flags parameter.
10745 (Layout::allocate_output_section): Remove function.
10746 (Layout::write_enable_output_section): Remove function.
10747 * layout.h (class Layout): Update for above changes. Add new
10748 field sections_are_attached_.
10749 * output.h (Output_section::update_flags_for_input_section): New
10750 function.
10751 * output.cc (Output_section::add_input_section): Call
10752 update_flags_for_input_section.
10753 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
10754
10755 2008-04-11 Cary Coutant <ccoutant@google.com>
10756
10757 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
10758 thought unnecessary.
10759 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
10760
10761 2008-04-11 Ian Lance Taylor <iant@google.com>
10762
10763 * output.h (class Output_section_data): Remove inline definition
10764 of set_addralign.
10765 * output.cc (Output_section_data::set_addralign): New function.
10766
10767 2008-04-11 Cary Coutant <ccoutant@google.com>
10768
10769 Add support for TLS descriptors for i386 and x86_64.
10770 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
10771 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
10772 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
10773 GOT_TYPE_TLS_DESC.
10774 (Target_i386::got_mod_index_entry): Remove unnecessary code.
10775 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
10776 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
10777 relocations.
10778 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
10779 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
10780 Fix problem with initial-exec relocations.
10781 (Target_i386::Relocate::relocate_tls): Likewise.
10782 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
10783 relaxation.
10784 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
10785 support for section-plus-offset dynamic table entries.
10786 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
10787 (Output_data_dynamic::Dynamic_entry): Add support for
10788 section-plus-offset dynamic table entries.
10789 (Output_data_dynamic::Classification): Likewise.
10790 (Output_data_dynamic::classification_): Renamed offset_.
10791 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
10792 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
10793 (Target_x86_64::make_plt_section): New function.
10794 (Target_x86_64::reserve_tlsdesc_entries): New function.
10795 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
10796 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
10797 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
10798 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
10799 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
10800 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
10801 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
10802 add extra PLT entry for TLS descriptors.
10803 (Output_data_plt_x86_64::got_): New field.
10804 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
10805 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
10806 fields.
10807 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
10808 descriptors.
10809 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
10810 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
10811 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
10812 R_386_TLS_DESC_CALL relocations.
10813 (Target_x86_64::Scan::global): Likewise.
10814 (Target_x86_64::do_finalize_sections): Add dynamic table entries
10815 for TLS descriptors.
10816 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
10817 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
10818 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
10819 GD-to-IE relaxation.
10820 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
10821 and TLS_DESCRIPTORS.
10822 * Makefile.in: Rebuild.
10823 * configure: Rebuild.
10824 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
10825 (tls_test_shared2.so): New target.
10826 (tls_shared_gd_to_ie_test_SOURCES): New variable.
10827 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
10828 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
10829 (tls_shared_gd_to_ie_test_LDADD): New variable.
10830 (tls_shared_gnu2_gd_to_ie_test): New target.
10831 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
10832 New targets.
10833 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
10834 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
10835 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
10836 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
10837 (tls_shared_gnu2_test): New target.
10838 (tls_test_gnu2_shared.so): New target.
10839 (tls_shared_gnu2_test_SOURCES): New variable.
10840 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
10841 (tls_shared_gnu2_test_LDFLAGS): New variable.
10842 (tls_shared_gnu2_test_LDADD): New variable.
10843 * testsuite/Makefile.in: Rebuild.
10844 * testsuite/Makefile.
10845
10846 2008-04-11 Ian Lance Taylor <iant@google.com>
10847
10848 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
10849 justsyms.t.
10850 * testsuite/Makefile.in: Rebuild.
10851
10852 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
10853 long.
10854 * testsuite/script_test_2.cc (main): Adjust test.
10855
10856 2008-04-11 David S. Miller <davem@davemloft.net>
10857 Ian Lance Taylor <iant@google.com>
10858
10859 * options.h (General_options): Add entries for '-Y' and
10860 '-relax'.
10861 * options.cc (General_options:finalize): If -Y was used, add those
10862 entries to the library path instead of the default "/lib" and
10863 "/usr/lib".
10864
10865 2008-04-11 David S. Miller <davem@davemloft.net>
10866
10867 * testsuite/justsyms.t: Start at 0x100.
10868 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
10869 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
10870 long.
10871 * testsuite/script_test_2.cc: Adjust string and section length
10872 checks.
10873
10874 2008-04-09 Ian Lance Taylor <iant@google.com>
10875
10876 PR gold/5996
10877 * script-sections.cc (Sections_element::allocate_to_segment): Add
10878 orphan parameter.
10879 (Output_section_definition::allocate_to_segment): Likewise.
10880 (Orphan_output_section::allocate_to_segment): Likewise.
10881 (Script_sections::attach_sections_using_phdrs_clause): Don't
10882 propagate non-PT_LOAD segments to orphan sections.
10883 * testsuite/Makefile.am (script_test_3.stdout): Generate using
10884 readelf rather than objdump.
10885 * testsuite/script_test_3.sh: Adjust accordingly. Test that
10886 .interp section and PT_INTERP segment are the same size.
10887 * testsuite/Makefile.in: Rebuild.
10888
10889 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
10890 aliases for symbols defined in the same object.
10891 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
10892 (weak_alias_test_SOURCES): New variable.
10893 (weak_alias_test_DEPENDENCIES): New variable.
10894 (weak_alias_test_LDFLAGS): New variable.
10895 (weak_alias_test_LDADD): New variable.
10896 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
10897 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
10898 (weak_alias_test_3.o): New target.
10899 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
10900 * testsuite/weak_alias_test_main.cc: New file.
10901 * testsuite/weak_alias_test_1.cc: New file.
10902 * testsuite/weak_alias_test_2.cc: New file.
10903 * testsuite/weak_alias_test_3.cc: New file.
10904
10905 2008-04-08 Ian Lance Taylor <iant@google.com>
10906
10907 * options.h (class General_options): Add --noinhibit-exec option.
10908 * main.cc (main): Check --noinhibit-exec.
10909
10910 * options.h (class General_options): Define --wrap as a special
10911 option. Add wrap_symbols_ field.
10912 (General_options::any_wrap_symbols): New function.
10913 (General_options::is_wrap_symbol): New function.
10914 * options.cc (General_options::parse_wrap): New function.
10915 (General_options::General_options): Initialize wrap_symbols_.
10916 * symtab.cc (Symbol_table::wrap_symbol): New function.
10917 (Symbol_table::add_from_object): Handle --wrap.
10918 * symtab.h (class Symbol_table): Declare wrap_symbol.
10919 * target.h (Target::wrap_char): New function.
10920 (Target::Target_info): Add wrap_char field.
10921 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
10922 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10923 * testsuite/testfile.cc (Target_test::test_target_info):
10924 Likewise.
10925
10926 * errors.cc (Errors::undefined_symbol): Mention symbol version if
10927 there is one.
10928
10929 * layout.h (class Layout): Add added_eh_frame_data_ field.
10930 * layout.cc (Layout::Layout): Initialize new field.
10931 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
10932 output section until we find a section we merged successfully.
10933 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
10934 that the size be non-zero.
10935
10936 * merge.cc (Object_merge_map::get_output_offset): Remove inline
10937 qualifier.
10938
10939 2008-04-08 Craig Silverstein <csilvers@google.com>
10940
10941 * configure.ac: Export new conditional variable HAVE_ZLIB.
10942 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
10943 on HAVE_ZLIB.
10944 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
10945 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10946
10947 2008-04-07 Ian Lance Taylor <iant@google.com>
10948
10949 * version.cc (version_string): Set to "1.5".
10950
10951 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
10952 Add issued_non_pic_error_ field. Declare check_non_pic.
10953 (Target_x86_64::Scan::check_non_pic): New function.
10954 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
10955 (Target_x86_64::Scan::global): Likewise.
10956
10957 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
10958 addend parameter. Change caller. Handle merge sections.
10959 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
10960 Address to Addend. Don't add in the result of
10961 local_section_offset, pass down the addend and use the returned
10962 value.
10963 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
10964 Update declarations of local_section_offset and symbol_value.
10965 * testsuite/two_file_test_1.cc (t18): New function.
10966 * testsuite/two_file_test_2.cc (f18): New function.
10967 * testsuite/two_file_test_main.cc (main): Call t18.
10968 * testsuite/two_file_test.h (t18, f18): Declare.
10969
10970 * configure.ac: Don't test for objdump, c++filt, or readelf.
10971 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
10972 conditionals.
10973 (TEST_READELF): New variable.
10974 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
10975 (check_PROGRAMS): Add two_file_strip_test.
10976 (two_file_strip_test): New target.
10977 (check_PROGRAMS): Add two_file_same_shared_strip_test.
10978 (two_file_same_shared_strip_test_SOURCES): New variable.
10979 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
10980 (two_file_same_shared_strip_test_LDFLAGS): New variable.
10981 (two_file_same_shared_strip_test_LDADD): New variable.
10982 (two_file_shared_strip.so): New target.
10983 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
10984 (ver_test_5.syms, ver_test_7.syms): Likewise.
10985 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
10986 (strip_test_3.stdout): Use TEST_OBJDUMP.
10987 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
10988
10989 2008-04-04 Cary Coutant <ccoutant@google.com>
10990
10991 * symtab.h (Symbol::is_weak_undefined): New function.
10992 (Symbol::is_strong_undefined): New function.
10993 (Symbol::is_absolute): New function.
10994 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
10995 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
10996 absolute symbols.
10997 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
10998 (weak_undef_test): New target.
10999 * testsuite/Makefile.in: Rebuild.
11000 * testsuite/weak_undef_file1.cc: New file.
11001 * testsuite/weak_undef_file2.cc: New file.
11002 * testsuite/weak_undef_test.cc: New file.
11003
11004 2008-04-03 Craig Silverstein <csilvers@google.com>
11005
11006 * compressed_output.h (class Output_compressed_section): Use
11007 unsigned buffer.
11008 * compressed_output.cc (zlib_compress): Use unsigned buffers,
11009 add zlib header.
11010 (zlib_compressed_suffix): Removed.
11011 (Output_compressed_section::set_final_data_size): Use unsigned
11012 buffers.
11013 * testsuite/Makefile.am (flagstest_compress_debug_sections):
11014 Fix linker invocation.
11015 (flagstest_o_specialfile_and_compress_debug_sections):
11016 Likewise.
11017 * testsuite/Makefile.in: Regenerated.
11018
11019 2008-04-02 David S. Miller <davem@davemloft.net>
11020
11021 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
11022 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
11023
11024 2008-04-02 Craig Silverstein <csilvers@google.com>
11025
11026 * TODO: New file.
11027
11028 2008-04-02 Ian Lance Taylor <iant@google.com>
11029
11030 * fileread.cc (File_read::find_view): Add byteshift and vshifted
11031 parameters. Update for new key type to views_. Change all
11032 callers.
11033 (File_read::read): Adjust for byteshift in returned view.
11034 (File_read::add_view): New function, broken out of
11035 find_and_make_view.
11036 (File_read::make_view): New function, broken out of
11037 find_and_make_view.
11038 (File_read::find_or_make_view): Add offset and aligned
11039 parameters. Rewrite accordingly. Change all callers.
11040 (File_read::get_view): Add offset and aligned parameters. Adjust
11041 for byteshift in return value.
11042 (File_read::get_lasting_view): Likewise.
11043 * fileread.h (class File_read): Update declarations.
11044 (class File_read::View): Add byteshift_ field. Add byteshift to
11045 constructor. Add byteshift method.
11046 * archive.h (Archive::clear_uncached_views): New function.
11047 (Archive::get_view): Add aligned parameter. Change all callers.
11048 * object.h (Object::get_view): Add aligned parameter. Change all
11049 callers.
11050 (Object::get_lasting_view): Likewise.
11051
11052 * fileread.cc (File_read::release): Don't call clear_views if
11053 there are multiple objects.
11054 * fileread.h (File_read::clear_uncached_views): New function.
11055 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
11056 on the archive.
11057
11058 2008-03-31 Cary Coutant <ccoutant@google.com>
11059
11060 Add thin archive support.
11061 * archive.cc (Archive::armagt): New const.
11062 (Archive::setup): Remove task parameter and calls to unlock.
11063 (Archive::unlock_nested_archives): New function.
11064 (Archive::read_header): Add nested_off parameter. Change
11065 all callers.
11066 (Archive::interpret_header): Likewise.
11067 (Archive::include_all_members): Change to handle thin
11068 archives.
11069 (Archive::include_member): Likewise.
11070 * archive.h (Archive::Archive): Add new parameters and
11071 initializers.
11072 (Archive::armagt): New const.
11073 (Archive::setup): Remove task parameter.
11074 (Archive::unlock_nested_archives): New function.
11075 (Archive::read_header): Add nested_off parameter.
11076 (Archive::interpret_header): Likewise.
11077 (Archive::Nested_archive_table): New typedef.
11078 (Archive::is_thin_archive_): New field.
11079 (Archive::nested_archives_): New field.
11080 (Archive::options_): New field.
11081 (Archive::dirpath_): New field.
11082 (Archive::task_): New field.
11083 * readsyms.cc (Read_symbols::do_read_symbols): Add check
11084 for thin archives. Pass additional parameters to
11085 Archive::Archive. Unlock the archive file after calling
11086 Archive::setup.
11087
11088 2008-03-29 Ian Lance Taylor <iant@google.com>
11089
11090 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
11091 version symbol to be local.
11092 * testsuite/ver_test_4.sh: New file.
11093 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
11094 (check_DATA): Add ver_test_4.syms.
11095 (ver_test_4.syms): New target.
11096 * testsuite/Makefile.in: Rebuild.
11097
11098 * output.cc
11099 (Output_section::Input_section_sort_entry::has_priority): New
11100 function.
11101 (Output_section::Input_section_sort_entry::match_file_name): New
11102 function.
11103 (Output_section::Input_section_sort_entry::match_section_name):
11104 Remove.
11105 (Output_section::Input_section_sort_entry::match_section_name_prefix):
11106 Remove.
11107 (Output_section::Input_section_sort_entry::match_section_file):
11108 Remove.
11109 (Output_section::Input_section_sort_compare::operator()): Rewrite
11110 using new Input_section_sort_entry functions. Sort crtbegin and
11111 crtend first. Sort sections with no priority before sections with
11112 a priority.
11113 * testsuite/initpri1.c (d3): Check j != 4.
11114 (cd5): New constructor/destructor function.
11115 (main): Check j != 2.
11116
11117 * symtab.cc (Symbol_table::add_from_object): If we don't use the
11118 new symbol when resolving, don't call set_is_default.
11119 * testsuite/ver_test_7.cc: New file.
11120 * testsuite/ver_test_7.sh: New file.
11121 * testsuite/Makefile.am (ver_test_7.so): New target.
11122 (ver_test_7.o): New target.
11123 (check_SCRIPTS): Add ver_test_7.sh.
11124 (check_DATA): Add ver_test_7.syms.
11125 (ver_test_7.syms): New target.
11126
11127 2008-03-28 Ian Lance Taylor <iant@google.com>
11128
11129 * layout.cc (Layout::layout): If we see an input section with a
11130 name that needs sorting, set the must_sort flag for the output
11131 section.
11132 (Layout::make_output_section): If the name of the output section
11133 indicates that it might require sorting, set the may_sort flag.
11134 * output.h (Output_section::may_sort_attached_input_sections): New
11135 function.
11136 (Output_section::set_may_sort_attached_input_sections): New
11137 function.
11138 (Output_section::must_sort_attached_input_sections): New
11139 function.
11140 (Output_section::set_must_sort_attached_input_sections): New
11141 function.
11142 (class Output_section): Declare Input_section_sort_entry. Define
11143 Input_section_sort_compare. Declare
11144 sort_attached_input_sections. Add new fields:
11145 may_sort_attached_input_sections_,
11146 must_sort_attached_input_sections_,
11147 attached_input_sections_are_sorted_.
11148 * output.cc (Output_section::Output_section): Initialize new
11149 fields.
11150 (Output_section::add_input_section): Add an entry to
11151 input_sections_ if may_sort or must_sort are true.
11152 (Output_section::set_final_data_size): Call
11153 sort_attached_input_sections if necessary.
11154 (Output_section::Input_section_sort_entry): Define new class.
11155 (Output_section::Input_section_sort_compare::operator()): New
11156 function.
11157 (Output_section::sort_attached_input_sections): New function.
11158 * configure.ac: Check whether the compiler supports constructor
11159 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
11160 * testsuite/initpri1.c: New file.
11161 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
11162 CONSTRUCTOR_PRIORITY.
11163 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
11164 (initpri1_LDFLAGS): New variable.
11165 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
11166
11167 2008-03-27 Ian Lance Taylor <iant@google.com>
11168
11169 * common.cc (Sort_commons::operator): Correct sorting algorithm.
11170 * testsuite/common_test_1.c: New file.
11171 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
11172 (common_test_1_SOURCES): New variable.
11173 (common_test_1_DEPENDENCIES): New variable.
11174 (common_test_1_LDFLAGS): New variable.
11175
11176 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
11177 and commons_ correctly when NAME/VERSION does not override
11178 NAME/NULL.
11179 * testsuite/ver_test_6.c: New file.
11180 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
11181 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
11182 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
11183
11184 2008-03-26 Ian Lance Taylor <iant@google.com>
11185
11186 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
11187 of an undefined symbol from a version script.
11188 * testsuite/Makefile.am (ver_test_5.so): New target.
11189 (ver_test_5.o): New target.
11190 (check_SCRIPTS): Add ver_test_5.sh.
11191 (check_DATA): Add ver_test_5.syms.
11192 (ver_test_5.syms): New target.
11193 * testsuite/ver_test_5.cc: New file.
11194 * testsuite/ver_test_5.script: New file.
11195 * testsuite/ver_test_5.sh: New file.
11196 * Makefile.in, testsuite/Makefile.in: Rebuild.
11197
11198 PR gold/5986
11199 Fix problems building gold with gcc 4.3.0.
11200 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
11201 (gold_error_at_location, gold_warning_at_location): Use it.
11202 * configure.ac: Check whether we can compile and use a template
11203 function with a printf attribute.
11204 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
11205 when jumping over bytes.
11206 * object.cc: Instantiate Object::read_section_data.
11207 * debug.h: Include <cstring>
11208 * dwarf_reader.cc: Include <algorithm>
11209 * main.cc: Include <cstring>.
11210 * options.cc: Include <cstring>.
11211 * output.cc: Include <cstring>.
11212 * script.cc: Include <cstring>.
11213 * script.h: Include <string>.
11214 * symtab.cc: Include <cstring> and <algorithm>.
11215 * target-select.cc: Include <cstring>.
11216 * version.cc: Include <string>.
11217 * testsuite/testmain.cc: Include <cstdlib>.
11218 * configure, config.in: Rebuild.
11219
11220 2008-03-25 Ian Lance Taylor <iant@google.com>
11221
11222 * options.cc: Include "../bfd/bfdver.h".
11223 (options::help): Print bug reporting address.
11224
11225 * version.cc (print_version): Adjust output for current value of
11226 BFD_VERSION_STRING.
11227
11228 * NEWS: New file.
11229
11230 * options.cc (options::help): Print list of supported targets.
11231 * target-select.h: Include <vector>.
11232 (class Target_selector): Make machine_, size_, and is_big_endian_
11233 fields const. Add bfd_name_ and instantiated_target_ fields.
11234 (Target_selector::Target_selector): Add bfd_name parameter.
11235 (Target_selector::recognize): Make non-virtual, call
11236 do_recognize.
11237 (Target_selector::recognize_by_name): Make non-virtual, call
11238 do_recognize_by_name.
11239 (Target_selector::supported_names): New function.
11240 (Target_selector::bfd_name): New function.
11241 (Target_selector::do_instantiate_target): New pure virtual
11242 function.
11243 (Target_selector::do_recognize): New virtual function.
11244 (Target_selector::do_recognize_by_name): New virtual function.
11245 (Target_selector::instantiate_target): New private function.
11246 (supported_target_names): Declare.
11247 * target-select.cc (Target_selector::Target_selector): Update for
11248 new parameter and fields.
11249 (select_target_by_name): Check that the name matches before
11250 calling recognize_by_name.
11251 (supported_target_names): New function.
11252 * i386.cc (class Target_selector_i386): Update Target_selector
11253 constructor call. Remove recognize and recognize_by_name. Add
11254 do_instantiate_target.
11255 * x86_64.cc (class Target_selector_x86_64): Likewise.
11256 * testsuite/testfile.cc (class Target_selector_test): Update for
11257 changes to Target_selector.
11258
11259 * README: Rewrite, with some notes on unsupported features.
11260
11261 2008-03-24 Cary Coutant <ccoutant@google.com>
11262
11263 * i386.cc (Target_i386::Got_type): New enum declaration.
11264 (Target_i386::Scan::local): Updated callers of Output_data_got
11265 member functions.
11266 (Target_i386::Scan::global): Likewise.
11267 (Target_i386::Relocate::relocate): Likewise.
11268 (Target_i386::Relocate::relocate_tls): Likewise.
11269 * object.h (Got_offset_list): New class.
11270 (Sized_relobj::local_has_got_offset): Added got_type parameter.
11271 (Sized_relobj::local_got_offset): Likewise.
11272 (Sized_relobj::set_local_got_offset): Likewise.
11273 (Sized_relobj::local_has_tls_got_offset): Removed.
11274 (Sized_relobj::local_tls_got_offset): Removed.
11275 (Sized_relobj::set_local_tls_got_offset): Removed.
11276 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
11277 * output.cc (Output_data_got::add_global): Added got_type parameter.
11278 (Output_data_got::add_global_with_rel): Likewise.
11279 (Output_data_got::add_global_with_rela): Likewise.
11280 (Output_data_got::add_global_pair_with_rel): New function.
11281 (Output_data_got::add_global_pair_with_rela): New function.
11282 (Output_data_got::add_local): Added got_type parameter.
11283 (Output_data_got::add_local_with_rel): Likewise.
11284 (Output_data_got::add_local_with_rela): Likewise.
11285 (Output_data_got::add_local_pair_with_rel): New function.
11286 (Output_data_got::add_local_pair_with_rela): New function.
11287 (Output_data_got::add_global_tls): Removed.
11288 (Output_data_got::add_global_tls_with_rel): Removed.
11289 (Output_data_got::add_global_tls_with_rela): Removed.
11290 (Output_data_got::add_local_tls): Removed.
11291 (Output_data_got::add_local_tls_with_rel): Removed.
11292 (Output_data_got::add_local_tls_with_rela): Removed.
11293 * output.h (Output_data_got::add_global): Added got_type parameter.
11294 (Output_data_got::add_global_with_rel): Likewise.
11295 (Output_data_got::add_global_with_rela): Likewise.
11296 (Output_data_got::add_global_pair_with_rel): New function.
11297 (Output_data_got::add_global_pair_with_rela): New function.
11298 (Output_data_got::add_local): Added got_type parameter.
11299 (Output_data_got::add_local_with_rel): Likewise.
11300 (Output_data_got::add_local_with_rela): Likewise.
11301 (Output_data_got::add_local_pair_with_rel): New function.
11302 (Output_data_got::add_local_pair_with_rela): New function.
11303 (Output_data_got::add_global_tls): Removed.
11304 (Output_data_got::add_global_tls_with_rel): Removed.
11305 (Output_data_got::add_global_tls_with_rela): Removed.
11306 (Output_data_got::add_local_tls): Removed.
11307 (Output_data_got::add_local_tls_with_rel): Removed.
11308 (Output_data_got::add_local_tls_with_rela): Removed.
11309 * resolve.cc (Symbol::override_base_with_special): Removed
11310 reference to has_got_offset_ field.
11311 * symtab.cc (Symbol::init_fields): Replaced initialization
11312 of got_offset_ with got_offsets_. Removed initialization
11313 of has_got_offset_
11314 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
11315 (Symbol::got_offset): Likewise.
11316 (Symbol::set_got_offset): Likewise.
11317 (Symbol::has_tls_got_offset): Removed.
11318 (Symbol::tls_got_offset): Removed.
11319 (Symbol::set_tls_got_offset): Removed.
11320 (Symbol::got_offset_): Removed.
11321 (Symbol::tls_mod_got_offset_): Removed.
11322 (Symbol::tls_pair_got_offset_): Removed.
11323 (Symbol::got_offsets_): New field.
11324 (Symbol::has_got_offset): Removed.
11325 (Symbol::has_tls_mod_got_offset): Removed.
11326 (Symbol::has_tls_pair_got_offset): Removed.
11327 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
11328 (Target_x86_64::Scan::local): Updated callers of Output_data_got
11329 member functions.
11330 (Target_x86_64::Scan::global): Likewise.
11331 (Target_x86_64::Relocate::relocate): Likewise.
11332 (Target_x86_64::Relocate::relocate_tls): Likewise.
11333
11334 2008-03-25 Ben Elliston <bje@au.ibm.com>
11335
11336 * yyscript.y: Fix spelling error in comment.
11337
11338 2008-03-24 Ian Lance Taylor <iant@google.com>
11339
11340 * options.h (class General_options): Define build_id option.
11341 * layout.h (class Layout): Declare write_build_id, create_note,
11342 create_build_id. Add build_id_note_ member.
11343 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
11344 "libiberty.h", "md5.h", "sha1.h".
11345 (Layout::Layout): Initialize eh_frame_data_,
11346 eh_frame_hdr_section_, and build_id_note_.
11347 (Layout::finalize): Call create_build_id.
11348 (Layout::create_note): New function, broken out of
11349 Layout::create_gold_note.
11350 (Layout::create_gold_note): Call create_note.
11351 (Layout::create_build_id): New function.
11352 (Layout::write_build_id): New function.
11353 (Close_task_runner::run): Call write_build_id.
11354
11355 * x86_64.cc: Correct license to GPLv3.
11356
11357 2008-03-23 Ian Lance Taylor <iant@google.com>
11358
11359 * options.cc: Include "demangle.h".
11360 (parse_optional_string): New function.
11361 (parse_long_option): Handle takes_optional_argument.
11362 (parse_short_option): Update dash_z initializer. Handle
11363 takes_optional_argument.
11364 (General_options::General_options): Initialize do_demangle_.
11365 (General_options::finalize): Set do_demangle_. Handle demangling
11366 style.
11367 * options.h (parse_optional_string): Declare.
11368 (struct One_option): Add optional_arg field. Update constructor.
11369 Update call constructor calls. Add takes_optional_argument
11370 function.
11371 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
11372 (DEFINE_optional_string): Define.
11373 (General_options::demangle): Change from DEFINE_bool to
11374 DEFINE_optional_string.
11375 (General_options::no_demangle): New function.
11376 (General_options::do_demangle): New function.
11377 (General_options::set_do_demangle): New function.
11378 (General_options::execstack_status_): Move definition to end of
11379 class definition.
11380 (General_options::static_): Likewise.
11381 (General_options::do_demangle_): New field.
11382 * object.cc (big_endian>::get_symbol_location_info): Call
11383 Options::do_demangle, not Options::demangle.
11384 * symtab.cc (demangle): Likewise.
11385
11386 2008-03-22 Ian Lance Taylor <iant@google.com>
11387
11388 * gold.h: Include <cstddef> and <sys/types.h>
11389 * options.h: Include <cstring>.
11390
11391 2008-03-21 Ian Lance Taylor <iant@google.com>
11392
11393 * Added source code to GNU binutils.
This page took 0.278026 seconds and 4 git commands to generate.