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