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