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