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