Index: gold/arm.cc
[binutils-gdb.git] / gold / ChangeLog
1 2010-08-12 Doug Kwan <dougkwan@google.com>
2
3 * arm.cc (Target_arm::merge_object_attributes): Check command line
4 options --no-wchar-size-warning and --no-enum-size-warning.
5 * options.h (General_options): Add ld-compatible options
6 --no-enum-size-warning and --no-wchar-size-warning.
7
8 2010-08-04 Ian Lance Taylor <iant@google.com>
9
10 * x86_64.cc (Target_x86_64::Scan::local): Use
11 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
12 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
13 (Target_x86_64::Scan::global): Likewise.
14 (Target_x86_64::Relocate::relocate): Likewise.
15 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
16 Likewise.
17
18 2010-08-03 Cary Coutant <ccoutant@google.com>
19
20 * merge.cc (Output_merge_string::do_add_input_section): Count strings
21 to reserve space in merged_strings vector. Keep total input size
22 for stats.
23 (Output_merge_string::do_print_merge_stats): Print total input size.
24 * merge.h (Output_merge_string): Add input_size_ field.
25 * stringpool.cc (Stringpool_template::string_length): Move
26 implementations out of Stringpool_template class and place in
27 stringpool.h.
28 * stringpool.h (string_length): Move out of Stringpool_template.
29
30 2010-08-03 Ian Lance Taylor <iant@google.com>
31
32 PR 11712
33 * layout.cc (relaxation_loop_body): If address of load segment is
34 set, adjust address to include headers if possible.
35
36 2010-08-03 Ian Lance Taylor <iant@google.com>
37
38 * version.cc (version_string): Bump to 1.10.
39
40 2010-08-03 Ian Lance Taylor <iant@google.com>
41
42 PR 11805
43 * layout.h (enum Output_section_order): Define.
44 (class Layout): Update declarations.
45 * layout.cc (Layout::get_output_section): Add order parameter.
46 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
47 is_first_non_relro parameters. Change all callers.
48 (Layout::choose_output_section): Likewise.
49 (Layout::add_output_section_data): Likewise.
50 (Layout::make_output_section): Likewise. Set order.
51 (Layout::default_section_order): New function.
52 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
53 * output.cc (Output_section::Output_section): Initialize order_.
54 Don't initialize deleted fields.
55 (Output_segment::Output_segment): Don't initialize deleted
56 fields.
57 (Output_segment::add_output_section_to_load): New function
58 replacing add_output_section. Change all callers to call this or
59 add_output_section_to_nonload.
60 (Output_segment::add_output_section_to_nonload): New function.
61 (Output_segment::remove_output_section): Rewrite.
62 (Output_segment::add_initial_output_data): Likewise.
63 (Output_segment::has_any_data_sections): Likewise.
64 (Output_segment::is_first_section_relro): Likewise.
65 (Output_segment::maximum_alignment): Likewise.
66 (Output_segment::has_dynamic_reloc): New function replacing
67 dynamic_reloc_count. Change all callers.
68 (Output_segment::has_dynamic_reloc_list): New function replacing
69 dynamic_reloc_count_list. Change all callers.
70 (Output_segment::set_section_addresses): Rewrite.
71 (Output_segment::set_offset): Rewrite.
72 (Output_segment::find_first_and_last_list): Remove.
73 (Output_segment::set_tls_offsets): Rewrite.
74 (Output_segment::first_section_load_address): Likewise.
75 (Output_segment::output_section_count): Likewise.
76 (Output_segment::section_with_lowest_load_address): Likewise.
77 (Output_segment::write_section_headers): Likewise.
78 (Output_segment::print_sections_to_map): Likewise.
79 * output.h (class Output_data): Remove dynamic_reloc_count_
80 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
81 (Output_data::add_dynamic_reloc): Rewrite.
82 (Output_data::has_dynamic_reloc): New function.
83 (Output_data::dynamic_reloc_count): Remove.
84 (class Output_section): Add order_ field. Remvoe is_relro_local_,
85 is_last_relro_, is_first_non_relro_, is_interp_,
86 is_dynamic_linker_section_ fields. Add order and set_order
87 functions. Remove is_relro_local, set_is_relro_local,
88 is_last_relro, set_is_last_relro, is_first_non_relro,
89 set_is_first_non_relro functions, is_interp, set_is_interp,
90 is_dynamic_linker_section, and set_is_dynamic_linker_section
91 functions.
92 (class Output_segment): Change Output_data_list from std::list to
93 std:;vector. Add output_lists_ field. Remove output_data_ and
94 output_bss_ fields. Update declarations.
95
96 2010-08-02 Ian Lance Taylor <iant@google.com>
97
98 * arm.cc (Target_arm::gc_process_relocs): Use typename.
99 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
100 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
101
102 2010-08-02 Ian Lance Taylor <iant@google.com>
103
104 PR 11855
105 * script.cc (Script_options::Script_options): Initialize
106 symbol_definitions_ and symbol_references_.
107 (Script_options::add_symbol_assignment): Update
108 symbol_definitions_ and symbol_references_.
109 (Script_options::add_symbol_reference): New function.
110 (script_symbol): New function.
111 * script.h (class Script_options): Add symbol_definitions_ and
112 symbol_references_ fields.
113 (Script_options::referenced_const_iterator): New type.
114 (Script_options::referenced_begin): New function.
115 (Script_options::referenced_end): New function.
116 (Script_options::is_referenced): New function.
117 (Script_options::any_unreferenced): New function.
118 * script-c.h (script_symbol): Declare.
119 * yyscript.y (exp): Call script_symbol.
120 * symtab.cc: Include "script.h".
121 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
122 Change all callers. Check symbols referenced by scripts.
123 (Symbol_table::add_undefined_symbols_from_command_line): Add
124 layout parameter. Change all callers.
125 (Symbol_table::do_add_undefined_symbols_from_command_line):
126 Likewise. Break out loop body. Check symbols referenced by
127 scripts.
128 (Symbol_table::add_undefined_symbol_from_command_line): New
129 function broken out of
130 do_add_undefined_symbols_from_command_line.
131 * symtab.h (class Symbol_table): Update declarations.
132 * archive.cc: Include "layout.h".
133 (Archive::should_include_member): Add layout parameter. Change
134 all callers. Check for symbol mentioned in expression.
135 * archive.h (class Archive): Update declaration.
136 * object.cc (Sized_relobj::do_should_include_member): Add layout
137 parameter.
138 * object.h (Object::should_include_member): Add layout parameter.
139 Change all callers.
140 (Object::do_should_include_member): Add layout parameter.
141 (class Sized_relobj): Update declaration.
142 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
143 parameter.
144 * dynobj.h (class Sized_dynobj): Update declaration.
145 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
146 layout parameter.
147 * plugin.h (class Sized_pluginobj): Update declaration.
148
149 2010-08-02 Ian Lance Taylor <iant@google.com>
150
151 PR 11866
152 * output.cc (Output_segment::set_offset): Search for the first and
153 last sections rather than assuming that the list is in order.
154 (Output_segment::find_first_and_last_list): New function.
155 * output.h (class Output_segment): Update declarations.
156 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
157 (relro_strip_test_SOURCES): New variable.
158 (relro_strip_test_DEPENDENCIES): New variable.
159 (relro_strip_test_LDFLAGS): New variable.
160 (relro_strip_test_LDADD): New variable.
161 (relro_strip_test.so): New target.
162
163 2010-08-02 Ian Lance Taylor <iant@google.com>
164
165 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
166 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
167 (Target_i386::got_tlsdesc_section): New function.
168 (Target_i386::got_section): Create space for GOT entries for
169 TLSDESC relocations.
170 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
171 R_386_TLS_GOTDESC.
172 (Target_i386::Scan::global): Likewise.
173 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
174 using TLSDESC GOT.
175 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
176 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
177 (Target_x86_64::got_tlsdesc_section): New function.
178 (Target_x86_64::got_section): Create space for GOT entries for
179 TLSDESC relocations.
180 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
181 R_386_TLS_GOTDESC.
182 (Target_x86_64::Scan::global): Likewise.
183 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
184 using TLSDESC GOT.
185
186 2010-08-02 Ian Lance Taylor <iant@google.com>
187
188 * testsuite/final_layout.sh: Use dc to convert from hex to
189 decimal.
190
191 2010-07-29 Sriraman Tallam <tmsriram@google.com>
192
193 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
194 paramter to the call to gold::gc_process_relocs.
195 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
196 paramter to the call to gold::gc_process_relocs.
197 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
198 parameter to the call to gold::gc_process_relocs.
199 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
200 template parameter to the call to gold::gc_process_relocs.
201 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
202 paramter to the call to gold::gc_process_relocs.
203 * gc.h (get_embedded_addend_size): New function.
204 (gc_process_relocs): Save the size of the reloc for use by ICF.
205 * icf.cc (get_section_contents): Get the addend from the text section
206 for SHT_REL relocation sections.
207 * icf.h (Icf::Reloc_addend_size_info): New typedef.
208 (Icf::Reloc_info): Add new member reloc_addend_size_info.
209 * int_encoding.h (read_from_pointer): New overloaded function.
210 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
211 * testsuite/icf_sht_rel_addend_test.sh: New file.
212 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
213 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
214
215 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
216
217 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
218 * Makefile.in: Regenerate.
219 * testsuite/Makefile.in: Regenerate.
220
221 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
222
223 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
224 * gold/testsuite/debug_msg.cc: Likewise.
225 * gold/testsuite/odr_violation1.cc
226 * gold/testsuite/odr_violation2.cc
227
228 2010-07-21 Cary Coutant <ccoutant@google.com>
229
230 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
231 string, and length fields.
232 (Output_merge_string::Merged_strings_list): New type.
233 (Output_merge_string::Merged_strings_lists): New typedef.
234 (Output_merge_string): Replace merged_strings_ with
235 merged_strings_lists_.
236 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
237 Merged_strings_list per input object and section. Don't store pointer
238 to the string. Don't store length with each merged string entry.
239 (Output_merge_string::finalize_merged_data): Loop over list of merged
240 strings lists. Recompute length of each merged string.
241
242 2010-07-15 Cary Coutant <ccoutant@google.com>
243
244 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
245 here.
246
247 2010-07-14 Ian Lance Taylor <iant@google.com>
248
249 * descriptors.cc (Descriptors::open): Report correct name in error
250 message.
251
252 2010-07-13 Doug Kwan <dougkwan@google.com>
253
254 * arm.cc (Arm_input_section::Arm_input_section): For a
255 SHT_ARM_EXIDX section, always keeps the input sections.
256 (Arm_input_section::set_exidx_section_link): New method.
257 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
258 has_errors_ to false.
259 (Arm_exidx_input_section::has_errors,
260 Arm_exidx_input_section::set_has_errors): New methods.
261 (Arm_exidx_input_section::has_errors_): New data member.
262 (Arm_relobj::get_exidx_shndx_list): New method.
263 (Arm_output_section::append_text_sections_to_list): Do not skip
264 section without SHF_EXECINSTR.
265 (Arm_output_section::fix_exidx_coverage): Skip input sections with
266 errors.
267 (Arm_relobj::make_exidx_input_section): Add new parameter for text
268 section header. Make error messages more verbose. Check for
269 a non-executable section linked to an EXIDX section.
270 (Arm_relobj::do_read_symbols): Remove error checking, which has been
271 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
272 check that there is no deferred EXIDX section if we exit early.
273 Instead of not making an EXIDX section in case of an error, make one
274 and set the has_errors flag of it.
275 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
276 in a relocatable link.
277 (Target_arm::do_relax): Look for the EXIDX output section instead of
278 assuming that it is called .ARM.exidx.
279 (Target_arm::fix_exidx_coverage): Add a new parameter for input
280 section list. Do not check for SHF_EXECINSTR section flags but
281 skip any input section with errors.
282 * output.cc (Output_section::Output_section): Initialize
283 always_keeps_input_sections_ to false.
284 (Output_section::add_input_section): Check for
285 always_keeps_input_sections_.
286 * output.h (Output_section::always_keeps_input_sections,
287 Output_section::set_always_keeps_input_sections): New methods.
288 (Output_section::always_keeps_input_sections): New data member.
289
290 2010-07-13 Rafael Espindola <espindola@google.com>
291
292 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
293 * fileread.h (Input_file): Add try_extra_search_path and find_file.
294
295 2010-07-13 Philip Herron <herron.philip@googlemail.com>
296 Ian Lance Taylor <iant@google.com>
297
298 * output.h (Output_section_lookup_maps::add_merge_section):
299 Correct check of whether value was inserted.
300 (Output_section_lookup_maps::add_merge_input_section): Likewise.
301 (Output_section_lookup_maps::add_relaxed_input_section):
302 Likewise.
303 * arm.cc (Target_arm::got_section): Remove used local os.
304 * i386.cc (Target_i386::got_section): Likewise.
305 * x86_64.cc (Target_x86_64::got_section): Likewise.
306 * sparc.cc (Target_sparc::got_section): Likewise.
307 (Target_sparc::relocate): Remove unused local have_got_offset.
308 * powerpc.cc (Target_powerpc::relocate): Likewise.
309
310 2010-07-13 Ian Lance Taylor <iant@google.com>
311
312 * compressed_output.cc (zlib_decompress): Fix signature in
313 !HAVE_ZLIB_H case.
314
315 * archive.cc (Archive::include_member): Unlock an external member
316 of a thin archive. Don't bother to delete an object we know is
317 NULL.
318
319 2010-07-12 Cary Coutant <ccoutant@google.com>
320
321 * compressed_output.cc (zlib_decompress): New function.
322 (get_uncompressed_size): New function.
323 (decompress_input_section): New function.
324 * compressed_output.h (get_uncompressed_size): New function.
325 (decompress_input_section): New function.
326 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
327 Handle compressed debug sections.
328 * layout.cc (is_compressed_debug_section): New function.
329 (Layout::output_section_name): Map compressed section names to
330 canonical names.
331 * layout.h (is_compressed_debug_section): New function.
332 (is_debug_info_section): Recognize compressed debug sections.
333 * merge.cc: Include compressed_output.h.
334 (Output_merge_data::do_add_input_section): Handle compressed
335 debug sections.
336 (Output_merge_string::do_add_input_section): Handle compressed
337 debug sections.
338 * object.cc: Include compressed_output.h.
339 (Sized_relobj::Sized_relobj): Initialize new data members.
340 (build_compressed_section_map): New function.
341 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
342 * object.h (Object::section_is_compressed): New method.
343 (Object::do_section_is_compressed): New method.
344 (Sized_relobj::Compressed_section_map): New type.
345 (Sized_relobj::do_section_is_compressed): New method.
346 (Sized_relobj::compressed_sections_): New data member.
347 * output.cc (Output_section::add_input_section): Handle compressed
348 debug sections.
349 * reloc.cc: Include compressed_output.h.
350 (Sized_relobj::write_sections): Handle compressed debug sections.
351
352 2010-07-08 Cary Coutant <ccoutant@google.com>
353
354 * resolve.cc (Symbol_table::resolve): Remember whether undef was
355 weak when resolving to a dynamic def.
356 (Symbol_table::should_override): Add adjust_dyndef flag; set it
357 for weak undef/dynamic def cases. Adjust callers.
358 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
359 undef_binding_weak_.
360 (Symbol_table::sized_write_globals): Adjust symbol binding.
361 (Symbol_table::sized_write_symbol): Add binding parameter.
362 * symtab.h (Symbol::set_undef_binding): New method.
363 (Symbol::is_undef_binding_weak): New method.
364 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
365 (Symbol_table::should_override): Add new parameter.
366 (Symbol_table::sized_write_symbol): Add new parameter.
367
368 * testsuite/weak_undef_file1.cc: Add new test case.
369 * testsuite/weak_undef_file2.cc: Fix header comment.
370 * testsuite/weak_undef_test.cc: Add new test case.
371
372 2010-06-29 Doug Kwan <dougkwan@google.com>
373
374 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
375 Initialize USE_SYMBOL_.
376 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
377 definition.
378 (Arm_reloc_property::uses_symbol_): New data member declaration.
379 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
380 uses symbol value and symbol is undefined but not weakly undefined.
381
382 2010-06-28 Rafael Espindola <espindola@google.com>
383
384 * plugin.cc (Plugin::load): Use dlerror.
385
386 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
387
388 * symtab.cc (detect_odr_violations): When reporting an ODR
389 violation, report an object where the symbol is defined.
390
391 2010-06-25 Doug Kwan <dougkwan@google.com>
392
393 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
394 (Target_arm::section_may_have_icf_unsafe_pointers): New method
395 definition.
396 (Target_arm::Scan::local_reloc_may_be_function_pointer,
397 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
398 target hook to detect function points.
399 (Target_arm::Scan::possible_function_pointer_reloc): New method.
400 * icf.h (Icf::check_section_for_function_pointers): Change type of
401 parameter SECTION_NAME to const reference to std::string. Use
402 target hook to determine if section may have unsafe pointers.
403 * target.h (Target::section_may_have_icf_unsafe_pointers): New
404 method definition.
405
406 2010-06-21 Rafael Espindola <espindola@google.com>
407
408 * fileread.cc (Input_file::find_fie): New
409 (Input_file::open): Use Input_file::find_fie.
410 * fileread.h (Input_file::find_fie): New
411 * plugin.cc (set_extra_library_path): New.
412 (Plugin::load): Add set_extra_library_path to the transfer vector.
413 (Plugin_manager::set_extra_library_path): New.
414 (Plugin_manager::add_input_file): Use the extra search path if set.
415 (set_extra_library_path(): New.
416 * plugin.h (Plugin_manager): Add set_extra_library_path and
417 extra_search_path_.
418
419 2010-06-19 Cary Coutant <ccoutant@google.com>
420
421 * layout.cc (gdb_sections): Add .debug_types.
422 (lines_only_debug_sections): Likewise.
423
424 2010-06-18 Rafael Espindola <espindola@google.com>
425
426 * plugin.cc (add_input_file,add_input_library)
427 (Plugin_manager::add_input_file): Make filename arguments const.
428 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
429 const.
430
431 2010-06-16 Doug Kwan <dougkwan@google.com>
432
433 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
434 .ARM.attributes section if we have not merged any input
435 attributes sections.
436
437 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
438
439 * arm.cc: Allow combining objects with no EABI version
440 information.
441
442 2010-06-15 Rafael Espindola <espindola@google.com>
443
444 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
445
446 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
447
448 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
449 (struct iovec): Correct !HAVE_READV definition.
450
451 2010-06-10 Cary Coutant <ccoutant@google.com>
452
453 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
454 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
455 reloc sections.
456 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
457
458 PR 11683
459 * symtab.h (Symbol::is_placeholder): New member function.
460 * target-reloc.h (relocate_section): Check for placeholder symbols.
461
462 * testsuite/Makefile.am (plugin_test_8): New test.
463 (plugin_test_9): New test.
464 * testsuite/Makefile.in: Regenerate.
465
466 2010-06-09 Nick Clifton <nickc@redhat.com>
467
468 * yyscript.y (input_list_element): Allow strings prefixed with
469 the '-' character. Treat these as libraries.
470 * script.cc (script_add_library): New function. Adds a library
471 specified by "-l<name>" found in an input script.
472 * script-c.h: Add prototype for script_add_library.
473
474 2010-06-07 Doug Kwan <dougkwan@google.com>
475
476 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
477 Restrict stub-group size to be within long conditional branch
478 range when working around cortex-A8 erratum.
479
480 2010-06-07 Damien Diederen <dd@crosstwine.com>
481
482 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
483 #ifdef typo.
484
485 2010-06-03 Sriraman Tallam <tmsriram@google.com>
486
487 PR gold/11658
488 * output.cc
489 (Output_section::Input_section_sort_entry::compare_section_ordering):
490 Change to return non-zero correctly.
491 (Output_section::Input_section_sort_section_order_index_compare
492 ::operator()): Change to fix ambiguity in comparisons.
493
494 2010-06-01 Sriraman Tallam <tmsriram@google.com>
495
496 * gold.h (is_wildcard_string): New function.
497 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
498 (Layout::layout_eh_frame): Ditto.
499 (Layout::find_section_order_index): New method.
500 (Layout::read_layout_from_file): New method.
501 * layout.h (Layout::find_section_order_index): New method.
502 (Layout::read_layout_from_file): New method.
503 (Layout::input_section_position_): New private member.
504 (Layout::input_section_glob_): New private member.
505 * main.cc (main): Call read_layout_from_file here.
506 * options.h (--section-ordering-file): New option.
507 * output.cc (Output_section::input_section_order_specified_): New
508 member.
509 (Output_section::Output_section): Initialize new member.
510 (Output_section::add_input_section): Add new parameter.
511 Keep input sections when --section-ordering-file is used.
512 (Output_section::set_final_data_size): Sort input sections when
513 section ordering file is specified.
514 (Output_section::Input_section_sort_entry): Add new parameter.
515 Check sorting type.
516 (Output_section::Input_section_sort_entry::compare_section_ordering):
517 New method.
518 (Output_section::Input_section_sort_compare::operator()): Change to
519 consider section_order_index.
520 (Output_section::Input_section_sort_init_fini_compare::operator()):
521 Change to consider section_order_index.
522 (Output_section::Input_section_sort_section_order_index_compare
523 ::operator()): New method.
524 (Output_section::sort_attached_input_sections): Change to sort
525 according to section order when specified.
526 (Output_section::add_input_section<32, true>): Add new parameter.
527 (Output_section::add_input_section<64, true>): Add new parameter.
528 (Output_section::add_input_section<32, false>): Add new parameter.
529 (Output_section::add_input_section<64, false>): Add new parameter.
530 * output.h (Output_section::add_input_section): Add new parameter.
531 (Output_section::input_section_order_specified): New
532 method.
533 (Output_section::set_input_section_order_specified): New method.
534 (Input_section::Input_section): Initialize section_order_index_.
535 (Input_section::section_order_index): New method.
536 (Input_section::set_section_order_index): New method.
537 (Input_section::section_order_index_): New member.
538 (Input_section::Input_section_sort_section_order_index_compare): New
539 struct.
540 (Output_section::input_section_order_specified_): New member.
541 * script-sections.cc (is_wildcard_string): Delete and move modified
542 method to gold.h.
543 (Output_section_element_input::Output_section_element_input): Modify
544 call to is_wildcard_string.
545 (Output_section_element_input::Input_section_pattern
546 ::Input_section_pattern): Ditto.
547 (Output_section_element_input::Output_section_element_input): Ditto.
548 * testsuite/Makefile.am (final_layout): New test case.
549 * testsuite/Makefile.in: Regenerate.
550 * testsuite/final_layout.cc: New file.
551 * testsuite/final_layout.sh: New file.
552
553 2010-06-01 Rafael Espindola <espindola@google.com>
554
555 * plugin.cc (Plugin::load): Pass the output name to the plugin.
556
557 2010-06-01 Rafael Espindola <espindola@google.com>
558
559 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
560 visibility of symbols.
561
562 2010-05-27 Doug Kwan <dougkwan@google.com>
563
564 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
565 from start of output section instead of address for a local symbol
566 in a merged or relaxed section when doing a relocatable link.
567
568 2010-05-26 Rafael Espindola <espindola@google.com>
569
570 PR 11604
571 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
572 adding sections the garbage collector removed.
573 * gold/testsuite/Makefile.am: Add test.
574 * gold/testsuite/Makefile.in: Regenerate.
575 * gold/testsuite/plugin_test_7.sh: New.
576 * gold/testsuite/plugin_test_7_1.c: New.
577 * gold/testsuite/plugin_test_7_2.c: New.
578
579 2010-05-26 Rafael Espindola <espindola@google.com>
580
581 * script-sections.cc (Output_section_definition::set_section_addresses):
582 Check for --section-start.
583
584 2010-05-26 Doug Kwan <dougkwan@google.com>
585
586 * arm.cc (Arm_scan_relocatable_relocs): New class.
587 (Target_arm::relocate_special_relocatable): New method.
588 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
589 (Arm_relocate_functions::thumb_branch_common): Same.
590 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
591 instead of Default_scan_relocatable_relocs.
592 * target-reloc.h (relocate_for_relocatable): Let target handle
593 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
594 * target.h (Sized_target::relocate_special_relocatable): New method.
595
596 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
597
598 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
599
600 2010-05-23 Doug Kwan <dougkwan@google.com>
601
602 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
603 instead of a cast.
604 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
605 with a direct branch, not a conditional branch, to a stub.
606 * merge.cc (Output_merge_base::record_input_section): New method
607 defintion.
608 (Output_merge_data::do_add_input_section): Record input section if
609 keeps-input-sections flag is set.
610 (Output_merge_string::do_add_input_section): Ditto.
611 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
612 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
613 INPUT_SECTIONS_.
614 (Output_merge_base::keeps_input_sections,
615 Output_merge_base::set_keeps_input_sections,
616 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
617 method definitions.
618 (Output_merge_base::Input_sections): New type declaration.
619 (Output_merge_base::input_sections_begin,
620 Output_merge_base::input_sections_end,
621 Output_merge_base::do_set_keeps_input_sections): New method definitions.
622 (Output_merge_base::bool keeps_input_sections_,
623 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
624 Output_merge_base::input_sections_): New data members.
625 (Output_merge_data::do_set_keeps_input_sections): New method
626 defintion.
627 (Output_merge_string::do_set_keeps_input_sections): Ditto.
628 * output.cc (Output_section::Input_section::relobj): Move method
629 defintion from class declaration to here and handle merge sections.
630 (Output_section::Input_section::shndx): Ditto.
631 (Output_section::Output_section): Remove initializations of removed
632 data members and initialize new data member LOOKUP_MAPS_.
633 (Output_section::add_input_section): Set keeps-input-sections flag
634 for a newly created merge output section as appropriate. Adjust code
635 to use Output_section_lookup_maps class.
636 (Output_section::add_relaxed_input_section): Adjst code for lookup
637 maps code refactoring.
638 (Output_section::add_merge_input_section): Add a new parameter
639 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
640 class. If adding input section to a newly created merge output
641 section fails, remove the new merge section.
642 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
643 Adjust code for use of the Output_section_lookup_maps class.
644 (Output_section::find_merge_section): Ditto.
645 (Output_section::build_lookup_maps): New method defintion.
646 (Output_section::find_relaxed_input_section): Adjust code to use
647 Output_section_lookup_maps class.
648 (Output_section::get_input_sections): Export merge sections. Adjust
649 code to use Output_section_lookup_maps class.
650 (Output_section:::add_script_input_section): Adjust code to use
651 Output_section_lookup_maps class. Update lookup maps for merge
652 sections also.
653 (Output_section::discard_states): Use Output_section_lookup_maps.
654 (Output_section::restore_states): Same.
655 * output.h (Merge_section_properties): Move class defintion out of
656 Output_section.
657 (Output_section_lookup_maps): New class.
658 (Output_section::Input_section::is_merge_section): New method
659 defintion.
660 (Output_section::Input_section::relobj): Move defintion out of class
661 defintion. Declare method only.
662 (Output_section::Input_section::shndx): Ditto.
663 (Output_section::Input_section::output_merge_base): New method defintion.
664 (Output_section::Input_section::u2_.pomb): New union field.
665 (Output_section::Merge_section_by_properties_map,
666 Output_section::Output_section_data_by_input_section_map,
667 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
668 Remove types.
669 (Output_section::add_merge_input_section): Add new parameter
670 KEEPS_INPUT_SECTIONS.
671 (Output_section::build_lookup_maps): New method declaration.
672 (Output_section::merge_section_map_,
673 Output_section::merge_section_by_properties_map_,
674 Output_section::relaxed_input_section_map_,
675 Output_section::is_relaxed_input_section_map_valid_): Remove data
676 members.
677 (Output_section::lookup_maps_): New data member.
678
679 2010-05-21 Doug Kwan <dougkwan@google.com>
680
681 PR gold/11619
682 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
683 avoid a compilation error.
684
685 2010-05-19 Rafael Espindola <espindola@google.com>
686
687 * script-sections.cc (Output_section_definition::allocate_to_segment):
688 Update the phdrs_list even when the output section is NULL.
689 * testsuite/Makefile.am: Add test.
690 * testsuite/Makefile.in: Regenerate.
691 * testsuite/script_test_9.cc: New.
692 * testsuite/script_test_9.sh: New.
693 * testsuite/script_test_9.t: New.
694
695 2010-05-19 Doug Kwan <dougkwan@google.com>
696
697 * arm.cc (Arm_input_section::original_size): New method.
698 (Arm_input_section::do_addralign): Add a cast.
699 (Arm_input_section::do_output_offset): Remove static cast.
700 (Arm_input_section::original_addralign,
701 Arm_input_section::original_size_): Change type to uint32_t.
702 (Arm_input_section::init): Add safe casts for section alignment
703 and size.
704 (Arm_input_section::set_final_data_size): Do not set address and
705 offset of stub table.
706 (Arm_output_section::fix_exidx_coverage): Change use of of
707 Output_section::Simple_input_section to that of
708 Output_section::Input_section.
709 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
710 except for the first pass.
711 * output.cc (Output_section::get_input_sections): Change type of
712 input_sections to std::list<Input_section>.
713 (Output_section::add_script_input_section): Rename from
714 Output_section::add_simple_input_section. Change type of SIS
715 parameter from Simple_input_section to Input_section.
716 * output.h (Output_section::Simple_input_section): Remove class.
717 (Output_section::Input_section): Change class visibility to public.
718 (Output_section::Input_section::addralign): Use stored alignments
719 for special input sections if set.
720 (Output_section::Input_section::set_addralign): New method.
721 (Output_section::get_input_sections): Change parameter type from
722 list of Simple_input_section to list of Input_section.
723 (Output_section::add_script_input_section): Rename from
724 Output_section::add_simple_input_section. Change first parameter's
725 type from Simple_input_section to Input_section and remove the
726 second and third parameters.
727 * script-sections.cc (Input_section::Input_section_list): Change
728 type to list of Output_section::Input_section/
729 (Input_section_info::Input_section_info): Change parameter type of
730 INPUT_SECTION to Output_section::Input_section.
731 (Input_section_info::input_section): Change return type.
732 (Input_section_info::input_section_): Change type to
733 Output_section::Input_section.
734 (Output_section_element_input::set_section_addresses): Adjust code
735 to use Output_section::Input_section instead of
736 Output_section::Simple_input_section. Adjust code for renaming
737 of Output_section::add_simple_input_section.
738 (Orphan_output_section::set_section_addresses): Ditto.
739
740 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
741
742 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
743 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
744
745 2010-05-18 Rafael Espindola <espindola@google.com>
746
747 * options.cc (General_options::finalize): Handle -nostdlib.
748 * options.h (nostdlib): New option.
749 * script.cc (script_add_search_dir): Handle -nostdlib.
750
751 2010-05-12 Doug Kwan <dougkwan@google.com>
752
753 * arm.cc (Target_arm::do_finalize_sections): Create an empty
754 attributes section only if there no attributes section after merging.
755 (Target_arm::merge_object_attributes): Move value of
756 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
757 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
758 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
759 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
760 and arm_attr_merge_7.stdout.
761 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
762 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
763 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
764 arm_attr_merge_7b.o): New rules.
765 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
766 arm_attr_merge_7
767 * testsuite/Makefile.in: Regenerate.
768 * testsuite/arm_attr_merge.sh: New file.
769 * testsuite/arm_attr_merge_[67][ab].s: Same.
770
771 2010-05-05 Nick Clifton <nickc@redhat.com>
772
773 * po/es.po: Updated Spanish translation.
774
775 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
776
777 * Makefile.am (install-exec-local): Properly install gold as
778 default cross linker.
779 * Makefile.in: Regenerated.
780
781 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
782 Nick Clifton <nickc@redhat.com>
783
784 * configure.ac (install_as_default): Define and set to false
785 unless --enable-gold or --enable-gold=both/gold has been
786 specified.
787 * configure: Regenerate.
788
789 * Makefile.am (install-exec-local): Install the executable as
790 'ld.gold'. If install_as_default is true then also install it as
791 'ld'.
792 * Makefile.in: Regenerated.
793
794 2010-04-24 Ian Lance Taylor <iant@google.com>
795
796 * layout.cc (Layout::layout_reloc): In relocatable link don't
797 combine reloc sections for grouped sections.
798
799 2010-04-23 Sriraman Tallam <tmsriram@google.com>
800
801 * gc.h (gc_process_relocs): Pass information on relocs pointing to
802 sections that are not ordinary to icf.
803 * icf.cc (get_section_contents): Handle relocation pointing to section
804 with no object or shndx information.
805 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
806 * testsuite/Makefile.in: Regenerate.
807 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
808 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
809
810 2010-04-22 Ian Lance Taylor <iant@google.com>
811
812 * expression.cc (Expression::Expression_eval_info): Add
813 result_alignment_pointer field.
814 (Expression::eval_with_dot): Add result_alignment_pointer
815 parameter. Change all callers.
816 (Expression::eval_maybe_dot): Likewise.
817 (class Binary_expression): Add alignment_pointer parameter to
818 left_value and right_value. Change all callers.
819 (BINARY_EXPRESSION): Set result alignment.
820 (class Trinary_expression): Add alignment_pointer parameter to
821 arg2_value and arg3_value. Change all callers.
822 (Trinary_cond::value): Set result alignment.
823 (Max_expression::value, Min_expression::value): Likewise.
824 (Align_expression::value): Likewise.
825 * script-sections.cc (class Sections_element): Add dot_alignment
826 parameter to set_section_addresses virtual function. Update
827 instantiations.
828 (class Output_section_element): Likewise.
829 (Script_sections::create_segments): Add dot_alignment parameter.
830 Change all callers.
831 (Script_sections::create_segments_from_phdrs_clause): Likewise.
832 (Script_sections::set_phdrs_clause_addresses): Likewise.
833 * script-sections.h: Update declarations.
834 * script.h: Update declarations.
835 * output.h (Output_segment::set_minimum_p_align): Don't decrease
836 min_p_align.
837 * testsuite/script_test_3.t: Set large alignment.
838 * testsuite/script_test_3.sh: Make sure that at least one LOAD
839 segment has expected alignment.
840
841 2010-04-22 Nick Clifton <nickc@redhat.com>
842
843 * po/gold.pot: Updated by the Translation project.
844 * po/vi.po: Updated Vietnamese translation.
845
846 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
847
848 * testsuite/Makefile.am (check_PROGRAMS): Add
849 icf_virtual_function_folding_test.
850 * testsuite/Makefile.in: Regenerated.
851
852 2010-04-15 Andrew Haley <aph@redhat.com>
853
854 * options.h (merge_exidx_entries): New option.
855 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
856 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
857 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
858 (Target_arm::merge_exidx_entries): New function.
859 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
860 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
861 to Arm_exidx_fixup constructor.
862 Add new arg, merge_exidx_entries.
863 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
864 Arm_output_section::fix_exidx_coverage.
865
866 2010-04-18 Sriraman Tallam <tmsriram@google.com>
867
868 * icf.cc (get_section_contents): Check for preemptible functions.
869 Ignore addend when appropriate.
870 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
871 section folded.
872 (add_from_relobj): Check for section folded.
873 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
874 * symtab.h (should_add_dynsym_entry): Add new parameter.
875 * target-reloc.h (scan_relocs): Check for section folded.
876 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
877 Check reloc types for function pointers in shared objects.
878 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
879 case.
880 (icf_preemptible_functions_test): New test case.
881 (icf_string_merge_test): New test case.
882 * testsuite.Makefile.in: Regenerate.
883 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
884 bar_glob. Refactor code.
885 * testsuite/icf_preemptible_functions_test.cc: New file.
886 * testsuite/icf_preemptible_functions_test.sh: New file.
887 * testsuite/icf_string_merge_test.cc: New file.
888 * testsuite/icf_string_merge_test.sh: New file.
889 * testsuite/icf_virtual_function_folding_test.cc: New file.
890 * testsuite/icf_virtual_function_folding_test.sh: New file.
891
892 2010-04-14 Doug Kwan <dougkwan@google.com>
893
894 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
895 for local symbol recounting if we remove a section due to ICF.
896 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
897 there are no regular objects in input.
898
899 2010-04-13 Doug Kwan <dougkwan@google.com>
900
901 * arm.cc (Arm_input_section::set_final_data_size): Compute
902 accurate final data size instead of using current data size.
903
904 2010-04-09 Doug Kwan <dougkwan@google.com>
905
906 * layout.cc (Layout::choose_output_section): Handle script section
907 types.
908 (Layout::make_output_section_for_script): Add section type parameter.
909 Handle script section types.
910 * layout.h (Layout::make_output_section_for_script): Add section
911 type parameter.
912 * output.cc (Output_section::Output_section): Initialize data member
913 is_noload_.
914 (Output_section::do_reset_address_and_file_offset): Do not set address
915 to 0 if section is a NOLOAD section.
916 * output.h (Output_section::is_noload): New method.
917 (Output_section::set_is_noload): Ditto.
918 (Output_section::is_noload_): New data member.
919 * script-c.h (Script_section_type): New enum type.
920 (struct Parser_output_section_header): Add new file section_type.
921 * script-sections.cc (Sections_element::output_section_name): Add
922 parameter for returning script section type.
923 (Output_section_definition::output_section_name): Ditto.
924 (Output_section_definition::section_type)P; New method.
925 (Output_section_definiton::script_section_type_name): Ditto.
926 (Output_section_definition::script_section_type_): New data member.
927 (Output_section_definition::Output_section_definition): Initialize
928 data member Output_section_definition::script_section_type_.
929 (Output_section_definition::create_sections): Pass script section type
930 to Layout::make_output_section_for_script.
931 (Output_section_definition::output_section_name): Return script
932 section type to caller.
933 (Output_section_definition::set_section_address): Do not advance
934 dot value and load address if section type is NOLOAD. Set address
935 of NOLOAD sections regardless of section flags.
936 (Output_section_definition::print): Print section type if it is
937 not SCRIPT_SECTION_TYPE_NONE.
938 (Output_section_definition::section_type): New method.
939 (Output_section_definition::script_section_type_name): Ditto.
940 (Script_sections::output_section_name): Add new parameter
941 PSECTION_TYPE for returning script section type. Pass it to
942 section elements. Handle discard sections.
943 (Sort_output_sections::operator()): Handle NOLOAD sections.
944 * script-sections.h (Script_sections::Section_type): New enum type.
945 (Script_sections::output_section_name): Add a new parameter for
946 returning script section type.
947 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
948 INFO and NOLOAD.
949 * yyscript.y (union): Add new field SECTION_TYPE.
950 (COPY, DSECT, INFO, NOLOAD): New tokens.
951 (opt_address_and_section_type): Change type to output_section_header.
952 (section_type): New non-terminal
953 (section_header): Handle section type.
954 (opt_address_and_section_type): Return section type value.
955
956 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
957
958 * testsuite/plugin_common_test_1.c (foo): Add prototype.
959 * testsuite/plugin_common_test_2.c (foo): Likewise.
960
961 2010-04-08 Doug Kwan <dougkwan@google.com>
962
963 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
964 Output_merge_data.
965 * output.cc (Output_section::add_merge_input_section): Simplify
966 code and return status of Output_merge_base::add_input_section.
967 Update merge section map only if Output_merge_base::add_input_section
968 returns true.
969
970 2010-04-07 Doug Kwan <dougkwan@google.com>
971
972 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
973 if section is marked as containing instructions but has no mapping
974 symbols.
975 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
976 correct section index.
977 (Arm_relobj::find_linked_text_section): Ditto.
978
979 2010-04-07 Cary Coutant <ccoutant@google.com>
980
981 * archive.cc (include_member): Destroy Read_symbols_data object before
982 releasing file.
983 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
984 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
985 (Read_symbols_data::~Read_symbols_data) New destructor.
986 (Section_relocs::Section_relocs) New constructor.
987 (Section_relocs::~Section_relocs) New destructor.
988 (Read_relocs_data::Read_relocs_data) New constructor.
989 (Read_relocs_data::~Read_relocs_data) New destructor.
990 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
991 pointers to NULL after deleting.
992
993 2010-04-07 Doug Kwan <dougkwan@google.com>
994
995 * arm.cc: Replace "endianity" with "endianness" in comments.
996 (Arm_exidx_cantunwind): Ditto.
997 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
998 (Arm_relobj::merge_flags_and_attributes): New method.
999 (Arm_relobj::merge_flags_and_attributes_): New data member.
1000 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
1001 (Arm_relobj::scan_sections_for_stubs): Ditto.
1002 (Arm_relobj::do_read_symbols): Check to see if we really want to
1003 merge processor-specific flags and attributes. Exit early if
1004 an object is empty except for section names and the undefined symbol.
1005 (Target_arm::do_finalize_sections): Move check for ELF format to
1006 Arm_relobj::do_read_symbols. Merge processor specific flags and
1007 attributes from a regular object only when we have determined that
1008 it is aapropriate. Do not create an .ARM.attributes section in
1009 output if there is no regular input object.
1010 (Target_arm::merge_processor_specific_flags): Check
1011 --warn-mismatch before printing any error.
1012 (Target_arm::merge_object_attributes): Ditto.
1013 * gold.cc (queue_middle_tasks): Handle the case in which there is
1014 no regular object in input.
1015 * options.cc (General_options::parse_EB): New method.
1016 (General_options::parse_EL): Same.
1017 (General_options::General_options): Initialize endianness_.
1018 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
1019 New options.
1020 (General_options::Endianness): New enum.
1021 (General_options::endianness): New method.
1022 (General_options::endianness_): New data member.
1023 * parameters.cc (Parameters::set_options): Check target endianness.
1024 (Parameters::set_target_once): Ditto.
1025 (Parameters::check_target_endianness): New method.
1026 (parameters_force_valid_target): If either -EL or -EB is specified,
1027 use it to define endianness of default target.
1028 * parameters.h (Parameters::check_target_endianness): New method
1029 declaration.
1030 * target.h (class Target): Change "endianity" to "endianness"
1031 in comments.
1032
1033 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
1034
1035 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
1036 * configure: Regenerate.
1037 * Makefile.in: Regenerate.
1038 * testsuite/Makefile.in: Regenerate.
1039
1040 2010-04-06 Cary Coutant <ccoutant@google.com>
1041
1042 gcc PR lto/42757
1043 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
1044 prevailing definitions of common symbols.
1045 * testsuite/plugin_test_6.sh: New test case.
1046 * testsuite/plugin_common_test_1.c: New test case.
1047 * testsuite/plugin_common_test_2.c: New test case.
1048 * testsuite/Makefile.am (plugin_test_6): New test case.
1049 * testsuite/Makefile.in: Regenerate.
1050
1051 2010-04-06 Nick Clifton <nickc@redhat.com>
1052
1053 * po/vi.po: New Vietnamese translation.
1054
1055 2010-03-30 Doug Kwan <dougkwan@google.com>
1056
1057 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
1058
1059 2010-03-25 Doug Kwan <dougkwan@google.com>
1060
1061 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
1062 to avoid a conversion warning on a 32-bit host.
1063
1064 2010-03-24 Ian Lance Taylor <iant@google.com>
1065
1066 * testsuite/script_test_3.t: Add a TLS segment.
1067 * testsuite/Makefile.am (check_PROGRAMS): Add
1068 tls_phdrs_script_test.
1069 (tls_phdrs_script_test_SOURCES): Define.
1070 (tls_phdrs_script_test_DEPENDENCIES): Define.
1071 (tls_phdrs_script_test_LDFLAGS): Define.
1072 (tls_phdrs_script_test_LDADD): Define.
1073 * testsuite/Makefile.in: Rebuild.
1074
1075 2010-03-23 Cary Coutant <ccoutant@google.com>
1076
1077 * fileread.cc (find_or_make_view): Fix comment.
1078
1079 2010-03-23 Ian Lance Taylor <iant@google.com>
1080
1081 * script-sections.cc (class Orphan_section_placement): Define
1082 PLACE_TLS and PLACE_TLS_BSS.
1083 (Orphan_section_placement::Orphan_section_placement): Initialize
1084 new places.
1085 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
1086 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
1087 (tls_script_test_SOURCES): Define.
1088 (tls_script_test_DEPENDENCIES): Define.
1089 (tls_script_test_LDFLAGS): Define.
1090 (tls_script_test_LDADD): Define.
1091 * testsuite/Makefile.in: Rebuild.
1092
1093 2010-03-22 Doug Kwan <dougkwan@google.com>
1094
1095 * arm.cc (Arm_relocate_functions::abs8,
1096 Arm_relocate_functions::abs16): Use correct check for overflow
1097 specified in the ARM ELF specs.
1098 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
1099 target of a BLX instruction specially.
1100 (Reloc_stub::stub_type_for_reloc): Ditto.
1101 (Relocate::relocate): Use symbolic names instead of numeric relocation
1102 codes to report error.
1103 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
1104 workaround.
1105 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
1106 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
1107 thumb2_blx_out_of_range.stdout
1108 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
1109 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
1110 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
1111 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
1112 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
1113 thumb2_blx_in_range, thumb2_blx_in_range.o,
1114 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
1115 thumb2_blx_out_of_range.o): New rules.
1116 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
1117 thumb2_blx_in_range and thumb2_blx_out_of_range.
1118 * testsuite/Makefile.in: Regenerate.
1119 * arm_branch_in_range.sh: Add tests for THUMB BLX.
1120 * testsuite/thumb_blx_in_range.s: New file.
1121 * testsuite/thumb_blx_out_of_range.s: New file.
1122
1123 2010-03-22 Rafael Espindola <espindola@google.com>
1124
1125 * archive.cc (Should_include): Move to archive.h.
1126 (should_include_member): Make it a member of Archive.
1127 (Lib_group): New.
1128 (Add_lib_group_symbols): New.
1129 * archive.h: Include options.h.
1130 (Archive_member): Moved from Archive.
1131 (Should_include): Moved from archive.cc.
1132 (Lib_group): New.
1133 (Add_lib_group_symbols): New.
1134 * dynobj.cc (do_should_include_member): New.
1135 * dynobj.h (do_should_include_member): New.
1136 * gold.cc (queue_initial_tasks): Update call to queue.
1137 * main.cc (main): Print lib group stats.
1138 * object.cc (do_should_include_member): New.
1139 * object.h: Include archive.h.
1140 (Object::should_include_member): New.
1141 (Object::do_should_include_member): New.
1142 (Sized_relobj::do_should_include_member): New.
1143 * options.cc (General_options::parse_start_lib): New.
1144 (General_options::parse_end_lib): New.
1145 (Input_arguments::add_file): Handle lib groups.
1146 (Input_arguments::start_group): Check we are not in a lib.
1147 (Input_arguments::start_lib): New.
1148 (Input_arguments::end_lib): New.
1149 * options.h (General_options): Add start_lib and end_lib.
1150 (Input_argument::lib_): New.
1151 (Input_argument::lib): New.
1152 (Input_argument::is_lib): New.
1153 (Input_file_lib): New.
1154 (Input_arguments::in_lib_): New.
1155 (Input_arguments::in_lib): New.
1156 (Input_arguments::start_lib): New.
1157 (Input_arguments::end_lib_): New.
1158 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
1159 in unused members as preempted.
1160 (Sized_pluginobj::do_should_include_member): New.
1161 * plugin.h (Sized_pluginobj::do_should_include_member): New.
1162 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
1163 return the blocker.
1164 (Read_symbols::do_whole_lib_group): New.
1165 (Read_symbols::do_lib_group): New.
1166 (Read_symbols::do_read_symbols): Handle lib groups.
1167 (Read_symbols::get_name): Handle lib groups.
1168 * readsyms.h (Read_symbols): Add an archive member pointer.
1169 (Read_symbols::do_whole_lib_group): New.
1170 (Read_symbols::do_lib_group): New.
1171 (Read_symbols::member_): New.
1172 * script.cc (read_input_script): Update call to queue_soon.
1173
1174 2010-03-19 Doug Kwan <dougkwan@google.com>
1175
1176 * arm.cc (Stub_table::Stub_table): Initialize new data members
1177 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1178 (Stub_table::add_reloc_stub): Assign stub offset and update
1179 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
1180 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
1181 New data members.
1182 (Stub_table::update_data_size_and_addralign): Use
1183 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
1184 instead of going over all reloc stubs.
1185 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
1186 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1187 Stringpool_template::offset_ to size of Stringpool_char.
1188 (Stringpool_template::new_key_offset): Remove code to initialize
1189 Stringpool_template::offset_.
1190 * stringpool.h (Stringpool_template::set_no_zero_null): Set
1191 Stringpool_template::offset_ to zero.
1192
1193 2010-03-15 Doug Kwan <dougkwan@google.com>
1194
1195 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
1196 offset_.
1197 (Stringpool_template::new_key_offset): New method.
1198 (Stringpool_template::add_string): Assign offsets when adding new
1199 strings.
1200 (Stringpool_template::set_string_offsets): Do not set string offsets
1201 when not optimizing.
1202 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
1203 member size_.
1204 (Chunked_vector::clear): Clear size_.
1205 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
1206 (Chunked_vector::size): Return size_.
1207 (Chunked_vector::push_back): Use size_ to find insert position.
1208 (Chunked_vector::size_): New data member.
1209 (Stringpool_template::set_no_zero_null): Assert string set is empty.
1210 (Stringpool_template::new_key_offset): New method declaration.
1211 (Stringpool_template::offset_): New data member.
1212
1213 2010-03-15 Rafael Espindola <espindola@google.com>
1214
1215 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
1216 Add_symbols' constructor.
1217 * readsyms.h (Add_symbols): Remove the input_group member.
1218
1219 2010-03-10 Ian Lance Taylor <iant@google.com>
1220
1221 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
1222 target to ask whether a reference to a symbol requires a stack
1223 split.
1224 * target.h (Target::is_call_to_non_split): New function.
1225 (Target::do_is_call_to_non_split): Declare virtual function.
1226 * target.cc: Include "symtab.h".
1227 (Target::do_is_call_to_non_split): New function.
1228 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
1229
1230 2010-03-10 Cary Coutant <ccoutant@google.com>
1231
1232 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
1233 (File_read::open[1]): Remove initial mapping of whole_file_view_.
1234 (File_read::open[2]): Add whole_file_view_ to list of views.
1235 (File_read::make_view): Remove test of whole_file_view_.
1236 (File_read::find_or_make_view): Create whole_file_view_ if
1237 necessary.
1238 (File_read::clear_views): Replace bool parameter with enum;
1239 adjust all callers. Don't delete views with permanent data;
1240 do delete cached views and views from archives if
1241 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
1242 if clearing the corresponding view.
1243 * fileread.h (File_read::Clear_views_mode): New enum.
1244 (File_read::View::is_permanent_view): New method.
1245 (File_read::clear_views): Replace bool parameter
1246 with enum; adjust all callers.
1247 * options.h (General_options): Change keep_files_mapped option;
1248 add map_whole_files.
1249 * readsyms.cc (Add_symbols::run): Delete sd_ object before
1250 releasing the file.
1251 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
1252 the file.
1253
1254 2010-03-10 David S. Miller <davem@davemloft.net>
1255
1256 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
1257
1258 2010-03-09 Sriraman Tallam <tmsriram@google.com>
1259
1260 * icf.cc (get_section_contents): Add '@' marker after processing the
1261 merge reloc.
1262
1263 2010-03-08 Doug Kwan <dougkwan@google.com>
1264
1265 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
1266 due to a conversion warning.
1267 (Arm_relobj::update_output_local_symbol_count): Check for local
1268 symbol with unset output index.
1269
1270 2010-03-05 Ian Lance Taylor <iant@google.com>
1271
1272 * options.h (class General_options): Add --spare-dynamic-tags.
1273 * output.cc (Output_data_dynamic::set_final_data_size): Implement
1274 --spare-dynamic-tags.
1275
1276 2010-03-05 Ian Lance Taylor <iant@google.com>
1277
1278 * incremental.cc: Include "libiberty.h".
1279
1280 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
1281
1282 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
1283 function, is_info_ member.
1284 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
1285 (Versions::Versions): Update caller.
1286 (Versions::define_base_version): Likewise.
1287 (Versions::add_def): Likewise.
1288
1289 2010-03-03 Sriraman Tallam <tmsriram@google.com>
1290
1291 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
1292 (Scan::possible_function_pointer_reloc): New function.
1293 (Scan::local_reloc_may_be_function_pointer): Change to call
1294 possible_function_pointer_reloc.
1295 (Scan::global_reloc_may_be_function_pointer): Ditto.
1296 * icf.h (Icf::check_section_for_function_pointers): Change to reject
1297 relocations in ".data.rel.ro._ZTV" section.
1298 * testsuite/icf_safe_so_test.sh: Change to pass i386.
1299 * testsuite/icf_safe_so_test.cc: Ditto.
1300 * testsuite/icf_safe_test.cc: Ditto.
1301 * testsuite/icf_safe_test.sh: Ditto.
1302
1303 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1304 Ian Lance Taylor <iant@google.com>
1305
1306 * target-reloc.h (relocate_section): Check the symbol table index
1307 for -1U before setting the local symbol index.
1308 (scan_relocatable_relocs): If copying the relocation, record that
1309 the local symbol is required.
1310 * object.h (Symbol_value::is_output_symtab_index_set): New
1311 function.
1312 (Symbol_value::may_be_discarded_from_output_symtab): New
1313 function.
1314 (Symbol_value::has_output_symtab_entry): New function.
1315 (Symbol_value::needs_output_symtab_entry): Remove.
1316 (Symbol_value::output_symtab_index): Make sure the symbol index is
1317 set.
1318 (Symbol_value::set_output_symtab_index): Make sure the symbol
1319 index is not set. Make sure the new index is valid.
1320 (Symbol_value::set_must_have_output_symtab_entry): New function.
1321 (Symbol_value::has_output_dynsym_entry): New function.
1322 (Symbol_value::set_output_dynsym_index): Make sure the new index
1323 is valid.
1324 (Sized_relobj::set_must_have_output_symtab_entry): New function.
1325 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
1326 local symbol if permitted.
1327 (Sized_relobj::do_finalize_local_symbols): Call
1328 is_output_symtab_index_set rather than needs_output_symtab_entry.
1329 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
1330 rather than needs_output_symtab_entry. Call
1331 has_output_dynsym_entry rather than needs_output_dynsym_entry.
1332 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
1333 is_output_symtab_index_set rather than needs_output_symtab_entry.
1334 * testsuite/discard_locals_relocatable_test.c: New file.
1335 * testsuite/discard_locals_test.sh: Test -r.
1336 * testsuite/Makefile.am (check_DATA): Add
1337 discard_locals_relocatable_test1.syms,
1338 discard_local_relocatable_test2.syms.
1339 (MOSTLYCLEANFILES): Likewise. Also add
1340 discard_locals_relocatable_test1.lout and
1341 discard_locals_relocatable_test2.out.
1342 (discard_locals_relocatable_test1.syms): New target.
1343 (discard_locals_relocatable_test.o): New target.
1344 (discard_locals_relocatable_test1.out): New target.
1345 (discard_locals_relocatable_test2.syms): New target.
1346 (discard_locals_relocatable_test2.out): New target.
1347 (various): Add missing ../ld-new dependencies.
1348 * testsuite/Makefile.in: Rebuild.
1349
1350 2010-03-03 Nick Clifton <nickc@redhat.com>
1351
1352 * po/fi.po: New Finnish translation.
1353
1354 2010-03-01 Doug Kwan <dougkwan@google.com>
1355
1356 * layout.cc (Layout::Layout): Force section types of .init_array*,
1357 .preinit_array* and .fini_array* sections.
1358 * output.cc (Output_section::Input_section_sort_entry::has_priority):
1359 Fix check of return value of std::string::find.().
1360 (Output_section::Input_section_sort_compare::operator()): Remove
1361 comment about .init_array.
1362 (Output_section::Input_section_sort_init_fini_compare::operator()):
1363 New method.
1364 (Output_section::sort_attached_input_sections): Handle .init_array
1365 and .fini_array specially.
1366 * output.h (Output_section::Inut_section_sort_compare): Update
1367 comment.
1368 (Output_section::Input_section_sort_init_fini_compare): New struct.
1369
1370 2010-02-26 Doug Kwan <dougkwan@google.com>
1371
1372 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
1373 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
1374 * testsuite/debug_msg.sh: Avoid matching source line number for
1375 use of global variable undef_int.
1376
1377 2010-02-26 Doug Kwan <dougkwan@google.com>
1378
1379 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
1380 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
1381 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
1382 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
1383 * options.cc (General_options::General_options): Initialize member
1384 fix_v4bx_.
1385 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
1386 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
1387 and rm_no_fix_v4bx.stdout
1388 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
1389 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
1390 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
1391 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
1392 and arm_no_fix_v4bx.
1393 * Makefile.in: Regenerate.
1394 * testsuite/arm_fix_v4bx.s: New file.
1395 * testsuite/arm_fix_v4bx.sh: Ditto.
1396
1397 2010-02-24 Doug Kwan <dougkwan@google.com>
1398
1399 * arm.cc (Target_arm::got_section): Make the .got section the first
1400 non RELRO section in the data segment.
1401 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
1402 suffixes of section names.
1403
1404 2010-02-24 Doug Kwan <dougkwan@google.com>
1405
1406 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
1407 flags and attributes merging if an input file is a binary file.
1408 * fileread.cc (Input_file::open): Record format of original file.
1409 * fileread.h (Input_file::Format): New enum type.
1410 (Input_file::Input_file): Initialize data member format_.
1411 (Input_file::format): New method definition.
1412 (Input_file::format_):: New data member.
1413
1414 2010-02-24 Doug Kwan <dougkwan@google.com>
1415
1416 * arm.cc (Arm_output_data_got): New class.
1417 (ARM_TCB_SIZE): New constant
1418 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
1419 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
1420 If user uses a script with a SECTIONS clause, issue only a warning
1421 for a misplaced EXIDX input section. Otherwise, issue an error.
1422 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
1423 garbage collection.
1424 (Target_arm::got_mode_index_entry): Handle static linking.
1425 (Target_arm::Scan::local): Ditto.
1426 (Target_arm::Scan::global): Ditto.
1427 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
1428 all incorrectly implemented relocations.
1429 (Target_arm::fix_exidx_coverage): Pass layout to
1430 Arm_output_section::fix_exidx_coverage.
1431 * layout.cc (Layout::section_name_mapping): Remove trailing dots
1432 from ".ARM.exidx." and ".ARM.extab.".
1433
1434 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1435
1436 * arm.cc (Target_arm::do_finalize_sections): Create attribute
1437 section if it does not already exist.
1438 * attributes.cc (Attributes_section_data::Attributes_section_data):
1439 Don't crash if size is zero.
1440
1441 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1442 Ian Lance Taylor <iant@google.com>
1443
1444 * gold.cc (queue_middle_tasks): If no input files were opened,
1445 exit.
1446 * workqueue.h (Task_function::Task_function): Assert that there is
1447 a blocker.
1448
1449 2010-02-22 Doug Kwan <dougkwan@google.com>
1450
1451 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
1452 * icf.cc (get_section_contents): Cast snprintf arguments to long long
1453 types to avoid warnings due to different uint64_t implementations
1454 on different hosts.
1455
1456 2010-02-21 Doug Kwan <dougkwan@google.com>
1457
1458 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
1459 handling of the maximum backward branch offset.
1460 (Arm_relocate_functions::thumb_branch_common): Ditto.
1461 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
1462 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
1463 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
1464 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
1465 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
1466 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
1467 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
1468 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
1469 thumb_bl_out_of_range thumb_bl_out_of_range.o,
1470 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
1471 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
1472 thumb2_bl_out_of_range.o): New rules.
1473 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
1474 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
1475 thumb2_bl_out_of_range
1476 * testsuite/Makefile.in: Regenerate.
1477 * testsuite/arm_bl_in_range.s: New file.
1478 * testsuite/arm_bl_out_of_range.s: Ditto.
1479 * testsuite/arm_branch_in_range.sh: Ditto.
1480 * testsuite/arm_branch_range.t: Ditto.
1481 * testsuite/thumb2_branch_range.t: Ditto.
1482 * testsuite/thumb_bl_in_range.s: Ditto.
1483 * testsuite/thumb_bl_out_of_range.s: Ditto.
1484 * testsuite/thumb_branch_range.t: Ditto.
1485
1486 2010-02-20 Sriraman Tallam <tmsriram@google.com>
1487
1488 * gc.h (gc_process_relocs): Change vectors to point to the new list.
1489 Add reloc offset information.
1490 * icf.cc (get_section_contents): Change iterators to point to the new
1491 vectors. Add reloc offset information to the contents.
1492 * icf.h (Icf::Sections_reachable_info): New typedef.
1493 (Icf::Sections_reachable_list): New typedef.
1494 (Icf::Offset_info): New typedef.
1495 (Icf::Reloc_info): New struct typedef.
1496 (Icf::Reloc_info_list): New typedef.
1497 (Icf::symbol_reloc_list): Delete method.
1498 (Icf::addend_reloc_list): Delete method.
1499 (Icf::section_reloc_list): Delete method.
1500 (Icf::reloc_info_list): New method.
1501 (Icf::reloc_info_list_): New member.
1502
1503 2010-02-19 Doug Kwan <dougkwan@google.com>
1504
1505 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
1506 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
1507 * arm.cc (Arm_relocation_functions): New forward declaration.
1508 (Target_arm::Target_arm): Initialize new data members
1509 got_mod_index_offset_ and tls_base_symbol_defined_.
1510 (Target_arm::Relocate::relocate_tls): New method.
1511 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
1512 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
1513 New methods.
1514 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
1515 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
1516 (Target_arm::got_mod_index_offset_,
1517 Target_arm::tls_base_symbol_defined_): New data members.
1518 (Target_arm::Scan::local, Target::Scan::global,
1519 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
1520 relocations.
1521
1522 2010-02-18 Doug Kwan <dougkwan@google.com>
1523
1524 * arm.cc (Arm_relobj::find_linked_text_section): New method.
1525 (Arm_relobj::make_exidx_input_section): Pass section index of linked
1526 text section as a parameter becuase some broken tools may not set
1527 the link in section header.
1528 (Target_arm::has_got_section): New method.
1529 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
1530 without any mapping symbol as data only. Remove warning.
1531 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
1532 link in its section header, try to discover the link by inspecting the
1533 REL31 relocation at the beginning of the section.
1534 (Target_arm::Scan::check_non_pic): Report name of offending relocation
1535 in error message.
1536 (Target_arm::Scan::global): Treat any reference to the symbol
1537 _GLOBAL_OFFSET_TABLE_ as a GOT access.
1538
1539 2010-02-12 Sriraman Tallam <tmsriram@google.com>
1540
1541 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
1542 (Scan::global_reloc_may_be_function_pointer): New function.
1543 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1544 (Scan::global_reloc_may_be_function_pointer): New function.
1545 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
1546 (Scan::global_reloc_may_be_function_pointer): New function.
1547 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
1548 (Scan::global_reloc_may_be_function_pointer): New function.
1549 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
1550 (Scan::global_reloc_may_be_function_pointer): New function.
1551 (Scan::possible_function_pointer_reloc): New function.
1552 (Target_x86_64::can_check_for_function_pointers): New function.
1553 * gc.h (gc_process_relocs): Scan relocation types to determine if
1554 function pointers were taken for targets that support it.
1555 * icf.cc (Icf::find_identical_sections): Include functions for
1556 folding in safe ICF whose pointer is not taken.
1557 * icf.h (Secn_fptr_taken_set): New typedef.
1558 (fptr_section_id_): New member.
1559 (section_has_function_pointers): New function.
1560 (set_section_has_function_pointers): New function.
1561 (check_section_for_function_pointers): New function.
1562 * options.h: Fix comment for safe ICF option.
1563 * target.h (can_check_for_function_pointers): New function.
1564 * testsuite/Makefile.am: Add icf_safe_so_test test case.
1565 Modify icf_safe_test for X86-64.
1566 * testsuite/Makefile.in: Regenerate.
1567 * testsuite/icf_safe_so_test.cc: New file.
1568 * testsuite/icf_safe_so_test.sh: New file.
1569 * testsuite/icf_safe_test.cc (kept_func_3): New function.
1570 (main): Change to take pointer to function kept_func_3.
1571 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
1572 folding is done correctly for X86-64.
1573
1574 2010-02-12 David S. Miller <davem@davemloft.net>
1575
1576 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
1577 is_symbolless parameter.
1578 (Output_reloc<SHT_REL>::is_symbolless): New.
1579 (Output_reloc<SHT_REL>::is_symbolless_): New.
1580 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
1581 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
1582 (Output_reloc<SHT_RELA>::is_symbolless): New.
1583 (Output_data_reloc::add_global): Handle is_symbolless.
1584 (Output_data_reloc::add_global_relative): Likewise.
1585 (Output_data_reloc::add_local): Likewise.
1586 (Output_data_reloc::add_local_relative): Likewise.
1587 (Output_data_reloc::add_symbolless_global_addend): New.
1588 (Output_data_reloc::add_symbolless_local_addend): New.
1589 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
1590 is_symbolless.
1591 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
1592 instead of ->is_relative_
1593 (Output_reloc::write): Likewise.
1594 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
1595 (Output_reloc::write_rel): Simplify.
1596
1597 * sparc.cc (Target_sparc::Scan::local): Use
1598 ->add_symbolless_local_addend as needed.
1599 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
1600 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
1601 based upon relocation offset.
1602
1603 2010-02-11 Doug Kwan <dougkwan@google.com>
1604
1605 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
1606 (Target_arm::Scan::global): Ditto. Also remove a comment before the
1607 beginning of function.
1608 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
1609 and MOVT_ABS relocations. Those are non issued in scanning. Fix
1610 parameter is_32bit in calls to should_apply_static_reloc.
1611 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
1612 (check_DATA): Add arm_abs_global.stdout.
1613 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
1614 arm_abs_global.stdout): New rules.
1615 (MOSTLLYCLEANFILES): Add arm_abs_global
1616 * Makefile.in: Regenerate.
1617 * testsuite/arm_abs_global.s: New file.
1618 * testsuite/arm_abs_global.sh: Ditto.
1619 * testsuite/arm_abs_lib.s: Ditto.
1620
1621 2010-02-11 Ian Lance Taylor <iant@google.com>
1622
1623 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
1624 Read_relocs task.
1625 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
1626 Allocate_commons_task first.
1627 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
1628 task, rather than symtab_lock_.
1629 (Gc_process_relocs::~Gc_process_relocs): New function.
1630 (Gc_process_relocs::is_runnable): Check this_blocker_.
1631 (Gc_process_relocs::locks): Use next_blocker_ rather than
1632 blocker_.
1633 (Scan_relocs::~Scan_relocs): New function.
1634 (Scan_relocs::is_runnable): Check this_blocker_ rather than
1635 symtab_lock_.
1636 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
1637 next_blocker_.
1638 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
1639 fields. Add this_blocker_ and next_blocker_ fields. Adjust
1640 constructor accordingly.
1641 (class Gc_process_relocs): Likewise.
1642 (class Scan_relocs): Likewise.
1643 * common.h (class Allocate_commons_task): Remove symtab_lock_
1644 field, and corresponding constructor parameter.
1645 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
1646 symtab_lock_.
1647 (Allocate_commons_task::locks): Likewise.
1648
1649 2010-02-11 Ian Lance Taylor <iant@google.com>
1650
1651 * gold-threads.h (class Once): Define.
1652 (class Initialize_lock): Rewrite as child of Once.
1653 * gold-threads.cc (class Once_initialize): Define.
1654 (once_pointer_control): New static variable.
1655 (once_pointer, once_arg): New static variables.
1656 (c_run_once): New static function.
1657 (Once::Once, Once::run_once, Once::internal_run): New functions.
1658 (class Initialize_lock_once): Remove.
1659 (initialize_lock_control): Remove.
1660 (initialize_lock_pointer): Remove.
1661 (initialize_lock_once): Remove.
1662 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
1663 (Initialize_lock::initialize): Rewrite.
1664 (Initialize_lock::do_run_once): New function.
1665 * archive.cc (Archive::interpret_header): Only clear name if it is
1666 not already empty.
1667 * fileread.cc: Include "gold-threads.h"
1668 (file_counts_lock): New static variable.
1669 (file_counts_initialize_lock): Likewise.
1670 (File_read::release): Only increment counts when using --stats.
1671 Use a lock around the increment.
1672 * parameters.cc (class Set_parameters_target_once): Define.
1673 (set_parameters_target_once): New static variable.
1674 (Parameters::Parameters): Move here from parameters.h.
1675 (Parameters::set_target): Rewrite.
1676 (Parameters::set_target_once): New function.
1677 (Parameters::clear_target): Move here and rewrite.
1678 * parameters.h (class Parameters): Update declarations. Add
1679 set_parameters_target_once_ field.
1680 (Parameters::Parameters): Move to parameters.cc.
1681 (Parameters::clear_target): Likewise.
1682 * readsyms.cc (Read_symbols::do_group): Create a Start_group
1683 task.
1684 (Start_group::~Start_group): New function.
1685 (Start_group::is_runnable): New function.
1686 (Start_group::locks, Start_group::run): New functions.
1687 (Finish_group::run): Change saw_undefined to size_t.
1688 * readsyms.h (class Start_group): Define.
1689 (class Finish_group): Change saw_undefined_ field to size_t.
1690 (Finish_group::Finish_group): Remove saw_undefined and
1691 this_blocker parameters. Change all callers.
1692 (Finish_group::set_saw_undefined): New function.
1693 (Finish_group::set_blocker): New function.
1694 * symtab.h (class Symbol_table): Change saw_undefined to return
1695 size_t. Change saw_undefined_ field to size_t.
1696 * target-select.cc (Set_target_once::do_run_once): New function.
1697 (Target_selector::Target_selector): Initialize set_target_once_
1698 field. Don't initialize lock_ and initialize_lock_ fields.
1699 (Target_selector::instantiate_target): Rewrite.
1700 (Target_selector::set_target): New function.
1701 * target-select.h (class Set_target_once): Define.
1702 (class Target_selector): Update declarations. Make
1703 Set_target_once a friend. Remove lock_ and initialize_lock_
1704 fields. Add set_target_once_ field.
1705
1706 2010-02-10 Ian Lance Taylor <iant@google.com>
1707
1708 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
1709 queueing any tasks.
1710 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
1711 (queue_middle_tasks): Add all blockers before queueing any tasks.
1712 (queue_final_tasks): Likewise.
1713 * token.h (Task_token::add_blockers): New function.
1714 * object.h (Input_objects::number_of_relobjs): New function.
1715
1716 2010-02-10 Ian Lance Taylor <iant@google.com>
1717
1718 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
1719 shared, not if not position independent.
1720 * x86_64.cc (Relocate::relocate_tls): Likewise.
1721 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
1722 (tls_pie_pic_test): New target.
1723 * testsuite/Makefile.in: Rebuild.
1724
1725 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
1726 (tls_test_main_pie.o, tls_test_pie.o): New targets.
1727 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
1728 * testsuite/Makefile.in: Rebuild.
1729
1730 2010-02-09 David S. Miller <davem@davemloft.net>
1731
1732 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
1733 R_SPARC_RELATIVE using ->add_local_relative().
1734 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
1735
1736 * output.h (Output_data_dynamic::add_section_size): New method
1737 that takes two Output_data objects.
1738 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
1739 entry param. Handle it in initializers.
1740 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
1741 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
1742 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
1743 arg.
1744 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
1745 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
1746 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
1747 for dynrel_includes_plt.
1748 * i386.cc (Target_i386::do_finalize_sections): Likewise.
1749 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1750 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
1751 before .rela.plt
1752 (Target_sparc::do_finalize_sections): Update to pass true for
1753 dynrel_includes_plt.
1754 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
1755 output before .rela.plt
1756 (Target_powerpc::do_finalize_sections): Update to pass true for
1757 dynrel_includes_plt when 32-bit.
1758
1759 2010-02-08 Doug Kwan <dougkwan@google.com>
1760
1761 * arm.cc (Arm_relobj::simple_input_section_output_address): New
1762 method.
1763 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
1764 Arm_relobj::scan_section_for_cortex_a8_stubs,
1765 Arm_relobj::do_relocation_section): Instead of calling
1766 Output_section::output_address, use faster
1767 Arm_relobj::simple_input_section_output_address.
1768
1769 2010-02-08 David S. Miller <davem@davemloft.net>
1770
1771 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
1772 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
1773 relocation helper function.
1774
1775 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
1776 just like R_SPARC_GOT{10,13,22}.
1777 (Target_sparc::Scan::local): Likewise.
1778 (Target_sparc::Relocate:relocate): Likewise.
1779
1780 2010-02-06 Ian Lance Taylor <iant@google.com>
1781
1782 * configure.ac: Rewrite targetobjs duplicate removal code to use
1783 only shell constructs.
1784 * configure: Rebuild.
1785
1786 2010-02-05 Doug Kwan <dougkwan@google.com>
1787
1788 PR 11247
1789 * arm.cc (Arm_relobj::section_is_scannable): New method.
1790 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
1791 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
1792
1793 2010-02-04 Doug Kwan <dougkwan@google.com>
1794
1795 PR 11247
1796 * arm-reloc-property.cc (cstdio): Include.
1797 * configure.ac (targetobjs): Remove duplicates.
1798 * configure: Regenerate.
1799 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
1800 big and little endian version for a given address size.
1801
1802 2010-02-03 Doug Kwan <dougkwan@google.com>
1803
1804 * arm-reloc-property.cc
1805 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1806 definition.
1807 * arm-reloc-property.h
1808 (Arm_reloc_property_table::get_implemented_static_reloc_property):
1809 New method definition.
1810 (Arm_reloc_property_table::reloc_name_in_error_message): New method
1811 declaration.
1812 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
1813 overflow to N.
1814 (GOT_PREL): Change implemented to Y.
1815 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
1816 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
1817 (Arm_relocate_functions::movw_abs_nc): Remove method.
1818 (Arm_relocate_functions::movt_abs): Ditto.
1819 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
1820 (Arm_relocate_functions::thm_movt_abs): Ditto.
1821 (Arm_relocate_functions::movw_rel_nc): Ditto.
1822 (Arm_relocate_functions::movw_rel): Ditto.
1823 (Arm_relocate_functions::movt_rel): Ditto.
1824 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
1825 (Arm_relocate_functions:thm_movw_rel): Ditto.
1826 (Arm_relocate_functions:thm_movt_rel): Ditto.
1827 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
1828 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
1829 New method definitions.
1830 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
1831 (Arm_relocation_functions::arm_grp_ldr): Ditto.
1832 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
1833 (Arm_relocation_functions::arm_grp_ldc): Ditto.
1834 (Target_arm::Relocate::relocate): Check for non-static or
1835 unimplemented relocation code and exit early. Change calls to
1836 Target_arm::reloc_uses_thumb_bit and
1837 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
1838 instead. Refactor code to handle similar relocations to increase
1839 code sharing. Remove check for unsupported relocation code in switch
1840 statement.
1841 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
1842 relocation property table to find out size. Change error message to
1843 print out the name of a relocation code instead of the numeric value.
1844 (Target_arm::scan_reloc_for_stub): Use relocation property table
1845 instead of calling Target_arm::reloc_uses_thumb_bit().
1846
1847 2010-02-02 Doug Kwan <dougkwan@google.com>
1848
1849 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
1850 types of relaxed input section.
1851
1852 2010-02-02 Doug Kwan <dougkwan@google.com>
1853
1854 * Makefile.am (HFILES): Add arm-reloc-property.h.
1855 (DEFFILES): New.
1856 (TARGETSOURCES): Add arm-reloc-property.cc
1857 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
1858 (libgold_a_SOURCES): $(DEFFILES)
1859 * Makefile.in: Regenerate.
1860 * arm-reloc-property.cc: New file.
1861 * arm-reloc-property.h: New file.
1862 * arm-reloc.def: New file.
1863 * arm.cc: Update comments.
1864 (arm-reloc-property.h): New included header.
1865 (arm_reloc_property_table): New global variable.
1866 (Target_arm::do_select_as_default_target): New method definition.
1867 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
1868 arm-reloc-property to targ_extra_obj.
1869 * parameters.cc (set_parameters_target): Call
1870 Target::select_as_default_target().
1871 * target.h (Target::select_as_default_target): New method definition.
1872 (Target::do_select_as_default_target): Same.
1873
1874 2010-02-01 Doug Kwan <dougkwan@google.com>
1875
1876 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
1877 first_output_text_section_.
1878 (Arm_exidx_fixup::first_output_text_section): New method definition.
1879 (Arm_exidx_fixup::first_output_text_section_): New data member.
1880 (Arm_exidx_fixup::process_exidx_section): Record the first text
1881 output section seen.
1882 (Arm_output_section::fix_exidx_coverage): Set correct linked section
1883 and entsize in output section header.
1884
1885 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1886
1887 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
1888 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
1889 (Arm_relocate_functions::thm_alu11): New Method.
1890 (Arm_relocate_functions::thm_pc8): New Method.
1891 (Arm_relocate_functions::thm_pc12): New Method.
1892 (Target_arm::Scan::local): Handle the relocations.
1893 (Target_arm::Scan::global): Likewise.
1894 (Target_arm::Relocate::relocate): Likewise.
1895 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
1896
1897 2010-01-29 Doug Kwan <dougkwan@google.com>
1898
1899 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
1900 of relocation types as ld.
1901
1902 2010-01-29 Doug Kwan <dougkwan@google.com>
1903
1904 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
1905 to public.
1906 (Arm_relocate_functions::thumb_branch_common): Ditto.
1907 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
1908 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
1909 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
1910 Arm_relocate_functions::jump24): Remove.
1911 (Target_arm::Relocate::relocate): Adjust code to call
1912 Arm_relocation_functions::arm_branch_common and
1913 Arm_relocation_functions::thumb_branch_common instead of their removed
1914 wrappers. Merge switch-cases together to reduce source code size.
1915
1916 2010-01-29 Doug Kwan <dougkwan@google.com>
1917
1918 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
1919 output_local_symbol_count_needs_update_.
1920 (Arm_relobj::output_local_symbol_count_needs_update,
1921 Arm_relobj::set_output_local_symbol_count_needs_update,
1922 Arm_relobj::update_output_local_symbol_count): New methods.
1923 (Arm_relobj::output_local_symbol_count_needs_update_): New data
1924 member.
1925 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
1926 of pointed function as in a R_ARM_PREL31 relocation.
1927 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
1928 for output local symbol count updating.
1929 (Target_arm::do_relax): Update output local symbol counts in objects
1930 if necessary.
1931 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
1932
1933 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1934
1935 * arm.cc: Added support for the ARM relocations:
1936 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
1937 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
1938 (Arm_relocate_functions::movw_rel_nc): Renamed (was
1939 movw_prel_nc).
1940 (Arm_relocate_functions::movw_rel): New method.
1941 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
1942 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
1943 thm_movw_prel_nc).
1944 (Arm_relocate_functions::thm_movw_rel): New method.
1945 (Arm_relocate_functions::thm_movt_rel): Renamed (was
1946 thm_movt_prel).
1947 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
1948 relocations.
1949 (Target_arm::Scan::global): Likewise.
1950 (Target_arm::Relocate::relocate): Likewise.
1951 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1952 Likewise.
1953
1954 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1955
1956 * arm.cc: Added support for ARM group relocations.
1957 (Target_arm::reloc_needs_sym_origin): New method.
1958 (Arm_relocate_functions::calc_grp_kn): New method.
1959 (Arm_relocate_functions::calc_grp_residual): New method.
1960 (Arm_relocate_functions::calc_grp_gn): New method.
1961 (Arm_relocate_functions::arm_grp_alu): New Method.
1962 (Arm_relocate_functions::arm_grp_ldr): New Method.
1963 (Arm_relocate_functions::arm_grp_ldrs): New Method.
1964 (Arm_relocate_functions::arm_grp_ldc): New Method.
1965 (Target_arm::Scan::local): Handle the ARM group relocations.
1966 (Target_arm::Scan::global): Likewise.
1967 (Target_arm::Relocate::relocate): Likewise.
1968 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
1969 Likewise.
1970
1971 2010-01-26 Doug Kwan <dougkwan@google.com>
1972
1973 * arm.cc (set): Include.
1974 (class Arm_exidx_fixup): Change type of last_input_section_ to const
1975 pointer type.
1976 (Arm_output_section::Text_section_list): New type.
1977 (Arm_output_section::append_text_sections_to_list): New method.
1978 (Arm_output_section::fix_exidx_coverage): Ditto.
1979 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
1980 (Arm_relobj::convert_input_section_to_relaxed_section): Use
1981 Relobj::set_section_offset() instead of
1982 Sized_relobj::invalidate_section_offset().
1983 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
1984 parameter for section headers. Ignore relocation sections for
1985 unallocated sections and EXIDX sections.
1986 (Target_arm::fix_exidx_coverage): New method.
1987 (Target_arm::output_section_address_less_than): New type.
1988 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
1989 linked text section instead of the EXIDX section.
1990 (Arm_output_section::create_stub_group): Add an assertion to check
1991 that this is not an EXIDX output section.
1992 (Arm_output_section::append_text_sections_to_list): New method.
1993 (Arm_output_section::fix_exidx_coverage): Ditto.
1994 (Arm_relobj::scan_sections_for_stubs): Adjust call to
1995 Arm_relobj::section_needs_reloc_stub_scanning.
1996 (Target_arm::do_relax): Fix EXIDX output section coverage in the
1997 first pass.
1998 (Target_arm::fix_exidx_coverage): New method.
1999 * object.h (Relobj::set_output_section): New method.
2000 (Sized_relobj::invalidate_section_offset): Remove method.
2001 (Sized_relobj::do_invalidate_section_offset): Remove method.
2002 (Sized_relobj::do_set_section_offset): Handle offset value -1.
2003
2004 2010-01-25 Doug Kwan <dougkwan@google.com>
2005
2006 * arm.cc (Arm_exidx_merged_section::do_output_offset):
2007 Fix warning due to signed and unsigned comparison on a 32-bit host.
2008
2009 2010-01-22 Doug Kwan <dougkwan@google.com>
2010
2011 * arm.cc (Target_arm::do_relax): Record an output section for section
2012 offset adjustment it contains any stub table that has changed.
2013 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
2014 offsets in an output section if necessary.
2015 * output.cc (Output_section::Output_section): Initialize
2016 section_offsets_need_adjustments_.
2017 (Output_section::add_input_section_for_script): Renamed to
2018 Output_section::add_simple_input_section.
2019 (Output_section::save_states): Add a comment.
2020 (Output_section::discard_states): New method defintion.
2021 (Output_section::adjust_section_offsets): Same.
2022 * output.h (Output_section::add_input_section_for_script): Renamed to
2023 Output_section::add_simple_input_section.
2024 (Output_section::discard_states): New method declaration.
2025 (Output_section::adjust_section_offsets): Same.
2026 (Output_section::section_offsets_need_adjustment,
2027 Output_section::set_section_offsets_need_adjustment): New method
2028 definitions.
2029 (Output_section::section_offsets_need_adjustment_): New data member.
2030 * script-sections.cc
2031 (Output_section_element_input::set_section_address): Adjust code for
2032 renaming of Output_section::add_input_section_for_script.
2033 (Orphan_output_section::set_section_address): Same.
2034
2035 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2036
2037 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
2038 Fix_v4bx enum values .
2039 * gold/options.h (General_options): New option definitions.
2040 (General_options::fix_v4bx): New method.
2041 (General_options::Fix_v4bx): New enum.
2042 * gold/options.cc (General_options::parse_fix_v4bx): New method.
2043 (General_options::parse_fix_v4bx_interworking): New method.
2044
2045 2010-01-22 Doug Kwan <dougkwan@google.com>
2046
2047 * arm.cc (Arm_exidx_fixup): New class.
2048
2049 2010-01-21 Doug Kwan <dougkwan@google.com>
2050
2051 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
2052 classes.
2053 (Arm_exidx_section_offset_map): New type.
2054
2055 2010-01-21 Doug Kwan <dougkwan@google.com>
2056
2057 * arm.cc (Arm_exidx_input_section): New class.
2058 (Arm_relobj::exidx_input_section_by_link,
2059 Arm_relobj::exidx_input_section_by_shndx,
2060 Arm_relobj::make_exidx_input_section): New methods.
2061 (read_arm_attributes_section): Remove.
2062 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
2063 information about them.
2064 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
2065 to here.
2066
2067 2010-01-20 Doug Kwan <dougkwan@google.com>
2068
2069 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
2070 Input_section_specifier to Section_id.
2071 (Target_arm::new_arm_input_section: Adjust code for change of key
2072 type.
2073 (Target_arm::find_arm_input_section): Ditto.
2074 * gc.h (object.h): Include for Section_id nand Section_id_hash.
2075 (Section_id): Remove.
2076 (Garbage_collection::Section_id_hash): Remove.
2077 * icf.h (object.h): Include for Section_id nand Section_id_hash.
2078 (Section_id): Remove.
2079 (Icf::Section_id_hash): Remove.
2080 * object.h (Section_id, Const_section_id, Section_id_hash,
2081 Const_section_id_hash): New type definitions.
2082 * output.cc (Output_section::add_relaxed_input_section): Change to
2083 use Const_section_id instead of Input_section_specifier as key type.
2084 (Output_section::add_merge_input_section): Ditto.
2085 (Output_section::build_relaxation_map): Change to use Section_id
2086 instead of Input_section_specifier as key type.
2087 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
2088 Ditto.
2089 (Output_section::convert_input_sections_to_relaxed_sections): Change
2090 to use Const_section_id instead of Input_section_specifier as key type.
2091 (Output_section::find_merge_section): Ditto.
2092 (Output_section::find_relaxed_input_section): Ditto.
2093 * output.h (Input_section_specifier): Remove class.
2094 (Output_section::Output_section_data_by_input_section_map): Change
2095 key type to Const_section_id.
2096 (Output_section::Output_relaxed_input_section_by_input_section_map):
2097 Ditto.
2098 (Output_section::Relaxation_map): Change key type to Section_id.
2099
2100 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2101
2102 * gold/arm.cc: Added support for R_ARM_V4BX relocation
2103 (class Arm_v4bx_stub): New class.
2104 (DEF_STUBS): Updated definition to support v4_veneer_bx.
2105 (Stub_factory::make_arm_v4bx_stub): New method.
2106 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
2107 (Stub_table::empty): Handle v4bx stubs.
2108 (Stub_table::add_arm_v4bx_stub): New method.
2109 (Stub_table::find_arm_v4bx_stub): New method.
2110 (Arm_relocate_functions::v4bx): New method.
2111 (Target_arm::fix_v4bx): New method.
2112 (Target_arm::Target_arm): Handle R_ARM_V4BX.
2113 (Stub_table::relocate_stubs): Likewise.
2114 (Stub_table::do_write): Likewise.
2115 (Stub_table::update_data_size_and_addralign): Likewise.
2116 (Stub_table::finalize_stubs): Likewise.
2117 (Target_arm::Scan::local): Likewise.
2118 (Target_arm::Scan::global): Likewise.
2119 (Target_arm::do_finalize_sections): Likewise.
2120 (Target_arm::Relocate::relocate): Likewise.
2121 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2122 Likewise.
2123 (Target_arm::scan_reloc_for_stub): Likewise.
2124 (Target_arm::scan_reloc_section_for_stubs): Likewise.
2125
2126 2010-01-19 Ian Lance Taylor <iant@google.com>
2127
2128 * output.cc (Output_section_headers::do_sized_write): Write large
2129 segment count to sh_info field.
2130 (Output_file_header::do_sized_write): For large segment count,
2131 write PN_XNUM to e_phnum field.
2132
2133 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2134
2135 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
2136 (Arm_relocate_functions::thm_jump8): New function.
2137 (Arm_relocate_functions::thm_jump11): New function.
2138 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
2139 R_ARM_THM_JUMP11.
2140 (Target_arm::Scan::global): Likewise.
2141 (Target_arm::Relocate::relocate): Likewise.
2142 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
2143 Likewise.
2144
2145 2010-01-14 Doug Kwan <dougkwan@google.com>
2146
2147 * arm.cc (map, utility): Include headers.
2148 (Target_arm::apply_cortex_a8_workaround): New method.
2149 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
2150 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
2151 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
2152 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
2153 the --[no-]fix-cortex-a8 command line options.
2154 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
2155 (Target_arm::relocate_stub): Use addend in instruction template.
2156 * options.h (DEFINE_bool): Set the user-set flag.
2157 (General_options): Add --[no-]-fix-cortex options.
2158 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
2159 : Update fast look-up map after conversion.
2160
2161 2010-01-14 Sriraman Tallam <tmsriram@google.com>
2162
2163 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
2164 in the first pass of do_layout.
2165
2166 2010-01-13 Doug Kwan <dougkwan@google.com>
2167
2168 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2169 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
2170 apparent compiler problem of not folding static constant integral
2171 data members of elfcpp::Elf_sizes<32>.
2172
2173 2010-01-13 Doug Kwan <dougkwan@google.com>
2174
2175 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
2176 Arm_relobj::section_needs_cortex_a8_stub_scanning,
2177 Arm_relobj::scan_section_for_cortex_a8_erratum,
2178 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
2179 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
2180 sections to scan for relocation stubs into a new method
2181 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
2182 relocation and Cortex-A8 stub scanning.
2183 (Target_arm::do_relax): Force stubs to be after stubbed sections
2184 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
2185 the beginning of a new relaxation pass. Update a comment.
2186 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
2187
2188 2010-01-12 Ian Lance Taylor <iant@google.com>
2189
2190 * target-reloc.h (visibility_error): New inline function.
2191 (relocate_section): Call visibility_error.
2192 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
2193 (MOSTLYCLEANFILES): Likewise.
2194 (protected_4_pic.o, protected_3.err): New targets.
2195 * testsuite/protected_4.cc: New file.
2196
2197 2010-01-12 Doug Kwan <dougkwan@google.com>
2198
2199 * arm.cc (Cortex_a8_reloc): New class.
2200 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
2201 and cortex_a8_relocs_info_.
2202 (Target_arm::fix_cortex_a8): New method definition.
2203 (Target_arm::Cortex_a8_relocs_info): New type.
2204 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
2205 New data member declarations.
2206 (Target_arm::scan_reloc_for_stub): Record information about
2207 relocations for THUMB branches that might be exempted from the
2208 Cortex-A8 workaround.
2209 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
2210 at the beginning of a relaxation pass.
2211
2212 2010-01-12 Doug Kwan <dougkwan@google.com>
2213
2214 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
2215 (Arm_relobj::Mapping_symbol_position,
2216 Arm_reloj::Mapping_symbol_position_less,
2217 Arm_relobj::Mapping_symbols_info): New types.
2218 (Target_arm::is_mapping_symbol_name): New method definition.
2219 (Arm_relobj::do_count_local_symbols): Save information about mapping
2220 symbols.
2221
2222 2010-01-11 Doug Kwan <dougkwan@google.com>
2223
2224 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
2225 Arm_relocate_functions::thumb32_branch_upper,
2226 Arm_relocate_functions::thumb32_branch_lower,
2227 Arm_relocate_functions::thumb32_cond_branch_offset,
2228 Arm_relocate_functions::thumb32_cond_branch_upper,
2229 Arm_relocate_functions::thumb32_cond_branch_lower,
2230 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
2231 branch offset encoding.
2232 (Arm_relocate_functions::thumb_branch_common): Use new branch
2233 offset encoding methods to avoid code duplication.
2234 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
2235 (Stub_addend_reader::operator()): Use new branch encoding method
2236 to avoid code duplication.
2237
2238 2010-01-11 Doug Kwan <dougkwan@google.com>
2239
2240 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
2241 (Target_arm::do_finalize_sections): Define special EXIDX section
2242 symbols only if referenced.
2243 * gc.h (Garbage_collection::add_reference): New method.
2244 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
2245 code duplication.
2246
2247 2010-01-11 Ian Lance Taylor <iant@google.com>
2248
2249 * script.cc (Version_script_info::build_expression_list_lookup):
2250 Change complaing about duplicate wildcard match from error to
2251 warning.
2252
2253 * script.cc (class Lazy_demangler): Recreate--revert part of patch
2254 of 2009-12-30.
2255 (Version_script_info::Version_script_info): Initialize globs_,
2256 default_version_, default_is_global_, and exact_. Don't
2257 initialize globals_ or locals_.
2258 (Version_script_info::build_lookup_tables): Build local symbols
2259 first.
2260 (Version_script_info::unquote): New function.
2261 (Version_script_info::add_exact_match): New function.
2262 (Version_script_info::build_expression_list_lookup): Remove lookup
2263 parameter. Add is_global parameter. Change all callers. Handle
2264 wildcard pattern specially. Unquote pattern. Call
2265 add_exact_match.
2266 (Version_script_info::get_name_to_match): New function.
2267 (Version_script_info::get_symbol_version): New function.
2268 (Version_script_info::get_symbol_version_helper): Remove.
2269 (Version_script_info::check_unmatched_names): Call unquote.
2270 * script.h (class Version_script_info): Change get_symbol_version
2271 to be non-inline and add is_global parameter; change all callers.
2272 Rewrite symbol_is_local. Update declarations. Define struct
2273 Version_tree_match, Exact, Globs. Don't define struct Lookup.
2274 Remove globals_ and locals_ members. Add exact_, globs_,
2275 default_version_, is_global_.
2276 (Version_script_info::Glob): Remove pattern, add expression and
2277 is_global. Update constructor. Change all callers.
2278 * dynobj.cc (Versions::finalize): Mark the version symbol as the
2279 default version.
2280 (Versions::symbol_section_contents): If a symbol is undefined, or
2281 defined in a dynamic object, set the version index to
2282 VER_NDX_LOCAL.
2283 * symtab.cc (Symbol_table::add_from_relobj): Don't call
2284 symbol_is_local.
2285 (Symbol_table::add_from_pluginobj): Likewise.
2286 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
2287
2288 2010-01-11 Doug Kwan <dougkwan@google.com>
2289
2290 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
2291 (incremental_dump_LDADD): Add linking option for libintl.
2292 * Makefile.in: Regenerate.
2293
2294 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
2295
2296 PR gold/11144
2297 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
2298 instead of -Ds.
2299 * testsuite/Makefile.in: Regenerated.
2300
2301 2010-01-10 Doug Kwan <dougkwan@google.com>
2302
2303 * options.h (DEFINE_var): Use parentheses around argument varname__
2304 in macro body to avoid any unintended subsequent substitutions.
2305
2306 2010-01-10 Ian Lance Taylor <iant@google.com>
2307
2308 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
2309 candidates before doing symbol resolution.
2310
2311 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
2312 ODR candidates if only one is weak.
2313
2314 2010-01-08 Ian Lance Taylor <iant@google.com>
2315
2316 * script.cc (Version_script_info::build_expression_list_lookup):
2317 Don't warn about ambiguous version, just record the ambiguity.
2318 (Version_script_info::get_symbol_version_helper): Give error if
2319 version is ambiguous.
2320
2321 2010-01-08 Doug Kwan <dougkwan@google.com>
2322
2323 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
2324 prev_data_size_ and prev_addralign_. Remove initializer for
2325 deleted data member has_been_changed_.
2326 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
2327 to determine if the table is empty.
2328 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
2329 Remove.
2330 (Stub_table::add_reloc_stub): Define method in class definition
2331 instead of just declaring it there.
2332 (Stub_table::add_cortex_a8_stub): New method definition.
2333 (Stub_table::update_data_size_and_addralign): Ditto.
2334 (Stub_table::finalize_stubs): Ditto.
2335 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
2336 (Stub_table::do_addralign_): Return address alignment in the
2337 (Stub_table::do_reset_address_and_file_offset): Define method in
2338 class definition instead of declaring it there. Set current data
2339 size to be the data size of the previous pass.
2340 (Stub_table::set_final_data_size): Use current data size as the
2341 final data size.
2342 (Stub_table::relocate_stub): Change parameter type of stub from
2343 Reloc_stub pointer to Stub pointer.
2344 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
2345 (Stub_table::Cortex_a8_stub_list): New typedef.
2346 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
2347 Stub_table::prev_addralign_): New data member.
2348 (Arm_relobj::Arm_relobj): Initialize data member
2349 section_has_cortex_a8_workaround_.
2350 (Arm_relobj::section_has_cortex_a8_workaround,
2351 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
2352 definitions.
2353 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
2354 declarations.
2355 (Target_arm::relocate_stub): Change parameter type of stub from
2356 Reloc_stub pointer to Stub pointer.
2357 (Insn_template::size, Insn_template::alignment): Handle
2358 THUMB16_SPECIAL_TYPE.
2359 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
2360 Stub_table::update_data_size_and_addralign,
2361 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
2362 definitions.
2363 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
2364 (Stub_table::do_write): Ditto.
2365 (Target_arm::do_relax): Adjust code for changes in Stub_table.
2366
2367 2010-01-08 Ian Lance Taylor <iant@google.com>
2368
2369 PR 11108
2370 * symtab.h (class Symbol): Remove fields is_target_special_ and
2371 has_plt_offset_. Add field is_defined_in_discarded_section_.
2372 (Symbol::is_defined_in_discarded_section): New function.
2373 (Symbol::set_is_defined_in_discarded_section): New function.
2374 (Symbol::has_plt_offset): Rewrite.
2375 (Symbol::set_plt_offset): Verify that new offset is not -1U.
2376 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
2377 Don't initialize is_target_special_ or has_plt_offset_.
2378 Initialize is_defined_in_discarded_section_.
2379 (Symbol_table::add_from_relobj): If appropriate, set
2380 is_defined_in_discarded_section.
2381 * resolve.cc (Symbol::override_base_with_special): Don't test
2382 is_target_special_. Change has_plt_offset_ to has_plt_offset().
2383 * target-reloc.h (relocate_section): Do special handling for
2384 symbols defined in discarded sections for global symbols as well
2385 as local symbols.
2386
2387 2010-01-08 Ian Lance Taylor <iant@google.com>
2388
2389 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
2390 the SHT_SYMTAB case.
2391
2392 2010-01-08 Ian Lance Taylor <iant@google.com>
2393
2394 * object.cc (Sized_relobj::do_layout): Don't get confused if
2395 layout_eh_frame returns NULL.
2396
2397 2010-01-08 Ian Lance Taylor <iant@google.com>
2398
2399 PR 11084
2400 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
2401 dynamic symbol table, use the normal symbol table.
2402 (Sized_dynobj::do_read_symbols): Remove assertion about type of
2403 symbol table.
2404
2405 2010-01-08 Ian Lance Taylor <iant@google.com>
2406
2407 PR 11072
2408 * layout.cc (Layout::include_section): Remove .gnu_debuglink
2409 sections.
2410
2411 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
2412
2413 * version.cc (print_version): Change to "Copyright 2010".
2414
2415 2010-01-08 Ian Lance Taylor <iant@google.com>
2416
2417 PR 10287
2418 PR 11063
2419 * i386.cc (class Target_i386): Change return type of plt_section
2420 to be non-const.
2421 (class Output_data_plt_i386): Add tls_desc_rel_ field.
2422 (Output_data_plt_i386::Output_data_plt_i386): Initialize
2423 tls_desc_rel_ field.
2424 (Output_data_plt_i386::rel_tls_desc): New function.
2425 (Target_i386::rel_tls_desc_section): New function.
2426 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
2427 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
2428 R_386_TLS_DESC reloc in rel_tls_desc_section.
2429 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
2430 Define struct Tlsdesc_info.
2431 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
2432 (Target_x86_64::do_reloc_symbol_index): New function.
2433 (Target_x86_64::add_tlsdesc_info): New function.
2434 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
2435 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
2436 tlsdesc_rel_ field.
2437 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
2438 all callers.
2439 (Output_data_plt_x86_64::rela_tlsdesc): New function.
2440 (Target_x86_64::rela_tlsdesc_section): New function.
2441 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
2442 handling.
2443 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
2444 (Target_x86_64::do_reloc_addend): New function.
2445 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
2446 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
2447 declarations. Define TARGET_CODE. Add arg field to u1_ union.
2448 (Output_reloc::type): New function.
2449 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
2450 (Output_reloc::is_target_specific): New function.
2451 (Output_reloc::target_arg): New function.
2452 (class Output_reloc) [SHT_RELA]: Add four new constructors for
2453 absolute relocs and target specific relocs.
2454 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
2455 add_target_specific.
2456 (class Output_data_reloc) [SHT_RELA]: Likewise.
2457 * output.cc (Output_reloc::Output_reloc): Add four new versions
2458 for absolute relocs and target specific relocs.
2459 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
2460 (Output_reloc::get_symbol_index): Likewise.
2461 (Output_reloc::local_section_offset): Check that local_sym_index_
2462 is not TARGET_CODE or 0.
2463 (Output_reloc::symbol_value): Likewise.
2464 (Output_reloc::write) [SHT_RELA]: Call target for target specific
2465 reloc.
2466 * target.h (class Target): Add reloc_symbol_index and reloc_addend
2467 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
2468 functions.
2469 * layout.cc (add_target_dynamic_tags): Use output section for
2470 DT_PLTRELSZ and DT_JMPREL.
2471
2472 2010-01-07 Ian Lance Taylor <iant@google.com>
2473
2474 PR 11061
2475 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
2476 function.
2477 (class Output_data_reloc_generic): Define.
2478 (class Output_data_reloc_base): Change base class to
2479 Output_data_reloc_generic. Change add() method to call
2480 bump_relative_reloc_count for a relative reloc. Remove
2481 sort_relocs_ field.
2482 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
2483 to sort_relocs().
2484 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
2485 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
2486 appropriate.
2487 * layout.h (class Layout): Update declaration.
2488
2489 2010-01-07 Ian Lance Taylor <iant@google.com>
2490
2491 * output.h (class Output_data): Add const version of
2492 output_section and do_output_section.
2493 (class Output_section_data): Add const version of
2494 do_output_section.
2495 (class Output_section): Likewise.
2496 * layout.cc (Layout::add_target_dynamic_tags): New function.
2497 * layout.h (class Layout): Update declarations.
2498 * arm.cc (Target_arm::do_finalize_sections): Use
2499 add_target_dynamic_tags.
2500 * i386.cc (Target_i386::do_finalize_sections): Likewise.
2501 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
2502 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
2503 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2504
2505 2010-01-07 Ian Lance Taylor <iant@google.com>
2506
2507 PR 11042
2508 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
2509 object as needed.
2510
2511 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
2512 Ian Lance Taylor <iant@google.com>
2513
2514 PR 11019
2515 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
2516 Xindex::read_symtab_xindex.
2517
2518 2010-01-07 Doug Kwan <dougkwan@google.com>
2519
2520 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
2521 (Insn_template::thumb16_bcond_insn): New method declaration.
2522 (Insn_template): Fix spelling.
2523 (Stub::thumb16_special): New method declaration.
2524 (Stub::do_write): Define virtual method which was previously pure
2525 virtual.
2526 (Stub::do_thumb16_special): New method declaration.
2527 (Stub::do_fixed_endian_write): New template member.
2528 (Reloc_stub::do_write): Remove.
2529 (Reloc_stub::do_fixed_endian_write): Remove.
2530 (Cortex_a8_stub): New class definition.
2531 (Stub_factory::make_cortex_a8_stub): New method definition.
2532 (Stub_factory::Stub_factory): Add missing static storage class
2533 qualifier for elf32_arm_stub_a8_veneer_blx.
2534
2535 2010-01-07 Ian Lance Taylor <iant@google.com>
2536
2537 PR 10980
2538 * options.h (class General_options): Add --warn-unresolved-symbols
2539 and --error-unresolved-symbols.
2540 * errors.cc (Errors::undefined_symbol): Implement
2541 --warn-unresolved-symbols.
2542
2543 * options.h (class General_options): Add -z text and -z textoff.
2544 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
2545
2546 2010-01-06 Sriraman Tallam <tmsriram@google.com>
2547
2548 * gc.h (Garbage_collection::Cident_section_map): New typedef.
2549 (Garbage_collection::cident_sections): New function.
2550 (Garbage_collection::add_cident_section): New function.
2551 (Garbage_collection::cident_sections_): New member.
2552 (gc_process_relocs): Add references to sections whose names are C
2553 identifiers.
2554 * gold.h (cident_section_start_prefix): New constant.
2555 (cident_section_stop_prefix): New constant.
2556 (is_cident): New function.
2557 * layout.cc (Layout::define_section_symbols): Replace string constants
2558 with the newly defined constants.
2559 * object.cc (Sized_relobj::do_layout): Track sections whose names are
2560 C identifiers.
2561 * testsuite/Makefile.am: Add gc_orphan_section_test.
2562 * testsuite/Makefile.in: Regenerate.
2563 * testsuite/gc_orphan_section_test.cc: New file.
2564 * testsuite/gc_orphan_section_test.sh: New file.
2565
2566 2010-01-06 Ian Lance Taylor <iant@google.com>
2567
2568 PR 10980
2569 * options.h (class General_options): Add --warn-shared-textrel.
2570 * layout.cc (Layout::finish_dynamic_section): Implement
2571 --warn-shared-textrel.
2572
2573 PR 10980
2574 * options.h (class General_options): Add --warn-multiple-gp.
2575
2576 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
2577
2578 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
2579 $(THREADSLIB) and $(LIBDL).
2580 * Makefile.in: Rebuild.
2581
2582 2010-01-06 Ian Lance Taylor <iant@google.com>
2583
2584 PR 10980
2585 * options.cc (General_options::parse_section_start): New function.
2586 (General_options::section_start): New function.
2587 (General_options::General_options): Initialize all members.
2588 * options.h: Include <map>
2589 (class General_options): Add --section-start. Add section_starts_
2590 member.
2591 * layout.cc (Layout::attach_allocated_section_to_segment): If
2592 --section-start was used, set the address of the segment. Remove
2593 local sort_sections.
2594 (Layout::relaxation_loop_body): If the address of the load segment
2595 has been set by --section-start, don't use it.
2596 * output.h (Output_segment::update_flags_for_output_section): New
2597 function.
2598 * output.cc (Output_segment::add_output_section): Call
2599 update_flags_for_output_section.
2600
2601 2010-01-05 Ian Lance Taylor <iant@google.com>
2602
2603 PR 10980
2604 * options.h (class General_options): Add --undefined-version.
2605 * script.cc (struct Version_expression): Add was_matched_by_symbol
2606 field.
2607 (Version_script_info::matched_symbol): New function.
2608 (Version_script_info::get_symbol_version_helper): Call
2609 matched_symbol.
2610 (Version_script_info::check_unmatched_names): New function.
2611 * script.h (class Version_script_info): Update declarations.
2612 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
2613
2614 * options.h (class General_options): Use DEFINE_bool_alias for
2615 allow_multiple_definition.
2616 * resolve.cc (Symbol_table::should_override): Don't test
2617 allow_multiple_definition.
2618
2619 PR 10980
2620 * options.h (class General_options): Add --cref.
2621 * main.cc (main): Print cref table if --cref. Don't close mapfile
2622 until after printing cref table.
2623 * cref.cc: Include "symtab.h".
2624 (class Cref_inputs): Define Cref_table_compare and Cref_table.
2625 (Cref_table_compare::operator()): New function.
2626 (Cref_inputs::gather_cref): New function.
2627 (filecol): New static const.
2628 (Cref_inputs::print_cref): New function.
2629 (Cref::print_cref): New function.
2630 * cref.h: Include <cstdio>.
2631 (class Cref): Update declarations.
2632 * mapfile.h (Mapfile::file): New function.
2633 * object.h (class Object): Define Symbols. Declare virtual
2634 do_get_global_symbols.
2635 (Object::get_global_symbols): New function.
2636 * object.cc (Input_objects::add_object): Pass object to cref_ if
2637 --cref.
2638 (Input_objects::archive_start): Likewise.
2639 (Input_objects::archive_stop): Likewise.
2640 (Input_objects::print_cref): New function.
2641 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
2642 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
2643 --cref.
2644 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
2645 function.
2646 * plugin.h (class Sized_pluginobj): Update declarations.
2647
2648 2010-01-05 Ian Lance Taylor <iant@google.com>
2649
2650 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
2651 to is_default_version. Rename insdef to insdefault.
2652 (Symbol_table::add_from_relobj): Rename def to is_default_version
2653 and local to is_forced_local.
2654 (Symbol_table::add_from_pluginobj): Likewise.
2655 (Symbol_table::add_from_dynobj): Likewise.
2656 (Symbol_table::define_special_symbol): Rename insdef to
2657 insdefault.
2658
2659 2010-01-04 Ian Lance Taylor <iant@google.com>
2660
2661 PR 10980
2662 * options.h (class General_options): Add
2663 --allow-multiple-definition and -z muldefs.
2664 * resolve.cc (Symbol_table::should_override): Don't warn about a
2665 multiple symbol definition if --allow-multiple-definition or -z
2666 muldefs.
2667
2668 PR 10980
2669 * options.h (class General_options): Add --add-needed and
2670 --copy-dt-needed-entries. Tweak --as-needed help entry.
2671 * object.cc (Input_objects::check_dynamic_dependencies): Give an
2672 error if --copy-dt-needed-entries aka --add-needed is used and
2673 would cause a change in behaviour.
2674
2675 PR 10980
2676 * options.h (class General_options): Add -G as a short version of
2677 --shared. Add no-op options -assert, -g, and -i.
2678
2679 2010-01-04 Sriraman Tallam <tmsriram@google.com>
2680
2681 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
2682 check for .text or .gnu.linkonce.t sections.
2683 * icf.cc (Icf::find_identical_sections): Ditto.
2684 Change the detection for mangled function name within the section
2685 name.
2686 * icf.h (is_section_foldable_candidate): New function.
2687
2688 2009-12-30 Ian Lance Taylor <iant@google.com>
2689
2690 PR 10980
2691 * options.h (class General_options): Permit two dashes with
2692 --retain-symbols-file.
2693
2694 2009-12-30 Ian Lance Taylor <iant@google.com>
2695
2696 PR 10979
2697 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
2698 don't put the file header and segment headers in the text
2699 segment.
2700
2701 PR 10979
2702 * common.cc (Sort_commons::operator()): Stabilize sort when both
2703 entries are NULL.
2704 (Symbol_table::do_allocate_commons_list): When allocating common
2705 symbols, skip a symbol which is no longer common.
2706 * symtab.h (Symbol::is_common): Test whether the symbol comes from
2707 an object before checking its type.
2708 * testsuite/common_test_2.c: New file.
2709 * testsuite/common_test_3.c: New file.
2710 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
2711 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
2712 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
2713 (common_test_2_pic.o, common_test_2.so): New targets.
2714 (common_test_3_pic.o, common_test_3.so): New targets.
2715 * testsuite/Makefile.in: Rebuild.
2716
2717 PR 10979
2718 * script.cc (read_input_script): If we see a new SECTIONS clause,
2719 and we have added an input section, give an error.
2720 * layout.h (class Layout): Add have_added_input_section function.
2721 Add have_added_input_section_ field.
2722 * layout.cc (Layout::Layout): Initialize
2723 have_added_input_section_.
2724 (Layout::layout): Set have_added_input_section_.
2725 (Layout::layout_eh_frame): Likewise.
2726
2727 2009-12-30 Ian Lance Taylor <iant@google.com>
2728
2729 PR 10931
2730 * options.h (class General_options): Add --sort-common option.
2731 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
2732 * common.cc (Sort_common): Add sort_order parameter to
2733 constructor. Add sort_order_ field.
2734 (Sort_commons::operator): Check sort_order_.
2735 (Symbol_table::allocate_commons): Determine the sort order.
2736 (Symbol_table::do_allocate_commons): Add sort_order parameter.
2737 Change all callers.
2738 (Symbol_table::do_allocate_commons_list): Likewise.
2739
2740 2009-12-30 Ian Lance Taylor <iant@google.com>
2741
2742 PR 10916
2743 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
2744 symbols from this object, don't change the visibility of an
2745 undefined symbol.
2746 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
2747
2748 2009-12-30 Ian Lance Taylor <iant@google.com>
2749
2750 PR 10861
2751 * script.h (class Version_script_info): Define Language enum.
2752 Update declarations. Define Glob, Exact, and Lookup types. Add
2753 new fields globals_, locals_, and is_finalized_.
2754 * script.cc: Various formatting fixes.
2755 (class Parser_closure): Change language_stack_ from a vector of
2756 std::string to one of Version_script_info::Language. Adjust all
2757 uses accordingly.
2758 (class Lazy_demangler): Remove.
2759 (struct Version_expression): Change language from std::string to
2760 Version_script_info::Language.
2761 (Version_script_info::Version_script_info): New function.
2762 (Version_script_info::~Version_script_info): Don't call clear.
2763 (Version_script_info::finalize): New function.
2764 (Version_script_info::build_lookup_tables): New function.
2765 (Version_script_info::build_expression_list_lookup): New
2766 function.
2767 (Version_script_info::get_symbol_version_helper): Rewrite to use
2768 lookup tables.
2769 (Version_script_info::print_expression_list): Adjust to use
2770 Version_script_info::Language.
2771 (script_push_lex_into_version_mode): Check that the version script
2772 has not been finalized.
2773 (version_script_push_lang): Change language string to
2774 Version_script_info::Language.
2775 * options.cc (Command_line::version_script): New function.
2776 * options.h (class General_options): Add finalize_dynamic_list
2777 function. Change version_script from declaration to definition.
2778 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
2779 * testsuite/version_script.map: Remove duplicate def of foo.
2780 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
2781 version_script.map.
2782 * testsuite/Makefile.in: Rebuild.
2783
2784 2009-12-30 Ian Lance Taylor <iant@google.com>
2785
2786 PR 10843
2787 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
2788 if the input symbol index is 0, make the output symbol index 0.
2789
2790 2009-12-30 Ian Lance Taylor <iant@google.com>
2791
2792 PR 10670
2793 * options.h (class General_options): Add -x/--discard-all.
2794 * object.cc (Sized_relobj::do_count_local_symbols): Handle
2795 --discard-all. If the local symbol needs a dynamic entry, check
2796 that before handling --discard-locals.
2797
2798 2009-12-30 Ian Lance Taylor <iant@google.com>
2799
2800 PR 10450
2801 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
2802 flags to PF_R.
2803 (Output_segment::add_output_section): Don't change the flags if
2804 the type is PT_TLS.
2805
2806 PR 10450
2807 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
2808 GNU hash table if they need a dynamic value. Otherwise, don't add
2809 them if they are defined in a dynamic object or are forced local.
2810
2811 2009-12-29 Ian Lance Taylor <iant@google.com>
2812
2813 PR 10450
2814 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
2815 .gnu.hash table for a 32-bit target.
2816
2817 PR 10450
2818 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
2819 regular and a dynamic object only needs a dynamic symbol table
2820 entry if it is externally visible.
2821
2822 PR 10450
2823 * i386.cc (class Target_i386): Initialize global_offset_table_ in
2824 constructor. Add global_offset_table_ field.
2825 (Target_i386::got_section): Set global_offset_table_.
2826 (Target_i386::do_finalize_sections): Set global_offset_table_
2827 size.
2828 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
2829 in constructor. Add global_offset_table_ field.
2830 (Target_x86_64::got_section): Set global_offset_table_.
2831 (Target_x86_64::do_finalize_sections): Set global_offset_table_
2832 size.
2833
2834 * layout.cc (Layout::Layout): Initialize increase_relro_.
2835 (Layout::get_output_section): Add is_relro, is_last_relro, and
2836 is_first_non_relro parameters. Change all callers.
2837 (Layout::choose_output_section): Likewise.
2838 (Layout::add_output_section_data): Likewise.
2839 (Layout::make_output_section): Likewise.
2840 (Layout::set_segment_offsets): Clear increase_relro when using a
2841 linker script.
2842 * layout.h (class Layout): Add increase_relro method. Add
2843 increase_relro_ field. Update declarations.
2844 * output.cc (Output_section::Output_section): Initialize
2845 is_last_relro_ and is_first_non_relro_.
2846 (Output_segment::add_output_section): Group relro sections is
2847 do_sort is true. Handle is_last_relro and is_first_non_relro.
2848 (Output_segment::maximum_alignment): Remove relro handling.
2849 (Output_segment::set_section_addresses): Add increase_relro
2850 parameter. Change all callers. Add initial alignment to align
2851 relro sections on separate page. Remove old relro handling.
2852 (Output_segment::set_section_list_addresses): Remove in_relro
2853 parameter. Change all callers.
2854 (Output_segment::set_offset): Add increase parameter. Change all
2855 callers. Remove old relro handling.
2856 * output.h (class Output_section): Add new methods: is_last_relro,
2857 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
2858 Add is_last_relro_ and is_first_non_relro_ fields.
2859 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
2860 Create separate .got.plt section. Call increase_relro.
2861 * x86_64.cc (Target_x86_64::got_section): Likewise.
2862 * testsuite/relro_script_test.t: Add .got.plt.
2863
2864 PR 10450
2865 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
2866 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
2867 (Layout::finalize): Call set_dynamic_symbol_size.
2868 (Layout::set_dynamic_symbol_size): New function.
2869 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
2870 set_dynamic_symbol_size.
2871
2872 PR 10450
2873 * output.h (class Output_section): Add is_entsize_zero_ field.
2874 * output.cc (Output_section::Output_section): Initialize
2875 is_entsize_zero_.
2876 (Output_section::set_entsize): If two different entsizes are
2877 requested, force it to zero.
2878 (Output_section::add_input_section): Set flags for .debug_str
2879 before updating section flags. Set entsize.
2880 (Output_section::update_flags_for_input_section): Set SHF_MERGE
2881 and SHF_STRING if all input sections have those flags.
2882
2883 2009-12-29 Rafael Espindola <espindola@google.com>
2884
2885 * main.cc (main): Fix the sys time reporting.
2886 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
2887 reporting.
2888
2889 2009-12-29 Sriraman Tallam <tmsriram@google.com>
2890
2891 * options.cc (General_options::parse_version): Allow -v to exit
2892 without an error if there is nothing to link.
2893
2894 2009-12-29 Ian Lance Taylor <iant@google.com>
2895
2896 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
2897 using a version of gcc before 4.1.
2898 * configure: Rebuild.
2899
2900 2009-12-28 Chris Demetriou <cgd@google.com>
2901
2902 * attributes.cc (Output_attributes_section_data::do_write): Use
2903 std::vector::front rather than std::vector::data.
2904
2905 2009-12-28 Ian Lance Taylor <iant@google.com>
2906
2907 * symtab.h (class Symbol_table): Add enum Defined.
2908 * resolve.cc (Symbol_table::should_override): Add defined
2909 parameter. Change all callers. Test whether object is NULL
2910 before calling a method on it.
2911 (Symbol_table::report_resolve_problem): Add defined parameter.
2912 Change all callers.
2913 (Symbol_table::should_override_with_special): Likewise.
2914 * symtab.cc (Symbol_table::define_in_output_data): Add defined
2915 parameter. Change all callers.
2916 (Symbol_table::do_define_in_output_data): Likewise.
2917 (Symbol_table::define_in_output_segment): Likewise.
2918 (Symbol_table::do_define_in_output_segment): Likewise.
2919 (Symbol_table::define_as_constant): Likewise.
2920 (Symbol_table::do_define_as_constant): Likewise.
2921 * script.h (class Symbol_assignment): Add is_defsym parameter to
2922 constructor; change all callers.
2923 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
2924 parameter. Change all callers. Add is_defsym_ field.
2925 (class Parser_closure): Add parsing_defsym parameter to
2926 constructor; change all callers. Add parsing_defsym accessor
2927 function. Add parsing_defsym_ field.
2928
2929 2009-12-28 Ian Lance Taylor <iant@google.com>
2930
2931 * gold.cc (queue_middle_tasks): Fix formatting.
2932 * object.cc (Relobj::is_section_name_included): Likewise.
2933
2934 2009-12-23 Ian Lance Taylor <iant@google.com>
2935
2936 * i386.cc (Target_i386::do_calls_non_split): Recognize
2937 -fsplit-stack prologue for a function with a static chain.
2938 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
2939 -fsplit-stack prologue when using %r11.
2940
2941 2009-12-21 Sriraman Tallam <tmsriram@google.com>
2942
2943 * options.cc (General_options::parse_version): Make -v continue and do
2944 the link like GNU ld does.
2945
2946 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
2947
2948 * Makefile.am (CCFILES): Add timer.cc.
2949 (HFILES): Add timer.h.
2950 * configure.ac: Check for sysconf and times.
2951 * main.cc: include timer.h.
2952 (main): Use Timer instead of get_run_time.
2953 * timer.cc: New.
2954 * timer.h: New.
2955 * workqueue.cc: include timer.h.
2956 (Workqueue::find_and_run_task):
2957 Report user, sys and wall time.
2958 * Makefile.in: Regenerate.
2959 * config.in: Regenerate.
2960 * configure: Regenerate.
2961
2962 2009-12-16 Doug Kwan <dougkwan@google.com>
2963
2964 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
2965 sections.
2966 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
2967 relaxed input sections.
2968 * output.cc (Output_section::find_relaxed_input_section): Change
2969 return type to Output_relaxed_input_section pointer. Adjust code
2970 for new type of relaxed_input_section_map_.
2971 * output.h (Output_section::find_relaxed_input_section): Change
2972 return type to Output_relaxed_input_section pointer.
2973 (Output_section::Output_relaxed_input_section_by_input_section_map):
2974 New type.
2975 (Output_section::relaxed_input_section_map_): Change type to
2976 Output_section::Output_relaxed_input_section_by_input_section_map.
2977 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
2978 input section.
2979
2980 2009-12-15 Ian Lance Taylor <iant@google.com>
2981
2982 * layout.cc (Layout::create_shstrtab): Only write out after input
2983 sections if we are compressing debug sections.
2984
2985 2009-12-15 Ian Lance Taylor <iant@google.com>
2986
2987 * archive.cc (Archive::add_symbols): Only look up a symbol without
2988 a version if there is, in fact, a version.
2989
2990 2009-12-14 Ian Lance Taylor <iant@google.com>
2991
2992 Revert -Wshadow changes, all changes from:
2993 2009-12-11 Doug Kwan <dougkwan@google.com>
2994 2009-12-11 Nick Clifton <nickc@redhat.com>
2995 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
2996
2997 2009-12-11 Doug Kwan <dougkwan@google.com>
2998
2999 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
3000 due to -Wshadow.
3001 * attributes.cc (Object_attribute::size): Ditto.
3002 (Attributes_section_data::size): Ditto.
3003 (Attributes_section_data::Attributes_section_data): Ditto.
3004 (Output_attributes_section_data::do_write): Ditto.
3005 * attributes.h (Object_attribute::set_type): Ditto.
3006 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
3007
3008 2009-12-11 Nick Clifton <nickc@redhat.com>
3009
3010 * archive.cc: Fix shadowed variable warnings.
3011 * arm.cc: Likewise.
3012 * compressed_output.cc: Likewise.
3013 * compressed_output.h: Likewise.
3014 * configure: Likewise.
3015 * dwarf_reader.cc: Likewise.
3016 * dynobj.cc: Likewise.
3017 * dynobj.h: Likewise.
3018 * ehframe.cc: Likewise.
3019 * ehframe.h: Likewise.
3020 * errors.cc: Likewise.
3021 * expression.cc: Likewise.
3022 * fileread.cc: Likewise.
3023 * fileread.h: Likewise.
3024 * freebsd.h: Likewise.
3025 * i386.cc: Likewise.
3026 * icf.cc: Likewise.
3027 * incremental.h: Likewise.
3028 * layout.cc: Likewise.
3029 * layout.h: Likewise.
3030 * mapfile.cc: Likewise.
3031 * merge.cc: Likewise.
3032 * merge.h: Likewise.
3033 * object.cc: Likewise.
3034 * object.h: Likewise.
3035 * options.h: Likewise.
3036 * output.cc: Likewise.
3037 * output.h: Likewise.
3038 * parameters.cc: Likewise.
3039 * plugin.cc: Likewise.
3040 * powerpc.cc: Likewise.
3041 * reduced_debug_output.cc: Likewise.
3042 * reduced_debug_output.h: Likewise.
3043 * reloc.cc: Likewise.
3044 * reloc.h: Likewise.
3045 * resolve.cc: Likewise.
3046 * script-sections.cc: Likewise.
3047 * script.cc: Likewise.
3048 * script.h: Likewise.
3049 * sparc.cc: Likewise.
3050 * symtab.cc: Likewise.
3051 * symtab.h: Likewise.
3052 * target-select.cc: Likewise.
3053 * target-select.h: Likewise.
3054 * token.h: Likewise.
3055 * workqueue.cc: Likewise.
3056 * workqueue.h: Likewise.
3057 * x86_64.cc: Likewise.
3058
3059 2009-12-10 Doug Kwan <dougkwan@google.com>
3060
3061 * arm.cc (attributes.h): New include.
3062 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
3063 (Arm_relobj::~Arm_relobj): Delete object pointed by
3064 attributes_section_data_.
3065 (Arm_relobj::attributes_section_data): New method definition.
3066 (Arm_relobj::attributes_section_data_): New data member declaration.
3067 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
3068 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
3069 attributes_section_data_.
3070 (Arm_dynobj::attributes_section_data): New method definition.
3071 (Arm_dynobj::attributes_section_data_): New data member declaration.
3072 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
3073 initialization value of may_use_blx_ to false.
3074 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
3075 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
3076 object attributes to compute results instead of hard-coding.
3077 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
3078 Target_arm::get_secondary_compatible_arch,
3079 Target_arm::set_secondary_compatible_arch
3080 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3081 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
3082 New method declarations.
3083 (Target_arm::get_aeabi_object_attribute): New method definition.
3084 (Target_arm::attributes_section_data_): New data member declaration.
3085 (read_arm_attributes_section): New template definition.
3086 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
3087 (Arm_dynobj::do_read_symbols): Ditto.
3088 (Target_arm::do_finalize_sections): Merge attributes sections from
3089 input. Check for BLX use after attributes section merging.
3090 Fix __exidx_start and __exidx_end visibility. Create an
3091 .ARM.attributes section if necessary.
3092 (Target_arm::get_secondary_compatible_arch,
3093 Target_arm::set_secondary_compatible_arch,
3094 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
3095 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
3096 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
3097 New method definitions.
3098
3099 2009-12-09 Ian Lance Taylor <iant@google.com>
3100
3101 * plugin.cc (Plugin::load): Don't cast from void* to a function
3102 pointer.
3103
3104 2009-12-09 Ian Lance Taylor <iant@google.com>
3105
3106 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
3107 information fields.
3108
3109 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
3110
3111 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
3112 Replace two_file_shared_1.so with two_file_shared_2.so.
3113 * testsuite/Makefile.in: Regenerated.
3114
3115 2009-12-08 Doug Kwan <dougkwan@google.com>
3116
3117 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
3118 (HFILES): Add attributes.h and int_encoding.h.
3119 * Makefile.in: Regenerate.
3120 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
3121 function definitions to int_encoding.cc
3122 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
3123 prototypes to int_encoding.h
3124 * reduced_debug_output.cc (int_encoding.h): New include.
3125 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
3126 function definitions to int_encoding.cc
3127 (insert_into_vector, read_from_pointer): Move template definitions to
3128 int_encoding.h
3129 * attributes.cc: New file.
3130 * attributes.h: New file.
3131 * int_encoding.cc: New file.
3132 * int_encoding.h: New file.
3133
3134 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
3135
3136 PR gold/11055
3137 * incremental-dump.cc (dump_incremental_inputs): New.
3138 (main): Use dump_incremental_inputs.
3139
3140 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
3141
3142 PR gold/10893
3143 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
3144 checking elfcpp::STT_FUNC.
3145 (Target_i386::Relocate::relocate): Likewise.
3146 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3147
3148 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
3149 symbols from shared libraries into normal FUNC symbols.
3150
3151 * symtab.h (Symbol): Add is_func and use it.
3152
3153 2009-12-05 Doug Kwan <dougkwan@google.com>
3154
3155 * arm.cc (Target_arm::arm_info): Initialize new fields
3156 attributes_section and attributes_vendor.
3157 * i386.cc (Target_i386::i386_info): Same.
3158 * object.cc (Sized_relobj::do_layout): Skip attribute section.
3159 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
3160 fields attributes_section and attributes_vendor.
3161 * sparc.cc (Target_sparc::sparc_info): Same.
3162 * target.h (Target::attributes_section, Target::attributes_vendor,
3163 Target::is_attributes_section, Target::attribute_arg_type,
3164 Target::attributes_order): New method definitions.
3165 (Target::Target_info::attributes_section,
3166 Target::Target_info::attributes_vendor): New fields.
3167 (Target::do_attribute_arg_type, Target::do_attributes_order): New
3168 virtual method definitions.
3169 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
3170 attributes_section and attributes_vendor.
3171 * testsuite/testfile.cc (Target_test::test_target_info): Same.
3172
3173 2009-12-05 Doug Kwan <dougkwan@google.com>
3174
3175 * arm.cc: Update comments about interworking and stub generation.
3176 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
3177 considered as non-PIC.
3178 (Arm_relocate_functions::base_abs): Fix formatting.
3179 (Arm_relocate_functions::got_prel): Fix comment. Change interface
3180 of function to use GOT entry address instead of offset.
3181 (Target_arm::Scan::global): Issue an error if a symbol would need a
3182 PLT does not get one because it is untyped. Remove code to create
3183 dynamic symbols for relative branches.
3184 (Target_arm::Relocate::relocate: Use 0 instead of false since function
3185 takes unsigned integer instead of boolean.
3186
3187 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
3188
3189 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
3190 (two_file_test_LDADD): Likewise.
3191 (common_test_1_LDADD): Likewise.
3192 (exception_test_LDADD) Likewise.
3193 (weak_test_LDADD): Likewise.
3194 (many_sections_test_LDADD): Likewise.
3195 (initpri1_LDADD): Likewise.
3196 (script_test_1_LDADD): Likewise.
3197 (script_test_2_LDADD): Likewise.
3198 (justsyms_LDADD): Likewise.
3199 (binary_test_LDADD): Likewise.
3200 (large_LDADD): Likewise.
3201 * testsuite/Makefile.in: Regenerated.
3202
3203 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
3204
3205 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
3206 (Symbol_table::override_with_special): Likewise.
3207 (Symbol_table::add_from_object): Likewise.
3208
3209 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
3210
3211 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3212 Don't set the data_offset twice.
3213
3214 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
3215
3216 * testsuite/Makefile.in: Regenerate.
3217
3218 2009-12-03 Doug Kwan <dougkwan@google.com>
3219
3220 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
3221 (Target_arm::do_finalize_sections): Add parameter for symbol table
3222 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
3223 * i386.cc (Target_i386::do_finalize_sections): Add an additional
3224 parameter for symbol table pointer.
3225 * layout.cc (Layout::finalize): Call Target::finalize_sections with
3226 an additional parameter for a pointer to symbol table.
3227 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
3228 parameter for a symbol table pointer.
3229 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
3230 * target.h (Target::finalize_sections, Target::do_finalize_sections):
3231 Ditto.
3232 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
3233 parameter for a symbol table pointer.
3234
3235 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
3236
3237 * incremental.cc (Incremental_inputs_header)
3238 (Incremental_inputs_header_write, Incremental_inputs_entry)
3239 (Incremental_inputs_entry_write): Move ...
3240 * incremental.h (Incremental_inputs_header)
3241 (Incremental_inputs_header_write, Incremental_inputs_entry)
3242 (Incremental_inputs_entry_write): here.
3243
3244 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3245
3246 * incremental.cc (make_sized_incremental_binary): Set the target.
3247 Error if it is incompatible.
3248 * output.h (Output_file): Add filename method.
3249
3250 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3251
3252 * incremental.cc (Incremental_inputs_entry): Remove unused argument
3253 from the get_* methods.
3254
3255 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3256
3257 * incremental-dump.cc (main): Check that the offeset of a script is 0.
3258 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
3259 Write 0 for the data_offset of scripts.
3260
3261 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
3262
3263 * testsuite/Makefile.am: Add the incremental_test.sh test.
3264 * testsuite/incremental_test.sh: New.
3265 * testsuite/incremental_test_1.c: New.
3266 * testsuite/incremental_test_2.c: New.
3267
3268 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
3269
3270 * incremental-dump.cc (main): Fix typos.
3271
3272 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
3273
3274 PR gold/11025
3275 * incremental-dump.cc (main): Use llu to print 64 bit values.
3276
3277 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
3278 H.J. Lu <hongjiu.lu@intel.com>
3279
3280 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
3281 $(LIBDL).
3282 (incremental_dump_LDADD): Likewise.
3283 * Makefile.in: Regenerated.
3284
3285 2009-11-25 Doug Kwan <dougkwan@google.com>
3286
3287 Revert:
3288
3289 2009-11-25 Doug Kwan <dougkwan@google.com>
3290
3291 * arm.cc (Target_arm::Target_arm): Move method definition
3292 outside of class definition. Add code to handle
3293 --target1-rel, --target1-abs and --target2= options.
3294 (Target_arm::get_reloc_reloc_type): Change method to be
3295 non-static and const.
3296 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
3297 New data member declaration.
3298 (Target_arm::Scan::local, Target_arm::Scan::global,
3299 Target_arm::Relocate::relocate,
3300 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
3301 Adjust call to Target_arm::get_real_reloc_type.
3302 (Target_arm::get_real_reloc_type): Use command line options
3303 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3304 * options.h (--target1-rel, --target1-abs, --target2): New
3305 ARM-only options.
3306
3307 2009-11-25 Doug Kwan <dougkwan@google.com>
3308
3309 * arm.cc (Target_arm::Target_arm): Move method definition outside of
3310 class definition. Add code to handle --target1-rel, --target1-abs
3311 and --target2= options.
3312 (Target_arm::get_reloc_reloc_type): Change method to be non-static
3313 and const.
3314 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
3315 member declaration.
3316 (Target_arm::Scan::local, Target_arm::Scan::global,
3317 Target_arm::Relocate::relocate,
3318 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
3319 call to Target_arm::get_real_reloc_type.
3320 (Target_arm::get_real_reloc_type): Use command line options to
3321 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
3322 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
3323 options.
3324
3325 2009-11-25 Doug Kwan <dougkwan@google.com>
3326
3327 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
3328 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
3329 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
3330 formatting.
3331 (Arm_relocate_functions::thm_call): Replace body with a call to
3332 Arm_relocate_functions::thumb_branch_common.
3333 (Arm_relocate_functions::thm_jump24,
3334 Arm_relocate_functions::thm_xpc22): New method definitions.
3335 (Arm_relocate_functions::thumb_branch_common): New method definition.
3336 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
3337 operator.
3338 (Target_arm::Relocate::relocate): Adjust call to thm_call.
3339 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
3340
3341 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3342
3343 * Makefile.am: Build incremental-dump
3344 * Makefile.in: Regenerate.
3345 * incremental-dump.cc: New.
3346 * incremental.cc (Incremental_inputs_header_data,
3347 Incremental_inputs_entry_data): Move to incremental.h
3348 * incremental.h: (Incremental_inputs_header_data,
3349 Incremental_inputs_entry_data): Move from incremental.cc
3350
3351 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3352
3353 * incremental.cc (Incremental_inputs_header,
3354 Incremental_inputs_header_write, Incremental_inputs_entry,
3355 Incremental_inputs_entry_write): Add a typedef with the data type.
3356
3357 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
3358
3359 * incremental.cc (Incremental_inputs_header,
3360 Incremental_inputs_header_write, Incremental_inputs_entry,
3361 Incremental_inputs_entry_write): Update comment about which
3362 type has the filed descriptions.
3363
3364 2009-11-15 Doug Kwan <dougkwan@google.com>
3365
3366 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
3367 (Arm_relocate_functions::arm_branch_common): Change method defintion
3368 in class definition to a method declaration and update list of formal
3369 parameters.
3370 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
3371 Arm_relocation_functions::jump24): Adjust call to
3372 Arm_relocate_functions::arm_branch_common. Update list of formal
3373 parameters.
3374 (Arm_relocate_functions::xpc25): New method definition.
3375 (Arm_relocate_functions::arm_branch_common): Move method defintion
3376 out from class definition. Use stubs for mode-switching and extending
3377 branch ranges.
3378 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
3379 specially. Change code to enable use of stubs in ARM branches.
3380
3381 2009-11-10 Doug Kwan <dougkwan@google.com>
3382
3383 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
3384 in method declaration.
3385 (Target_arm::relocate_stub): New method declaration.
3386 (Target_arm::default_target): Change to return a pointer instead of
3387 a const reference.
3388 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
3389 Target_arm::default_target.
3390 (Arm_Relobj::do_relocate_sections): Remove options paramater in
3391 method definition.
3392 (Target_arm::relocate_section): Adjust view.
3393 (Target_arm::relocate_stub): New method definition.
3394
3395 2009-11-10 Doug Kwan <dougkwan@google.com>
3396
3397 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
3398 a format warning.
3399 * incremental.cc (open_incremental_binary): Initialized local
3400 variables to avoid warnings.
3401 * object.cc (make_elf_object): Ditto.
3402 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
3403 a format warning.
3404
3405 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
3406
3407 PR gold/10930
3408 * testsuite/plugin_test.c: Include "config.h".
3409
3410 2009-11-09 Doug Kwan <dougkwan@google.com>
3411
3412 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
3413 (arm_symbol_value): Remove.
3414 (Arm_relocate_functions::arm_branch_common,
3415 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
3416 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
3417 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
3418 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
3419 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
3420 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
3421 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
3422 Arm_relocate_functions::thm_mobw_abs_nc,
3423 Arm_relocate_functions::thm_mov_abs,
3424 Arm_relocate_functions::movw_prel_nc,
3425 Arm_relocate_functions::thm_movt_abs,
3426 Arm_relocate_functions::movt_prel,
3427 Arm_relocate_functions::thm_movw_prel_nc,
3428 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
3429 (Target_arm::Relocate::relocate): Only decompose address into two
3430 parts if relocation type uses the thumb-bit and pass the actual
3431 bit instead of a flag indicating that the thumb-bit is used. Adjust
3432 calls to methods in Arm_relocate_functions for this change.
3433
3434 2009-11-08 Ian Lance Taylor <iant@google.com>
3435
3436 PR 10925
3437 * reloc.cc: Instantiate
3438 Sized_relobj::initialize_input_to_output_maps and
3439 Sized_relobj:free_input_to_output_maps.
3440
3441 2009-11-06 Ian Lance Taylor <iant@google.com>
3442
3443 PR 10876
3444 * defstd.cc (in_segment): Set only_if_ref true for "end".
3445
3446 2009-11-06 Doug Kwan <dougkwan@google.com>
3447
3448 * arm.cc (class Reloc_stub): Correct a comment.
3449 (Target_arm::Target_arm): Initialize arm_input_section_map_.
3450 (Target_arm::scan_section_for_stubs): New method declaration.
3451 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
3452 Change methods from private to protected.
3453 (Target_arm::do_may_relax): New method definition.
3454 (Target_arm::do_relax, Target_arm::group_sections,
3455 Target_arm::scan_reloc_for_stub,
3456 Target_arm::scan_reloc_section_for_stubs): New method declarations.
3457 (Target_arm::arm_input_section_map_): New data member declaration.
3458 (Target_arm::scan_reloc_for_stub,
3459 Target_arm::scan_reloc_section_for_stubs,
3460 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
3461 Target_arm::do_relax): New method definitions.
3462
3463 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
3464
3465 * configure.ac: Check for (struct stat)::st_mtim
3466 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
3467 * config.in: Regenerate.
3468 * configure: Regenerate.
3469
3470 2009-11-05 Ian Lance Taylor <iant@google.com>
3471
3472 PR 10910
3473 * output.cc (Output_segment::add_output_section): Add missing
3474 return statement.
3475
3476 2009-11-04 Ian Lance Taylor <iant@google.com>
3477
3478 PR 10880
3479 * object.h (class Object): Add is_needed and set_is_needed
3480 methods. Add is_needed_ field. Make bool fields into bitfields.
3481 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
3482 defined in a dynamic object and referenced by a regular object,
3483 set is_needed for the dynamic object.
3484 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
3485 if the file is marked with as_needed and it is not needed.
3486
3487 2009-11-04 Ian Lance Taylor <iant@google.com>
3488
3489 PR 10887
3490 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
3491 tags if data is discarded by linker script.
3492 * i386.cc (Target_i386::do_finalize_sections): Likewise.
3493 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
3494 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
3495 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3496
3497 2009-11-04 Ian Lance Taylor <iant@google.com>
3498
3499 * layout.cc (Layout::get_output_section): Add is_interp and
3500 is_dynamic_linker_section parameters. Change all callers.
3501 (Layout::choose_output_section): Likewise.
3502 (Layout::make_output_section): Likewise.
3503 (Layout::add_output_section_data): Add is_dynamic_linker_section
3504 parameter. Change all callers.
3505 * layout.h (class Layout): Update declarations.
3506 * output.h (class Output_section): Add is_interp, set_is_interp,
3507 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
3508 Add is_interp_, is_dynamic_linker_section_ fields. Change
3509 generate_code_fills_at_write_ to a bitfield.
3510 * output.cc (Output_section::Output_sections): Initialize new
3511 fields.
3512 (Output_segment::add_output_section): Add do_sort parameter.
3513 Change all callers.
3514
3515 2009-11-03 Ian Lance Taylor <iant@google.com>
3516
3517 PR 10860
3518 * options.h (class General_options): Add --warn-common.
3519 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
3520 merging two common symbols.
3521 (Symbol_table::should_override): Handle --warn-common when merging
3522 a common symbol with a defined symbol. Use report_resolve_problem
3523 for multiple definitions.
3524 (Symbol_table::report_resolve_problem): New function.
3525 * symtab.h (class Symbol_table): Declare report_resolve_problem.
3526
3527 2009-11-03 Doug Kwan <dougkwan@google.com>
3528
3529 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
3530 stub_factory_.
3531 (Target_arm::stub_factory): New method definition.
3532 (Target_arm::new_arm_input_section,
3533 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
3534 Target_arm::reloc_uses_thumb_bit): New method declarations.
3535 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
3536 New type definitions.
3537 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
3538 member declarations.
3539 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
3540 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
3541 New method definitions.
3542
3543 2009-11-03 Ian Lance Taylor <iant@google.com>
3544
3545 * options.h (class General_options): Add --warn_constructors.
3546
3547 2009-11-03 Ian Lance Taylor <iant@google.com>
3548
3549 PR 10893
3550 * defstd.cc (in_section): Add entries for __rel_iplt_start,
3551 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
3552
3553 2009-11-03 Ian Lance Taylor <iant@google.com>
3554
3555 PR 10895
3556 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
3557 --msgid-bugs-address.
3558 (install-pdf): New target.
3559 (install-data_yes): Look up one directory to find mkinstalldirs.
3560
3561 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
3562
3563 * po/Make-in (.po.gmo): Don't generate .gmo files in source
3564 tree.
3565
3566 2009-10-30 Doug Kwan <dougkwan@google.com>
3567
3568 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
3569
3570 2009-10-30 Doug Kwan <dougkwan@google.com>
3571
3572 * arm.cc (Stub_addend_reader): New struct template definition
3573 and partial specializations.
3574 (Stub_addend_reader::operator()): New method definition for a
3575 partially specialized template.
3576
3577 2009-10-30 Doug Kwan <dougkwan@google.com>
3578
3579 * arm.cc (Arm_relobj::processor_specific_flags): New method
3580 definition.
3581 (Arm_relobj::do_read_symbols): New method declaration.
3582 (Arm_relobj::processor_specific_flags_): New data member declaration.
3583 (Arm_dynobj): New class definition.
3584 (Target_arm::do_finalize_sections): Add input_objects parameter.
3585 (Target_arm::do_adjust_elf_header): New method declaration.
3586 (Target_arm::are_eabi_versions_compatible,
3587 (Target_arm::merge_processor_specific_flags): New method declaration.
3588 (Target_arm::do_make_elf_object): New overloaded method definitions
3589 and declaration.
3590 (Arm_relobj::do_read_symbols): New method definition.
3591 (Arm_dynobj::do_read_symbols): Ditto.
3592 (Target_arm::do_finalize_sections): Add input_objects parameters.
3593 Merge processor-specific flags from all input objects.
3594 (Target_arm::are_eabi_versions_compatible,
3595 Target_arm::merge_processor_specific_flags,
3596 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
3597 New method definitions.
3598 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
3599 Input_objects pointer type parameter.
3600 * layout.cc (Layout::finalize): Pass input objects to target's.
3601 finalize_sections function.
3602 * output.cc (Output_file_header::do_sized_write): Set ELF file
3603 header's processor-specific flags.
3604 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
3605 Input_objects pointer type parameter.
3606 * sparc.cc (Target_sparc::do_finalize_sections): Same.
3607 * target.h (Input_objects): New forward class declaration.
3608 (Target::processor_specific_flags,
3609 Target::are_processor_specific_flags_sect): New method definitions.
3610 (Target::finalize_sections): Add input_objects parameter.
3611 (Target::Target): Initialize processor_specific_flags_ and
3612 are_processor_specific_flags_set_.
3613 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
3614 parameter.
3615 (Target::set_processor_specific_flags): New method definition.
3616 (Target::processor_specific_flags_,
3617 Target::are_processor_specific_flags_set_): New data member
3618 declarations.
3619 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
3620 Input_objects pointer type parameter.
3621
3622 2009-10-30 Doug Kwan <dougkwan@google.com>
3623
3624 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
3625
3626 2009-10-28 Ian Lance Taylor <iant@google.com>
3627
3628 * object.h (class Relobj): Drop options parameter from
3629 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
3630 do_scan_relocs, do_relocate. Change all callers.
3631 (class Sized_relobj): Drop options parameters from
3632 do_gc_process_relocs, do_scan_relocs, do_relocate,
3633 do_relocate_sections, relocate_sections, emit_relocs_scan,
3634 emit_relocs_scan_reltype. Change all callers.
3635 (struct Relocate_info): Remove options field and all references to
3636 it.
3637 * reloc.h (class Read_relocs): Remove options constructor
3638 parameter and options_ field. Change all callers.
3639 (class Gc_process_relocs, class Scan_relocs): Likewise.
3640 (class Relocate_task): Likewise.
3641 * target-reloc.h (scan_relocs): Remove options parameter. Change
3642 all callers.
3643 (scan_relocatable_relocs): Likewise.
3644 * target.h (class Sized_target): Remove options parameter from
3645 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
3646 all callers.
3647 * gc.h (gc_process_relocs): Remove options parameter. Change all
3648 callers.
3649 * arm.cc: Update functions to remove options parameters.
3650 * i386.cc: Likewise.
3651 * powerpc.cc: Likewise.
3652 * sparc.cc: Likewise.
3653 * x86_64.cc: Likewise.
3654 * testsuite/testfile.cc: Likewise.
3655
3656 2009-10-28 Doug Kwan <dougkwan@google.com>
3657
3658 * arm.cc (Arm_relobj): New class definition.
3659 (Arm_relobj::scan_sections_for_stubs,
3660 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
3661 New method definitions.
3662
3663 2009-10-28 Cary Coutant <ccoutant@google.com>
3664
3665 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
3666 (Plugin::cleanup_done_): New member.
3667 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
3668 (Plugin_manager::cleanup_done_): Remove.
3669 (Plugin_manager::add_input_file): Edit error message.
3670 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
3671 (Plugin_manager::cleanup): Remove use of cleanup_done_.
3672
3673 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
3674
3675 * fileread.cc: (File_read::View::~View): Use the new
3676 data_ownership_ filed.
3677 (File_read::~File_read): Dispose the new whole_file_view_.
3678 (File_read::open): Mmap the whole file if needed.
3679 (File_read::open): Use whole_file_view_ instead of contents_.
3680 (File_read::find_view): Use whole_file_view_ if applicable.
3681 (File_read::do_read): Use whole_file_view_ instead of contents_.
3682 (File_read::make_view): Use whole_file_view_ instead of contents_,
3683 update File_read::View::View call.
3684 (File_read::find_or_make_view): Update File_read::View::View
3685 call.
3686 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
3687 remove contents_
3688 (File_read::View::Data_ownership): New enum.
3689 (File_read::View::View): Replace bool mapped_ with Data_ownership
3690 argument.
3691 (File_read::View::mapped_): Remove (replaced by data_ownership_).
3692 (File_read::View::data_ownership_): New field.
3693 (File_read::contents_): Remove (replaced by whole_file_view_).
3694 (File_read::whole_file_view_): New field.
3695 * options.h (class General_options): Add --keep-files-mapped.
3696
3697 2009-10-27 Cary Coutant <ccoutant@google.com>
3698
3699 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
3700 * testsuite/Makefile.am (plugin_test_5): New test case.
3701 * testsuite/Makefile.in: Regenerate.
3702
3703 2009-10-25 Doug Kwan <dougkwan@google.com>
3704
3705 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
3706 from private to protected to allow access by child class.
3707 (Sized_relobj::do_relocate_sections): New method declaration.
3708 (Sized_relobj::relocate_sections): Virtualize.
3709 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
3710 Sized_relobj::relocate_sections. Instantiate template explicitly
3711 for different target sizes and endianity.
3712
3713 2009-10-24 Doug Kwan <dougkwan@google.com>
3714
3715 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
3716 (Arm_input_section::as_arm_input_section): New method.
3717 (Arm_output_section): New class definition.
3718 (Arm_output_section::create_stub_group,
3719 Arm_output_section::group_sections): New method definitions.
3720
3721 2009-10-22 Doug Kwan <dougkwan@google.com>
3722
3723 * arm.cc (Arm_input_section): New class definition.
3724 (Arm_input_section::init, Arm_input_section:do_write,
3725 Arm_input_section::set_final_data_size,
3726 Arm_input_section::do_reset_address_and_file_offset): New method
3727 definitions.
3728
3729 2009-10-21 Doug Kwan <dougkwan@google.com>
3730
3731 * arm.cc (Stub_table, Arm_input_section): New forward class
3732 declarations.
3733 (Stub_table): New class defintion.
3734 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
3735 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
3736 New method definition.
3737
3738 2009-10-21 Doug Kwan <dougkwan@google.com>
3739
3740 * arm.cc: Update copyright comments.
3741 (Target_arm): New forward class template declaration.
3742 (Arm_address): New type.
3743 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
3744 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
3745 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
3746 constants.
3747 (Insn_template): Same.
3748 (DEF_STUBS): New macro.
3749 (Stub_type): New enum type.
3750 (Stub_template): New class definition.
3751 (Stub): Same.
3752 (Reloc_stub): Same.
3753 (Stub_factory): Same.
3754 (Target_arm::Target_arm): Initialize may_use_blx_ and
3755 should_force_pic_veneer_.
3756 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
3757 Target_arm::should_force_pic_veneer,
3758 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
3759 Target_arm::using_thumb_only, Target_arm:;default_target): New
3760 method defintions.
3761 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
3762 New data member declarations.
3763 (Insn_template::size, Insn_template::alignment): New method defintions.
3764 (Stub_template::Stub_template): New method definition.
3765 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
3766 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
3767 (Stub_factory::Stub_factory): New method definition.
3768 * gold.h (string_hash): New template.
3769 * output.h (Input_section_specifier::hash_value): Use
3770 gold::string_hash.
3771 (Input_section_specifier::string_hash): Remove.
3772 * stringpool.cc (Stringpool_template::string_hash): Use
3773 gold::string_hash.
3774
3775 2009-10-20 Doug Kwan <dougkwan@google.com>
3776
3777 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
3778 symbols of relaxed input sections.
3779 * output.h (Output_section::find_relaxed_input_section): Make
3780 method public.
3781
3782 2009-10-16 Doug Kwan <dougkwan@google.com>
3783
3784 * dynobj.cc (Versions::Versions): Initialize version_script_.
3785 Only insert base version symbol definition for a shared object
3786 if version script defines any version versions.
3787 (Versions::define_base_version): New method definition.
3788 (Versions::add_def): Check that base version is not needed.
3789 (Versions::add_need): Define base version lazily.
3790 * dynobj.h (Versions::define_base_version): New method declaration.
3791 (Versions::needs_base_version_): New data member declaration.
3792 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
3793 (check_DATA): Add no_version_test.stdout.
3794 (libno_version_test.so, no_version_test.o no_version_test.stdout):
3795 New make rules.
3796 * testsuite/Makefile.in: Regenerate.
3797 * testsuite/no_version_test.c: New file.
3798 * testsuite/no_version_test.sh: Ditto.
3799
3800 2009-10-16 Doug Kwan <dougkwan@google.com>
3801
3802 * expression.cc (class Segment_start_expression): New class definition.
3803 (Segment_start_expression::value): New method definition.
3804 (script_exp_function_segment_start): Return a new
3805 Segment_start_expression.
3806 * gold/script-c.h (script_saw_segment_start_expression): New function
3807 prototype.
3808 * script-sections.cc (Script_sections::Script_sections): Initialize
3809 SAW_SEGMENT_START_EXPRESSION_ to false.
3810 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
3811 and -Tbbs options to specify section addresses if given in
3812 command line and no SEGMENT_START expression is seen in a script.
3813 * script-sections.h (Script_sections::saw_segment_start_expression,
3814 Script_sections::set_saw_segment_start_expression): New method
3815 definition.
3816 (Script_sections::saw_segment_start_expression_): New data member
3817 declaration.
3818 * script.cc (script_saw_segment_start_expression): New function.
3819 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
3820 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
3821 script_test_7.sh and script_test_8.sh.
3822 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
3823 script_test_8.stdout.
3824 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
3825 (script_test_6, script_test_6.stdout, script_test_7,
3826 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
3827 * Makefile.in: Regenerate.
3828 * testsuite/script_test_6.sh: New file.
3829 * testsuite/script_test_6.t: Same.
3830 * testsuite/script_test_7.sh: Same.
3831 * testsuite/script_test_7.t: Same.
3832 * testsuite/script_test_8.sh: Same.
3833
3834 2009-10-16 Doug Kwan <dougkwan@google.com>
3835
3836 * output.cc (Output_segment::set_section_list_address): Cast
3837 expressions to unsigned long long type to avoid format warnings.
3838
3839 2009-10-15 Ian Lance Taylor <iant@google.com>
3840
3841 * script.cc (Script_options::add_symbol_assignment): Always add a
3842 dot assignment to script_sections_.
3843 * script-sections.cc (Script_sections::add_dot_assignment):
3844 Initialize if necessary.
3845
3846 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
3847 program headers with no load segment if there is a linker script.
3848
3849 * layout.cc (Layout::set_segment_offsets): Align the file offset
3850 to the segment aligment for -N or -n with no load segment.
3851 * output.cc (Output_segment::add_output_section): Don't crash if
3852 the first section is a TLS section.
3853 (Output_segment::set_section_list_addresses): Print an error
3854 message if the address moves backward in a linker script.
3855 * script-sections.cc
3856 (Output_section_element_input::set_section_addresses): Don't
3857 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
3858 (Orphan_output_section::set_section_addresses): Likewise.
3859
3860 2009-10-15 Doug Kwan <dougkwan@google.com>
3861
3862 * layout.cc (Layout::finish_dynamic_section): Generate tags
3863 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
3864 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
3865 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
3866
3867 2009-10-14 Ian Lance Taylor <iant@google.com>
3868
3869 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
3870 fields.
3871 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
3872 data_shdr fields of relinfo.
3873 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
3874 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
3875 R_386_TLS_LDO_32, adjust based on section flags.
3876 (Target_i386::Relocate::fix_up_ldo): Remove.
3877
3878 2009-10-13 Ian Lance Taylor <iant@google.com>
3879
3880 Add support for -pie.
3881 * options.h (class General_options): Add -pie and
3882 --pic-executable.
3883 (General_options::output_is_position_independent): Test -pie.
3884 (General_options::output_is_executable): Return true if not shared
3885 and not relocatable.
3886 (General_options::output_is_pie): Remove.
3887 * options.cc (General_options::finalize): Reject incompatible uses
3888 of -pie.
3889 * gold.cc (queue_middle_tasks): A -pie link is not static.
3890 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
3891 * symtab.cc (Symbol::final_value_is_known): Return false if
3892 output_is_position_independent.
3893 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
3894 output_is_position_independent.
3895 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
3896 output_is_position_independent.
3897 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
3898 output_is_position_independent.
3899 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
3900 two_file_pie_test.
3901 (basic_pie_test.o, basic_pie_test): New targets.
3902 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
3903 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
3904 (two_file_pie_test): New target.
3905 * testsuite/Makefile.in: Rebuild.
3906 * README: Remove note saying that -pie is not supported.
3907
3908 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
3909
3910 * options.h (class General_options): Add -init and -fini.
3911 * layout.cc (Layout::finish_dynamic_section): Emit
3912 given init and fini functions.
3913
3914 2009-10-13 Sriraman Tallam <tmsriram@google.com>
3915
3916 * gc.h (gc_process_relocs): Check if icf is enabled using new
3917 function.
3918 * gold.cc (queue_initial_tasks): Likewise.
3919 (queue_middle_tasks): Likewise.
3920 * object.cc (do_layout): Likewise.
3921 * symtab.cc (is_section_folded): Likewise.
3922 * main.cc (main): Likewise.
3923 * reloc.cc (Read_relocs::run): Likewise.
3924 (Sized_relobj::do_scan_relocs): Likewise.
3925 * icf.cc (is_function_ctor_or_dtor): New function.
3926 (Icf::find_identical_sections): Check if function is ctor or dtor when
3927 safe icf is chosen.
3928 * options.h (General_options::icf): Change option to be an enum.
3929 (Icf_status): New enum.
3930 (icf_enabled): New method.
3931 (icf_safe_folding): New method.
3932 (set_icf_status): New method.
3933 (icf_status_): New variable.
3934 * (options.cc) (General_options::finalize): Set icf_status_.
3935 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
3936 icf_test and icf_keep_unique_test to use the --icf enum flag.
3937 * testsuite/icf_safe_test.sh: New file.
3938 * testsuite/icf_safe_test.cc: New file.
3939
3940 2009-10-12 Sriraman Tallam <tmsriram@google.com>
3941
3942 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
3943 includes to gc.h and icf.h.
3944 * arm.cc: Include gc.h.
3945 * gold.cc: Likewise.
3946 * i386.cc: Likewise.
3947 * powerpc.cc: Likewise.
3948 * sparc.cc: Likewise.
3949 * x86_64.cc: Likewise.
3950 * gc.h: Include icf.h.
3951
3952 2009-10-11 Ian Lance Taylor <iant@google.com>
3953
3954 * plugin.cc: Include "gold.h" before other header files.
3955
3956 2009-10-10 Chris Demetriou <cgd@google.com>
3957
3958 * options.h (Input_file_argument::Input_file_type): New enum.
3959 (Input_file_argument::is_lib_): Replace with...
3960 (Input_file_argument::type_): New member.
3961 (Input_file_argument::Input_file_argument): Take Input_file_type
3962 'type' rather than boolean 'is_lib' as second argument.
3963 (Input_file_argument::is_lib): Use type_.
3964 (Input_file_argument::is_searched_file): New function.
3965 (Input_file_argument::may_need_search): Handle is_searched_file.
3966 * options.cc (General_options::parse_library): Support -l:filename.
3967 (General_options::parse_just_symbols): Update for Input_file_argument
3968 changes.
3969 (Command_line::process): Likewise.
3970 * archive.cc (Archive::get_file_and_offset): Likewise.
3971 * plugin.cc (Plugin_manager::release_input_file): Likewise.
3972 * script.cc (read_script_file, script_add_file): Likewise.
3973 * fileread.cc (Input_file::Input_file): Likewise.
3974 (Input_file::will_search_for): Handle is_searched_file.
3975 (Input_file::open): Likewise.
3976 * readsyms.cc (Read_symbols::get_name): Likewise.
3977 * testsuite/Makefile.am (searched_file_test): New test.
3978 * testsuite/Makefile.in: Regenerate.
3979 * testsuite/searched_file_test.cc: New file.
3980 * testsuite/searched_file_test_lib.cc: New file.
3981
3982 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3983 Ian Lance Taylor <iant@google.com>
3984
3985 * descriptor.cc: Include <cstdio> and "binary-io.h".
3986 (Descriptors::open): Open the files in binary mode always.
3987 * script.cc (Lex::get_token): Treat \r as whitespace.
3988
3989 2009-10-09 Ian Lance Taylor <iant@google.com>
3990
3991 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
3992
3993 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
3994 Ian Lance Taylor <iant@google.com>
3995
3996 * configure.ac: Check for readv function also.
3997 * fileread.cc (readv): Define if not HAVE_READV.
3998 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
3999 does not exist.
4000 * config.in: Regenerate.
4001 * configure: Regenerate.
4002
4003 2009-10-09 Doug Kwan <dougkwan@google.com>
4004
4005 * layout.cc (Layout::make_output_section): Call target hook to make
4006 ordinary output section.
4007 (Layout::finalize): Adjust parameter list of call the
4008 Target::may_relax().
4009 * layout.h (class Layout::section_list): New method.
4010 * merge.h (Output_merge_base::entsize): Change visibility to public.
4011 (Output_merge_base::is_string, Output_merge_base::do_is_string):
4012 New methods.
4013 (Output_merge_string::do_is_string): New method.
4014 * object.cc (Sized_relobj::do_setup): renamed from
4015 Sized_relobj::set_up.
4016 * object.h (Sized_relobj::adjust_shndx,
4017 Sized_relobj::initializ_input_to_output_maps,
4018 Sized_relobj::free_input_to_output_maps): Change visibilities to
4019 protected.
4020 (Sized_relobj::setup): Virtualize.
4021 (Sized_relobj::do_setup): New method declaration.
4022 (Sized_relobj::invalidate_section_offset,
4023 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
4024 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
4025 * options.cc (parse_int): New function.
4026 * options.h (parse_int): New declaration.
4027 (DEFINE_int): New macro.
4028 (stub_group_size): New option.
4029 * output.cc (Output_section::Output_section): Initialize memebers
4030 merge_section_map_, merge_section_by_properties_map_,
4031 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
4032 (Output_section::add_input_section): Handled deferred code-fill
4033 generation and remove an old comment.
4034 (Output_section::add_relaxed_input_section): New method definition.
4035 (Output_section::add_merge_input_section): Use merge section by
4036 properties map to speed to search. Update merge section maps
4037 as appropriate.
4038 (Output_section::build_relaxation_map): New method definition.
4039 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4040 Same.
4041 (Output_section::relax_input_section): Renamed to
4042 Output_section::convert_input_sections_to_relaxed_sections and change
4043 interface to take a vector of pointers to relaxed sections.
4044 (Output_section::find_merge_section,
4045 Output_section::find_relaxed_input_section): New method definitions.
4046 (Output_section::is_input_address_mapped,
4047 Output_section::output_offset, Output_section::output_address):
4048 Use output section data maps to speed up searching.
4049 (Output_section::find_starting_output_address): Add comments.
4050 (Output_section::do_write,
4051 Output_section::write_to_postprocessing_buffer): Do code-fill
4052 generation as appropriate.
4053 (Output_section::get_input_sections): Invalidate relaxed input section
4054 map.
4055 (Output_section::restore_states): Adjust type of checkpoint .
4056 Invalidate relaxed input section map.
4057 * output.h (Output_merge_base): New class declaration.
4058 (Input_section_specifier): New class defintion.
4059 (class Output_relaxed_input_section) Change base class to
4060 Output_section_data_build.
4061 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
4062 base class initializer.
4063 (Output_section::add_relaxed_input_section): New method declaration.
4064 (Output_section::Input_section): Change visibility to protected.
4065 (Output_section::Input_section::relobj,
4066 Output_section::Input_section::shndx): Handle relaxed input sections.
4067 Output_section::input_sections) Change visibility to protected. Also
4068 define overload to return a non-const pointer.
4069 (Output_section::Merge_section_properties): New class defintion.
4070 (Output_section::Merge_section_by_properties_map,
4071 Output_section::Output_section_data_by_input_section_map,
4072 Output_section::Relaxation_map): New types.
4073 (Output_section::relax_input_section): Rename method to
4074 Output_section::convert_input_sections_to_relaxed_sections and change
4075 interface to take a vector of relaxed section pointers.
4076 (Output_section::find_merge_section,
4077 Output_section::find_relaxed_input_section,
4078 Output_section::build_relaxation_map,
4079 Output_section::convert_input_sections_in_list_to_relaxed_sections):
4080 New method declarations.
4081 (Output_section::merge_section_map_
4082 Output_section::merge_section_by_properties_map_,
4083 Output_section::relaxed_input_section_map_,
4084 Output_section::is_relaxed_input_section_map_valid_,
4085 Output_section::generate_code_fills_at_write_): New data members.
4086 * script-sections.cc
4087 (Output_section_element_input::set_section_addresses): Call
4088 current_data_size and addralign methods of relaxed input sections.
4089 (Orphan_output_section::set_section_addresses): Call current_data_size
4090 and addralign methods of relaxed input sections.
4091 * symtab.cc (Symbol_table::compute_final_value): Extract template
4092 from the body of Symbol_table::sized_finalize_symbol.
4093 (Symbol_table::sized_finalized_symbol): Call
4094 Symbol_table::compute_final_value.
4095 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
4096 (Symbol_table::compute_final_value): New templated method declaration.
4097 * target.cc (Target::do_make_output_section): New method defintion.
4098 * target.h (Target::make_output_section): New method declaration.
4099 (Target::relax): Add more parameters for input objects, symbol table
4100 and layout. Adjust call to do_relax.
4101 (Target::do_make_output_section): New method declaration.
4102 (Target::do_relax): Add parameters for input objects, symbol table
4103 and layout.
4104
4105 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4106
4107 * pread.c: Include stdio.h.
4108
4109 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4110
4111 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
4112 defined.
4113
4114 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
4115
4116 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4117 Change read_shndx type to unsigned int.
4118 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4119 int.
4120 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4121 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
4122 Change read_shndx type to unsigned int.
4123 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
4124 int.
4125 (Sized_dwarf_line_info::read_line_mappings): Likewise.
4126 * layout.cc (Layout::create_symtab_sections): Cast the result of
4127 local_symcount * symsize to off_t in the gold_assert.
4128
4129 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4130
4131 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
4132 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
4133 R_ARM_BASE_ABS.
4134 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
4135 (Arm_relocate_functions::thm_abs5): New function.
4136 (Arm_relocate_functions::abs12): New function.
4137 (Arm_relocate_functions::abs16): New function.
4138 (Arm_relocate_functions::base_abs): New function.
4139 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
4140 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
4141 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
4142 R_ARM_BASE_ABS.
4143 (Scan::global): Likewise.
4144 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
4145 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
4146 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
4147 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
4148 R_ARM_BASE_ABS.
4149
4150 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4151
4152 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
4153 (Arm_relocate_functions::movt_prel): New function.
4154 (Arm_relocate_functions::thm_movw_prel_nc): New function.
4155 (Arm_relocate_functions::thm_movt_prel): New function.
4156 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
4157 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
4158 (Scan::global, Relocate::relocate): Likewise.
4159 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4160
4161 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4162
4163 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
4164 Incremental_checker.
4165 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
4166 unsigned int.
4167 (class Incremental_inputs_header): New class.
4168 (Incremental_inputs_header_writer): Edit comment.
4169 (Incremental_inputs_entry): New class.
4170 (Incremental_inputs_entry_writer): Edit comment.
4171 (Sized_incremental_binary::do_find_incremental_inputs_section):
4172 Add *strtab_shndx parameter, fill it.
4173 (Sized_incremental_binary::do_check_inputs): New method.
4174 (Incremental_checker::can_incrementally_link_output_file): Use
4175 Sized_incremental_binary::check_inputs.
4176 (Incremental_inputs::report_command_line): Save command line in
4177 command_line_.
4178 * incremental.h:
4179 (Incremental_binary::find_incremental_inputs_section): New
4180 method.
4181 (Incremental_binary::do_find_incremental_inputs_section): Add
4182 strtab_shndx parameter.
4183 (Incremental_binary::do_check_inputs): New pure virtual method.
4184 (Sized_incremental_binary::do_check_inputs): Declare.
4185 (Incremental_checker::Incremental_checker): Add incremental_inputs
4186 parameter, use it to initialize incremental_inputs_.
4187 (Incremental_checker::incremental_inputs_): New field.
4188 (Incremental_checker::command_line): New method.
4189 (Incremental_checker::inputs): New method.
4190 (Incremental_checker::command_line_): New field.
4191
4192 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
4193
4194 * incremental.cc: Include <cstdarg> and "target-select.h".
4195 (vexplain_no_incremental): New function.
4196 (explain_no_incremental): New function.
4197 (Incremental_binary::error): New method.
4198 (Sized_incremental_binary::do_find_incremental_inputs_section): New
4199 method.
4200 (make_sized_incremental_binary): New function.
4201 (open_incremental_binary): New function.
4202 (can_incrementally_link_file): Add checks if output is ELF and has
4203 inputs section.
4204 * incremental.h: Include "elfcpp_file.h" and "output.h".
4205 (Incremental_binary): New class.
4206 (Sized_incremental_binary): New class.
4207 (open_incremental_binary): Declare.
4208 * object.cc (is_elf_object): Use
4209 elfcpp::Elf_recognizer::is_elf_file.
4210 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
4211 * output.h (Output_file::filesize): New method.
4212
4213 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4214
4215 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
4216 New function.
4217 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
4218 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
4219 function.
4220 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
4221 function.
4222 (Arm_relocate_functions::movw_abs_nc): New function.
4223 (Arm_relocate_functions::movt_abs): New function.
4224 (Arm_relocate_functions::thm_movw_abs_nc): New function.
4225 (Arm_relocate_functions::thm_movt_abs): New function.
4226 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
4227 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
4228 (Scan::global): Likewise.
4229 (Relocate::relocate): Likewise.
4230 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4231
4232 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4233
4234 * arm.cc (Arm_relocate_functions::got_prel) New function.
4235 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
4236 (Relocate::relocate): Likewise.
4237 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
4238
4239 2009-10-06 Ian Lance Taylor <iant@google.com>
4240
4241 * options.h (class General_options): Define
4242 split_stack_adjust_size parameter.
4243 * object.h (class Object): Add uses_split_stack_ and
4244 has_no_split_stack_ fields. Add uses_split_stack and
4245 has_no_split_stack accessor functions. Declare
4246 handle_split_stack_section.
4247 (class Reloc_symbol_changes): Define.
4248 (class Sized_relobj): Define Function_offsets. Declare
4249 split_stack_adjust, split_stack_adjust_reltype, and
4250 find_functions.
4251 * object.cc (Object::handle_split_stack_section): New function.
4252 (Sized_relobj::do_layout): Call handle_split_stack_section.
4253 * dynobj.cc (Sized_dynobj::do_layout): Call
4254 handle_split_stack_section.
4255 * reloc.cc (Sized_relobj::relocate_sections): Call
4256 split_stack_adjust for executable sections in split_stack
4257 objects. Pass reloc_map to relocate_section.
4258 (Sized_relobj::split_stack_adjust): New function.
4259 (Sized_relobj::split_stack_adjust_reltype): New function.
4260 (Sized_relobj::find_functions): New function.
4261 * target-reloc.h: Include "object.h".
4262 (relocate_section): Add reloc_symbol_changes parameter. Change
4263 all callers.
4264 * target.h (class Target): Add calls_non_split method. Declare
4265 do_calls_non_split virtual method. Declare match_view and
4266 set_view_to_nop.
4267 * target.cc: Include "elfcpp.h".
4268 (Target::do_calls_non_split): New function.
4269 (Target::match_view): New function.
4270 (Target::set_view_to_nop): New function.
4271 * gold.cc (queue_middle_tasks): Give an error if mixing
4272 split-stack and non-split-stack objects with -r.
4273 * i386.cc (Target_i386::relocate_section): Add
4274 reloc_symbol_changes parameter.
4275 (Target_i386::do_calls_non_split): New function.
4276 * x86_64.cc (Target_x86_64::relocate_section): Add
4277 reloc_symbol_changes parameter.
4278 (Target_x86_64::do_calls_non_split): New function.
4279 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
4280 parameter.
4281 * powerpc.cc (Target_powerpc::relocate_section): Add
4282 reloc_symbol_changes parameter.
4283 * sparc.cc (Target_sparc::relocate_section): Add
4284 reloc_symbol_changes parameter.
4285 * configure.ac: Call AM_CONDITIONAL for the default target.
4286 * configure: Rebuild.
4287 * testsuite/Makefile.am (TEST_AS): New variable.
4288 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
4289 (check_DATA): Add split_i386 and split_x86_64 files.
4290 (SPLIT_DEFSYMS): Define.
4291 (split_i386_[1234n].o): New targets.
4292 (split_i386_[124]): New targets.
4293 (split_i386_[1234r].stdout): New targets.
4294 (split_x86_64_[1234n].o): New targets.
4295 (split_x86_64_[124]): New targets.
4296 (split_x86_64_[1234r].stdout): New targets.
4297 (MOSTLYCLEANFILES): Add new executables.
4298 * testsuite/split_i386.sh: New file.
4299 * testsuite/split_x86_64.sh: New file.
4300 * testsuite/split_i386_1.s: New file.
4301 * testsuite/split_i386_2.s: New file.
4302 * testsuite/split_i386_3.s: New file.
4303 * testsuite/split_i386_4.s: New file.
4304 * testsuite/split_i386_n.s: New file.
4305 * testsuite/split_x86_64_1.s: New file.
4306 * testsuite/split_x86_64_2.s: New file.
4307 * testsuite/split_x86_64_3.s: New file.
4308 * testsuite/split_x86_64_4.s: New file.
4309 * testsuite/split_x86_64_n.s: New file.
4310 * testsuite/testfile.cc (Target_test): Update relocation_section
4311 function.
4312 * testsuite/Makefile.in: Rebuild.
4313
4314 2009-10-06 Ian Lance Taylor <iant@google.com>
4315
4316 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
4317 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
4318 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
4319 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
4320 the address on ldo_addrs_.
4321 (Target_i386::Relocate::fix_up_ldo): New function.
4322
4323 2009-10-06 Rafael Espindola <espindola@google.com>
4324
4325 * plugin.cc (add_input_library): New.
4326 (Plugin::load): Add add_input_library to tv.
4327 (Plugin_manager::add_input_file): Add the is_lib argument.
4328 (add_input_file): Update call to Plugin_manager::add_input_file.
4329 (add_input_library): New.
4330 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
4331
4332 2009-09-30 Doug Kwan <dougkwan@google.com>
4333
4334 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
4335 symbol and call Symbol::may_need_copy_reloc to determine if
4336 a copy reloc is needed.
4337 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
4338 nocopyreloc is given in command line.
4339 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
4340 given in command line.
4341 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
4342 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
4343 of the removed Target_i386::may_need_copy_reloc.
4344 * options.h (copyreloc): New option with default value false.
4345 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4346 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
4347 instead of the removed Target_powerpc::may_need_copy_reloc.
4348 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
4349 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
4350 instead of the removed Target_sparc::may_need_copy_reloc.
4351 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
4352 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
4353 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
4354 instead of the removed Target_x86_64::may_need_copy_reloc.
4355
4356 2009-09-30 Ian Lance Taylor <iant@google.com>
4357
4358 * object.h (class Object): Remove target_ field, and target,
4359 sized_target, and set_target methods.
4360 (Object::sized_target): Remove.
4361 (class Sized_relobj): Update declarations. Remove sized_target.
4362 * object.cc (Sized_relobj::setup): Remove target parameter.
4363 Change all callers.
4364 (Input_objects::add_object): Don't do anything with the target.
4365 (make_elf_sized_object): Add punconfigured parameter. Change all
4366 callers. Set or test parameter target.
4367 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
4368 Change all callers.
4369 * parameters.cc (Parameters::set_target): Change parameter type to
4370 be non-const.
4371 (Parameters::default_target): Remove.
4372 (set_parameters_target): Change parameter type to be non-const.
4373 (parameters_force_valid_target): New function.
4374 (parameters_clear_target): New function.
4375 * parameters.h (class Parameters): Update declarations. Remove
4376 default_target method. Add sized_target and clear_target
4377 methods. Change target_ to be non-const.
4378 (set_parameters_target): Update declaration.
4379 (parameters_force_valid_target): Declare.
4380 (parameters_clear_target): Declare.
4381 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
4382 as NULL if we aren't searching.
4383 (Add_symbols::run): Don't check for compatible target.
4384 * fileread.cc (Input_file::open_binary): Call
4385 parameters_force_valid_target.
4386 * gold.cc (queue_middle_tasks): Likewise.
4387 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
4388 set_target on object.
4389 * dynobj.h (class Sized_dynobj): Update declarations.
4390 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
4391 make_elf_object returns NULL.
4392 (Archive::include_member): Don't check whether object target is
4393 compatible.
4394 * output.cc (Output_section::add_input_section): Get target from
4395 parameters.
4396 (Output_section::relax_input_section): Likewise.
4397 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
4398 parameters.
4399 (Sized_relobj::do_scan_relocs): Likewise.
4400 (Sized_relobj::relocate_sections): Likewise.
4401 * resolve.cc (Symbol_table::resolve): Likewise.
4402 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
4403 parameter. Change all callers.
4404 (Symbol_table::add_from_object): Get target from parameters.
4405 (Symbol_table::add_from_relobj): Don't check object target.
4406 (Symbol_table::add_from_dynobj): Likewise.
4407 (Symbol_table::define_special_symbol): Get target from
4408 parameters.
4409 * symtab.h (class Symbol_table): Update declaration.
4410 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
4411 parameter. Change all callers. Clear parameter target.
4412 (Binary_test): Test target here.
4413 * testsuite/object_unittest.cc (gold_testsuite): Remove
4414 target_test_pointer parameter. Change all callers.
4415 (Object_test): Test target here.
4416
4417 2009-09-26 Ian Lance Taylor <iant@google.com>
4418
4419 * testsuite/initpri1.c: Don't try to use constructor priorities if
4420 compiling with gcc before 4.3.
4421
4422 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
4423
4424 * testsuite/retain_symbols_file_test.sh (check_present): Change
4425 output file name to retain_symbols_file_test.stdout.
4426 (check_absent): Likewise.
4427
4428 2009-09-18 Craig Silverstein <csilvers@google.com>
4429
4430 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
4431 * options.cc: Include <cerrno> and <fstream>.
4432 (General_options::finalize): Parse -retain-symbols-file tag.
4433 * options.h: New flag.
4434 (General_options): New method should_retain_symbol, new
4435 variable symbols_to_retain.
4436 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
4437 should_retain_symbol map.
4438 * testsuite/Makefile.am (retain_symbols_file_test): New test.
4439 * testsuite/Makefile.in: Regenerate.
4440 * testsuite/retain_symbols_file_test.sh: New file.
4441
4442 2009-09-18 Nick Clifton <nickc@redhat.com>
4443
4444 * po/es.po: Updated Spanish translation.
4445
4446 2009-09-17 Doug Kwan <dougkwan@google.com>
4447
4448 * debug.h (DEBUG_RELAXATION): New constant.
4449 (DEBUG_ALL): Add DEBUG_RELAXATION.
4450 (debug_string_to_enum): Add relaxation debug option.
4451 * layout.cc
4452 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
4453 Layout::Relaxation_debug_check::read_sections,
4454 Layout::Relaxation_debug_check::read_sections): New method definitions.
4455 (Layout::Layout): Initialize data members
4456 record_output_section_data_from_scrips_,
4457 script_output_section_data_list_ and relaxation_debug_check_.
4458 (Layout::save_segments, Layout::restore_segments,
4459 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4460 Layout::relaxation_loop_body): New method definitions.
4461 (Layout::finalize): Support relaxation. Move section layout code to
4462 Layout::relaxation_loop_body.
4463 (Layout::set_asection_address_from_script): Move code for orphan
4464 section placement out.
4465 (Layout::place_orphan_sections_in_script): New method definition.
4466 * layout.h (Output_segment_headers, Output_file_header):
4467 New forward class declarations.
4468 (Layout::~Layout): Define.
4469 (Layout::new_output_section_data_from_script): New method definition.
4470 (Layout::place_orphan_sections_in_script): New method declaration.
4471 (Layout::Segment_states): New type declaration.
4472 (Layout::save_segments, Layout::restore_segments,
4473 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
4474 Layout::relaxation_loop_body): New method declarations.
4475 (Layout::Output_section_data_list): New type declaration.
4476 (Layout::Relaxation_debug_check): New class definition.
4477 (Layout::record_output_section_data_from_script_,
4478 Layout::script_output_section_data_list_, Layout::segment_states_,
4479 Layout::relaxation_debug_check_): New data members.
4480 * output.cc: (Output_section_headers::do_size): New method definition.
4481 (Output_section_headers::Output_section_headers): Move size
4482 computation to Output_section_headers::do_size.
4483 (Output_segment_headers::do_size): New method definition.
4484 (Output_file_header::Output_file_header): Move size computation to
4485 Output_file_header::do_size and call it.
4486 (Output_file_header::do_size): New method definition.
4487 (Output_data_group::Output_data_group): Adjust call to
4488 Output_section_data.
4489 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
4490 (Output_symtab_xindex::do_write): Add array bound check.
4491 (Output_section::Input_section::print_to_mapfile): Handle
4492 RELAXED_INPUT_SECTION_CODE.
4493 (Output_section::Output_section): Initialize data member checkpoint_.
4494 (Output_section::~Output_section): Delete checkpoint object pointed
4495 by checkpoint_.
4496 (Output_section::add_input_section): Always add an Input_section if
4497 relaxing.
4498 (Output_section::add_merge_input_section): Add assert.
4499 (Output_section::relax_input_section): New method definition.
4500 (Output_section::set_final_data_size): Set load address to zero for
4501 an unallocated section.
4502 (Output_section::do_address_and_file_offset_have_reset_values):
4503 New method definition.
4504 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
4505 Handle relaxed input section.
4506 (Output_section::sort_attached_input_sections): Checkpoint input
4507 section list lazily.
4508 (Output_section::get_input_sections): Change type of input_sections to
4509 list of Simple_input_section pointers. Checkpoint input section list
4510 lazily. Also handle relaxed input sections.
4511 (Output_section::add_input_section_for_script): Take a reference to
4512 a Simple_input_section object instead of Relobj pointer and section
4513 index as parameter. Handle relaxed input sections.
4514 (Output_section::save_states, Output_section::restore_states): New
4515 method definitions.
4516 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
4517 (Output_data::is_data_size_fixed): New method definition.
4518 (Output_data::reset_addresss_and_file_offset): Do not reset data size
4519 if it is fixed.
4520 (Output_data::address_and_file_offset_have_reset_values): New method
4521 definition.
4522 (Output_data::do_address_and_file_offset_have_reset_values): New method
4523 definition.
4524 (Output_data::set_data_size): Check that data size is not fixed.
4525 (Output_data::fix_data_size): New method definition.
4526 (Output_data::is_data_size_fixed_): New data member.
4527 (Output_section_headers::set_final_data_size): New method definition.
4528 (Output_section_headers::do_size): New method declaration.
4529 (Output_segment_headers::set_final_data_size): New method definition.
4530 (Output_segment_headers::do_size): New method declaration.
4531 (Output_file_header::set_final_data_size)::New method definition.
4532 (Output_file_header::do_size)::New method declaration.
4533 (Output_section_data::Output_section_data): Add new parameter
4534 is_data_size_fixed and use it to fix data size.
4535 (Output_data_const::Output_data_const): Adjust call to base class
4536 constructor and fix data size.
4537 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
4538 base class constructor and fix data size.
4539 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
4540 base class constructor and fix data size.
4541 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
4542 class constructor and fix data size.
4543 (Output_data_group::set_final_data_size): New method definition.
4544 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
4545 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
4546 class constructor and fix data size.
4547 (Output_relaxed_input_section): New class definition.
4548 (Output_section::Simple_input_section): New class definition.
4549 (Output_section::get_input_sections): Adjust parameter list.
4550 (Output_section::add_input_section_for_script): Same.
4551 (Output_section::save_states, Output_section::restore_states,
4552 Output_section::do_address_and_file_offset_have_reset_values,
4553 (Output_section::Input_section::Input_section): Handle
4554 RELAXED_INPUT_SECTION_CODE. Add new overload for
4555 Output_relaxed_input_section.
4556 (Output_section::Input_section::is_input_section,
4557 Output_section::Input_section::set_output_section): Handle relaxed
4558 input section.
4559 (Output_section::Input_section::is_relaxed_input_section,
4560 Output_section::Input_section::output_section_data,
4561 Output_section::Input_section::relaxed_input_section): New method
4562 definitions.
4563 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
4564 value.
4565 (Output_section::Input_section::u1_): Update comments.
4566 (Output_section::Input_section::u2_): Add new union member poris.
4567 (Output_section::Checkpoint_output_section): New classs definition.
4568 (Output_section::relax_input_section): New method declaration.
4569 (Output_section::checkpoint_): New data member.
4570 (Output_segment): Update comments.
4571 (Output_segment::Output_segment): Un-privatize copy constructor.
4572 (Output_segment::operator=): Un-privatize.
4573 * script-sections.cc (Output_section_element::Input_section_list):
4574 Change element type to Output_section::Simple_input_section.
4575 (Output_section_element_dot_assignment::set_section_addresses):
4576 Register output section data for relaxation clean up.
4577 (Output_data_exression::Output_data_expression): Adjust call to base
4578 constructor to fix data size.
4579 (Output_section_element_data::set_section_addresses): Register
4580 Output_data_expression object for relaxation clean up.
4581 (struct Input_section_info): Replace Relobj pointer and section index
4582 pair with Output_section::Simple_input_section and Convert struct to a
4583 class.
4584 (Input_section_sorter::operator()): Adjust access to
4585 Input_section_info data member to use accessors.
4586 (Output_section_element_input::set_section_addresses): Use layout
4587 parameter. Adjust code to use Output_section::Simple_input_section
4588 and Input_secction_info classes. Register filler for relaxation
4589 clean up.
4590 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
4591 and section index pair with Output_section::Simple_input_section
4592 class. Adjust code accordingly.
4593 (Phdrs_element::release_segment): New method definition.
4594 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
4595 segment list.
4596 (Script_sections::release_segments): New method definition.
4597 * gold/script-sections.h (Script_sections::release_segments): New
4598 method declaration.
4599 * gold/target.h (Target::may_relax, Target::relax,
4600 Target::do_may_relax, Target::do_relax): New method definitions.
4601
4602 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4603
4604 * arm.cc (has_signed_unsigned_overflow): New function.
4605 (Arm_relocate_functions::abs8): New function.
4606 (Target_arm::Scan::local): Handle R_ARM_ABS8.
4607 (Target_arm::Scan::global): Likewise.
4608 (Target_arm::relocate::relocate): Likewise.
4609 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
4610 Likewise.
4611
4612 2009-09-16 Cary Coutant <ccoutant@google.com>
4613
4614 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
4615 * testsuite/Makefile.in: Regenerate.
4616
4617 2009-09-11 Nick Clifton <nickc@redhat.com>
4618
4619 * po/gold.pot: Updated by the Translation project.
4620
4621 2009-09-08 Cary Coutant <ccoutant@google.com>
4622
4623 * output.cc (Output_file::open): Add execute permission to empty file.
4624 * testsuite/Makefile.am (permission_test): New test.
4625 * testsuite/Makefile.in: Regenerate.
4626
4627 2009-09-02 Ian Lance Taylor <iant@google.com>
4628
4629 * output.cc (Output_file::resize): Call map_no_anonymous rather
4630 than map.
4631
4632 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
4633
4634 * gold.cc: Include "incremental.h".
4635 (queue_initial_tasks): Call Incremental_checker methods.
4636 * incremental.cc: Include "output.h".
4637 (Incremental_checker::can_incrementally_link_output_file): New
4638 method.
4639 * incremental.h (Incremental_checker): New class.
4640
4641 * output.cc (Output_file::open_for_modification): New method.
4642 (Output_file::map_anonymous): Changed return type to bool. Record
4643 map in base_ field.
4644 (Output_file::map_no_anonymous): New method, broken out of map.
4645 (Output_file::map): Use map_no_anonymous and map_anonymous.
4646 * output.h (class Output_file): Update declarations.
4647
4648 2009-08-24 Cary Coutant <ccoutant@google.com>
4649
4650 * options.h (Command_line::Pre_options): New class.
4651 (Command_line::pre_options): New member.
4652 * options.cc (gold::options::ready_to_register): New variable.
4653 (One_option::register_option): Do nothing if not registering options.
4654 Assert if same short option registered twice.
4655 (General_options::General_options): Turn off option registration when
4656 done constructing.
4657 (Command_line::Pre_options::Pre_options): New constructor.
4658
4659 2009-08-24 Cary Coutant <ccoutant@google.com>
4660
4661 * options.h (General_options::no_keep_memory): Remove incorrect
4662 short option.
4663
4664 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4665
4666 * Makefile.am (am__skiplex, am__skipyacc): New.
4667 * Makefile.in: Regenerate.
4668
4669 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4670
4671 * Makefile.am (AM_CPPFLAGS): Renamed from ...
4672 (INCLUDES): ... this.
4673 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
4674 (AM_CPPFLAGS): Renamed from ...
4675 (INCLUDE): ... this.
4676 * Makefile.in, testsuite/Makefile.in: Regenerate.
4677
4678 * Makefile.in: Regenerate.
4679 * aclocal.m4: Likewise.
4680 * config.in: Likewise.
4681 * configure: Likewise.
4682 * testsuite/Makefile.in: Likewise.
4683
4684 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4685 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
4686 * Makefile.in: Regenerate.
4687 * testsuite/Makefile.in: Regenerate.
4688
4689 2009-08-19 Cary Coutant <ccoutant@google.com>
4690
4691 * resolve.cc (Symbol_table::resolve): Don't complain about defined
4692 symbols in shared libraries overridden by hidden or internal symbols
4693 in the main program.
4694
4695 2009-08-19 Chris Demetriou <cgd@google.com>
4696
4697 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
4698 checking source file names in error messages.
4699
4700 2009-08-18 Doug Kwan <dougkwan@google.com>
4701
4702 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
4703 an elcpp::Ehdr as parameter. Adjust call to set_target.
4704 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
4705 an elfcpp::Ehdr as parameter.
4706 * object.cc (Object::set_target): Remove the version that looks up
4707 a target and sets it.
4708 (Sized_relobj::setup): Take a Target object instead of
4709 an elfcpp::Ehdr as parameter. Adjust call to set_target.
4710 (make_elf_sized_object): Find target and ask target to
4711 make an ELF object.
4712 * object.h: (Object::set_target): Remove the version that looks up
4713 a target and sets it.
4714 (Sized_relobj::setup): Take a Target object instead of
4715 an elfcpp:Ehdr as parameter.
4716 * target.cc: Include dynobj.h.
4717 (Target::do_make_elf_object_implementation): New.
4718 (Target::do_make_elf_object): New.
4719 * target.h (Target::make_elf_object): New template declaration.
4720 (Target::do_make_elf_object): New method declarations.
4721 (Target::do_make_elf_object_implementation): New template declaration.
4722
4723 2009-08-14 Ian Lance Taylor <iant@google.com>
4724
4725 * gold.h (FUNCTION_NAME): Define.
4726 (gold_unreachable): Use FUNCTION_NAME.
4727
4728 2009-08-12 Sriraman Tallam <tmsriram@google.com>
4729
4730 * icf.cc (Icf::find_identical_sections): Issue a warning when a
4731 symbol in the --keep-unique list is not found.
4732
4733 2009-08-12 Sriraman Tallam <tmsriram@google.com>
4734
4735 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
4736 been maked as --keep-unique.
4737 (Icf::unfold_section): New function.
4738 * icf.h (Icf::unfold_section): New function.
4739 * options.h (General_options::keep_unique): New option.
4740 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
4741 * testsuite/Makefile.in: Regenerate.
4742 * testsuite/icf_keep_unique_test.sh: New file.
4743 * testsuite/icf_keep_unique_test.cc: New file.
4744
4745 2009-08-12 Cary Coutant <ccoutant@google.com>
4746
4747 PR 10471
4748 * resolve.cc (Symbol_table::resolve): Check for references from
4749 dynamic objects to hidden and internal symbols.
4750 * testsuite/Makefile.am (hidden_test.sh): New test.
4751 * testsuite/Makefile.in: Regenerate.
4752 * testsuite/hidden_test.sh: New script.
4753 * testsuite/hidden_test_1.c: New test source.
4754 * testsuite/hidden_test_main.c: New test source.
4755
4756 2009-08-11 Doug Kwan <dougkwan@google.com>
4757
4758 * arm.cc: Update comments.
4759 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
4760 segment to locate the .ARM.exidx section if present.
4761
4762 2009-08-09 Doug Kwan <dougkwan@google.com>
4763
4764 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
4765 patch.
4766
4767 2009-08-07 Sriraman Tallam <tmsriram@google.com>
4768 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
4769 compiler warnings.
4770
4771 2009-08-06 Sriraman Tallam <tmsriram@google.com>
4772
4773 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
4774 valid tls_segment only for non-debug-section relocations.
4775 * testsuite/Makefile.am: Add gc_tls_test.
4776 * testsuite/Makefile.in: Regenerate.
4777 * testsuite/gc_tls_test.cc: New file.
4778 * testsuite/gc_tls_test.sh: New file.
4779
4780 2009-08-05 Sriraman Tallam <tmsriram@google.com>
4781
4782 * icf.cc: New file.
4783 * icf.h: New file.
4784 * Makefile.am (CCFILES): Add icf.cc.
4785 (HFILES): Add icf.h
4786 * Makefile.in: Regenerate.
4787 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
4788 * gc.h (gc_process_relocs): Populate lists used by icf to contain
4789 section, symbol and addend information for the relocs.
4790 * gold.cc (queue_middle_tasks): Call identical code folding.
4791 * gold.h: Add defines for multimap.
4792 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
4793 to the call of finalize_local_symbols.
4794 * main.cc (main): Create object of class Icf.
4795 * object.cc (Sized_relobj::do_layout): Allow this function to be
4796 called twice during icf.
4797 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
4798 to sections marked as identical by icf.
4799 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
4800 when available.
4801 (Sized_relobj::do_section_entsize): New function.
4802 * object.h (Object::section_entsize): New function.
4803 (Object::do_section_entsize): New pure virtual function.
4804 (Relobj::finalize_local_symbols): Add new parameter.
4805 (Relobj::do_section_entsize): New function.
4806 * options.h (General_options::icf): New option.
4807 (General_options::icf_iterations): New option.
4808 (General_options::print_icf_sections): New option.
4809 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
4810 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
4811 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
4812 icf.
4813 * symtab.cc (Symbol_table::is_section_folded): New function.
4814 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
4815 to sections marked as identical by icf.
4816 * symtab.h (Symbol_table::set_icf): New function.
4817 (Symbol_table::icf): New function.
4818 (Symbol_table::is_section_folded): New function.
4819 (Symbol_table::icf_): New data member.
4820 * target-reloc.h (relocate_section): Ignore sections folded by icf.
4821 * testsuite/Makefile.am: Add commands to build icf_test.
4822 * testsuite/Makefile.in: Regenerate.
4823 * testsuite/icf_test.sh: New file.
4824 * testsuite/icf_test.cc: New file.
4825
4826 2009-07-24 Chris Demetriou <cgd@google.com>
4827
4828 * layout.cc (is_compressible_debug_section): Fix incorrect
4829 comment about compressed section names.
4830
4831 2009-07-20 Ian Lance Taylor <ian@airs.com>
4832
4833 PR 10419
4834 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
4835
4836 2009-07-16 Ian Lance Taylor <iant@google.com>
4837
4838 PR 10400
4839 * layout.h: #include <map>.
4840 (class Kept_section): Change from struct to class. Add accessors
4841 and setters. Add section size to Comdat_group mapping. Change
4842 Comdat_group to std::map. Add is_comdat_ field. Add
4843 linkonce_size field in union.
4844 (class Layout): Update declaration of find_or_add_kept_section.
4845 Don't declare find_kept_object.
4846 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
4847 parameter. Add object, shndx, is_comdat, and is_group_name
4848 parameters. Change all callers. Adjust for new Kept_section.
4849 (Layout::find_kept_object): Remove.
4850 * object.cc (Sized_relobj::include_section_group): Update use of
4851 Kept_section. Rename secnum to shndx. Only record
4852 Kept_comdat_section if sections are the same size.
4853 (Sized_relobj::include_linkonce_section): Update use of
4854 Kept_section. Only record Kept_comdat_section if sections are the
4855 same size. Set size of linkonce section.
4856 (Sized_relobj::map_to_kept_section): Update call to
4857 get_kept_comdat_section.
4858 * object.h (class Sized_relobj): Rename fields in
4859 Kept_comdat_section to drop trailing underscores; change object
4860 field to Relobj*. Change Kept_comdat_section_table to store
4861 struct rather than pointer.
4862 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
4863 Add kept_object and kept_shndx parameters. Change all callers.
4864 (Sized_relobj::get_kept_comdat_section): Change return type to
4865 bool. Add kept_object and kept_shndx parameters. Change all
4866 callers.
4867 * plugin.cc (Pluginobj::include_comdat_group): Update call to
4868 Layout::find_or_add_kept_section.
4869
4870 2009-07-09 Ian Lance Taylor <iant@google.com>
4871
4872 * merge.cc (Object_merge_map::initialize_input_to_output_map):
4873 Reserve space in the hash table.
4874
4875 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
4876
4877 * fileread.cc (File_read::get_mtime): New method.
4878 * fileread.h (Timespec): New structure.
4879 (File_read::get_mtime): New method.
4880 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
4881 Renamed from timestamp_nsec.
4882 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
4883 Elf_Xword.
4884 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
4885 timestamp_nsec.
4886 (Incremental_inputs::report_archive): Save mtime; style fix.
4887 (Incremental_inputs::report_obejct): Save mtime; style fix.
4888 (Incremental_inputs::report_script): Save mtime; style fix.
4889 (Incremental_inputs::finalize_inputs): Style fix.
4890 (Incremental_inputs::finalize): Style fix.
4891 (Incremental_inputs::create_input_section_data): Store inputs
4892 mtime.
4893 * incremental.h (Incremental_inputs::report_script): Add mtime
4894 argument.
4895 (Incremental_inputs::Input_info::Input_info): Intialize only one
4896 union member.
4897 (Incremental_inputs::Input_info::archive): Move to nameless
4898 union.
4899 (Incremental_inputs::Input_info::obejct): Move to nameless union.
4900 (Incremental_inputs::Input_info::script): Move to nameless union.
4901 (Incremental_inputs::mtime): New field.
4902 * script.cc (read_input_script): Pass file mtime to
4903 Incremental_input.
4904 * script.h (Script_info::inputs): Style fix.
4905
4906 2009-07-01 Ian Lance Taylor <ian@airs.com>
4907
4908 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
4909 instead of 32.
4910
4911 2009-06-24 Ian Lance Taylor <iant@google.com>
4912
4913 PR 10156
4914 * layout.cc (Layout::choose_output_section): If we find an
4915 existing section, update the flags.
4916 (Layout::create_notes): New function, broken out of
4917 Layout::finalize.
4918 (Layout::finalize): Don't create note sections.
4919 (Layout::create_note): Don't crash if linker script discards
4920 section.
4921 (Layout::create_gold_note): Likewise.
4922 (Layout::create_build_id): Likewise. Don't set
4923 after_input_sections on the section.
4924 (Layout::create_executable_stack_info): Remove target parameter.
4925 Change caller.
4926 * layout.h (class Layout): Declare create_notes. Update
4927 declaration of create_executable_stack_info.
4928 * gold.cc (queue_middle_tasks): Call create_notes.
4929 * output.cc (Output_section::update_flags_for_input_section): Move
4930 here from output.h. If SHF_ALLOC flag is newly set, mark address
4931 invalid.
4932 * output.h (Output_data::mark_address_invalid): New function.
4933 (class Output_section): Only declare, not define,
4934 update_flags_for_input_section. Remove set_flags.
4935
4936 2009-06-24 Ian Lance Taylor <iant@google.com>
4937
4938 * script-sections.cc (Output_section_definition::
4939 set_section_addresses): Rename shadowing local load_address to
4940 laddr.
4941
4942 2009-06-24 Ian Lance Taylor <iant@google.com>
4943
4944 PR 10244
4945 * reloc.cc (relocate_sections): Skip empty relocation sections.
4946
4947 2009-06-23 Ian Lance Taylor <iant@google.com>
4948
4949 PR 10156
4950 * layout.cc (Layout::create_note): Use choose_output_section
4951 rather than make_output_section.
4952
4953 2009-06-23 Ian Lance Taylor <iant@google.com>
4954
4955 PR 10237
4956 * options.cc (General_options::parse_V): Set printed_version_.
4957 (General_options::General_options): Initialize printed_version_.
4958 * options.h (class General_options): Add printed_version_ field.
4959 * gold.cc (queue_initial_tasks): If there are no input files,
4960 don't give a fatal error if we printed the version information.
4961 (queue_middle_tasks): If using -r with a shared object, give a
4962 fatal error rather than an ordinary error.
4963
4964 2009-06-23 Ian Lance Taylor <iant@google.com>
4965
4966 PR 10219
4967 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
4968 (Layout::make_output_section): Set have_stabstr_section_ if we see
4969 a .stab*str section.
4970 (Layout::finalize): Call link_stabs_sections.
4971 (Layout::link_stabs_sections): New file.
4972 * layout.h (class Layout): Add have_stabstr_section_ field.
4973 Declare link_stabs_sections.
4974
4975 2009-06-23 Doug Kwan <dougkwan@google.com>
4976
4977 * Makefile.am (libgold_a_LIBADD): New.
4978 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
4979 * Makefile.in: Regenerate.
4980 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
4981 * configure: Regenerate.
4982 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
4983 * fileread.cc: Include sys/state.h
4984 * gold.h: Declare memmem and strndup if found missing.
4985 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
4986
4987 2009-06-23 Ian Lance Taylor <iant@google.com>
4988
4989 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
4990 * configure: Rebuild.
4991
4992 2009-06-23 Ian Lance Taylor <iant@google.com>
4993
4994 PR 10147
4995 * object.cc (Object::section_contents): Don't try to get a view if
4996 the section has length zero.
4997 (Object::handle_gnu_warning_section): If the section is empty, use
4998 the name of the section as the warning.
4999
5000 2009-06-23 Ian Lance Taylor <iant@google.com>
5001
5002 PR 10133
5003 * stringpool.h (class Stringpool_template): Add optimize_ field.
5004 (Stringpool_template::set_optimize): New function.
5005 * stringpool.cc (Stringpool_template::Stringpool_template):
5006 Initialize optimize_ field.
5007 (Stringpool_template::set_string_offsets): Test local optimize
5008 fild rather than parameter.
5009 * layout.cc (Layout::Layout): Call set_optimize on the section
5010 name stringpool.
5011
5012 2009-06-22 Ian Lance Taylor <iant@google.com>
5013
5014 PR 10030
5015 * yyscript.y: Parse TARGET.
5016 * script.cc (script_set_target): New function.
5017 * script-c.h (script_set_target): Declare.
5018 * options.cc (General_options::string_to_object_format): Rename
5019 from string_to_object_format in anonymous namespace. Change
5020 callers.
5021 * options.h (class General_options): Declare
5022 string_to_object_format.
5023
5024 2009-06-22 Ian Lance Taylor <iant@google.com>
5025
5026 * script-sections.cc (Script_sections::create_segments): Don't put
5027 program headers in a PT_LOAD segment if -n or -N.
5028
5029 2009-06-22 Ian Lance Taylor <iant@google.com>
5030
5031 PR 10141
5032 * options.h (class General_options): Add -z lazy and -z now. Sort
5033 -z options into alphabetical order.
5034 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
5035
5036 2009-06-21 Ian Lance Taylor <iant@google.com>
5037
5038 * layout.cc (Layout::make_output_section): Call
5039 Target::new_output_section.
5040 (Layout::attach_allocated_section_to_segment): Put large section
5041 sections in a separate load segment with the large segment flag
5042 set.
5043 (Layout::segment_precedes): Sort large data segments after other
5044 load segments.
5045 (align_file_offset): New static function.
5046 (Layout::set_segment_offsets): Use align_file_offset.
5047 * output.h (class Output_section): Add is_small_section_ and
5048 is_large_section_ fields.
5049 (Output_section::is_small_section): New function.
5050 (Output_section::set_is_small_section): New function.
5051 (Output_section::is_large_section): New function.
5052 (Output_section::set_is_large_section): New function.
5053 (Output_section::is_large_data_section): New function.
5054 (class Output_segment): Add is_large_data_segment_ field.
5055 (Output_segment::is_large_data_segment): New function.
5056 (Output_segment::set_is_large_data_segment): New function.
5057 * output.cc (Output_section::Output_section): Initialize new
5058 fields.
5059 (Output_segment::Output_segment): Likewise.
5060 (Output_segment::add_output_section): Add assertion that large
5061 data sections always go in large data segments. Force small data
5062 sections to the end of the list of data sections. Force small BSS
5063 sections to the start of the list of BSS sections. For large BSS
5064 sections to the end of the list of BSS sections.
5065 * symtab.h (class Symbol): Declare is_common_shndx.
5066 (Symbol::is_defined): Check Symbol::is_common_shndx.
5067 (Symbol::is_common): Likewise.
5068 (class Symbol_table): Define enum Commons_section_type. Update
5069 declarations. Add small_commons_ and large_commons_ fields.
5070 * symtab.cc (Symbol::is_common_shndx): New function.
5071 (Symbol_table::Symbol_table): Initialize new fields.
5072 (Symbol_table::add_from_object): Put small and large common
5073 symbols in the right list.
5074 (Symbol_table::sized_finalized_symbol): Check
5075 Symbol::is_common_shndx.
5076 (Symbol_table::sized_write_globals): Likewise.
5077 * common.cc (Symbol_table::do_allocate_commons): Allocate new
5078 common symbol lists. Don't call do_allocate_commons_list if the
5079 list is empty.
5080 (Symbol_table::do_allocate_commons_list): Remove is_tls
5081 parameter. Add comons_section_type parameter. Change all
5082 callers. Handle small and large common symbols.
5083 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
5084 Symbol::is_common_shndx.
5085 * resolve.cc (symbol_to_bits): Likewise.
5086 * target.h (Target::small_common_shndx): New function.
5087 (Target::small_common_section_flags): New function.
5088 (Target::large_common_shndx): New function.
5089 (Target::large_common_section_flags): New function.
5090 (Target::new_output_section): New function.
5091 (Target::Target_info): Add small_common_shndx, large_common_shndx,
5092 small_common_section_flags, and large_common_section_flags
5093 fields.
5094 (Target::do_new_output_section): New virtual function.
5095 * arm.cc (Target_arm::arm_info): Initialize new fields.
5096 * i386.cc (Target_i386::i386_info): Likewise.
5097 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5098 Likewise.
5099 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
5100 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
5101 (Target_x86_64::do_new_output_section): New function.
5102 * configure.ac: Define conditional MCMODEL_MEDIUM.
5103 * testsuite/Makefile.am (check_PROGRAMS): Add large.
5104 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
5105 (large_LDFLAGS): Define.
5106 * testsuite/large.c: New file.
5107 * testsuite/testfile.cc (Target_test::test_target_info):
5108 Initialize new fields.
5109 * configure, testsuite/Makefile.in: Rebuild.
5110
5111 2009-06-05 Doug Kwan <dougkwan@google.com>
5112
5113 * Makefile.am (CCFILES): Add target.cc.
5114 * Makefile.in: Regenerate.
5115 * i386.cc (class Target_i386): Define new virtual method to
5116 override do_is_local_label_name in parent.
5117 * object.cc (Sized_relobj::do_count_local_symbols): Discard
5118 local symbols if --discard-locals or -X is given.
5119 * options.h (class General_options): Declare new options
5120 '--discard-locals' and '-X' for discarding locals.
5121 * target.h (class Target): Define new methods is_local_label_name.
5122 Declare new virtual method do_is_local_label_name.
5123 * target.cc: New file.
5124 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
5125 (check_SCRIPTS): Add discard_locals_test.sh.
5126 (check_DATA): Add discard_local_tests.syms.
5127 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
5128 (discard_local_tests.syms, discard_locals_test.o): New make rules.
5129 * testsuite/Makefile.in: Regenerate.
5130 * testsuite/discard_locals_test.c: New file.
5131 * testsuite/discard_locals_test.sh: Same.
5132
5133 2009-06-05 Doug Kwan <dougkwan@google.com>
5134
5135 * object.cc (Sized_relobj::Sized_relobj): Initialize
5136 discarded_eh_frame_shndx_ to -1U.
5137 (Sized_relobj::do_layout): Record index of a discard .eh_frame
5138 section.
5139 (Sized_relobj::do_count_local_symbols): Skip local symbols in
5140 a discarded .eh_frame section.
5141 (Sized_relobj::do_finalize_local_symbols): Ditto.
5142 * object.h (class Sized_relobj): Declare new member
5143 discarded_eh_frame_shndx_.
5144 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
5145 (local_labels_test.o, local_labels_test): New rules.
5146 * testsuite/Makefile.in: Regenerate.
5147
5148 2009-06-04 Doug Kwan <dougkwan@google.com>
5149
5150 * layout.cc (Layout::section_name_mapping): Add mapping for
5151 special ARM sections.
5152
5153 2009-06-03 Doug Kwan <dougkwan@google.com>
5154
5155 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
5156 (utils::has_overflow): Same.
5157
5158 2009-06-03 Ian Lance Taylor <iant@google.com>
5159
5160 * layout.cc (Layout::section_name_mapping): New array, replacing
5161 Layout::linkonce_mapping.
5162 (Layout::section_name_mapping_count): New variable, replacing
5163 Layout::linkonce_mapping_count.
5164 (Layout::linkonce_output_name): Remove.
5165 (Layout::output_section_name): Rewrite.
5166 * layout.h (class Layout): Rename Linkonce_mapping to
5167 Section_name_mapping, linkonce_mapping to section_name_mapping,
5168 linkonce_mapping_count to section_name_mapping_count. Don't
5169 declare linkonce_output_name.
5170
5171 2009-06-03 Doug Kwan <dougkwan@google.com>
5172
5173 * gold/arm.cc (namespace utils): New.
5174 (Target_arm::reloc_is_non_pic): Define new method.
5175 (class Arm_relocate_functions): New.
5176 (Target_arm::Relocate::relocate): Handle relocation types used by
5177 Android.
5178
5179 2009-06-03 Ian Lance Taylor <iant@google.com>
5180
5181 * arm.cc (Target_arm::scan::global): Use || instead of |.
5182
5183 2009-06-02 Doug Kwan <dougkwan@google.com>
5184
5185 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
5186 issued_non_pic_error_.
5187 (class Target_arm::Scan): Declare new method check_non_pic.
5188 Define new method symbol_needs_plt_entry.
5189 Declare new data member issued_non_pic_error_.
5190 (class Target_arm::Relocate): Declare new method
5191 should_apply_static_reloc.
5192 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
5193 (Target_arm::Scan::check_non_pic): Define new method.
5194 (Target_arm::Scan::local): Handle a small subset of reloc types used
5195 by Android.
5196 (Target_arm::Scan::local): Same.
5197 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
5198
5199 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
5200
5201 * incremental.cc (Incremental_inputs::report_command_line): Filter
5202 out --incremental-* options.
5203
5204 2009-05-29 Doug Kwan <dougkwan@google.com>
5205
5206 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
5207 template class.
5208 (class Target_arm): Update comment.
5209 (Target_arm::Target_arm): Initialize new data members GOT_,
5210 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
5211 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
5212 and Target_arm::rel_dyn_section.
5213 Declare new_enum Target_arm::Got_type.
5214 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
5215 and DYNBSS_.
5216 Update commments for member do_dynsym_value.
5217 (Target_arm::got_size, Target_arm::plt_section,
5218 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
5219 new methods inside class defintion.
5220 (Target_arm::got_section): Define new method.
5221 (Target_arm::rel_dyn_section): Same.
5222 (Output_data_plt_arm): New template class.
5223 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
5224 (Output_data_plt_arm:do_adjust_output_section): Define new method.
5225 (Output_data_plt_arm::add_entry): Same.
5226 (Output_data_plt_arm::first_plt_entry): Define new
5227 static data member for PLT instruction template.
5228 (Output_data_plt_arm::plt_entry): Same.
5229 (Output_data_plt_arm::do_write): Define new method.
5230 (Target_arm::make_plt_entry): Same.
5231 (Target_arm::do_finalize_sections): Same.
5232 (Target_arm::do_dynsym_value): Same.
5233
5234 2009-05-28 Doug Kwan <dougkwan@google.com>
5235
5236 * Makefile.am (TARGETSOURCES): Add arm.cc.
5237 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
5238 * Makefile.in: Regenerate.
5239 * arm.cc: New file.
5240 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
5241
5242 2009-05-26 Doug Kwan <dougkwan@google.com>
5243
5244 * options.cc (General_options::parse_exclude_libs). Fix a comment.
5245 (General_options::check_excluded_libs): Strip off directories in
5246 archive name before matching like GNU ld does.
5247 * testsuite/Makefile.am (MOSTLYCLEANFILES,
5248 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
5249 (exclude_libs_test_LDFLAGS): Add linker option
5250 -Wl,--exclude-libs,libexclude_libs_test_3
5251 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
5252 an explicit archive without using -l.
5253 (alt/libexclude_libs_test_3.a): New make rule.
5254 * testsuite/Makefile.in: Regenerate.
5255 * testsuite/exclude_libs_test.c : Declare lib3_default().
5256 (main): Call it.
5257 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
5258 * exclude_libs_test_3.c: New file.
5259
5260 2009-05-26 Nick Clifton <nickc@redhat.com>
5261
5262 * po/id.po: New Indonesian translation.
5263 * po/gold.pot: Updated template file.
5264
5265 2009-05-22 Sriraman Tallam <tmsriram@google.com>
5266
5267 * testsuite/Makefile.am: Add -ffunction-sections to compile
5268 gc_comdat_test files. Add -Wl,--gc-sections to build
5269 gc_comdat_test.
5270 * testsuite/Makefile.in: Regenerate.
5271 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
5272
5273 2009-05-21 Sriraman Tallam <tmsriram@google.com>
5274
5275 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
5276 kept comdat section was garbage collected.
5277 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
5278 * testsuite/Makefile.in: Regenerate.
5279 * testsuite/gc_comdat_test.sh: New file.
5280 * testsuite/gc_comdat_test_1.cc: New file.
5281 * testsuite/gc_comdat_test_2.cc: New file.
5282
5283 2009-05-19 Doug Kwan <dougkwan@google.com>
5284
5285 * archive.cc (Archive::Archive): Move constructor from archive.h
5286 to here. Initialize no_export_.
5287 (Archive::get_elf_object_for_member): Set no_export flag of object.
5288 * archive.h (Archive::Archive): Move constructor body to
5289 archive.cc.
5290 (Archive::no_export): New method.
5291 (Archive::no_export_): New field.
5292 * object.h (Object::Object): Initialize no_export_ to false.
5293 (Object::no_export, Object::set_no_export): New methods.
5294 (Object::no_export_): New field.
5295 * options.cc (General_options::parse_exclude_libs): New method.
5296 (General_options::check_excluded_libs) Same.
5297 * options.h (exclude_libs): New option.
5298 (General_options::check_excluded_libs): New method declaration.
5299 (General_options::excluded_libs_): New field.
5300 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
5301 default or protected visibility if an object has no-export flag set.
5302 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
5303 (check_SCRIPTS): Add exclude_libs_test.sh.
5304 (check_DATA): Add exclude_libs_test.syms.
5305 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
5306 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
5307 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
5308 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
5309 (exclude_libs_test.syms, libexclude_libs_test_1.a,
5310 libexclude_libs_test_2.a): New rules.
5311 * testsuite/Makefile.in: Regenerate.
5312 * testsuite/exclude_libs_test.c: New file.
5313 * testsuite/exclude_libs_test.sh: Ditto.
5314 * testsuite/exclude_libs_test_1.c: Ditto.
5315 * testsuite/exclude_libs_test_2.c: Ditto.
5316
5317 2009-05-15 Ian Lance Taylor <iant@google.com>
5318
5319 * configure.ac: Check for declarations for cases where libiberty.h
5320 checks HAVE_DECL_xxx.
5321 * configure, config.in: Rebuild.
5322
5323 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
5324
5325 * gold.h (Incremental_argument_list): Remove (invalid) forward
5326 declaration.
5327 * incremental.cc (Incremental_inputs::report_achive): New method.
5328 (Incremental_inputs::report_object): New method.
5329 (Incremental_inputs::report_script): New method.
5330 (Incremental_inputs::finalize_inputs): New method.
5331 (Incremental_inputs::finalize): Call finalize_inputs().
5332 (Incremental_inputs::sized_create_incremental_inputs_section_data):
5333 Create inputs entries.
5334 * incremental.h (Incremental_input_type): New enum.
5335 (Incremental_inputs::Incremental_input): Initialize new fields.
5336 (Incremental_inputs::report_inputs): New method.
5337 (Incremental_inputs::report_achive): New method.
5338 (Incremental_inputs::report_object): New method.
5339 (Incremental_inputs::report_script): New method.
5340 (Incremental_inputs::finalize_inputs): New method.
5341 (Incremental_inputs::Input_info): New struct.
5342 (Incremental_inputs::Input_info_map): New typedef.
5343 (Incremental_inputs::lock_): New field.
5344 (Incremental_inputs::Inputs_): New field.
5345 (Incremental_inputs::Inputs_map): New field.
5346 * main.cc (main): Call Incremental_input::report_inputs.
5347 * options.h (Input_argument_list): Typedef moved from
5348 Input_arguments.
5349 (Input_file_group::Files): Remove, use ::Input_argument_list.
5350 (Input_file_group::Input_argument_list): Remove, use
5351 ::Input_argument_list.
5352 * plugin.cc (Plugin_manager::add_input_file): Add error in
5353 incremental build.
5354 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
5355 functions.
5356 * script.cc (read_input_script): Call
5357 Incremental_input::report_script.
5358 * script.h (Script_info): New class.
5359
5360 2009-04-27 Ian Lance Taylor <iant@google.com>
5361
5362 * x86_64.cc (do_adjust_output_section): Set entsize to
5363 plt_entry_size.
5364
5365 2009-04-23 Elliott Hughes <enh@google.com>
5366
5367 * output.cc (Output_file::close): After short writes, continue
5368 writing from the correct offset in the buffer being written.
5369
5370 2009-04-23 Chris Demetriou <cgd@google.com>
5371
5372 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
5373 * configure: Regenerate.
5374 * config.in: Regenerate.
5375 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
5376 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
5377
5378 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
5379
5380 * incremental.cc (Incremental_inputs_header_data): Renamed from
5381 Incremental_input_header_data.
5382 (Incremental_inputs_header_data::data_size): New field.
5383 (Incremental_inputs_header_data::put_input_file_count): Renamed
5384 from input_file_count.
5385 (Incremental_inputs_header_data::put_command_line_offset): Renamed
5386 from command_line_offset.
5387 (Incremental_inputs_header_data::put_reserved): Renamed from
5388 put_reserved.
5389 (Incremental_inputs_entry_data): Renamed from
5390 Incremental_input_entry_data.
5391 (Incremental_inputs_entry_data::data_size): New field.
5392 (Incremental_inputs::report_command_line): New method.
5393 (Incremental_inputs::finalize): New method.
5394 (Incremental_inputs::create_incremental_inputs_data): New method.
5395 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
5396 * incremental.h: New file.
5397 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
5398 (Layout::finalize): Create incremental inputs section in
5399 incremental builds.
5400 (Layout::create_incremental_info_sections): New method.
5401 * layout.h (Layout::incremental_inputs): New method.
5402 (Layout::create_incremental_info_sections): New method.
5403 (Layout::incremental_inputs_): New field.
5404 * main.cc (main): Notify Incremental_input of the command line.
5405
5406 2009-04-01 Ian Lance Taylor <iant@google.com>
5407 Mikolaj Zalewski <mikolajz@google.com>
5408
5409 * gold.h (reserve_unordered_map): Define, three versions, one for
5410 each version of Unordered_map.
5411 * layout.cc (Layout::Layout): Remove options parameter. Add
5412 number_of_input_files parameter. Don't initialize options_.
5413 Initialize number_of_input_files_ and resized_signatures_. Move
5414 sections_are_attached_.
5415 (Layout::layout_group): Reserve space for group_signatures_.
5416 (Layout::find_or_add_kept_section): Change name parameter to be a
5417 reference. Resize signatures_ map when it gets large enough.
5418 (Layout::layout_eh_frame): Use parameters->options() instead of
5419 this->options_.
5420 (Layout::make_output_section): Likewise.
5421 (Layout::attach_allocated_section_to_segment): Likewise.
5422 (Layout::finalize, Layout::create_executable_stack): Likewise.
5423 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
5424 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
5425 * layout.h (class Layout): Update declarations. Remove options_
5426 field. Add number_of_input_files_ and resized_signatures_
5427 fields. Move sections_are_attached_ field.
5428 * main.cc (main): Pass number of input files to Layout
5429 constructor. Don't pass options.
5430
5431 2009-03-30 Ian Lance Taylor <iant@google.com>
5432
5433 * ffsll.c (ffsll): Correct implementation.
5434
5435 2009-03-27 Ian Lance Taylor <iant@google.com>
5436
5437 * ffsll.c: New file.
5438 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
5439 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
5440 * ftruncate.c (ftruncate): Declare before definition.
5441 * mremap.c (mremap): Likewise.
5442 * pread.c (pread): Likewise.
5443 * configure, Makefile.in, config.in: Rebuild.
5444
5445 * mremap.c: New file.
5446 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
5447 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
5448 (mremap): Declare if HAVE_MREMAP is not defined.
5449 * configure, Makefile.in, config.in: Rebuild.
5450
5451 2009-03-27 Cary Coutant <ccoutant@google.com>
5452
5453 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
5454 position independent.
5455 * sparc.cc (Target_sparc::check_non_pic): Likewise.
5456 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
5457
5458 2009-03-24 Cary Coutant <ccoutant@google.com>
5459
5460 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
5461 an executable.
5462 (needs_dynamic_reloc): Likewise.
5463
5464 2009-03-24 Ian Lance Taylor <iant@google.com>
5465
5466 * yyscript.y (file_cmd): Recognize EXTERN.
5467 (extern_name_list, extern_name_list_body): New nonterminals.
5468 * script.cc (script_add_extern): Define.
5469 * script-c.h (script_add_extern): Declare.
5470
5471 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
5472
5473 * object.cc (is_elf_object): Define.
5474 * object.h (is_elf_object): Declare.
5475 * archive.cc (Archive::get_elf_object_for_member): Call
5476 is_elf_object.
5477 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
5478
5479 2009-03-24 Elliott Hughes <enh@google.com>
5480
5481 * output.cc (Output_file::map_anonymous): Define.
5482 (Output_file::map): Use map_anonymous. If the regular mmap fails,
5483 try an anonymous one. Report the size if the mmap fails.
5484 * output.h (class Output_file): Declare map_anonymous.
5485
5486 2009-03-24 Ian Lance Taylor <iant@google.com>
5487
5488 * target-select.cc (instantiate_target): Don't acquire the lock if
5489 the instantiated_target_ field has already been set.
5490
5491 2009-03-23 Ian Lance Taylor <iant@google.com>
5492
5493 * gold-threads.h (class Initialize_lock): Define.
5494 * gold-threads.cc (class Initialize_lock_once): Define.
5495 (initialize_lock_control): New static variable.
5496 (initialize_lock_pointer): New static variable.
5497 (initialize_lock_once): New static function.
5498 (Initialize_lock::Initialize_lock): Define.
5499 (Initialize_lock::initialize): Define.
5500 * target-select.h: Include "gold-threads.h".
5501 (class Target_selector): Add lock_ and initialize_lock_ fields.
5502 Don't define instantiate_target, just declare it.
5503 * target-select.cc (Target_selector::Target_selector): Initialize
5504 new fields.
5505 (Target_selector::instantiate_target): Define.
5506 * descriptors.h: Include "gold-threads.h".
5507 (class Descriptors): Add initialize_lock_ field.
5508 * descriptors.cc (Descriptors::Descriptors): Initialize new
5509 field.
5510 (Descriptors::open): Use initialize_lock_ field
5511 * errors.h (class Errors): Add initialize_lock_ field.
5512 * errors.cc (Errors::Errors): Initialize new field.
5513 (Errors::initialize_lock): Use initialize_lock_ field.
5514 * powerpc.cc (class Target_selector_powerpc): Remove
5515 instantiated_target_ field. In do_recognize call
5516 instantiate_target rather than do_instantiate_target. In
5517 do_instantiate_target just allocate a new target.
5518 * sparc.cc (class Target_selector_sparc): Likewise.
5519
5520 * freebsd.h: New file.
5521 * i386.cc: Include "freebsd.h".
5522 (Target_i386): Derive from Target_freebsd rather than
5523 Sized_target.
5524 (Target_selector_i386): Derive from Target_selector_freebsd rather
5525 than Target_selector.
5526 * x86_64.cc: Include "freebsd.h".
5527 (Target_x86_64): Derive from Target_freebsd rather than
5528 Sized_target.
5529 (Target_selector_x86_64): Derive from Target_selector_freebsd
5530 rather than Target_selector.
5531 * target.h (class Target): Add adjust_elf_header and
5532 do_adjust_elf_header.
5533 * output.cc (Output_file_header:: do_sized_write): Call target
5534 adjust_elf_header routine.
5535 * configure.tgt: Set targ_osabi.
5536 * configure.ac: Define GOLD_DEFAULT_OSABI.
5537 * parameters.cc (Parameters::default_target): Pass
5538 GOLD_DEFAULT_OSABI to select_target.
5539 * target-select.h (class Target_selector): Make instantiate_target
5540 protected rather than private.
5541 * Makefile.am (HFILES): Add freebsd.h.
5542 * configure, Makefile.in, config.in: Rebuild.
5543
5544 * merge.cc (do_add_input_section): Correct pend value. Change
5545 message about last entry not being null terminated from error to
5546 warning.
5547
5548 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
5549
5550 * incremental.cc: New file.
5551 * Makefile.am (CCFILES): Add incremental.cc.
5552 * Makefile.in: Rebuild.
5553
5554 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
5555
5556 * layout.cc (Layout::output_section_name): Preserve names
5557 of '.note.' sections.
5558
5559 2009-03-19 Ian Lance Taylor <iant@google.com>
5560
5561 * descriptors.cc (Descriptors::open): Check that the options are
5562 valid before using them.
5563
5564 2009-03-18 Ian Lance Taylor <iant@google.com>
5565
5566 * script-sections.h: Include <list>.
5567 (class Script_sections): Change Sections_elements from std::vector
5568 to std::list. Typedef public Elements_iterator. Add
5569 orphan_section_placement_, data_segment_align_start_, and
5570 saw_data_segment_align_ fields. Remove data_segment_align_index_
5571 field.
5572 * script-sections.cc (class Orphan_section_placement): New class.
5573 (class Sections_element): Add virtual functions is_relro and
5574 orphan_section_init. Remove virtual function place_orphan_here.
5575 (class Output_section_definition): Add is_relro and
5576 orphan_section_init. Remove place_orphan_here.
5577 (class Orphan_output_section): Likewise.
5578 (Script_sections::Script_sections): Update for field changes.
5579 (Script_sections::data_segment_align): Set saw_data_segment_align_
5580 and data_segment_align_start_, not data_segment_align_index.
5581 (Script_sections::data_segment_relro_end): Check
5582 saw_data_segment_align_. Use data_segment_align_start_ rather
5583 than data_segment_align_index_.
5584 (Script_sections::place_orphan): Rewrite to use
5585 Orphan_section_placement.
5586
5587 2009-03-17 Ian Lance Taylor <iant@google.com>
5588
5589 * archive.cc (Archive::add_symbols): Check for a version attached
5590 to the symbol name in the archive map.
5591 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
5592 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
5593 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
5594 (ver_test_11.a): New target.
5595 * testsuite/Makefile.in: Rebuild.
5596
5597 * configure.ac: Check for chsize and posix_fallocate. Replace
5598 ftruncate.
5599 * ftruncate.c: New file, from gnulib.
5600 * output.cc (posix_fallocate): Define dummy version if not
5601 HAVE_POSIX_FALLOCATE.
5602 (Output_file::map): Call posix_fallocate rather than lseek and
5603 write.
5604 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
5605 * configure, Makefile.in, config.in: Rebuild.
5606
5607 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
5608
5609 * layout.h (Layout::create_note): Add section_name parameter.
5610 * layout.cc (Layout::create_note): Likewise.
5611 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
5612
5613 2009-03-17 Ian Lance Taylor <iant@google.com>
5614
5615 * descriptors.cc: Include "options.h".
5616 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
5617 (Descriptors::open): Always use O_CLOEXEC when opening a new
5618 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
5619 then set FD_CLOEXEC.
5620
5621 * sparc.cc (class Target_sparc): Add has_got_section.
5622 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
5623 make sure we have a GOT section.
5624
5625 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
5626 (Target_sparc::Scan::local): Likewise.
5627 (Target_sparc::Scan::global): Likewise.
5628 (Target_sparc::Relocate::relocate): Likewise.
5629 (Target_sparc::Relocate::relocate_tls): Likewise.
5630
5631 * symtab.cc (Symbol_table::define_default_version): New function,
5632 broken out of add_from_object.
5633 (Symbol_table::add_from_object): Call define_default_version.
5634 (Symbol_table::define_special_symbol): Add resolve_oldsym
5635 parameter. Change all callers. If the version for a symbol comes
5636 from a version script, resolve it with the symbol with the same
5637 name with no version. Also add the symbol without a version if
5638 appropriate.
5639 (do_define_in_output_data): If resolving with oldsym, don't delete
5640 sym.
5641 (do_define_in_output_segment): Likewise.
5642 (do_define_as_constant): Likewise.
5643 * symtab.h (class Symbol_table): Update declarations.
5644
5645 2009-03-13 Ian Lance Taylor <iant@google.com>
5646
5647 * readsyms.cc (Read_symbols::incompatible_warning): New function.
5648 (Read_symbols::requeue): New function.
5649 (Read_symbols::do_read_symbols): If make_elf_object fails because
5650 the target type is not configured, and the file was searched for,
5651 issue a warning and retry with the next directory.
5652 (Add_symbols::run): If the file has an incompatible format, and
5653 it was searched for, requeue the Read_symbols task. On error,
5654 release the object.
5655 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
5656 dirindex parameter to constructor. Change all callers. Declare
5657 incompatible_warning and requeue.
5658 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
5659 input_argument_ and input_group_ fields. Add them to
5660 constructor. Change all callers.
5661 (class Read_script): Add dirindex_ field. Add it to constructor.
5662 Change all callers.
5663 * archive.cc (Archive::setup): Remove input_objects parameter.
5664 Change all callers.
5665 (Archive::get_file_and_offset): Likewise.
5666 (Archive::read_all_symbols): Likewise.
5667 (Archive::read_symbols): Likewise.
5668 (Archive::get_elf_object_for_member): Remove input_objects
5669 parameter. Add punconfigured parameter. Change all callers.
5670 (Archive::add_symbols): Change return type to bool. Check return
5671 value of include_member.
5672 (Archive::include_all_members): Likewise.
5673 (Archive::include_member): Change return type to bool. Return
5674 false if first included object has incompatible target. Set
5675 included_member_ field.
5676 (Add_archive_symbols::run): If add_symbols returns false, requeue
5677 Read_symbols task.
5678 * archive.h (class Archive): Add included_member_ field.
5679 Initialize it in constructor. Add input_file and searched_for
5680 methods. Update declarations.
5681 (class Add_archive_symbols): Add dirpath_, dirindex_, and
5682 input_argument_ fields. Add them to constructor. Change all
5683 callers.
5684 * script.cc: Include "target-select.h".
5685 (class Parser_closure): Add skip_on_incompatible_target_ and
5686 found_incompatible_target_ fields. Add
5687 skip_on_incompatible_target parameter to constructor. Change all
5688 callers. Add methods skip_on_incompatible_target,
5689 clear_skip_on_incompatible_target, found_incompatible_target, and
5690 set_found_incompatible_target.
5691 (read_input_script): Add dirindex parameter. Change all callers.
5692 If parser finds an incompatible target, requeue Read_symbols
5693 task.
5694 (script_set_symbol): Clear skip_on_incompatible_target in
5695 closure.
5696 (script_add_assertion, script_parse_option): Likewise.
5697 (script_start_sections, script_add_phdr): Likewise.
5698 (script_check_output_format): New function.
5699 * script.h (read_input_script): Update declaration.
5700 * script-c.h (script_check_output_format): Declare.
5701 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
5702 (ignore_cmd): Remove OUTPUT_FORMAT.
5703 * fileread.cc (Input_file::Input_file): Add explicit this.
5704 (Input_file::will_search_for): New function.
5705 (Input_file::open): Add pindex parameter. Change all callers.
5706 * fileread.h (class Input_file): Add input_file_argument method.
5707 Declare will_search_for. Update declarations.
5708 * object.cc (make_elf_object): Add punconfigured parameter.
5709 Change all callers.
5710 * object.h (class Object): Make input_file public. Add
5711 searched_for method.
5712 (make_elf_object): Update declaration.
5713 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
5714 restart search.
5715 * dirsearch.h (class Dirsearch): Update declaration.
5716 * options.h (class General_options): Add --warn-search-mismatch.
5717 * parameters.cc (Parameters::is_compatible_target): New function.
5718 * parameters.h (class Parameters): Declare is_compatible_target.
5719 * workqueue.cc (Workqueue::add_blocker): New function.
5720 * workqueue.h (class Workqueue): Declare add_blocker.
5721
5722 * fileread.cc (Input_file::open): Remove options parameter.
5723 Change all callers.
5724 (Input_file::open_binary): Likewise.
5725 * script.cc (read_input_script): Likewise.
5726 * readsyms.h (class Read_symbols): Remove options_ field. Remove
5727 options parameter from constructor. Change all callers.
5728 (class Read_script): Likewise.
5729 * fileread.h (class Input_file): Update declarations.
5730 * script.h (read_input_script): Update declaration.
5731
5732 2009-03-10 Nick Clifton <nickc@redhat.com>
5733
5734 * po/es.po: New Spanish translation.
5735
5736 2009-03-06 Cary Coutant <ccoutant@google.com>
5737
5738 * options.cc (parse_short_option): Keep dash_z from registering itself.
5739
5740 2009-03-03 Ian Lance Taylor <iant@google.com>
5741
5742 PR 9918
5743 * target-reloc.h (relocate_section): Pass output_section to
5744 relocate.
5745 * i386.cc (Target_i386::should_apply_static_reloc): Add
5746 output_section parameter. Change all callers.
5747 (Target_i386::Relocate::relocate): Add output_section parameter.
5748 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5749 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
5750 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
5751 * testsuite/two_file_shared.sh: New script.
5752 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
5753 (check_DATA): Add two_file_shared.dbg.
5754 (two_file_shared.dbg): New target.
5755 * testsuite/Makefile.in: Rebuild.
5756
5757 2009-03-01 Ian Lance Taylor <iant@google.com>
5758
5759 * configure.ac: Check for byteswap.h.
5760 * configure: Rebuild.
5761 * config.in: Rebuild.
5762
5763 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
5764
5765 * layout.cc (Layout::find_or_add_kept_section): New function.
5766 (Layout::add_comdat): Removed.
5767 * layout.h (struct Kept_section): Move out of class Layout.
5768 Remove trailing underscores from field names. Add group_sections
5769 field. Rename group_ field to is_group. Change all uses.
5770 (class Layout): Declare find_or_add_kept_section, not add_comdat.
5771 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
5772 comdat_groups_ field.
5773 (Sized_relobj::include_section_group): Use
5774 find_or_add_kept_section and Kept_section::group_sections.
5775 (Sized_relobj::include_linkonce_section): Likewise.
5776 * object.cc (class Sized_relobj): Don't define Comdat_group or
5777 Comdat_group_table. Remove find_comdat_group and
5778 add_comdat_group. Remove comdat_groups_ field.
5779 * plugin.cc (include_comdat_group): Use
5780 Layout::find_or_add_kept_section.
5781
5782 2009-02-28 Ian Lance Taylor <iant@google.com>
5783
5784 * README: --gc-sections and map files are now supported. Document
5785 some build requirements.
5786
5787 PR 6992
5788 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
5789 relocatable link set the value of the section symbol to zero.
5790 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
5791 relocatable link don't include the section address in the local
5792 symbol value.
5793
5794 2009-02-27 Ian Lance Taylor <iant@google.com>
5795
5796 PR 6811
5797 * options.h (class Search_directory): Add is_system_directory.
5798 (class General_options): Declare is_in_system_directory.
5799 * options.cc (get_relative_sysroot): Make static.
5800 (get_default_sysroot): Make static.
5801 (General_optoins::is_in_system_directory): New function.
5802 * fileread.cc (Input_file::is_in_system_directory): New function.
5803 * fileread.h (class Input_file): Declare is_in_system_directory.
5804 * object.h (class Object): Add is_in_system_directory.
5805 (class Input_objects): Remove system_library_directory_ field.
5806 * object.cc (Input_objects::add_object): Don't set
5807 system_library_directory_.
5808 (input_objects::found_in_system_library_directory): Remove.
5809 * symtab.cc (Symbol_table::write_globals): Remove input_objects
5810 parameter. Change all callers.
5811 (Symbol_table::sized_write_globals): Likewise.
5812 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
5813 Call Object::is_in_system_directory.
5814 * symtab.h (class Symbol_table): Update declarations.
5815
5816 PR 5990
5817 * descriptors.h (Open_descriptor): Add is_on_stack field.
5818 * descriptors.cc (Descriptors::open): If the descriptor is on the
5819 top of the stack, remove it. Initialize is_on_stack field.
5820 (Descriptors::release): Only add pod to stack if it is not on the
5821 stack already.
5822 (Descriptors::close_some_descriptor): Clear stack_next and
5823 is_on_stack fields.
5824
5825 PR 7091
5826 * output.cc (Output_section::find_starting_output_address): Rename
5827 from starting_output_address; add PADDR parameter; change return
5828 type.
5829 * output.h (class Output_section): Declare
5830 find_starting_output_address instead of starting_output_address.
5831 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
5832 section symbol for which we can't find a merge section.
5833
5834 PR 9836
5835 * symtab.cc (Symbol_table::add_from_object): If the visibility is
5836 hidden or internal, force the symbol to be local.
5837 * resolve.cc (Symbol::override_visibility): Define.
5838 (Symbol::override_base): Use override_visibility.
5839 (Symbol_table::resolve): Likewise.
5840 (Symbol::override_base_with_special): Likewise.
5841 (Symbol_table::override_with_special): If the visibility is hidden
5842 or internal, force the symbol to be local.
5843 * symtab.h (class Symbol): Add set_visibility and
5844 override_visibility.
5845 * testsuite/ver_test_1.sh: New file.
5846 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
5847 (check_DATA): Add ver_test_1.syms.
5848 (ver_test_1.syms): New target.
5849 * testsuite/Makefile.in: Rebuild.
5850
5851 2009-02-25 Cary Coutant <ccoutant@google.com>
5852
5853 * layout.cc (Layout::choose_output_section): Don't rename sections
5854 when using a linker script that has a SECTIONS clause.
5855 * Makefile.in: Regenerate.
5856
5857 * testsuite/Makefile.am (script_test_5.sh): New test case.
5858 * testsuite/Makefile.in: Regenerate.
5859 * testsuite/script_test_5.cc: New file.
5860 * testsuite/script_test_5.sh: New file.
5861 * testsuite/script_test_5.t: New file.
5862
5863 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
5864
5865 * archive.cc (Archive::include_member): Update calls to add_symbols.
5866 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
5867 the Layout argument.
5868 * dynobj.h (do_add_symbols): Add the Layout argument.
5869 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
5870 Layout argument.
5871 * object.h (Object::add_symbols): Add the Layout argument.
5872 (Object::do_add_symbols): Add the Layout argument.
5873 (Sized_relobj::do_add_symbols): Add the Layout argument.
5874 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
5875 Unify the two versions.
5876 (Add_plugin_symbols): Remove.
5877 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
5878 (Sized_pluginobj::do_add_symbols): Unify the two versions.
5879 (Add_plugin_symbols): Remove.
5880 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
5881 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
5882 (Add_symbols::run): Make it work with Pulginobj.
5883
5884 2009-02-06 Ian Lance Taylor <iant@google.com>
5885
5886 * object.cc (Sized_relobj::do_layout): Make info message start
5887 with lower case letter.
5888
5889 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
5890
5891 * binary.cc: Fix file comment.
5892
5893 * options.h (enum Incremental_disposition): Define.
5894 (class General_options): Add new options: --incremental,
5895 --incremental_changed, --incremental_unchanged,
5896 --incremental_unknown. Add incremental_disposition_ and
5897 implicit_incremental_ fields.
5898 (General_options::incremental_disposition): New function.
5899 (class Position_dependent_options): Add incremental_disposition
5900 option.
5901 (Position_dependent_options::copy_from_options): Set incremental
5902 dispositions.
5903 * options.cc (General_options::parse_incremental_changed): New
5904 function.
5905 (General_options::parse_incremental_unchanged): New function.
5906 (General_options::parse_incremental_unknown): New function.
5907 (General_options::General_options): Initialize new fields
5908 incremental_disposition_ and implicit_incremental_.
5909 (General_options::finalize): Check for uasge of --incremental-*
5910 without --incremental.
5911
5912 2009-02-06 Chris Demetriou <cgd@google.com>
5913
5914 * gold.h (gold_undefined_symbol): Change to take only a Symbol
5915 pointer and to report location as the file name associated with
5916 the symbol.
5917 (gold_undefined_symbol_at_location): New function to replace the
5918 old gold_undefined_symbol functionality.
5919 * target-reloc.h (relocate_section): Update to use
5920 gold_undefined_symbol_at_location.
5921 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
5922 Call gold_undefined_symbol function rather than gold_error.
5923 * errors.h (Errors::undefined_symbol): Take location as a
5924 string, rather than calculating it from a relocation.
5925 * errors.cc (Errors::fatal): Print "fatal error:" before the
5926 formatted message.
5927 (Errors::error, Errors::error_at_location): Print "error: "
5928 before the formatted message.
5929 (Errors::undefined_symbol): Take location as a string, rather
5930 than calculating it from a relocation.
5931 (gold_undefined_symbol_at_location): New function akin to
5932 old gold_undefined_symbol, calculates location from relocation.
5933 (gold_undefined_symbol): Change to take only a Symbol pointer
5934 and to report location as the file name associated with the symbol.
5935 * testsuite/debug_msg.sh: Update for changed error messages.
5936 * testsuite/undef_symbol.sh: Likewise.
5937
5938 2009-02-04 Duncan Sands <baldrick@free.fr>
5939
5940 PR 9812
5941 * reduced_debug_output.h
5942 (Output_reduced_debug_abbrev_section::failed): Use format for
5943 gold_warning.
5944 (Output_reduced_debug_info_section::faild): Likewise.
5945
5946 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
5947
5948 * script.cc (Lazy_demangler): New class.
5949 (Version_script_info::get_symbol_version_helper): Demangle a
5950 symbol only once.
5951
5952 2009-01-29 Cary Coutant <ccoutant@google.com>
5953
5954 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
5955 to __tls_get_addr.
5956 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
5957
5958 2009-01-28 Ian Lance Taylor <iant@google.com>
5959
5960 * version.cc (version_string): Bump to 1.9.
5961
5962 * gold.h: Include <cstring> and <stdint.h>.
5963 * version.cc: Include <cstdio>.
5964 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
5965 warning.
5966 * reduced_debug_output.cc (insert_into_vector): Rename from
5967 Insert_into_vector; change all callers. Use Swap_unaligned to
5968 avoid aliasing issue; remove union since it is unnecessary.
5969
5970 2009-01-27 Sriraman Tallam <tmsriram@google.com>
5971
5972 * Makefile.am (CCFILES): Add gc.cc.
5973 (HFILES): Add gc.h.
5974 * Makefile.in: Regenerate.
5975 * gold.cc (Gc_runner): New class.
5976 (queue_initial_tasks): Call garbage collection related tasks
5977 when corresponding options are invoked.
5978 (queue_middle_gc_tasks): New function.
5979 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
5980 processed early before laying out sections during garbage collection.
5981 * gold.h (queue_middle_gc_tasks): New function.
5982 (is_prefix_of): Move from "layout.cc".
5983 * i386.cc (Target_i386::gc_process_relocs): New function.
5984 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
5985 * main.cc (main): Create object of class "Garbage_collection".
5986 * object.cc (Relobj::copy_symbols_data): New function.
5987 (Relobj::is_section_name_included): New function.
5988 (Sized_relobj::do_layout): Allow this function to be called twice
5989 during garbage collection and defer layout of section during the
5990 first call.
5991 * object.h (Relobj::get_symbols_data): New function.
5992 (Relobj::is_section_name_included): New function.
5993 (Relobj::copy_symbols_data): New function.
5994 (Relobj::set_symbols_data): New function.
5995 (Relobj::get_relocs_data): New function.
5996 (Relobj::set_relocs_data): New function.
5997 (Relobj::is_output_section_offset_invalid): New pure virtual function.
5998 (Relobj::gc_process_relocs): New function.
5999 (Relobj::do_gc_process_relocs): New pure virtual function.
6000 (Relobj::sd_): New data member.
6001 (Sized_relobj::is_output_section_offset_invalid): New function.
6002 (Sized_relobj::do_gc_process_relocs): New function.
6003 * options.h (General_options::gc_sections): Modify to not be a no-op.
6004 (General_options::print_gc_sections): New option.
6005 * plugin.cc (Plugin_finish::run): Remove function call to
6006 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
6007 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
6008 * reloc.cc (Read_relocs::run): Add task to process relocs and
6009 determine unreferenced sections when doing garbage collection.
6010 (Gc_process_relocs): New class.
6011 (Sized_relobj::do_gc_process_relocs): New function.
6012 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
6013 sections that are garbage collected.
6014 * reloc.h (Gc_process_relocs): New class.
6015 * sparc.cc (Target_sparc::gc_process_relocs): New function.
6016 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
6017 symbols whose corresponding sections are garbage collected.
6018 (Symbol_table::Symbol_table): Add new parameter for the garbage
6019 collection object.
6020 (Symbol_table::gc_mark_undef_symbols): New function.
6021 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6022 (Symbol_table::gc_mark_dyn_syms): New function.
6023 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
6024 as garbage.
6025 (Symbol_table::add_from_object): Likewise.
6026 (Symbol_table::add_from_relobj): When building shared objects, do not
6027 treat externally visible symbols as garbage.
6028 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
6029 table information for static and relocatable links.
6030 * symtab.h (Symbol_table::set_gc): New function.
6031 (Symbol_table::gc): New function.
6032 (Symbol_table::gc_mark_undef_symbols): New function.
6033 (Symbol_table::gc_mark_symbol_for_shlib): New function.
6034 (Symbol_table::gc_mark_dyn_syms): New function.
6035 (Symbol_table::gc_): New data member.
6036 * target.h (Sized_target::gc_process_relocs): New pure virtual
6037 function.
6038 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
6039 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
6040
6041 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
6042
6043 * options.h (General_options::gc_sections): Define as a no-op for now.
6044 (General_options::no_keep_memory): Ditto.
6045 (General_options::Bshareable): Define.
6046 * options.cc (General_options::finalize): Honor -Bshareable.
6047
6048 2009-01-20 Andreas Schwab <schwab@suse.de>
6049
6050 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
6051 read the value in the contents, since we don't use it. Use the
6052 template endianness when writing.
6053 (Relocate::relocate): Use it for R_PPC_REL16_HA.
6054
6055 2009-01-19 Andreas Schwab <schwab@suse.de>
6056
6057 * configure.tgt (powerpc64-*): Fix targ_obj.
6058
6059 2009-01-15 Ian Lance Taylor <iant@google.com>
6060
6061 * object.cc (Sized_relobj::write_local_symbols): Don't write out
6062 local symbols when stripping all symbols.
6063
6064 2009-01-14 Cary Coutant <ccoutant@google.com>
6065
6066 * output.cc (Output_reloc): Add explicit instantiations.
6067
6068 2009-01-14 Cary Coutant <ccoutant@google.com>
6069
6070 * archive.cc (Archive::get_elf_object_for_member): Remove call
6071 to File_read::claim_for_plugin.
6072 * descriptors.cc (Descriptors::open): Remove reference to
6073 is_claimed.
6074 (Descriptors::claim_for_plugin): Remove.
6075 * descriptors.h (Descriptors::claim_for_plugin): Remove.
6076 (Descriptors::is_claimed): Remove.
6077 (claim_descriptor_for_plugin): Remove.
6078 * fileread.cc (File_read::claim_for_plugin): Remove.
6079 * fileread.h (File_read::claim_for_plugin): Remove.
6080 (File_read::descriptor): Reopen descriptor if necessary.
6081 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
6082 (Plugin_manager::all_symbols_read): Add task parameter. Change
6083 all callers.
6084 (Plugin_manager::get_input_file): New function.
6085 (Plugin_manager::release_input_file): New function.
6086 (Pluginobj::Pluginobj): Add filesize parameter and initialize
6087 corresponding data member.
6088 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
6089 and pass to base constructor. Change all callers.
6090 (get_input_file, release_input_file): New functions.
6091 (make_sized_plugin_object): Add filesize parameter. Change all callers.
6092 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
6093 (Plugin_manager::all_symbols_read): Add task parameter.
6094 (Plugin_manager::get_input_file): New function.
6095 (Plugin_manager::release_input_file): New function.
6096 (Plugin_manager::task_): New data member.
6097 (Pluginobj::Pluginobj): Add filesize parameter.
6098 (Pluginobj::filename): New function.
6099 (Pluginobj::descriptor): New function.
6100 (Pluginobj::filesize): New function.
6101 (Pluginobj::filesize_): New data member.
6102 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
6103 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
6104 File_read::claim_for_plugin; use Object::unlock to unlock the file.
6105
6106 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
6107 with archive libraries.
6108 * testsuite/Makefile.in: Regenerate.
6109 * testsuite/plugin_test.c (struct sym_info): New type.
6110 (get_input_file, release_input_file): New static variables.
6111 (onload): Capture new transfer vector entries.
6112 (claim_file_hook): Stop reading at end of file according to filesize.
6113 Factor out parsing of readelf output into separate function.
6114 (all_symbols_read_hook): Exercise get_input_file and release_input_file
6115 APIs and get the source file name from the symbol table. Convert
6116 source file name to corresponding object file name. Print info
6117 message when adding new input files.
6118 (parse_readelf_line): New function.
6119 * testsuite/plugin_test_1.sh: Add checks for new info messages.
6120 * testsuite/plugin_test_2.sh: Likewise.
6121 * testsuite/plugin_test_3.sh: Likewise.
6122 * testsuite/plugin_test_4.sh: New test case.
6123
6124 2009-01-07 Ian Lance Taylor <iant@google.com>
6125
6126 * version.cc (version_string): Bump to 1.8.
6127
6128 2008-12-23 Cary Coutant <ccoutant@google.com>
6129
6130 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
6131 * plugin.cc (Plugin_manager::finish): Rename as
6132 layout_deferred_objects. Move cleanup to separate function.
6133 (Plugin_manager::cleanup): New function.
6134 (Plugin_finish::run): Call layout_deferred_objects and cleanup
6135 separately.
6136 * plugin.h (Plugin_manager::finish): Rename as
6137 layout_deferred_objects.
6138 (Plugin_manager::cleanup): New function.
6139 (Plugin_manager::cleanup_done): New field.
6140
6141 2008-12-23 Cary Coutant <ccoutant@google.com>
6142
6143 * plugin.cc (is_visible_from_outside): New function.
6144 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
6145 so we don't return "IR only" status for exported symbols or -r links.
6146
6147 * testsuite/Makefile.am (plugin_test_3): New test case.
6148 * testsuite/Makefile.in: Regenerate.
6149 * testsuite/plugin_test_3.sh: New file.
6150
6151 2008-12-22 Cary Coutant <ccoutant@google.com>
6152
6153 * object.cc (Sized_relobj::layout_section): New function.
6154 (Sized_relobj::do_layout): Defer layout of input sections until after
6155 plugin has provided replacement files.
6156 (Sized_relobj::do_layout_deferred_sections): New function.
6157 * object.h (Relobj::set_section_offset): Remove virtual keyword.
6158 (Relobj::layout_deferred_sections): New function.
6159 (Relobj::do_layout_deferred_sections): New function.
6160 (Sized_relobj::do_layout_deferred_sections): New function.
6161 (Sized_relobj::layout_section): New function.
6162 (Sized_relobj::Deferred_layout): New structure.
6163 (Sized_relobj::deferred_layout_): New field.
6164 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
6165 Change all callers. Layout deferred sections.
6166 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
6167 references.
6168 (Plugin_hook::run): Move code from do_plugin_hook inline.
6169 (Plugin_hook::do_plugin_hook): Remove.
6170 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
6171 (Plugin_manager::finish): Renamed, was cleanup.
6172 (Plugin_manager::should_defer_layout): New function.
6173 (Plugin_manager::add_deferred_layout_object): New function.
6174 (Plugin_manager::Deferred_layout_list): New type.
6175 (Plugin_manager::deferred_layout_objects_): New field.
6176 (Plugin_hook::do_plugin_hook): Remove.
6177
6178 2008-12-17 Ian Lance Taylor <iant@google.com>
6179
6180 * options.h (class General_options): Add --no case for
6181 --export-dynamic.
6182
6183 2008-12-16 Cary Coutant <ccoutant@google.com>
6184
6185 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
6186 vector.
6187 (Plugin_manager::claim_file): Create plugin object even if
6188 plugin did not call the add_symbols callback.
6189 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
6190 asking for more symbols than were added.
6191 * testsuite/Makefile.am (plugin_test_1): Add test case with
6192 no global symbols.
6193 (empty.syms): New target.
6194 * testsuite/Makefile.in: Regenerate.
6195 * testsuite/plugin_test.c (claim_file_hook): Add new debug
6196 message. Don't call add_symbols if no globals.
6197 (all_symbols_read_hook): Don't provide replacement for empty
6198 claimed file.
6199
6200 2008-12-12 Ian Lance Taylor <iant@google.com>
6201
6202 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
6203 r_type == 0 for a local symbol with r_sym == 0.
6204 (scan_relocatable_relocs): Pass r_sym to
6205 local_non_section_strategy.
6206 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
6207 r_sym parameter.
6208
6209 * configure.ac: Update test for TLS descriptors: they are
6210 supported as of glibc 2.9.
6211 * configure: Rebuild.
6212
6213 2008-12-11 Ian Lance Taylor <iant@google.com>
6214
6215 PR 7091
6216 * target-reloc.h (Default_scan_relocatable_relocs): For each
6217 function, map r_type == 0 to RELOC_DISCARD.
6218
6219 2008-12-10 Cary Coutant <ccoutant@google.com>
6220
6221 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
6222 object to override a kept COMDAT group from a plugin object.
6223
6224 2008-12-09 Ian Lance Taylor <iant@google.com>
6225
6226 PR 7088
6227 * yyscript.y (file_cmd): Handle INPUT.
6228
6229 * testsuite/initpri1.c: Change all declarations to be full
6230 prototypes by adding void, to avoid compiler warnings.
6231
6232 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
6233
6234 * options.cc (General_options::parse_plugin_opt): New.
6235 (General_options::add_plugin): The argument now is just the filename.
6236 (General_options::add_plugin_option): New.
6237 * options.h (plugin_opt): New.
6238 (add_plugin): Change argument name.
6239 (add_plugin_option): New.
6240 * plugin.cc (Plugin::load): Don't parse the plugin option.
6241 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
6242 (Plugin::add_option): New.
6243 (Plugin::args_): Change type.
6244 (Plugin::filename_): New.
6245 (Plugin_manager::add_plugin_option): New.
6246 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
6247 * testsuite/Makefile.in: Regenerate.
6248
6249 2008-12-05 Cary Coutant <ccoutant@google.com>
6250
6251 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
6252 Handle --strip-lto-sections option.
6253 * options.h (strip_lto_sections): New option.
6254
6255 2008-12-01 Cary Coutant <ccoutant@google.com>
6256
6257 * plugin.cc (ld_plugin_message): Change format parameter to const.
6258 Fix mismatch between new[] and delete.
6259
6260 2008-11-14 Cary Coutant <ccoutant@google.com>
6261
6262 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
6263 instead of -1U.
6264
6265 2008-11-05 Craig Silverstein <csilvers@google.com>
6266
6267 * options.cc (General_options::parse_dynamic_list): New function.
6268 * options.h (General_options): New flags dynamic_list,
6269 dynamic_list_data, dynamic_list_cpp_new, and
6270 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
6271 (General_options::in_dynamic_list): New function.
6272 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
6273 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
6274 (Lex::can_continue_name): Likewise.
6275 (yylex): Likewise.
6276 (read_script_file): New parameter script_options.
6277 (read_dynamic_list): New function.
6278 (Script_options::define_dynamic_list): New function.
6279 (dynamic_list_keyword_parsecodes): New variable.
6280 (dynamic_list_keywords): New variable.
6281 * script.h (Script_options::define_dynamic_list): New function
6282 prototype.
6283 (read_dynamic_list): New function prototype.
6284 * symtab.cc (strprefix): New macro.
6285 (Symbol::should_add_dynsym_entry): Support dynamic_list,
6286 dynamic_list_data, dynamic_list_cpp_new, and
6287 dynamic_list_cpp_typeinfo.
6288 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
6289 (dynamic_list_expr): New rule.
6290 (dynamic_list_nodes): Likewise.
6291 (dynamic_list_node): Likewise.
6292 * testsuite/Makefile.am (dynamic_list): New test.
6293 * testsuite/Makefile.in: Regenerated.
6294 * testsuite/dynamic_list.t: New file.
6295 * testsuite/dynamic_list.sh: New file.
6296
6297 2008-11-05 Craig Silverstein <csilvers@google.com>
6298
6299 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
6300 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
6301 (t11_last): Likewise.
6302 * testsuite/ver_test_6.c (main): Likewise.
6303
6304 2008-10-07 Cary Coutant <ccoutant@google.com>
6305
6306 * options.c (General_options::finalize): Add check for -static and
6307 -shared.
6308 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
6309 is not empty.
6310
6311 2008-10-02 Cary Coutant <ccoutant@google.com>
6312
6313 * plugin.cc (make_sized_plugin_object): Fix conditional
6314 compilation to work when not all targets are enabled.
6315
6316 2008-09-29 Cary Coutant <ccoutant@google.com>
6317
6318 * archive.cc (Archive::get_file_and_offset): Use filename instead
6319 of name to get library path.
6320 (Archive::include_member): Unlock external member of a thin archive.
6321
6322 * testsuite/Makefile.am (TEST_AR): New variable.
6323 (thin_archive_test_1): New test.
6324 (thin_archive_test_2): New test.
6325 * testsuite/Makefile.in: Regenerate.
6326 * testsuite/thin_archive_main.cc: New file.
6327 * testsuite/thin_archive_test_1.cc: New file.
6328 * testsuite/thin_archive_test_2.cc: New file.
6329 * testsuite/thin_archive_test_3.cc: New file.
6330 * testsuite/thin_archive_test_4.cc: New file.
6331
6332 2008-09-29 Cary Coutant <ccoutant@google.com>
6333
6334 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
6335 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
6336 instead of -1U.
6337 (Sized_relobj::do_finalize_local_symbols): Likewise.
6338 (Sized_relobj::map_to_kept_section): Likewise.
6339 * object.h (Sized_relobj::invalid_address): New constant.
6340 (Sized_relobj::do_output_section_offset): Check for invalid_address
6341 and return -1ULL.
6342 * output.cc (Output_reloc::local_section_offset): Use constant
6343 invalid_address instead of -1U.
6344 (Output_reloc::get_address): Likewise.
6345 (Output_section::output_address): Change -1U to -1ULL.
6346 * output.h (Output_reloc::invalid_address): New constant.
6347 * reloc.cc (Sized_relobj::write_sections): Use constant
6348 invalid_address instead of -1U.
6349 (Sized_relobj::relocate_sections): Likewise.
6350 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
6351 values for merge sections.
6352 * target-reloc.h (relocate_for_relocatable): Use constant
6353 invalid_address instead of -1U.
6354
6355 2008-09-19 Cary Coutant <ccoutant@google.com>
6356
6357 Add plugin functionality for link-time optimization (LTO).
6358 * configure.ac (plugins): Add --enable-plugins option.
6359 * configure: Regenerate.
6360 * config.in: Regenerate.
6361 * Makefile.am (LIBDL): New variable.
6362 (CCFILES): Add plugin.cc.
6363 (HFILES): Add plugin.h.
6364 (ldadd_var): Add LIBDL.
6365 * Makefile.in: Regenerate.
6366
6367 * archive.cc: Include "plugin.h".
6368 (Archive::setup): Don't preread archive symbols when using a plugin.
6369 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
6370 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
6371 files.
6372 (Archive::include_member): Add symbols from plugin objects.
6373 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
6374 * descriptors.cc (Descriptors::open): Check for file descriptors
6375 abandoned by plugins.
6376 (Descriptors::claim_for_plugin): New function.
6377 * descriptors.h (Descriptors::claim_for_plugin): New function.
6378 (Open_descriptor::is_claimed): New field.
6379 (claim_descriptor_for_plugin): New function.
6380 * fileread.cc (File_read::claim_for_plugin): New function.
6381 * fileread.h (File_read::claim_for_plugin): New function.
6382 (File_read::descriptor): New function.
6383 * gold.cc: Include "plugin.h".
6384 (queue_initial_tasks): Add task to call plugin hooks for generating
6385 new object files.
6386 * main.cc: Include "plugin.h".
6387 (main): Load plugin libraries.
6388 * object.h (Pluginobj): Declare.
6389 (Object::pluginobj): New function.
6390 (Object::do_pluginobj): New function.
6391 (Object::set_target): New function.
6392 * options.cc: Include "plugin.h".
6393 (General_options::parse_plugin): New function.
6394 (General_options::General_options): Initialize plugins_ field.
6395 (General_options::add_plugin): New function.
6396 * options.h (Plugin_manager): Declare.
6397 (General_options): Add --plugin option.
6398 (General_options::has_plugins): New function.
6399 (General_options::plugins): New function.
6400 (General_options::add_plugin): New function.
6401 (General_options::plugins_): New field.
6402 * plugin.cc: New file.
6403 * plugin.h: New file.
6404 * readsyms.cc: Include "plugin.h".
6405 (Read_symbols::do_read_symbols): Check for archive before checking
6406 for ELF file. Call plugin hooks to claim files.
6407 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
6408 from a real object file; force override when processing replacement
6409 files.
6410 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
6411 (Symbol::init_base_object): Likewise.
6412 (Symbol::init_base_output_data): Likewise.
6413 (Symbol::init_base_output_segment): Likewise.
6414 (Symbol::init_base_constant): Likewise.
6415 (Symbol::init_base_undefined): Likewise.
6416 (Symbol::output_section): Assert that object is not a plugin.
6417 (Symbol_table::add_from_pluginobj): New function.
6418 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
6419 undefined.
6420 (Symbol_table::sized_write_globals): Likewise.
6421 (Symbol_table::add_from_pluginobj): Instantiate template.
6422 * symtab.h (Sized_pluginobj): Declare.
6423 (Symbol::in_real_elf): New function.
6424 (Symbol::set_in_real_elf): New function.
6425 (Symbol::in_real_elf_): New field.
6426 (Symbol_table::add_from_pluginobj): New function.
6427
6428 * testsuite/Makefile.am (AM_CFLAGS): New variable.
6429 (LIBDL): New variable.
6430 (LDADD): Add LIBDL.
6431 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
6432 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
6433 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
6434 (MOSTLYCLEANFILES): Likewise.
6435 * testsuite/Makefile.in: Regenerate.
6436 * testsuite/plugin_test.c: New file.
6437 * testsuite/plugin_test_1.sh: New file.
6438 * testsuite/plugin_test_2.sh: New file.
6439
6440 2008-09-16 Ian Lance Taylor <iant@google.com>
6441
6442 * target-reloc.h (relocate_section): Check whether a symbol is
6443 defined by the ABI before reporting an undefined symbol error.
6444 * target.h (Target::is_defined_by_abi): Make parameter const.
6445 (Target::do_is_defined_by_abi): Likewise.
6446 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
6447 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
6448 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
6449 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
6450 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
6451 * testsuite/Makefile.in: Rebuild.
6452
6453 * fileread.cc (make_view): Add casts to avoid warning.
6454
6455 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
6456
6457 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
6458 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6459
6460 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
6461
6462 * options.h (General_options::output_is_executable): New.
6463 (General_options::output_is_pie): New.
6464 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
6465 for shared libraries.
6466 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
6467
6468 2008-09-11 Chris Demetriou <cgd@google.com>
6469
6470 * options.h (origin): New -z option.
6471 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
6472 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
6473 in DT_FLAGS_1.
6474
6475 2008-09-05 Cary Coutant <ccoutant@google.com>
6476
6477 * fileread.cc (File_read::make_view): Add check for attempt to map
6478 beyond end of file.
6479
6480 2008-09-05 Cary Coutant <ccoutant@google.com>
6481
6482 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
6483 explicit instantiations.
6484
6485 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
6486
6487 PR gold/6858
6488 * options.cc (General_options::finalize): Allow undefined symbols
6489 in shlibs if linking -shared.
6490
6491 PR gold/6859
6492 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
6493 symbols as not needing a dynsym entry.
6494
6495 2008-08-20 Craig Silverstein <csilvers@google.com>
6496
6497 * fileread.cc (File_read::open): Do not lock the file unless it
6498 was successfully opened.
6499
6500 2008-08-14 Cary Coutant <ccoutant@google.com>
6501
6502 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
6503 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
6504 * testsuite/tls_test.cc (struct int128): 128-bit struct
6505 for testing TLS relocs with non-zero addend.
6506 (v12): New TLS variable.
6507 (t12): New test.
6508 (t_last): Add check for v12.
6509 * testsuite/tls_test.h (t12): New function.
6510 * testsuite/tls_test_main.cc (thread_routine): Call new test.
6511
6512 2008-08-13 Ian Lance Taylor <iant@google.com>
6513
6514 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
6515 set tls_segment_ or relro_segment_.
6516 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
6517 when appropriate.
6518 * output.h (Output_section::clear_is_relro): New function.
6519 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
6520 sections specially even when output_data_ is empty.
6521 (Output_segment::maximum_alignment): When first section is relro,
6522 only force alignment for PT_LOAD segments.
6523 * script.cc (script_data_segment_align): New function.
6524 (script_data_segment_relro_end): New function.
6525 * script-c.h (script_data_segment_align): Declare.
6526 (script_data_segment_relro_end): Declare.
6527 * script-sections.h (class Script_sections): Declare
6528 data_segment_align and data_segment_relro_end. Add fields
6529 segment_align_index_ and saw_relro_end_.
6530 * script-sections.cc (class Sections_element): Add set_is_relro
6531 virtual function. Add new bool* parameter to place_orphan_here.
6532 Add get_output_section virtual function.
6533 (class Output_section_definition): Add set_is_relro. Add new
6534 bool* parameter to place_orphan_here. Add get_output_section.
6535 Add is_relro_ field.
6536 (Output_section_definition::Output_section_definition): Initialize
6537 evaluated_address_, evaluated_load_address, evaluated_addralign_,
6538 and is_relro_ fields.
6539 (Output_section_definition::place_orphan_here): Add is_relro
6540 parameter.
6541 (Output_section_definition::set_section_addresses): Set relro for
6542 output section.
6543 (Output_section_definition::alternate_constraint): Likewise.
6544 (class Orphan_output_section): Add new bool* parameter to
6545 place_orphan_here. Add get_output_section.
6546 (Orphan_output_section::place_orphan_here): Add is_relro
6547 parameter.
6548 (Script_sections::Script_sections): Initialize
6549 data_segment_align_index_ and saw_relro_end_.
6550 (Script_sections::data_segment_align): New function.
6551 (Script_sections::data_segment_relro_end): New function.
6552 (Script_sections::place_orphan): Set or clear is_relro.
6553 (Script_sections::set_section_addresses): Force alignment of first
6554 TLS section.
6555 * yyscript.y (exp): Call script_data_segment_align and
6556 script_data_segment_relro_end.
6557 * testsuite/relro_script_test.t: New file.
6558 * testsuite/relro_test.cc (using_script): Declare.
6559 (t1, t2): Test using_script.
6560 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
6561 (relro_script_test_SOURCES): Define.
6562 (relro_script_test_DEPENDENCIES): Define.
6563 (relro_script_test_LDFLAGS): Define.
6564 (relro_script_test_LDADD): Define.
6565 (relro_script_test.so): New target.
6566 * testsuite/Makefile.in: Rebuild.
6567
6568 2008-08-06 Cary Coutant <ccoutant@google.com>
6569
6570 * archive.cc (Archive::total_archives, Archive::total_members)
6571 (Archive::total_members_loaded): New variables.
6572 (Archive::setup): Add parameter. Add option to preread
6573 archive symbols.
6574 (Archive::read_armap): Add counter.
6575 (Archive::get_file_and_offset): New function.
6576 (Archive::get_elf_object_for_member): New function.
6577 (Archive::read_all_symbols): New function.
6578 (Archive::read_symbols): New function.
6579 (Archive::add_symbols): Add counters.
6580 (Archive::include_all_members): Use armap to find members if it's
6581 already built.
6582 (Archive::include_member): Skip reading symbols if already read.
6583 Factored code into Archive::get_file_and_offset and
6584 Archive::get_elf_object_for_member. Changed call to
6585 Mapfile::report_include_archive_member.
6586 (Archive::print_stats): New function.
6587 * archive.h: Declare Object and Read_symbols_data classes.
6588 (Archive::Archive): Add initializers for new members.
6589 (Archive::setup): Add parameter.
6590 (Archive::print_stats): New function.
6591 (Archive::total_archives, Archive::total_members)
6592 (Archive::total_members_loaded): New variables.
6593 (Archive::get_file_and_offset): New function.
6594 (Archive::get_elf_object_for_member): New function.
6595 (Archive::read_all_symbols): New function.
6596 (Archive::read_symbols): New function.
6597 (Archive::Archive_member): New class.
6598 (Archive::members_): New member.
6599 (Archive::num_members_): New member.
6600 * main.cc: Include archive.h.
6601 (main): Call Archive::print_stats.
6602 * mapfile.cc (Mapfile::report_include_archive_member): Delete
6603 archive parameter; member_name is now the fully-decorated name.
6604 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
6605 * options.h: (General_options): Add --preread-archive-symbols option.
6606 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
6607 Archive::setup.
6608
6609 2008-08-04 Ian Lance Taylor <iant@google.com>
6610
6611 * symtab.h (Symbol::use_plt_offset): New function.
6612 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
6613 * powerpc.cc (Relocate::relocate): Likewise.
6614 * sparc.cc (Relocate::relocate): Likewise.
6615 * x86_64.cc (Relocate::relocate): Likewise.
6616 * testsuite/weak_plt.sh: New test.
6617 * testsuite/weak_plt_main.cc: New test.
6618 * testsuite/weak_plt_shared.cc: New test.
6619 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
6620 (check_PROGRAMS): Add weak_plt.
6621 (check_DATA): Add weak_plt_shared.so.
6622 (weak_plt_main_pic.o, weak_plt): New targets.
6623 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
6624 * testsuite/Makefile.in: Rebuild.
6625
6626 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
6627 gcctestdir/ld.
6628 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
6629 * testsuite/Makefile.in: Rebuild.
6630
6631 2008-08-04 Alan Modra <amodra@bigpond.net.au>
6632
6633 * Makefile.am (POTFILES.in): Set LC_ALL=C.
6634 * Makefile.in: Regenerate.
6635 * po/POTFILES.in: Regenerate.
6636
6637 2008-07-29 Ian Lance Taylor <iant@google.com>
6638
6639 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
6640 symbols before other symbols.
6641 * testsuite/script_test_2.cc (test_addr): Declare.
6642 (test_addr_alias): Declare.
6643 (main): Check that test_addr and test_addr_alias have the right
6644 values.
6645 * testsuite/script_test_2.t: Define test_addr_alias and
6646 test_addr.
6647
6648 2008-07-24 Ian Lance Taylor <iant@google.com>
6649
6650 PR 5990
6651 * descriptors.cc: New file.
6652 * descriptors.h: New file.
6653 * gold-threads.h (class Hold_optional_lock): New class.
6654 * fileread.cc: Include "descriptors.h".
6655 (File_read::~File_read): Release descriptor rather than closing
6656 it.
6657 (File_read::open) [file]: Call open_descriptor rather than open.
6658 Set is_descriptor_opened_.
6659 (File_read::open) [memory]: Assert that descriptor is not open.
6660 (File_read::reopen_descriptor): New function.
6661 (File_read::release): Release descriptor.
6662 (File_read::do_read): Make non-const. Reopen descriptor.
6663 (File_read::read): Make non-const.
6664 (File_read::make_view): Reopen descriptor.
6665 (File_read::do_readv): Likewise.
6666 * fileread.h (class File_read): Add is_descriptor_opened_ field.
6667 Update declarations.
6668 * layout.cc: Include "descriptors.h".
6669 (Layout::create_build_id): Use open_descriptor rather than open.
6670 * output.cc: Include "descriptors.h".
6671 (Output_file::open): Use open_descriptor rather than open.
6672 * archive.cc (Archive::const_iterator): Change Archive to be
6673 non-const.
6674 (Archive::begin, Archive::end): Make non-const.
6675 (Archive::count_members): Likewise.
6676 * archive.h (class Archive): Update declarations.
6677 * object.h (Object::read): Make non-const.
6678 * Makefile.am (CCFILES): Add descriptors.cc.
6679 (HFILES): Add descriptors.h.
6680 * Makefile.in: Rebuild.
6681
6682 PR 6716
6683 * gold.h: Always include <clocale>. Add Solaris workarounds
6684 following code in binutils/sysdep.h.
6685
6686 PR 6048
6687 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
6688 this->eh_frame_hdr_ is NULL before using it.
6689
6690 * dynobj.cc (Versions::Versions): Update comment.
6691
6692 * dynobj.cc (Versions::Versions): If there is an soname, use it as
6693 the base version name.
6694
6695 * stringpool.cc (Stringpool_template::add_with_length): Set key to
6696 array size plus one.
6697 (Stringpool_template::set_string_offsets): Subtract one from key
6698 before using it as an array index.
6699 (Stringpool_template::get_offset_with_length): Likewise.
6700 (Stringpool_template::write_to_buffer): Likewise.
6701 * stringpool.h (Stringpool_template::get_offset_from_key):
6702 Likewise.
6703
6704 2008-07-23 Ian Lance Taylor <iant@google.com>
6705
6706 PR 6658
6707 * object.h (Merged_symbol_value::value): Do our best to handle a
6708 negative addend.
6709
6710 PR 6647
6711 * script.cc (Version_script_info::get_versions): Don't add empty
6712 version tag to return value.
6713 (Version_script_info::get_symbol_version_helper): Change return
6714 type to bool. Add pversion parameter. Change all callers.
6715 (script_register_vers_node): Don't require a non-NULL tag.
6716 * script.h (class Version_script_info): Update declarations.
6717 (Version_script_info::get_symbol_version): Change return type to
6718 bool. Add version parameter. Change all callers.
6719 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
6720 handling. Handle an empty version from a version script.
6721 (Symbol_table::define_special_symbol): Likewise.
6722 * testsuite/ver_test_10.script: New file.
6723 * testsuite/ver_test_10.sh: New file.
6724 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
6725 (check_DATA): Add ver_test_10.syms.
6726 (ver_test_10.syms, ver_test_10.so): New target.
6727 * testsuite/Makefile.in: Rebuild.
6728
6729 2008-07-23 Simon Baldwin <simonb@google.com>
6730
6731 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
6732 to zero for undefined symbols from dynamic libraries.
6733
6734 2008-07-23 Ian Lance Taylor <iant@google.com>
6735
6736 * symtab.cc (Symbol_table::resolve): Remove version parameter.
6737 Change all callers.
6738 * symtab.h (class Symbol_table): Update declaration.
6739 * testsuite/ver_test_9.cc: New file.
6740 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
6741 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
6742 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
6743 (ver_test_9.so, ver_test_9.o): New targets.
6744 * testsuite/Makefile.in: Rebuild.
6745
6746 2008-07-22 Ian Lance Taylor <iant@google.com>
6747
6748 * options.h (class General_options): Define --check-sections.
6749 * layout.cc (Layout::set_segment_offsets): Handle
6750 --check-sections.
6751
6752 * options.h (class General_options): Define -n/--nmagic and
6753 -N/--omagic.
6754 * options.cc (General_options::finalize): For -n/--nmagic or
6755 -N/--omagic, set -static.
6756 * layout.cc (Layout::attach_allocated_section_to_segment): If
6757 -N/--omagic, don't put read-only and read-write sections in
6758 different segments.
6759 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
6760 finding a read-only segment.
6761 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
6762 don't set the minimum segment alignment to the common page size,
6763 and don't set the file offset to the address modulo the page size.
6764 * script-sections.cc (Script_sections::create_segments): If
6765 -n/--omagic, don't put read-only and read-write sections in
6766 different segments.
6767
6768 * cref.cc: New file.
6769 * cref.h: New file.
6770 * options.h (class General_options): Add --print-symbol-counts.
6771 * main.cc (main): Issue defined symbol report if requested.
6772 * archive.cc (Archive::interpret_header): Make into a const member
6773 function.
6774 (Archive::add_symbols): Call Input_objects::archive_start and
6775 archive_stop.
6776 (Archive::const_iterator): Define new class.
6777 (Archive::begin, Archive::end): New functions.
6778 (Archive::include_all_members): Rewrite to use iterator.
6779 (Archive::count_members): New function.
6780 * archive.h (class Archive): Update declarations.
6781 (Archive::filename): New function.
6782 * object.cc: Include "cref.h".
6783 (Sized_relobj::Sized_relobj): Initialize defined_count_.
6784 (Sized_relobj::do_get_global_symbol_counts): New function.
6785 (Input_objects::add_object): Add object to cross-referencer.
6786 (Input_objects::archive_start): New function.
6787 (Input_objects::archive_stop): New function.
6788 (Input_objects::print_symbol_counts): New function.
6789 * object.h: Declare Cref and Archive.
6790 (Object::get_global_symbol_counts): New function.
6791 (Object::do_get_global_symbol_counts): New pure virtual function.
6792 (class Sized_relobj): Add defined_count_ field. Update
6793 declarations.
6794 (class Input_objects): Add cref_ field. Update constructor.
6795 Update declarations.
6796 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
6797 defined_count_.
6798 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
6799 symbol counts.
6800 (Sized_dynobj::do_get_global_symbol_counts): New function.
6801 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
6802 defined_count_. Update declarations. Define Symbols typedef.
6803 * symtab.cc (Symbol_table::add_from_relobj): Add defined
6804 parameter. Change all callers.
6805 (Symbol_table::add_from_dynobj): Add sympointers and defined
6806 parameters. Change all callers.
6807 * symtab.h (class Symbol_table): Update declarations.
6808 * Makefile.am (CCFILES): Add cref.cc.
6809 (HFILES): Add cref.h.
6810 * Makefile.in: Rebuild.
6811
6812 2008-07-22 Simon Baldwin <simonb@google.com>
6813
6814 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
6815 to zero when writing undefined symbols.
6816
6817 2008-07-22 Ian Lance Taylor <iant@google.com>
6818
6819 * output.cc (Output_section::add_input_section): Don't try to
6820 merge empty merge sections.
6821
6822 2008-07-21 Craig Silverstein <csilvers@google.com>
6823
6824 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
6825 Include symbol version in error message.
6826
6827 2008-07-20 Chris Demetriou <cgd@google.com>
6828
6829 * configure.ac (gold_cv_c_random_seed): New configured variable.
6830 (RANDOM_SEED_CFLAGS): New substituted variable.
6831 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
6832 * configure: Rebuild.
6833 * Makefile.in: Likewise.
6834 * testsuite/Makefile.in: Likewise.
6835
6836 2008-07-18 Ian Lance Taylor <iant@google.com>
6837
6838 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
6839 where we see NAME/NULL and NAME/VERSION as separate symbols.
6840 * testsuite/ver_test_main.cc (main): Call t4.
6841 (t4, t4_2a): Define.
6842 * testsuite/ver_test_2.cc (t4_2): Define.
6843 * testsuite/ver_test_2.script: Put t4_2a in VER2.
6844 * testsuite/ver_test_4.cc (t4_2a): Define.
6845 * testsuite/ver_test_4.script: Put t4_2a in VER2.
6846 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
6847
6848 2008-07-17 Ian Lance Taylor <iant@google.com>
6849
6850 * dynobj.cc (Versions::add_def): If we give an error about a
6851 missing version, go ahead and create the version anyhow.
6852
6853 2008-07-10 Ian Lance Taylor <iant@google.com>
6854
6855 Handle output sections with more than 0x7fffffff bytes.
6856 * object.h (class Relobj): Change map_to_output_ to
6857 output_sections_, and just keep a section pointer. Change all
6858 uses. Move comdat group support to Sized_relobj.
6859 (Relobj::is_section_specially_mapped): Remove.
6860 (Relobj::output_section): Remove poff parameter. Change all
6861 callers.
6862 (Relobj::output_section_offset): New function.
6863 (Relobj::set_section_offset): Rewrite.
6864 (Relobj::map_to_output): Remove.
6865 (Relobj::output_sections): New function.
6866 (Relobj::do_output_section_offset): New pure virtual function.
6867 (Relobj::do_set_section_offset): Likewise.
6868 (class Sized_relobj): Add section_offsets_ field. Add comdat
6869 group support from Relobj. Update declarations.
6870 (Sized_relobj::get_output_section_offset): New function.
6871 (Sized_relobj::do_output_section_offset): New function.
6872 (Sized_relobj::do_set_section_offset): New function.
6873 * object.cc (Relobj::output_section_address): Remove.
6874 (Sized_relobj::Sized_relobj): Initialize new fields.
6875 (Sized_relobj::include_section_group): Cast find_kept_object to
6876 Sized_relobj.
6877 (Sized_relobj::include_linkonce_section): Likewise.
6878 (Sized_relobj::do_layout): Use separate arrays for output section
6879 and output offset.
6880 (Sized_relobj::do_count_local_symbols): Change map_to_output to
6881 output_sections.
6882 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
6883 output_sections and section_offsets.
6884 (Sized_relobj::write_local_symbols): Likewise.
6885 (map_to_kept_section): Compute output address directly.
6886 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
6887 output_sections and section_offsets.
6888 (Sized_relobj::write_sections): Likewise.
6889 (Sized_relobj::relocate_sections): Likewise.
6890 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
6891 * output.h (class Output_reloc): Update declarations. Change
6892 u2_.relobj to Sized_relobj*.
6893 (class Output_data_reloc): Change add functions to use
6894 Sized_relobj*.
6895 * output.cc (Output_reloc::Output_reloc): Change relobj to
6896 Sized_relobj*.
6897 (Output_reloc::local_section_offset): Change return type to
6898 Elf_Addr. Use get_output_section_offset.
6899 (Output_reloc::get_address): Likewise.
6900 (Output_section::is_input_address_mapped): Don't call
6901 is_section_specially_mapped.
6902 (Output_section::output_offset): Likewise.
6903 (Output_section::output_address): Likewise.
6904 (Output_section::starting_output_address): Likewise.
6905 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
6906 parameter to Sized_relobj*.
6907 (Copy_relocs::need_copy_reloc): Likewise.
6908 (Copy_relocs::save): Likewise.
6909 * copy-relocs.h (class Copy_relocs): Update declarations.
6910 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
6911 Sized_relobj*. Change relobj_ field to Sized_relobj*.
6912 * target-reloc.h (relocate_for_relocatable): Change
6913 offset_in_output_section type to Elf_Addr. Change code that uses
6914 it as well.
6915 * layout.cc (Layout::layout): Always set *off.
6916 * mapfile.cc (Mapfile::print_input_section): Use
6917 output_section_offset.
6918 * i386.cc (Target_i386::copy_reloc): Change object parameter to
6919 Sized_relobj*.
6920 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
6921 * sparc.cc (Target_sparc::copy_reloc): Likewise.
6922 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
6923
6924 2008-07-03 Ian Lance Taylor <iant@google.com>
6925
6926 * layout.cc (Layout::include_section): Do not discard unrecognized
6927 SHT_STRTAB sections.
6928
6929 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
6930
6931 * script.cc (Lex::can_continue_name): Make '?' allowable in
6932 version-script names.
6933 * testsuite/version_script.map: Change glob pattern to use '?'
6934
6935 2008-06-30 Manish Singh <yosh@gimp.org>
6936
6937 PR 6585
6938 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
6939 Correct typo.
6940
6941 2008-06-30 Ian Lance Taylor <iant@google.com>
6942
6943 PR 6660
6944 PR 6682
6945 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
6946 versions]: Don't try to read the value in the contents, since we
6947 don't use it. Use the template endianness when writing.
6948
6949 2008-06-25 Cary Coutant <ccoutant@google.com>
6950
6951 * fileread.cc (File_read::make_view): Assert on zero-length view.
6952 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
6953 symbol table when there are no symbols to read.
6954
6955 2008-06-23 Craig Silverstein <csilvers@google.com>
6956
6957 * version.cc (version_string): Bump to 1.7
6958
6959 2008-06-18 Craig Silverstein <csilvers@google.com>
6960
6961 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
6962 constant 0xFFFF to type Valtype.
6963 (Powerpc_relocate_functions::rel16_ha): Likewise.
6964
6965 2008-06-17 Ian Lance Taylor <iant@google.com>
6966
6967 * output.h (Output_section::Input_section): Initialize p2align_ to
6968 zero for Output_section_data constructors.
6969 (Output_section::Input_section::addralign): If not an input
6970 section, return the alignment of the Output_section_data.
6971 * testsuite/copy_test.cc: New file.
6972 * testsuite/copy_test_1.cc: New file.
6973 * testsuite/copy_test_2.cc: New file.
6974 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
6975 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
6976 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
6977 (copy_test_1_pic.o, copy_test_1.so): New targets.
6978 (copy_test_2_pic.o, copy_test_2.so): New targets.
6979 * testsuite/Makefile.in: Rebuild.
6980
6981 * script-sections.cc (Script_sections::place_orphan): Initialize
6982 local variable exact.
6983
6984 2008-06-13 David Edelsohn <edelsohn@gnu.org>
6985
6986 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
6987
6988 2008-06-12 David Edelsohn <edelsohn@gnu.org>
6989 David S. Miller <davem@davemloft.net>
6990
6991 * powerpc.cc: New file.
6992 * Makefile.am (TARGETSOURCES): Add powerpc.cc
6993 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
6994 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
6995 * Makefile.in: Rebuild.
6996
6997 2008-06-09 Ian Lance Taylor <iant@google.com>
6998
6999 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
7000 <exception>.
7001 (throwing, orig_terminate): New static variables.
7002 (terminate_handler): New static function.
7003 (t2): Set terminate handler.
7004
7005 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
7006
7007 PR 6584
7008 * binary.cc (Binary_to_elf::sized_convert): Fix .data
7009 alignment.
7010
7011 2008-05-30 Cary Coutant <ccoutant@google.com>
7012
7013 * archive.cc (Archive::include_all_members) Correct to step
7014 over symbol table and extended name table in thin archives.
7015
7016 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
7017
7018 PR 6407
7019 * target-reloc.h (relocate_for_relocatable): Fix new_offset
7020 calculation.
7021
7022 2008-05-28 Caleb Howe <cshowe@google.com>
7023
7024 * reduced_debug_output.cc: New file.
7025 * reduced_debug_output.h: New file.
7026 * options.h (class General_options): Add --strip-debug-non-line.
7027 * options.cc (General_options::finalize): Add strip_debug_non_line
7028 to the strip heirarchy.
7029 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
7030 fields.
7031 * layout.cc: Include "reduced_debug_output.h".
7032 (Layout::Layout): Initialize new fields.
7033 (line_only_debug_sections): New static array.
7034 (is_lines_only_debug_sections): New static inline function.
7035 (Layout::include_section): Handle --strip-debug-non-line.
7036 (Layout::make_output_section): If --strip-debug-non-line, build
7037 new output sections for .debug_abbrev and .debug_info.
7038 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
7039 gold. Warn about possible overflow.
7040 (read_signed_LEB_128): Likewise.
7041 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
7042 (read_signed_LEB_128): Declare.
7043 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
7044 (HFILES): Add reduced_debug_output.h.
7045 * Makefile.in: Rebuild.
7046
7047 2008-05-21 Ian Lance Taylor <iant@google.com>
7048
7049 * mapfile.cc: New file.
7050 * mapfile.h: New file.
7051 * options.h (class General_options): Add -M/--print-map and -Map.
7052 * options.cc (General_options::finalize): Make -M equivalent to
7053 -Map -.
7054 * main.cc: Include <cstdio> and "mapfile.h".
7055 (main): Open mapfile if requested.
7056 * gold.cc (class Middle_runner): Add mapfile_ field. Update
7057 constructor. Change caller.
7058 (queue_initial_tasks): Add mapfile parameter. Change caller.
7059 (queue_middle_tasks): Likewise.
7060 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
7061 declarations.
7062 * archive.cc: Include "mapfile.h".
7063 (Archive::add_symbols): Add mapfile parameter. Change all
7064 callers. Pass mapfile, symbol, and reason to include_member.
7065 (Archive::include_all_members): Add mapfile parameter. Change all
7066 callers.
7067 (Archive::include_member): Add mapfile, sym, and why parameters.
7068 Change all callers. Report inclusion to map file.
7069 * archive.h: Include "fileread.h".
7070 (class Archive): Update declarations.
7071 (Archive::file): New const method.
7072 (class Add_archive_symbols): Add mapfile_ field. Update
7073 constructor. Change all callers.
7074 * readsyms.h (class Read_symbols): Likewise.
7075 (class Finish_group): Likewise.
7076 (class Read_script): Likewise.
7077 * common.cc: Include "mapfile.h".
7078 (Symbol_table::allocate_commons): Add mapfile parameter. Change
7079 all callers.
7080 (Symbol_table::do_allocate_commons): Likewise.
7081 (Symbol_table::do_allocate_commons_list): Likewise. Report common
7082 symbol allocation to mapfile.
7083 * common.h (class Allocate_commons_task): Add mapfile_ field.
7084 Update constructor. Change all callers.
7085 * symtab.h (class Symbol_table): Update declarations.
7086 * layout.cc: Include "mapfile.h".
7087 (Layout_task_runner::run): Print information to mapfile.
7088 (Layout::create_gold_note): Change Output_data_fixed_space to
7089 Output_data_zero_fill.
7090 (Layout::create_build_id): Likewise.
7091 (Layout::print_to_mapfile): New function.
7092 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
7093 constructor. Change caller.
7094 (class Layout): Declare print_to_mapfile.
7095 * output.cc (Output_section::Input_section::print_to_mapfile): New
7096 function.
7097 (Output_section::add_input_section): If producing a map, always
7098 add to input_sections_ list.
7099 (Output_section::do_print_to_mapfile): New function.
7100 (Output_segment::print_sections_to_mapfile): New function.
7101 (Output_segment::print_section_list_to_mapfile): New function.
7102 * output.h: Include "mapfile.h".
7103 (Output_data::print_to_mapfile): New function.
7104 (Output_data::do_print_to_mapfile): New virtual function.
7105 (Output_segment_headers::do_print_to_mapfile): New function.
7106 (Output_file_header::do_print_to_mapfile): New function.
7107 (Output_data_const::do_print_to_mapfile): New function.
7108 (class Output_data_const_buffer): Add map_name_ field. Update
7109 constructor. Change all callers. Add do_print_to_mapfile
7110 function.
7111 (class Output_data_fixed_space): Likewise.
7112 (class Output_data_space): Likewise.
7113 (class Output_data_zero_fill): New class.
7114 (Output_data_strtab::do_print_to_mapfile): New function.
7115 (Output_data_reloc_base::do_print_to_mapfile): New function.
7116 (Output_relocatable_relocs::do_print_to_mapfile): New function.
7117 (Output_data_group::do_print_to_mapfile): New function.
7118 (Output_data_got::do_print_to_mapfile): New function.
7119 (Output_data_dynamic::do_print_to_mapfile): New function.
7120 (Output_symtab_xindex::do_print_to_mapfile): New function.
7121 (class Output_section): Declare do_print_to_mapflie. Declare
7122 print_to_mapfile in Input_section.
7123 (class Output_segment): Declare new functions.
7124 * object.h (Sized_relobj::symbol_count): New function.
7125 * script-sections.cc
7126 (Output_section_element_dot_assignment::set_section_addresses):
7127 Change Output_data_fixed_space to Output_data_zero_fill.
7128 (Output_data_expression::do_print_to_mapfile): New function.
7129 * script.cc (read_input_script): Add mapfile parameter. Change
7130 all callers.
7131 * script.h (read_input_script): Update declaration.
7132 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
7133 (Eh_frame::do_print_to_mapfile): New function.
7134 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
7135 (Output_merge_string::do_print_to_mapfile): New function.
7136 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
7137 function.
7138 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
7139 function.
7140 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
7141 function.
7142 * Makefile.am (CCFILES): Add mapfile.cc.
7143 (HFILES): Add mapfile.h.
7144 * Makefile.in: Rebuild.
7145
7146 2008-05-19 Ian Lance Taylor <iant@google.com>
7147
7148 * options.h (class General_options): Add -z relro.
7149 * layout.cc (Layout::Layout): Initialize relro_segment_.
7150 (Layout::add_output_section_data): Return the output section.
7151 (Layout::make_output_section): Rcognize relro sections and mark
7152 them appropriately.
7153 (Layout::attach_allocated_section_to_segment): Put relro sections
7154 in a PT_GNU_RELRO segment.
7155 (Layout::create_initial_dynamic_sections): Mark the .dynamic
7156 section as relro.
7157 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
7158 PT_TLS segments.
7159 (Layout::linkonce_mapping): Map d.rel.ro.local to
7160 .data.rel.ro.local.
7161 (Layout::output_section_name): Us .data.rel.ro.local for any
7162 section which begins with that.
7163 * layout.h (class Layout): Update add_output_section_data
7164 declaration. Add relro_segment_ field.
7165 * output.cc (Output_section::Output_section): Initialize is_relro_
7166 and is_relro_local_ fields.
7167 (Output_segment::add_output_section): Group relro sections.
7168 (Output_segment::is_first_section_relro): New function.
7169 (Output_segment::maximum_alignment): If there is a relro section,
7170 align the segment to the common page size.
7171 (Output_segment::set_section_addresses): Track whether we are
7172 looking at relro sections. If the last section is a relro
7173 section, align to the common page size.
7174 (Output_segment::set_section_list_addresses): Add in_relro
7175 parameter. Change all callers. Align to the page size when
7176 moving from relro to non-relro section.
7177 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
7178 segment.
7179 * output.h (class Output_section): Add is_relro_ and
7180 is_relro_local_ fields.
7181 (Output_section::is_relro): New function.
7182 (Output_section::set_is_relro): New function.
7183 (Output_section::is_relro_local): New function.
7184 (Output_section::set_is_relro_local): New function.
7185 (class Output_segment): Update declarations.
7186 * i386.cc (Target_i386::got_section): Mark .got section as relro.
7187 * sparc.cc (Target_sparc::got_section): Likewise.
7188 * x86_64.cc (Target_x86_64::got_section): Likewise.
7189 * testsuite/relro_test_main.cc: New file.
7190 * testsuite/relro_test.cc: New file.
7191 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
7192 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
7193 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
7194 (relro_test.so, relro_test_pic.o): New targets.
7195 * testsuite/Makefile.in: Rebuild.
7196
7197 2008-05-16 Ian Lance Taylor <iant@google.com>
7198
7199 * output.cc (Output_segment::add_output_section): Remove front
7200 parameter.
7201 * output.h (class Output_segment): Remove
7202 add_initial_output_section and overloaded add_output_section.
7203 Update declaration of remaining add_output_section.
7204 * layout.cc (Layout::create_interp): Call add_output_section
7205 rather than add_initial_output_section.
7206 (Layout::finish_dynamic_section): Likewise.
7207
7208 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
7209 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
7210 know the dynamic type.
7211 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
7212 field. Initialize it in constructor.
7213 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
7214 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
7215 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
7216 reloc.
7217
7218 * output.cc (Output_reloc::get_address): Change return type to
7219 Elf_Addr.
7220 * output.h (class Output_reloc): Update get_address declaration.
7221 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
7222 for section addresses.
7223
7224 2008-05-09 Ian Lance Taylor <iant@google.com>
7225
7226 PR 6493
7227 * gold.cc (gold_nomem): Use return value of write.
7228
7229 2008-05-08 Ian Lance Taylor <iant@google.com>
7230
7231 * symtab.c (Symbol::init_base_output_data): Add version
7232 parameter. Change all callers.
7233 (Symbol::init_base_output_segment): Likewise.
7234 (Symbol::init_base_constant): Likewise.
7235 (Symbol::init_base_undefined): Likewise.
7236 (Sized_symbol::init_output_data): Likewise.
7237 (Sized_symbol::init_output_segment): Likewise.
7238 (Sized_symbol::init_constant): Likewise.
7239 (Sized_symbol::init_undefined): Likewise.
7240 (Symbol_table::do_define_in_output_data): If the new symbol has a
7241 version, mark it as the default.
7242 (Symbol_table::do_define_in_output_segment): Likewise.
7243 (Symbol_table::do_define_as_constant): Likewise.
7244 * symtab.h (class Symbol): Update declarations.
7245 (class Sized_symbol): Likewise.
7246 * resolve.cc (Symbol::override_version): New function.
7247 (Symbol::override_base): Call override_version.
7248 (Symbol::override_base_with_special): Likewise.
7249 * testsuite/ver_script_8.script: New file.
7250 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
7251 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
7252 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
7253 (ver_test_8_1.so, ver_test_8_2.so): New targets.
7254
7255 2008-05-06 Ian Lance Taylor <iant@google.com>
7256
7257 PR 6049
7258 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
7259 functions.
7260 (class General_options): Remove existing --undefined, and add
7261 --no-undefined instead. Add new --undefined as synonym for -u.
7262 * archive.cc (Archive::add_symbols): Check whether symbol was
7263 named with -u.
7264 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
7265 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
7266 all uses. Add IS_UNDEFINED. Update declarations to split
7267 different versions of init_base. Declare init_base_undefined.
7268 (Symbol::is_defined): Handle IS_UNDEFINED.
7269 (Symbol::is_undefined): Likewise.
7270 (Symbol::is_weak_undefined): Call is_undefined.
7271 (Symbol::is_absolute): Handle IS_CONSTANT.
7272 (class Sized_symbol): Update declarations to split different
7273 versions of init. Declare init_undefined.
7274 (class Symbol_table): Declare new functions.
7275 * symtab.cc (Symbol::init_base_object): Rename from init_base.
7276 Change all callers.
7277 (Symbol::init_base_output_data): Likewise.
7278 (Symbol::init_base_output_segment): Likewise.
7279 (Symbol::init_base_constant): Likewise.
7280 (Symbol::init_base_undefined): New function.
7281 (Sized_symbol::init_object): Rename from init. Change all
7282 callers.
7283 (Sized_symbol::init_output_data): Likewise.
7284 (Sized_symbol::init_output_segment): Likewise.
7285 (Sized_symbol::init_constant): Likewise.
7286 (Sized_symbol::init_undefined): New function.
7287 (Symbol_table::add_undefined_symbols_from_command_line): New
7288 function.
7289 (Symbol_table::do_add_undefined_symbols_from_command_line): New
7290 function.
7291 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
7292 (Symbol::output_section): Likewise.
7293 (Symbol::set_output_section): Likewise.
7294 (Symbol_table::sized_finalize_symbol): Likewise.
7295 (Symbol_table::sized_write_globals): Likewise.
7296 * resolve.cc (Symbol_table::should_override): Likewise.
7297 (Symbol::override_base_with_special): Likewise.
7298
7299 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
7300 symbol, change it to have default visibility.
7301 * testsuite/protected_1.cc: New file.
7302 * testsuite/protected_2.cc: New file.
7303 * testsuite/protected_3.cc: New file.
7304 * testsuite/protected_main_1.cc: New file.
7305 * testsuite/protected_main_2.cc: New file.
7306 * testsuite/protected_main_3.cc: New file.
7307 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
7308 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
7309 (protected_1_LDFLAGS, protected_1_LDADD): Define.
7310 (protected_1.so): New target.
7311 (protected_1_pic.o, protected_2_pic.o): New targets.
7312 (protected_3_pic.o): New target.
7313 (check_PROGRAMS): Add protected_2.
7314 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
7315 (protected_2_LDFLAGS, protected_2_LDADD): Define.
7316 * testsuite/Makefile.in: Rebuild.
7317
7318 * options.h (DEFINE_var): Add set_user_set_##varname__.
7319 (DEFINE_bool_alias): New macro.
7320 (class General_options): Define -Bstatic using DEFINE_bool_alias
7321 rather than DEFINE_special. Add --undefined as an alias for -z
7322 defs.
7323 * options.cc (General_options::parse_Bstatic): Remove.
7324
7325 * options.h (class General_options): Add --fatal-warnings.
7326 * main.cc (main): Implement --fatal-warnings.
7327 * errors.h (Errors::warning_count): New function.
7328
7329 * options.h (class General_options): Add -Bsymbolic-functions.
7330 * symtab.h (Symbol::is_preemptible): Check for
7331 -Bsymbolic-functions.
7332
7333 2008-05-05 Ian Lance Taylor <iant@google.com>
7334
7335 * options.h (DEFINE_bool): For DASH_Z, create the negative option
7336 as noVARNAME rather than no-VARNAME.
7337 (class General_options): Add option -z combreloc.
7338 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
7339 get_address.
7340 (Output_reloc::sort_before) [SHT_REL]: New function.
7341 (Output_reloc::sort_before) [SHT_RELA]: New function.
7342 (class Output_data_reloc_base): Add sort_relocs_ field. Define
7343 Sort_relocs_comparison.
7344 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
7345 parameter. Change all callers.
7346 (Output_data_reloc::Output_data_reloc) [both versions]: Add
7347 sort_relocs parameter. Change all callers.
7348 * output.cc (Output_reloc::get_address): New function, broken out
7349 of write_rel.
7350 (Output_reloc::write_rel): Call it.
7351 (Output_reloc::compare): New function.
7352 (Output_data_reloc_base::do_write): Optionally sort relocs.
7353
7354 * configure.ac: If targ_extra_obj is set, link it in.
7355 * configure.tgt: Initialize all variables.
7356 (x86_64*): Set targ_extra_obj and targ_extra_size.
7357 * configure: Rebuild.
7358
7359 * object.cc (Sized_relobj::include_section_group): Adjust section
7360 indexes read from group data. Build vector to pass to
7361 layout_group.
7362 * layout.cc (Layout::layout_group): Add flags and shndxes
7363 parameters. Remove contents parameter. Change caller. Update
7364 explicit instantiations.
7365 * layout.h (class Layout): Update layout_group declaration.
7366 * output.cc (Output_data_group::Output_data_group): Add flags and
7367 input_shndxes parameters. Remove contents parameter. Change
7368 caller.
7369 (Output_data_group::do_write): Change input_sections_ to
7370 input_shndxes_.
7371 * output.h (class Output_data_group): Update constructor
7372 declaration. Rename input_sections_ to input_shndxes_.
7373 * testsuite/many_sections_test.cc: Add template.
7374
7375 2008-04-30 Cary Coutant <ccoutant@google.com>
7376
7377 * target-reloc.h (relocate_section): Fix dead-pointer bug.
7378
7379 * layout.cc (Layout::include_section): Refactored check for debug
7380 info section.
7381 (Layout::add_comdat): Add new parameters. Change type
7382 of signature parameter. Add object and shndx to signatures table.
7383 (Layout::find_kept_object): New function.
7384 * layout.h: Include <cstring>.
7385 (Layout::is_debug_info_section): New function.
7386 (Layout::add_comdat): Add new parameters.
7387 (Layout::find_kept_object): New function.
7388 (Layout::Kept_section): New struct.
7389 (Layout::Signatures): Change type of map range.
7390 * object.cc (Relobj::output_section_address): New function.
7391 (Sized_relobj::include_section_group): Add new parameters. Change
7392 calls to Layout::add_comdat. Change to build table of kept comdat
7393 groups and table mapping discarded sections to kept sections.
7394 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
7395 (Sized_relobj::do_layout): Change calls to include_section_group and
7396 include_linkonce_section.
7397 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
7398 value to zero when section is discarded.
7399 (Sized_relobj::map_to_kept_section): New function.
7400 * object.h (Relobj::output_section_address): New function.
7401 (Relobj::Comdat_group): New type.
7402 (Relobj::find_comdat_group): New function.
7403 (Relobj::Comdat_group_table): New type.
7404 (Relobj::Kept_comdat_section): New type.
7405 (Relobj::Kept_comdat_section_table): New type.
7406 (Relobj::add_comdat_group): New function.
7407 (Relobj::set_kept_comdat_section): New function.
7408 (Relobj::get_kept_comdat_section): New function.
7409 (Relobj::comdat_groups_): New field.
7410 (Relobj::kept_comdat_sections_): New field.
7411 (Symbol_value::input_value): Update comment.
7412 (Sized_relobj::map_to_kept_section) New function.
7413 (Sized_relobj::include_linkonce_section): Add new parameter.
7414 * target-reloc.h (Comdat_behavior): New type.
7415 (get_comdat_behavior): New function.
7416 (relocate_section): Add code to map a discarded section to the
7417 corresponding kept section when applying a relocation.
7418
7419 2008-04-30 Craig Silverstein <csilvers@google.com>
7420
7421 * dwarf_reader.cc (next_generation_count): New static var.
7422 (Addr2line_cache_entry): New struct.
7423 (addr2line_cache): New static var.
7424 (Dwarf_line_info::one_addr2line): Added caching.
7425 (Dwarf_line_info::clear_addr2line_cache): New function.
7426 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
7427 cache-size parameter.
7428 (Dwarf_line_info::one_addr2line_cache): New function.
7429 * symtab.cc (Symbol_table::detect_odr_violations): Pass
7430 new cache-size argument to one_addr2line(), and clear cache.
7431
7432 2008-04-28 Cary Coutant <ccoutant@google.com>
7433
7434 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
7435 R_386_PC8 relocations.
7436
7437 2008-04-23 Ian Lance Taylor <iant@google.com>
7438
7439 * object.cc (Sized_relobj::include_section_group): Check for
7440 invalid section group.
7441
7442 * object.cc (make_elf_object): Correct test for 64-bit ELF file
7443 header size.
7444
7445 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
7446 than read for file header.
7447 * archive.cc (Archive::include_member): Likewise.
7448
7449 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
7450
7451 * aclocal.m4: Regenerate.
7452 * configure: Regenerate.
7453
7454 2008-04-19 Ian Lance Taylor <iant@google.com>
7455
7456 * version.cc (version_string): Bump to 1.6.
7457
7458 * testsuite/Makefile.am (many_sections_r_test): New target.
7459 (many_sections_r_test_SOURCES): Remove.
7460 (many_sections_r_test_DEPENDENCIES): Remove.
7461 (many_sections_r_test_LDFLAGS): Remove.
7462 (many_sections_r_test_LDADD): Remove.
7463
7464 * object.cc (Sized_relobj::do_add_symbols): Always pass
7465 local_symbol_count_ to add_from_relobj.
7466
7467 * testsuite/Makefile.am (many_sections_check.h): Only check one in
7468 every thousand variables.
7469 * testsuite/Makefile.in: Rebuild.
7470
7471 * object.cc (Xindex::initialize_symtab_xindex): New function.
7472 (Xindex::read_symtab_xindex): New function.
7473 (Xindex::sym_xindex_to_shndx): New function.
7474 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
7475 available.
7476 (Sized_relobj::do_initialize_xindex): New function.
7477 (Sized_relobj::do_read_symbols): Adjust section links.
7478 (Sized_relobj::symbol_section_and_value): Add is_ordinary
7479 parameter. Change all callers.
7480 (Sized_relobj::include_section_group): Adjust section links and
7481 symbol section indexes.
7482 (Sized_relobj::do_layout): Adjust section links.
7483 (Sized_relobj::do_count_local_symbols): Adjust section links and
7484 symbol section indexes.
7485 (Sized_relobj::do_finalize_local_symbols): Distinguish between
7486 ordinary and special symbols.
7487 (Sized_relobj::write_local_symbols): Add symtab_xindex and
7488 dynsym_xindex parameters. Change all callers. Adjust section
7489 links. Use SHN_XINDEX when needed.
7490 (Sized_relobj::get_symbol_location_info): Adjust section links.
7491 Don't get fooled by special symbols.
7492 * object.h (class Xindex): Define.
7493 (class Object): Add xindex_ parameter. Declare virtual functoin
7494 do_initialize_xindex.
7495 (Object::adjust_sym_shndx): New function.
7496 (Object::set_xindex): New protected function.
7497 (class Symbol_value): Add is_ordinary_shndx_ field.
7498 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
7499 (Symbol_value::value): Assert ordinary section.
7500 (Symbol_value::initialize_input_to_output_map): Likewise.
7501 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
7502 Change all callers.
7503 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
7504 all callers.
7505 (class Sized_relobj): Update declarations.
7506 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
7507 parameter. Change all callers.
7508 (Sized_relobj::adjust_shndx): New function.
7509 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
7510 field.
7511 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
7512 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
7513 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
7514 (Sized_dynobj::read_dynsym_section): Adjust section links.
7515 (Sized_dynobj::read_dynamic): Likewise.
7516 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
7517 section links.
7518 (Sized_dynobj::do_initialize_xindex): New function.
7519 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
7520 do_initialize_xindex.
7521 (Sized_dynobj::adjust_shndx): New function.
7522 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
7523 dynsym_xindex_ fields.
7524 (Layout::finalize): Add a call to set_section_indexes before
7525 creating the symtab sections.
7526 (Layout::set_section_indexes): Don't do anything if the section
7527 already has a section index.
7528 (Layout::create_symtab_sections): Add shnum parameter. Change
7529 caller. Create .symtab_shndx section if needed.
7530 (Layout::create_shdrs): Add shstrtab_section parameter. Change
7531 caller.
7532 (Layout::allocated_output_section_count): New function.
7533 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
7534 needed.
7535 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
7536 fields. Update declarations.
7537 (Layout::symtab_xindex): New function.
7538 (Layout::dynsym_xindex): New function.
7539 (class Write_symbols_task): Add layout_ field.
7540 (Write_symbols_task::Write_symbols_task): Add layout parameter.
7541 Change caller.
7542 * output.cc (Output_section_headers::Output_section_headers): Add
7543 shstrtab_section parameter. Change all callers.
7544 (Output_section_headers::do_sized_write): Store overflow values
7545 for section count and section string table section index in
7546 section header zero.
7547 (Output_file_header::do_sized_write): Check for overflow of
7548 section count and section string table section index.
7549 (Output_symtab_xindex::do_write): New function.
7550 (Output_symtab_xindex::endian_do_write): New function.
7551 * output.h (class Output_section_headers): Add shstrtab_section_.
7552 Update declarations.
7553 (class Output_symtab_xindex): Define.
7554 (Output_section::has_out_shndx): New function.
7555 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
7556 field.
7557 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
7558 Change all callers.
7559 (Sized_symbol::init): Likewise.
7560 (Symbol::output_section): Check for ordinary symbol.
7561 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
7562 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
7563 callers.
7564 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
7565 Change all callers. Simplify handling of symbols from sections
7566 not included in the link.
7567 (Symbol_table::add_from_dynobj): Handle ordinary symbol
7568 distinction.
7569 (Weak_alias_sorter::operator()): Assert that symbols are
7570 ordinary.
7571 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
7572 distinction.
7573 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
7574 parameters. Change all callers.
7575 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
7576 symbol distinction. Use SHN_XINDEX when needed.
7577 (Symbol_table::write_section_symbol): Add symtab_xindex
7578 parameter. Change all callers.
7579 (Symbol_table::sized_write_section_symbol): Likewise. Use
7580 SHN_XINDEX when needed.
7581 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
7582 declarations.
7583 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
7584 (Symbol::is_defined): Check is_ordinary.
7585 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
7586 (Symbol::is_absolute, Symbol::is_common): Likewise.
7587 (class Sized_symbol): Update declarations.
7588 (class Symbol_table): Update declarations.
7589 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
7590 parameters. Change all callers.
7591 (Sized_symbol::override): Likewise.
7592 (Symbol_table::override): Likewise.
7593 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
7594 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
7595 is_ordinary, and orig_st_shndx parameters. Change all callers.
7596 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
7597 to be in an ordinary section.
7598 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
7599 object and is_ordinary parameters. Change all callers.
7600 (Sized_dwarf_line_info::read_relocs): Add object parameter.
7601 Change all callers. Don't add undefined or non-ordinary symbols
7602 to reloc_map_.
7603 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
7604 Change all callers.
7605 * dwarf_reader.h (class Sized_dwarf_line_info): Update
7606 declarations.
7607 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
7608 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
7609 (Sized_relobj::relocate_sections): Likewise.
7610 * target-reloc.h (scan_relocs): Adjust section symbol index.
7611 (scan_relocatable_relocs): Likewise.
7612 * i386.cc (Scan::local): Check for ordinary symbols.
7613 * sparc.cc (Scan::local): Likewise.
7614 * x86_64.cc (Scan::local): Likewise.
7615 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
7616 to symbol_section_and_value.
7617 * testsuite/many_sections_test.cc: New file.
7618 * testsuite/Makefile.am (BUILT_SOURCES): Define.
7619 (check_PROGRAMS): Add many_sections_test.
7620 (many_sections_test_SOURCES): Define.
7621 (many_sections_test_DEPENDENCIES): Define.
7622 (many_sections_test_LDFLAGS): Define.
7623 (BUILT_SOURCES): Add many_sections_define.h.
7624 (many_sections_define.h): New target.
7625 (BUILT_SOURCES): Add many_sections_check.h.
7626 (many_sections_check.h): New target.
7627 (check_PROGRAMS): Add many_sections_r_test.
7628 (many_sections_r_test_SOURCES): Define.
7629 (many_sections_r_test_DEPENDENCIES): Define.
7630 (many_sections_r_test_LDFLAGS): Define.
7631 (many_sections_r_test_LDADD): Define.
7632 (many_sections_r_test.o): New target.
7633 * testsuite/Makefile.in: Rebuild.
7634
7635 2008-04-17 Cary Coutant <ccoutant@google.com>
7636
7637 * errors.cc (Errors::info): New function.
7638 (gold_info): New function.
7639 * errors.h (Errors::info): New function.
7640 * gold.h (gold_info): New function.
7641 * object.cc (Input_objects::add_object): Print trace output.
7642 * options.cc (options::parse_set): New function.
7643 (General_options::parse_wrap): Deleted.
7644 (General_options::General_options): Deleted initializer.
7645 * options.h (options::String_set): New typedef.
7646 (options::parse_set): New function.
7647 (DEFINE_set): New macro.
7648 (General_options::wrap): Changed to use DEFINE_set. Changed
7649 callers of any_wrap_symbols and is_wrap_symbol.
7650 (General_options::trace, General_options::trace_symbol):
7651 New options.
7652 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
7653 (General_options::wrap_symbols_): Deleted.
7654 * symtab.cc (Symbol_table::add_from_object): Print trace output.
7655
7656 2008-04-17 David S. Miller <davem@davemloft.net>
7657
7658 * options.cc (General_options::parse_V): New function.
7659 * options.h: Add entries for -V and -Qy.
7660
7661 2008-04-17 Ian Lance Taylor <iant@google.com>
7662
7663 * common.cc (Symbol_table::allocate_commons): Remove options
7664 parameter. Change caller.
7665 (Symbol_table::do_allocate_commons): Remove options parameter.
7666 Change caller. Just call do_allocate_commons_list twice.
7667 (Symbol_table::do_allocate_commons_list): New function, broken out
7668 of do_allocate_commons.
7669 * common.h (class Allocate_commons_task): Remove options_ field.
7670 Update constructor.
7671 * symtab.cc (Symbol_table::Symbol_table): Initialize
7672 tls_commons_.
7673 (Symbol_table::add_from_object): Put TLS common symbols on
7674 tls_commons_ list.
7675 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
7676 which are IN_OUTPUT_DATA.
7677 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
7678 allocate_commons and do_allocate_commons declarations. Declare
7679 do_allocate_commons_list.
7680 * gold.cc (queue_middle_tasks): Update creation of
7681 Allocate_commons_task to not pass options.
7682 * testsuite/Makefile.am (INCLUDES): Add -I.. .
7683 (TLS_TEST_C_FLAGS): New variable.
7684 (tls_test_c_pic.o): New target.
7685 (tls_test_shared.so): Link in tls_test_c_pic.o.
7686 (tls_test_c_pic_ie.o): New target.
7687 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
7688 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
7689 (tls_test_c.o): New target.
7690 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
7691 (tls_pic_test_LDADD): Likewise.
7692 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
7693 (tls_shared_gd_to_ie_test_LDADD): Likewise.
7694 (tls_test_c_gnu2.o): New target.
7695 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
7696 tls_test_c_gnu2.o.
7697 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
7698 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
7699 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
7700 * testsuite/tls_test.cc: Include "config.h".
7701 (t_last): Call t11_last.
7702 * testsuite/tls_test.h (t11, t11_last): Declare.
7703 * testsuite/tls_test_c.c: New file.
7704 * testsuite/tls_test_main.cc (thread_routine): Call t11.
7705 * configure.ac: Check for OpenMP support.
7706 * configure, config.in, Makefile.in: Rebuild.
7707 * testsuite/Makefile.in: Rebuild.
7708
7709 2008-04-16 Cary Coutant <ccoutant@google.com>
7710
7711 * i386.cc (Target_i386::define_tls_base_symbol): New function.
7712 (Target_i386::tls_base_symbol_defined_): New field.
7713 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7714 (Target_i386::Scan::global): Likewise.
7715 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
7716 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
7717 (Target_x86_64::tls_base_symbol_defined_): New field.
7718 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
7719 (Target_x86_64::Scan::global): Likewise.
7720
7721 2008-04-16 Cary Coutant <ccoutant@google.com>
7722
7723 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
7724 (Symbol::needs_plt_entry): Allow weak undefined symbols.
7725 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
7726 building shared libraries.
7727 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
7728 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
7729 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
7730 * testsuite/Makefile.in: Rebuild.
7731 * testsuite/weak_undef.h: New file.
7732 * testsuite/weak_undef_file1.cc: Add extra test cases.
7733 * testsuite/weak_undef_file2.cc: Likewise.
7734 * testsuite/weak_undef_test.cc: Likewise.
7735
7736 2008-04-16 David S. Miller <davem@davemloft.net>
7737
7738 * sparc.cc (Target_sparc::Scan): Change from struct to class.
7739 Add issued_non_pic_error_ field. Declare check_non_pic.
7740 (Target_sparc::Scan::check_non_pic): New function.
7741 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
7742 (Target_sparc::Scan::global): Likewise.
7743
7744 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
7745 * configure: Rebuild.
7746
7747 * options.h (DEFINE_enable): New macro.
7748 (new_dtags): New enable option.
7749 (initfirst, interpose, loadfltr, nodefaultlib,
7750 nodelete, nodlopen, nodump): New -z options.
7751 * layout.cc (Layout:finish_dynamic_section): If new
7752 dtags enabled, emit DT_RUNPATH. Also, emit a
7753 DT_FLAGS_1 containing any specified -z flags.
7754
7755 2008-04-16 Ian Lance Taylor <iant@google.com>
7756
7757 * copy-relocs.cc: New file.
7758 * copy-relocs.h: New file.
7759 * reloc.cc: Remove Copy_relocs code.
7760 * reloc.h: Likewise.
7761 * reloc-types.h (struct Reloc_types) [both versions]: Add
7762 get_reloc_addend_noerror.
7763 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
7764 variants of add_global which take an addend which must be zero.
7765 * i386.cc: Include "copy-relocs.h".
7766 (class Target_i386): Change type of copy_relocs_ to variable,
7767 update initializer.
7768 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
7769 Change all callers.
7770 (Target_i386::do_finalize_sections): Change handling of
7771 copy_relocs_.
7772 * sparc.cc: Include "copy-relocs.h".
7773 (class Target_sparc): Change type of copy_relocs_ to variable,
7774 update initializer.
7775 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
7776 Change all callers.
7777 (Target_sparc::do_finalize_sections): Change handling of
7778 copy_relocs_.
7779 * x86_64.cc: Include "copy-relocs.h".
7780 (class Target_x86_64): Change type of copy_relocs_ to variable,
7781 update initializer.
7782 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
7783 class. Change all callers.
7784 (Target_x86_64::do_finalize_sections): Change handling of
7785 copy_relocs_.
7786 * Makefile.am (CCFILES): Add copy-relocs.cc.
7787 (HFILES): Add copy-relocs.h.
7788
7789 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
7790
7791 * testsuite/script_test_4.sh: Permit leading zeroes.
7792
7793 2008-04-15 Ian Lance Taylor <iant@google.com>
7794
7795 * script-sections.cc (Script_sections::create_segments): Use
7796 header_size_adjustment even when there is enough room for the
7797 headers.
7798 * testsuite/script_test_4.sh: New file.
7799 * testsuite/script_test_4.t: New file.
7800 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
7801 (check_DATA): Add script_test_4.stdout.
7802 (MOSTLYCLEANFILES): Likewise.
7803 (script_test_4): New target.
7804 (script_test_4.stdout): New target.
7805 * testsuite/Makefile.in: Rebuild.
7806
7807 * sparc.cc: Add definitions for Output_data_plt_sparc class
7808 constants.
7809
7810 2008-04-14 David S. Miller <davem@davemloft.net>
7811
7812 * sparc.cc: New file.
7813 * Makefile.am (TARGETSOURCES): Add sparc.cc
7814 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
7815 * configure.tgt: Document targ_extra_size and
7816 targ_extra_big_endian. Add entries for sparc-* and
7817 sparc64-*.
7818 * configure.ac: Handle targ_extra_size and
7819 targ_extra_big_endian.
7820 * Makefile.in: Rebuild.
7821 * configure: Likewise.
7822 * po/POTFILES.in: Likewise.
7823 * po/gold.pot: Likewise.
7824
7825 2008-04-14 Ian Lance Taylor <iant@google.com>
7826
7827 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
7828 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
7829 in the name/type/flags to section mapping. Don't call
7830 allocate_output_section.
7831 (Layout::choose_output_section): Change parameter from adjust_name
7832 to is_input_section. Don't permit input sections after sections
7833 are attached to segments. Don't call allocate_output_section.
7834 (Layout::layout_eh_frame): Call update_flags_for_input_section,
7835 not write_enable_output_section.
7836 (Layout::make_output_section): Don't push to
7837 unattached_section_list_ nor call attach_to_segment. Call
7838 attach_section_to_segment if sections are attached.
7839 (Layout::attach_sections_to_segments): New function.
7840 (Layout::attach_section_to_segment): New function.
7841 (Layout::attach_allocated_section_to_segment): Rename from
7842 attach_to_segment. Remove flags parameter.
7843 (Layout::allocate_output_section): Remove function.
7844 (Layout::write_enable_output_section): Remove function.
7845 * layout.h (class Layout): Update for above changes. Add new
7846 field sections_are_attached_.
7847 * output.h (Output_section::update_flags_for_input_section): New
7848 function.
7849 * output.cc (Output_section::add_input_section): Call
7850 update_flags_for_input_section.
7851 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
7852
7853 2008-04-11 Cary Coutant <ccoutant@google.com>
7854
7855 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
7856 thought unnecessary.
7857 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
7858
7859 2008-04-11 Ian Lance Taylor <iant@google.com>
7860
7861 * output.h (class Output_section_data): Remove inline definition
7862 of set_addralign.
7863 * output.cc (Output_section_data::set_addralign): New function.
7864
7865 2008-04-11 Cary Coutant <ccoutant@google.com>
7866
7867 Add support for TLS descriptors for i386 and x86_64.
7868 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
7869 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
7870 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
7871 GOT_TYPE_TLS_DESC.
7872 (Target_i386::got_mod_index_entry): Remove unnecessary code.
7873 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
7874 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
7875 relocations.
7876 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
7877 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
7878 Fix problem with initial-exec relocations.
7879 (Target_i386::Relocate::relocate_tls): Likewise.
7880 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
7881 relaxation.
7882 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
7883 support for section-plus-offset dynamic table entries.
7884 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
7885 (Output_data_dynamic::Dynamic_entry): Add support for
7886 section-plus-offset dynamic table entries.
7887 (Output_data_dynamic::Classification): Likewise.
7888 (Output_data_dynamic::classification_): Renamed offset_.
7889 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
7890 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
7891 (Target_x86_64::make_plt_section): New function.
7892 (Target_x86_64::reserve_tlsdesc_entries): New function.
7893 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
7894 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
7895 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
7896 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
7897 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
7898 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
7899 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
7900 add extra PLT entry for TLS descriptors.
7901 (Output_data_plt_x86_64::got_): New field.
7902 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
7903 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
7904 fields.
7905 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
7906 descriptors.
7907 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
7908 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
7909 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
7910 R_386_TLS_DESC_CALL relocations.
7911 (Target_x86_64::Scan::global): Likewise.
7912 (Target_x86_64::do_finalize_sections): Add dynamic table entries
7913 for TLS descriptors.
7914 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
7915 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
7916 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
7917 GD-to-IE relaxation.
7918 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
7919 and TLS_DESCRIPTORS.
7920 * Makefile.in: Rebuild.
7921 * configure: Rebuild.
7922 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
7923 (tls_test_shared2.so): New target.
7924 (tls_shared_gd_to_ie_test_SOURCES): New variable.
7925 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
7926 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
7927 (tls_shared_gd_to_ie_test_LDADD): New variable.
7928 (tls_shared_gnu2_gd_to_ie_test): New target.
7929 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
7930 New targets.
7931 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
7932 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
7933 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
7934 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
7935 (tls_shared_gnu2_test): New target.
7936 (tls_test_gnu2_shared.so): New target.
7937 (tls_shared_gnu2_test_SOURCES): New variable.
7938 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
7939 (tls_shared_gnu2_test_LDFLAGS): New variable.
7940 (tls_shared_gnu2_test_LDADD): New variable.
7941 * testsuite/Makefile.in: Rebuild.
7942 * testsuite/Makefile.
7943
7944 2008-04-11 Ian Lance Taylor <iant@google.com>
7945
7946 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
7947 justsyms.t.
7948 * testsuite/Makefile.in: Rebuild.
7949
7950 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
7951 long.
7952 * testsuite/script_test_2.cc (main): Adjust test.
7953
7954 2008-04-11 David S. Miller <davem@davemloft.net>
7955 Ian Lance Taylor <iant@google.com>
7956
7957 * options.h (General_options): Add entries for '-Y' and
7958 '-relax'.
7959 * options.cc (General_options:finalize): If -Y was used, add those
7960 entries to the library path instead of the default "/lib" and
7961 "/usr/lib".
7962
7963 2008-04-11 David S. Miller <davem@davemloft.net>
7964
7965 * testsuite/justsyms.t: Start at 0x100.
7966 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
7967 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
7968 long.
7969 * testsuite/script_test_2.cc: Adjust string and section length
7970 checks.
7971
7972 2008-04-09 Ian Lance Taylor <iant@google.com>
7973
7974 PR gold/5996
7975 * script-sections.cc (Sections_element::allocate_to_segment): Add
7976 orphan parameter.
7977 (Output_section_definition::allocate_to_segment): Likewise.
7978 (Orphan_output_section::allocate_to_segment): Likewise.
7979 (Script_sections::attach_sections_using_phdrs_clause): Don't
7980 propagate non-PT_LOAD segments to orphan sections.
7981 * testsuite/Makefile.am (script_test_3.stdout): Generate using
7982 readelf rather than objdump.
7983 * testsuite/script_test_3.sh: Adjust accordingly. Test that
7984 .interp section and PT_INTERP segment are the same size.
7985 * testsuite/Makefile.in: Rebuild.
7986
7987 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
7988 aliases for symbols defined in the same object.
7989 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
7990 (weak_alias_test_SOURCES): New variable.
7991 (weak_alias_test_DEPENDENCIES): New variable.
7992 (weak_alias_test_LDFLAGS): New variable.
7993 (weak_alias_test_LDADD): New variable.
7994 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
7995 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
7996 (weak_alias_test_3.o): New target.
7997 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
7998 * testsuite/weak_alias_test_main.cc: New file.
7999 * testsuite/weak_alias_test_1.cc: New file.
8000 * testsuite/weak_alias_test_2.cc: New file.
8001 * testsuite/weak_alias_test_3.cc: New file.
8002
8003 2008-04-08 Ian Lance Taylor <iant@google.com>
8004
8005 * options.h (class General_options): Add --noinhibit-exec option.
8006 * main.cc (main): Check --noinhibit-exec.
8007
8008 * options.h (class General_options): Define --wrap as a special
8009 option. Add wrap_symbols_ field.
8010 (General_options::any_wrap_symbols): New function.
8011 (General_options::is_wrap_symbol): New function.
8012 * options.cc (General_options::parse_wrap): New function.
8013 (General_options::General_options): Initialize wrap_symbols_.
8014 * symtab.cc (Symbol_table::wrap_symbol): New function.
8015 (Symbol_table::add_from_object): Handle --wrap.
8016 * symtab.h (class Symbol_table): Declare wrap_symbol.
8017 * target.h (Target::wrap_char): New function.
8018 (Target::Target_info): Add wrap_char field.
8019 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
8020 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
8021 * testsuite/testfile.cc (Target_test::test_target_info):
8022 Likewise.
8023
8024 * errors.cc (Errors::undefined_symbol): Mention symbol version if
8025 there is one.
8026
8027 * layout.h (class Layout): Add added_eh_frame_data_ field.
8028 * layout.cc (Layout::Layout): Initialize new field.
8029 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
8030 output section until we find a section we merged successfully.
8031 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
8032 that the size be non-zero.
8033
8034 * merge.cc (Object_merge_map::get_output_offset): Remove inline
8035 qualifier.
8036
8037 2008-04-08 Craig Silverstein <csilvers@google.com>
8038
8039 * configure.ac: Export new conditional variable HAVE_ZLIB.
8040 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
8041 on HAVE_ZLIB.
8042 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
8043 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8044
8045 2008-04-07 Ian Lance Taylor <iant@google.com>
8046
8047 * version.cc (version_string): Set to "1.5".
8048
8049 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
8050 Add issued_non_pic_error_ field. Declare check_non_pic.
8051 (Target_x86_64::Scan::check_non_pic): New function.
8052 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
8053 (Target_x86_64::Scan::global): Likewise.
8054
8055 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
8056 addend parameter. Change caller. Handle merge sections.
8057 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
8058 Address to Addend. Don't add in the result of
8059 local_section_offset, pass down the addend and use the returned
8060 value.
8061 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
8062 Update declarations of local_section_offset and symbol_value.
8063 * testsuite/two_file_test_1.cc (t18): New function.
8064 * testsuite/two_file_test_2.cc (f18): New function.
8065 * testsuite/two_file_test_main.cc (main): Call t18.
8066 * testsuite/two_file_test.h (t18, f18): Declare.
8067
8068 * configure.ac: Don't test for objdump, c++filt, or readelf.
8069 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
8070 conditionals.
8071 (TEST_READELF): New variable.
8072 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
8073 (check_PROGRAMS): Add two_file_strip_test.
8074 (two_file_strip_test): New target.
8075 (check_PROGRAMS): Add two_file_same_shared_strip_test.
8076 (two_file_same_shared_strip_test_SOURCES): New variable.
8077 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
8078 (two_file_same_shared_strip_test_LDFLAGS): New variable.
8079 (two_file_same_shared_strip_test_LDADD): New variable.
8080 (two_file_shared_strip.so): New target.
8081 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
8082 (ver_test_5.syms, ver_test_7.syms): Likewise.
8083 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
8084 (strip_test_3.stdout): Use TEST_OBJDUMP.
8085 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8086
8087 2008-04-04 Cary Coutant <ccoutant@google.com>
8088
8089 * symtab.h (Symbol::is_weak_undefined): New function.
8090 (Symbol::is_strong_undefined): New function.
8091 (Symbol::is_absolute): New function.
8092 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
8093 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
8094 absolute symbols.
8095 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
8096 (weak_undef_test): New target.
8097 * testsuite/Makefile.in: Rebuild.
8098 * testsuite/weak_undef_file1.cc: New file.
8099 * testsuite/weak_undef_file2.cc: New file.
8100 * testsuite/weak_undef_test.cc: New file.
8101
8102 2008-04-03 Craig Silverstein <csilvers@google.com>
8103
8104 * compressed_output.h (class Output_compressed_section): Use
8105 unsigned buffer.
8106 * compressed_output.cc (zlib_compress): Use unsigned buffers,
8107 add zlib header.
8108 (zlib_compressed_suffix): Removed.
8109 (Output_compressed_section::set_final_data_size): Use unsigned
8110 buffers.
8111 * testsuite/Makefile.am (flagstest_compress_debug_sections):
8112 Fix linker invocation.
8113 (flagstest_o_specialfile_and_compress_debug_sections):
8114 Likewise.
8115 * testsuite/Makefile.in: Regenerated.
8116
8117 2008-04-02 David S. Miller <davem@davemloft.net>
8118
8119 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
8120 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
8121
8122 2008-04-02 Craig Silverstein <csilvers@google.com>
8123
8124 * TODO: New file.
8125
8126 2008-04-02 Ian Lance Taylor <iant@google.com>
8127
8128 * fileread.cc (File_read::find_view): Add byteshift and vshifted
8129 parameters. Update for new key type to views_. Change all
8130 callers.
8131 (File_read::read): Adjust for byteshift in returned view.
8132 (File_read::add_view): New function, broken out of
8133 find_and_make_view.
8134 (File_read::make_view): New function, broken out of
8135 find_and_make_view.
8136 (File_read::find_or_make_view): Add offset and aligned
8137 parameters. Rewrite accordingly. Change all callers.
8138 (File_read::get_view): Add offset and aligned parameters. Adjust
8139 for byteshift in return value.
8140 (File_read::get_lasting_view): Likewise.
8141 * fileread.h (class File_read): Update declarations.
8142 (class File_read::View): Add byteshift_ field. Add byteshift to
8143 constructor. Add byteshift method.
8144 * archive.h (Archive::clear_uncached_views): New function.
8145 (Archive::get_view): Add aligned parameter. Change all callers.
8146 * object.h (Object::get_view): Add aligned parameter. Change all
8147 callers.
8148 (Object::get_lasting_view): Likewise.
8149
8150 * fileread.cc (File_read::release): Don't call clear_views if
8151 there are multiple objects.
8152 * fileread.h (File_read::clear_uncached_views): New function.
8153 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
8154 on the archive.
8155
8156 2008-03-31 Cary Coutant <ccoutant@google.com>
8157
8158 Add thin archive support.
8159 * archive.cc (Archive::armagt): New const.
8160 (Archive::setup): Remove task parameter and calls to unlock.
8161 (Archive::unlock_nested_archives): New function.
8162 (Archive::read_header): Add nested_off parameter. Change
8163 all callers.
8164 (Archive::interpret_header): Likewise.
8165 (Archive::include_all_members): Change to handle thin
8166 archives.
8167 (Archive::include_member): Likewise.
8168 * archive.h (Archive::Archive): Add new parameters and
8169 initializers.
8170 (Archive::armagt): New const.
8171 (Archive::setup): Remove task parameter.
8172 (Archive::unlock_nested_archives): New function.
8173 (Archive::read_header): Add nested_off parameter.
8174 (Archive::interpret_header): Likewise.
8175 (Archive::Nested_archive_table): New typedef.
8176 (Archive::is_thin_archive_): New field.
8177 (Archive::nested_archives_): New field.
8178 (Archive::options_): New field.
8179 (Archive::dirpath_): New field.
8180 (Archive::task_): New field.
8181 * readsyms.cc (Read_symbols::do_read_symbols): Add check
8182 for thin archives. Pass additional parameters to
8183 Archive::Archive. Unlock the archive file after calling
8184 Archive::setup.
8185
8186 2008-03-29 Ian Lance Taylor <iant@google.com>
8187
8188 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
8189 version symbol to be local.
8190 * testsuite/ver_test_4.sh: New file.
8191 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
8192 (check_DATA): Add ver_test_4.syms.
8193 (ver_test_4.syms): New target.
8194 * testsuite/Makefile.in: Rebuild.
8195
8196 * output.cc
8197 (Output_section::Input_section_sort_entry::has_priority): New
8198 function.
8199 (Output_section::Input_section_sort_entry::match_file_name): New
8200 function.
8201 (Output_section::Input_section_sort_entry::match_section_name):
8202 Remove.
8203 (Output_section::Input_section_sort_entry::match_section_name_prefix):
8204 Remove.
8205 (Output_section::Input_section_sort_entry::match_section_file):
8206 Remove.
8207 (Output_section::Input_section_sort_compare::operator()): Rewrite
8208 using new Input_section_sort_entry functions. Sort crtbegin and
8209 crtend first. Sort sections with no priority before sections with
8210 a priority.
8211 * testsuite/initpri1.c (d3): Check j != 4.
8212 (cd5): New constructor/destructor function.
8213 (main): Check j != 2.
8214
8215 * symtab.cc (Symbol_table::add_from_object): If we don't use the
8216 new symbol when resolving, don't call set_is_default.
8217 * testsuite/ver_test_7.cc: New file.
8218 * testsuite/ver_test_7.sh: New file.
8219 * testsuite/Makefile.am (ver_test_7.so): New target.
8220 (ver_test_7.o): New target.
8221 (check_SCRIPTS): Add ver_test_7.sh.
8222 (check_DATA): Add ver_test_7.syms.
8223 (ver_test_7.syms): New target.
8224
8225 2008-03-28 Ian Lance Taylor <iant@google.com>
8226
8227 * layout.cc (Layout::layout): If we see an input section with a
8228 name that needs sorting, set the must_sort flag for the output
8229 section.
8230 (Layout::make_output_section): If the name of the output section
8231 indicates that it might require sorting, set the may_sort flag.
8232 * output.h (Output_section::may_sort_attached_input_sections): New
8233 function.
8234 (Output_section::set_may_sort_attached_input_sections): New
8235 function.
8236 (Output_section::must_sort_attached_input_sections): New
8237 function.
8238 (Output_section::set_must_sort_attached_input_sections): New
8239 function.
8240 (class Output_section): Declare Input_section_sort_entry. Define
8241 Input_section_sort_compare. Declare
8242 sort_attached_input_sections. Add new fields:
8243 may_sort_attached_input_sections_,
8244 must_sort_attached_input_sections_,
8245 attached_input_sections_are_sorted_.
8246 * output.cc (Output_section::Output_section): Initialize new
8247 fields.
8248 (Output_section::add_input_section): Add an entry to
8249 input_sections_ if may_sort or must_sort are true.
8250 (Output_section::set_final_data_size): Call
8251 sort_attached_input_sections if necessary.
8252 (Output_section::Input_section_sort_entry): Define new class.
8253 (Output_section::Input_section_sort_compare::operator()): New
8254 function.
8255 (Output_section::sort_attached_input_sections): New function.
8256 * configure.ac: Check whether the compiler supports constructor
8257 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
8258 * testsuite/initpri1.c: New file.
8259 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
8260 CONSTRUCTOR_PRIORITY.
8261 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
8262 (initpri1_LDFLAGS): New variable.
8263 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
8264
8265 2008-03-27 Ian Lance Taylor <iant@google.com>
8266
8267 * common.cc (Sort_commons::operator): Correct sorting algorithm.
8268 * testsuite/common_test_1.c: New file.
8269 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
8270 (common_test_1_SOURCES): New variable.
8271 (common_test_1_DEPENDENCIES): New variable.
8272 (common_test_1_LDFLAGS): New variable.
8273
8274 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
8275 and commons_ correctly when NAME/VERSION does not override
8276 NAME/NULL.
8277 * testsuite/ver_test_6.c: New file.
8278 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
8279 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
8280 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
8281
8282 2008-03-26 Ian Lance Taylor <iant@google.com>
8283
8284 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
8285 of an undefined symbol from a version script.
8286 * testsuite/Makefile.am (ver_test_5.so): New target.
8287 (ver_test_5.o): New target.
8288 (check_SCRIPTS): Add ver_test_5.sh.
8289 (check_DATA): Add ver_test_5.syms.
8290 (ver_test_5.syms): New target.
8291 * testsuite/ver_test_5.cc: New file.
8292 * testsuite/ver_test_5.script: New file.
8293 * testsuite/ver_test_5.sh: New file.
8294 * Makefile.in, testsuite/Makefile.in: Rebuild.
8295
8296 PR gold/5986
8297 Fix problems building gold with gcc 4.3.0.
8298 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
8299 (gold_error_at_location, gold_warning_at_location): Use it.
8300 * configure.ac: Check whether we can compile and use a template
8301 function with a printf attribute.
8302 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
8303 when jumping over bytes.
8304 * object.cc: Instantiate Object::read_section_data.
8305 * debug.h: Include <cstring>
8306 * dwarf_reader.cc: Include <algorithm>
8307 * main.cc: Include <cstring>.
8308 * options.cc: Include <cstring>.
8309 * output.cc: Include <cstring>.
8310 * script.cc: Include <cstring>.
8311 * script.h: Include <string>.
8312 * symtab.cc: Include <cstring> and <algorithm>.
8313 * target-select.cc: Include <cstring>.
8314 * version.cc: Include <string>.
8315 * testsuite/testmain.cc: Include <cstdlib>.
8316 * configure, config.in: Rebuild.
8317
8318 2008-03-25 Ian Lance Taylor <iant@google.com>
8319
8320 * options.cc: Include "../bfd/bfdver.h".
8321 (options::help): Print bug reporting address.
8322
8323 * version.cc (print_version): Adjust output for current value of
8324 BFD_VERSION_STRING.
8325
8326 * NEWS: New file.
8327
8328 * options.cc (options::help): Print list of supported targets.
8329 * target-select.h: Include <vector>.
8330 (class Target_selector): Make machine_, size_, and is_big_endian_
8331 fields const. Add bfd_name_ and instantiated_target_ fields.
8332 (Target_selector::Target_selector): Add bfd_name parameter.
8333 (Target_selector::recognize): Make non-virtual, call
8334 do_recognize.
8335 (Target_selector::recognize_by_name): Make non-virtual, call
8336 do_recognize_by_name.
8337 (Target_selector::supported_names): New function.
8338 (Target_selector::bfd_name): New function.
8339 (Target_selector::do_instantiate_target): New pure virtual
8340 function.
8341 (Target_selector::do_recognize): New virtual function.
8342 (Target_selector::do_recognize_by_name): New virtual function.
8343 (Target_selector::instantiate_target): New private function.
8344 (supported_target_names): Declare.
8345 * target-select.cc (Target_selector::Target_selector): Update for
8346 new parameter and fields.
8347 (select_target_by_name): Check that the name matches before
8348 calling recognize_by_name.
8349 (supported_target_names): New function.
8350 * i386.cc (class Target_selector_i386): Update Target_selector
8351 constructor call. Remove recognize and recognize_by_name. Add
8352 do_instantiate_target.
8353 * x86_64.cc (class Target_selector_x86_64): Likewise.
8354 * testsuite/testfile.cc (class Target_selector_test): Update for
8355 changes to Target_selector.
8356
8357 * README: Rewrite, with some notes on unsupported features.
8358
8359 2008-03-24 Cary Coutant <ccoutant@google.com>
8360
8361 * i386.cc (Target_i386::Got_type): New enum declaration.
8362 (Target_i386::Scan::local): Updated callers of Output_data_got
8363 member functions.
8364 (Target_i386::Scan::global): Likewise.
8365 (Target_i386::Relocate::relocate): Likewise.
8366 (Target_i386::Relocate::relocate_tls): Likewise.
8367 * object.h (Got_offset_list): New class.
8368 (Sized_relobj::local_has_got_offset): Added got_type parameter.
8369 (Sized_relobj::local_got_offset): Likewise.
8370 (Sized_relobj::set_local_got_offset): Likewise.
8371 (Sized_relobj::local_has_tls_got_offset): Removed.
8372 (Sized_relobj::local_tls_got_offset): Removed.
8373 (Sized_relobj::set_local_tls_got_offset): Removed.
8374 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
8375 * output.cc (Output_data_got::add_global): Added got_type parameter.
8376 (Output_data_got::add_global_with_rel): Likewise.
8377 (Output_data_got::add_global_with_rela): Likewise.
8378 (Output_data_got::add_global_pair_with_rel): New function.
8379 (Output_data_got::add_global_pair_with_rela): New function.
8380 (Output_data_got::add_local): Added got_type parameter.
8381 (Output_data_got::add_local_with_rel): Likewise.
8382 (Output_data_got::add_local_with_rela): Likewise.
8383 (Output_data_got::add_local_pair_with_rel): New function.
8384 (Output_data_got::add_local_pair_with_rela): New function.
8385 (Output_data_got::add_global_tls): Removed.
8386 (Output_data_got::add_global_tls_with_rel): Removed.
8387 (Output_data_got::add_global_tls_with_rela): Removed.
8388 (Output_data_got::add_local_tls): Removed.
8389 (Output_data_got::add_local_tls_with_rel): Removed.
8390 (Output_data_got::add_local_tls_with_rela): Removed.
8391 * output.h (Output_data_got::add_global): Added got_type parameter.
8392 (Output_data_got::add_global_with_rel): Likewise.
8393 (Output_data_got::add_global_with_rela): Likewise.
8394 (Output_data_got::add_global_pair_with_rel): New function.
8395 (Output_data_got::add_global_pair_with_rela): New function.
8396 (Output_data_got::add_local): Added got_type parameter.
8397 (Output_data_got::add_local_with_rel): Likewise.
8398 (Output_data_got::add_local_with_rela): Likewise.
8399 (Output_data_got::add_local_pair_with_rel): New function.
8400 (Output_data_got::add_local_pair_with_rela): New function.
8401 (Output_data_got::add_global_tls): Removed.
8402 (Output_data_got::add_global_tls_with_rel): Removed.
8403 (Output_data_got::add_global_tls_with_rela): Removed.
8404 (Output_data_got::add_local_tls): Removed.
8405 (Output_data_got::add_local_tls_with_rel): Removed.
8406 (Output_data_got::add_local_tls_with_rela): Removed.
8407 * resolve.cc (Symbol::override_base_with_special): Removed
8408 reference to has_got_offset_ field.
8409 * symtab.cc (Symbol::init_fields): Replaced initialization
8410 of got_offset_ with got_offsets_. Removed initialization
8411 of has_got_offset_
8412 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
8413 (Symbol::got_offset): Likewise.
8414 (Symbol::set_got_offset): Likewise.
8415 (Symbol::has_tls_got_offset): Removed.
8416 (Symbol::tls_got_offset): Removed.
8417 (Symbol::set_tls_got_offset): Removed.
8418 (Symbol::got_offset_): Removed.
8419 (Symbol::tls_mod_got_offset_): Removed.
8420 (Symbol::tls_pair_got_offset_): Removed.
8421 (Symbol::got_offsets_): New field.
8422 (Symbol::has_got_offset): Removed.
8423 (Symbol::has_tls_mod_got_offset): Removed.
8424 (Symbol::has_tls_pair_got_offset): Removed.
8425 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
8426 (Target_x86_64::Scan::local): Updated callers of Output_data_got
8427 member functions.
8428 (Target_x86_64::Scan::global): Likewise.
8429 (Target_x86_64::Relocate::relocate): Likewise.
8430 (Target_x86_64::Relocate::relocate_tls): Likewise.
8431
8432 2008-03-25 Ben Elliston <bje@au.ibm.com>
8433
8434 * yyscript.y: Fix spelling error in comment.
8435
8436 2008-03-24 Ian Lance Taylor <iant@google.com>
8437
8438 * options.h (class General_options): Define build_id option.
8439 * layout.h (class Layout): Declare write_build_id, create_note,
8440 create_build_id. Add build_id_note_ member.
8441 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
8442 "libiberty.h", "md5.h", "sha1.h".
8443 (Layout::Layout): Initialize eh_frame_data_,
8444 eh_frame_hdr_section_, and build_id_note_.
8445 (Layout::finalize): Call create_build_id.
8446 (Layout::create_note): New function, broken out of
8447 Layout::create_gold_note.
8448 (Layout::create_gold_note): Call create_note.
8449 (Layout::create_build_id): New function.
8450 (Layout::write_build_id): New function.
8451 (Close_task_runner::run): Call write_build_id.
8452
8453 * x86_64.cc: Correct license to GPLv3.
8454
8455 2008-03-23 Ian Lance Taylor <iant@google.com>
8456
8457 * options.cc: Include "demangle.h".
8458 (parse_optional_string): New function.
8459 (parse_long_option): Handle takes_optional_argument.
8460 (parse_short_option): Update dash_z initializer. Handle
8461 takes_optional_argument.
8462 (General_options::General_options): Initialize do_demangle_.
8463 (General_options::finalize): Set do_demangle_. Handle demangling
8464 style.
8465 * options.h (parse_optional_string): Declare.
8466 (struct One_option): Add optional_arg field. Update constructor.
8467 Update call constructor calls. Add takes_optional_argument
8468 function.
8469 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
8470 (DEFINE_optional_string): Define.
8471 (General_options::demangle): Change from DEFINE_bool to
8472 DEFINE_optional_string.
8473 (General_options::no_demangle): New function.
8474 (General_options::do_demangle): New function.
8475 (General_options::set_do_demangle): New function.
8476 (General_options::execstack_status_): Move definition to end of
8477 class definition.
8478 (General_options::static_): Likewise.
8479 (General_options::do_demangle_): New field.
8480 * object.cc (big_endian>::get_symbol_location_info): Call
8481 Options::do_demangle, not Options::demangle.
8482 * symtab.cc (demangle): Likewise.
8483
8484 2008-03-22 Ian Lance Taylor <iant@google.com>
8485
8486 * gold.h: Include <cstddef> and <sys/types.h>
8487 * options.h: Include <cstring>.
8488
8489 2008-03-21 Ian Lance Taylor <iant@google.com>
8490
8491 * Added source code to GNU binutils.