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