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