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