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