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