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