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