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