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