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