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