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