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