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