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