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