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