1 2012-09-05 Alan Modra <amodra@gmail.com>
3 * object.h (Sized_relobj_file::emit_relocs): Delete.
4 (Sized_relobj_file::emit_relocs_reltype): Delete.
5 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
6 relocate_relocs for --emit-relocs.
7 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
8 * output.h: Update comment.
9 (Output_segment::first_section): New function.
10 (Output_segment::first_section_load_address): Use first_section.
11 * output.cc (Output_segment::first_section): New function extracted..
12 (Output_segment::first_section_load_address): ..from here. Delete.
13 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
14 * target.h (Sized_target::relocate_for_relocatable): Likewise.
15 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
16 adjust call to target.h function.
17 * i386.cc (Target_i386): Likewise.
18 * sparc.cc (Target_sparc): Likewise.
19 * x86_64.cc (Target_x86_64): Likewise.
20 * powerpc.cc (Target_powerpc): Likewise.
21 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
22 first tls section has section symbol for optimised local dynamic
24 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
25 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
27 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
28 Rename to relocate_relocs. Update error message.
30 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
32 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
35 2012-08-31 Alan Modra <amodra@gmail.com>
37 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
38 (Powerpc_relobj::toc_base_offset): New stub function.
39 (Target_powerpc): Add tp_offset, dtp_offset. Rename
40 got_mod_index_offset to tlsld_got_offset. Update all refs.
41 (Target_powerpc::Relocate::enum skip_tls): New.
42 (Target_powerpc::call_tls_get_addr_): New var.
43 (Target_powerpc::is_branch_reloc): Move to file scope.
44 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
45 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
47 (Target_powerpc::enum Got_type): Delete old values, add new ones.
48 (powerpc_info): Correct common_pagesize for ppc64.
49 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
50 (Powerpc_relocate_functions): Add overflow check enums and functions.
51 Add non-shift version of rela, rela_ua. Delete all rel public
52 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
53 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
54 addr16_ha3, addr14 functions.
55 (Output_data_got_powerpc::add_constant_pair): New function.
56 (Output_data_got_powerpc::got_base_offset): Likewise.
57 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
58 (instruction constants): Sort, add some more.
59 (Output_data_glink::do_write): Add and use Address typedef. Use
60 object->toc_base_offset() stub for 64-bit.
61 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
62 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
63 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
64 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
65 Always treat .opd relocs as against locally defined symbol.
66 Correct condition for RELATIVE relocs.
67 (Target_powerpc::do_finalize_sections): Test for NULL sections.
68 (Target_powerpc::Relocate::relocate): Use plt call stub as value
69 for 32-bit syms with a plt entry. Correct ppc64 toc base
70 calculations. Handle TLS relocs, and more. Add overflow
71 checking and adjust for Powerpc_relocate_functions changes.
72 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
73 Reinstate --emit-relocs code with FIXME.
75 2012-08-30 Alan Modra <amodra@gmail.com>
77 * layout.cc (Layout::set_segment_offsets): Set p_align to
78 abi_pagesize, not common_pagesize.
79 (Layout::relaxation_loop_body): Similarly use abi_pagesize
80 to determine whether file header can go in segment.
82 2012-08-30 Alan Modra <amodra@gmail.com>
84 * output.h (Output_reloc::Output_reloc <output section>): Add
85 is_relative param. Adjust calls.
86 (Output_reloc::add_output_section_relative): New functions.
87 * output.cc (Output_reloc::Output_reloc <output section>): Handle
89 (Output_reloc::symbol_value): Handle SECTION_CODE.
91 2012-08-24 Sriraman Tallam <tmsriram@google.com>
93 * gold.cc (queue_middle_tasks): Call layout again when unique
94 segments for sections is desired.
95 * layout.cc (Layout::Layout): Initialize new members.
96 (Layout::get_output_section_flags): New function.
97 (Layout::choose_output_section): Call get_output_section_flags.
98 (Layout::layout): Make output section for mapping to a unique segment.
99 (Layout::insert_section_segment_map): New function.
100 (Layout::attach_allocated_section_to_segment): Make unique segment for
101 output sections marked so.
102 (Layout::segment_precedes): Check for unique segments when sorting.
103 * layout.h (Layout::Unique_segment_info): New struct.
104 (Layout::Section_segment_map): New typedef.
105 (Layout::insert_section_segment_map): New function.
106 (Layout::get_output_section_flags): New function.
107 (Layout::is_unique_segment_for_sections_specified): New function.
108 (Layout::set_unique_segment_for_sections_specified): New function.
109 (Layout::unique_segment_for_sections_specified_): New member.
110 (Layout::section_segment_map_): New member.
111 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
112 Rename is_gc_pass_one to is_pass_one.
113 Rename is_gc_pass_two to is_pass_two.
114 Rename is_gc_or_icf to is_two_pass.
115 Check for which pass based on whether symbols data is present.
116 Make it two pass when unique segments for sections is desired.
117 * output.cc (Output_section::Output_section): Initialize new
119 * output.h (Output_section::is_unique_segment): New function.
120 (Output_section::set_is_unique_segment): New function.
121 (Output_section::is_unique_segment_): New member.
122 (Output_section::extra_segment_flags): New function.
123 (Output_section::set_extra_segment_flags): New function.
124 (Output_section::extra_segment_flags_): New member.
125 (Output_section::segment_alignment): New function.
126 (Output_section::set_segment_alignment): New function.
127 (Output_section::segment_alignment_): New member.
128 (Output_segment::Output_segment): Initialize is_unique_segment_.
129 (Output_segment::is_unique_segment): New function.
130 (Output_segment::set_is_unique_segment): New function.
131 (Output_segment::is_unique_segment_): New member.
132 * plugin.cc (allow_unique_segment_for_sections): New function.
133 (unique_segment_for_sections): New function.
134 (Plugin::load): Add new functions to transfer vector.
135 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
136 * Makefile.in: Regenerate.
137 * testsuite/plugin_final_layout.sh: Check if unique segment
139 * testsuite/plugin_section_order.c (onload): Check if new interfaces
141 (allow_unique_segment_for_sections): New global.
142 (unique_segment_for_sections): New global.
143 (claim_file_hook): Call allow_unique_segment_for_sections.
144 (all_symbols_read_hook): Call unique_segment_for_sections.
146 2012-08-22 Cary Coutant <ccoutant@google.com>
148 * layout.cc (Layout::include_section): Don't assert on GROUP
149 sections with --emit-relocs.
151 2012-08-21 Cary Coutant <ccoutant@google.com>
153 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
154 if --export-dynamic-symbol names an undef symbol.
156 2012-08-18 Alan Modra <amodra@gmail.com>
158 * powerpc.cc: Formatting and white space.
159 (Powerpc_relobj): Rename got2_section_ to special_.
160 Add opd_ent_shndx_ and opd_ent_off_ vectors.
161 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
162 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
163 (Target_powerpc): Add Address typedef and invalid_address. Use
165 (Target_powerpc::is_branch_reloc): New function.
166 (Powerpc_relocate_functions): Add Address typedef, use throughout.
167 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
168 for dst_mask, value and addend.
169 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
170 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
171 (Output_data_glink::do_write): Correct toc base. Don't try to use
172 uint16_t for 24-bit offset. Use get_output_section_offset and
174 (Target_powerpc::Scan::local): Handle more relocs.
175 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
176 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
177 Plug in toc restoring insn after plt calls. Translate branches
178 to function descriptor symbols to corresponding entry point.
179 (Target_powerpc::relocate_for_relocatable): Check return from
180 get_output_section_offset.
181 * symtab.h: Comment typo.
183 2012-08-14 Ian Lance Taylor <iant@google.com>
185 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
186 unsupported_relocal_local to call unsupported_reloc_global.
188 2012-08-14 Nick Clifton <nickc@redhat.com>
191 * script-sections.cc (Sections_element::output_section_name): Add
192 keep return parameter.
193 (Output_section_element::match_name): Add keep return parameter.
194 Return the value of the keep_ member.
195 * script-sections.h (class Output_section): Update
196 output_section_name prototype.
197 * layout.cc (Layout::keep_input_section): New public member
199 (Layout::choose_output_section): Pass keep parameter to
201 * layout.h (class Layout): Add keep_input_section.
202 * object.cc (Sized_relobj_file::do_layout): Check for kept input
204 * testsuite/Makefile.am: Add a test.
205 * testsuite/Makefile.in: Regenerate.
206 * testsuite/pr14265.c: Source file for the test.
207 * testsuite/pr14265.t: Linker script for the test.
208 * testsuite/pr14265.sh: Shell script for the test.
210 2012-08-14 Alan Modra <amodra@gmail.com>
212 * target.h (Target::output_section_name): New function.
213 (Target::do_output_section_name): New function.
214 * layout.cc (Layout::choose_output_section): Call the above.
215 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
217 2012-08-14 Alan Modra <amodra@gmail.com>
219 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
220 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
221 for replace_constant call.
222 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
223 (Output_data_glink::do_print_to_mapfile): New function.
224 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
225 (Target_powerpc::Relocate::relocate): Likewise.
227 2012-08-14 Alan Modra <amodra@gmail.com>
229 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
230 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
231 (Output_data_glink::add_entry,find_entry): Remove shndx param.
232 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
233 all references to shndx_. Handle special case for R_PPC_PLTREL24
235 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
236 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
237 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
239 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
240 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
242 2012-08-12 Alan Modra <amodra@gmail.com>
244 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
245 (glink insn constants): Use uint32_t.
246 (Output_data_glink::add_entry): Use insert, not [] operator.
248 2012-08-11 Alan Modra <amodra@gmail.com>
250 * object.h (Sized_relobj_file::find_shdr): New function.
251 (Sized_relobj_file::find_special_sections): New function.
252 * object.cc (Sized_relobj_file::find_shdr): New function.
253 (Sized_relobj_file::find_eh_frame): Use find_shdr.
254 (Sized_relobj_file::find_special_sections): New function, split out..
255 (Sized_relobj_file::do_read_symbols): ..from here.
256 * output.h (Output_data_got::replace_constant): New function.
257 (Output_data_got::num_entries): New function.
258 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
259 (Output_data_got::got_offset): Protected rather than private.
260 (Output_data_got::replace_got_entry): New function.
261 * output.cc (Output_data_got::replace_got_entry): New function.
262 * powerpc.cc (class Powerpc_relobj): New.
263 (class Powerpc_relocate_functions): Delete all psymval variants or
264 convert to value,addend type. Delete pcrela, pcrela_unaligned.
265 Implement _ha functions using corresponding _hi function.
266 (Powerpc_relobj::find_special_sections): New function.
267 (Target_powerpc::do_make_elf_object): New function.
268 (class Output_data_got_powerpc): New.
269 (class Output_data_glink): New.
270 (class Powerpc_scan_relocatable_reloc): New.
271 Many more changes througout file.
273 2012-08-09 Nick Clifton <nickc@redhat.com>
275 * po/vi.po: Updated Vietnamese translation.
277 2012-08-07 Ian Lance Taylor <iant@google.com>
279 * layout.cc (Layout::add_target_dynamic_tags): If
280 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
283 2012-07-30 Nick Clifton <nickc@redhat.com>
285 * po/gold.pot: Updated template.
286 * po/es.po: Updated Spanish translation.
288 2012-07-18 Cary Coutant <ccoutant@google.com>
291 * configure.ac: Add check for -gpubnames support.
292 * configure: Regenerate.
293 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
294 support; force -gno-pubnames.
295 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
297 (gdb_index_test_4): New test.
298 * testsuite/Makefile.in: Regenerate.
299 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
300 * testsuite/gdb_index_test_2.sh: Likewise.
301 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
302 * testsuite/gdb_index_test_4.sh: New script.
303 * testsuite/gdb_index_test_comm.sh: New script with common code;
304 don't look for space after colon.
306 2012-07-16 Sriraman Tallam <tmsriram@google.com>
308 * gold.cc (queue_middle_tasks): Update function order only after
309 deferred objects due to plugins are processed.
311 2012-07-11 Ian Lance Taylor <iant@google.com>
313 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
314 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
315 (Target_arm::scan_reloc_for_stub): Likewise.
316 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
317 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
318 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
319 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
320 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
322 2012-07-10 Dodji Seketeli <dodji@redhat.com>
323 Ian Lance Taylor <iant@google.com>
326 * configure.ac: Test whether std::tr1::hash<off_t> works.
327 * gold.h: Add a specialization for std::tr1::hash<off_t> if
329 * output.h (class Output_fill): Add virtual destructor.
330 * configure, config.in: Rebuild.
332 2012-06-22 Roland McGrath <mcgrathr@google.com>
334 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
336 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
338 * plugin.cc (Plugin::load): Handle position independent executables.
340 2012-06-06 Cary Coutant <ccoutant@google.com>
342 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
344 (lines_only_debug_sections): Likewise.
345 (gdb_fast_lookup_sections): New static array.
346 (is_gdb_debug_section): Rename formal parameter.
347 (is_lines_only_debug_section): Likewise.
348 (is_gdb_fast_lookup_section): New function.
349 (Layout::include_section): Check for ".zdebug_" prefix; pass
350 section name suffix to is_gdb_debug_section, et al.; check for
351 fast-lookup sections when building .gdb_index.
352 * options.h (--strip-debug-gdb): Update GDB version number.
354 2012-06-06 Cary Coutant <ccoutant@google.com>
356 * configure.ac: Add check for fallocate.
357 * configure: Regenerate.
358 * config.in: Regenerate.
360 * options.h (class General_options): Add --mmap-output-file and
361 --posix-fallocate options.
362 * output.cc: (posix_fallocate): Remove; replace with...
363 (gold_fallocate): New function.
364 (Output_file::map_no_anonymous): Call gold_fallocate.
365 (Output_file::map): Check --mmap-output-file option.
367 2012-06-05 Jing Yu <jingyu@google.com>
369 * gold.h (textdomain): Add do {} to empty while(0).
370 (bindtextdomain): Likewise.
372 2012-06-04 Cary Coutant <ccoutant@google.com>
374 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
377 2012-05-25 Sriraman Tallam <tmsriram@google.com>
379 * symtab.cc (Symbol_table::define_special_symbol):
380 Initialize *poldsym to prevent uninitialized variable errors.
382 2012-05-23 Cary Coutant <ccoutant@google.com>
384 * layout.cc (Layout::section_name_mapping): Add rules to handle
385 exact match on .data.rel.ro.local or .data.rel.ro.
386 (Layout::output_section_name): Check for exact matches.
388 2012-05-23 Cary Coutant <ccoutant@google.com>
390 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
393 2012-05-22 Cary Coutant <ccoutant@google.com>
395 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
396 object before exporting symbol.
398 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
400 * testsuite/tls_test.cc: Include "config.h" first.
401 * testsuite/tls_test_c.c: Likewise.
403 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
404 Nick Clifton <nickc@redhat.com>
407 * configure.in: Add check that sysdep.h has been included before
408 any system header files.
409 * configure: Regenerate.
410 * config.in: Regenerate.
412 2012-05-14 Cary Coutant <ccoutant@google.com>
414 * layout.cc (Layout::make_output_section): Mark .tdata section
416 * testsuite/relro_test.cc: Add a TLS variable.
418 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
421 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
422 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
425 2012-05-08 Cary Coutant <ccoutant@google.com>
427 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
428 (lines_only_debug_sections): Likewise.
430 2012-05-02 Roland McGrath <mcgrathr@google.com>
434 * Makefile.am (CCFILES, HFILES): Add them.
435 * Makefile.in: Regenerate.
436 * i386.cc (Output_data_plt_i386_nacl): New class.
437 (Output_data_plt_i386_nacl_exec): New class.
438 (Output_data_plt_i386_nacl_dyn): New class.
439 (Target_i386_nacl): New class.
440 (Target_selector_i386_nacl): New class.
441 (target_selector_i386): Use it instead of Target_selector_i386.
442 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
443 (Target_x86_64_nacl): New class.
444 (Target_selector_x86_64_nacl): New class.
445 (target_selector_x86_64, target_selector_x32): Use it instead of
446 Target_selector_x86_64.
447 * arm.cc (Output_data_plt_arm_nacl): New class.
448 (Target_arm_nacl): New class.
449 (Target_selector_arm_nacl): New class.
450 (target_selector_arm, target_selector_armbe): Use it instead of
453 * target-select.cc (select_target): Take new Input_file* and off_t
454 arguments, pass them on to recognize method of selector.
455 * object.cc (make_elf_sized_object): Update caller.
456 * parameters.cc (parameters_force_valid_target): Likewise.
457 * incremental.cc (make_sized_incremental_binary): Likewise.
458 * target-select.h: Update decl.
459 (Target_selector::recognize): Take new Input_file* argument,
460 pass it on to do_recognize.
461 (Target_selector::do_recognize): Take new Input_file* argument.
462 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
463 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
464 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
465 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
467 * target.h (Target::Target_info): New members isolate_execinstr
469 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
470 * arm.cc (Target_arm::arm_info): Update initializer.
471 * i386.cc (Target_i386::i386_info): Likewise.
472 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
473 * sparc.cc (Target_sparc::sparc_info): Likewise.
474 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
475 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
476 * layout.cc (Layout::attach_allocated_section_to_segment):
477 Take new const Target* argument. If target->isolate_execinstr(), act
479 (Layout::find_first_load_seg): Take new const Target* argument;
480 if target->isolate_execinstr(), reject PF_X segments.
481 (Layout::relaxation_loop_body): Update caller.
482 (Layout::set_segment_offsets): If target->isolate_execinstr(),
483 reset file offset to zero when we hit LOAD_SEG, and then do a second
484 loop over the segments before LOAD_SEG to reassign offsets after
485 addresses have been determined. Handle target->rosegment_gap().
486 (Layout::attach_section_to_segment): Take new const Target* argument;
487 pass it to attach_allocated_section_to_segment.
488 (Layout::make_output_section): Update caller.
489 (Layout::attach_sections_to_segments): Take new const Target* argument;
490 pass it to attach_section_to_segment.
491 * gold.cc (queue_middle_tasks): Update caller.
492 * layout.h (Layout): Update method decls with new arguments.
494 * arm.cc (Target_arm::Target_arm): Take optional argument for the
495 Target_info pointer to use.
496 (Target_arm::do_make_data_plt): New virtual method.
497 (Target_arm::make_data_plt): New method that calls it.
498 (Target_arm::make_plt_entry): Use it.
499 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
500 for the section alignment.
501 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
503 (Output_data_plt_arm::first_plt_entry_offset): Call it.
504 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
506 (Output_data_plt_arm::get_plt_entry_size): Call it.
507 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
508 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
509 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
511 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
512 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
513 method instead of sizeof(plt_entry).
514 (Output_data_plt_arm::add_entry): Likewise.
515 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
516 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
518 (Target_arm::plt_entry_size): Likewise.
519 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
521 (Output_data_plt_arm_standard): ... here, new class.
522 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
523 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
524 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
526 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
527 Take additional argument for the PLT entry size.
528 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
529 Use get_plt_entry_size method rather than plt_entry_size variable.
530 (Output_data_plt_x86_64::reserve_slot): Likewise.
531 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
532 (Output_data_plt_x86_64::add_entry): Likewise.
533 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
534 (Output_data_plt_x86_64::address_for_global): Likewise.
535 (Output_data_plt_x86_64::address_for_local): Likewise.
536 (Output_data_plt_x86_64::set_final_data_size): Likewise.
537 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
538 Make method non-static.
539 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
541 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
542 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
543 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
544 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
546 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
547 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
549 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
550 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
552 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
553 (Output_data_plt_x86_64::plt_entry_size)
554 (Output_data_plt_x86_64::first_plt_entry)
555 (Output_data_plt_x86_64::plt_entry)
556 (Output_data_plt_x86_64::tlsdesc_plt_entry)
557 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
558 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
559 (Output_data_plt_x86_64_standard): ... here, new class.
560 (Target_x86_64::Target_x86_64): Take optional argument for the
561 Target_info pointer to use.
562 (Target_x86_64::do_make_data_plt): New virtual method.
563 (Target_x86_64::make_data_plt): New method to call it.
564 (Target_x86_64::init_got_plt_for_update): Use that.
565 Call this->plt_->add_eh_frame method here.
566 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
567 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
568 rather than static method.
569 (Target_x86_64::plt_entry_size): Likewise.
570 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
571 rather than plt_entry_size variable. Move guts of PLT filling to...
572 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
573 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
574 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
576 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
577 additional argument for the section alignment.
578 Don't do add_eh_frame_for_plt here.
579 (Output_data_plt_i386::first_plt_entry_offset): Make the method
580 non-static. Use get_plt_entry_size method rather than plt_entry_size
582 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
584 (Output_data_plt_i386::get_plt_entry_size): Call it.
585 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
586 (Output_data_plt_i386::add_eh_frame): New method to call it.
587 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
589 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
590 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
592 (Output_data_plt_i386::fill_plt_entry): New method to call it.
593 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
594 method instead of plt_entry_size.
595 (Output_data_plt_i386::plt_entry_size)
596 (Output_data_plt_i386::plt_eh_frame_fde_size)
597 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
598 (Output_data_plt_i386_standard): ... here, new class.
599 (Output_data_plt_i386_exec): New class.
600 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
601 (Output_data_plt_i386_exec::first_plt_entry): ... here.
602 (Output_data_plt_i386::exec_plt_entry): Move to ...
603 (Output_data_plt_i386_exec::plt_entry): ... here.
604 (Output_data_plt_i386_dyn): New class.
605 (Output_data_plt_i386::first_plt_entry): Move to ...
606 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
607 (Output_data_plt_i386::dyn_plt_entry): Move to ...
608 (Output_data_plt_i386_dyn::plt_entry): ... here.
609 (Target_i386::Target_i386): Take optional argument for the Target_info
611 (Target_i386::do_make_data_plt): New virtual method.
612 (Target_i386::make_data_plt): New method to call it.
613 (Target_i386::make_plt_section): Use that.
614 Call this->plt_->add_eh_frame method here.
615 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
616 rather than plt_entry_size variable.
617 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
618 (Output_data_plt_i386::address_for_local): Likewise.
619 (Output_data_plt_i386::do_write): Likewise.
620 Move guts of PLT filling to...
621 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
622 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
623 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
624 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
626 2012-05-01 Cary Coutant <ccoutant@google.com>
628 * dwarf_reader.cc (Dwarf_die::read_attributes)
629 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
630 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
631 * reduced_debug_output.cc
632 (Output_reduced_debug_info_section::get_die_end): Remove
633 DW_FORM_GNU_ref_index. Add default case.
635 2012-04-26 Mark Wielaard <mjw@redhat.com>
637 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
638 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
639 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
640 DW_AT_high_pc as offset from DW_AT_low_pc.
642 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
643 * testsuite/Makefile.in: Regenerate.
644 * testsuite/gdb_index_test_3.c: New test source file.
645 * testsuite/gdb_index_test_3.sh: New test source file.
647 2012-04-25 Ian Lance Taylor <iant@google.com>
649 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
651 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
652 as a class, not a struct.
653 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
654 (Target_arm::apply_cortex_a8_workaround): Likewise.
655 * gc.h: Declare Reloc_types as a struct, not a class.
656 * object.h: Declare Symbols_data as a struct.
657 * reloc.h: Declare Read_relocs_data as a struct.
658 * target.h: Declare Relocate_info as a struct.
660 2012-04-24 David S. Miller <davem@davemloft.net>
662 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
663 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
666 2012-04-24 Cary Coutant <ccoutant@google.com>
668 * incremental-dump.cc (find_input_containing_global): Replace
669 magic number with symbolic constant.
670 (dump_incremental_inputs): Update version number.
671 * incremental.cc (Output_section_incremental_inputs): Update version
672 number; import symbolic constants from Incremental_inputs_reader.
673 (Incremental_inputs::create_data_sections): Align relocations
674 section correctly for 64-bit targets.
675 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
676 constants; add padding.
677 (Output_section_incremental_inputs::write_header): Add assert for
679 (Output_section_incremental_inputs::write_input_files): Add assert
680 for input_entry_size.
681 (Output_section_incremental_inputs::write_info_blocks): Add padding;
682 add assert for object_info_size, input_section_entry_size,
683 global_sym_entry_size.
684 * incremental.h (Incremental_inputs_reader): Add symbolic constants
685 for data structure sizes; use them.
686 (Incremental_input_entry_reader): Import symbolic constants from
687 Incremental_inputs_reader; use them.
689 2012-04-23 David S. Miller <davem@davemloft.net>
691 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
693 (Target_sparc::Target_sparc): Initialize new fields.
694 (Target_sparc::do_make_elf_object): New function.
695 (Target_sparc::do_adjust_elf_header): New function.
697 2012-04-23 Cary Coutant <ccoutant@google.com>
699 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
700 CU range table of gdb index.
702 2012-04-20 David S. Miller <davem@davemloft.net>
704 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
707 2012-04-16 David S. Miller <davem@davemloft.net>
709 * sparc.cc (Target_sparc::got_address): New function.
710 (Sparc_relocate_functions::gdop_hix22): New function.
711 (Sparc_relocate_functions::gdop_lox10): New function.
712 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
714 (Target_sparc::Scan::local): Likewise if the global symbol is not
715 preemptible and is not IFUNC.
716 (Target_sparc::Relocate::relocate): Perform GOTDATA code
717 transformations for local and non-preemptible non-IFUNC global
720 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
721 writing out 64-bit part of ranges.
723 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
724 -fpic and -fpie respectively.
725 * Makefile.in: Regenerate.
727 * sparc.cc (class Target_sparc): Add rela_ifunc_.
728 (Target_sparc::Target_sparc): Initialize new field.
729 (Target_sparc::do_plt_section_for_global): New function.
730 (Target_sparc::do_plt_section_for_local): New function.
731 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
732 (Target_sparc::make_plt_section): New function, broken out of
733 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
734 (Target_sparc::make_plt_entry): Call make_plt_section.
735 (Target_sparc::make_local_ifunc_plt_entry): New function.
736 (Target_sparc::rela_ifunc_section): New function.
737 (Target_sparc::plt_section): Remove const.
738 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
739 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
740 and ifunc_count_ fields.
741 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
742 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
743 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
744 (Output_data_plt_sparc::rela_ifunc): New function.
745 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
746 (Output_data_plt_sparc::has_ifunc_section): New function.
747 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
748 (Output_data_plt_sparc::address_for_global): New function.
749 (Output_data_plt_sparc::address_for_local): New function.
750 (Output_data_plt_sparc::plt_index_to_offset): New function.
751 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
753 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
755 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
756 R_SPARC_JMP_IREL to switch.
757 (Target_sparc::Scan::check_non_pic): Likewise.
758 (Target_sparc::Scan::local): Handle IFUNC symbols.
759 (Target_sparc::Scan::local): Likewise.
760 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
761 and plt_address_for_local.
762 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
763 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
765 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
766 (class Output_data_reloc): Adjust calls to Output_reloc_type.
767 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
768 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
770 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
771 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
773 * sparc.cc (Target_sparc::Scan::global): Likewise.
774 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
776 2012-04-16 Cary Coutant <ccoutant@google.com>
778 * archive.cc (Library_base::should_include_member): Check for
779 --export-dynamic-symbol.
780 * options.h (class General_options): Add --export-dynamic-symbol.
781 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
782 --export-dynamic-symbol.
783 (Symbol_table::gc_mark_undef_symbols): Likewise.
784 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
786 2012-04-12 David S. Miller <davem@davemloft.net>
788 * sparc.cc (Reloc::wdisp10): New relocation method.
789 (Reloc::h34): Likewise.
790 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
791 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
793 (Target_sparc::Scan::local): Likewise.
794 (Target_sparc::Scan::global): Likewise.
795 (Target_sparc::Relocate::relocate): Likewise.
797 2012-04-09 Cary Coutant <ccoutant@google.com>
799 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
802 2012-04-06 Ian Lance Taylor <iant@google.com>
804 * timer.cc: #include <unistd.h>.
806 2012-04-06 Roland McGrath <mcgrathr@google.com>
808 * configure.in (AC_CHECK_HEADERS): Add locale.h.
809 * config.in: Regenerate.
810 * configure: Regenerate.
812 2012-04-05 Nick Clifton <nickc@redhat.com>
814 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
815 (AM_LC_MESSAGES): Add.
816 * aclocal.m4: Regenerate.
817 * config.in: Regenerate.
818 * configure: Regenerate.
820 2012-03-21 Cary Coutant <ccoutant@google.com>
822 * Makefile.am: Add gdb-index.cc, gdb-index.h.
823 * Makefile.in: Regenerate.
824 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
825 (Sized_elf_reloc_mapper::symbol_section): New function.
826 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
827 (make_elf_reloc_mapper): New function.
828 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
829 (Dwarf_abbrev_table::do_read_abbrevs): New function.
830 (Dwarf_abbrev_table::do_get_abbrev): New function.
831 (Dwarf_ranges_table::read_ranges_table): New function.
832 (Dwarf_ranges_table::read_range_list): New function.
833 (Dwarf_pubnames_table::read_section): New function.
834 (Dwarf_pubnames_table::read_header): New function.
835 (Dwarf_pubnames_table::next_name): New function.
836 (Dwarf_die::Dwarf_die): New function.
837 (Dwarf_die::read_attributes): New function.
838 (Dwarf_die::skip_attributes): New function.
839 (Dwarf_die::set_name): New function.
840 (Dwarf_die::set_linkage_name): New function.
841 (Dwarf_die::attribute): New function.
842 (Dwarf_die::string_attribute): New function.
843 (Dwarf_die::int_attribute): New function.
844 (Dwarf_die::uint_attribute): New function.
845 (Dwarf_die::ref_attribute): New function.
846 (Dwarf_die::child_offset): New function.
847 (Dwarf_die::sibling_offset): New function.
848 (Dwarf_info_reader::check_buffer): New function.
849 (Dwarf_info_reader::parse): New function.
850 (Dwarf_info_reader::do_parse): New function.
851 (Dwarf_info_reader::do_read_string_table): New function.
852 (Dwarf_info_reader::lookup_reloc): New function.
853 (Dwarf_info_reader::get_string): New function.
854 (Dwarf_info_reader::visit_compilation_unit): New function.
855 (Dwarf_info_reader::visit_type_unit): New function.
856 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
857 Sized_elf_reloc_mapper.
858 (Sized_dwarf_line_info::symbol_section): Remove function.
859 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
860 (Sized_dwarf_line_info::read_line_mappings): Remove object
861 parameter, adjust callers.
862 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
863 * dwarf_reader.h: Include <sys/types.h>.
864 (class Track_relocs): Remove forward declaration.
865 (class Elf_reloc_mapper): New class.
866 (class Sized_elf_reloc_mapper): New class.
867 (class Dwarf_abbrev_table): New class.
868 (class Dwarf_range_list): New class.
869 (class Dwarf_ranges_table): New class.
870 (class Dwarf_pubnames_table): New class.
871 (class Dwarf_die): New class.
872 (class Dwarf_info_reader): New class.
873 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
874 (Sized_dwarf_line_info::symbol_section): Remove member function.
875 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
877 * gdb-index.cc: New source file.
878 * gdb-index.h: New source file.
879 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
880 and .debug_types sections, call Layout::add_to_gdb_index.
881 (Sized_relobj_incr::do_section_name): Implement.
882 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
883 return type; Implement.
884 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
886 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
887 parameter list and return type.
888 (Sized_incr_dynobj::do_section_contents): Likewise.
889 * layout.cc: Include gdb-index.h.
890 (Layout::Layout): Initialize gdb_index_data_.
891 (Layout::init_fixed_output_section): Check for .gdb_index section.
892 (Layout::add_to_gdb_index): New function. Instantiate.
893 * layout.h: Add forward declaration for class Gdb_index.
894 (Layout::add_to_gdb_index): New member function.
895 (Layout::gdb_index_data_): New data member.
896 * main.cc: Include gdb-index.h.
897 (main): Print statistics for gdb index.
898 * object.cc (Object::section_contents): Move code into
900 (need_decompressed_section): Check for sections needed when building
902 (build_compressed_section_map): Likewise.
903 (Sized_relobj_file::do_read_symbols): Need local symbols when building
905 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
906 sections; call Layout::add_to_gdb_index.
907 (Sized_relobj_file::do_decompressed_section_contents): Call
908 do_section_contents directly.
909 * object.h (Object::do_section_contents): Adjust parameter list and
911 (Object::do_decompressed_section_contents): Call do_section_contents
913 (Sized_relobj_file::do_section_contents): Adjust parameter list and
915 * options.h (class General_options): Add --gdb-index option.
916 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
917 list and return type.
918 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
919 * reloc.h (Track_relocs::checkpoint): New function.
920 (Track_relocs::reset): New function.
922 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
924 * testsuite/Makefile.in: Regenerate.
925 * testsuite/gdb_index_test.cc: New test source file.
926 * testsuite/gdb_index_test_1.sh: New test source file.
927 * testsuite/gdb_index_test_2.sh: New test source file.
929 2012-03-19 Doug Kwan <dougkwan@google.com>
931 * arm.cc (Target_arm::do_define_standard_symbols): New method.
932 (Target_arm::do_finalize_sections): Remove code which defines
933 __exidx_start and __exidx_end. Make symbol table parameter
934 anonymous as it is not used.
935 * gold.cc (queue_middle_tasks): Call target hook to define any
936 target-specific symbols.
937 * target.h (Target::define_standard_symbols): New method.
938 (Target::do_define_standard_symbols): Same.
939 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
940 * testsuite/Makefile.in: Regenerate.
941 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
943 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
944 relocations are generated for __exidx_start and __exidx_end.
946 2012-03-16 Doug Kwan <dougkwan@google.com>
948 * testsuite/Makefile.am: Disable test initpri3b.
949 * testsuite/Makefile.in: Regenerate.
951 2012-03-15 Doug Kwan <dougkwan@google.com>
953 * arm.cc (Target_arm::got_section): Make .got section read-only
956 2012-03-15 Ian Lance Taylor <iant@google.com>
959 * layout.cc (Layout::make_output_section): Correctly mark
960 SHT_INIT_ARRAY, et. al., as relro.
962 2012-03-14 Doug Kwan <dougkwan@google.com>
964 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
965 dynamic relocations for protected symbols in shared objects.
967 2012-03-13 Ian Lance Taylor <iant@google.com>
969 * resolve.cc (Symbol_table::resolve): When merging common symbols,
970 keep the larger alignment.
972 2012-03-12 Cary Coutant <ccoutant@google.com>
974 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
975 handling of DW_LNE_define_file.
977 2012-03-12 Cary Coutant <ccoutant@google.com>
979 * reduced_debug_output.cc
980 (Output_reduced_debug_info_section::get_die_end): Add new FORM
983 2012-02-29 Cary Coutant <ccoutant@google.com>
985 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
987 2012-02-29 Cary Coutant <ccoutant@google.com>
989 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
990 Call Object::decompressed_section_contents.
991 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
993 (Sized_dwarf_line_info::buffer_start_): New data member.
994 * merge.cc (Output_merge_data::do_add_input_section): Call
995 Object::decompressed_section_contents.
996 (Output_merge_string::do_add_input_section): Likewise.
997 * object.cc (need_decompressed_section): New function.
998 (build_compressed_section_map): Decompress sections needed later.
999 (Sized_relobj_file::do_decompressed_section_contents): New function.
1000 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1001 * object.h (Object::decompressed_section_contents): New function.
1002 (Object::discard_decompressed_sections): New function.
1003 (Object::do_decompressed_section_contents): New function.
1004 (Object::do_discard_decompressed_sections): New function.
1005 (Compressed_section_info): New type.
1006 (Compressed_section_map): Include decompressed section contents.
1007 (Sized_relobj_file::do_decompressed_section_contents): New function.
1008 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1010 2012-02-16 Cary Coutant <ccoutant@google.com>
1012 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1013 * testsuite/Makefile.in: Regenerate.
1015 2012-02-14 Cary Coutant <ccoutant@google.com>
1017 * options.cc (General_options::finalize): Disallow -pie and -static.
1019 2012-02-03 Doug Kwan <dougkwan@google.com>
1021 * arm.cc (Arm_relocate_functions::abs8,
1022 Arm_relocate_functions::abs16): Use
1023 Bits::has_signed_unsigned_overflow32.
1024 (Arm_relocate_functions::thm_abs8): Correct range of
1026 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1029 2012-02-02 Doug Kwan <dougkwan@google.com>
1031 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1032 position independent outputs, not just shared objects.
1034 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1036 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1037 * configure: Regenerated.
1039 2012-01-27 Ian Lance Taylor <iant@google.com>
1041 * reloc.h (Bits): New class with static functions, copied from
1042 namespace utils in arm.cc.
1043 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1046 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1048 * incremental.cc (write_info_blocks): Correct relocation offset.
1050 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1052 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1053 (Relocate::tls_gd_to_le): Likewise.
1055 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1057 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1059 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1061 * configure.ac: Check if -mcmodel=medium works.
1062 * configure: Regenerated.
1064 2012-01-24 Cary Coutant <ccoutant@google.com>
1066 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1068 (read_unsigned_LEB_128_x): ... this new function.
1069 (read_signed_LEB_128): Replaced with inline definition and ...
1070 (read_signed_LEB_128_x): ... this new function.
1071 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1072 (read_unsigned_LEB_128): Add inline definition.
1073 (read_signed_LEB_128_x): New function.
1074 (read_signed_LEB_128): Add inline definition.
1075 * testsuite/Makefile.am (leb128_unittest): New unit test.
1076 * testsuite/Makefile.in: Regenerate.
1077 * testsuite/leb128_unittest.cc: New unit test.
1079 2012-01-23 Ian Lance Taylor <iant@google.com>
1082 * i386.cc (Target_i386::do_code_fill): When using a jmp
1083 instruction, pad with nop instructions.
1084 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1086 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1088 * x86_64.cc (gc_process_relocs): Add typename on types used in
1090 (scan_relocs): Likewise.
1091 (relocate_section): Likewise.
1092 (apply_relocation): Likewise.
1094 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1096 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1097 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1100 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1102 * x86_64.cc: Initial support for x32.
1104 2012-01-03 Cary Coutant <ccoutant@google.com>
1106 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1107 Use abstract base class for GOT.
1108 * gold/output.h (class Output_data_got_base): New abstract base class.
1109 (class Output_data_got): Derive from new base class, adjust ctors.
1110 (Output_data_got::reserve_slot): Make virtual; rename to
1111 do_reserve_slot; Adjust callers.
1112 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1113 pointer to abstract base class.
1114 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1116 2011-12-18 Ian Lance Taylor <iant@google.com>
1118 * object.h (Relobj::local_symbol_value): New function.
1119 (Relobj::local_plt_offset): New function.
1120 (Relobj::local_has_got_offset): New function.
1121 (Relobj::local_got_offset): New function.
1122 (Relobj::set_local_got_offset): New function.
1123 (Relobj::do_local_symbol_value): New pure virtual function.
1124 (Relobj::do_local_plt_offset): Likewise.
1125 (Relobj::do_local_has_got_offset): Likewise.
1126 (Relobj::do_local_got_offset): Likewise.
1127 (Relobj::do_set_local_got_offset): Likewise.
1128 (Sized_relobj::do_local_has_got_offset): Rename from
1129 local_has_got_offset.
1130 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1131 (Sized_relobj::do_set_local_got_offset): Rename from
1132 set_local_got_offset.
1133 (Sized_relobj_file::do_local_plt_offset): Rename from
1135 (Sized_relobj_file::do_local_symbol_value): New function.
1136 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1138 * output.cc (Output_data_got::Got_entry::write): Change object to
1139 Relobj. Use local_symbol_value.
1140 (Output_data_got::add_global_with_rel): Change rel_dyn to
1141 Output_data_reloc_generic*. Use add_global_generic.
1142 (Output_data_got::add_global_with_rela): Remove. Change all
1143 callers to use add_global_with_rel.
1144 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1145 Output_data_reloc_generic*. Use add_global_generic.
1146 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1147 callers to use add_global_pair_with_rel.
1148 (Output_data_got::add_local): Change object to Relobj*.
1149 (Output_data_got::add_local_plt): Likewise.
1150 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1151 change rel_dyn to Output_data_reloc_generic*. Use
1153 (Output_data_got::add_local_with_rela): Remove. Change all
1154 callers to use all_local_with_rel.
1155 (Output_data_got::add_local_pair_with_rel): Change object to
1156 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1157 add_output_section_generic.
1158 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1159 callers to use add_local_pair_with_rel.
1160 (Output_data_got::reserve_local): Change object to Relobj*.
1161 * output.h: (class Output_data_reloc_generic): Add pure virtual
1162 declarations for add_global_generic, add_local_generic,
1163 add_output_section_generic.
1164 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1165 functions for Output_data_reloc_generic. Update declarations for
1166 changes listed in output.cc.
1167 (class Output_data_got): Change template parameter to got_size.
1168 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1169 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1171 (Sized_relobj_incr::do_local_plt_offset): New function.
1172 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1175 2011-12-17 Cary Coutant <ccoutant@google.com>
1177 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1178 * resolve.cc (Symbol_table::resolve): Likewise.
1179 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1181 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1183 2011-12-16 Ian Lance Taylor <iant@google.com>
1185 * output.h (Output_data_reloc_generic::add): Only call
1186 add_dynamic_reloc if this is a dynamic reloc section.
1188 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1191 * target-reloc.h (apply_relocation): Replace <64, false> with
1194 2011-11-25 Nick Clifton <nickc@redhat.com>
1196 * po/it.po: New Italian translation.
1198 2011-11-17 Sterling Augustine <saugustine@google.com>
1200 * script.cc (script_include_directive): Implement.
1201 (read_script_file): New local variables name and search_path. Update
1202 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1203 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1204 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1206 2011-11-11 Sterling Augustine <saugustine@google.com>
1208 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1209 (file_or_sections_cmd): Likewise.
1211 2011-11-11 Doug Kwan <dougkwan@google.com>
1213 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1214 if --just-symbols is given.
1216 2011-11-10 Doug Kwan <dougkwan@google.com>
1219 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1220 when processing data relocs.
1221 * reloc.h (Relocate_functions::rel_unaligned): New method.
1222 (Relocate_functions::pcrel_unaligned): Ditto.
1223 (Relocate_functions::rel32_unaligned): Ditto.
1224 (Relocate_functions::pcrel32_unaligned): Ditto.
1226 2011-11-09 Doug Kwan <dougkwan@google.com>
1229 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1230 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1231 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1232 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1233 (Relocate_functions::rel_unaligned): New.
1234 (Relocate_functions::rel32_unaligned): New.
1235 * target-reloc.h (relocate_for_relocatable): Add code to handle
1236 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1237 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1238 arm_unaligned_reloc_r): New targets.
1239 * testsuite/Makefile.in: Regenerate.
1240 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1243 2011-11-02 Ian Lance Taylor <iant@google.com>
1245 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1247 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1248 * options.cc (General_options::finalize): Use library search path
1249 from configure script if specified. If not native and no sysroot,
1250 only search TOOLLIBDIR.
1251 * options.h (Search_directory::Search_directory): Change name to
1253 (General_options::add_to_library_path_with_sysroot): Change arg to
1255 * configure, Makefile.in, config.in: Rebuild.
1257 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1259 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1260 we are working around the ARM1176 Erratum.
1261 * options.h (General_options::fix_arm1176): Add option.
1262 * testsuite/Makefile.am: Add testcases, and keep current ones
1264 * testsuite/Makefile.in: Regenerate.
1265 * testsuite/arm_fix_1176.s: New file.
1266 * testsuite/arm_fix_1176.sh: Likewise.
1268 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1270 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1272 (Target_arm::may_use_blx): Remove method.
1273 (Target_arm::set_may_use_blx): Likewise.
1274 (Target_arm::may_use_v4t_interworking): New method.
1275 (Target_arm::may_use_v5t_interworking): Likewise.
1276 (Target_arm::may_use_blx_): Remove member variable.
1277 (Arm_relocate_functions::arm_branch_common): Check for v5T
1279 (Arm_relocate_functions::thumb_branch_common): Likewise.
1280 (Reloc_stub::stub_type_for_reloc): Likewise.
1281 (Target_arm::do_finalize_sections): Correct interworking checks.
1282 * testsuite/Makefile.am: Add new tests.
1283 * testsuite/Makefile.in: Regenerate.
1284 * testsuite/arm_farcall_arm_arm.s: New test.
1285 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1286 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1287 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1288 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1289 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1290 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1291 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1293 2011-10-31 Cary Coutant <ccoutant@google.com>
1296 * expression.cc (Expression::eval_with_dot): Add
1297 is_section_dot_assignment parameter.
1298 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1299 absolute and assigning to dot within a section.
1300 * script-sections.cc
1301 (Output_section_element_assignment::set_section_addresses): Pass
1302 dot_section to set_if_absolute.
1303 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1304 as is_section_dot_assignment flag to eval_with_dot.
1305 (Output_section_element_dot_assignment::set_section_addresses):
1307 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1308 parameter. Also set value if relative to dot_section; set the
1309 symbol's output_section.
1310 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1311 parameter. Adjust all callers.
1312 (Expression::eval_maybe_dot): Likewise.
1313 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1315 * testsuite/script_test_2.t: Test assignment of an absolute value
1316 to dot within an output section element.
1318 2011-10-31 Cary Coutant <ccoutant@google.com>
1320 * options.h (class General_options): Add --[no-]gnu-unique options.
1321 * symtab.cc (Symbol_table::sized_write_globals): Convert
1322 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1324 2011-10-31 Cary Coutant <ccoutant@google.com>
1327 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1328 unnecessary assertion.
1329 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1331 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1333 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1335 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1337 Change to just keep the section associated with symbol.
1338 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1339 they are externally visible and --export-dynamic is turned on.
1340 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1342 2011-10-19 Ian Lance Taylor <iant@google.com>
1345 * script-sections.cc
1346 (Output_section_element_dot_assignment::needs_output_section): New
1349 2011-10-19 Ian Lance Taylor <iant@google.com>
1352 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1353 --section-start option was seen.
1354 * options.h (General_options::any_section_start): New function.
1356 2011-10-18 David S. Miller <davem@davemloft.net>
1359 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1360 member to track relocation locations that have moved during TLS
1361 reloc optimizations.
1362 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1363 (Target_sparc::Relocate::relocate): Adjust view down by 4
1364 bytes if it matches reloc_adjust_addr_.
1365 (Target_sparc::Relocate::relocate_tls): Always move the
1366 __tls_get_addr call delay slot instruction forward 4 bytes when
1367 performing relaxation.
1369 2011-10-18 Cary Coutant <ccoutant@google.com>
1371 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1372 (Output_file::map_no_anonymous): Check for non-zero
1373 return code from posix_fallocate.
1375 2011-10-17 Cary Coutant <ccoutant@google.com>
1378 * plugin.cc (is_visible_from_outside): Check for symbols
1379 referenced from dynamic objects.
1380 * resolve.cc (Symbol_table::resolve): Don't count references
1381 from dynamic objects as references from real ELF files.
1382 * testsuite/plugin_test_2.sh: Adjust expected result.
1384 2011-10-17 Cary Coutant <ccoutant@google.com>
1386 * gold.cc: Include timer.h.
1387 (queue_middle_tasks): Stamp time.
1388 (queue_final_tasks): Likewise.
1389 * main.cc (main): Store timer in parameters. Print timers
1391 * parameters.cc (Parameters::Parameters): Initialize timer_.
1392 (Parameters::set_timer): New function.
1393 (set_parameters_timer): New function.
1394 * parameters.h (Parameters::set_timer): New function.
1395 (Parameters::timer): New function.
1396 (Parameters::timer_): New data member.
1397 (set_parameters_timer): New function.
1398 * timer.cc (Timer::stamp): New function.
1399 (Timer::get_pass_time): New function.
1400 * timer.h (Timer::stamp): New function.
1401 (Timer::get_pass_time): New function.
1402 (Timer::pass_times_): New data member.
1404 2011-10-17 Cary Coutant <ccoutant@google.com>
1406 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1407 task for members of lib groups.
1409 2011-10-17 Cary Coutant <ccoutant@google.com>
1412 * fileread.cc (File_read::find_view): Add assert.
1413 (File_read::make_view): Move bounds check (replace with assert)...
1414 (File_read::find_or_make_view): ... to here.
1416 2011-10-12 Cary Coutant <ccoutant@google.com>
1418 * output.cc (Output_file::open_base_file): Handle case where
1419 ::read returns less than requested size.
1421 2011-10-10 Cary Coutant <ccoutant@google.com>
1423 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1424 Initialize defined_count_.
1425 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1426 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1427 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1428 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1429 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1430 * incremental.h (Sized_relobj_incr::defined_count_): New data
1432 (Sized_incr_dynobj::defined_count_): New data member.
1433 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1434 Return zeroes instead of internal error.
1436 2011-10-10 Cary Coutant <ccoutant@google.com>
1439 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1440 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1441 * output.h (class Output_reloc): Add use_plt_offset flag.
1442 (Output_reloc::type_): Adjust size of bit field.
1443 (Output_reloc::use_plt_offset_): New bit field.
1444 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1445 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1446 flag. Adjust all callers.
1447 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1448 creating RELATIVE relocations.
1450 2011-10-10 Nick Clifton <nickc@redhat.com>
1452 * po/es.po: Updated Spanish translation.
1453 * po/fi.po: Updated Finnish translation.
1455 2011-10-03 Diego Novillo <dnovillo@google.com>
1457 * options.cc (parse_uint): Fix dereference of RETVAL.
1459 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1461 * layout.h (section_order_map_): New member.
1462 (get_section_order_map): New member function.
1463 * output.cc (Output_section::add_input_section): Check for patterns
1464 only when --section-ordering-file is specified.
1465 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1466 output_sections have been formed.
1467 * layout.cc (Layout_Layout): Initialize section_order_map_.
1468 * plugin.cc (update_section_order): Store order in order_map. Do not
1470 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1471 * testsuite/Makefile.in: Regenerate.
1472 * testsuite/plugin_section_order.c: New file.
1473 * testsuite/plugin_final_layout.cc: New file.
1474 * testsuite/plugin_final_layout.sh: New file.
1476 2011-09-29 Cary Coutant <ccoutant@google.com>
1478 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1480 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1481 symbols during incremental update.
1482 (Symbol_table::add_from_dynobj): Likewise.
1484 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1485 Ian Lance Taylor <iant@google.com>
1487 * symtab.cc (Symbol_table::define_special_symbol): Always
1488 canonicalize version string.
1490 2011-09-26 Cary Coutant <ccoutant@google.com>
1492 * gold.cc (queue_initial_tasks): Move option checks ...
1493 * options.cc (General_options::finalize): ... to here. Disable
1494 some options; make others fatal.
1496 2011-09-26 Cary Coutant <ccoutant@google.com>
1499 * plugin.cc (get_symbols_v2): New function.
1500 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1501 (is_referenced_from_outside): New function.
1502 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1503 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1504 (get_symbols): Pass version parameter.
1505 (get_symbols_v2): New function.
1506 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1508 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1509 (onload): Add LDPT_GET_SYMBOLS_V2.
1510 (all_symbols_read_hook): Use get_symbols_v2; check for
1511 LDPR_PREVAILING_DEF_IRONLY_EXP.
1512 * testsuite/plugin_test_3.sh: Update expected results.
1514 2011-09-23 Simon Baldwin <simonb@google.com>
1516 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1517 configuration options.
1518 * configure: Regenerate.
1519 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1520 * Makefile.in: Regenerate.
1521 * testsuite/Makefile.in: Regenerate.
1523 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1525 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1527 2011-09-19 Cary Coutant <ccoutant@google.com>
1529 * incremental.cc (can_incremental_update): Fix typo in comment.
1530 * incremental.h (can_incremental_update): Likewise.
1532 2011-09-18 Cary Coutant <ccoutant@google.com>
1534 * incremental.cc (can_incremental_update): New function.
1535 * incremental.h (can_incremental_update): New function.
1536 * layout.cc (Layout::init_fixed_output_section): Call it.
1537 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1538 * object.cc (Sized_relobj_file::do_layout): Call
1539 can_incremental_update.
1541 2011-09-13 Cary Coutant <ccoutant@google.com>
1543 * configure.ac: Check for glibc support for gnu_indirect_function
1544 support with static linking, setting automake conditional
1546 * Makefile.in: Regenerate.
1547 * configure: Regenerate.
1549 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1550 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1552 * testsuite/Makefile.in: Regenerate.
1554 2011-09-13 Cary Coutant <ccoutant@google.com>
1556 * incremental.cc (Sized_relobj_incr::do_layout): Call
1557 report_comdat_group for kept comdat sections.
1558 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1559 * testsuite/Makefile.in: Regenerate.
1560 * testsuite/incr_comdat_test_1.cc: New source file.
1561 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1562 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1563 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1565 2011-09-13 Ian Lance Taylor <iant@google.com>
1567 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1568 variable external_symbols_offset.
1570 2011-09-12 Ian Lance Taylor <iant@google.com>
1572 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1573 triggered if object has no symbols.
1575 2011-09-09 David S. Miller <davem@davemloft.net>
1577 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1578 (Output_fill_debug_line::do_write): Likewise.
1580 2011-08-29 Cary Coutant <ccoutant@google.com>
1582 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1583 casts to match formatting specs.
1584 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1586 2011-08-26 Cary Coutant <ccoutant@google.com>
1588 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1589 remaining hole size when allocating.
1590 (Layout::make_output_section): Set fill methods for debug sections.
1591 * layout.h (Free_list::Free_list_node): Move from private to
1593 (Free_list::set_min_hole_size): New function.
1594 (Free_list::begin, Free_list::end): New functions.
1595 (Free_list::min_hole_): New data member.
1596 * output.cc: Include dwarf.h.
1597 (Output_fill_debug_info::do_minimum_hole_size): New function.
1598 (Output_fill_debug_info::do_write): New function.
1599 (Output_fill_debug_line::do_minimum_hole_size): New function.
1600 (Output_fill_debug_line::do_write): New function.
1601 (Output_section::Output_section): Initialize new data member.
1602 (Output_section::set_final_data_size): Ensure patch space is larger
1603 than minimum hole size.
1604 (Output_section::do_write): Fill holes in debug sections.
1605 * output.h (Output_fill): New class.
1606 (Output_fill_debug_info): New class.
1607 (Output_fill_debug_line): New class.
1608 (Output_section::set_free_space_fill): New function.
1609 (Output_section::free_space_fill_): New data member.
1610 * testsuite/Makefile.am (incremental_test_3): Add
1611 --incremental-patch option.
1612 (incremental_test_4): Likewise.
1613 (incremental_test_5): Likewise.
1614 (incremental_test_6): Likewise.
1615 (incremental_copy_test): Likewise.
1616 (incremental_common_test_1): Likewise.
1617 * testsuite/Makefile.in: Regenerate.
1619 2011-08-26 Nick Clifton <nickc@redhat.com>
1621 * po/es.po: Updated Spanish translation.
1623 2011-08-01 Cary Coutant <ccoutant@google.com>
1625 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1626 * gold/testsuite/Makefile.in: Regenerate.
1627 * gold/testsuite/justsyms_exec.c: New source file.
1628 * gold/testsuite/justsyms_lib.c: New source file.
1630 2011-08-01 Cary Coutant <ccoutant@google.com>
1632 * layout.cc (Layout::set_segment_offsets): Don't realign text
1633 segment if -Ttext was specified.
1634 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1636 * object.h (Sized_relobj_file::e_type): New function.
1637 (Sized_relobj_file::e_type_): New data member.
1638 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1639 base address for ET_EXEC files.
1640 * target.cc (Target::do_make_elf_object_implementation): Allow
1641 ET_EXEC files with --just-symbols option.
1643 2011-07-28 Cary Coutant <ccoutant@google.com>
1645 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1646 Add thread_number parameter.
1647 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1648 * workqueue-threads.cc
1649 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1650 current thread if its thread number is greater than desired thread
1652 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1653 Add thread_number parameter.
1654 (Workqueue::should_cancel_thread): Likewise.
1655 (Workqueue::find_runnable_or_wait): Pass thread_number to
1656 should_cancel_thread.
1657 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1660 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1662 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1663 only after checking if it cannot be forced local.
1664 * symtab.h (is_externally_visible): Check if the symbol is not forced
1667 2011-07-15 Ian Lance Taylor <iant@google.com>
1669 * options.h (class General_options): Add --print-output-format.
1670 Move -EL next to -EB, for better --help output.
1671 * target-select.cc: Include <cstdio>, "options.h", and
1673 (Target_selector::do_target_bfd_name): New function.
1674 (print_output_format): New function.
1675 * target-select.h (class Target_selector): Update declarations.
1676 (Target_selector::target_bfd_name): New function.
1677 (print_output_format): Declare.
1678 * main.cc: Include "target-select.h".
1679 (main): Handle --print-output-format.
1680 * gold.cc: Include "target-select.h".
1681 (queue_initial_tasks): Handle --print-output-format when there are
1683 * parameters.cc (parameters_force_valid_target): Give a better
1684 error message if -EB/-EL does not match target.
1685 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1688 2011-07-15 Ian Lance Taylor <iant@google.com>
1690 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1691 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1692 (Output_data_plt_i386::do_write): Write address of .dynamic
1693 section to first entry in .got.plt section.
1694 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1695 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1697 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1698 section to first entry in .got.plt section.
1699 * layout.h (Layout::dynamic_section): New function.
1701 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1703 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1705 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1706 input_section_position_, and input_section_glob_.
1707 (read_layout_from_file): Call function section_ordering_specified.
1708 * layout.h (is_section_ordering_specified): New function.
1709 (section_ordering_specified): New function.
1710 (section_ordering_specified_): New boolean member.
1711 * main.cc(main): Call load_plugins after layout object is defined.
1712 * output.cc (Output_section::add_input_section): Use
1713 function section_ordering_specified to check if section ordering is
1715 * output.cc (Output_section::add_relaxed_input_section): Use
1716 function section_ordering_specified to check if section ordering is
1718 (Output_section::update_section_layout): New function.
1719 (Output_section::sort_attached_input_sections): Check if input section
1721 * output.h (Output_section::update_section_layout): New function.
1722 * plugin.cc (get_section_count): New function.
1723 (get_section_type): New function.
1724 (get_section_name): New function.
1725 (get_section_contents): New function.
1726 (update_section_order): New function.
1727 (allow_section_ordering): New function.
1728 (Plugin::load): Add the new interfaces to the transfer vector.
1729 (Plugin_manager::load_plugins): New parameter.
1730 (Plugin_manager::all_symbols_read): New parameter.
1731 (Plugin_manager::claim_file): New parameter. Save the elf object for
1733 (Plugin_manager::get_elf_object): New function.
1734 (Plugin_manager::get_view): Change to directly use the bool to check
1735 if get_view is called from claim_file_hook.
1736 * plugin.h (input_objects): New function
1737 (Plugin__manager::load_plugins): New parameter.
1738 (Plugin_manager::claim_file): New parameter.
1739 (Plugin_manager::get_elf_object): New function.
1740 (Plugin_manager::in_claim_file_handler): New function.
1741 (Plugin_manager::in_claim_file_handler_): New member.
1742 (layout): New function.
1743 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1744 handler with an extra parameter. Make the elf object before calling
1746 * testsuite/plugin_test.c (get_section_count): New function pointer.
1747 (get_section_type): New function pointer.
1748 (get_section_name): New function pointer.
1749 (get_section_contents): New function pointer.
1750 (update_section_order): New function pointer.
1751 (allow_section_ordering): New function pointer.
1752 (onload): Check if the new interfaces exist.
1754 2011-07-13 Ian Lance Taylor <iant@google.com>
1756 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1758 * x86_64.cc (Target_x86_64::got_section): Likewise.
1759 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1760 (relro_now_test_SOURCES): New variable.
1761 (relro_now_test_DEPENDENCIES): New variable.
1762 (relro_now_test_LDFLAGS): New variable.
1763 (relro_now_test_LDADD): New variable.
1764 (relro_now_test.so): New target.
1765 * testsuite/Makefile.in: Rebuild.
1767 2011-07-12 Ian Lance Taylor <iant@google.com>
1770 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1771 GLOB_DAT relocation rather than a RELATIVE relocation for a
1772 protected symbol when creating a shared library.
1773 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1774 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1775 * testsuite/protected_main_1.cc (main): Test that protected
1776 function has same address.
1778 2011-07-11 Ian Lance Taylor <iant@google.com>
1781 * options.h (class General_options): Add -Bgroup.
1782 * options.cc (General_options::finalize): If -Bgroup is set,
1783 default to --unresolved-symbols=report-all.
1784 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1785 * target-reloc.h (issue_undefined_symbol_error): Handle
1786 --unresolved-symbols=report-all.
1788 2011-07-08 Ian Lance Taylor <iant@google.com>
1791 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1792 if linker script discards key sections.
1793 (Layout::create_dynamic_symtab): Likewise.
1794 (Layout::assign_local_dynsym_offsets): Likewise.
1795 (Layout::sized_create_version_sections): Likewise.
1796 (Layout::create_interp): Likewise.
1797 (Layout::finish_dynamic_section): Likewise.
1798 (Layout::set_dynamic_symbol_size): Likewise.
1800 2011-07-08 Ian Lance Taylor <iant@google.com>
1803 * options.h (class General_options): Add --unresolved-symbols.
1804 * target-reloc.h (issue_undefined_symbol_error): Check
1805 --unresolved-symbols. Add comments.
1807 2011-07-08 Ian Lance Taylor <iant@google.com>
1809 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1810 expression more complex.
1812 2011-07-08 Ian Lance Taylor <iant@google.com>
1815 * target-reloc.h (issue_undefined_symbol_error): New inline
1816 function, broken out of relocate_section.
1817 (relocate_section): Call issue_undefined_symbol_error.
1818 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1819 there is no TLS segment if we are about to issue an undefined
1821 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1823 2011-07-08 Ian Lance Taylor <iant@google.com>
1826 * resolve.cc (Symbol_table::should_override): Add fromtype
1827 parameter. Change all callers. Give error when linking together
1828 TLS and non-TLS symbol.
1829 (Symbol_table::should_override_with_special): Add fromtype
1830 parameter. Change all callers.
1831 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1832 there is no TLS segment if we have reported some errors.
1833 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1835 2011-07-08 Ian Lance Taylor <iant@google.com>
1838 * target.h (Target::plt_address_for_global): New function.
1839 (Target::plt_address_for_local): New function.
1840 (Target::plt_section_for_global): Remove.
1841 (Target::plt_section_for_local): Remove.
1842 (Target::do_plt_address_for_global): New virtual function.
1843 (Target::do_plt_address_for_local): New virtual function.
1844 (Target::do_plt_section_for_global): Remove.
1845 (Target::do_plt_section_for_local): Remove.
1846 (Target::register_global_plt_entry): Add Symbol_table and Layout
1848 * output.cc (Output_data_got::Got_entry::write): Use
1849 plt_address_for_global and plt_address_for_local.
1850 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1851 address of output section.
1852 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1853 got_irelative_, and irelative_count_ fields. Update
1855 (Output_data_plt_i386::has_irelative_section): New function.
1856 (Output_data_plt_i386::entry_count): Add irelative_count_.
1857 (Output_data_plt_i386::set_final_data_size): Likewise.
1858 (class Target_i386): Add got_irelative_ and rel_irelative_
1859 fields. Update declarations.
1860 (Target_i386::Target_i386): Initialize new fields.
1861 (Target_i386::do_plt_address_for_global): New function replacing
1862 do_plt_section_for_global.
1863 (Target_i386::do_plt_address_for_local): New function replacing
1864 do_plt_section_for_local.
1865 (Target_i386::got_section): Create got_irelative_.
1866 (Target_i386::rel_irelative_section): New function.
1867 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1868 fields. Don't define __rel_iplt_{start,end}.
1869 (Output_data_plt_i386::add_entry): Add symtab and layout
1870 parameters. Change all callers. Use different PLT and GOT for
1872 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1873 layout parameters. Change all callers. Use different PLT and
1875 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1876 (Output_data_plt_i386::rel_irelative): New function.
1877 (Output_data_plt_i386::address_for_global): New function.
1878 (Output_data_plt_i386::address_for_local): New function.
1879 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1880 IRELATIVE GOT when changing IFUNC GOT entries.
1881 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1883 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1884 if we didn't create an IRELATIVE GOT.
1885 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1886 plt_address_for_local.
1887 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1888 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1889 got_irelative_, and irelative_count_ fields. Update
1891 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1892 Initialize new fields. Remove symtab parameter. Change all
1894 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1896 (Output_data_plt_x86_64::has_irelative_section): New function.
1897 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1898 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1899 fields. Update declarations.
1900 (Target_x86_64::Target_x86_64): Initialize new fields.
1901 (Target_x86_64::do_plt_address_for_global): New function replacing
1902 do_plt_section_for_global.
1903 (Target_x86_64::do_plt_address_for_local): New function replacing
1904 do_plt_section_for_local.
1905 (Target_x86_64::got_section): Create got_irelative_.
1906 (Target_x86_64::rela_irelative_section): New function.
1907 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1908 all callers. Don't create __rel_iplt_{start,end}.
1909 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1910 parameters. Change all callers. Use different PLT and GOT for
1912 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1913 layout parameters. Change all callers. Use different PLT and
1915 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1916 parameters. Change all callers. Use different PLT and GOT for
1918 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1919 (Output_data_plt_x86_64::rela_irelative): New function.
1920 (Output_data_plt_x86_64::address_for_global): New function.
1921 (Output_data_plt_x86_64::address_for_local): New function.
1922 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1923 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1924 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1925 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1927 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1929 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1930 symbols if we didn't create an IRELATIVE GOT.
1931 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1932 plt_address_for_local.
1933 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1934 * testsuite/ifuncvar1.c: New test file.
1935 * testsuite/ifuncvar2.c: New test file.
1936 * testsuite/ifuncvar3.c: New test file.
1937 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1938 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1939 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1940 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1941 * testsuite/Makefile.in: Rebuild.
1943 2011-07-07 Cary Coutant <ccoutant@google.com>
1945 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1946 (two_file_test_1_ndebug.o): Likewise.
1947 (two_file_test_1b_ndebug.o): Likewise.
1948 (two_file_test_2_ndebug.o): Likewise.
1949 (two_file_test_main_ndebug.o): Likewise.
1950 (incremental_test_2): Link with no-debug versions.
1952 2011-07-06 Cary Coutant <ccoutant@google.com>
1954 * gold/incremental.cc
1955 (Output_section_incremental_inputs::write_info_blocks): Check for
1956 hidden and internal symbols.
1958 2011-07-06 Cary Coutant <ccoutant@google.com>
1960 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1961 Check disposition for startup file.
1962 (Incremental_inputs::report_command_line): Ignore
1963 --incremental-startup-unchanged option.
1964 * options.cc (General_options::parse_incremental_startup_unchanged):
1966 (General_options::General_options): Initialize new data member.
1967 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1968 (General_options): Add --incremental-startup-unchanged option.
1969 (General_options::incremental_startup_disposition): New function.
1970 (General_options::incremental_startup_disposition_): New data member.
1972 2011-07-06 Cary Coutant <ccoutant@google.com>
1974 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1975 input file index to Script_info ctor.
1976 (Sized_incremental_binary::do_file_has_changed): Find the
1977 command-line argument for files named in scripts.
1978 * incremental.h (Script_info::Script_info): New ctor
1979 with input file index.
1980 (Script_info::input_file_index): New function.
1981 (Script_info::input_file_index_): New data member.
1982 (Incremental_binary::get_library): Add const.
1983 (Incremental_binary::get_script_info): Add const.
1984 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1985 * testsuite/Makefile.am (incremental_test_5): New test case.
1986 (incremental_test_6): New test case.
1987 * testsuite/Makefile.in: Regenerate.
1989 2011-07-06 Cary Coutant <ccoutant@google.com>
1991 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1992 debug output when command lines differ.
1994 2011-07-06 Cary Coutant <ccoutant@google.com>
1996 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1997 --incremental-patch option.
1998 * layout.cc (Free_list::allocate): Extend allocation beyond original
2000 (Layout::make_output_section): Mark sections that should get
2002 * options.cc (parse_percent): New function.
2003 * options.h (parse_percent): New function.
2004 (DEFINE_percent): New macro.
2005 (General_options): Add --incremental-patch option.
2006 * output.cc (Output_section::Output_section): Initialize new data
2008 (Output_section::add_input_section): Print section name when out
2010 (Output_section::add_output_section_data): Likewise.
2011 (Output_section::set_final_data_size): Add patch space when
2012 doing --incremental-full.
2013 (Output_section::do_reset_address_and_file_offset): Remove patch
2015 (Output_segment::set_section_list_addresses): Print debug output
2016 only if --incremental-update.
2017 * output.h (Output_section::set_is_patch_space_allowed): New function.
2018 (Output_section::is_patch_space_allowed_): New data member.
2019 (Output_section::patch_space_): New data member.
2020 * parameters.cc (Parameters::incremental_full): New function.
2021 * parameters.h (Parameters::incremental_full): New function
2022 * testsuite/Makefile.am (incremental_test_2): Add test for
2023 --incremental-patch option.
2024 * testsuite/Makefile.in: Regenerate.
2025 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2026 (t18): Remove function body.
2028 2011-07-05 Doug Kwan <dougkwan@google.com>
2031 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2032 Arm_Address type for relocation result.
2033 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2035 (Arm_relocate_functions::abs32): Use unaligned access.
2036 (Arm_relocate_functions::rel32): Ditto.
2037 (Arm_relocate_functions::prel31): Ditto.
2038 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2039 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2040 static data relocations.
2041 * testsuite/Makefile.in: Regnerate.
2042 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2044 2011-07-05 Ian Lance Taylor <iant@google.com>
2047 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2048 symbols if necessary.
2049 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2051 2011-07-05 Ian Lance Taylor <iant@google.com>
2054 * resolve.cc (Symbol::override_base_with_special): Simply override
2055 version with special symbol version, ignoring previous version.
2057 2011-07-05 Ian Lance Taylor <iant@google.com>
2059 * object.cc (Sized_relobj_file::include_section_group): Add
2060 information to comment about signature location.
2062 2011-07-02 Ian Lance Taylor <iant@google.com>
2065 * options.h (class General_options): Add -f and -F.
2066 * options.cc (General_options::finalize): Fatal error if -f/-F
2067 are used without -shared.
2068 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2070 2011-07-02 Ian Lance Taylor <iant@google.com>
2072 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2074 2011-07-01 Ian Lance Taylor <iant@google.com>
2078 * resolve.cc (Symbol::override_base_with_special): Don't override
2079 the version if the overriding symbol has a different name.
2080 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2081 all callers. If we give an error about an undefined version,
2082 define the base version if necessary.
2083 * dynobj.h (class Versions): Update declaration.
2084 * testsuite/weak_alias_test_5.cc: New file.
2085 * testsuite/weak_alias_test.script: New file.
2086 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2087 and versioned_alias have the right value, and call t2.
2088 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2089 weak_alias_test_5.so.
2090 (weak_alias_test_LDADD): Likewise.
2091 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2092 * testsuite/Makefile.in: Rebuild.
2094 2011-07-01 Ian Lance Taylor <iant@google.com>
2097 * options.h (class General_options): Support -z notext.
2098 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2100 (two_file_shared_nonpic.so): Likewise.
2101 (two_file_shared_mixed.so): Likewise.
2102 (two_file_shared_mixed_1.so): Likewise.
2103 (weak_undef_lib_nonpic.so): Likewise.
2104 (alt/weak_undef_lib_nonpic.so): Likewise.
2105 (tls_test_shared_nonpic.so): Likewise.
2106 * testsuite/Makefile.in: Rebuild.
2108 2011-07-01 Ian Lance Taylor <iant@google.com>
2111 * configure.ac: Test whether static linking works, setting
2112 the automake conditional HAVE_STATIC.
2113 * testsuite/Makefile.am: Disable tests using -static if
2114 HAVE_STATIC is not true.
2115 * configure, testsuite/Makefile.in: Rebuild.
2117 2011-07-01 Ian Lance Taylor <iant@google.com>
2120 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2121 Assert if we see DW_EH_PE_indirect.
2122 * target.h (Target::ehframe_datarel_base): New function.
2123 (Target::do_ehframe_datarel_base): New target function.
2124 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2125 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2128 2011-07-01 Ian Lance Taylor <iant@google.com>
2131 * options.h (class General_options): Add
2132 --ld-generated-unwind-info.
2133 * ehframe.cc (Fde::write): Add address parameter. Change all
2134 callers. If associated with PLT, fill in address and size.
2135 (Cie::set_output_offset): Only add merge mapping if there is an
2137 (Cie::write): Add address parameter. Change all callers.
2138 (Eh_frame::add_ehframe_for_plt): New function.
2139 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2140 input_offset_ fields into union u_, with new plt field.
2141 (Fde::Fde): Adjust for new union field.
2142 (Fde::Fde) [Output_data version]: New constructor.
2143 (Fde::add_mapping): Only add merge mapping if there is an object.
2144 (class Cie): Update declarations.
2145 (class Eh_frame): Declare add_ehframe_for_plt.
2146 * layout.cc (Layout::layout_eh_frame): Break out code into
2147 make_eh_frame_section, and call it.
2148 (Layout::make_eh_frame_section): New function.
2149 (Layout::add_eh_frame_for_plt): New function.
2150 * layout.h (class Layout): Update declarations.
2151 * merge.cc (Merge_map::add_mapping): Add assertion.
2152 * i386.cc: Include "dwarf.h".
2153 (class Output_data_plt_i386): Make first_plt_entry,
2154 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2155 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2156 and plt_eh_frame_fde.
2157 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2158 boundary. Call add_eh_frame_for_plt if appropriate.
2159 * x86_64.cc: Include "dwarf.h".
2160 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2161 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2162 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2163 and plt_eh_frame_fde.
2164 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2167 2011-06-29 Ian Lance Taylor <iant@google.com>
2170 * object.cc (Sized_relobj_file::layout_section): Change shdr
2171 parameter to be const.
2172 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2174 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2175 appropriate. Call layout_eh_frame_section.
2176 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2178 * object.h (class Sized_relobj_file): Update declarations.
2180 2011-06-29 Ian Lance Taylor <iant@google.com>
2183 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2185 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2187 2011-06-29 Ian Lance Taylor <iant@google.com>
2190 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2192 * layout.cc (Layout::layout_eh_frame): Likewise.
2194 2011-06-29 Ian Lance Taylor <iant@google.com>
2197 * layout.cc (Layout::symtab_section_shndx): New function.
2198 * layout.h (class Layout): Declare symtab_section_shndx.
2199 * output.cc (Output_section::write_header): Call it.
2201 2011-06-29 Ian Lance Taylor <iant@google.com>
2204 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2205 symbols which are not used in a relocation.
2207 2011-06-28 Ian Lance Taylor <iant@google.com>
2210 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2211 script create indistinguishable segments.
2212 (Layout::set_segment_offsets): Use stable_sort when sorting
2213 segments. Pass this to Compare_segments constructor.
2214 * layout.h (class Layout): Make segment_precedes non-static.
2215 (class Compare_segments): Change from struct to class. Add
2216 layout_ field. Add constructor.
2217 * script-sections.cc
2218 (Script_sections::attach_sections_using_phdrs_clause): Rename
2219 local orphan to is_orphan. Don't report failure to put empty
2220 section in segment. On attachment failure, report name of
2221 section, and attach to first PT_LOAD segment.
2223 2011-06-28 Ian Lance Taylor <iant@google.com>
2226 * target-select.cc (Target_selector::Target_selector): Add
2227 emulation parameter. Change all callers.
2228 (select_target_by_bfd_name): Rename from select_target_by_name.
2230 (select_target_by_emulation): New function.
2231 (supported_emulation_names): New function.
2232 * target-select.h (class Target_selector): Add emulation_ field.
2233 Update declarations.
2234 (Target_selector::recognize_by_bfd_name): Rename from
2235 recognize_by_name. Change all callers.
2236 (Target_selector::supported_bfd_names): Rename from
2237 supported_names. Change all callers.
2238 (Target_selector::recognize_by_emulation): New function.
2239 (Target_selector::supported_emulations): New function.
2240 (Target_selector::emulation): New function.
2241 (Target_selector::do_recognize_by_bfd_name): Rename from
2242 do_recognize_by_name. Change all callers.
2243 (Target_selector::do_supported_bfd_names): Rename from
2244 do_supported_names. Change all callers.
2245 (Target_selector::do_recognize_by_emulation): New function.
2246 (Target_selector::do_supported_emulations): New function.
2247 (select_target_by_bfd_name): Change name in declaration.
2248 (select_target_by_emulation): Declare.
2249 (supported_emulation_names): Declare.
2250 * parameters.cc (parameters_force_valid_target): Try to find
2251 target based on emulation from -m option.
2252 * options.h (class General_options): Change doc string for -m.
2253 * options.cc (help): Print emulations.
2254 (General_options::parse_V): Likewise.
2255 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2256 Add emulation parameter. Change all callers.
2258 2011-06-28 Ian Lance Taylor <iant@google.com>
2260 * target.h (class Target): Add osabi_ field.
2261 (Target::osabi): New function.
2262 (Target::set_osabi): New function.
2263 (Target::Target): Initialize osabi_.
2264 (Target::do_adjust_elf_header): Make pure virtual.
2265 (Sized_target::do_adjust_elf_header): Declare.
2266 * target.cc (Sized_target::do_adjust_elf_header): New function.
2267 (class Sized_target): Instantiate all versions.
2268 * freebsd.h (class Target_freebsd): Remove.
2269 (Target_selector_freebsd::do_recognize): Call set_osabi on
2271 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2272 (Target_selector_freebsd::set_osabi): Remove.
2273 * i386.cc (class Target_i386): Inherit from Sized_target rather
2274 than Target_freebsd.
2275 * x86_64.cc (class Target_x86_64): Likewise.
2277 2011-06-28 Ian Lance Taylor <iant@google.com>
2279 * target.h (Target::can_check_for_function_pointers): Rewrite.
2281 (Target::can_icf_inline_merge_sections): Likewise.
2282 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2283 (Target::Target_info): Add can_icf_inline_merge_sections field.
2284 (Target::do_can_check_for_function_pointers): New virtual
2286 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2287 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2288 from can_check_for_function_pointers, move in file.
2289 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2290 section_may_have_icf_unsafe_poineters, move in file.
2291 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2292 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2293 Rename from can_check_for_function_pointers, move in file.
2294 (Target_i386::can_icf_inline_merge_sections): Remove.
2295 (Target_i386::i386_info): Initialize
2296 can_icf_inline_merge_sections.
2297 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2298 Initialize can_icf_inline_merge_sections.
2299 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2300 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2301 Rename from can_check_for_function_pointers, move in file.
2302 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2303 (Target_x86_64::x86_64_info): Initialize
2304 can_icf_inline_merge_sections.
2305 * testsuite/testfile.cc (Target_test::test_target_info):
2307 * icf.cc (get_section_contents): Correct formatting.
2309 2011-06-27 Ian Lance Taylor <iant@google.com>
2311 * symtab.cc (Symbol::versioned_name): New function.
2312 (Symbol_table::add_to_final_symtab): Use versioned_name when
2314 (Symbol_table::sized_write_symbol): Likewise.
2315 * symtab.h (class Symbol): Declare versioned_name.
2316 * stringpool.h (class Stringpool_template): Add variant of add
2317 which takes a std::basic_string.
2318 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2319 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2320 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2321 (ver_test_12.o): New target.
2322 * testsuite/Makefile.in: Rebuild.
2324 2011-06-27 Doug Kwan <dougkwan@google.com>
2326 * arm.cc (Arm_relocate_functions::thm_jump8,
2327 Arm_relocate_functions::thm_jump11): Use a wider signed
2328 type to compute offset.
2329 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2331 * testsuite/Makefile.in: Regenerate.
2332 * testsuite/arm_branch_in_range.sh: Check test results of
2333 arm_thm_jump11 and arm_thm_jump8.
2334 * testsuite/arm_thm_jump11.s: New test source file.
2335 * testsuite/arm_thm_jump11.t: New linker script.
2336 * testsuite/arm_thm_jump8.s: New test source file.
2337 * testsuite/arm_thm_jump8.t: New linker script.
2339 2011-06-24 Ian Lance Taylor <iant@google.com>
2341 * layout.cc: Include "object.h".
2342 (ctors_sections_in_init_array): New static variable.
2343 (Layout::is_ctors_in_init_array): New function.
2344 (Layout::layout): Add entry to ctors_sections_in_init_array if
2346 * layout.h (class Layout): Declare is_ctors_in_init_array.
2347 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2348 is_ctors_reverse_view is set.
2349 (Sized_relobj_file::write_sections): Add layout parameter. Change
2350 all callers. Set is_ctors_reverse_view field of View_size.
2351 (Sized_relobj_file::reverse_words): New function.
2352 * object.h (Sized_relobj_file::View_size): Add
2353 is_ctors_reverse_view field.
2354 (class Sized_relobj_file): Update declarations.
2355 * testsuite/initpri3.c: New test.
2356 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2358 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2359 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2360 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2361 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2362 * testsuite/Makefile.in: Rebuild.
2364 2011-06-24 Cary Coutant <ccoutant@google.com>
2366 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2367 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2368 (debug_msg_cdebug.err): New targets.
2369 * testsuite/Makefile.in: Regenerate.
2370 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2371 Fix checks for link with shared library.
2373 2011-06-24 Doug Kwan <dougkwan@google.com>
2375 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2376 skip empty text sections.
2377 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2379 2011-06-22 Ian Lance Taylor <iant@google.com>
2382 * options.h (class General_options): Add --ctors-in-init-array.
2383 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2384 friends as SHT_PROGBITS for merging sections.
2385 (Layout::layout): Remove special handling of .init_array and
2386 friends. Don't sort if doing relocatable link. Sort for .ctors
2387 and .dtors if ctors_in_init_array.
2388 (Layout::make_output_section): Force correct section types for
2389 .init_array and friends. Don't sort if doing relocatable link,
2390 Don't sort .ctors and .dtors if ctors_in_init_array.
2391 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2392 (Layout::output_section_name): Add relobj parameter. Change all
2393 callers. Handle .ctors. and .dtors. in code rather than table.
2394 Handle .ctors and .dtors if ctors_in_init_array.
2395 (Layout::match_file_name): New function, moved from output.cc.
2396 * layout.h (class Layout): Update declarations.
2397 * output.cc: Include "layout.h".
2398 (Input_section_sort_entry::get_priority): New function.
2399 (Input_section_sort_entry::match_file_name): Just call
2400 Layout::match_file_name.
2401 (Output_section::Input_section_sort_init_fini_compare::operator()):
2402 Handle .ctors and .dtors. Sort by explicit priority rather than
2404 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2405 * testsuite/initpri2.c: New test.
2406 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2407 (check_PROGRAMS): Add initpri2.
2408 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2409 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2410 * configure, testsuite/Makefile.in: Rebuild.
2412 2011-06-19 Ian Lance Taylor <iant@google.com>
2415 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2416 .interp section to a PT_INTERP segment even if we have seen a
2417 --dynamic-linker option. Don't do it if we have seen a PHDRS
2418 clause in a linker script.
2419 (Layout::finalize): Don't create a .interp section if we've
2420 already create a PT_INTERP segment.
2421 (Layout::create_interp): Always call choose_output_section (revert
2422 patch of 2011-06-17). Don't create PT_INTERP segment.
2423 * script-sections.cc
2424 (Script_sections::create_note_and_tls_segments): Add a .interp
2425 section to a PT_INTERP segment even if we have seen a
2426 --dynamic-linker option.
2428 2011-06-18 Ian Lance Taylor <iant@google.com>
2430 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2431 merely because a non-PT_LOAD segment has a dynamic reloc.
2433 2011-06-18 Ian Lance Taylor <iant@google.com>
2435 * layout.cc (Layout::finish_dynamic_section): Don't create
2436 DT_FLAGS entry if not needed.
2438 2011-06-18 Ian Lance Taylor <iant@google.com>
2441 * layout.cc (Layout::layout_eh_frame): Correct handling of
2442 writable .eh_frame section.
2444 2011-06-17 Ian Lance Taylor <iant@google.com>
2447 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2448 symbol is redefined with the exact same object and value.
2450 2011-06-17 Ian Lance Taylor <iant@google.com>
2453 * layout.h (class Layout): Add interp_segment_ field.
2454 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2455 (Layout::attach_allocated_section_to_segment): If making shared
2456 library, put .interp section in PT_INTERP segment.
2457 (Layout::finalize): Also call create_interp if -dynamic-linker
2459 (Layout::create_interp): Assert that there is no PT_INTERP
2460 segment. If not using a SECTIONS clause, use make_output_section.
2461 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2462 * script-sections.cc
2463 (Script_sections::create_note_and_tls_segments): If making shared
2464 library, put .interp section in PT_INTERP segment.
2466 2011-06-17 Ian Lance Taylor <iant@google.com>
2468 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2469 when making a shared library.
2471 2011-06-17 Ian Lance Taylor <iant@google.com>
2473 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2474 parameter. Change all callers. Don't issue warning about PC32
2475 against locally defined symbol.
2477 2011-06-16 Ian Lance Taylor <iant@google.com>
2479 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2480 occurs in same object.
2482 2011-06-14 Alan Modra <amodra@gmail.com>
2484 * po/POTFILES.in: Regenerate.
2486 2011-06-09 Ian Lance Taylor <iant@google.com>
2488 * script-sections.cc
2489 (Orphan_output_section::set_section_addresses): For a relocatable
2490 link set address to 0.
2492 2011-06-09 Cary Coutant <ccoutant@google.com>
2495 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2496 used with --compress-debug-sections.
2497 * gold/object.cc (Sized_relobj_file::do_layout): Report
2498 uncompressed size of compressed input sections.
2500 2011-06-08 Cary Coutant <ccoutant@google.com>
2503 * testsuite/two_file_test_2_v1.cc: Change initialization of
2504 v2 to keep it in .data.
2506 2011-06-07 Cary Coutant <ccoutant@google.com>
2508 * common.cc (Symbol_table::do_allocate_commons_list): Call
2510 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2511 (Errors::fallback): New function.
2512 (gold_fallback): New function.
2513 * errors.h (Errors::fallback): New function.
2514 * gold.cc (gold_exit): Change status parameter to enum; adjust
2516 (queue_initial_tasks): Call gold_fallback.
2517 * gold.h: Include cstdlib.
2518 (Exit_status): New enum type.
2519 (gold_exit): Change status parameter to enum.
2520 (gold_fallback): New function.
2521 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2522 (Layout::create_symtab_sections): Likewise.
2523 (Layout::create_shdrs): Likewise.
2524 * main.cc (main): Adjust call to gold_exit.
2525 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2526 (Output_data_got::add_got_entry_pair): Likewise.
2527 (Output_section::add_input_section): Likewise.
2528 (Output_section::add_output_section_data): Likewise.
2529 (Output_segment::set_section_list_addresses): Likewise.
2530 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2532 2011-06-07 Cary Coutant <ccoutant@google.com>
2534 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2535 for incremental links.
2536 * output.cc (Output_segment::set_section_list_addresses): Remove
2537 FIXME and test for TLS or BSS.
2539 2011-06-07 Cary Coutant <ccoutant@google.com>
2541 * testsuite/Makefile.am: Add incremental_copy_test,
2542 incremental_common_test_1.
2543 * testsuite/Makefile.in: Regenerate.
2544 * testsuite/common_test_1_v1.c: New source file.
2545 * testsuite/common_test_1_v2.c: New source file.
2546 * testsuite/copy_test_v1.cc: New source file.
2548 2011-06-07 Cary Coutant <ccoutant@google.com>
2550 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2551 update, allocate common from bss section's free list.
2552 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2553 linker-defined symbols.
2554 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2555 Skip GOT and PLT entries that are no longer referenced.
2556 (Output_section_incremental_inputs::write_info_blocks): Mark
2557 linker-defined symbols.
2558 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2559 * output.cc (Output_section::allocate): New function.
2560 * output.h (Output_section::allocate): New function.
2561 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2562 linker-defined symbols.
2563 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2564 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2565 (Symbol::init_base_output_data): Likewise.
2566 (Symbol::init_base_output_segment): Likewise.
2567 (Symbol::init_base_constant): Likewise.
2568 (Sized_symbol::init_output_data): Likewise.
2569 (Sized_symbol::init_output_segment): Likewise.
2570 (Sized_symbol::init_constant): Likewise.
2571 (Symbol_table::do_define_in_output_data): Likewise.
2572 (Symbol_table::do_define_in_output_segment): Likewise.
2573 (Symbol_table::do_define_as_constant): Likewise.
2574 * symtab.h (Symbol::is_predefined): New function.
2575 (Symbol::init_base_output_data): Add is_predefined parameter.
2576 (Symbol::init_base_output_segment): Likewise.
2577 (Symbol::init_base_constant): Likewise.
2578 (Symbol::is_predefined_): New data member.
2579 (Sized_symbol::init_output_data): Add is_predefined parameter.
2580 (Sized_symbol::init_output_segment): Likewise.
2581 (Sized_symbol::init_constant): Likewise.
2582 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2584 2011-06-07 Cary Coutant <ccoutant@google.com>
2586 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2587 instead of emit_copy_reloc.
2588 (Copy_relocs::emit_copy_reloc): Refactor.
2589 (Copy_relocs::make_copy_reloc): New function.
2590 (Copy_relocs::add_copy_reloc): Remove.
2591 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2593 (Copy_relocs::make_copy_reloc): New function.
2594 (Copy_relocs::add_copy_reloc): Remove.
2595 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2596 unchanged input files.
2597 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2598 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2599 Reserve BSS space for COPY relocations.
2600 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2601 (Output_section_incremental_inputs::write_info_blocks): Record
2602 whether a symbol is copied from a shared object.
2603 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2604 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2605 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2606 (Incremental_input_entry_reader::get_output_symbol_index): Add
2608 (Incremental_binary::emit_copy_relocs): New function.
2609 (Incremental_binary::do_emit_copy_relocs): New function.
2610 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2612 (Sized_incremental_binary::add_copy_reloc): New function.
2613 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2614 (Sized_incremental_binary::Copy_reloc): New struct.
2615 (Sized_incremental_binary::Copy_relocs): New typedef.
2616 (Sized_incremental_binary::copy_relocs_): New data member.
2617 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2618 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2619 * target.h (Sized_target::emit_copy_reloc): New function.
2620 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2622 2011-06-02 Cary Coutant <ccoutant@google.com>
2625 * gold/archive.cc (Archive::Archive): Initialize new data member.
2626 (Archive::include_all_members): Return if archive has already been
2628 * gold/archive.h (Archive::include_all_members_): New data member.
2630 2011-06-02 Nick Clifton <nickc@redhat.com>
2632 * dynobj.h: Fix spelling mistake in comment.
2633 * output.cc: Likewise.
2635 2011-05-31 Doug Kwan <dougkwan@google.com>
2639 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2640 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2641 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2642 redundant arm_exidx_test.so.
2643 * testsuite/Makefile.in: Regenerate.
2644 (check_SCRIPTS): Add pr12826.sh
2645 (check_DATA): Add pr12826.stdout
2646 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2647 * testsuite/pr12826.sh: New file.
2648 * testsuite/pr12826_1.s: Ditto.
2649 * testsuite/pr12826_1.s: Ditto.
2651 2011-05-30 Ian Lance Taylor <iant@google.com>
2653 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2656 2011-05-29 Ian Lance Taylor <iant@google.com>
2659 * testsuite/Makefile.am: Use different file name for two_file_test
2660 temporary file for each incremental test.
2661 * testsuite/Makefile.in: Rebuild.
2663 2011-05-29 Ian Lance Taylor <iant@google.com>
2665 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2666 binary input file is empty.
2668 2011-05-27 Ian Lance Taylor <iant@google.com>
2670 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2671 (ver_test_9.so): Likewise.
2672 * testsuite/Makefile.in: Rebuild.
2674 2011-05-26 Cary Coutant <ccoutant@google.com>
2676 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2677 * incremental.cc (Incremental_inputs::report_input_section): Fix
2678 comment, indentation.
2679 (Incremental_inputs::report_comdat_group): New function.
2680 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2681 of data for incremental input file entry.
2682 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2683 group count, COMDAT group signatures.
2684 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2685 an unchanged input file.
2686 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2687 Initialize new data member.
2688 (Incremental_object_entry::add_comdat_group): New function.
2689 (Incremental_object_entry::get_comdat_group_count): New function.
2690 (Incremental_object_entry::get_comdat_signature_key): New function.
2691 (Incremental_object_entry::groups_): New data member.
2692 (Incremental_inputs::report_comdat_group): New function.
2693 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2694 data for incremental input file entry.
2695 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2696 (Incremental_input_entry_reader::get_input_section): Adjust size of
2697 data for incremental input file entry.
2698 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2699 (Incremental_input_entry_reader::get_comdat_group_signature): New
2701 * object.cc (Sized_relobj::include_section_group): Report kept
2702 COMDAT groups for incremental links.
2704 2011-05-24 David Meyer <pdox@google.com>
2706 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2707 with name parameter. Add found_name parameter.
2708 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2709 * dirsearch.h (class Dirsearch): Update declaration.
2711 2011-05-24 Ian Lance Taylor <iant@google.com>
2713 * archive.cc (Library_base::should_include_member): Pull in object
2714 from archive if it defines the entry symbol.
2715 * parameters.cc (Parameters::entry): New function.
2716 * parameters.h (class Parameters): Declare entry.
2717 * output.h (class Output_file_header): Remove entry_ field.
2718 * output.cc (Output_file_header::Output_file_header): Remove entry
2719 parameter. Change all callers.
2720 (Output_file_header::entry): Use parameters->entry.
2721 * gold.cc (queue_middle_tasks): Likewise.
2722 * plugin.cc (Plugin_hook::run): Likewise.
2724 2011-05-24 Cary Coutant <ccoutant@google.com>
2726 * gold.cc (queue_initial_tasks): Pass incremental base filename
2727 to Output_file::open_base_file; don't print error message.
2728 * incremental-dump.cc (main): Adjust call to
2729 Output_file::open_for_modification.
2730 * incremental-dump.cc (main): Likewise.
2731 * incremental.cc (Incremental_inputs::report_command_line):
2732 Ignore --incremental-base option when comparing command lines.
2733 Ignore parameter when given as separate argument.
2734 * options.h (class General_options): Add --incremental-base.
2735 * output.cc (Output_file::Output_file):
2736 (Output_file::open_base_file): Add base_name and writable parameters;
2737 read base file into new file; print error message here.
2738 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2740 * output.h (Output_file::open_for_modification): Rename to...
2741 (Output_file::open_base_file): ...this; add base_name and
2742 writable parameters; adjust all callers.
2743 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2745 * testsuite/Makefile.am (incremental_test_4): Test
2747 * testsuite/Makefile.in: Regenerate.
2749 2011-05-24 Cary Coutant <ccoutant@google.com>
2751 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2753 * testsuite/Makefile.in: Regenerate.
2754 * testsuite/two_file_test_1_v1.cc: New test source file.
2755 * testsuite/two_file_test_1b_v1.cc: New test source file.
2756 * testsuite/two_file_test_2_v1.cc: New test source file.
2758 2011-05-24 Cary Coutant <ccoutant@google.com>
2760 * dynobj.h (Dynobj::do_dynobj): New function.
2761 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2762 flag and soname for shared objects.
2763 * incremental.cc (Incremental_inputs::report_object): Make
2764 either Incremental_object_entry or Incremental_dynobj_entry; add
2765 soname to string table.
2766 (Incremental_inputs::report_input_section): Add assertion.
2767 (Output_section_incremental_inputs::set_final_data_size): Adjust
2768 type of input file entry for shared libraries; adjust size of
2769 shared library info entry.
2770 (Output_section_incremental_inputs::write_input_files): Write
2771 as_needed flag for shared libraries.
2772 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2773 of input file entry for shared libraries; write soname.
2774 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2775 soname from incremental info.
2776 * incremental.h (enum Incremental_input_flags): Add
2777 INCREMENTAL_INPUT_AS_NEEDED.
2778 (Incremental_input_entry::Incremental_input_entry): Initialize new
2780 (Incremental_input_entry::set_as_needed): New function.
2781 (Incremental_input_entry::as_needed): New function.
2782 (Incremental_input_entry::do_dynobj_entry): New function.
2783 (Incremental_input_entry::as_needed_): New data member.
2784 (Incremental_object_entry::Incremental_object_entry): Don't check
2786 (Incremental_object_entry::do_type): Likewise.
2787 (class Incremental_dynobj_entry): New class.
2788 (Incremental_input_entry_reader::as_needed): New function.
2789 (Incremental_input_entry_reader::get_soname): New function.
2790 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2791 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2792 size of shared library info entry.
2793 * layout.cc (Layout::finish_dynamic_section): Don't test for
2794 incremental link when adding DT_NEEDED entries.
2795 * object.h (Object::Object): Initialize new data member.
2796 (Object::dynobj): New function.
2797 (Object::set_as_needed): New function.
2798 (Object::as_needed): New function.
2799 (Object::do_dynobj): New function.
2800 (Object::as_needed_): New data member.
2802 2011-05-24 Cary Coutant <ccoutant@google.com>
2804 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2805 info; adjust display of GOT entries.
2806 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2807 vector of input objects; remove file_status_.
2808 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2809 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2810 got_plt reader; call target hooks to reserve GOT entries.
2811 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2812 of input file info header and GOT info entry.
2813 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2815 (Got_plt_view_info::got_descriptor): Remove.
2816 (Got_plt_view_info::sym_index): New data member.
2817 (Got_plt_view_info::input_index): New data member.
2818 (Local_got_offset_visitor::visit): Write input file index.
2819 (Global_got_offset_visitor::visit): Write 0 for input file index.
2820 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2821 with sym_index and input_index.
2822 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2823 incremental info GOT entry; replace got_descriptor with input_index.
2824 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2825 map from input file index to object.
2826 (Sized_relobj_incr::do_layout): Replace direct data member reference
2827 with accessor function.
2828 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2829 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2830 Adjust size of input file info header.
2831 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2832 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2833 (Incremental_input_entry_reader::get_input_section): Adjust size of
2834 input file info header.
2835 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2836 of incremental info GOT entry.
2837 (Incremental_got_plt_reader::get_got_desc): Remove.
2838 (Incremental_got_plt_reader::get_got_symndx): New function.
2839 (Incremental_got_plt_reader::get_got_input_index): New function.
2840 (Sized_incremental_binary::Sized_incremental_binary): Remove
2841 file_status_; add input_objects_.
2842 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2843 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2844 (Sized_incremental_binary::file_is_unchanged): Remove.
2845 (Sized_incremental_binary::set_input_object): New function.
2846 (Sized_incremental_binary::input_object): New function.
2847 (Sized_incremental_binary::file_status_): Remove.
2848 (Sized_incremental_binary::input_objects_): New data member.
2849 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2851 (Sized_relobj_incr::invalid_address): Move to base class.
2852 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2854 (Sized_relobj_incr::do_output_section_offset): Likewise.
2855 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2856 (Sized_relobj_incr::section_offsets_): Likewise.
2857 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2859 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2860 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2861 with accessor function.
2862 (Sized_relobj_file::do_layout): Likewise.
2863 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2864 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2865 (Sized_relobj_file::compute_final_local_value): Replace refs to
2866 section_offsets_ with accessor function.
2867 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2868 * object.h (Relobj::Relobj): Initialize new data members.
2869 (Relobj::add_dyn_reloc): New function.
2870 (Relobj::first_dyn_reloc): New function.
2871 (Relobj::dyn_reloc_count): New function.
2872 (Relobj::first_dyn_reloc_): New data member.
2873 (Relobj::dyn_reloc_count_): New data member.
2874 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2876 (Sized_relobj::Address): New typedef.
2877 (Sized_relobj::invalid_address): Move here from child class.
2878 (Sized_relobj::Sized_relobj): Initialize new data members.
2879 (Sized_relobj::sized_relobj): New function.
2880 (Sized_relobj::is_output_section_offset_invalid): Move here from
2882 (Sized_relobj::get_output_section_offset): Likewise.
2883 (Sized_relobj::local_has_got_offset): Likewise.
2884 (Sized_relobj::local_got_offset): Likewise.
2885 (Sized_relobj::set_local_got_offset): Likewise.
2886 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2887 (Sized_relobj::clear_got_offsets): New function.
2888 (Sized_relobj::section_offsets): Move here from child class.
2889 (Sized_relobj::do_output_section_offset): Likewise.
2890 (Sized_relobj::do_set_section_offset): Likewise.
2891 (Sized_relobj::Local_got_offsets): Likewise.
2892 (Sized_relobj::local_got_offsets_): Likewise.
2893 (Sized_relobj::section_offsets_): Likewise.
2894 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2896 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2898 (Sized_relobj_file::sized_relobj): New function
2899 (Sized_relobj_file::local_has_got_offset): Move to base class.
2900 (Sized_relobj_file::local_got_offset): Likewise.
2901 (Sized_relobj_file::set_local_got_offset): Likewise.
2902 (Sized_relobj_file::get_output_section_offset): Likewise.
2903 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2904 (Sized_relobj_file::do_output_section_offset): Likewise.
2905 (Sized_relobj_file::do_set_section_offset): Likewise.
2906 (Sized_relobj_file::Local_got_offsets): Likewise.
2907 (Sized_relobj_file::local_got_offsets_): Likewise.
2908 (Sized_relobj_file::section_offsets_): Likewise.
2909 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2911 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2912 (Output_reloc::get_symbol_index): Likewise.
2913 (Output_reloc::local_section_offset): Likewise.
2914 (Output_reloc::get_address): Likewise.
2915 (Output_reloc::symbol_value): Likewise.
2916 (Output_data_got::reserve_slot): Move to class definition.
2917 (Output_data_got::reserve_local): New function.
2918 (Output_data_got::reserve_slot_for_global): Remove.
2919 (Output_data_got::reserve_global): New function.
2920 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2921 (all constructors, two instantiations).
2922 (Output_reloc::get_relobj): New function (two instantiations).
2923 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2924 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2925 (Output_data_reloc::add_global): Adjust type of relobj.
2926 (Output_data_reloc::add_global_relative): Likewise.
2927 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2928 (Output_data_reloc::add_local): Likewise.
2929 (Output_data_reloc::add_local_relative): Likewise.
2930 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2931 (Output_data_reloc::add_local_section): Likewise.
2932 (Output_data_reloc::add_output_section): Likewise.
2933 (Output_data_reloc::add_absolute): Likewise.
2934 (Output_data_reloc::add_target_specific): Likewise.
2935 (Output_data_got::reserve_slot): Move definition here.
2936 (Output_data_got::reserve_local): New function.
2937 (Output_data_got::reserve_global): New function.
2938 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2939 section_offsets_ with accessor function.
2940 (Sized_relobj_file::write_sections): Likewise.
2941 (Sized_relobj_file::do_relocate_sections): Likewise.
2942 * target.h (Sized_target::reserve_local_got_entry): New function.
2943 (Sized_target::reserve_global_got_entry): New function.
2944 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2945 (Target_x86_64::reserve_global_got_entry): New function.
2946 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2948 2011-05-23 Cary Coutant <ccoutant@google.com>
2950 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2951 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2952 bit when checking got_type.
2953 * incremental.cc (Sized_incremental_binary::setup_readers):
2954 Store symbol table and string table locations; initialize bit vector
2955 of file status flags.
2956 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2958 (Sized_incremental_binary::do_process_got_plt): New function.
2959 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2960 (Output_section_incremental_inputs::set_final_data_size): Record
2961 file index for each input file.
2962 (Output_section_incremental_inputs::write_got_plt): Store file index
2963 instead of input entry offset for each GOT entry.
2965 (Incremental_input_entry::Incremental_input_entry): Initialize new
2967 (Incremental_input_entry::set_offset): Store file index.
2968 (Incremental_input_entry::get_file_index): New function.
2969 (Incremental_input_entry::file_index_): New data member.
2970 (Incremental_binary::process_got_plt): New function.
2971 (Incremental_binary::do_process_got_plt): New function.
2972 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2974 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2975 (Sized_incremental_binary::set_file_is_unchanged): New function.
2976 (Sized_incremental_binary::file_is_unchanged): New function.
2977 (Sized_incremental_binary::do_process_got_plt): New function.
2978 (Sized_incremental_binary::file_status_): New data member.
2979 (Sized_incremental_binary::main_symtab_loc_): New data member.
2980 (Sized_incremental_binary::main_strtab_loc_): New data member.
2981 * output.cc (Output_data_got::Got_entry::write): Add case
2983 (Output_data_got::add_global): Call add_got_entry.
2984 (Output_data_got::add_global_plt): Likewise.
2985 (Output_data_got::add_global_with_rel): Likewise.
2986 (Output_data_got::add_global_with_rela): Likewise.
2987 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2988 (Output_data_got::add_global_pair_with_rela): Likewise.
2989 (Output_data_got::add_local): Call add_got_entry.
2990 (Output_data_got::add_local_plt): Likewise.
2991 (Output_data_got::add_local_with_rel): Likewise.
2992 (Output_data_got::add_local_with_rela): Likewise.
2993 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2994 (Output_data_got::add_local_pair_with_rela): Likewise.
2995 (Output_data_got::reserve_slot): New function.
2996 (Output_data_got::reserve_slot_for_global): New function.
2997 (Output_data_got::add_got_entry): New function.
2998 (Output_data_got::add_got_entry_pair): New function.
2999 (Output_section::add_output_section_data): Edit FIXME.
3001 (Output_section_data_build::Output_section_data_build): New
3002 constructor with size parameter.
3003 (Output_data_space::Output_data_space): Likewise.
3004 (Output_data_got::Output_data_got): Initialize new data member; new
3005 constructor with size parameter.
3006 (Output_data_got::add_constant): Call add_got_entry.
3007 (Output_data_got::reserve_slot): New function.
3008 (Output_data_got::reserve_slot_for_global): New function.
3009 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3010 (Output_data_got::add_got_entry): New function.
3011 (Output_data_got::add_got_entry_pair): New function.
3012 (Output_data_got::free_list_): New data member.
3013 * target.h (Sized_target::init_got_plt_for_update): New function.
3014 (Sized_target::register_global_plt_entry): New function.
3015 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3016 Initialize new data member; call init; add constructor with PLT count.
3017 (Output_data_plt_x86_64::init): New function.
3018 (Output_data_plt_x86_64::add_relocation): New function.
3019 (Output_data_plt_x86_64::reserve_slot): New function.
3020 (Output_data_plt_x86_64::free_list_): New data member.
3021 (Target_x86_64::init_got_plt_for_update): New function.
3022 (Target_x86_64::register_global_plt_entry): New function.
3023 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3024 incremental updates.
3025 (Output_data_plt_x86_64::add_relocation): New function.
3026 * testsuite/object_unittest.cc (Object_test): Set default options.
3028 2011-05-16 Ian Lance Taylor <iant@google.com>
3030 * options.h (class General_options): Make -i a synonym for -r.
3032 2011-05-16 Ian Lance Taylor <iant@google.com>
3034 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3036 2011-05-10 Cary Coutant <ccoutant@google.com>
3038 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3041 2011-05-06 Ian Lance Taylor <iant@google.com>
3043 * layout.cc (Layout::layout): If the output section flags change,
3044 update the ordering.
3046 2011-04-25 Cary Coutant <ccoutant@google.com>
3048 * incremental-dump.cc (dump_incremental_inputs): Print local
3049 symbol info for each input file.
3051 (Output_section_incremental_inputs::set_final_data_size): Add local
3052 symbol info to input file entries in incremental info.
3053 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3054 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3055 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3056 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3058 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3059 (Sized_incr_relobj::do_relocate): Write the local symbols.
3060 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3061 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3062 Adjust size of input file header.
3063 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3064 (Incremental_inputs_reader::get_local_symbol_count): New function.
3065 (Incremental_inputs_reader::get_input_section): Adjust size of input
3067 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3068 (Sized_incr_relobj::This): New typedef.
3069 (Sized_incr_relobj::sym_size): New const data member.
3070 (Sized_incr_relobj::Local_symbol): New struct.
3071 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3072 (Sized_incr_relobj::do_local_symbol_offset): New function.
3073 (Sized_incr_relobj::local_symbol_count_): New data member.
3074 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3075 (Sized_incr_relobj::local_symbol_index_): New data member.
3076 (Sized_incr_relobj::local_symbol_offset_): New data member.
3077 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3078 (Sized_incr_relobj::local_symbols_): New data member.
3079 * object.h (Relobj::output_local_symbol_count): New function.
3080 (Relobj::local_symbol_offset): New function.
3081 (Relobj::do_output_local_symbol_count): New function.
3082 (Relobj::do_local_symbol_offset): New function.
3083 (Sized_relobj::do_output_local_symbol_count): New function.
3084 (Sized_relobj::do_local_symbol_offset): New function.
3086 2011-04-22 Vladimir Simonov <sv@sw.ru>
3088 * descriptors.cc (set_close_on_exec): New function.
3089 (Descriptors::open): Use set_close_on_exec.
3090 * output.cc (S_ISLNK): Define if not defined.
3092 2011-04-22 Cary Coutant <ccoutant@google.com>
3094 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3096 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3097 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3098 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3100 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3101 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3102 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3104 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3106 (Incremental_binary::apply_incremental_relocs): New function.
3107 (Incremental_binary::do_apply_incremental_relocs): New function.
3108 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3110 (Sized_incremental_binary::add_global_symbol): New function.
3111 (Sized_incremental_binary::global_symbol): New function.
3112 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3113 (Sized_incremental_binary::symbol_map_): New data member.
3114 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3115 * target.h (Sized_target::apply_relocation): New function.
3116 * target-reloc.h (apply_relocation): New function.
3117 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3119 2011-04-22 Doug Kwan <dougkwan@google.com>
3121 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3122 flag of a SHT_ARM_EXIDX section.
3123 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3124 * testsuite/Makefile.in: Regenerate.
3125 * testsuite/arm_exidx_test.s: New file.
3126 * testsuite/arm_exidx_test.sh: Same.
3128 2011-04-20 Cary Coutant <ccoutant@google.com>
3131 * archive.h (Incremental_archive_entry::Archive_member):
3132 Initialize arg_serial_ (second constructor).
3134 2011-04-17 Ian Lance Taylor <iant@google.com>
3136 * object.cc (Relocate_info::location): Simplify location string.
3137 * errors.cc (Errors::error_at_location): Don't print program
3139 (Errors::warning_at_location): Likewise.
3140 (Errors::undefined_symbol): Likewise.
3141 * testsuite/debug_msg.sh: Update accordingly.
3143 2011-04-14 Cary Coutant <ccoutant@google.com>
3145 * gold/layout.cc (Layout::symtab_section_offset): New function.
3146 * gold/layout.h (Layout::symtab_section_offset): New function.
3147 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3149 2011-04-12 Ian Lance Taylor <iant@google.com>
3151 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3152 with MREMAP_MAYMOVE.
3153 * output.h (class Output_file): Add map_is_allocated_ field.
3154 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3155 not available, provide stubs. If mremap is not available, #define
3157 (MREMAP_MAYMOVE): Define if not defined.
3158 (Output_file::Output_file): Initialize map_is_allocated_.
3159 (Output_file::resize): Check map_is_allocated_.
3160 (Output_file::map_anonymous): If mmap fails, use malloc.
3161 (Output_file::unmap): Don't do anything for an anonymous map.
3162 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3163 is not available, provide stubs.
3164 (File_read::View::~View): Use free rather than delete[].
3165 (File_read::make_view): Use malloc rather than new[]. If mmap
3167 (File_read::find_or_make_view): Use malloc rather than new[].
3168 * gold.h: Remove HAVE_REMAP code.
3169 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3170 exists. Rename mremap to gold_mremap. If mmap is not available
3172 * configure, config.in: Rebuild.
3174 2011-04-11 Ian Lance Taylor <iant@google.com>
3176 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3177 initialize local variable v.
3179 2011-04-11 Cary Coutant <ccoutant@google.com>
3181 * archive.cc (Archive::include_member): Adjust call to
3183 (Add_archive_symbols::run): Track argument serial numbers.
3184 (Lib_group::include_member): Likewise.
3185 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3186 * archive.h (Incremental_archive_entry::Archive_member):
3187 Initialize arg_serial_.
3188 (Archive_member::arg_serial_): New data member.
3189 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3190 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3192 (Sized_dynobj::do_for_all_local_got_entries): New function.
3193 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3195 * fileread.cc (get_mtime): New function.
3196 * fileread.h (get_mtime): New function.
3197 * gold.cc (queue_initial_tasks): Check for incremental update.
3198 (process_incremental_input): New function.
3199 (queue_middle_tasks): Don't force valid target for incremental
3201 * incremental-dump.cc (find_input_containing_global): Adjust
3202 size of symbol info entry.
3203 (dump_incremental_inputs): Dump argument serial number and
3204 in_system_directory flag; bias shndx by 1; print symbol names
3205 when dumping per-file symbol lists; use new symbol info readers.
3207 (Output_section_incremental_inputs:update_data_size): New function.
3208 (Sized_incremental_binary::setup_readers): Setup input readers
3209 for each input file; build maps for files added from libraries
3211 (Sized_incremental_binary::check_input_args): New function.
3212 (Sized_incremental_binary::do_check_inputs): Build map of argument
3213 serial numbers to input arguments.
3214 (Sized_incremental_binary::do_file_has_changed): Rename
3215 do_file_is_unchanged to this; compare file modification times.
3216 (Sized_incremental_binary::do_init_layout): New function.
3217 (Sized_incremental_binary::do_reserve_layout): New function.
3218 (Sized_incremental_binary::do_get_input_reader): Remove.
3219 (Sized_incremental_binary::get_symtab_view): New function.
3220 (Incremental_checker::can_incrementally_link_output_file): Remove.
3221 (Incremental_inputs::report_command_line): Exclude --debug options.
3222 (Incremental_inputs::report_archive_begin): Add parameter; track
3223 argument serial numbers; don't put input file entry for archive
3224 before archive members.
3225 (Incremental_inputs::report_archive_end): Put input file entry
3226 for archive after archive members.
3227 (Incremental_inputs::report_object): Add parameter; track argument
3228 serial numbers and in_system_directory flag.
3229 (Incremental_inputs::report_script): Add parameter; track argument
3231 (Output_section_incremental_inputs::set_final_data_size): Adjust
3232 size of symbol info entry; check for forwarding symbols.
3233 (Output_section_incremental_inputs::write_input_files): Write
3234 in_system_directory flag and argument serial number.
3235 (Output_section_incremental_inputs::write_info_blocks): Map section
3236 indices between incremental info and original input file; store
3237 input section index for each symbol.
3238 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3239 change operator() to visit().
3240 (class Global_got_offset_visitor): Likewise.
3241 (class Global_symbol_visitor_got_plt):
3242 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3244 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3245 (Sized_incr_relobj::do_read_symbols): New function.
3246 (Sized_incr_relobj::do_layout): New function.
3247 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3248 (Sized_incr_relobj::do_add_symbols): New function.
3249 (Sized_incr_relobj::do_should_include_member): New function.
3250 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3251 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3252 (Sized_incr_relobj::do_section_size): New function.
3253 (Sized_incr_relobj::do_section_name): New function.
3254 (Sized_incr_relobj::do_section_contents): New function.
3255 (Sized_incr_relobj::do_section_flags): New function.
3256 (Sized_incr_relobj::do_section_entsize): New function.
3257 (Sized_incr_relobj::do_section_address): New function.
3258 (Sized_incr_relobj::do_section_type): New function.
3259 (Sized_incr_relobj::do_section_link): New function.
3260 (Sized_incr_relobj::do_section_info): New function.
3261 (Sized_incr_relobj::do_section_addralign): New function.
3262 (Sized_incr_relobj::do_initialize_xindex): New function.
3263 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3264 (Sized_incr_relobj::do_read_relocs): New function.
3265 (Sized_incr_relobj::do_gc_process_relocs): New function.
3266 (Sized_incr_relobj::do_scan_relocs): New function.
3267 (Sized_incr_relobj::do_count_local_symbols): New function.
3268 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3269 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3270 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3271 (Sized_incr_relobj::do_relocate): New function.
3272 (Sized_incr_relobj::do_set_section_offset): New function.
3273 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3274 (Sized_incr_dynobj::do_read_symbols): New function.
3275 (Sized_incr_dynobj::do_layout): New function.
3276 (Sized_incr_dynobj::do_add_symbols): New function.
3277 (Sized_incr_dynobj::do_should_include_member): New function.
3278 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3279 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3280 (Sized_incr_dynobj::do_section_size): New function.
3281 (Sized_incr_dynobj::do_section_name): New function.
3282 (Sized_incr_dynobj::do_section_contents): New function.
3283 (Sized_incr_dynobj::do_section_flags): New function.
3284 (Sized_incr_dynobj::do_section_entsize): New function.
3285 (Sized_incr_dynobj::do_section_address): New function.
3286 (Sized_incr_dynobj::do_section_type): New function.
3287 (Sized_incr_dynobj::do_section_link): New function.
3288 (Sized_incr_dynobj::do_section_info): New function.
3289 (Sized_incr_dynobj::do_section_addralign): New function.
3290 (Sized_incr_dynobj::do_initialize_xindex): New function.
3291 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3292 (make_sized_incremental_object): New function.
3293 (Incremental_library::copy_unused_symbols): New function.
3294 (Incremental_library::do_for_all_unused_symbols): New function.
3295 * incremental.h (enum Incremental_input_flags): New type.
3296 (class Incremental_checker): Remove.
3297 (Incremental_input_entry::Incremental_input_entry): Add argument
3299 (Incremental_input_entry::arg_serial): New function.
3300 (Incremental_input_entry::set_is_in_system_directory): New function.
3301 (Incremental_input_entry::is_in_system_directory): New function.
3302 (Incremental_input_entry::arg_serial_): New data member.
3303 (Incremental_input_entry::is_in_system_directory_): New data member.
3304 (class Script_info): Move here from script.h.
3305 (Script_info::Script_info): Add filename parameter.
3306 (Script_info::filename): New function.
3307 (Script_info::filename_): New data member.
3308 (Incremental_script_entry::Incremental_script_entry): Add argument
3310 (Incremental_object_entry::Incremental_object_entry): Likewise.
3311 (Incremental_object_entry::add_input_section): Build list of input
3312 sections with map to original shndx.
3313 (Incremental_object_entry::get_input_section_index): New function.
3314 (Incremental_object_entry::shndx_): New data member.
3315 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3316 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3317 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3319 (Incremental_inputs::report_archive_begin): Likewise.
3320 (Incremental_inputs::report_object): Likewise.
3321 (Incremental_inputs::report_script): Likewise.
3322 (class Incremental_global_symbol_reader): New class.
3323 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3324 and store flags and input file type.
3325 (Incremental_input_entry_reader::arg_serial): New function.
3326 (Incremental_input_entry_reader::type): Extract type from flags.
3327 (Incremental_input_entry_reader::is_in_system_directory): New function.
3328 (Incremental_input_entry_reader::get_input_section_count): Call
3329 accessor function for type.
3330 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3331 function for type; adjust size of global symbol entry.
3332 (Incremental_input_entry_reader::get_global_symbol_count): Call
3333 accessor function for type.
3334 (Incremental_input_entry_reader::get_object_count): Likewise.
3335 (Incremental_input_entry_reader::get_object_offset): Likewise.
3336 (Incremental_input_entry_reader::get_member_count): Likewise.
3337 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3338 (Incremental_input_entry_reader::get_member_offset): Likewise.
3339 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3340 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3341 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3342 (Incremental_input_entry_reader::get_global_symbol_reader): New
3344 (Incremental_input_entry_reader::get_output_symbol_index): New
3346 (Incremental_input_entry_reader::type_): Remove.
3347 (Incremental_input_entry_reader::flags_): New data member.
3348 (Incremental_inputs_reader::input_file_offset): New function.
3349 (Incremental_inputs_reader::input_file_index): New function.
3350 (Incremental_inputs_reader::input_file): Call input_file_offset.
3351 (Incremental_inputs_reader::input_file_at_offset): New function.
3352 (Incremental_relocs_reader::get_r_type): Reformat.
3353 (Incremental_relocs_reader::get_r_shndx): Reformat.
3354 (Incremental_relocs_reader::get_r_offset): Reformat.
3355 (Incremental_relocs_reader::data): New function.
3356 (Incremental_binary::Incremental_binary): Initialize new data members.
3357 (Incremental_binary::check_inputs): Add cmdline parameter.
3358 (Incremental_binary::file_is_unchanged): Remove.
3359 (Input_reader::arg_serial): New function.
3360 (Input_reader::get_unused_symbol_count): New function.
3361 (Input_reader::get_unused_symbol): New function.
3362 (Input_reader::do_arg_serial): New function.
3363 (Input_reader::do_get_unused_symbol_count): New function.
3364 (Input_reader::do_get_unused_symbol): New function.
3365 (Incremental_binary::input_file_count): New function.
3366 (Incremental_binary::get_input_reader): Change signature to use
3367 index instead of filename.
3368 (Incremental_binary::file_has_changed): New function.
3369 (Incremental_binary::get_input_argument): New function.
3370 (Incremental_binary::get_library): New function.
3371 (Incremental_binary::get_script_info): New function.
3372 (Incremental_binary::init_layout): New function.
3373 (Incremental_binary::reserve_layout): New function.
3374 (Incremental_binary::output_file): New function.
3375 (Incremental_binary::do_check_inputs): New function.
3376 (Incremental_binary::do_file_is_unchanged): Remove.
3377 (Incremental_binary::do_file_has_changed): New function.
3378 (Incremental_binary::do_init_layout): New function.
3379 (Incremental_binary::do_reserve_layout): New function.
3380 (Incremental_binary::do_input_file_count): New function.
3381 (Incremental_binary::do_get_input_reader): Change signature.
3382 (Incremental_binary::input_args_map_): New data member.
3383 (Incremental_binary::library_map_): New data member.
3384 (Incremental_binary::script_map_): New data member.
3385 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3387 (Sized_incremental_binary::output_section): New function.
3388 (Sized_incremental_binary::inputs_reader): Add const.
3389 (Sized_incremental_binary::symtab_reader): Add const.
3390 (Sized_incremental_binary::relocs_reader): Add const.
3391 (Sized_incremental_binary::got_plt_reader): Add const.
3392 (Sized_incremental_binary::get_symtab_view): New function.
3393 (Sized_incremental_binary::Inputs_reader): New typedef.
3394 (Sized_incremental_binary::Input_entry_reader): New typedef.
3395 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3396 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3397 (Sized_incremental_binary::do_file_has_changed): New function.
3398 (Sized_incremental_binary::do_init_layout): New function.
3399 (Sized_incremental_binary::do_reserve_layout): New function.
3400 (Sized_input_reader::Inputs_reader): Remove.
3401 (Sized_input_reader::Input_entry_reader): Remove.
3402 (Sized_input_reader::do_arg_serial): New function.
3403 (Sized_input_reader::do_get_unused_symbol_count): New function.
3404 (Sized_input_reader::do_get_unused_symbol): New function.
3405 (Sized_incremental_binary::do_input_file_count): New function.
3406 (Sized_incremental_binary::do_get_input_reader): Change signature;
3407 use index instead of filename.
3408 (Sized_incremental_binary::section_map_): New data member.
3409 (Sized_incremental_binary::input_entry_readers_): New data member.
3410 (class Sized_incr_relobj): New class.
3411 (class Sized_incr_dynobj): New class.
3412 (make_sized_incremental_object): New function.
3413 (class Incremental_library): New class.
3414 * layout.cc (Free_list::num_lists): New static data member.
3415 (Free_list::num_nodes): New static data member.
3416 (Free_list::num_removes): New static data member.
3417 (Free_list::num_remove_visits): New static data member.
3418 (Free_list::num_allocates): New static data member.
3419 (Free_list::num_allocate_visits): New static data member.
3420 (Free_list::init): New function.
3421 (Free_list::remove): New function.
3422 (Free_list::allocate): New function.
3423 (Free_list::dump): New function.
3424 (Free_list::print_stats): New function.
3425 (Layout_task_runner::run): Resize output file for incremental updates.
3426 (Layout::Layout): Initialize new data members.
3427 (Layout::set_incremental_base): New function.
3428 (Layout::init_fixed_output_section): New function.
3429 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3430 incremental updates.
3431 (Layout::create_gold_note): Do not create gold note section for
3432 incremental updates.
3433 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3434 for incremental updates.
3435 (Layout::set_section_offsets): For incremental updates, allocate space
3437 (Layout::create_symtab_sections): Layout with offsets relative to
3438 start of section; for incremental updates, allocate space from free
3440 (Layout::create_shdrs): For incremental updates, allocate space from
3442 (Layout::finish_dynamic_section): For incremental updates, do not
3443 check --as-needed (fixed in subsequent patch).
3444 * layout.h (class Free_list): New class.
3445 (Layout::set_incremental_base): New function.
3446 (Layout::incremental_base): New function.
3447 (Layout::init_fixed_output_section): New function.
3448 (Layout::allocate): New function.
3449 (Layout::incremental_base_): New data member.
3450 (Layout::free_list_): New data member.
3451 * main.cc (main): Print Free_list statistics.
3452 * object.cc (Relobj::finalize_incremental_relocs): Add
3453 clear_counts parameter; clear counts only when clear_counts is set.
3454 (Sized_relobj::Sized_relobj): Initialize new base class.
3455 (Sized_relobj::do_layout): Don't report special sections.
3456 (Sized_relobj::do_for_all_local_got_entries): New function.
3457 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3458 symtab_off to all symbol table offsets.
3459 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3460 * object.h (class Got_offset_list): Move to top of file.
3461 (Object::Object): Allow case where input_file == NULL.
3462 (Object::~Object): Likewise.
3463 (Object::input_file): Assert that input_file != NULL.
3464 (Object::lock): Allow case where input_file == NULL.
3465 (Object::unlock): Likewise.
3466 (Object::is_locked): Likewise.
3467 (Object::token): Likewise.
3468 (Object::release): Likewise.
3469 (Object::is_incremental): New function.
3470 (Object::get_mtime): New function.
3471 (Object::for_all_local_got_entries): New function.
3472 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3473 (Object::set_is_in_system_directory): New function.
3474 (Object::is_in_system_directory): New function.
3475 (Object::do_is_incremental): New function.
3476 (Object::do_get_mtime): New function.
3477 (Object::do_for_all_local_got_entries): New function.
3478 (Object::is_in_system_directory_): New data member.
3479 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3480 (class Sized_relobj_base): New class.
3481 (class Sized_relobj): Derive from Sized_relobj_base.
3482 (class Sized_relobj::Symbols): Redeclare from base class.
3483 (class Sized_relobj::local_got_offset_list): Remove.
3484 (class Sized_relobj::Output_sections): Redeclare from base class.
3485 (class Sized_relobj::do_for_all_local_got_entries): New function.
3486 (class Sized_relobj::write_local_symbols): Add offset parameter.
3487 (class Sized_relobj::local_symbol_offset_): Update comment.
3488 (class Sized_relobj::local_dynsym_offset_): Update comment.
3489 * options.cc (Input_arguments::add_file): Remove const.
3490 * options.h (Input_file_argument::Input_file_argument):
3491 Initialize arg_serial_ (all constructors).
3492 (Input_file_argument::set_arg_serial): New function.
3493 (Input_file_argument::arg_serial): New function.
3494 (Input_file_argument::arg_serial_): New data member.
3495 (Input_arguments::Input_arguments): Initialize file_count_.
3496 (Input_arguments::add_file): Remove const.
3497 (Input_arguments::number_of_input_files): New function.
3498 (Input_arguments::file_count_): New data member.
3499 (Command_line::number_of_input_files): Call
3500 Input_arguments::number_of_input_files.
3501 * output.cc (Output_segment_headers::Output_segment_headers):
3503 (Output_section::Input_section::current_data_size): New function.
3504 (Output_section::Output_section): Initialize new data members.
3505 (Output_section::add_input_section): Don't do merge sections for
3506 an incremental link; allocate space from free list for an
3508 (Output_section::add_output_section_data): Allocate space from
3509 free list for an incremental update.
3510 (Output_section::update_data_size): New function.
3511 (Output_section::set_fixed_layout): New function.
3512 (Output_section::reserve): New function.
3513 (Output_segment::set_section_addresses): Remove const.
3514 (Output_segment::set_section_list_addresses): Remove const; allocate
3515 space from free list for an incremental update.
3516 (Output_segment::set_offset): Adjust size of RELRO segment for an
3518 * output.h (Output_data::current_data_size): Move here from
3520 (Output_data::pre_finalize_data_size): New function.
3521 (Output_data::update_data_size): New function.
3522 (Output_section_headers::update_data_size): new function.
3523 (Output_section_data_build::current_data_size): Move to Output_data.
3524 (Output_data_strtab::update_data_size): New function.
3525 (Output_section::current_data_size): Move to Output_data.
3526 (Output_section::set_fixed_layout): New function.
3527 (Output_section::has_fixed_layout): New function.
3528 (Output_section::reserve): New function.
3529 (Output_section::update_data_size): New function.
3530 (Output_section::has_fixed_layout_): New data member.
3531 (Output_section::free_list_): New data member.
3532 (Output_segment::set_section_addresses): Remove const.
3533 (Output_segment::set_section_list_addresses): Remove const.
3534 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3536 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3538 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3539 parameter when calling Add_symbols constructor; store argument
3540 serial number for members of a lib group.
3541 (Add_symbols::locks): Allow case where token == NULL.
3542 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3543 (Read_member::~Read_member): New function.
3544 (Read_member::is_runnable): New function.
3545 (Read_member::locks): New function.
3546 (Read_member::run): New function.
3547 (Check_script::~Check_script): New function.
3548 (Check_script::is_runnable): New function.
3549 (Check_script::locks): New function.
3550 (Check_script::run): New function.
3551 (Check_library::~Check_library): New function.
3552 (Check_library::is_runnable): New function.
3553 (Check_library::locks): New function.
3554 (Check_library::run): New function.
3555 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3556 (Add_symbols::library_): New data member.
3557 (class Read_member): New class.
3558 (class Check_script): New class.
3559 (class Check_library): New class.
3560 * reloc.cc (Read_relocs::is_runnable): Allow case where
3562 (Read_relocs::locks): Likewise.
3563 (Scan_relocs::locks): Likewise.
3564 (Relocate_task::locks): Likewise.
3565 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3567 (Sized_relobj::incremental_relocs_scan): Fix comment.
3568 (Sized_relobj::do_relocate): Pass output file offset to
3569 write_local_symbols.
3570 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3571 from class declaration.
3572 * script.cc (read_input_script): Allocate Script_info; pass
3573 argument serial number to report_script.
3574 * script.h (class Script_info): Move to incremental.h.
3575 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3576 * symtab.h (Symbol_table::add_from_incrobj): New function.
3577 (Symbol_table::set_file_offset): New function.
3579 2011-04-05 Cary Coutant <ccoutant@google.com>
3581 * incremental-dump.cc (dump_incremental_inputs): Change signature
3582 to take a Sized_incremental_binary; change caller. Use readers
3583 in Sized_incremental_binary.
3585 (Sized_incremental_binary::find_incremental_inputs_sections):
3586 Rename do_find_incremental_inputs_sections to this.
3587 (Sized_incremental_binary::setup_readers): New function.
3588 (Sized_incremental_binary::do_check_inputs): Check
3589 has_incremental_info_ flag; move setup code to setup_readers;
3591 (Sized_incremental_binary::do_file_is_unchanged): New function.
3592 (Sized_incremental_binary::do_get_input_reader): New function.
3593 * incremental.h (class Incremental_binary): Move to end of file.
3594 (Incremental_binary::file_is_unchanged): New function.
3595 (Incremental_binary::do_file_is_unchanged): New function.
3596 (Incremental_binary::Input_reader): New class.
3597 (Incremental_binary::get_input_reader): New function.
3598 (class Sized_incremental_binary): Move to end of file.
3599 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3600 input section reader classes.
3601 (Sized_incremental_binary::has_incremental_info): New function.
3602 (Sized_incremental_binary::inputs_reader): New function.
3603 (Sized_incremental_binary::symtab_reader): New function.
3604 (Sized_incremental_binary::relocs_reader): New function.
3605 (Sized_incremental_binary::got_plt_reader): New function.
3606 (Sized_incremental_binary::do_file_is_unchanged): New function.
3607 (Sized_incremental_binary::Sized_input_reader): New class.
3608 (Sized_incremental_binary::get_input_reader): New function.
3609 (Sized_incremental_binary::find_incremental_inputs_sections):
3610 Rename do_find_incremental_inputs_sections to this.
3611 (Sized_incremental_binary::setup_readers): New function.
3612 (Sized_incremental_binary::has_incremental_info_): New data member.
3613 (Sized_incremental_binary::inputs_reader_): New data member.
3614 (Sized_incremental_binary::symtab_reader_): New data member.
3615 (Sized_incremental_binary::relocs_reader_): New data member.
3616 (Sized_incremental_binary::got_plt_reader_): New data member.
3617 (Sized_incremental_binary::current_input_file_): New data member.
3619 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3622 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3625 2011-03-30 Cary Coutant <ccoutant@google.com>
3627 * archive.cc (Archive::include_member): Adjust call to report_object.
3628 (Add_archive_symbols::run): Add script_info to call to
3629 report_archive_begin.
3630 (Lib_group::include_member): Adjust call to report_object.
3631 (Add_lib_group_symbols::run): Adjust call to report_object.
3632 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3633 blocks. Add object count for script input files.
3634 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3635 script_info parameter; change all callers.
3636 (Incremental_inputs::report_object): Add script_info parameter;
3638 (Incremental_inputs::report_script): Store backpointer to
3639 incremental info entry.
3640 (Output_section_incremental_inputs::set_final_data_size): Record
3641 additional information for scripts.
3642 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3643 * incremental.h (Incremental_script_entry::add_object): New function.
3644 (Incremental_script_entry::get_object_count): New function.
3645 (Incremental_script_entry::get_object): New function.
3646 (Incremental_script_entry::objects_): New data member; adjust
3648 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3649 (Incremental_inputs::report_object): Add script_info parameter.
3650 (Incremental_inputs_reader::get_object_count): New function.
3651 (Incremental_inputs_reader::get_object_offset): New function.
3652 * options.cc (Input_arguments::add_file): Return reference to
3654 * options.h (Input_argument::set_script_info): New function.
3655 (Input_argument::script_info): New function.
3656 (Input_argument::script_info_): New data member; adjust all
3658 (Input_file_group::add_file): Return reference to new input argument.
3659 (Input_file_lib::add_file): Likewise.
3660 (Input_arguments::add_file): Likewise.
3661 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3662 * script.cc (Parser_closure::Parser_closure): Add script_info
3663 parameter; adjust all callers.
3664 (Parser_closure::script_info): New function.
3665 (Parser_closure::script_info_): New data member.
3666 (read_input_script): Report scripts earlier to incremental info.
3667 (script_add_file): Set script_info in Input_argument.
3668 (script_add_library): Likewise.
3669 * script.h (Script_options::Script_info): Rewrite class.
3671 2011-03-29 Cary Coutant <ccoutant@google.com>
3673 * archive.cc (Library_base::should_include_member): Move
3674 method here from class Archive.
3675 (Archive::Archive): Initialize base class.
3676 (Archive::should_include_member): Move to base class.
3677 (Archive::do_for_all_unused_symbols): New function.
3678 (Add_archive_symbols::run): Remove redundant access to
3680 (Lib_group::Lib_group): Initialize base class.
3681 (Lib_group::do_filename): New function.
3682 (Lib_group::include_member): Pass pointer to Lib_group to
3684 (Lib_group::do_for_all_unused_symbols): New function.
3685 (Add_lib_group_symbols::run): Report archive information for
3687 * archive.h (class Library_base): New base class.
3688 (class Archive): Derive from Library_base.
3689 (Archive::filename): Move to base class.
3690 (Archive::set_incremental_info): Likewise.
3691 (Archive::incremental_info): Likewise.
3692 (Archive::Should_include): Likewise.
3693 (Archive::should_include_member): Likewise.
3694 (Archive::Armap_entry): Remove.
3695 (Archive::Unused_symbol_iterator): Remove.
3696 (Archive::unused_symbols_begin): Remove.
3697 (Archive::unused_symbols_end): Remove.
3698 (Archive::do_filename): New function.
3699 (Archive::do_get_mtime): New function.
3700 (Archive::do_for_all_unused_symbols): New function.
3701 (Archive::task_): Move to base class.
3702 (Archive::incremental_info_): Likewise.
3703 (class Lib_group): Derive from Library_base.
3704 (Lib_group::do_filename): New function.
3705 (Lib_group::do_get_mtime): New function.
3706 (Lib_group::do_for_all_unused_symbols): New function.
3707 (Lib_group::task_): Move to base class.
3708 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3710 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3712 * incremental.cc (Incremental_inputs::report_archive_begin):
3713 Use Library_base; call library's get_mtime; add incremental inputs
3714 entry before members.
3715 (class Unused_symbol_visitor): New class.
3716 (Incremental_inputs::report_archive_end): Use Library_base; use
3717 visitor class to record unused symbols; don't add incremental inputs
3718 entry after members.
3719 (Incremental_inputs::report_object): Use Library_base.
3721 (Incremental_archive_entry::Incremental_archive_entry): Remove
3722 unused Archive parameter.
3723 (Incremental_inputs::report_archive_begin): Use Library_base.
3724 (Incremental_inputs::report_archive_end): Likewise.
3725 (Incremental_inputs::report_object): Likewise.
3726 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3728 * object.h (Object::for_all_global_symbols): New function.
3729 (Object::do_for_all_global_symbols): New function.
3730 (Sized_relobj::do_for_all_global_symbols): New function.
3731 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3733 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3736 2011-03-27 Ian Lance Taylor <iant@google.com>
3738 * archive.cc (Archive::interpret_header): Return -1 if something
3739 goes wrong. Change callers accordingly.
3741 2011-03-25 Cary Coutant <ccoutant@google.com>
3743 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3744 * testsuite/Makefile.in: Regenerate.
3746 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3748 * plugin.cc (get_view): New.
3749 (Plugin::load): Pass get_view to the plugin.
3750 (Plugin_manager::get_view): New.
3752 2011-03-21 Ian Lance Taylor <iant@google.com>
3754 * testsuite/final_layout.sh: Rewrite to not use dc.
3755 * testsuite/relro_test.sh: Fail if dc is not present.
3757 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3759 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3761 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3762 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3764 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3765 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3767 2011-03-14 Ian Lance Taylor <iant@google.com>
3769 * script-sections.cc (Sort_output_sections::script_compare):
3770 Rename from is_before, change return type.
3771 (Sort_output_sections::operator()): Adjust accordingly.
3773 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3776 * testsuite/odr_violation2.cc: Add comment to make all error line
3777 numbers double digits.
3778 * testsuite/debug_msg.sh: Adjust expected errors.
3780 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3782 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3783 but mark earlier ones as non-canonical
3784 (offset_to_iterator): Update search target and example
3785 (do_addr2line): Return extra lines in a vector*
3786 (format_file_lineno): Extract from do_addr2line
3787 (one_addr2line): Add vector* out-param
3788 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3789 when a lineno entry appeared last for its instruction
3790 (Dwarf_line_info): Add vector* out-param
3791 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3792 * symtab.cc (Odr_violation_compare): Include the lineno in the
3794 (linenos_from_loc): New. Combine the canonical line for an
3795 address with its other lines.
3796 (True_if_intersect): New. Helper functor to make
3797 std::set_intersection a query.
3798 (detect_odr_violations): Compare sets of lines instead of just
3799 one line for each function. This became less deterministic, but
3800 has fewer false positives.
3801 * symtab.h: Declarations.
3802 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3803 mix an optimized and non-optimized object in the same binary
3804 (odr_violation2.so): Same.
3805 * testsuite/Makefile.in: Regenerate from Makefile.am.
3806 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3807 * testsuite/debug_msg.sh: Update line numbers and add
3809 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3810 non-optimized context.
3811 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3812 isn't inlined, and use OdrDerived in an optimized context.
3813 * testsuite/odr_header1.h: Defines OdrDerived, where
3814 optimization will change the
3815 first-instruction-in-the-destructor's file and line number.
3816 * testsuite/odr_header2.h: Defines OdrBase.
3818 2011-03-09 Ian Lance Taylor <iant@google.com>
3820 * fileread.cc (File_read::clear_views): Don't delete the whole
3823 2011-03-08 Ian Lance Taylor <iant@google.com>
3826 * fileread.cc: #include <climits>.
3827 (GOLD_IOV_MAX): Define.
3828 (File_read::read_multiple): Limit number of entries by iov_max.
3829 * fileread.h (class File_read): Always set max_readv_entries to
3832 2011-03-07 Ian Lance Taylor <iant@google.com>
3835 * options.h (class General_options): Add -dy and -dn.
3837 2011-03-02 Cary Coutant <ccoutant@google.com>
3839 * testsuite/script_test_9.t: Add TLS segment.
3841 2011-03-02 Simon Baldwin <simonb@google.com>
3843 * configure.ac: Add check for gnu_indirect_function support in
3844 the toolchain building binutils.
3845 * configure: Rebuild.
3847 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3849 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3850 plugin only symbols.
3851 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3852 in plugin files as not needed in the symbol table.
3854 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3856 * output.cc (Output_section::add_input_section): Delay fill
3857 generation for section ordering.
3859 2011-02-09 Ian Lance Taylor <iant@google.com>
3862 * object.h (class Sized_relobj): Remove clear_local_symbols.
3863 * reloc.cc (Sized_relobj::do_relocate): Don't call
3864 clear_local_symbols.
3866 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3868 * plugin.cc (is_visible_from_outside): Return true for symbols
3871 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3873 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3876 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3878 * icf.h (is_section_foldable_candidate): Change type of parameter
3880 * icf.cc (Icf::find_identical_sections): Change type of local variable
3881 section_name to be std::string.
3882 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3884 2011-01-25 Ian Lance Taylor <iant@google.com>
3886 * script.cc (script_add_extern): Rewrite to use
3887 add_symbol_reference.
3889 2011-01-25 Doug Kwan <dougkwan@google.com>
3891 * icf.cc (get_section_contents): Always lock section's object.
3893 2011-01-24 Ian Lance Taylor <iant@google.com>
3895 * options.h (class General_options): Accept
3896 --no-detect-odr-violations.
3898 2011-01-24 Ian Lance Taylor <iant@google.com>
3900 * version.cc (version_string): Bump to 1.11.
3902 2011-01-24 Ian Lance Taylor <iant@google.com>
3904 * plugin.cc (class Plugin_rescan): Define new class.
3905 (Plugin_manager::claim_file): Set any_claimed_.
3906 (Plugin_manager::save_archive): New function.
3907 (Plugin_manager::save_input_group): New function.
3908 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3910 (Plugin_manager::new_undefined_symbol): New function.
3911 (Plugin_manager::rescan): New function.
3912 (Plugin_manager::rescannable_defines): New function.
3913 (Plugin_manager::add_input_file): Set any_added_.
3914 * plugin.h (class Plugin_manager): define new fields rescannable_,
3915 undefined_symbols_, any_claimed_, and any_added_. Declare
3916 Plugin_rescan as friend. Declare new functions.
3917 (Plugin_manager::Rescannable): Define type.
3918 (Plugin_manager::Rescannable_list): Define type.
3919 (Plugin_manager::Undefined_symbol_list): Define type.
3920 (Plugin_manager::Plugin_manager): Initialize new fields.
3921 * archive.cc (Archive::defines_symbol): New function.
3922 (Add_archive_symbols::run): Pass archive to plugins if any.
3923 * archive.h (class Archive): Declare defines_symbol.
3924 * readsyms.cc (Input_group::~Input_group): New function.
3925 (Finish_group::run): Pass input_group to plugins if any.
3926 * readsyms.h (class Input_group): Declare destructor.
3927 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3930 2011-01-10 Ian Lance Taylor <iant@google.com>
3932 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3934 (Layout::set_segment_offsets): Reset increase_relro before calling
3935 set_section_addresses a second time.
3937 2011-01-04 Cary Coutant <ccoutant@google.com>
3939 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3940 sections before NOBITS sections.
3942 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3944 * version.cc (print_version): Update copyright to 2011.
3946 2010-12-23 Cary Coutant <ccoutant@google.com>
3948 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3949 of OS to this->add. Add OD parameter to second form of the function.
3951 2010-12-20 Ian Lance Taylor <iant@google.com>
3953 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3954 second of two consecutive entries with same offset.
3956 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3958 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3959 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3960 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3961 to avoid unneeded links against $(LDADD).
3962 * testsuite/Makefile.in: Regenerate.
3964 2010-12-15 Ian Lance Taylor <iant@google.com>
3967 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3968 for R_X86_64_32 and R_X86_64_PC32.
3969 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3970 ver_matching_def_pic.o.
3971 (ver_matching_def_pic.o): New target.
3973 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3975 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3976 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3977 Move definition before File_read::View member definitions.
3978 (File_read::View::~View): Initialize and hold lock before
3979 updating current_mapped_bytes.
3981 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3983 * dwarf_reader.cc: Remove outdated comment.
3984 * gold-threads.cc: Fix typo in error message.
3985 * archive.cc: Fix typos in comments.
3986 * archive.h: Likewise.
3987 * arm-reloc-property.cc: Likewise.
3988 * arm-reloc-property.h: Likewise.
3989 * arm-reloc.def: Likewise.
3991 * attributes.h: Likewise.
3992 * cref.cc: Likewise.
3993 * ehframe.cc: Likewise.
3994 * fileread.h: Likewise.
3996 * i386.cc: Likewise.
3998 * incremental.h: Likewise.
3999 * int_encoding.cc: Likewise.
4000 * layout.h: Likewise.
4001 * main.cc: Likewise.
4002 * merge.h: Likewise.
4003 * object.cc: Likewise.
4004 * object.h: Likewise.
4005 * options.cc: Likewise.
4006 * readsyms.cc: Likewise.
4007 * reduced_debug_output.cc: Likewise.
4008 * reloc.cc: Likewise.
4009 * script-sections.cc: Likewise.
4010 * sparc.cc: Likewise.
4011 * symtab.h: Likewise.
4012 * target-reloc.h: Likewise.
4013 * target.cc: Likewise.
4014 * target.h: Likewise.
4015 * timer.cc: Likewise.
4016 * timer.h: Likewise.
4017 * x86_64.cc: Likewise.
4019 2010-12-09 Cary Coutant <ccoutant@google.com>
4021 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4023 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4024 parameter; change all callers.
4025 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4026 * options.h (warn_execstack): New option.
4028 2010-12-07 Doug Kwan <dougkwan@google.com>
4030 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4031 like function call relocations.
4033 2010-12-07 Ian Lance Taylor <iant@google.com>
4035 * archive.cc (Archive::get_elf_object_for_member): Permit
4036 punconfigured to be NULL.
4037 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4038 (Archive::include_member): Pass NULL to get_elf_object_for_member
4039 if we searched for the archive and this is the first included
4042 2010-12-01 Ian Lance Taylor <iant@google.com>
4044 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4045 track_relocs_type_ field.
4046 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4047 Set track_relocs_type_.
4048 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4049 contents when using RELA relocs.
4050 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4052 * reloc.cc (Track_relocs::next_addend): New function.
4053 * reloc.h (class Track_relocs): Declare next_addend.
4055 2010-12-01 Ian Lance Taylor <iant@google.com>
4057 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4060 2010-12-01 Ian Lance Taylor <iant@google.com>
4062 * README: Update compilers known to work and fail.
4064 2010-11-23 Matthias Klose <doko@ubuntu.com>
4066 * configure.in: For --enable-gold, handle value `default' instead of
4067 `both*'. Always install ld as ld.bfd, install as ld if gold is
4069 * configure: Regenerate.
4071 2010-11-18 Doug Kwan <dougkwan@google.com>
4073 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4074 and right_alignment to be zero. Store result alignment only if it is
4075 greater than existing alignment.
4077 2010-11-16 Cary Coutant <ccoutant@google.com>
4080 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4081 Check for ".zdebug_line".
4083 2010-11-16 Doug Kwan <dougkwan@google.com>
4084 Cary Coutant <ccoutant@google.com>
4086 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4087 by reference; adjust all callers.
4088 * output.cc (Output_segment::set_section_addresses): Adjust references
4089 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4091 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4092 end at page boundary.
4094 2010-11-16 Cary Coutant <ccoutant@google.com>
4097 * layout.cc (Layout::choose_output_section): Transform names of
4098 compressed sections even when using a script with a SECTIONS clause.
4099 (Layout::output_section_name): Remove code to transform
4100 compressed debug section names.
4101 * output.cc (Output_section::add_input_section): Use uncompressed
4102 section size when tracking input sections.
4104 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4106 * symtab.h (Symbol::NON_PIC_REF): Remove.
4107 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4108 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4109 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4110 (Symbol::use_plt_offset): Take a flags argument and pass it
4111 directly to needs_dynamic_reloc. Restrict check for undefined
4112 weak symbols to function calls.
4113 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4114 (Target_arm::Scan::global): Use it.
4115 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4116 (Target_arm::Relocate::relocate): Likewise.
4117 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4118 parameter with an r_type parameter. Use get_reference_flags
4120 (Target_arm::Relocate::relocate): Update accordingly.
4121 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4122 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4123 (Target_i386::Scan::global): Likewise.
4124 (Target_i386::Relocate::relocate): Likewise.
4125 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4126 parameter with an r_type parameter. Use get_reference_flags
4128 (Target_i386::Relocate::relocate): Update accordingly.
4129 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4130 (Target_powerpc::Scan::global): Use it.
4131 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4132 (Target_powerpc::Relocate::relocate): Likewise.
4133 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4134 (Target_sparc::Scan::global): Use it.
4135 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4136 (Target_sparc::Relocate::relocate): Likewise.
4137 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4138 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4139 (Target_x86_64::Scan::global): Likewise.
4140 (Target_x86_64::Relocate::relocate): Likewise.
4142 2010-11-08 Doug Kwan <dougkwan@google.com>
4143 Cary Coutant <ccoutant@google.com>
4145 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4146 (Arm_exidx_merge_section::section_contents_): New data member.
4147 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4148 (Arm_input_section::~Arm_input_section): De-allocate memory.
4149 (Arm_input_section::original_contents_): New data member.
4150 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4151 in parameters instead of calling Object::section_contents without
4153 (Arm_output_section::group_section): New parameter TASK. Pass it
4154 to callees that need locking objects.
4155 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4156 to lock EXIDX input sections. Fix a formatting issue. Call
4157 Arm_exidx_merged_section::build_contents to create merged section
4159 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4160 to lock object of stub table owner.
4161 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4162 TEXT_SIZE to initialize data member TEXT_SIZE_.
4163 (Arm_exidx_input_section::addralign): Fix typo in comment.
4164 (Arm_exidx_input_section::text_size): New method.
4165 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4166 that require locking objects. Lock objects before scanning for stubs
4167 and updating local symbols.
4168 (Arm_input_section<big_endian>::init): Copy contents of original
4170 (Arm_input_section<big_endian>::do_write): Use saved contents of
4171 original input section instead of calling Object::section_contents
4173 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4174 size without calling Object::section_size().
4175 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4176 for size. Allocate a buffer for merged EXIDX entries.
4177 (Arm_exidx_merged_section::build_contents): New method.
4178 (Arm_exidx_merged_section::do_write): Move merge section contents
4179 building code to Arm_exidx_merged_section::build_contetns. Write
4180 out contetns in buffer instead of building it on the fly.
4181 (Arm_relobj::make_exidx_input_section): Also pass text section size
4182 to Arm_exidx_input_section constructor.
4183 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4184 (Arm_dynobj::do_read_symbols): Fix memory leak.
4185 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4186 * target.h: (class Task): Add forward declaration.
4187 (Target::relax): Add new parameter TASK and pass it to
4189 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4191 2010-11-05 Cary Coutant <ccoutant@google.com>
4194 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4195 object when reading from the file.
4196 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4198 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4199 when reading section contents.
4200 (get_section_contents): Likewise.
4201 (icf::find_identical_sections): Likewise.
4202 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4203 object when reading from the file.
4204 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4205 the object when doing deferred section layout.
4207 2010-11-03 Nick Clifton <nickc@redhat.com>
4210 * script.h (class Symbol_assignment: name): New member. Returns
4211 the name of the symbol.
4212 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4213 Returns true if the given symbol name is on the list of
4214 assignments wating to be processed.
4215 * archive.cc (should_incldue_member): If the symbol is undefined,
4216 check to see if it is on the list of symbols pending assignment.
4218 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4220 * script-sections.cc (Script_sections::find_memory_region): Check
4221 for a NULL output section pointer.
4223 2010-10-29 Doug Kwan <dougkwan@google.com>
4225 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4226 Output_section::add_relaxed_input_section.
4227 * output.cc (Output_section::add_relaxed_input_section): Add new
4228 arguments LAYOUT and NAME. Set section order index.
4229 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4230 Copy section order index.
4231 * output.h (Output_section::add_relaxed_input_section): Add new
4232 arguments LAYOUT and NAME.
4234 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4236 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4237 NATIVE_OR_CROSS_LINKER.
4238 * testsuite/Makefile.in: Regenerate.
4240 2010-10-20 Doug Kwan <dougkwan@google.com>
4242 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4243 without SHF_LINK_ORDER flags.
4244 * layout.cc (Layout::choose_output_section): Do not filter
4245 SHF_LINK_ORDER flag in a relocatable link.
4247 2010-10-17 Cary Coutant <ccoutant@google.com>
4249 * output.h (Output_segment::set_section_addresses): Change function
4250 signature. Update all callers.
4251 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4253 (Output_segment::set_section_addresses): Align after last TLS
4254 section. Add padding before last relro section instead of after.
4256 2010-10-17 Doug Kwan <dougkwan@google.com>
4258 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4259 GOT output section to be writable.
4261 2010-10-14 Cary Coutant <ccoutant@google.com>
4263 * debug.h (DEBUG_INCREMENTAL): New flag.
4264 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4265 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4267 * incremental.cc (report_command_line): Ignore all forms of
4269 * layout.cc (Layout::Layout): Check parameters for incremental link
4271 * options.cc (General_options::parse_incremental): New function.
4272 (General_options::parse_no_incremental): New function.
4273 (General_options::parse_incremental_full): New function.
4274 (General_options::parse_incremental_update): New function.
4275 (General_options::incremental_mode_): New data member.
4276 (General_options::finalize): Check incremental_mode_.
4277 * options.h (General_options): Update help text for --incremental.
4278 Add --no-incremental, --incremental-full, --incremental-update.
4279 (General_options::Incremental_mode): New enum type.
4280 (General_options::incremental_mode): New function.
4281 (General_options::incremental_mode_): New data member.
4282 * parameters.cc (Parameters::incremental_mode_): New data member.
4283 (Parameters::set_options): Set incremental_mode_.
4284 (Parameters::set_incremental_full): New function.
4285 (Parameters::incremental): New function.
4286 (Parameters::incremental_update): New function.
4287 (set_parameters_incremental_full): New function.
4288 * parameters.h (Parameters::set_incremental_full): New function.
4289 (Parameters::incremental): New function.
4290 (Parameters::incremental_update): New function.
4291 (Parameters::incremental_mode_): New data member.
4292 (set_parameters_incremental_full): New function.
4293 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4294 incremental link mode.
4295 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4296 (Sized_relobj::do_relocate_sections): Likewise.
4297 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4299 * testsuite/Makefile.in: Regenerate.
4300 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4302 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4304 * script-sections.h (class Script_sections): Make
4305 Sections_elements typedef public.
4306 * script-sections.cc (class Sort_output_sections): Add elements_
4307 field. Add constructor which sets it; change all callers.
4308 (Sort_output_sections::is_before): New function.
4309 (Sort_output_sections::operator()): Call is_before.
4310 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4312 * testsuite/script_test_10.sh: New test. Test script section
4314 * testsuite/script_test_10.t: Likewise.
4315 * testsuite/script_test_10.s: Likewise.
4316 * testsuite/Makefile.am: Wrap the cross linker tests and the
4317 common tests into NATIVE_OR_CROSS_LINKER.
4318 (check_SCRIPTS): Add script_test_10.sh.
4319 (check_DATA): Add script_test_10.stdout.
4320 (script_test_10.o, script_test_10): New targets.
4321 (script_test_10.stdout): New target.
4322 * configure, testsuite/Makefile.in: Regenerate.
4324 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4326 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4327 error for the deprecated relocations.
4328 (Target_arm::Scan::global): Likewise.
4329 (Target_arm::Relocate::relocate): Likewise.
4331 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4333 * fileread.cc (Input_file::find_file): Initialize *found_name
4334 and *namep when using the fallback search for case 4.
4336 2010-10-11 Cary Coutant <ccoutant@google.com>
4338 * options.h (class General_options): Redefine -z lazy as an alias for
4339 the negation of -z now.
4341 2010-10-11 Ian Lance Taylor <iant@google.com>
4343 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4346 2010-10-06 Nick Clifton <nickc@redhat.com>
4348 * script-sections.cc(class Memory_region): Remove
4349 current_lma_offset_ field. Rename current_vma_offset_ to
4350 current_offset_. Add last_section_ field.
4351 (Memory_region::get_current_vma_address): Rename to
4352 get_current_address.
4353 (Memory_region::get_current_lma_address): Delete.
4354 (Memory_region::increment_vma_offset): Rename to
4356 (Memory_region::increment_lma_offset): Delete.
4357 (Memory_region::attributes_compatible): New method. Returns
4358 true if the provided section is compatible with the region.
4359 (Memory_region::get_last_section): New method. Returns the last
4360 section to use the region.
4361 (Memory_region::set_last_section): New method. Stores the last
4362 section to use the region.
4363 (Script_sections::block_in_region): New method. Returns true if
4364 a block of memory is contained within a region.
4365 (Script_sections::find_memory_region): New method. Locates a
4366 memory region to be used to set a VMA or LMA address.
4367 (Output_section_definition::set_section_addresses): Add code to
4368 check for addresses set by memory regions.
4369 (Output_segment::set_section_addresses): Remove memory region
4371 (Script_sections::create_segment): Add a warning if a header
4372 segment is created outside of any region.
4373 * script-sections.h (class Script_sections): Add prototypes for
4374 find_memory_region and block_in_region methods.
4375 * testsuite/memory_test.s: Use .long instead of .word.
4376 * testsuite/memory_test.t: Add some more output sections.
4377 * testsuite/memory_test.sh: Update expected output.
4379 2010-10-02 Doug Kwan <dougkwan@google.com>
4381 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4382 defintion to symtab.h
4383 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4384 declaration to defintion.
4386 2010-10-01 Nick Clifton <nickc@redhat.com>
4388 * expression.cc (eval): Replace dummy argument with NULL.
4389 (eval_maybe_dot): Check for a NULL result section pointer.
4390 (Symbol_expression::value): Likewise.
4391 (Dot_expression::value): Likewise.
4392 (BINARY_EXPRESSION): Likewise.
4393 (Max_expression::value): Likewise.
4394 (Min_expression::value): Likewise.
4395 (Absolute_expression::value): Likewise.
4396 (Addr_expression::value_from_output_section): Likewise.
4397 (Loaddddr_expression::value_from_output_section): Likewise.
4398 (Segment_start_expression::value): Likewise.
4399 * script-sections.cc
4400 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4402 (Sections_elememt_dot_assignment::set_section_addresses):
4404 (Output_data_expression::do_write_to_buffer): Likewise.
4405 (Output_section_definition::finalize_symbols): Likewise.
4406 (Output_section_definition::set_section_addresses): Likewise.
4408 2010-09-30 Doug Kwan <dougkwan@google.com>
4410 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4412 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4414 * target.h (Target::can_icf_inline_merge_sections): New virtual
4416 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4418 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4420 * icf.cc (get_section_contents): Inline merge sections only when
4423 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4425 * configure: Regenerate.
4427 2010-09-17 Ian Lance Taylor <iant@google.com>
4429 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4430 * testsuite/Makefile.am (memory_test.o): New target.
4431 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4433 * testsuite/Makefile.in: Rebuild.
4435 2010-09-17 Doug Kwan <dougkwan@google.com>
4437 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4438 defintion if relocation uses GOT entries of the symbol.
4439 * testsuite/icf_safe_test.sh: Fix test.
4440 * testsuite/icf_safe_so_test.sh: Fix test.
4442 2010-09-16 Cary Coutant <ccoutant@google.com>
4444 * script_sections.cc (class Memory_region): Remove "NULL" from
4445 vector initializations.
4447 2010-09-15 Cary Coutant <ccoutant@google.com>
4449 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4450 Resolve forwarding symbols.
4452 2010-09-15 Doug Kwan <dougkwan@google.com>
4454 * gold/testsuite/script_test_3.t: Add ARM special sections.
4455 * gold/testsuite/script_test_4.t: Same.
4456 * gold/testsuite/script_test_5.t: Same.
4457 * gold/testsuite/script_test_6.t: Same.
4458 * gold/testsuite/script_test_7.t: Same.
4459 * gold/testsuite/script_test_7.t: Same.
4460 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4462 2010-09-14 Cary Coutant <ccoutant@google.com>
4464 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4465 (Target_x86_64::Relocate::relocate_tls): Replace check for
4466 saw_tls_block_reloc_ with test for executable section.
4468 2010-09-12 Cary Coutant <ccoutant@google.com>
4470 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4471 position-independent executables to shared libraries need dynamic
4473 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4474 position-independent executables.
4475 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4476 * testsuite/Makefile.in: Regenerate.
4478 2010-09-10 Nick Clifton <nickc@redhat.com>
4481 * testsuite/memory_test.t: Discard any sections that are not
4484 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4487 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4488 "This::" to work around a bug in gcc 4.2.
4490 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4492 2010-09-09 Rafael Espindola <espindola@google.com>
4494 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4495 sections with different PF_X flags in the same segment.
4496 (Layout::find_first_load_seg): Search all segments to find the first
4498 * options.h (rosegment): New.
4500 2010-09-08 Rafael Espindola <espindola@google.com>
4502 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4504 2010-09-08 Doug Kwan <dougkwan@google.com>
4506 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4507 (Arm_relobj::do_relocate_sections): Add new parameter for output
4508 file to match the parent.
4509 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4510 of local symbols instead of input values. Update code to track
4511 changes in gold::relocate_section.
4512 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4513 (Sized_relobj::compute_final_local_value_internal): New methods.
4514 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4515 body into private version of Sized_relobj::compute_final_local_value.
4516 Call the inline method.
4517 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4518 merged symbol value if there is one.
4519 (Symbol_value::has_output_value): New method defintiion.
4520 (Sized_relobj::Compute_final_local_value_status): New enum type.
4521 (Sized_relobj::compute_final_local_value): New methods.
4522 (Sized_relobj::compute_final_local_value_internal): New methods.
4523 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4524 and arm_cortex_a8.sh.
4525 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4526 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4528 * Makefile.in: Regenerate.
4529 * testsuite/arm_bl_out_of_range.s: Update test.
4530 * testsuite/thumb_bl_out_of_range.s: Ditto.
4531 * testsuite/thumb_blx_out_of_range.s: Ditto.
4532 * testsuite/arm_branch_out_of_range.sh: New file.
4533 * testsuite/arm_cortex_a8.sh: Ditto.
4534 * testsuite/arm_cortex_a8_b.s: Ditto.
4535 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4536 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4537 * testsuite/arm_cortex_a8_bl.s: Ditto.
4538 * testsuite/arm_cortex_a8_blx.s: Ditto.
4539 * testsuite/arm_cortex_a8_local.s: Ditto.
4540 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4541 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4543 2010-09-08 Rafael Espindola <espindola@google.com>
4545 * Makefile.am (memory_test.stdout): Run readelf with -W.
4546 * Makefile.in: Regenerate.
4547 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4550 2010-09-08 Rafael Espindola <espindola@google.com>
4552 * script-sections.cc (Script_sections::add_memory_region): Convert
4553 field precision to int.
4554 * script.cc (script_set_section_region, script_set_section_region):
4555 Convert field precision to int.
4557 2010-09-08 Rafael Espindola <espindola@google.com>
4559 * arm.cc (do_finalize_sections): Create the __exidx_start and
4560 __exdix_end symbols even when the section is missing.
4562 2010-09-08 Nick Clifton <nickc@redhat.com>
4564 * README: Remove claim that MEMORY is not supported.
4565 * expression.cc (script_exp_function_origin)
4566 (script_exp_function_length): Move from here to ...
4567 * script.cc: ... here.
4568 (script_set_section_region, script_add_memory)
4569 (script_parse_memory_attr, script_include_directive): New
4571 * script-sections.cc
4572 (class Memory_region): New class.
4573 (class Output_section_definition): Add set_memory_region,
4574 set_section_vma, set_section_lma and get_section_name methods.
4575 (class Script_Sections): Add add_memory_region,
4576 find_memory_region, find_memory_region_origin,
4577 find_memory_region_length and set_memory_region methods.
4578 Have set_section_addresses method walk the list of set memory
4580 Extend the print methos to display memory regions.
4581 * script-sections.h: Add prototypes for new methods.
4582 Add enum for MEMORY region attributes.
4583 * yyscript.y: Add support for parsing MEMORY regions.
4584 * script-c.h: Add prototypes for new functions.
4585 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4586 * testsuite/Makefile.in: Regenerate.
4587 * testsuite/memory_test.sh: New script.
4588 * testsuite/memory_test.s: New assembler source file.
4589 * testsuite/memory_test.t: New linker script.
4591 2010-08-27 Doug Kwan <dougkwan@google.com>
4593 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4594 reference override an existing dynamic weak reference.
4595 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4596 * testsuite/Makefile.in: Regenerate.
4597 * testsuite/dyn_weak_ref.sh: New file.
4598 * testsuite/dyn_weak_ref_1.c: Ditto.
4599 * testsuite/dyn_weak_ref_2.c: Ditto.
4601 2010-08-27 Ian Lance Taylor <iant@google.com>
4603 * incremental.h (class Incremental_input_entry): Add virtual
4606 2010-08-27 Ian Lance Taylor <iant@google.com>
4608 * testsuite/start_lib_test_3.c: Mark t3 as used.
4610 2010-08-27 Nick Clifton <nickc@redhat.com>
4612 * options.cc (version_script): Fix small typo in previous
4615 2010-08-25 Nick Clifton <nickc@redhat.com>
4617 * archive.cc: Formatting fixes: Remove whitespace between
4618 typename and following asterisk. Remove whitespace between
4619 function name and opening parenthesis.
4620 * archive.h: Likewise.
4622 * attributes.cc: Likewise.
4623 * attributes.h: Likewise.
4624 * common.cc: Likewise.
4625 * copy-relocs.cc: Likewise.
4626 * dirsearch.h: Likewise.
4627 * dynobj.cc: Likewise.
4628 * ehframe.cc: Likewise.
4629 * ehframe.h: Likewise.
4630 * expression.cc: Likewise.
4631 * fileread.cc: Likewise.
4632 * fileread.h: Likewise.
4634 * gold-threads.cc: Likewise.
4635 * gold.cc: Likewise.
4636 * i386.cc: Likewise.
4638 * incremental-dump.cc: Likewise.
4639 * incremental.cc: Likewise.
4640 * layout.cc: Likewise.
4641 * layout.h: Likewise.
4642 * main.cc: Likewise.
4643 * merge.cc: Likewise.
4644 * merge.h: Likewise.
4645 * object.cc: Likewise.
4646 * object.h: Likewise.
4647 * options.cc: Likewise.
4648 * options.h: Likewise.
4649 * output.cc: Likewise.
4650 * output.h: Likewise.
4651 * plugin.cc: Likewise.
4652 * plugin.h: Likewise.
4653 * powerpc.cc: Likewise.
4654 * reloc.cc: Likewise.
4655 * script-c.h: Likewise.
4656 * script-sections.cc: Likewise.
4657 * script.cc: Likewise.
4658 * stringpool.cc: Likewise.
4659 * symtab.cc: Likewise.
4660 * symtab.h: Likewise.
4661 * target.cc: Likewise.
4662 * timer.cc: Likewise.
4663 * timer.h: Likewise.
4664 * version.cc: Likewise.
4665 * x86_64.cc: Likewise.
4667 2010-08-24 Nick Clifton <nickc@redhat.com>
4670 * layout.cc (segment_precedes): Sort segments by their physical
4671 addresses, if they have been set.
4673 2010-08-23 Cary Coutant <ccoutant@google.com>
4675 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4677 (Lib_group::include_member): Unlock object after deleting its
4679 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4682 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4683 Cary Coutant <ccoutant@google.com>
4685 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4686 constructor, and set_blocker.
4687 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4689 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4690 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4691 * testsuite/Makefile.am (start_lib_test): New test case.
4692 * testsuite/Makefile.in: Regenerate.
4693 * testsuite/start_lib_test_main.c: New file.
4694 * testsuite/start_lib_test_1.c: New file.
4695 * testsuite/start_lib_test_2.c: New file.
4696 * testsuite/start_lib_test_3.c: New file.
4698 2010-08-19 Ian Lance Taylor <iant@google.com>
4700 * Makefile.in: Rebuild with automake 1.11.1.
4701 * aclocal.m4: Likewise.
4702 * testsuite/Makefile.in: Likewise.
4704 2010-08-19 Ian Lance Taylor <iant@google.com>
4707 * i386.cc (class Output_data_plt_i386): Update declarations.
4708 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4709 local_ifuncs_ fields.
4710 (Target_i386::do_plt_section_for_global): New function.
4711 (Target_i386::do_plt_section_for_local): New function.
4712 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4713 parameter; change all callers. Initialize global_ifuncs_ and
4714 local_ifuncs_. If doing a static link define __rel_iplt_start and
4716 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4717 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4718 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4720 (Target_i386::make_plt_section): New function, broken out of
4721 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4722 (Target_i386::make_plt_entry): Call make_plt_section.
4723 (Target_i386::make_local_ifunc_plt_entry): New function.
4724 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4725 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4726 R_386_IRELATIVE to switch.
4727 (Target_i386::Scan::global): Likewise.
4728 (Target_i386::Relocate::relocate): Likewise.
4729 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4731 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4732 (Target_x86_64::do_plt_section_for_global): New function.
4733 (Target_x86_64::do_plt_section_for_local): New function.
4734 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4735 parameter; change all callers. If doing a static link define
4736 __rela_iplt_start and __rela_iplt_end.
4737 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4738 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4739 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4741 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4742 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4744 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4745 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4746 R_X86_64_IRELATIVE to switch.
4747 (Target_x86_64::Scan::global): Likewise.
4748 (Target_x86_64::Relocate::relocate): Likewise.
4749 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4751 * target.h (class Target): Add plt_section_for_global and
4752 plt_section_for_local functions. Add do_plt_section_for_global
4753 and do_plt_section_for_local virtual functions.
4754 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4755 clarifying comments.
4756 (Symbol::use_plt_offset): Handle IFUNC symbol.
4757 * object.cc (Sized_relobj::Sized_relobj): Initialize
4759 (Sized_relobj::local_has_plt_offset): New function.
4760 (Sized_relobj::local_plt_offset): New function.
4761 (Sized_relobj::set_local_plt_offset): New function.
4762 (Sized_relobj::do_count): Handle IFUNC symbol.
4763 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4764 a bit away from input_shndx_ field. Add set_is_func_symbol and
4765 is_ifunc_symbol functions.
4766 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4767 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4768 local_plt_offsets_ field.
4769 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4770 * output.h (class Output_section_data): Add non-const
4771 output_section function.
4772 (class Output_data_got): Update declarations.
4773 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4774 Add use_plt_offset parameter to global and local constructors.
4775 Change all callers. Change local_sym_index_ field to 31 bits.
4776 Change GSYM_CODE and CONSTANT_CODE accordingly.
4777 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4778 doing a static link don't set sh_link field.
4779 (Output_data_got::Got_entry::write): Use PLT offset if
4781 (Output_data_got::add_global_plt): New function.
4782 (Output_data_got::add_local_plt): New function.
4783 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4784 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4785 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4786 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4787 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4789 * testsuite/ifunc-sel.h: New file.
4790 * testsuite/ifuncmain1.c: New file.
4791 * testsuite/ifuncmain1vis.c: New file.
4792 * testsuite/ifuncmod1.c: New file.
4793 * testsuite/ifuncdep2.c: New file.
4794 * testsuite/ifuncmain2.c: New file.
4795 * testsuite/ifuncmain3.c: New file.
4796 * testsuite/ifuncmod3.c: New file.
4797 * testsuite/ifuncmain4.c: New file.
4798 * testsuite/ifuncmain5.c: New file.
4799 * testsuite/ifuncmod5.c: New file.
4800 * testsuite/ifuncmain6pie.c: New file.
4801 * testsuite/ifuncmod6.c: New file.
4802 * testsuite/ifuncmain7.c: New file.
4803 * configure, testsuite/Makefile.in: Rebuild.
4805 2010-08-18 Ian Lance Taylor <iant@google.com>
4808 (Output_section_incremental_inputs::write_input_files): Add cast
4809 to avoid signed/unsigned comparison warning.
4810 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4812 2010-08-12 Cary Coutant <ccoutant@google.com>
4814 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4816 2010-08-13 Ian Lance Taylor <iant@google.com>
4818 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4820 2010-08-12 Cary Coutant <ccoutant@google.com>
4821 Doug Kwan <dougkwan@google.com>
4823 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4824 defintion overrides non-weak undef, remember that the original undef
4826 * symtab.cc (Symbol_table::sized_write_global): For undef without
4827 an original weak binding, set binding to global in output.
4828 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4829 * testsuite/Makefile.in: Regenerate.
4830 * testsuite/strong_ref_weak_def.sh: New file.
4831 * testsuite/strong_ref_weak_def_1.c: Ditto.
4832 * testsuite/strong_ref_weak_def_2.c: Ditto.
4834 2010-08-12 Cary Coutant <ccoutant@google.com>
4836 * testsuite/incremental_test.sh: Rewrite.
4837 * testsuite/incremental_test_1.c: Rewrite.
4838 * testsuite/incremental_test_2.c: Rewrite.
4840 2010-08-12 Cary Coutant <ccoutant@google.com>
4842 * arm.cc (Target_arm::got_size): Add const.
4843 (Target_arm::got_entry_count): New function.
4844 (Target_arm::plt_entry_count): New function.
4845 (Target_arm::first_plt_entry_offset): New function.
4846 (Target_arm::plt_entry_size): New function.
4847 (Output_data_plt_arm::entry_count): New function.
4848 (Output_data_plt_arm::first_plt_entry_offset): New function.
4849 (Output_data_plt_arm::get_plt_entry_size): New function.
4850 * i386.cc (Target_i386::got_size): Add const.
4851 (Target_i386::got_entry_count): New function.
4852 (Target_i386::plt_entry_count): New function.
4853 (Target_i386::first_plt_entry_offset): New function.
4854 (Target_i386::plt_entry_size): New function.
4855 (Output_data_plt_i386::entry_count): New function.
4856 (Output_data_plt_i386::first_plt_entry_offset): New function.
4857 (Output_data_plt_i386::get_plt_entry_size): New function.
4858 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4859 find_incremental_inputs_sections. Dump incremental_got_plt section.
4860 * incremental.cc: Include target.h.
4861 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4862 parameter. Adjust all callers. Find incremental_got_plt section.
4863 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4865 (Output_section_incremental_inputs::set_final_data_size): Calculate
4866 size of incremental_got_plt section.
4867 (Output_section_incremental_inputs::do_write): Write the
4868 incremental_got_plt section.
4869 (Got_plt_view_info): New struct.
4870 (Local_got_offset_visitor): New class.
4871 (Global_got_offset_visitor): New class.
4872 (Global_symbol_visitor_got_plt): New class.
4873 (Output_section_incremental_inputs::write_got_plt): New function.
4874 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4875 Add parameter. Adjust all callers.
4876 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4877 (Incremental_inputs::got_plt_section): New function.
4878 (Incremental_inputs::got_plt_section_): New data member.
4879 (Incremental_got_plt_reader): New class.
4880 * layout.cc (Layout::create_incremental_info_sections): Add the
4881 incremental_got_plt section.
4882 * object.h (Got_offset_list::get_list): New function.
4883 (Got offset_list::for_all_got_offsets): New function.
4884 (Sized_relobj::local_got_offset_list): New function.
4885 * powerpc.cc (Target_powerpc::got_size): Add const.
4886 (Target_powerpc::got_entry_count): New function.
4887 (Target_powerpc::plt_entry_count): New function.
4888 (Target_powerpc::first_plt_entry_offset): New function.
4889 (Target_powerpc::plt_entry_size): New function.
4890 (Output_data_plt_powerpc::entry_count): New function.
4891 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4892 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4893 * sparc.cc (Target_sparc::got_size): Add const.
4894 (Target_sparc::got_entry_count): New function.
4895 (Target_sparc::plt_entry_count): New function.
4896 (Target_sparc::first_plt_entry_offset): New function.
4897 (Target_sparc::plt_entry_size): New function.
4898 (Output_data_plt_sparc::entry_count): New function.
4899 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4900 (Output_data_plt_sparc::get_plt_entry_size): New function.
4901 * symtab.h (Symbol::got_offset_list): New function.
4902 (Symbol_table::for_all_symbols): New function.
4903 * target.h (Sized_target::got_entry_count): New function.
4904 (Sized_target::plt_entry_count): New function.
4905 (Sized_target::plt_entry_size): New function.
4906 * x86_64.cc (Target_x86_64::got_size): Add const.
4907 (Target_x86_64::got_entry_count): New function.
4908 (Target_x86_64::plt_entry_count): New function.
4909 (Target_x86_64::first_plt_entry_offset): New function.
4910 (Target_x86_64::plt_entry_size): New function.
4911 (Output_data_plt_x86_64::entry_count): New function.
4912 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4913 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4915 2010-08-12 Cary Coutant <ccoutant@google.com>
4917 * archive.cc: Include incremental.h.
4918 (Archive::Archive): Initialize incremental_info_.
4919 (Archive::include_member): Record archive members in incremental info.
4920 (Add_archive_symbols::run): Record begin and end of an archive in
4922 (Lib_group::include_member): Record objects in incremental info.
4923 * archive.h (Incremental_archive_entry): Forward declaration.
4924 (Archive::set_incremental_info): New member function.
4925 (Archive::incremental_info): New member function.
4926 (Archive::Unused_symbol_iterator): New class.
4927 (Archive::unused_symbols_begin): New member function.
4928 (Archive::unused_symbols_end): New member function.
4929 (Archive::incremental_info_): New data member.
4930 * incremental-dump.cc (find_input_containing_global): New function.
4931 (dump_incremental_inputs): Dump new incremental info sections.
4932 * incremental.cc: Include symtab.h.
4933 (Output_section_incremental_inputs): New class.
4934 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4935 new incremental info sections.
4936 (Sized_incremental_binary::do_check_inputs): Likewise.
4937 (Incremental_inputs::report_archive): Remove.
4938 (Incremental_inputs::report_archive_begin): New function.
4939 (Incremental_inputs::report_archive_end): New function.
4940 (Incremental_inputs::report_object): New function.
4941 (Incremental_inputs::finalize_inputs): Remove.
4942 (Incremental_inputs::report_input_section): New function.
4943 (Incremental_inputs::report_script): Rewrite.
4944 (Incremental_inputs::finalize): Do nothing but finalize string table.
4945 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4946 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4947 (Incremental_inputs::create_data_sections): New function.
4948 (Incremental_inputs::relocs_entsize): New function.
4949 (Output_section_incremental_inputs::set_final_data_size): New function.
4950 (Output_section_incremental_inputs::do_write): New function.
4951 (Output_section_incremental_inputs::write_header): New function.
4952 (Output_section_incremental_inputs::write_input_files): New function.
4953 (Output_section_incremental_inputs::write_info_blocks): New function.
4954 (Output_section_incremental_inputs::write_symtab): New function.
4955 * incremental.h (Incremental_script_entry): Forward declaration.
4956 (Incremental_object_entry): Forward declaration.
4957 (Incremental_archive_entry): Forward declaration.
4958 (Incremental_inputs): Forward declaration.
4959 (Incremental_inputs_header_data): Remove.
4960 (Incremental_inputs_header): Remove.
4961 (Incremental_inputs_header_write): Remove.
4962 (Incremental_inputs_entry_data): Remove.
4963 (Incremental_inputs_entry): Remove.
4964 (Incremental_inputs_entry_write): Remove.
4965 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4966 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4967 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4968 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4970 (Incremental_input_entry): New class.
4971 (Incremental_script_entry): New class.
4972 (Incremental_object_entry): New class.
4973 (Incremental_archive_entry): New class.
4974 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4975 (Incremental_inputs::report_inputs): Remove.
4976 (Incremental_inputs::report_archive): Remove.
4977 (Incremental_inputs::report_archive_begin): New function.
4978 (Incremental_inputs::report_archive_end): New function.
4979 (Incremental_inputs::report_object): Change prototype.
4980 (Incremental_inputs::report_input_section): New function.
4981 (Incremental_inputs::report_script): Change prototype.
4982 (Incremental_inputs::get_reloc_count): New function.
4983 (Incremental_inputs::set_reloc_count): New function.
4984 (Incremental_inputs::create_data_sections): New function.
4985 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4986 (Incremental_inputs::inputs_section): New function.
4987 (Incremental_inputs::symtab_section): New function.
4988 (Incremental_inputs::relocs_section): New function.
4989 (Incremental_inputs::get_stringpool): Add const.
4990 (Incremental_inputs::command_line): Add const.
4991 (Incremental_inputs::inputs): Remove.
4992 (Incremental_inputs::command_line_key): New function.
4993 (Incremental_inputs::input_file_count): New function.
4994 (Incremental_inputs::input_files): New function.
4995 (Incremental_inputs::relocs_entsize): New function.
4996 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4997 (Incremental_inputs::finalize_inputs): Remove.
4998 (Incremental_inputs::Input_info): Remove.
4999 (Incremental_inputs::lock_): Remove.
5000 (Incremental_inputs::inputs_): Change type.
5001 (Incremental_inputs::inputs_map_): Remove.
5002 (Incremental_inputs::current_object_entry_): New data member.
5003 (Incremental_inputs::inputs_section_): New data member.
5004 (Incremental_inputs::symtab_section_): New data member.
5005 (Incremental_inputs::relocs_section_): New data member.
5006 (Incremental_inputs::reloc_count_): New data member.
5007 (Incremental_inputs_reader): New class.
5008 (Incremental_symtab_reader): New class.
5009 (Incremental_relocs_reader): New class.
5010 * layout.cc (Layout::finalize): Move finalization of incremental info
5011 and creation of incremental info sections to follow finalization of
5012 symbol table. Set offsets for postprocessing sections.
5013 (Layout::create_incremental_info_sections): Call
5014 Incremental_inputs::create_data_sections. Add incremental symtab
5015 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5016 sections to layout after input sections.
5017 * layout.h (struct Timespec): Forward declaration.
5018 (Layout::incremental_inputs): Add const.
5019 (Layout::create_incremental_info_sections): Add parameter.
5020 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5021 * object.cc: Include incremental.h.
5022 (Relobj::finalize_incremental_relocs): New function.
5023 (Sized_relobj::do_layout): Record input sections in incremental info.
5024 * object.h (Object::output_section): New function.
5025 (Object::output_section_offset): Moved from Relobj.
5026 (Object::get_incremental_reloc_base): New function.
5027 (Object::get_incremental_reloc_count): New function.
5028 (Object::do_output_section): New function.
5029 (Object::do_output_section_offset): Moved from Relobj.
5030 (Object::do_get_incremental_reloc_base): New function.
5031 (Object::do_get_incremental_reloc_count): New function.
5032 (Object::Object): Initialize new data members.
5033 (Relobj::output_section): Renamed do_output_section and moved to
5035 (Relobj::output_section_offset): Moved to Object.
5036 (Relobj::do_get_incremental_reloc_base): New function.
5037 (Relobj::do_get_incremental_reloc_count): New function.
5038 (Relobj::allocate_incremental_reloc_counts): New function.
5039 (Relobj::count_incremental_reloc): New function.
5040 (Relobj::finalize_incremental_relocs): New function.
5041 (Relobj::next_incremental_reloc_index): New function.
5042 (Relobj::reloc_counts_): New data member.
5043 (Relobj::reloc_bases_): New data member.
5044 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5045 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5046 (Sized_relobj::incremental_relocs_scan): New function.
5047 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5048 (Sized_relobj::incremental_relocs_write): New function.
5049 (Sized_relobj::incremental_relocs_write_reltype): New function.
5050 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5052 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5053 archives and object files elsewhere.
5054 (Add_symbols::run): Report object files here.
5055 (Finish_group::run): Report end of archive at end of group.
5056 * reloc.cc: Include layout.h, incremental.h.
5057 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5058 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5059 (Sized_relobj::incremental_relocs_scan): New function.
5060 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5061 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5062 (Sized_relobj::incremental_relocs_write): New function.
5063 (Sized_relobj::incremental_relocs_write_reltype): New function.
5064 * script.cc (read_input_script): Rewrite test for incremental link.
5065 Change call to Incremental_inputs::report_script.
5066 * symtab.h (Symbol_table::first_global_index): New function.
5067 (Symbol_table::output_count): New function.
5069 2010-08-12 Doug Kwan <dougkwan@google.com>
5071 * arm.cc (Target_arm::merge_object_attributes): Check command line
5072 options --no-wchar-size-warning and --no-enum-size-warning.
5073 * options.h (General_options): Add ld-compatible options
5074 --no-enum-size-warning and --no-wchar-size-warning.
5076 2010-08-04 Ian Lance Taylor <iant@google.com>
5078 * x86_64.cc (Target_x86_64::Scan::local): Use
5079 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5080 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5081 (Target_x86_64::Scan::global): Likewise.
5082 (Target_x86_64::Relocate::relocate): Likewise.
5083 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5086 2010-08-03 Cary Coutant <ccoutant@google.com>
5088 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5089 to reserve space in merged_strings vector. Keep total input size
5091 (Output_merge_string::do_print_merge_stats): Print total input size.
5092 * merge.h (Output_merge_string): Add input_size_ field.
5093 * stringpool.cc (Stringpool_template::string_length): Move
5094 implementations out of Stringpool_template class and place in
5096 * stringpool.h (string_length): Move out of Stringpool_template.
5098 2010-08-03 Ian Lance Taylor <iant@google.com>
5101 * layout.cc (relaxation_loop_body): If address of load segment is
5102 set, adjust address to include headers if possible.
5104 2010-08-03 Ian Lance Taylor <iant@google.com>
5106 * version.cc (version_string): Bump to 1.10.
5108 2010-08-03 Ian Lance Taylor <iant@google.com>
5111 * layout.h (enum Output_section_order): Define.
5112 (class Layout): Update declarations.
5113 * layout.cc (Layout::get_output_section): Add order parameter.
5114 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5115 is_first_non_relro parameters. Change all callers.
5116 (Layout::choose_output_section): Likewise.
5117 (Layout::add_output_section_data): Likewise.
5118 (Layout::make_output_section): Likewise. Set order.
5119 (Layout::default_section_order): New function.
5120 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5121 * output.cc (Output_section::Output_section): Initialize order_.
5122 Don't initialize deleted fields.
5123 (Output_segment::Output_segment): Don't initialize deleted
5125 (Output_segment::add_output_section_to_load): New function
5126 replacing add_output_section. Change all callers to call this or
5127 add_output_section_to_nonload.
5128 (Output_segment::add_output_section_to_nonload): New function.
5129 (Output_segment::remove_output_section): Rewrite.
5130 (Output_segment::add_initial_output_data): Likewise.
5131 (Output_segment::has_any_data_sections): Likewise.
5132 (Output_segment::is_first_section_relro): Likewise.
5133 (Output_segment::maximum_alignment): Likewise.
5134 (Output_segment::has_dynamic_reloc): New function replacing
5135 dynamic_reloc_count. Change all callers.
5136 (Output_segment::has_dynamic_reloc_list): New function replacing
5137 dynamic_reloc_count_list. Change all callers.
5138 (Output_segment::set_section_addresses): Rewrite.
5139 (Output_segment::set_offset): Rewrite.
5140 (Output_segment::find_first_and_last_list): Remove.
5141 (Output_segment::set_tls_offsets): Rewrite.
5142 (Output_segment::first_section_load_address): Likewise.
5143 (Output_segment::output_section_count): Likewise.
5144 (Output_segment::section_with_lowest_load_address): Likewise.
5145 (Output_segment::write_section_headers): Likewise.
5146 (Output_segment::print_sections_to_map): Likewise.
5147 * output.h (class Output_data): Remove dynamic_reloc_count_
5148 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5149 (Output_data::add_dynamic_reloc): Rewrite.
5150 (Output_data::has_dynamic_reloc): New function.
5151 (Output_data::dynamic_reloc_count): Remove.
5152 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5153 is_last_relro_, is_first_non_relro_, is_interp_,
5154 is_dynamic_linker_section_ fields. Add order and set_order
5155 functions. Remove is_relro_local, set_is_relro_local,
5156 is_last_relro, set_is_last_relro, is_first_non_relro,
5157 set_is_first_non_relro functions, is_interp, set_is_interp,
5158 is_dynamic_linker_section, and set_is_dynamic_linker_section
5160 (class Output_segment): Change Output_data_list from std::list to
5161 std:;vector. Add output_lists_ field. Remove output_data_ and
5162 output_bss_ fields. Update declarations.
5164 2010-08-02 Ian Lance Taylor <iant@google.com>
5166 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5167 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5168 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5170 2010-08-02 Ian Lance Taylor <iant@google.com>
5173 * script.cc (Script_options::Script_options): Initialize
5174 symbol_definitions_ and symbol_references_.
5175 (Script_options::add_symbol_assignment): Update
5176 symbol_definitions_ and symbol_references_.
5177 (Script_options::add_symbol_reference): New function.
5178 (script_symbol): New function.
5179 * script.h (class Script_options): Add symbol_definitions_ and
5180 symbol_references_ fields.
5181 (Script_options::referenced_const_iterator): New type.
5182 (Script_options::referenced_begin): New function.
5183 (Script_options::referenced_end): New function.
5184 (Script_options::is_referenced): New function.
5185 (Script_options::any_unreferenced): New function.
5186 * script-c.h (script_symbol): Declare.
5187 * yyscript.y (exp): Call script_symbol.
5188 * symtab.cc: Include "script.h".
5189 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5190 Change all callers. Check symbols referenced by scripts.
5191 (Symbol_table::add_undefined_symbols_from_command_line): Add
5192 layout parameter. Change all callers.
5193 (Symbol_table::do_add_undefined_symbols_from_command_line):
5194 Likewise. Break out loop body. Check symbols referenced by
5196 (Symbol_table::add_undefined_symbol_from_command_line): New
5197 function broken out of
5198 do_add_undefined_symbols_from_command_line.
5199 * symtab.h (class Symbol_table): Update declarations.
5200 * archive.cc: Include "layout.h".
5201 (Archive::should_include_member): Add layout parameter. Change
5202 all callers. Check for symbol mentioned in expression.
5203 * archive.h (class Archive): Update declaration.
5204 * object.cc (Sized_relobj::do_should_include_member): Add layout
5206 * object.h (Object::should_include_member): Add layout parameter.
5208 (Object::do_should_include_member): Add layout parameter.
5209 (class Sized_relobj): Update declaration.
5210 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5212 * dynobj.h (class Sized_dynobj): Update declaration.
5213 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5215 * plugin.h (class Sized_pluginobj): Update declaration.
5217 2010-08-02 Ian Lance Taylor <iant@google.com>
5220 * output.cc (Output_segment::set_offset): Search for the first and
5221 last sections rather than assuming that the list is in order.
5222 (Output_segment::find_first_and_last_list): New function.
5223 * output.h (class Output_segment): Update declarations.
5224 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5225 (relro_strip_test_SOURCES): New variable.
5226 (relro_strip_test_DEPENDENCIES): New variable.
5227 (relro_strip_test_LDFLAGS): New variable.
5228 (relro_strip_test_LDADD): New variable.
5229 (relro_strip_test.so): New target.
5231 2010-08-02 Ian Lance Taylor <iant@google.com>
5233 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5234 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5235 (Target_i386::got_tlsdesc_section): New function.
5236 (Target_i386::got_section): Create space for GOT entries for
5237 TLSDESC relocations.
5238 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5240 (Target_i386::Scan::global): Likewise.
5241 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5243 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5244 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5245 (Target_x86_64::got_tlsdesc_section): New function.
5246 (Target_x86_64::got_section): Create space for GOT entries for
5247 TLSDESC relocations.
5248 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5250 (Target_x86_64::Scan::global): Likewise.
5251 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5254 2010-08-02 Ian Lance Taylor <iant@google.com>
5256 * testsuite/final_layout.sh: Use dc to convert from hex to
5259 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5261 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5262 paramter to the call to gold::gc_process_relocs.
5263 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5264 paramter to the call to gold::gc_process_relocs.
5265 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5266 parameter to the call to gold::gc_process_relocs.
5267 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5268 template parameter to the call to gold::gc_process_relocs.
5269 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5270 paramter to the call to gold::gc_process_relocs.
5271 * gc.h (get_embedded_addend_size): New function.
5272 (gc_process_relocs): Save the size of the reloc for use by ICF.
5273 * icf.cc (get_section_contents): Get the addend from the text section
5274 for SHT_REL relocation sections.
5275 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5276 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5277 * int_encoding.h (read_from_pointer): New overloaded function.
5278 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5279 * testsuite/icf_sht_rel_addend_test.sh: New file.
5280 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5281 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5283 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5285 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5286 * Makefile.in: Regenerate.
5287 * testsuite/Makefile.in: Regenerate.
5289 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5291 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5292 * gold/testsuite/debug_msg.cc: Likewise.
5293 * gold/testsuite/odr_violation1.cc
5294 * gold/testsuite/odr_violation2.cc
5296 2010-07-21 Cary Coutant <ccoutant@google.com>
5298 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5299 string, and length fields.
5300 (Output_merge_string::Merged_strings_list): New type.
5301 (Output_merge_string::Merged_strings_lists): New typedef.
5302 (Output_merge_string): Replace merged_strings_ with
5303 merged_strings_lists_.
5304 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5305 Merged_strings_list per input object and section. Don't store pointer
5306 to the string. Don't store length with each merged string entry.
5307 (Output_merge_string::finalize_merged_data): Loop over list of merged
5308 strings lists. Recompute length of each merged string.
5310 2010-07-15 Cary Coutant <ccoutant@google.com>
5312 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5315 2010-07-14 Ian Lance Taylor <iant@google.com>
5317 * descriptors.cc (Descriptors::open): Report correct name in error
5320 2010-07-13 Doug Kwan <dougkwan@google.com>
5322 * arm.cc (Arm_input_section::Arm_input_section): For a
5323 SHT_ARM_EXIDX section, always keeps the input sections.
5324 (Arm_input_section::set_exidx_section_link): New method.
5325 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5326 has_errors_ to false.
5327 (Arm_exidx_input_section::has_errors,
5328 Arm_exidx_input_section::set_has_errors): New methods.
5329 (Arm_exidx_input_section::has_errors_): New data member.
5330 (Arm_relobj::get_exidx_shndx_list): New method.
5331 (Arm_output_section::append_text_sections_to_list): Do not skip
5332 section without SHF_EXECINSTR.
5333 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5335 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5336 section header. Make error messages more verbose. Check for
5337 a non-executable section linked to an EXIDX section.
5338 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5339 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5340 check that there is no deferred EXIDX section if we exit early.
5341 Instead of not making an EXIDX section in case of an error, make one
5342 and set the has_errors flag of it.
5343 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5344 in a relocatable link.
5345 (Target_arm::do_relax): Look for the EXIDX output section instead of
5346 assuming that it is called .ARM.exidx.
5347 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5348 section list. Do not check for SHF_EXECINSTR section flags but
5349 skip any input section with errors.
5350 * output.cc (Output_section::Output_section): Initialize
5351 always_keeps_input_sections_ to false.
5352 (Output_section::add_input_section): Check for
5353 always_keeps_input_sections_.
5354 * output.h (Output_section::always_keeps_input_sections,
5355 Output_section::set_always_keeps_input_sections): New methods.
5356 (Output_section::always_keeps_input_sections): New data member.
5358 2010-07-13 Rafael Espindola <espindola@google.com>
5360 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5361 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5363 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5364 Ian Lance Taylor <iant@google.com>
5366 * output.h (Output_section_lookup_maps::add_merge_section):
5367 Correct check of whether value was inserted.
5368 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5369 (Output_section_lookup_maps::add_relaxed_input_section):
5371 * arm.cc (Target_arm::got_section): Remove used local os.
5372 * i386.cc (Target_i386::got_section): Likewise.
5373 * x86_64.cc (Target_x86_64::got_section): Likewise.
5374 * sparc.cc (Target_sparc::got_section): Likewise.
5375 (Target_sparc::relocate): Remove unused local have_got_offset.
5376 * powerpc.cc (Target_powerpc::relocate): Likewise.
5378 2010-07-13 Ian Lance Taylor <iant@google.com>
5380 * compressed_output.cc (zlib_decompress): Fix signature in
5383 * archive.cc (Archive::include_member): Unlock an external member
5384 of a thin archive. Don't bother to delete an object we know is
5387 2010-07-12 Cary Coutant <ccoutant@google.com>
5389 * compressed_output.cc (zlib_decompress): New function.
5390 (get_uncompressed_size): New function.
5391 (decompress_input_section): New function.
5392 * compressed_output.h (get_uncompressed_size): New function.
5393 (decompress_input_section): New function.
5394 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5395 Handle compressed debug sections.
5396 * layout.cc (is_compressed_debug_section): New function.
5397 (Layout::output_section_name): Map compressed section names to
5399 * layout.h (is_compressed_debug_section): New function.
5400 (is_debug_info_section): Recognize compressed debug sections.
5401 * merge.cc: Include compressed_output.h.
5402 (Output_merge_data::do_add_input_section): Handle compressed
5404 (Output_merge_string::do_add_input_section): Handle compressed
5406 * object.cc: Include compressed_output.h.
5407 (Sized_relobj::Sized_relobj): Initialize new data members.
5408 (build_compressed_section_map): New function.
5409 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5410 * object.h (Object::section_is_compressed): New method.
5411 (Object::do_section_is_compressed): New method.
5412 (Sized_relobj::Compressed_section_map): New type.
5413 (Sized_relobj::do_section_is_compressed): New method.
5414 (Sized_relobj::compressed_sections_): New data member.
5415 * output.cc (Output_section::add_input_section): Handle compressed
5417 * reloc.cc: Include compressed_output.h.
5418 (Sized_relobj::write_sections): Handle compressed debug sections.
5420 2010-07-08 Cary Coutant <ccoutant@google.com>
5422 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5423 weak when resolving to a dynamic def.
5424 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5425 for weak undef/dynamic def cases. Adjust callers.
5426 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5427 undef_binding_weak_.
5428 (Symbol_table::sized_write_globals): Adjust symbol binding.
5429 (Symbol_table::sized_write_symbol): Add binding parameter.
5430 * symtab.h (Symbol::set_undef_binding): New method.
5431 (Symbol::is_undef_binding_weak): New method.
5432 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5433 (Symbol_table::should_override): Add new parameter.
5434 (Symbol_table::sized_write_symbol): Add new parameter.
5436 * testsuite/weak_undef_file1.cc: Add new test case.
5437 * testsuite/weak_undef_file2.cc: Fix header comment.
5438 * testsuite/weak_undef_test.cc: Add new test case.
5440 2010-06-29 Doug Kwan <dougkwan@google.com>
5442 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5443 Initialize USE_SYMBOL_.
5444 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5446 (Arm_reloc_property::uses_symbol_): New data member declaration.
5447 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5448 uses symbol value and symbol is undefined but not weakly undefined.
5450 2010-06-28 Rafael Espindola <espindola@google.com>
5452 * plugin.cc (Plugin::load): Use dlerror.
5454 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5456 * symtab.cc (detect_odr_violations): When reporting an ODR
5457 violation, report an object where the symbol is defined.
5459 2010-06-25 Doug Kwan <dougkwan@google.com>
5461 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5462 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5464 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5465 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5466 target hook to detect function points.
5467 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5468 * icf.h (Icf::check_section_for_function_pointers): Change type of
5469 parameter SECTION_NAME to const reference to std::string. Use
5470 target hook to determine if section may have unsafe pointers.
5471 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5474 2010-06-21 Rafael Espindola <espindola@google.com>
5476 * fileread.cc (Input_file::find_fie): New
5477 (Input_file::open): Use Input_file::find_fie.
5478 * fileread.h (Input_file::find_fie): New
5479 * plugin.cc (set_extra_library_path): New.
5480 (Plugin::load): Add set_extra_library_path to the transfer vector.
5481 (Plugin_manager::set_extra_library_path): New.
5482 (Plugin_manager::add_input_file): Use the extra search path if set.
5483 (set_extra_library_path(): New.
5484 * plugin.h (Plugin_manager): Add set_extra_library_path and
5487 2010-06-19 Cary Coutant <ccoutant@google.com>
5489 * layout.cc (gdb_sections): Add .debug_types.
5490 (lines_only_debug_sections): Likewise.
5492 2010-06-18 Rafael Espindola <espindola@google.com>
5494 * plugin.cc (add_input_file,add_input_library)
5495 (Plugin_manager::add_input_file): Make filename arguments const.
5496 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5499 2010-06-16 Doug Kwan <dougkwan@google.com>
5501 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5502 .ARM.attributes section if we have not merged any input
5503 attributes sections.
5505 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5507 * arm.cc: Allow combining objects with no EABI version
5510 2010-06-15 Rafael Espindola <espindola@google.com>
5512 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5514 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5516 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5517 (struct iovec): Correct !HAVE_READV definition.
5519 2010-06-10 Cary Coutant <ccoutant@google.com>
5521 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5522 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5524 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5527 * symtab.h (Symbol::is_placeholder): New member function.
5528 * target-reloc.h (relocate_section): Check for placeholder symbols.
5530 * testsuite/Makefile.am (plugin_test_8): New test.
5531 (plugin_test_9): New test.
5532 * testsuite/Makefile.in: Regenerate.
5534 2010-06-09 Nick Clifton <nickc@redhat.com>
5536 * yyscript.y (input_list_element): Allow strings prefixed with
5537 the '-' character. Treat these as libraries.
5538 * script.cc (script_add_library): New function. Adds a library
5539 specified by "-l<name>" found in an input script.
5540 * script-c.h: Add prototype for script_add_library.
5542 2010-06-07 Doug Kwan <dougkwan@google.com>
5544 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5545 Restrict stub-group size to be within long conditional branch
5546 range when working around cortex-A8 erratum.
5548 2010-06-07 Damien Diederen <dd@crosstwine.com>
5550 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5553 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5557 (Output_section::Input_section_sort_entry::compare_section_ordering):
5558 Change to return non-zero correctly.
5559 (Output_section::Input_section_sort_section_order_index_compare
5560 ::operator()): Change to fix ambiguity in comparisons.
5562 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5564 * gold.h (is_wildcard_string): New function.
5565 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5566 (Layout::layout_eh_frame): Ditto.
5567 (Layout::find_section_order_index): New method.
5568 (Layout::read_layout_from_file): New method.
5569 * layout.h (Layout::find_section_order_index): New method.
5570 (Layout::read_layout_from_file): New method.
5571 (Layout::input_section_position_): New private member.
5572 (Layout::input_section_glob_): New private member.
5573 * main.cc (main): Call read_layout_from_file here.
5574 * options.h (--section-ordering-file): New option.
5575 * output.cc (Output_section::input_section_order_specified_): New
5577 (Output_section::Output_section): Initialize new member.
5578 (Output_section::add_input_section): Add new parameter.
5579 Keep input sections when --section-ordering-file is used.
5580 (Output_section::set_final_data_size): Sort input sections when
5581 section ordering file is specified.
5582 (Output_section::Input_section_sort_entry): Add new parameter.
5584 (Output_section::Input_section_sort_entry::compare_section_ordering):
5586 (Output_section::Input_section_sort_compare::operator()): Change to
5587 consider section_order_index.
5588 (Output_section::Input_section_sort_init_fini_compare::operator()):
5589 Change to consider section_order_index.
5590 (Output_section::Input_section_sort_section_order_index_compare
5591 ::operator()): New method.
5592 (Output_section::sort_attached_input_sections): Change to sort
5593 according to section order when specified.
5594 (Output_section::add_input_section<32, true>): Add new parameter.
5595 (Output_section::add_input_section<64, true>): Add new parameter.
5596 (Output_section::add_input_section<32, false>): Add new parameter.
5597 (Output_section::add_input_section<64, false>): Add new parameter.
5598 * output.h (Output_section::add_input_section): Add new parameter.
5599 (Output_section::input_section_order_specified): New
5601 (Output_section::set_input_section_order_specified): New method.
5602 (Input_section::Input_section): Initialize section_order_index_.
5603 (Input_section::section_order_index): New method.
5604 (Input_section::set_section_order_index): New method.
5605 (Input_section::section_order_index_): New member.
5606 (Input_section::Input_section_sort_section_order_index_compare): New
5608 (Output_section::input_section_order_specified_): New member.
5609 * script-sections.cc (is_wildcard_string): Delete and move modified
5611 (Output_section_element_input::Output_section_element_input): Modify
5612 call to is_wildcard_string.
5613 (Output_section_element_input::Input_section_pattern
5614 ::Input_section_pattern): Ditto.
5615 (Output_section_element_input::Output_section_element_input): Ditto.
5616 * testsuite/Makefile.am (final_layout): New test case.
5617 * testsuite/Makefile.in: Regenerate.
5618 * testsuite/final_layout.cc: New file.
5619 * testsuite/final_layout.sh: New file.
5621 2010-06-01 Rafael Espindola <espindola@google.com>
5623 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5625 2010-06-01 Rafael Espindola <espindola@google.com>
5627 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5628 visibility of symbols.
5630 2010-05-27 Doug Kwan <dougkwan@google.com>
5632 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5633 from start of output section instead of address for a local symbol
5634 in a merged or relaxed section when doing a relocatable link.
5636 2010-05-26 Rafael Espindola <espindola@google.com>
5639 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5640 adding sections the garbage collector removed.
5641 * gold/testsuite/Makefile.am: Add test.
5642 * gold/testsuite/Makefile.in: Regenerate.
5643 * gold/testsuite/plugin_test_7.sh: New.
5644 * gold/testsuite/plugin_test_7_1.c: New.
5645 * gold/testsuite/plugin_test_7_2.c: New.
5647 2010-05-26 Rafael Espindola <espindola@google.com>
5649 * script-sections.cc (Output_section_definition::set_section_addresses):
5650 Check for --section-start.
5652 2010-05-26 Doug Kwan <dougkwan@google.com>
5654 * arm.cc (Arm_scan_relocatable_relocs): New class.
5655 (Target_arm::relocate_special_relocatable): New method.
5656 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5657 (Arm_relocate_functions::thumb_branch_common): Same.
5658 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5659 instead of Default_scan_relocatable_relocs.
5660 * target-reloc.h (relocate_for_relocatable): Let target handle
5661 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5662 * target.h (Sized_target::relocate_special_relocatable): New method.
5664 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5666 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5668 2010-05-23 Doug Kwan <dougkwan@google.com>
5670 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5672 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5673 with a direct branch, not a conditional branch, to a stub.
5674 * merge.cc (Output_merge_base::record_input_section): New method
5676 (Output_merge_data::do_add_input_section): Record input section if
5677 keeps-input-sections flag is set.
5678 (Output_merge_string::do_add_input_section): Ditto.
5679 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5680 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5682 (Output_merge_base::keeps_input_sections,
5683 Output_merge_base::set_keeps_input_sections,
5684 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5686 (Output_merge_base::Input_sections): New type declaration.
5687 (Output_merge_base::input_sections_begin,
5688 Output_merge_base::input_sections_end,
5689 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5690 (Output_merge_base::bool keeps_input_sections_,
5691 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5692 Output_merge_base::input_sections_): New data members.
5693 (Output_merge_data::do_set_keeps_input_sections): New method
5695 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5696 * output.cc (Output_section::Input_section::relobj): Move method
5697 defintion from class declaration to here and handle merge sections.
5698 (Output_section::Input_section::shndx): Ditto.
5699 (Output_section::Output_section): Remove initializations of removed
5700 data members and initialize new data member LOOKUP_MAPS_.
5701 (Output_section::add_input_section): Set keeps-input-sections flag
5702 for a newly created merge output section as appropriate. Adjust code
5703 to use Output_section_lookup_maps class.
5704 (Output_section::add_relaxed_input_section): Adjst code for lookup
5705 maps code refactoring.
5706 (Output_section::add_merge_input_section): Add a new parameter
5707 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5708 class. If adding input section to a newly created merge output
5709 section fails, remove the new merge section.
5710 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5711 Adjust code for use of the Output_section_lookup_maps class.
5712 (Output_section::find_merge_section): Ditto.
5713 (Output_section::build_lookup_maps): New method defintion.
5714 (Output_section::find_relaxed_input_section): Adjust code to use
5715 Output_section_lookup_maps class.
5716 (Output_section::get_input_sections): Export merge sections. Adjust
5717 code to use Output_section_lookup_maps class.
5718 (Output_section:::add_script_input_section): Adjust code to use
5719 Output_section_lookup_maps class. Update lookup maps for merge
5721 (Output_section::discard_states): Use Output_section_lookup_maps.
5722 (Output_section::restore_states): Same.
5723 * output.h (Merge_section_properties): Move class defintion out of
5725 (Output_section_lookup_maps): New class.
5726 (Output_section::Input_section::is_merge_section): New method
5728 (Output_section::Input_section::relobj): Move defintion out of class
5729 defintion. Declare method only.
5730 (Output_section::Input_section::shndx): Ditto.
5731 (Output_section::Input_section::output_merge_base): New method defintion.
5732 (Output_section::Input_section::u2_.pomb): New union field.
5733 (Output_section::Merge_section_by_properties_map,
5734 Output_section::Output_section_data_by_input_section_map,
5735 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5737 (Output_section::add_merge_input_section): Add new parameter
5738 KEEPS_INPUT_SECTIONS.
5739 (Output_section::build_lookup_maps): New method declaration.
5740 (Output_section::merge_section_map_,
5741 Output_section::merge_section_by_properties_map_,
5742 Output_section::relaxed_input_section_map_,
5743 Output_section::is_relaxed_input_section_map_valid_): Remove data
5745 (Output_section::lookup_maps_): New data member.
5747 2010-05-21 Doug Kwan <dougkwan@google.com>
5750 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5751 avoid a compilation error.
5753 2010-05-19 Rafael Espindola <espindola@google.com>
5755 * script-sections.cc (Output_section_definition::allocate_to_segment):
5756 Update the phdrs_list even when the output section is NULL.
5757 * testsuite/Makefile.am: Add test.
5758 * testsuite/Makefile.in: Regenerate.
5759 * testsuite/script_test_9.cc: New.
5760 * testsuite/script_test_9.sh: New.
5761 * testsuite/script_test_9.t: New.
5763 2010-05-19 Doug Kwan <dougkwan@google.com>
5765 * arm.cc (Arm_input_section::original_size): New method.
5766 (Arm_input_section::do_addralign): Add a cast.
5767 (Arm_input_section::do_output_offset): Remove static cast.
5768 (Arm_input_section::original_addralign,
5769 Arm_input_section::original_size_): Change type to uint32_t.
5770 (Arm_input_section::init): Add safe casts for section alignment
5772 (Arm_input_section::set_final_data_size): Do not set address and
5773 offset of stub table.
5774 (Arm_output_section::fix_exidx_coverage): Change use of of
5775 Output_section::Simple_input_section to that of
5776 Output_section::Input_section.
5777 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5778 except for the first pass.
5779 * output.cc (Output_section::get_input_sections): Change type of
5780 input_sections to std::list<Input_section>.
5781 (Output_section::add_script_input_section): Rename from
5782 Output_section::add_simple_input_section. Change type of SIS
5783 parameter from Simple_input_section to Input_section.
5784 * output.h (Output_section::Simple_input_section): Remove class.
5785 (Output_section::Input_section): Change class visibility to public.
5786 (Output_section::Input_section::addralign): Use stored alignments
5787 for special input sections if set.
5788 (Output_section::Input_section::set_addralign): New method.
5789 (Output_section::get_input_sections): Change parameter type from
5790 list of Simple_input_section to list of Input_section.
5791 (Output_section::add_script_input_section): Rename from
5792 Output_section::add_simple_input_section. Change first parameter's
5793 type from Simple_input_section to Input_section and remove the
5794 second and third parameters.
5795 * script-sections.cc (Input_section::Input_section_list): Change
5796 type to list of Output_section::Input_section/
5797 (Input_section_info::Input_section_info): Change parameter type of
5798 INPUT_SECTION to Output_section::Input_section.
5799 (Input_section_info::input_section): Change return type.
5800 (Input_section_info::input_section_): Change type to
5801 Output_section::Input_section.
5802 (Output_section_element_input::set_section_addresses): Adjust code
5803 to use Output_section::Input_section instead of
5804 Output_section::Simple_input_section. Adjust code for renaming
5805 of Output_section::add_simple_input_section.
5806 (Orphan_output_section::set_section_addresses): Ditto.
5808 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5810 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5811 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5813 2010-05-18 Rafael Espindola <espindola@google.com>
5815 * options.cc (General_options::finalize): Handle -nostdlib.
5816 * options.h (nostdlib): New option.
5817 * script.cc (script_add_search_dir): Handle -nostdlib.
5819 2010-05-12 Doug Kwan <dougkwan@google.com>
5821 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5822 attributes section only if there no attributes section after merging.
5823 (Target_arm::merge_object_attributes): Move value of
5824 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5825 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5826 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5827 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5828 and arm_attr_merge_7.stdout.
5829 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5830 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5831 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5832 arm_attr_merge_7b.o): New rules.
5833 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5835 * testsuite/Makefile.in: Regenerate.
5836 * testsuite/arm_attr_merge.sh: New file.
5837 * testsuite/arm_attr_merge_[67][ab].s: Same.
5839 2010-05-05 Nick Clifton <nickc@redhat.com>
5841 * po/es.po: Updated Spanish translation.
5843 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5845 * Makefile.am (install-exec-local): Properly install gold as
5846 default cross linker.
5847 * Makefile.in: Regenerated.
5849 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5850 Nick Clifton <nickc@redhat.com>
5852 * configure.ac (install_as_default): Define and set to false
5853 unless --enable-gold or --enable-gold=both/gold has been
5855 * configure: Regenerate.
5857 * Makefile.am (install-exec-local): Install the executable as
5858 'ld.gold'. If install_as_default is true then also install it as
5860 * Makefile.in: Regenerated.
5862 2010-04-24 Ian Lance Taylor <iant@google.com>
5864 * layout.cc (Layout::layout_reloc): In relocatable link don't
5865 combine reloc sections for grouped sections.
5867 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5869 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5870 sections that are not ordinary to icf.
5871 * icf.cc (get_section_contents): Handle relocation pointing to section
5872 with no object or shndx information.
5873 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5874 * testsuite/Makefile.in: Regenerate.
5875 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5876 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5878 2010-04-22 Ian Lance Taylor <iant@google.com>
5880 * expression.cc (Expression::Expression_eval_info): Add
5881 result_alignment_pointer field.
5882 (Expression::eval_with_dot): Add result_alignment_pointer
5883 parameter. Change all callers.
5884 (Expression::eval_maybe_dot): Likewise.
5885 (class Binary_expression): Add alignment_pointer parameter to
5886 left_value and right_value. Change all callers.
5887 (BINARY_EXPRESSION): Set result alignment.
5888 (class Trinary_expression): Add alignment_pointer parameter to
5889 arg2_value and arg3_value. Change all callers.
5890 (Trinary_cond::value): Set result alignment.
5891 (Max_expression::value, Min_expression::value): Likewise.
5892 (Align_expression::value): Likewise.
5893 * script-sections.cc (class Sections_element): Add dot_alignment
5894 parameter to set_section_addresses virtual function. Update
5896 (class Output_section_element): Likewise.
5897 (Script_sections::create_segments): Add dot_alignment parameter.
5899 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5900 (Script_sections::set_phdrs_clause_addresses): Likewise.
5901 * script-sections.h: Update declarations.
5902 * script.h: Update declarations.
5903 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5905 * testsuite/script_test_3.t: Set large alignment.
5906 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5907 segment has expected alignment.
5909 2010-04-22 Nick Clifton <nickc@redhat.com>
5911 * po/gold.pot: Updated by the Translation project.
5912 * po/vi.po: Updated Vietnamese translation.
5914 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5916 * testsuite/Makefile.am (check_PROGRAMS): Add
5917 icf_virtual_function_folding_test.
5918 * testsuite/Makefile.in: Regenerated.
5920 2010-04-15 Andrew Haley <aph@redhat.com>
5922 * options.h (merge_exidx_entries): New option.
5923 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5924 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5925 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5926 (Target_arm::merge_exidx_entries): New function.
5927 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5928 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5929 to Arm_exidx_fixup constructor.
5930 Add new arg, merge_exidx_entries.
5931 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5932 Arm_output_section::fix_exidx_coverage.
5934 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5936 * icf.cc (get_section_contents): Check for preemptible functions.
5937 Ignore addend when appropriate.
5938 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5940 (add_from_relobj): Check for section folded.
5941 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5942 * symtab.h (should_add_dynsym_entry): Add new parameter.
5943 * target-reloc.h (scan_relocs): Check for section folded.
5944 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5945 Check reloc types for function pointers in shared objects.
5946 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5948 (icf_preemptible_functions_test): New test case.
5949 (icf_string_merge_test): New test case.
5950 * testsuite.Makefile.in: Regenerate.
5951 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5952 bar_glob. Refactor code.
5953 * testsuite/icf_preemptible_functions_test.cc: New file.
5954 * testsuite/icf_preemptible_functions_test.sh: New file.
5955 * testsuite/icf_string_merge_test.cc: New file.
5956 * testsuite/icf_string_merge_test.sh: New file.
5957 * testsuite/icf_virtual_function_folding_test.cc: New file.
5958 * testsuite/icf_virtual_function_folding_test.sh: New file.
5960 2010-04-14 Doug Kwan <dougkwan@google.com>
5962 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5963 for local symbol recounting if we remove a section due to ICF.
5964 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5965 there are no regular objects in input.
5967 2010-04-13 Doug Kwan <dougkwan@google.com>
5969 * arm.cc (Arm_input_section::set_final_data_size): Compute
5970 accurate final data size instead of using current data size.
5972 2010-04-09 Doug Kwan <dougkwan@google.com>
5974 * layout.cc (Layout::choose_output_section): Handle script section
5976 (Layout::make_output_section_for_script): Add section type parameter.
5977 Handle script section types.
5978 * layout.h (Layout::make_output_section_for_script): Add section
5980 * output.cc (Output_section::Output_section): Initialize data member
5982 (Output_section::do_reset_address_and_file_offset): Do not set address
5983 to 0 if section is a NOLOAD section.
5984 * output.h (Output_section::is_noload): New method.
5985 (Output_section::set_is_noload): Ditto.
5986 (Output_section::is_noload_): New data member.
5987 * script-c.h (Script_section_type): New enum type.
5988 (struct Parser_output_section_header): Add new file section_type.
5989 * script-sections.cc (Sections_element::output_section_name): Add
5990 parameter for returning script section type.
5991 (Output_section_definition::output_section_name): Ditto.
5992 (Output_section_definition::section_type)P; New method.
5993 (Output_section_definiton::script_section_type_name): Ditto.
5994 (Output_section_definition::script_section_type_): New data member.
5995 (Output_section_definition::Output_section_definition): Initialize
5996 data member Output_section_definition::script_section_type_.
5997 (Output_section_definition::create_sections): Pass script section type
5998 to Layout::make_output_section_for_script.
5999 (Output_section_definition::output_section_name): Return script
6000 section type to caller.
6001 (Output_section_definition::set_section_address): Do not advance
6002 dot value and load address if section type is NOLOAD. Set address
6003 of NOLOAD sections regardless of section flags.
6004 (Output_section_definition::print): Print section type if it is
6005 not SCRIPT_SECTION_TYPE_NONE.
6006 (Output_section_definition::section_type): New method.
6007 (Output_section_definition::script_section_type_name): Ditto.
6008 (Script_sections::output_section_name): Add new parameter
6009 PSECTION_TYPE for returning script section type. Pass it to
6010 section elements. Handle discard sections.
6011 (Sort_output_sections::operator()): Handle NOLOAD sections.
6012 * script-sections.h (Script_sections::Section_type): New enum type.
6013 (Script_sections::output_section_name): Add a new parameter for
6014 returning script section type.
6015 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6017 * yyscript.y (union): Add new field SECTION_TYPE.
6018 (COPY, DSECT, INFO, NOLOAD): New tokens.
6019 (opt_address_and_section_type): Change type to output_section_header.
6020 (section_type): New non-terminal
6021 (section_header): Handle section type.
6022 (opt_address_and_section_type): Return section type value.
6024 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6026 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6027 * testsuite/plugin_common_test_2.c (foo): Likewise.
6029 2010-04-08 Doug Kwan <dougkwan@google.com>
6031 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6033 * output.cc (Output_section::add_merge_input_section): Simplify
6034 code and return status of Output_merge_base::add_input_section.
6035 Update merge section map only if Output_merge_base::add_input_section
6038 2010-04-07 Doug Kwan <dougkwan@google.com>
6040 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6041 if section is marked as containing instructions but has no mapping
6043 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6044 correct section index.
6045 (Arm_relobj::find_linked_text_section): Ditto.
6047 2010-04-07 Cary Coutant <ccoutant@google.com>
6049 * archive.cc (include_member): Destroy Read_symbols_data object before
6051 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6052 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6053 (Read_symbols_data::~Read_symbols_data) New destructor.
6054 (Section_relocs::Section_relocs) New constructor.
6055 (Section_relocs::~Section_relocs) New destructor.
6056 (Read_relocs_data::Read_relocs_data) New constructor.
6057 (Read_relocs_data::~Read_relocs_data) New destructor.
6058 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6059 pointers to NULL after deleting.
6061 2010-04-07 Doug Kwan <dougkwan@google.com>
6063 * arm.cc: Replace "endianity" with "endianness" in comments.
6064 (Arm_exidx_cantunwind): Ditto.
6065 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6066 (Arm_relobj::merge_flags_and_attributes): New method.
6067 (Arm_relobj::merge_flags_and_attributes_): New data member.
6068 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6069 (Arm_relobj::scan_sections_for_stubs): Ditto.
6070 (Arm_relobj::do_read_symbols): Check to see if we really want to
6071 merge processor-specific flags and attributes. Exit early if
6072 an object is empty except for section names and the undefined symbol.
6073 (Target_arm::do_finalize_sections): Move check for ELF format to
6074 Arm_relobj::do_read_symbols. Merge processor specific flags and
6075 attributes from a regular object only when we have determined that
6076 it is aapropriate. Do not create an .ARM.attributes section in
6077 output if there is no regular input object.
6078 (Target_arm::merge_processor_specific_flags): Check
6079 --warn-mismatch before printing any error.
6080 (Target_arm::merge_object_attributes): Ditto.
6081 * gold.cc (queue_middle_tasks): Handle the case in which there is
6082 no regular object in input.
6083 * options.cc (General_options::parse_EB): New method.
6084 (General_options::parse_EL): Same.
6085 (General_options::General_options): Initialize endianness_.
6086 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6088 (General_options::Endianness): New enum.
6089 (General_options::endianness): New method.
6090 (General_options::endianness_): New data member.
6091 * parameters.cc (Parameters::set_options): Check target endianness.
6092 (Parameters::set_target_once): Ditto.
6093 (Parameters::check_target_endianness): New method.
6094 (parameters_force_valid_target): If either -EL or -EB is specified,
6095 use it to define endianness of default target.
6096 * parameters.h (Parameters::check_target_endianness): New method
6098 * target.h (class Target): Change "endianity" to "endianness"
6101 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6103 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6104 * configure: Regenerate.
6105 * Makefile.in: Regenerate.
6106 * testsuite/Makefile.in: Regenerate.
6108 2010-04-06 Cary Coutant <ccoutant@google.com>
6111 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6112 prevailing definitions of common symbols.
6113 * testsuite/plugin_test_6.sh: New test case.
6114 * testsuite/plugin_common_test_1.c: New test case.
6115 * testsuite/plugin_common_test_2.c: New test case.
6116 * testsuite/Makefile.am (plugin_test_6): New test case.
6117 * testsuite/Makefile.in: Regenerate.
6119 2010-04-06 Nick Clifton <nickc@redhat.com>
6121 * po/vi.po: New Vietnamese translation.
6123 2010-03-30 Doug Kwan <dougkwan@google.com>
6125 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6127 2010-03-25 Doug Kwan <dougkwan@google.com>
6129 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6130 to avoid a conversion warning on a 32-bit host.
6132 2010-03-24 Ian Lance Taylor <iant@google.com>
6134 * testsuite/script_test_3.t: Add a TLS segment.
6135 * testsuite/Makefile.am (check_PROGRAMS): Add
6136 tls_phdrs_script_test.
6137 (tls_phdrs_script_test_SOURCES): Define.
6138 (tls_phdrs_script_test_DEPENDENCIES): Define.
6139 (tls_phdrs_script_test_LDFLAGS): Define.
6140 (tls_phdrs_script_test_LDADD): Define.
6141 * testsuite/Makefile.in: Rebuild.
6143 2010-03-23 Cary Coutant <ccoutant@google.com>
6145 * fileread.cc (find_or_make_view): Fix comment.
6147 2010-03-23 Ian Lance Taylor <iant@google.com>
6149 * script-sections.cc (class Orphan_section_placement): Define
6150 PLACE_TLS and PLACE_TLS_BSS.
6151 (Orphan_section_placement::Orphan_section_placement): Initialize
6153 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6154 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6155 (tls_script_test_SOURCES): Define.
6156 (tls_script_test_DEPENDENCIES): Define.
6157 (tls_script_test_LDFLAGS): Define.
6158 (tls_script_test_LDADD): Define.
6159 * testsuite/Makefile.in: Rebuild.
6161 2010-03-22 Doug Kwan <dougkwan@google.com>
6163 * arm.cc (Arm_relocate_functions::abs8,
6164 Arm_relocate_functions::abs16): Use correct check for overflow
6165 specified in the ARM ELF specs.
6166 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6167 target of a BLX instruction specially.
6168 (Reloc_stub::stub_type_for_reloc): Ditto.
6169 (Relocate::relocate): Use symbolic names instead of numeric relocation
6170 codes to report error.
6171 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6173 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6174 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6175 thumb2_blx_out_of_range.stdout
6176 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6177 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6178 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6179 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6180 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6181 thumb2_blx_in_range, thumb2_blx_in_range.o,
6182 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6183 thumb2_blx_out_of_range.o): New rules.
6184 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6185 thumb2_blx_in_range and thumb2_blx_out_of_range.
6186 * testsuite/Makefile.in: Regenerate.
6187 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6188 * testsuite/thumb_blx_in_range.s: New file.
6189 * testsuite/thumb_blx_out_of_range.s: New file.
6191 2010-03-22 Rafael Espindola <espindola@google.com>
6193 * archive.cc (Should_include): Move to archive.h.
6194 (should_include_member): Make it a member of Archive.
6196 (Add_lib_group_symbols): New.
6197 * archive.h: Include options.h.
6198 (Archive_member): Moved from Archive.
6199 (Should_include): Moved from archive.cc.
6201 (Add_lib_group_symbols): New.
6202 * dynobj.cc (do_should_include_member): New.
6203 * dynobj.h (do_should_include_member): New.
6204 * gold.cc (queue_initial_tasks): Update call to queue.
6205 * main.cc (main): Print lib group stats.
6206 * object.cc (do_should_include_member): New.
6207 * object.h: Include archive.h.
6208 (Object::should_include_member): New.
6209 (Object::do_should_include_member): New.
6210 (Sized_relobj::do_should_include_member): New.
6211 * options.cc (General_options::parse_start_lib): New.
6212 (General_options::parse_end_lib): New.
6213 (Input_arguments::add_file): Handle lib groups.
6214 (Input_arguments::start_group): Check we are not in a lib.
6215 (Input_arguments::start_lib): New.
6216 (Input_arguments::end_lib): New.
6217 * options.h (General_options): Add start_lib and end_lib.
6218 (Input_argument::lib_): New.
6219 (Input_argument::lib): New.
6220 (Input_argument::is_lib): New.
6221 (Input_file_lib): New.
6222 (Input_arguments::in_lib_): New.
6223 (Input_arguments::in_lib): New.
6224 (Input_arguments::start_lib): New.
6225 (Input_arguments::end_lib_): New.
6226 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6227 in unused members as preempted.
6228 (Sized_pluginobj::do_should_include_member): New.
6229 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6230 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6232 (Read_symbols::do_whole_lib_group): New.
6233 (Read_symbols::do_lib_group): New.
6234 (Read_symbols::do_read_symbols): Handle lib groups.
6235 (Read_symbols::get_name): Handle lib groups.
6236 * readsyms.h (Read_symbols): Add an archive member pointer.
6237 (Read_symbols::do_whole_lib_group): New.
6238 (Read_symbols::do_lib_group): New.
6239 (Read_symbols::member_): New.
6240 * script.cc (read_input_script): Update call to queue_soon.
6242 2010-03-19 Doug Kwan <dougkwan@google.com>
6244 * arm.cc (Stub_table::Stub_table): Initialize new data members
6245 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6246 (Stub_table::add_reloc_stub): Assign stub offset and update
6247 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6248 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6250 (Stub_table::update_data_size_and_addralign): Use
6251 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6252 instead of going over all reloc stubs.
6253 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6254 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6255 Stringpool_template::offset_ to size of Stringpool_char.
6256 (Stringpool_template::new_key_offset): Remove code to initialize
6257 Stringpool_template::offset_.
6258 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6259 Stringpool_template::offset_ to zero.
6261 2010-03-15 Doug Kwan <dougkwan@google.com>
6263 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6265 (Stringpool_template::new_key_offset): New method.
6266 (Stringpool_template::add_string): Assign offsets when adding new
6268 (Stringpool_template::set_string_offsets): Do not set string offsets
6269 when not optimizing.
6270 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6272 (Chunked_vector::clear): Clear size_.
6273 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6274 (Chunked_vector::size): Return size_.
6275 (Chunked_vector::push_back): Use size_ to find insert position.
6276 (Chunked_vector::size_): New data member.
6277 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6278 (Stringpool_template::new_key_offset): New method declaration.
6279 (Stringpool_template::offset_): New data member.
6281 2010-03-15 Rafael Espindola <espindola@google.com>
6283 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6284 Add_symbols' constructor.
6285 * readsyms.h (Add_symbols): Remove the input_group member.
6287 2010-03-10 Ian Lance Taylor <iant@google.com>
6289 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6290 target to ask whether a reference to a symbol requires a stack
6292 * target.h (Target::is_call_to_non_split): New function.
6293 (Target::do_is_call_to_non_split): Declare virtual function.
6294 * target.cc: Include "symtab.h".
6295 (Target::do_is_call_to_non_split): New function.
6296 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6298 2010-03-10 Cary Coutant <ccoutant@google.com>
6300 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6301 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6302 (File_read::open[2]): Add whole_file_view_ to list of views.
6303 (File_read::make_view): Remove test of whole_file_view_.
6304 (File_read::find_or_make_view): Create whole_file_view_ if
6306 (File_read::clear_views): Replace bool parameter with enum;
6307 adjust all callers. Don't delete views with permanent data;
6308 do delete cached views and views from archives if
6309 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6310 if clearing the corresponding view.
6311 * fileread.h (File_read::Clear_views_mode): New enum.
6312 (File_read::View::is_permanent_view): New method.
6313 (File_read::clear_views): Replace bool parameter
6314 with enum; adjust all callers.
6315 * options.h (General_options): Change keep_files_mapped option;
6316 add map_whole_files.
6317 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6319 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6322 2010-03-10 David S. Miller <davem@davemloft.net>
6324 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6326 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6328 * icf.cc (get_section_contents): Add '@' marker after processing the
6331 2010-03-08 Doug Kwan <dougkwan@google.com>
6333 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6334 due to a conversion warning.
6335 (Arm_relobj::update_output_local_symbol_count): Check for local
6336 symbol with unset output index.
6338 2010-03-05 Ian Lance Taylor <iant@google.com>
6340 * options.h (class General_options): Add --spare-dynamic-tags.
6341 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6342 --spare-dynamic-tags.
6344 2010-03-05 Ian Lance Taylor <iant@google.com>
6346 * incremental.cc: Include "libiberty.h".
6348 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6350 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6351 function, is_info_ member.
6352 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6353 (Versions::Versions): Update caller.
6354 (Versions::define_base_version): Likewise.
6355 (Versions::add_def): Likewise.
6357 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6359 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6360 (Scan::possible_function_pointer_reloc): New function.
6361 (Scan::local_reloc_may_be_function_pointer): Change to call
6362 possible_function_pointer_reloc.
6363 (Scan::global_reloc_may_be_function_pointer): Ditto.
6364 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6365 relocations in ".data.rel.ro._ZTV" section.
6366 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6367 * testsuite/icf_safe_so_test.cc: Ditto.
6368 * testsuite/icf_safe_test.cc: Ditto.
6369 * testsuite/icf_safe_test.sh: Ditto.
6371 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6372 Ian Lance Taylor <iant@google.com>
6374 * target-reloc.h (relocate_section): Check the symbol table index
6375 for -1U before setting the local symbol index.
6376 (scan_relocatable_relocs): If copying the relocation, record that
6377 the local symbol is required.
6378 * object.h (Symbol_value::is_output_symtab_index_set): New
6380 (Symbol_value::may_be_discarded_from_output_symtab): New
6382 (Symbol_value::has_output_symtab_entry): New function.
6383 (Symbol_value::needs_output_symtab_entry): Remove.
6384 (Symbol_value::output_symtab_index): Make sure the symbol index is
6386 (Symbol_value::set_output_symtab_index): Make sure the symbol
6387 index is not set. Make sure the new index is valid.
6388 (Symbol_value::set_must_have_output_symtab_entry): New function.
6389 (Symbol_value::has_output_dynsym_entry): New function.
6390 (Symbol_value::set_output_dynsym_index): Make sure the new index
6392 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6393 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6394 local symbol if permitted.
6395 (Sized_relobj::do_finalize_local_symbols): Call
6396 is_output_symtab_index_set rather than needs_output_symtab_entry.
6397 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6398 rather than needs_output_symtab_entry. Call
6399 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6400 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6401 is_output_symtab_index_set rather than needs_output_symtab_entry.
6402 * testsuite/discard_locals_relocatable_test.c: New file.
6403 * testsuite/discard_locals_test.sh: Test -r.
6404 * testsuite/Makefile.am (check_DATA): Add
6405 discard_locals_relocatable_test1.syms,
6406 discard_local_relocatable_test2.syms.
6407 (MOSTLYCLEANFILES): Likewise. Also add
6408 discard_locals_relocatable_test1.lout and
6409 discard_locals_relocatable_test2.out.
6410 (discard_locals_relocatable_test1.syms): New target.
6411 (discard_locals_relocatable_test.o): New target.
6412 (discard_locals_relocatable_test1.out): New target.
6413 (discard_locals_relocatable_test2.syms): New target.
6414 (discard_locals_relocatable_test2.out): New target.
6415 (various): Add missing ../ld-new dependencies.
6416 * testsuite/Makefile.in: Rebuild.
6418 2010-03-03 Nick Clifton <nickc@redhat.com>
6420 * po/fi.po: New Finnish translation.
6422 2010-03-01 Doug Kwan <dougkwan@google.com>
6424 * layout.cc (Layout::Layout): Force section types of .init_array*,
6425 .preinit_array* and .fini_array* sections.
6426 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6427 Fix check of return value of std::string::find.().
6428 (Output_section::Input_section_sort_compare::operator()): Remove
6429 comment about .init_array.
6430 (Output_section::Input_section_sort_init_fini_compare::operator()):
6432 (Output_section::sort_attached_input_sections): Handle .init_array
6433 and .fini_array specially.
6434 * output.h (Output_section::Inut_section_sort_compare): Update
6436 (Output_section::Input_section_sort_init_fini_compare): New struct.
6438 2010-02-26 Doug Kwan <dougkwan@google.com>
6440 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6441 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6442 * testsuite/debug_msg.sh: Avoid matching source line number for
6443 use of global variable undef_int.
6445 2010-02-26 Doug Kwan <dougkwan@google.com>
6447 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6448 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6449 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6450 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6451 * options.cc (General_options::General_options): Initialize member
6453 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6454 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6455 and rm_no_fix_v4bx.stdout
6456 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6457 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6458 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6459 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6460 and arm_no_fix_v4bx.
6461 * Makefile.in: Regenerate.
6462 * testsuite/arm_fix_v4bx.s: New file.
6463 * testsuite/arm_fix_v4bx.sh: Ditto.
6465 2010-02-24 Doug Kwan <dougkwan@google.com>
6467 * arm.cc (Target_arm::got_section): Make the .got section the first
6468 non RELRO section in the data segment.
6469 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6470 suffixes of section names.
6472 2010-02-24 Doug Kwan <dougkwan@google.com>
6474 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6475 flags and attributes merging if an input file is a binary file.
6476 * fileread.cc (Input_file::open): Record format of original file.
6477 * fileread.h (Input_file::Format): New enum type.
6478 (Input_file::Input_file): Initialize data member format_.
6479 (Input_file::format): New method definition.
6480 (Input_file::format_):: New data member.
6482 2010-02-24 Doug Kwan <dougkwan@google.com>
6484 * arm.cc (Arm_output_data_got): New class.
6485 (ARM_TCB_SIZE): New constant
6486 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6487 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6488 If user uses a script with a SECTIONS clause, issue only a warning
6489 for a misplaced EXIDX input section. Otherwise, issue an error.
6490 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6492 (Target_arm::got_mode_index_entry): Handle static linking.
6493 (Target_arm::Scan::local): Ditto.
6494 (Target_arm::Scan::global): Ditto.
6495 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6496 all incorrectly implemented relocations.
6497 (Target_arm::fix_exidx_coverage): Pass layout to
6498 Arm_output_section::fix_exidx_coverage.
6499 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6500 from ".ARM.exidx." and ".ARM.extab.".
6502 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6504 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6505 section if it does not already exist.
6506 * attributes.cc (Attributes_section_data::Attributes_section_data):
6507 Don't crash if size is zero.
6509 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6510 Ian Lance Taylor <iant@google.com>
6512 * gold.cc (queue_middle_tasks): If no input files were opened,
6514 * workqueue.h (Task_function::Task_function): Assert that there is
6517 2010-02-22 Doug Kwan <dougkwan@google.com>
6519 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6520 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6521 types to avoid warnings due to different uint64_t implementations
6524 2010-02-21 Doug Kwan <dougkwan@google.com>
6526 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6527 handling of the maximum backward branch offset.
6528 (Arm_relocate_functions::thumb_branch_common): Ditto.
6529 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6530 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6531 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6532 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6533 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6534 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6535 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6536 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6537 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6538 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6539 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6540 thumb2_bl_out_of_range.o): New rules.
6541 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6542 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6543 thumb2_bl_out_of_range
6544 * testsuite/Makefile.in: Regenerate.
6545 * testsuite/arm_bl_in_range.s: New file.
6546 * testsuite/arm_bl_out_of_range.s: Ditto.
6547 * testsuite/arm_branch_in_range.sh: Ditto.
6548 * testsuite/arm_branch_range.t: Ditto.
6549 * testsuite/thumb2_branch_range.t: Ditto.
6550 * testsuite/thumb_bl_in_range.s: Ditto.
6551 * testsuite/thumb_bl_out_of_range.s: Ditto.
6552 * testsuite/thumb_branch_range.t: Ditto.
6554 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6556 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6557 Add reloc offset information.
6558 * icf.cc (get_section_contents): Change iterators to point to the new
6559 vectors. Add reloc offset information to the contents.
6560 * icf.h (Icf::Sections_reachable_info): New typedef.
6561 (Icf::Sections_reachable_list): New typedef.
6562 (Icf::Offset_info): New typedef.
6563 (Icf::Reloc_info): New struct typedef.
6564 (Icf::Reloc_info_list): New typedef.
6565 (Icf::symbol_reloc_list): Delete method.
6566 (Icf::addend_reloc_list): Delete method.
6567 (Icf::section_reloc_list): Delete method.
6568 (Icf::reloc_info_list): New method.
6569 (Icf::reloc_info_list_): New member.
6571 2010-02-19 Doug Kwan <dougkwan@google.com>
6573 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6574 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6575 * arm.cc (Arm_relocation_functions): New forward declaration.
6576 (Target_arm::Target_arm): Initialize new data members
6577 got_mod_index_offset_ and tls_base_symbol_defined_.
6578 (Target_arm::Relocate::relocate_tls): New method.
6579 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6580 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6582 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6583 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6584 (Target_arm::got_mod_index_offset_,
6585 Target_arm::tls_base_symbol_defined_): New data members.
6586 (Target_arm::Scan::local, Target::Scan::global,
6587 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6590 2010-02-18 Doug Kwan <dougkwan@google.com>
6592 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6593 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6594 text section as a parameter becuase some broken tools may not set
6595 the link in section header.
6596 (Target_arm::has_got_section): New method.
6597 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6598 without any mapping symbol as data only. Remove warning.
6599 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6600 link in its section header, try to discover the link by inspecting the
6601 REL31 relocation at the beginning of the section.
6602 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6604 (Target_arm::Scan::global): Treat any reference to the symbol
6605 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6607 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6609 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6610 (Scan::global_reloc_may_be_function_pointer): New function.
6611 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6612 (Scan::global_reloc_may_be_function_pointer): New function.
6613 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6614 (Scan::global_reloc_may_be_function_pointer): New function.
6615 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6616 (Scan::global_reloc_may_be_function_pointer): New function.
6617 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6618 (Scan::global_reloc_may_be_function_pointer): New function.
6619 (Scan::possible_function_pointer_reloc): New function.
6620 (Target_x86_64::can_check_for_function_pointers): New function.
6621 * gc.h (gc_process_relocs): Scan relocation types to determine if
6622 function pointers were taken for targets that support it.
6623 * icf.cc (Icf::find_identical_sections): Include functions for
6624 folding in safe ICF whose pointer is not taken.
6625 * icf.h (Secn_fptr_taken_set): New typedef.
6626 (fptr_section_id_): New member.
6627 (section_has_function_pointers): New function.
6628 (set_section_has_function_pointers): New function.
6629 (check_section_for_function_pointers): New function.
6630 * options.h: Fix comment for safe ICF option.
6631 * target.h (can_check_for_function_pointers): New function.
6632 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6633 Modify icf_safe_test for X86-64.
6634 * testsuite/Makefile.in: Regenerate.
6635 * testsuite/icf_safe_so_test.cc: New file.
6636 * testsuite/icf_safe_so_test.sh: New file.
6637 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6638 (main): Change to take pointer to function kept_func_3.
6639 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6640 folding is done correctly for X86-64.
6642 2010-02-12 David S. Miller <davem@davemloft.net>
6644 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6645 is_symbolless parameter.
6646 (Output_reloc<SHT_REL>::is_symbolless): New.
6647 (Output_reloc<SHT_REL>::is_symbolless_): New.
6648 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6649 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6650 (Output_reloc<SHT_RELA>::is_symbolless): New.
6651 (Output_data_reloc::add_global): Handle is_symbolless.
6652 (Output_data_reloc::add_global_relative): Likewise.
6653 (Output_data_reloc::add_local): Likewise.
6654 (Output_data_reloc::add_local_relative): Likewise.
6655 (Output_data_reloc::add_symbolless_global_addend): New.
6656 (Output_data_reloc::add_symbolless_local_addend): New.
6657 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6659 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6660 instead of ->is_relative_
6661 (Output_reloc::write): Likewise.
6662 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6663 (Output_reloc::write_rel): Simplify.
6665 * sparc.cc (Target_sparc::Scan::local): Use
6666 ->add_symbolless_local_addend as needed.
6667 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6668 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6669 based upon relocation offset.
6671 2010-02-11 Doug Kwan <dougkwan@google.com>
6673 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6674 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6675 beginning of function.
6676 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6677 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6678 parameter is_32bit in calls to should_apply_static_reloc.
6679 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6680 (check_DATA): Add arm_abs_global.stdout.
6681 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6682 arm_abs_global.stdout): New rules.
6683 (MOSTLLYCLEANFILES): Add arm_abs_global
6684 * Makefile.in: Regenerate.
6685 * testsuite/arm_abs_global.s: New file.
6686 * testsuite/arm_abs_global.sh: Ditto.
6687 * testsuite/arm_abs_lib.s: Ditto.
6689 2010-02-11 Ian Lance Taylor <iant@google.com>
6691 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6693 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6694 Allocate_commons_task first.
6695 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6696 task, rather than symtab_lock_.
6697 (Gc_process_relocs::~Gc_process_relocs): New function.
6698 (Gc_process_relocs::is_runnable): Check this_blocker_.
6699 (Gc_process_relocs::locks): Use next_blocker_ rather than
6701 (Scan_relocs::~Scan_relocs): New function.
6702 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6704 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6706 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6707 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6708 constructor accordingly.
6709 (class Gc_process_relocs): Likewise.
6710 (class Scan_relocs): Likewise.
6711 * common.h (class Allocate_commons_task): Remove symtab_lock_
6712 field, and corresponding constructor parameter.
6713 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6715 (Allocate_commons_task::locks): Likewise.
6717 2010-02-11 Ian Lance Taylor <iant@google.com>
6719 * gold-threads.h (class Once): Define.
6720 (class Initialize_lock): Rewrite as child of Once.
6721 * gold-threads.cc (class Once_initialize): Define.
6722 (once_pointer_control): New static variable.
6723 (once_pointer, once_arg): New static variables.
6724 (c_run_once): New static function.
6725 (Once::Once, Once::run_once, Once::internal_run): New functions.
6726 (class Initialize_lock_once): Remove.
6727 (initialize_lock_control): Remove.
6728 (initialize_lock_pointer): Remove.
6729 (initialize_lock_once): Remove.
6730 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6731 (Initialize_lock::initialize): Rewrite.
6732 (Initialize_lock::do_run_once): New function.
6733 * archive.cc (Archive::interpret_header): Only clear name if it is
6735 * fileread.cc: Include "gold-threads.h"
6736 (file_counts_lock): New static variable.
6737 (file_counts_initialize_lock): Likewise.
6738 (File_read::release): Only increment counts when using --stats.
6739 Use a lock around the increment.
6740 * parameters.cc (class Set_parameters_target_once): Define.
6741 (set_parameters_target_once): New static variable.
6742 (Parameters::Parameters): Move here from parameters.h.
6743 (Parameters::set_target): Rewrite.
6744 (Parameters::set_target_once): New function.
6745 (Parameters::clear_target): Move here and rewrite.
6746 * parameters.h (class Parameters): Update declarations. Add
6747 set_parameters_target_once_ field.
6748 (Parameters::Parameters): Move to parameters.cc.
6749 (Parameters::clear_target): Likewise.
6750 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6752 (Start_group::~Start_group): New function.
6753 (Start_group::is_runnable): New function.
6754 (Start_group::locks, Start_group::run): New functions.
6755 (Finish_group::run): Change saw_undefined to size_t.
6756 * readsyms.h (class Start_group): Define.
6757 (class Finish_group): Change saw_undefined_ field to size_t.
6758 (Finish_group::Finish_group): Remove saw_undefined and
6759 this_blocker parameters. Change all callers.
6760 (Finish_group::set_saw_undefined): New function.
6761 (Finish_group::set_blocker): New function.
6762 * symtab.h (class Symbol_table): Change saw_undefined to return
6763 size_t. Change saw_undefined_ field to size_t.
6764 * target-select.cc (Set_target_once::do_run_once): New function.
6765 (Target_selector::Target_selector): Initialize set_target_once_
6766 field. Don't initialize lock_ and initialize_lock_ fields.
6767 (Target_selector::instantiate_target): Rewrite.
6768 (Target_selector::set_target): New function.
6769 * target-select.h (class Set_target_once): Define.
6770 (class Target_selector): Update declarations. Make
6771 Set_target_once a friend. Remove lock_ and initialize_lock_
6772 fields. Add set_target_once_ field.
6774 2010-02-10 Ian Lance Taylor <iant@google.com>
6776 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6778 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6779 (queue_middle_tasks): Add all blockers before queueing any tasks.
6780 (queue_final_tasks): Likewise.
6781 * token.h (Task_token::add_blockers): New function.
6782 * object.h (Input_objects::number_of_relobjs): New function.
6784 2010-02-10 Ian Lance Taylor <iant@google.com>
6786 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6787 shared, not if not position independent.
6788 * x86_64.cc (Relocate::relocate_tls): Likewise.
6789 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6790 (tls_pie_pic_test): New target.
6791 * testsuite/Makefile.in: Rebuild.
6793 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6794 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6795 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6796 * testsuite/Makefile.in: Rebuild.
6798 2010-02-09 David S. Miller <davem@davemloft.net>
6800 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6801 R_SPARC_RELATIVE using ->add_local_relative().
6802 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6804 * output.h (Output_data_dynamic::add_section_size): New method
6805 that takes two Output_data objects.
6806 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6807 entry param. Handle it in initializers.
6808 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6809 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6810 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6812 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6813 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6814 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6815 for dynrel_includes_plt.
6816 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6817 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6818 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6820 (Target_sparc::do_finalize_sections): Update to pass true for
6821 dynrel_includes_plt.
6822 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6823 output before .rela.plt
6824 (Target_powerpc::do_finalize_sections): Update to pass true for
6825 dynrel_includes_plt when 32-bit.
6827 2010-02-08 Doug Kwan <dougkwan@google.com>
6829 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6831 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6832 Arm_relobj::scan_section_for_cortex_a8_stubs,
6833 Arm_relobj::do_relocation_section): Instead of calling
6834 Output_section::output_address, use faster
6835 Arm_relobj::simple_input_section_output_address.
6837 2010-02-08 David S. Miller <davem@davemloft.net>
6839 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6840 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6841 relocation helper function.
6843 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6844 just like R_SPARC_GOT{10,13,22}.
6845 (Target_sparc::Scan::local): Likewise.
6846 (Target_sparc::Relocate:relocate): Likewise.
6848 2010-02-06 Ian Lance Taylor <iant@google.com>
6850 * configure.ac: Rewrite targetobjs duplicate removal code to use
6851 only shell constructs.
6852 * configure: Rebuild.
6854 2010-02-05 Doug Kwan <dougkwan@google.com>
6857 * arm.cc (Arm_relobj::section_is_scannable): New method.
6858 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6859 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6861 2010-02-04 Doug Kwan <dougkwan@google.com>
6864 * arm-reloc-property.cc (cstdio): Include.
6865 * configure.ac (targetobjs): Remove duplicates.
6866 * configure: Regenerate.
6867 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6868 big and little endian version for a given address size.
6870 2010-02-03 Doug Kwan <dougkwan@google.com>
6872 * arm-reloc-property.cc
6873 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6875 * arm-reloc-property.h
6876 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6877 New method definition.
6878 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6880 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6882 (GOT_PREL): Change implemented to Y.
6883 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6884 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6885 (Arm_relocate_functions::movw_abs_nc): Remove method.
6886 (Arm_relocate_functions::movt_abs): Ditto.
6887 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6888 (Arm_relocate_functions::thm_movt_abs): Ditto.
6889 (Arm_relocate_functions::movw_rel_nc): Ditto.
6890 (Arm_relocate_functions::movw_rel): Ditto.
6891 (Arm_relocate_functions::movt_rel): Ditto.
6892 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6893 (Arm_relocate_functions:thm_movw_rel): Ditto.
6894 (Arm_relocate_functions:thm_movt_rel): Ditto.
6895 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6896 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6897 New method definitions.
6898 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6899 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6900 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6901 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6902 (Target_arm::Relocate::relocate): Check for non-static or
6903 unimplemented relocation code and exit early. Change calls to
6904 Target_arm::reloc_uses_thumb_bit and
6905 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6906 instead. Refactor code to handle similar relocations to increase
6907 code sharing. Remove check for unsupported relocation code in switch
6909 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6910 relocation property table to find out size. Change error message to
6911 print out the name of a relocation code instead of the numeric value.
6912 (Target_arm::scan_reloc_for_stub): Use relocation property table
6913 instead of calling Target_arm::reloc_uses_thumb_bit().
6915 2010-02-02 Doug Kwan <dougkwan@google.com>
6917 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6918 types of relaxed input section.
6920 2010-02-02 Doug Kwan <dougkwan@google.com>
6922 * Makefile.am (HFILES): Add arm-reloc-property.h.
6924 (TARGETSOURCES): Add arm-reloc-property.cc
6925 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6926 (libgold_a_SOURCES): $(DEFFILES)
6927 * Makefile.in: Regenerate.
6928 * arm-reloc-property.cc: New file.
6929 * arm-reloc-property.h: New file.
6930 * arm-reloc.def: New file.
6931 * arm.cc: Update comments.
6932 (arm-reloc-property.h): New included header.
6933 (arm_reloc_property_table): New global variable.
6934 (Target_arm::do_select_as_default_target): New method definition.
6935 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6936 arm-reloc-property to targ_extra_obj.
6937 * parameters.cc (set_parameters_target): Call
6938 Target::select_as_default_target().
6939 * target.h (Target::select_as_default_target): New method definition.
6940 (Target::do_select_as_default_target): Same.
6942 2010-02-01 Doug Kwan <dougkwan@google.com>
6944 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6945 first_output_text_section_.
6946 (Arm_exidx_fixup::first_output_text_section): New method definition.
6947 (Arm_exidx_fixup::first_output_text_section_): New data member.
6948 (Arm_exidx_fixup::process_exidx_section): Record the first text
6949 output section seen.
6950 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6951 and entsize in output section header.
6953 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6955 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6956 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6957 (Arm_relocate_functions::thm_alu11): New Method.
6958 (Arm_relocate_functions::thm_pc8): New Method.
6959 (Arm_relocate_functions::thm_pc12): New Method.
6960 (Target_arm::Scan::local): Handle the relocations.
6961 (Target_arm::Scan::global): Likewise.
6962 (Target_arm::Relocate::relocate): Likewise.
6963 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6965 2010-01-29 Doug Kwan <dougkwan@google.com>
6967 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6968 of relocation types as ld.
6970 2010-01-29 Doug Kwan <dougkwan@google.com>
6972 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6974 (Arm_relocate_functions::thumb_branch_common): Ditto.
6975 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6976 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6977 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6978 Arm_relocate_functions::jump24): Remove.
6979 (Target_arm::Relocate::relocate): Adjust code to call
6980 Arm_relocation_functions::arm_branch_common and
6981 Arm_relocation_functions::thumb_branch_common instead of their removed
6982 wrappers. Merge switch-cases together to reduce source code size.
6984 2010-01-29 Doug Kwan <dougkwan@google.com>
6986 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6987 output_local_symbol_count_needs_update_.
6988 (Arm_relobj::output_local_symbol_count_needs_update,
6989 Arm_relobj::set_output_local_symbol_count_needs_update,
6990 Arm_relobj::update_output_local_symbol_count): New methods.
6991 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6993 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6994 of pointed function as in a R_ARM_PREL31 relocation.
6995 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6996 for output local symbol count updating.
6997 (Target_arm::do_relax): Update output local symbol counts in objects
6999 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7001 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7003 * arm.cc: Added support for the ARM relocations:
7004 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7005 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7006 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7008 (Arm_relocate_functions::movw_rel): New method.
7009 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7010 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7012 (Arm_relocate_functions::thm_movw_rel): New method.
7013 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7015 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7017 (Target_arm::Scan::global): Likewise.
7018 (Target_arm::Relocate::relocate): Likewise.
7019 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7022 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7024 * arm.cc: Added support for ARM group relocations.
7025 (Target_arm::reloc_needs_sym_origin): New method.
7026 (Arm_relocate_functions::calc_grp_kn): New method.
7027 (Arm_relocate_functions::calc_grp_residual): New method.
7028 (Arm_relocate_functions::calc_grp_gn): New method.
7029 (Arm_relocate_functions::arm_grp_alu): New Method.
7030 (Arm_relocate_functions::arm_grp_ldr): New Method.
7031 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7032 (Arm_relocate_functions::arm_grp_ldc): New Method.
7033 (Target_arm::Scan::local): Handle the ARM group relocations.
7034 (Target_arm::Scan::global): Likewise.
7035 (Target_arm::Relocate::relocate): Likewise.
7036 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7039 2010-01-26 Doug Kwan <dougkwan@google.com>
7041 * arm.cc (set): Include.
7042 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7044 (Arm_output_section::Text_section_list): New type.
7045 (Arm_output_section::append_text_sections_to_list): New method.
7046 (Arm_output_section::fix_exidx_coverage): Ditto.
7047 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7048 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7049 Relobj::set_section_offset() instead of
7050 Sized_relobj::invalidate_section_offset().
7051 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7052 parameter for section headers. Ignore relocation sections for
7053 unallocated sections and EXIDX sections.
7054 (Target_arm::fix_exidx_coverage): New method.
7055 (Target_arm::output_section_address_less_than): New type.
7056 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7057 linked text section instead of the EXIDX section.
7058 (Arm_output_section::create_stub_group): Add an assertion to check
7059 that this is not an EXIDX output section.
7060 (Arm_output_section::append_text_sections_to_list): New method.
7061 (Arm_output_section::fix_exidx_coverage): Ditto.
7062 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7063 Arm_relobj::section_needs_reloc_stub_scanning.
7064 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7066 (Target_arm::fix_exidx_coverage): New method.
7067 * object.h (Relobj::set_output_section): New method.
7068 (Sized_relobj::invalidate_section_offset): Remove method.
7069 (Sized_relobj::do_invalidate_section_offset): Remove method.
7070 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7072 2010-01-25 Doug Kwan <dougkwan@google.com>
7074 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7075 Fix warning due to signed and unsigned comparison on a 32-bit host.
7077 2010-01-22 Doug Kwan <dougkwan@google.com>
7079 * arm.cc (Target_arm::do_relax): Record an output section for section
7080 offset adjustment it contains any stub table that has changed.
7081 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7082 offsets in an output section if necessary.
7083 * output.cc (Output_section::Output_section): Initialize
7084 section_offsets_need_adjustments_.
7085 (Output_section::add_input_section_for_script): Renamed to
7086 Output_section::add_simple_input_section.
7087 (Output_section::save_states): Add a comment.
7088 (Output_section::discard_states): New method defintion.
7089 (Output_section::adjust_section_offsets): Same.
7090 * output.h (Output_section::add_input_section_for_script): Renamed to
7091 Output_section::add_simple_input_section.
7092 (Output_section::discard_states): New method declaration.
7093 (Output_section::adjust_section_offsets): Same.
7094 (Output_section::section_offsets_need_adjustment,
7095 Output_section::set_section_offsets_need_adjustment): New method
7097 (Output_section::section_offsets_need_adjustment_): New data member.
7098 * script-sections.cc
7099 (Output_section_element_input::set_section_address): Adjust code for
7100 renaming of Output_section::add_input_section_for_script.
7101 (Orphan_output_section::set_section_address): Same.
7103 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7105 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7106 Fix_v4bx enum values .
7107 * gold/options.h (General_options): New option definitions.
7108 (General_options::fix_v4bx): New method.
7109 (General_options::Fix_v4bx): New enum.
7110 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7111 (General_options::parse_fix_v4bx_interworking): New method.
7113 2010-01-22 Doug Kwan <dougkwan@google.com>
7115 * arm.cc (Arm_exidx_fixup): New class.
7117 2010-01-21 Doug Kwan <dougkwan@google.com>
7119 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7121 (Arm_exidx_section_offset_map): New type.
7123 2010-01-21 Doug Kwan <dougkwan@google.com>
7125 * arm.cc (Arm_exidx_input_section): New class.
7126 (Arm_relobj::exidx_input_section_by_link,
7127 Arm_relobj::exidx_input_section_by_shndx,
7128 Arm_relobj::make_exidx_input_section): New methods.
7129 (read_arm_attributes_section): Remove.
7130 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7131 information about them.
7132 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7135 2010-01-20 Doug Kwan <dougkwan@google.com>
7137 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7138 Input_section_specifier to Section_id.
7139 (Target_arm::new_arm_input_section: Adjust code for change of key
7141 (Target_arm::find_arm_input_section): Ditto.
7142 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7143 (Section_id): Remove.
7144 (Garbage_collection::Section_id_hash): Remove.
7145 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7146 (Section_id): Remove.
7147 (Icf::Section_id_hash): Remove.
7148 * object.h (Section_id, Const_section_id, Section_id_hash,
7149 Const_section_id_hash): New type definitions.
7150 * output.cc (Output_section::add_relaxed_input_section): Change to
7151 use Const_section_id instead of Input_section_specifier as key type.
7152 (Output_section::add_merge_input_section): Ditto.
7153 (Output_section::build_relaxation_map): Change to use Section_id
7154 instead of Input_section_specifier as key type.
7155 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7157 (Output_section::convert_input_sections_to_relaxed_sections): Change
7158 to use Const_section_id instead of Input_section_specifier as key type.
7159 (Output_section::find_merge_section): Ditto.
7160 (Output_section::find_relaxed_input_section): Ditto.
7161 * output.h (Input_section_specifier): Remove class.
7162 (Output_section::Output_section_data_by_input_section_map): Change
7163 key type to Const_section_id.
7164 (Output_section::Output_relaxed_input_section_by_input_section_map):
7166 (Output_section::Relaxation_map): Change key type to Section_id.
7168 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7170 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7171 (class Arm_v4bx_stub): New class.
7172 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7173 (Stub_factory::make_arm_v4bx_stub): New method.
7174 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7175 (Stub_table::empty): Handle v4bx stubs.
7176 (Stub_table::add_arm_v4bx_stub): New method.
7177 (Stub_table::find_arm_v4bx_stub): New method.
7178 (Arm_relocate_functions::v4bx): New method.
7179 (Target_arm::fix_v4bx): New method.
7180 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7181 (Stub_table::relocate_stubs): Likewise.
7182 (Stub_table::do_write): Likewise.
7183 (Stub_table::update_data_size_and_addralign): Likewise.
7184 (Stub_table::finalize_stubs): Likewise.
7185 (Target_arm::Scan::local): Likewise.
7186 (Target_arm::Scan::global): Likewise.
7187 (Target_arm::do_finalize_sections): Likewise.
7188 (Target_arm::Relocate::relocate): Likewise.
7189 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7191 (Target_arm::scan_reloc_for_stub): Likewise.
7192 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7194 2010-01-19 Ian Lance Taylor <iant@google.com>
7196 * output.cc (Output_section_headers::do_sized_write): Write large
7197 segment count to sh_info field.
7198 (Output_file_header::do_sized_write): For large segment count,
7199 write PN_XNUM to e_phnum field.
7201 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7203 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7204 (Arm_relocate_functions::thm_jump8): New function.
7205 (Arm_relocate_functions::thm_jump11): New function.
7206 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7208 (Target_arm::Scan::global): Likewise.
7209 (Target_arm::Relocate::relocate): Likewise.
7210 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7213 2010-01-14 Doug Kwan <dougkwan@google.com>
7215 * arm.cc (map, utility): Include headers.
7216 (Target_arm::apply_cortex_a8_workaround): New method.
7217 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7218 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7219 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7220 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7221 the --[no-]fix-cortex-a8 command line options.
7222 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7223 (Target_arm::relocate_stub): Use addend in instruction template.
7224 * options.h (DEFINE_bool): Set the user-set flag.
7225 (General_options): Add --[no-]-fix-cortex options.
7226 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7227 : Update fast look-up map after conversion.
7229 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7231 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7232 in the first pass of do_layout.
7234 2010-01-13 Doug Kwan <dougkwan@google.com>
7236 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7237 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7238 apparent compiler problem of not folding static constant integral
7239 data members of elfcpp::Elf_sizes<32>.
7241 2010-01-13 Doug Kwan <dougkwan@google.com>
7243 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7244 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7245 Arm_relobj::scan_section_for_cortex_a8_erratum,
7246 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7247 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7248 sections to scan for relocation stubs into a new method
7249 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7250 relocation and Cortex-A8 stub scanning.
7251 (Target_arm::do_relax): Force stubs to be after stubbed sections
7252 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7253 the beginning of a new relaxation pass. Update a comment.
7254 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7256 2010-01-12 Ian Lance Taylor <iant@google.com>
7258 * target-reloc.h (visibility_error): New inline function.
7259 (relocate_section): Call visibility_error.
7260 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7261 (MOSTLYCLEANFILES): Likewise.
7262 (protected_4_pic.o, protected_3.err): New targets.
7263 * testsuite/protected_4.cc: New file.
7265 2010-01-12 Doug Kwan <dougkwan@google.com>
7267 * arm.cc (Cortex_a8_reloc): New class.
7268 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7269 and cortex_a8_relocs_info_.
7270 (Target_arm::fix_cortex_a8): New method definition.
7271 (Target_arm::Cortex_a8_relocs_info): New type.
7272 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7273 New data member declarations.
7274 (Target_arm::scan_reloc_for_stub): Record information about
7275 relocations for THUMB branches that might be exempted from the
7276 Cortex-A8 workaround.
7277 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7278 at the beginning of a relaxation pass.
7280 2010-01-12 Doug Kwan <dougkwan@google.com>
7282 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7283 (Arm_relobj::Mapping_symbol_position,
7284 Arm_reloj::Mapping_symbol_position_less,
7285 Arm_relobj::Mapping_symbols_info): New types.
7286 (Target_arm::is_mapping_symbol_name): New method definition.
7287 (Arm_relobj::do_count_local_symbols): Save information about mapping
7290 2010-01-11 Doug Kwan <dougkwan@google.com>
7292 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7293 Arm_relocate_functions::thumb32_branch_upper,
7294 Arm_relocate_functions::thumb32_branch_lower,
7295 Arm_relocate_functions::thumb32_cond_branch_offset,
7296 Arm_relocate_functions::thumb32_cond_branch_upper,
7297 Arm_relocate_functions::thumb32_cond_branch_lower,
7298 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7299 branch offset encoding.
7300 (Arm_relocate_functions::thumb_branch_common): Use new branch
7301 offset encoding methods to avoid code duplication.
7302 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7303 (Stub_addend_reader::operator()): Use new branch encoding method
7304 to avoid code duplication.
7306 2010-01-11 Doug Kwan <dougkwan@google.com>
7308 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7309 (Target_arm::do_finalize_sections): Define special EXIDX section
7310 symbols only if referenced.
7311 * gc.h (Garbage_collection::add_reference): New method.
7312 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7315 2010-01-11 Ian Lance Taylor <iant@google.com>
7317 * script.cc (Version_script_info::build_expression_list_lookup):
7318 Change complaing about duplicate wildcard match from error to
7321 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7323 (Version_script_info::Version_script_info): Initialize globs_,
7324 default_version_, default_is_global_, and exact_. Don't
7325 initialize globals_ or locals_.
7326 (Version_script_info::build_lookup_tables): Build local symbols
7328 (Version_script_info::unquote): New function.
7329 (Version_script_info::add_exact_match): New function.
7330 (Version_script_info::build_expression_list_lookup): Remove lookup
7331 parameter. Add is_global parameter. Change all callers. Handle
7332 wildcard pattern specially. Unquote pattern. Call
7334 (Version_script_info::get_name_to_match): New function.
7335 (Version_script_info::get_symbol_version): New function.
7336 (Version_script_info::get_symbol_version_helper): Remove.
7337 (Version_script_info::check_unmatched_names): Call unquote.
7338 * script.h (class Version_script_info): Change get_symbol_version
7339 to be non-inline and add is_global parameter; change all callers.
7340 Rewrite symbol_is_local. Update declarations. Define struct
7341 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7342 Remove globals_ and locals_ members. Add exact_, globs_,
7343 default_version_, is_global_.
7344 (Version_script_info::Glob): Remove pattern, add expression and
7345 is_global. Update constructor. Change all callers.
7346 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7348 (Versions::symbol_section_contents): If a symbol is undefined, or
7349 defined in a dynamic object, set the version index to
7351 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7353 (Symbol_table::add_from_pluginobj): Likewise.
7354 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7356 2010-01-11 Doug Kwan <dougkwan@google.com>
7358 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7359 (incremental_dump_LDADD): Add linking option for libintl.
7360 * Makefile.in: Regenerate.
7362 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7365 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7367 * testsuite/Makefile.in: Regenerated.
7369 2010-01-10 Doug Kwan <dougkwan@google.com>
7371 * options.h (DEFINE_var): Use parentheses around argument varname__
7372 in macro body to avoid any unintended subsequent substitutions.
7374 2010-01-10 Ian Lance Taylor <iant@google.com>
7376 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7377 candidates before doing symbol resolution.
7379 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7380 ODR candidates if only one is weak.
7382 2010-01-08 Ian Lance Taylor <iant@google.com>
7384 * script.cc (Version_script_info::build_expression_list_lookup):
7385 Don't warn about ambiguous version, just record the ambiguity.
7386 (Version_script_info::get_symbol_version_helper): Give error if
7387 version is ambiguous.
7389 2010-01-08 Doug Kwan <dougkwan@google.com>
7391 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7392 prev_data_size_ and prev_addralign_. Remove initializer for
7393 deleted data member has_been_changed_.
7394 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7395 to determine if the table is empty.
7396 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7398 (Stub_table::add_reloc_stub): Define method in class definition
7399 instead of just declaring it there.
7400 (Stub_table::add_cortex_a8_stub): New method definition.
7401 (Stub_table::update_data_size_and_addralign): Ditto.
7402 (Stub_table::finalize_stubs): Ditto.
7403 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7404 (Stub_table::do_addralign_): Return address alignment in the
7405 (Stub_table::do_reset_address_and_file_offset): Define method in
7406 class definition instead of declaring it there. Set current data
7407 size to be the data size of the previous pass.
7408 (Stub_table::set_final_data_size): Use current data size as the
7410 (Stub_table::relocate_stub): Change parameter type of stub from
7411 Reloc_stub pointer to Stub pointer.
7412 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7413 (Stub_table::Cortex_a8_stub_list): New typedef.
7414 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7415 Stub_table::prev_addralign_): New data member.
7416 (Arm_relobj::Arm_relobj): Initialize data member
7417 section_has_cortex_a8_workaround_.
7418 (Arm_relobj::section_has_cortex_a8_workaround,
7419 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7421 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7423 (Target_arm::relocate_stub): Change parameter type of stub from
7424 Reloc_stub pointer to Stub pointer.
7425 (Insn_template::size, Insn_template::alignment): Handle
7426 THUMB16_SPECIAL_TYPE.
7427 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7428 Stub_table::update_data_size_and_addralign,
7429 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7431 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7432 (Stub_table::do_write): Ditto.
7433 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7435 2010-01-08 Ian Lance Taylor <iant@google.com>
7438 * symtab.h (class Symbol): Remove fields is_target_special_ and
7439 has_plt_offset_. Add field is_defined_in_discarded_section_.
7440 (Symbol::is_defined_in_discarded_section): New function.
7441 (Symbol::set_is_defined_in_discarded_section): New function.
7442 (Symbol::has_plt_offset): Rewrite.
7443 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7444 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7445 Don't initialize is_target_special_ or has_plt_offset_.
7446 Initialize is_defined_in_discarded_section_.
7447 (Symbol_table::add_from_relobj): If appropriate, set
7448 is_defined_in_discarded_section.
7449 * resolve.cc (Symbol::override_base_with_special): Don't test
7450 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7451 * target-reloc.h (relocate_section): Do special handling for
7452 symbols defined in discarded sections for global symbols as well
7455 2010-01-08 Ian Lance Taylor <iant@google.com>
7457 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7458 the SHT_SYMTAB case.
7460 2010-01-08 Ian Lance Taylor <iant@google.com>
7462 * object.cc (Sized_relobj::do_layout): Don't get confused if
7463 layout_eh_frame returns NULL.
7465 2010-01-08 Ian Lance Taylor <iant@google.com>
7468 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7469 dynamic symbol table, use the normal symbol table.
7470 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7473 2010-01-08 Ian Lance Taylor <iant@google.com>
7476 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7479 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7481 * version.cc (print_version): Change to "Copyright 2010".
7483 2010-01-08 Ian Lance Taylor <iant@google.com>
7487 * i386.cc (class Target_i386): Change return type of plt_section
7489 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7490 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7491 tls_desc_rel_ field.
7492 (Output_data_plt_i386::rel_tls_desc): New function.
7493 (Target_i386::rel_tls_desc_section): New function.
7494 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7495 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7496 R_386_TLS_DESC reloc in rel_tls_desc_section.
7497 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7498 Define struct Tlsdesc_info.
7499 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7500 (Target_x86_64::do_reloc_symbol_index): New function.
7501 (Target_x86_64::add_tlsdesc_info): New function.
7502 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7503 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7505 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7507 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7508 (Target_x86_64::rela_tlsdesc_section): New function.
7509 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7511 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7512 (Target_x86_64::do_reloc_addend): New function.
7513 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7514 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7515 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7516 (Output_reloc::type): New function.
7517 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7518 (Output_reloc::is_target_specific): New function.
7519 (Output_reloc::target_arg): New function.
7520 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7521 absolute relocs and target specific relocs.
7522 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7523 add_target_specific.
7524 (class Output_data_reloc) [SHT_RELA]: Likewise.
7525 * output.cc (Output_reloc::Output_reloc): Add four new versions
7526 for absolute relocs and target specific relocs.
7527 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7528 (Output_reloc::get_symbol_index): Likewise.
7529 (Output_reloc::local_section_offset): Check that local_sym_index_
7530 is not TARGET_CODE or 0.
7531 (Output_reloc::symbol_value): Likewise.
7532 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7534 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7535 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7537 * layout.cc (add_target_dynamic_tags): Use output section for
7538 DT_PLTRELSZ and DT_JMPREL.
7540 2010-01-07 Ian Lance Taylor <iant@google.com>
7543 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7545 (class Output_data_reloc_generic): Define.
7546 (class Output_data_reloc_base): Change base class to
7547 Output_data_reloc_generic. Change add() method to call
7548 bump_relative_reloc_count for a relative reloc. Remove
7550 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7552 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7553 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7555 * layout.h (class Layout): Update declaration.
7557 2010-01-07 Ian Lance Taylor <iant@google.com>
7559 * output.h (class Output_data): Add const version of
7560 output_section and do_output_section.
7561 (class Output_section_data): Add const version of
7563 (class Output_section): Likewise.
7564 * layout.cc (Layout::add_target_dynamic_tags): New function.
7565 * layout.h (class Layout): Update declarations.
7566 * arm.cc (Target_arm::do_finalize_sections): Use
7567 add_target_dynamic_tags.
7568 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7569 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7570 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7571 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7573 2010-01-07 Ian Lance Taylor <iant@google.com>
7576 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7579 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7580 Ian Lance Taylor <iant@google.com>
7583 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7584 Xindex::read_symtab_xindex.
7586 2010-01-07 Doug Kwan <dougkwan@google.com>
7588 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7589 (Insn_template::thumb16_bcond_insn): New method declaration.
7590 (Insn_template): Fix spelling.
7591 (Stub::thumb16_special): New method declaration.
7592 (Stub::do_write): Define virtual method which was previously pure
7594 (Stub::do_thumb16_special): New method declaration.
7595 (Stub::do_fixed_endian_write): New template member.
7596 (Reloc_stub::do_write): Remove.
7597 (Reloc_stub::do_fixed_endian_write): Remove.
7598 (Cortex_a8_stub): New class definition.
7599 (Stub_factory::make_cortex_a8_stub): New method definition.
7600 (Stub_factory::Stub_factory): Add missing static storage class
7601 qualifier for elf32_arm_stub_a8_veneer_blx.
7603 2010-01-07 Ian Lance Taylor <iant@google.com>
7606 * options.h (class General_options): Add --warn-unresolved-symbols
7607 and --error-unresolved-symbols.
7608 * errors.cc (Errors::undefined_symbol): Implement
7609 --warn-unresolved-symbols.
7611 * options.h (class General_options): Add -z text and -z textoff.
7612 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7614 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7616 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7617 (Garbage_collection::cident_sections): New function.
7618 (Garbage_collection::add_cident_section): New function.
7619 (Garbage_collection::cident_sections_): New member.
7620 (gc_process_relocs): Add references to sections whose names are C
7622 * gold.h (cident_section_start_prefix): New constant.
7623 (cident_section_stop_prefix): New constant.
7624 (is_cident): New function.
7625 * layout.cc (Layout::define_section_symbols): Replace string constants
7626 with the newly defined constants.
7627 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7629 * testsuite/Makefile.am: Add gc_orphan_section_test.
7630 * testsuite/Makefile.in: Regenerate.
7631 * testsuite/gc_orphan_section_test.cc: New file.
7632 * testsuite/gc_orphan_section_test.sh: New file.
7634 2010-01-06 Ian Lance Taylor <iant@google.com>
7637 * options.h (class General_options): Add --warn-shared-textrel.
7638 * layout.cc (Layout::finish_dynamic_section): Implement
7639 --warn-shared-textrel.
7642 * options.h (class General_options): Add --warn-multiple-gp.
7644 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7646 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7647 $(THREADSLIB) and $(LIBDL).
7648 * Makefile.in: Rebuild.
7650 2010-01-06 Ian Lance Taylor <iant@google.com>
7653 * options.cc (General_options::parse_section_start): New function.
7654 (General_options::section_start): New function.
7655 (General_options::General_options): Initialize all members.
7656 * options.h: Include <map>
7657 (class General_options): Add --section-start. Add section_starts_
7659 * layout.cc (Layout::attach_allocated_section_to_segment): If
7660 --section-start was used, set the address of the segment. Remove
7661 local sort_sections.
7662 (Layout::relaxation_loop_body): If the address of the load segment
7663 has been set by --section-start, don't use it.
7664 * output.h (Output_segment::update_flags_for_output_section): New
7666 * output.cc (Output_segment::add_output_section): Call
7667 update_flags_for_output_section.
7669 2010-01-05 Ian Lance Taylor <iant@google.com>
7672 * options.h (class General_options): Add --undefined-version.
7673 * script.cc (struct Version_expression): Add was_matched_by_symbol
7675 (Version_script_info::matched_symbol): New function.
7676 (Version_script_info::get_symbol_version_helper): Call
7678 (Version_script_info::check_unmatched_names): New function.
7679 * script.h (class Version_script_info): Update declarations.
7680 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7682 * options.h (class General_options): Use DEFINE_bool_alias for
7683 allow_multiple_definition.
7684 * resolve.cc (Symbol_table::should_override): Don't test
7685 allow_multiple_definition.
7688 * options.h (class General_options): Add --cref.
7689 * main.cc (main): Print cref table if --cref. Don't close mapfile
7690 until after printing cref table.
7691 * cref.cc: Include "symtab.h".
7692 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7693 (Cref_table_compare::operator()): New function.
7694 (Cref_inputs::gather_cref): New function.
7695 (filecol): New static const.
7696 (Cref_inputs::print_cref): New function.
7697 (Cref::print_cref): New function.
7698 * cref.h: Include <cstdio>.
7699 (class Cref): Update declarations.
7700 * mapfile.h (Mapfile::file): New function.
7701 * object.h (class Object): Define Symbols. Declare virtual
7702 do_get_global_symbols.
7703 (Object::get_global_symbols): New function.
7704 * object.cc (Input_objects::add_object): Pass object to cref_ if
7706 (Input_objects::archive_start): Likewise.
7707 (Input_objects::archive_stop): Likewise.
7708 (Input_objects::print_cref): New function.
7709 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7710 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7712 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7714 * plugin.h (class Sized_pluginobj): Update declarations.
7716 2010-01-05 Ian Lance Taylor <iant@google.com>
7718 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7719 to is_default_version. Rename insdef to insdefault.
7720 (Symbol_table::add_from_relobj): Rename def to is_default_version
7721 and local to is_forced_local.
7722 (Symbol_table::add_from_pluginobj): Likewise.
7723 (Symbol_table::add_from_dynobj): Likewise.
7724 (Symbol_table::define_special_symbol): Rename insdef to
7727 2010-01-04 Ian Lance Taylor <iant@google.com>
7730 * options.h (class General_options): Add
7731 --allow-multiple-definition and -z muldefs.
7732 * resolve.cc (Symbol_table::should_override): Don't warn about a
7733 multiple symbol definition if --allow-multiple-definition or -z
7737 * options.h (class General_options): Add --add-needed and
7738 --copy-dt-needed-entries. Tweak --as-needed help entry.
7739 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7740 error if --copy-dt-needed-entries aka --add-needed is used and
7741 would cause a change in behaviour.
7744 * options.h (class General_options): Add -G as a short version of
7745 --shared. Add no-op options -assert, -g, and -i.
7747 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7749 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7750 check for .text or .gnu.linkonce.t sections.
7751 * icf.cc (Icf::find_identical_sections): Ditto.
7752 Change the detection for mangled function name within the section
7754 * icf.h (is_section_foldable_candidate): New function.
7756 2009-12-30 Ian Lance Taylor <iant@google.com>
7759 * options.h (class General_options): Permit two dashes with
7760 --retain-symbols-file.
7762 2009-12-30 Ian Lance Taylor <iant@google.com>
7765 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7766 don't put the file header and segment headers in the text
7770 * common.cc (Sort_commons::operator()): Stabilize sort when both
7772 (Symbol_table::do_allocate_commons_list): When allocating common
7773 symbols, skip a symbol which is no longer common.
7774 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7775 an object before checking its type.
7776 * testsuite/common_test_2.c: New file.
7777 * testsuite/common_test_3.c: New file.
7778 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7779 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7780 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7781 (common_test_2_pic.o, common_test_2.so): New targets.
7782 (common_test_3_pic.o, common_test_3.so): New targets.
7783 * testsuite/Makefile.in: Rebuild.
7786 * script.cc (read_input_script): If we see a new SECTIONS clause,
7787 and we have added an input section, give an error.
7788 * layout.h (class Layout): Add have_added_input_section function.
7789 Add have_added_input_section_ field.
7790 * layout.cc (Layout::Layout): Initialize
7791 have_added_input_section_.
7792 (Layout::layout): Set have_added_input_section_.
7793 (Layout::layout_eh_frame): Likewise.
7795 2009-12-30 Ian Lance Taylor <iant@google.com>
7798 * options.h (class General_options): Add --sort-common option.
7799 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7800 * common.cc (Sort_common): Add sort_order parameter to
7801 constructor. Add sort_order_ field.
7802 (Sort_commons::operator): Check sort_order_.
7803 (Symbol_table::allocate_commons): Determine the sort order.
7804 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7806 (Symbol_table::do_allocate_commons_list): Likewise.
7808 2009-12-30 Ian Lance Taylor <iant@google.com>
7811 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7812 symbols from this object, don't change the visibility of an
7814 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7816 2009-12-30 Ian Lance Taylor <iant@google.com>
7819 * script.h (class Version_script_info): Define Language enum.
7820 Update declarations. Define Glob, Exact, and Lookup types. Add
7821 new fields globals_, locals_, and is_finalized_.
7822 * script.cc: Various formatting fixes.
7823 (class Parser_closure): Change language_stack_ from a vector of
7824 std::string to one of Version_script_info::Language. Adjust all
7826 (class Lazy_demangler): Remove.
7827 (struct Version_expression): Change language from std::string to
7828 Version_script_info::Language.
7829 (Version_script_info::Version_script_info): New function.
7830 (Version_script_info::~Version_script_info): Don't call clear.
7831 (Version_script_info::finalize): New function.
7832 (Version_script_info::build_lookup_tables): New function.
7833 (Version_script_info::build_expression_list_lookup): New
7835 (Version_script_info::get_symbol_version_helper): Rewrite to use
7837 (Version_script_info::print_expression_list): Adjust to use
7838 Version_script_info::Language.
7839 (script_push_lex_into_version_mode): Check that the version script
7840 has not been finalized.
7841 (version_script_push_lang): Change language string to
7842 Version_script_info::Language.
7843 * options.cc (Command_line::version_script): New function.
7844 * options.h (class General_options): Add finalize_dynamic_list
7845 function. Change version_script from declaration to definition.
7846 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7847 * testsuite/version_script.map: Remove duplicate def of foo.
7848 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7850 * testsuite/Makefile.in: Rebuild.
7852 2009-12-30 Ian Lance Taylor <iant@google.com>
7855 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7856 if the input symbol index is 0, make the output symbol index 0.
7858 2009-12-30 Ian Lance Taylor <iant@google.com>
7861 * options.h (class General_options): Add -x/--discard-all.
7862 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7863 --discard-all. If the local symbol needs a dynamic entry, check
7864 that before handling --discard-locals.
7866 2009-12-30 Ian Lance Taylor <iant@google.com>
7869 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7871 (Output_segment::add_output_section): Don't change the flags if
7875 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7876 GNU hash table if they need a dynamic value. Otherwise, don't add
7877 them if they are defined in a dynamic object or are forced local.
7879 2009-12-29 Ian Lance Taylor <iant@google.com>
7882 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7883 .gnu.hash table for a 32-bit target.
7886 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7887 regular and a dynamic object only needs a dynamic symbol table
7888 entry if it is externally visible.
7891 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7892 constructor. Add global_offset_table_ field.
7893 (Target_i386::got_section): Set global_offset_table_.
7894 (Target_i386::do_finalize_sections): Set global_offset_table_
7896 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7897 in constructor. Add global_offset_table_ field.
7898 (Target_x86_64::got_section): Set global_offset_table_.
7899 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7902 * layout.cc (Layout::Layout): Initialize increase_relro_.
7903 (Layout::get_output_section): Add is_relro, is_last_relro, and
7904 is_first_non_relro parameters. Change all callers.
7905 (Layout::choose_output_section): Likewise.
7906 (Layout::add_output_section_data): Likewise.
7907 (Layout::make_output_section): Likewise.
7908 (Layout::set_segment_offsets): Clear increase_relro when using a
7910 * layout.h (class Layout): Add increase_relro method. Add
7911 increase_relro_ field. Update declarations.
7912 * output.cc (Output_section::Output_section): Initialize
7913 is_last_relro_ and is_first_non_relro_.
7914 (Output_segment::add_output_section): Group relro sections is
7915 do_sort is true. Handle is_last_relro and is_first_non_relro.
7916 (Output_segment::maximum_alignment): Remove relro handling.
7917 (Output_segment::set_section_addresses): Add increase_relro
7918 parameter. Change all callers. Add initial alignment to align
7919 relro sections on separate page. Remove old relro handling.
7920 (Output_segment::set_section_list_addresses): Remove in_relro
7921 parameter. Change all callers.
7922 (Output_segment::set_offset): Add increase parameter. Change all
7923 callers. Remove old relro handling.
7924 * output.h (class Output_section): Add new methods: is_last_relro,
7925 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7926 Add is_last_relro_ and is_first_non_relro_ fields.
7927 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7928 Create separate .got.plt section. Call increase_relro.
7929 * x86_64.cc (Target_x86_64::got_section): Likewise.
7930 * testsuite/relro_script_test.t: Add .got.plt.
7933 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7934 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7935 (Layout::finalize): Call set_dynamic_symbol_size.
7936 (Layout::set_dynamic_symbol_size): New function.
7937 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7938 set_dynamic_symbol_size.
7941 * output.h (class Output_section): Add is_entsize_zero_ field.
7942 * output.cc (Output_section::Output_section): Initialize
7944 (Output_section::set_entsize): If two different entsizes are
7945 requested, force it to zero.
7946 (Output_section::add_input_section): Set flags for .debug_str
7947 before updating section flags. Set entsize.
7948 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7949 and SHF_STRING if all input sections have those flags.
7951 2009-12-29 Rafael Espindola <espindola@google.com>
7953 * main.cc (main): Fix the sys time reporting.
7954 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7957 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7959 * options.cc (General_options::parse_version): Allow -v to exit
7960 without an error if there is nothing to link.
7962 2009-12-29 Ian Lance Taylor <iant@google.com>
7964 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7965 using a version of gcc before 4.1.
7966 * configure: Rebuild.
7968 2009-12-28 Chris Demetriou <cgd@google.com>
7970 * attributes.cc (Output_attributes_section_data::do_write): Use
7971 std::vector::front rather than std::vector::data.
7973 2009-12-28 Ian Lance Taylor <iant@google.com>
7975 * symtab.h (class Symbol_table): Add enum Defined.
7976 * resolve.cc (Symbol_table::should_override): Add defined
7977 parameter. Change all callers. Test whether object is NULL
7978 before calling a method on it.
7979 (Symbol_table::report_resolve_problem): Add defined parameter.
7981 (Symbol_table::should_override_with_special): Likewise.
7982 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7983 parameter. Change all callers.
7984 (Symbol_table::do_define_in_output_data): Likewise.
7985 (Symbol_table::define_in_output_segment): Likewise.
7986 (Symbol_table::do_define_in_output_segment): Likewise.
7987 (Symbol_table::define_as_constant): Likewise.
7988 (Symbol_table::do_define_as_constant): Likewise.
7989 * script.h (class Symbol_assignment): Add is_defsym parameter to
7990 constructor; change all callers.
7991 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7992 parameter. Change all callers. Add is_defsym_ field.
7993 (class Parser_closure): Add parsing_defsym parameter to
7994 constructor; change all callers. Add parsing_defsym accessor
7995 function. Add parsing_defsym_ field.
7997 2009-12-28 Ian Lance Taylor <iant@google.com>
7999 * gold.cc (queue_middle_tasks): Fix formatting.
8000 * object.cc (Relobj::is_section_name_included): Likewise.
8002 2009-12-23 Ian Lance Taylor <iant@google.com>
8004 * i386.cc (Target_i386::do_calls_non_split): Recognize
8005 -fsplit-stack prologue for a function with a static chain.
8006 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8007 -fsplit-stack prologue when using %r11.
8009 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8011 * options.cc (General_options::parse_version): Make -v continue and do
8012 the link like GNU ld does.
8014 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8016 * Makefile.am (CCFILES): Add timer.cc.
8017 (HFILES): Add timer.h.
8018 * configure.ac: Check for sysconf and times.
8019 * main.cc: include timer.h.
8020 (main): Use Timer instead of get_run_time.
8023 * workqueue.cc: include timer.h.
8024 (Workqueue::find_and_run_task):
8025 Report user, sys and wall time.
8026 * Makefile.in: Regenerate.
8027 * config.in: Regenerate.
8028 * configure: Regenerate.
8030 2009-12-16 Doug Kwan <dougkwan@google.com>
8032 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8034 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8035 relaxed input sections.
8036 * output.cc (Output_section::find_relaxed_input_section): Change
8037 return type to Output_relaxed_input_section pointer. Adjust code
8038 for new type of relaxed_input_section_map_.
8039 * output.h (Output_section::find_relaxed_input_section): Change
8040 return type to Output_relaxed_input_section pointer.
8041 (Output_section::Output_relaxed_input_section_by_input_section_map):
8043 (Output_section::relaxed_input_section_map_): Change type to
8044 Output_section::Output_relaxed_input_section_by_input_section_map.
8045 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8048 2009-12-15 Ian Lance Taylor <iant@google.com>
8050 * layout.cc (Layout::create_shstrtab): Only write out after input
8051 sections if we are compressing debug sections.
8053 2009-12-15 Ian Lance Taylor <iant@google.com>
8055 * archive.cc (Archive::add_symbols): Only look up a symbol without
8056 a version if there is, in fact, a version.
8058 2009-12-14 Ian Lance Taylor <iant@google.com>
8060 Revert -Wshadow changes, all changes from:
8061 2009-12-11 Doug Kwan <dougkwan@google.com>
8062 2009-12-11 Nick Clifton <nickc@redhat.com>
8063 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8065 2009-12-11 Doug Kwan <dougkwan@google.com>
8067 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8069 * attributes.cc (Object_attribute::size): Ditto.
8070 (Attributes_section_data::size): Ditto.
8071 (Attributes_section_data::Attributes_section_data): Ditto.
8072 (Output_attributes_section_data::do_write): Ditto.
8073 * attributes.h (Object_attribute::set_type): Ditto.
8074 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8076 2009-12-11 Nick Clifton <nickc@redhat.com>
8078 * archive.cc: Fix shadowed variable warnings.
8080 * compressed_output.cc: Likewise.
8081 * compressed_output.h: Likewise.
8082 * configure: Likewise.
8083 * dwarf_reader.cc: Likewise.
8084 * dynobj.cc: Likewise.
8085 * dynobj.h: Likewise.
8086 * ehframe.cc: Likewise.
8087 * ehframe.h: Likewise.
8088 * errors.cc: Likewise.
8089 * expression.cc: Likewise.
8090 * fileread.cc: Likewise.
8091 * fileread.h: Likewise.
8092 * freebsd.h: Likewise.
8093 * i386.cc: Likewise.
8095 * incremental.h: Likewise.
8096 * layout.cc: Likewise.
8097 * layout.h: Likewise.
8098 * mapfile.cc: Likewise.
8099 * merge.cc: Likewise.
8100 * merge.h: Likewise.
8101 * object.cc: Likewise.
8102 * object.h: Likewise.
8103 * options.h: Likewise.
8104 * output.cc: Likewise.
8105 * output.h: Likewise.
8106 * parameters.cc: Likewise.
8107 * plugin.cc: Likewise.
8108 * powerpc.cc: Likewise.
8109 * reduced_debug_output.cc: Likewise.
8110 * reduced_debug_output.h: Likewise.
8111 * reloc.cc: Likewise.
8112 * reloc.h: Likewise.
8113 * resolve.cc: Likewise.
8114 * script-sections.cc: Likewise.
8115 * script.cc: Likewise.
8116 * script.h: Likewise.
8117 * sparc.cc: Likewise.
8118 * symtab.cc: Likewise.
8119 * symtab.h: Likewise.
8120 * target-select.cc: Likewise.
8121 * target-select.h: Likewise.
8122 * token.h: Likewise.
8123 * workqueue.cc: Likewise.
8124 * workqueue.h: Likewise.
8125 * x86_64.cc: Likewise.
8127 2009-12-10 Doug Kwan <dougkwan@google.com>
8129 * arm.cc (attributes.h): New include.
8130 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8131 (Arm_relobj::~Arm_relobj): Delete object pointed by
8132 attributes_section_data_.
8133 (Arm_relobj::attributes_section_data): New method definition.
8134 (Arm_relobj::attributes_section_data_): New data member declaration.
8135 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8136 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8137 attributes_section_data_.
8138 (Arm_dynobj::attributes_section_data): New method definition.
8139 (Arm_dynobj::attributes_section_data_): New data member declaration.
8140 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8141 initialization value of may_use_blx_ to false.
8142 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8143 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8144 object attributes to compute results instead of hard-coding.
8145 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8146 Target_arm::get_secondary_compatible_arch,
8147 Target_arm::set_secondary_compatible_arch
8148 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8149 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8150 New method declarations.
8151 (Target_arm::get_aeabi_object_attribute): New method definition.
8152 (Target_arm::attributes_section_data_): New data member declaration.
8153 (read_arm_attributes_section): New template definition.
8154 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8155 (Arm_dynobj::do_read_symbols): Ditto.
8156 (Target_arm::do_finalize_sections): Merge attributes sections from
8157 input. Check for BLX use after attributes section merging.
8158 Fix __exidx_start and __exidx_end visibility. Create an
8159 .ARM.attributes section if necessary.
8160 (Target_arm::get_secondary_compatible_arch,
8161 Target_arm::set_secondary_compatible_arch,
8162 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8163 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8164 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8165 New method definitions.
8167 2009-12-09 Ian Lance Taylor <iant@google.com>
8169 * plugin.cc (Plugin::load): Don't cast from void* to a function
8172 2009-12-09 Ian Lance Taylor <iant@google.com>
8174 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8177 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8179 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8180 Replace two_file_shared_1.so with two_file_shared_2.so.
8181 * testsuite/Makefile.in: Regenerated.
8183 2009-12-08 Doug Kwan <dougkwan@google.com>
8185 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8186 (HFILES): Add attributes.h and int_encoding.h.
8187 * Makefile.in: Regenerate.
8188 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8189 function definitions to int_encoding.cc
8190 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8191 prototypes to int_encoding.h
8192 * reduced_debug_output.cc (int_encoding.h): New include.
8193 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8194 function definitions to int_encoding.cc
8195 (insert_into_vector, read_from_pointer): Move template definitions to
8197 * attributes.cc: New file.
8198 * attributes.h: New file.
8199 * int_encoding.cc: New file.
8200 * int_encoding.h: New file.
8202 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8205 * incremental-dump.cc (dump_incremental_inputs): New.
8206 (main): Use dump_incremental_inputs.
8208 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8211 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8212 checking elfcpp::STT_FUNC.
8213 (Target_i386::Relocate::relocate): Likewise.
8214 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8216 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8217 symbols from shared libraries into normal FUNC symbols.
8219 * symtab.h (Symbol): Add is_func and use it.
8221 2009-12-05 Doug Kwan <dougkwan@google.com>
8223 * arm.cc (Target_arm::arm_info): Initialize new fields
8224 attributes_section and attributes_vendor.
8225 * i386.cc (Target_i386::i386_info): Same.
8226 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8227 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8228 fields attributes_section and attributes_vendor.
8229 * sparc.cc (Target_sparc::sparc_info): Same.
8230 * target.h (Target::attributes_section, Target::attributes_vendor,
8231 Target::is_attributes_section, Target::attribute_arg_type,
8232 Target::attributes_order): New method definitions.
8233 (Target::Target_info::attributes_section,
8234 Target::Target_info::attributes_vendor): New fields.
8235 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8236 virtual method definitions.
8237 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8238 attributes_section and attributes_vendor.
8239 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8241 2009-12-05 Doug Kwan <dougkwan@google.com>
8243 * arm.cc: Update comments about interworking and stub generation.
8244 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8245 considered as non-PIC.
8246 (Arm_relocate_functions::base_abs): Fix formatting.
8247 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8248 of function to use GOT entry address instead of offset.
8249 (Target_arm::Scan::global): Issue an error if a symbol would need a
8250 PLT does not get one because it is untyped. Remove code to create
8251 dynamic symbols for relative branches.
8252 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8253 takes unsigned integer instead of boolean.
8255 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8257 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8258 (two_file_test_LDADD): Likewise.
8259 (common_test_1_LDADD): Likewise.
8260 (exception_test_LDADD) Likewise.
8261 (weak_test_LDADD): Likewise.
8262 (many_sections_test_LDADD): Likewise.
8263 (initpri1_LDADD): Likewise.
8264 (script_test_1_LDADD): Likewise.
8265 (script_test_2_LDADD): Likewise.
8266 (justsyms_LDADD): Likewise.
8267 (binary_test_LDADD): Likewise.
8268 (large_LDADD): Likewise.
8269 * testsuite/Makefile.in: Regenerated.
8271 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8273 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8274 (Symbol_table::override_with_special): Likewise.
8275 (Symbol_table::add_from_object): Likewise.
8277 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8279 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8280 Don't set the data_offset twice.
8282 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8284 * testsuite/Makefile.in: Regenerate.
8286 2009-12-03 Doug Kwan <dougkwan@google.com>
8288 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8289 (Target_arm::do_finalize_sections): Add parameter for symbol table
8290 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8291 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8292 parameter for symbol table pointer.
8293 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8294 an additional parameter for a pointer to symbol table.
8295 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8296 parameter for a symbol table pointer.
8297 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8298 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8300 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8301 parameter for a symbol table pointer.
8303 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8305 * incremental.cc (Incremental_inputs_header)
8306 (Incremental_inputs_header_write, Incremental_inputs_entry)
8307 (Incremental_inputs_entry_write): Move ...
8308 * incremental.h (Incremental_inputs_header)
8309 (Incremental_inputs_header_write, Incremental_inputs_entry)
8310 (Incremental_inputs_entry_write): here.
8312 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8314 * incremental.cc (make_sized_incremental_binary): Set the target.
8315 Error if it is incompatible.
8316 * output.h (Output_file): Add filename method.
8318 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8320 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8321 from the get_* methods.
8323 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8325 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8326 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8327 Write 0 for the data_offset of scripts.
8329 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8331 * testsuite/Makefile.am: Add the incremental_test.sh test.
8332 * testsuite/incremental_test.sh: New.
8333 * testsuite/incremental_test_1.c: New.
8334 * testsuite/incremental_test_2.c: New.
8336 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8338 * incremental-dump.cc (main): Fix typos.
8340 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8343 * incremental-dump.cc (main): Use llu to print 64 bit values.
8345 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8346 H.J. Lu <hongjiu.lu@intel.com>
8348 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8350 (incremental_dump_LDADD): Likewise.
8351 * Makefile.in: Regenerated.
8353 2009-11-25 Doug Kwan <dougkwan@google.com>
8357 2009-11-25 Doug Kwan <dougkwan@google.com>
8359 * arm.cc (Target_arm::Target_arm): Move method definition
8360 outside of class definition. Add code to handle
8361 --target1-rel, --target1-abs and --target2= options.
8362 (Target_arm::get_reloc_reloc_type): Change method to be
8363 non-static and const.
8364 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8365 New data member declaration.
8366 (Target_arm::Scan::local, Target_arm::Scan::global,
8367 Target_arm::Relocate::relocate,
8368 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8369 Adjust call to Target_arm::get_real_reloc_type.
8370 (Target_arm::get_real_reloc_type): Use command line options
8371 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8372 * options.h (--target1-rel, --target1-abs, --target2): New
8375 2009-11-25 Doug Kwan <dougkwan@google.com>
8377 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8378 class definition. Add code to handle --target1-rel, --target1-abs
8379 and --target2= options.
8380 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8382 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8384 (Target_arm::Scan::local, Target_arm::Scan::global,
8385 Target_arm::Relocate::relocate,
8386 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8387 call to Target_arm::get_real_reloc_type.
8388 (Target_arm::get_real_reloc_type): Use command line options to
8389 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8390 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8393 2009-11-25 Doug Kwan <dougkwan@google.com>
8395 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8396 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8397 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8399 (Arm_relocate_functions::thm_call): Replace body with a call to
8400 Arm_relocate_functions::thumb_branch_common.
8401 (Arm_relocate_functions::thm_jump24,
8402 Arm_relocate_functions::thm_xpc22): New method definitions.
8403 (Arm_relocate_functions::thumb_branch_common): New method definition.
8404 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8406 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8407 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8409 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8411 * Makefile.am: Build incremental-dump
8412 * Makefile.in: Regenerate.
8413 * incremental-dump.cc: New.
8414 * incremental.cc (Incremental_inputs_header_data,
8415 Incremental_inputs_entry_data): Move to incremental.h
8416 * incremental.h: (Incremental_inputs_header_data,
8417 Incremental_inputs_entry_data): Move from incremental.cc
8419 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8421 * incremental.cc (Incremental_inputs_header,
8422 Incremental_inputs_header_write, Incremental_inputs_entry,
8423 Incremental_inputs_entry_write): Add a typedef with the data type.
8425 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8427 * incremental.cc (Incremental_inputs_header,
8428 Incremental_inputs_header_write, Incremental_inputs_entry,
8429 Incremental_inputs_entry_write): Update comment about which
8430 type has the filed descriptions.
8432 2009-11-15 Doug Kwan <dougkwan@google.com>
8434 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8435 (Arm_relocate_functions::arm_branch_common): Change method defintion
8436 in class definition to a method declaration and update list of formal
8438 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8439 Arm_relocation_functions::jump24): Adjust call to
8440 Arm_relocate_functions::arm_branch_common. Update list of formal
8442 (Arm_relocate_functions::xpc25): New method definition.
8443 (Arm_relocate_functions::arm_branch_common): Move method defintion
8444 out from class definition. Use stubs for mode-switching and extending
8446 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8447 specially. Change code to enable use of stubs in ARM branches.
8449 2009-11-10 Doug Kwan <dougkwan@google.com>
8451 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8452 in method declaration.
8453 (Target_arm::relocate_stub): New method declaration.
8454 (Target_arm::default_target): Change to return a pointer instead of
8456 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8457 Target_arm::default_target.
8458 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8460 (Target_arm::relocate_section): Adjust view.
8461 (Target_arm::relocate_stub): New method definition.
8463 2009-11-10 Doug Kwan <dougkwan@google.com>
8465 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8467 * incremental.cc (open_incremental_binary): Initialized local
8468 variables to avoid warnings.
8469 * object.cc (make_elf_object): Ditto.
8470 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8473 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8476 * testsuite/plugin_test.c: Include "config.h".
8478 2009-11-09 Doug Kwan <dougkwan@google.com>
8480 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8481 (arm_symbol_value): Remove.
8482 (Arm_relocate_functions::arm_branch_common,
8483 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8484 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8485 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8486 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8487 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8488 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8489 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8490 Arm_relocate_functions::thm_mobw_abs_nc,
8491 Arm_relocate_functions::thm_mov_abs,
8492 Arm_relocate_functions::movw_prel_nc,
8493 Arm_relocate_functions::thm_movt_abs,
8494 Arm_relocate_functions::movt_prel,
8495 Arm_relocate_functions::thm_movw_prel_nc,
8496 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8497 (Target_arm::Relocate::relocate): Only decompose address into two
8498 parts if relocation type uses the thumb-bit and pass the actual
8499 bit instead of a flag indicating that the thumb-bit is used. Adjust
8500 calls to methods in Arm_relocate_functions for this change.
8502 2009-11-08 Ian Lance Taylor <iant@google.com>
8505 * reloc.cc: Instantiate
8506 Sized_relobj::initialize_input_to_output_maps and
8507 Sized_relobj:free_input_to_output_maps.
8509 2009-11-06 Ian Lance Taylor <iant@google.com>
8512 * defstd.cc (in_segment): Set only_if_ref true for "end".
8514 2009-11-06 Doug Kwan <dougkwan@google.com>
8516 * arm.cc (class Reloc_stub): Correct a comment.
8517 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8518 (Target_arm::scan_section_for_stubs): New method declaration.
8519 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8520 Change methods from private to protected.
8521 (Target_arm::do_may_relax): New method definition.
8522 (Target_arm::do_relax, Target_arm::group_sections,
8523 Target_arm::scan_reloc_for_stub,
8524 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8525 (Target_arm::arm_input_section_map_): New data member declaration.
8526 (Target_arm::scan_reloc_for_stub,
8527 Target_arm::scan_reloc_section_for_stubs,
8528 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8529 Target_arm::do_relax): New method definitions.
8531 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8533 * configure.ac: Check for (struct stat)::st_mtim
8534 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8535 * config.in: Regenerate.
8536 * configure: Regenerate.
8538 2009-11-05 Ian Lance Taylor <iant@google.com>
8541 * output.cc (Output_segment::add_output_section): Add missing
8544 2009-11-04 Ian Lance Taylor <iant@google.com>
8547 * object.h (class Object): Add is_needed and set_is_needed
8548 methods. Add is_needed_ field. Make bool fields into bitfields.
8549 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8550 defined in a dynamic object and referenced by a regular object,
8551 set is_needed for the dynamic object.
8552 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8553 if the file is marked with as_needed and it is not needed.
8555 2009-11-04 Ian Lance Taylor <iant@google.com>
8558 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8559 tags if data is discarded by linker script.
8560 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8561 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8562 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8563 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8565 2009-11-04 Ian Lance Taylor <iant@google.com>
8567 * layout.cc (Layout::get_output_section): Add is_interp and
8568 is_dynamic_linker_section parameters. Change all callers.
8569 (Layout::choose_output_section): Likewise.
8570 (Layout::make_output_section): Likewise.
8571 (Layout::add_output_section_data): Add is_dynamic_linker_section
8572 parameter. Change all callers.
8573 * layout.h (class Layout): Update declarations.
8574 * output.h (class Output_section): Add is_interp, set_is_interp,
8575 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8576 Add is_interp_, is_dynamic_linker_section_ fields. Change
8577 generate_code_fills_at_write_ to a bitfield.
8578 * output.cc (Output_section::Output_sections): Initialize new
8580 (Output_segment::add_output_section): Add do_sort parameter.
8583 2009-11-03 Ian Lance Taylor <iant@google.com>
8586 * options.h (class General_options): Add --warn-common.
8587 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8588 merging two common symbols.
8589 (Symbol_table::should_override): Handle --warn-common when merging
8590 a common symbol with a defined symbol. Use report_resolve_problem
8591 for multiple definitions.
8592 (Symbol_table::report_resolve_problem): New function.
8593 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8595 2009-11-03 Doug Kwan <dougkwan@google.com>
8597 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8599 (Target_arm::stub_factory): New method definition.
8600 (Target_arm::new_arm_input_section,
8601 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8602 Target_arm::reloc_uses_thumb_bit): New method declarations.
8603 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8604 New type definitions.
8605 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8606 member declarations.
8607 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8608 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8609 New method definitions.
8611 2009-11-03 Ian Lance Taylor <iant@google.com>
8613 * options.h (class General_options): Add --warn_constructors.
8615 2009-11-03 Ian Lance Taylor <iant@google.com>
8618 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8619 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8621 2009-11-03 Ian Lance Taylor <iant@google.com>
8624 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8625 --msgid-bugs-address.
8626 (install-pdf): New target.
8627 (install-data_yes): Look up one directory to find mkinstalldirs.
8629 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8631 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8634 2009-10-30 Doug Kwan <dougkwan@google.com>
8636 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8638 2009-10-30 Doug Kwan <dougkwan@google.com>
8640 * arm.cc (Stub_addend_reader): New struct template definition
8641 and partial specializations.
8642 (Stub_addend_reader::operator()): New method definition for a
8643 partially specialized template.
8645 2009-10-30 Doug Kwan <dougkwan@google.com>
8647 * arm.cc (Arm_relobj::processor_specific_flags): New method
8649 (Arm_relobj::do_read_symbols): New method declaration.
8650 (Arm_relobj::processor_specific_flags_): New data member declaration.
8651 (Arm_dynobj): New class definition.
8652 (Target_arm::do_finalize_sections): Add input_objects parameter.
8653 (Target_arm::do_adjust_elf_header): New method declaration.
8654 (Target_arm::are_eabi_versions_compatible,
8655 (Target_arm::merge_processor_specific_flags): New method declaration.
8656 (Target_arm::do_make_elf_object): New overloaded method definitions
8658 (Arm_relobj::do_read_symbols): New method definition.
8659 (Arm_dynobj::do_read_symbols): Ditto.
8660 (Target_arm::do_finalize_sections): Add input_objects parameters.
8661 Merge processor-specific flags from all input objects.
8662 (Target_arm::are_eabi_versions_compatible,
8663 Target_arm::merge_processor_specific_flags,
8664 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8665 New method definitions.
8666 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8667 Input_objects pointer type parameter.
8668 * layout.cc (Layout::finalize): Pass input objects to target's.
8669 finalize_sections function.
8670 * output.cc (Output_file_header::do_sized_write): Set ELF file
8671 header's processor-specific flags.
8672 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8673 Input_objects pointer type parameter.
8674 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8675 * target.h (Input_objects): New forward class declaration.
8676 (Target::processor_specific_flags,
8677 Target::are_processor_specific_flags_sect): New method definitions.
8678 (Target::finalize_sections): Add input_objects parameter.
8679 (Target::Target): Initialize processor_specific_flags_ and
8680 are_processor_specific_flags_set_.
8681 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8683 (Target::set_processor_specific_flags): New method definition.
8684 (Target::processor_specific_flags_,
8685 Target::are_processor_specific_flags_set_): New data member
8687 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8688 Input_objects pointer type parameter.
8690 2009-10-30 Doug Kwan <dougkwan@google.com>
8692 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8694 2009-10-28 Ian Lance Taylor <iant@google.com>
8696 * object.h (class Relobj): Drop options parameter from
8697 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8698 do_scan_relocs, do_relocate. Change all callers.
8699 (class Sized_relobj): Drop options parameters from
8700 do_gc_process_relocs, do_scan_relocs, do_relocate,
8701 do_relocate_sections, relocate_sections, emit_relocs_scan,
8702 emit_relocs_scan_reltype. Change all callers.
8703 (struct Relocate_info): Remove options field and all references to
8705 * reloc.h (class Read_relocs): Remove options constructor
8706 parameter and options_ field. Change all callers.
8707 (class Gc_process_relocs, class Scan_relocs): Likewise.
8708 (class Relocate_task): Likewise.
8709 * target-reloc.h (scan_relocs): Remove options parameter. Change
8711 (scan_relocatable_relocs): Likewise.
8712 * target.h (class Sized_target): Remove options parameter from
8713 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8715 * gc.h (gc_process_relocs): Remove options parameter. Change all
8717 * arm.cc: Update functions to remove options parameters.
8718 * i386.cc: Likewise.
8719 * powerpc.cc: Likewise.
8720 * sparc.cc: Likewise.
8721 * x86_64.cc: Likewise.
8722 * testsuite/testfile.cc: Likewise.
8724 2009-10-28 Doug Kwan <dougkwan@google.com>
8726 * arm.cc (Arm_relobj): New class definition.
8727 (Arm_relobj::scan_sections_for_stubs,
8728 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8729 New method definitions.
8731 2009-10-28 Cary Coutant <ccoutant@google.com>
8733 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8734 (Plugin::cleanup_done_): New member.
8735 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8736 (Plugin_manager::cleanup_done_): Remove.
8737 (Plugin_manager::add_input_file): Edit error message.
8738 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8739 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8741 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8743 * fileread.cc: (File_read::View::~View): Use the new
8744 data_ownership_ filed.
8745 (File_read::~File_read): Dispose the new whole_file_view_.
8746 (File_read::open): Mmap the whole file if needed.
8747 (File_read::open): Use whole_file_view_ instead of contents_.
8748 (File_read::find_view): Use whole_file_view_ if applicable.
8749 (File_read::do_read): Use whole_file_view_ instead of contents_.
8750 (File_read::make_view): Use whole_file_view_ instead of contents_,
8751 update File_read::View::View call.
8752 (File_read::find_or_make_view): Update File_read::View::View
8754 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8756 (File_read::View::Data_ownership): New enum.
8757 (File_read::View::View): Replace bool mapped_ with Data_ownership
8759 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8760 (File_read::View::data_ownership_): New field.
8761 (File_read::contents_): Remove (replaced by whole_file_view_).
8762 (File_read::whole_file_view_): New field.
8763 * options.h (class General_options): Add --keep-files-mapped.
8765 2009-10-27 Cary Coutant <ccoutant@google.com>
8767 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8768 * testsuite/Makefile.am (plugin_test_5): New test case.
8769 * testsuite/Makefile.in: Regenerate.
8771 2009-10-25 Doug Kwan <dougkwan@google.com>
8773 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8774 from private to protected to allow access by child class.
8775 (Sized_relobj::do_relocate_sections): New method declaration.
8776 (Sized_relobj::relocate_sections): Virtualize.
8777 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8778 Sized_relobj::relocate_sections. Instantiate template explicitly
8779 for different target sizes and endianity.
8781 2009-10-24 Doug Kwan <dougkwan@google.com>
8783 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8784 (Arm_input_section::as_arm_input_section): New method.
8785 (Arm_output_section): New class definition.
8786 (Arm_output_section::create_stub_group,
8787 Arm_output_section::group_sections): New method definitions.
8789 2009-10-22 Doug Kwan <dougkwan@google.com>
8791 * arm.cc (Arm_input_section): New class definition.
8792 (Arm_input_section::init, Arm_input_section:do_write,
8793 Arm_input_section::set_final_data_size,
8794 Arm_input_section::do_reset_address_and_file_offset): New method
8797 2009-10-21 Doug Kwan <dougkwan@google.com>
8799 * arm.cc (Stub_table, Arm_input_section): New forward class
8801 (Stub_table): New class defintion.
8802 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8803 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8804 New method definition.
8806 2009-10-21 Doug Kwan <dougkwan@google.com>
8808 * arm.cc: Update copyright comments.
8809 (Target_arm): New forward class template declaration.
8810 (Arm_address): New type.
8811 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8812 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8813 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8815 (Insn_template): Same.
8816 (DEF_STUBS): New macro.
8817 (Stub_type): New enum type.
8818 (Stub_template): New class definition.
8821 (Stub_factory): Same.
8822 (Target_arm::Target_arm): Initialize may_use_blx_ and
8823 should_force_pic_veneer_.
8824 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8825 Target_arm::should_force_pic_veneer,
8826 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8827 Target_arm::using_thumb_only, Target_arm:;default_target): New
8829 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8830 New data member declarations.
8831 (Insn_template::size, Insn_template::alignment): New method defintions.
8832 (Stub_template::Stub_template): New method definition.
8833 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8834 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8835 (Stub_factory::Stub_factory): New method definition.
8836 * gold.h (string_hash): New template.
8837 * output.h (Input_section_specifier::hash_value): Use
8839 (Input_section_specifier::string_hash): Remove.
8840 * stringpool.cc (Stringpool_template::string_hash): Use
8843 2009-10-20 Doug Kwan <dougkwan@google.com>
8845 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8846 symbols of relaxed input sections.
8847 * output.h (Output_section::find_relaxed_input_section): Make
8850 2009-10-16 Doug Kwan <dougkwan@google.com>
8852 * dynobj.cc (Versions::Versions): Initialize version_script_.
8853 Only insert base version symbol definition for a shared object
8854 if version script defines any version versions.
8855 (Versions::define_base_version): New method definition.
8856 (Versions::add_def): Check that base version is not needed.
8857 (Versions::add_need): Define base version lazily.
8858 * dynobj.h (Versions::define_base_version): New method declaration.
8859 (Versions::needs_base_version_): New data member declaration.
8860 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8861 (check_DATA): Add no_version_test.stdout.
8862 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8864 * testsuite/Makefile.in: Regenerate.
8865 * testsuite/no_version_test.c: New file.
8866 * testsuite/no_version_test.sh: Ditto.
8868 2009-10-16 Doug Kwan <dougkwan@google.com>
8870 * expression.cc (class Segment_start_expression): New class definition.
8871 (Segment_start_expression::value): New method definition.
8872 (script_exp_function_segment_start): Return a new
8873 Segment_start_expression.
8874 * gold/script-c.h (script_saw_segment_start_expression): New function
8876 * script-sections.cc (Script_sections::Script_sections): Initialize
8877 SAW_SEGMENT_START_EXPRESSION_ to false.
8878 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8879 and -Tbbs options to specify section addresses if given in
8880 command line and no SEGMENT_START expression is seen in a script.
8881 * script-sections.h (Script_sections::saw_segment_start_expression,
8882 Script_sections::set_saw_segment_start_expression): New method
8884 (Script_sections::saw_segment_start_expression_): New data member
8886 * script.cc (script_saw_segment_start_expression): New function.
8887 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8888 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8889 script_test_7.sh and script_test_8.sh.
8890 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8891 script_test_8.stdout.
8892 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8893 (script_test_6, script_test_6.stdout, script_test_7,
8894 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8895 * Makefile.in: Regenerate.
8896 * testsuite/script_test_6.sh: New file.
8897 * testsuite/script_test_6.t: Same.
8898 * testsuite/script_test_7.sh: Same.
8899 * testsuite/script_test_7.t: Same.
8900 * testsuite/script_test_8.sh: Same.
8902 2009-10-16 Doug Kwan <dougkwan@google.com>
8904 * output.cc (Output_segment::set_section_list_address): Cast
8905 expressions to unsigned long long type to avoid format warnings.
8907 2009-10-15 Ian Lance Taylor <iant@google.com>
8909 * script.cc (Script_options::add_symbol_assignment): Always add a
8910 dot assignment to script_sections_.
8911 * script-sections.cc (Script_sections::add_dot_assignment):
8912 Initialize if necessary.
8914 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8915 program headers with no load segment if there is a linker script.
8917 * layout.cc (Layout::set_segment_offsets): Align the file offset
8918 to the segment aligment for -N or -n with no load segment.
8919 * output.cc (Output_segment::add_output_section): Don't crash if
8920 the first section is a TLS section.
8921 (Output_segment::set_section_list_addresses): Print an error
8922 message if the address moves backward in a linker script.
8923 * script-sections.cc
8924 (Output_section_element_input::set_section_addresses): Don't
8925 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8926 (Orphan_output_section::set_section_addresses): Likewise.
8928 2009-10-15 Doug Kwan <dougkwan@google.com>
8930 * layout.cc (Layout::finish_dynamic_section): Generate tags
8931 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8932 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8933 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8935 2009-10-14 Ian Lance Taylor <iant@google.com>
8937 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8939 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8940 data_shdr fields of relinfo.
8941 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8942 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8943 R_386_TLS_LDO_32, adjust based on section flags.
8944 (Target_i386::Relocate::fix_up_ldo): Remove.
8946 2009-10-13 Ian Lance Taylor <iant@google.com>
8948 Add support for -pie.
8949 * options.h (class General_options): Add -pie and
8951 (General_options::output_is_position_independent): Test -pie.
8952 (General_options::output_is_executable): Return true if not shared
8953 and not relocatable.
8954 (General_options::output_is_pie): Remove.
8955 * options.cc (General_options::finalize): Reject incompatible uses
8957 * gold.cc (queue_middle_tasks): A -pie link is not static.
8958 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8959 * symtab.cc (Symbol::final_value_is_known): Return false if
8960 output_is_position_independent.
8961 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8962 output_is_position_independent.
8963 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8964 output_is_position_independent.
8965 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8966 output_is_position_independent.
8967 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8969 (basic_pie_test.o, basic_pie_test): New targets.
8970 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8971 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8972 (two_file_pie_test): New target.
8973 * testsuite/Makefile.in: Rebuild.
8974 * README: Remove note saying that -pie is not supported.
8976 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8978 * options.h (class General_options): Add -init and -fini.
8979 * layout.cc (Layout::finish_dynamic_section): Emit
8980 given init and fini functions.
8982 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8984 * gc.h (gc_process_relocs): Check if icf is enabled using new
8986 * gold.cc (queue_initial_tasks): Likewise.
8987 (queue_middle_tasks): Likewise.
8988 * object.cc (do_layout): Likewise.
8989 * symtab.cc (is_section_folded): Likewise.
8990 * main.cc (main): Likewise.
8991 * reloc.cc (Read_relocs::run): Likewise.
8992 (Sized_relobj::do_scan_relocs): Likewise.
8993 * icf.cc (is_function_ctor_or_dtor): New function.
8994 (Icf::find_identical_sections): Check if function is ctor or dtor when
8996 * options.h (General_options::icf): Change option to be an enum.
8997 (Icf_status): New enum.
8998 (icf_enabled): New method.
8999 (icf_safe_folding): New method.
9000 (set_icf_status): New method.
9001 (icf_status_): New variable.
9002 * (options.cc) (General_options::finalize): Set icf_status_.
9003 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9004 icf_test and icf_keep_unique_test to use the --icf enum flag.
9005 * testsuite/icf_safe_test.sh: New file.
9006 * testsuite/icf_safe_test.cc: New file.
9008 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9010 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9011 includes to gc.h and icf.h.
9012 * arm.cc: Include gc.h.
9013 * gold.cc: Likewise.
9014 * i386.cc: Likewise.
9015 * powerpc.cc: Likewise.
9016 * sparc.cc: Likewise.
9017 * x86_64.cc: Likewise.
9018 * gc.h: Include icf.h.
9020 2009-10-11 Ian Lance Taylor <iant@google.com>
9022 * plugin.cc: Include "gold.h" before other header files.
9024 2009-10-10 Chris Demetriou <cgd@google.com>
9026 * options.h (Input_file_argument::Input_file_type): New enum.
9027 (Input_file_argument::is_lib_): Replace with...
9028 (Input_file_argument::type_): New member.
9029 (Input_file_argument::Input_file_argument): Take Input_file_type
9030 'type' rather than boolean 'is_lib' as second argument.
9031 (Input_file_argument::is_lib): Use type_.
9032 (Input_file_argument::is_searched_file): New function.
9033 (Input_file_argument::may_need_search): Handle is_searched_file.
9034 * options.cc (General_options::parse_library): Support -l:filename.
9035 (General_options::parse_just_symbols): Update for Input_file_argument
9037 (Command_line::process): Likewise.
9038 * archive.cc (Archive::get_file_and_offset): Likewise.
9039 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9040 * script.cc (read_script_file, script_add_file): Likewise.
9041 * fileread.cc (Input_file::Input_file): Likewise.
9042 (Input_file::will_search_for): Handle is_searched_file.
9043 (Input_file::open): Likewise.
9044 * readsyms.cc (Read_symbols::get_name): Likewise.
9045 * testsuite/Makefile.am (searched_file_test): New test.
9046 * testsuite/Makefile.in: Regenerate.
9047 * testsuite/searched_file_test.cc: New file.
9048 * testsuite/searched_file_test_lib.cc: New file.
9050 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9051 Ian Lance Taylor <iant@google.com>
9053 * descriptor.cc: Include <cstdio> and "binary-io.h".
9054 (Descriptors::open): Open the files in binary mode always.
9055 * script.cc (Lex::get_token): Treat \r as whitespace.
9057 2009-10-09 Ian Lance Taylor <iant@google.com>
9059 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9061 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9062 Ian Lance Taylor <iant@google.com>
9064 * configure.ac: Check for readv function also.
9065 * fileread.cc (readv): Define if not HAVE_READV.
9066 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9068 * config.in: Regenerate.
9069 * configure: Regenerate.
9071 2009-10-09 Doug Kwan <dougkwan@google.com>
9073 * layout.cc (Layout::make_output_section): Call target hook to make
9074 ordinary output section.
9075 (Layout::finalize): Adjust parameter list of call the
9076 Target::may_relax().
9077 * layout.h (class Layout::section_list): New method.
9078 * merge.h (Output_merge_base::entsize): Change visibility to public.
9079 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9081 (Output_merge_string::do_is_string): New method.
9082 * object.cc (Sized_relobj::do_setup): renamed from
9083 Sized_relobj::set_up.
9084 * object.h (Sized_relobj::adjust_shndx,
9085 Sized_relobj::initializ_input_to_output_maps,
9086 Sized_relobj::free_input_to_output_maps): Change visibilities to
9088 (Sized_relobj::setup): Virtualize.
9089 (Sized_relobj::do_setup): New method declaration.
9090 (Sized_relobj::invalidate_section_offset,
9091 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9092 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9093 * options.cc (parse_int): New function.
9094 * options.h (parse_int): New declaration.
9095 (DEFINE_int): New macro.
9096 (stub_group_size): New option.
9097 * output.cc (Output_section::Output_section): Initialize memebers
9098 merge_section_map_, merge_section_by_properties_map_,
9099 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9100 (Output_section::add_input_section): Handled deferred code-fill
9101 generation and remove an old comment.
9102 (Output_section::add_relaxed_input_section): New method definition.
9103 (Output_section::add_merge_input_section): Use merge section by
9104 properties map to speed to search. Update merge section maps
9106 (Output_section::build_relaxation_map): New method definition.
9107 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9109 (Output_section::relax_input_section): Renamed to
9110 Output_section::convert_input_sections_to_relaxed_sections and change
9111 interface to take a vector of pointers to relaxed sections.
9112 (Output_section::find_merge_section,
9113 Output_section::find_relaxed_input_section): New method definitions.
9114 (Output_section::is_input_address_mapped,
9115 Output_section::output_offset, Output_section::output_address):
9116 Use output section data maps to speed up searching.
9117 (Output_section::find_starting_output_address): Add comments.
9118 (Output_section::do_write,
9119 Output_section::write_to_postprocessing_buffer): Do code-fill
9120 generation as appropriate.
9121 (Output_section::get_input_sections): Invalidate relaxed input section
9123 (Output_section::restore_states): Adjust type of checkpoint .
9124 Invalidate relaxed input section map.
9125 * output.h (Output_merge_base): New class declaration.
9126 (Input_section_specifier): New class defintion.
9127 (class Output_relaxed_input_section) Change base class to
9128 Output_section_data_build.
9129 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9130 base class initializer.
9131 (Output_section::add_relaxed_input_section): New method declaration.
9132 (Output_section::Input_section): Change visibility to protected.
9133 (Output_section::Input_section::relobj,
9134 Output_section::Input_section::shndx): Handle relaxed input sections.
9135 Output_section::input_sections) Change visibility to protected. Also
9136 define overload to return a non-const pointer.
9137 (Output_section::Merge_section_properties): New class defintion.
9138 (Output_section::Merge_section_by_properties_map,
9139 Output_section::Output_section_data_by_input_section_map,
9140 Output_section::Relaxation_map): New types.
9141 (Output_section::relax_input_section): Rename method to
9142 Output_section::convert_input_sections_to_relaxed_sections and change
9143 interface to take a vector of relaxed section pointers.
9144 (Output_section::find_merge_section,
9145 Output_section::find_relaxed_input_section,
9146 Output_section::build_relaxation_map,
9147 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9148 New method declarations.
9149 (Output_section::merge_section_map_
9150 Output_section::merge_section_by_properties_map_,
9151 Output_section::relaxed_input_section_map_,
9152 Output_section::is_relaxed_input_section_map_valid_,
9153 Output_section::generate_code_fills_at_write_): New data members.
9154 * script-sections.cc
9155 (Output_section_element_input::set_section_addresses): Call
9156 current_data_size and addralign methods of relaxed input sections.
9157 (Orphan_output_section::set_section_addresses): Call current_data_size
9158 and addralign methods of relaxed input sections.
9159 * symtab.cc (Symbol_table::compute_final_value): Extract template
9160 from the body of Symbol_table::sized_finalize_symbol.
9161 (Symbol_table::sized_finalized_symbol): Call
9162 Symbol_table::compute_final_value.
9163 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9164 (Symbol_table::compute_final_value): New templated method declaration.
9165 * target.cc (Target::do_make_output_section): New method defintion.
9166 * target.h (Target::make_output_section): New method declaration.
9167 (Target::relax): Add more parameters for input objects, symbol table
9168 and layout. Adjust call to do_relax.
9169 (Target::do_make_output_section): New method declaration.
9170 (Target::do_relax): Add parameters for input objects, symbol table
9173 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9175 * pread.c: Include stdio.h.
9177 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9179 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9182 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9184 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9185 Change read_shndx type to unsigned int.
9186 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9188 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9189 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9190 Change read_shndx type to unsigned int.
9191 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9193 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9194 * layout.cc (Layout::create_symtab_sections): Cast the result of
9195 local_symcount * symsize to off_t in the gold_assert.
9197 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9199 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9200 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9202 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9203 (Arm_relocate_functions::thm_abs5): New function.
9204 (Arm_relocate_functions::abs12): New function.
9205 (Arm_relocate_functions::abs16): New function.
9206 (Arm_relocate_functions::base_abs): New function.
9207 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9208 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9209 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9211 (Scan::global): Likewise.
9212 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9213 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9214 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9215 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9218 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9220 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9221 (Arm_relocate_functions::movt_prel): New function.
9222 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9223 (Arm_relocate_functions::thm_movt_prel): New function.
9224 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9225 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9226 (Scan::global, Relocate::relocate): Likewise.
9227 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9229 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9231 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9232 Incremental_checker.
9233 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9235 (class Incremental_inputs_header): New class.
9236 (Incremental_inputs_header_writer): Edit comment.
9237 (Incremental_inputs_entry): New class.
9238 (Incremental_inputs_entry_writer): Edit comment.
9239 (Sized_incremental_binary::do_find_incremental_inputs_section):
9240 Add *strtab_shndx parameter, fill it.
9241 (Sized_incremental_binary::do_check_inputs): New method.
9242 (Incremental_checker::can_incrementally_link_output_file): Use
9243 Sized_incremental_binary::check_inputs.
9244 (Incremental_inputs::report_command_line): Save command line in
9247 (Incremental_binary::find_incremental_inputs_section): New
9249 (Incremental_binary::do_find_incremental_inputs_section): Add
9250 strtab_shndx parameter.
9251 (Incremental_binary::do_check_inputs): New pure virtual method.
9252 (Sized_incremental_binary::do_check_inputs): Declare.
9253 (Incremental_checker::Incremental_checker): Add incremental_inputs
9254 parameter, use it to initialize incremental_inputs_.
9255 (Incremental_checker::incremental_inputs_): New field.
9256 (Incremental_checker::command_line): New method.
9257 (Incremental_checker::inputs): New method.
9258 (Incremental_checker::command_line_): New field.
9260 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9262 * incremental.cc: Include <cstdarg> and "target-select.h".
9263 (vexplain_no_incremental): New function.
9264 (explain_no_incremental): New function.
9265 (Incremental_binary::error): New method.
9266 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9268 (make_sized_incremental_binary): New function.
9269 (open_incremental_binary): New function.
9270 (can_incrementally_link_file): Add checks if output is ELF and has
9272 * incremental.h: Include "elfcpp_file.h" and "output.h".
9273 (Incremental_binary): New class.
9274 (Sized_incremental_binary): New class.
9275 (open_incremental_binary): Declare.
9276 * object.cc (is_elf_object): Use
9277 elfcpp::Elf_recognizer::is_elf_file.
9278 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9279 * output.h (Output_file::filesize): New method.
9281 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9283 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9285 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9286 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9288 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9290 (Arm_relocate_functions::movw_abs_nc): New function.
9291 (Arm_relocate_functions::movt_abs): New function.
9292 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9293 (Arm_relocate_functions::thm_movt_abs): New function.
9294 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9295 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9296 (Scan::global): Likewise.
9297 (Relocate::relocate): Likewise.
9298 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9300 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9302 * arm.cc (Arm_relocate_functions::got_prel) New function.
9303 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9304 (Relocate::relocate): Likewise.
9305 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9307 2009-10-06 Ian Lance Taylor <iant@google.com>
9309 * options.h (class General_options): Define
9310 split_stack_adjust_size parameter.
9311 * object.h (class Object): Add uses_split_stack_ and
9312 has_no_split_stack_ fields. Add uses_split_stack and
9313 has_no_split_stack accessor functions. Declare
9314 handle_split_stack_section.
9315 (class Reloc_symbol_changes): Define.
9316 (class Sized_relobj): Define Function_offsets. Declare
9317 split_stack_adjust, split_stack_adjust_reltype, and
9319 * object.cc (Object::handle_split_stack_section): New function.
9320 (Sized_relobj::do_layout): Call handle_split_stack_section.
9321 * dynobj.cc (Sized_dynobj::do_layout): Call
9322 handle_split_stack_section.
9323 * reloc.cc (Sized_relobj::relocate_sections): Call
9324 split_stack_adjust for executable sections in split_stack
9325 objects. Pass reloc_map to relocate_section.
9326 (Sized_relobj::split_stack_adjust): New function.
9327 (Sized_relobj::split_stack_adjust_reltype): New function.
9328 (Sized_relobj::find_functions): New function.
9329 * target-reloc.h: Include "object.h".
9330 (relocate_section): Add reloc_symbol_changes parameter. Change
9332 * target.h (class Target): Add calls_non_split method. Declare
9333 do_calls_non_split virtual method. Declare match_view and
9335 * target.cc: Include "elfcpp.h".
9336 (Target::do_calls_non_split): New function.
9337 (Target::match_view): New function.
9338 (Target::set_view_to_nop): New function.
9339 * gold.cc (queue_middle_tasks): Give an error if mixing
9340 split-stack and non-split-stack objects with -r.
9341 * i386.cc (Target_i386::relocate_section): Add
9342 reloc_symbol_changes parameter.
9343 (Target_i386::do_calls_non_split): New function.
9344 * x86_64.cc (Target_x86_64::relocate_section): Add
9345 reloc_symbol_changes parameter.
9346 (Target_x86_64::do_calls_non_split): New function.
9347 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9349 * powerpc.cc (Target_powerpc::relocate_section): Add
9350 reloc_symbol_changes parameter.
9351 * sparc.cc (Target_sparc::relocate_section): Add
9352 reloc_symbol_changes parameter.
9353 * configure.ac: Call AM_CONDITIONAL for the default target.
9354 * configure: Rebuild.
9355 * testsuite/Makefile.am (TEST_AS): New variable.
9356 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9357 (check_DATA): Add split_i386 and split_x86_64 files.
9358 (SPLIT_DEFSYMS): Define.
9359 (split_i386_[1234n].o): New targets.
9360 (split_i386_[124]): New targets.
9361 (split_i386_[1234r].stdout): New targets.
9362 (split_x86_64_[1234n].o): New targets.
9363 (split_x86_64_[124]): New targets.
9364 (split_x86_64_[1234r].stdout): New targets.
9365 (MOSTLYCLEANFILES): Add new executables.
9366 * testsuite/split_i386.sh: New file.
9367 * testsuite/split_x86_64.sh: New file.
9368 * testsuite/split_i386_1.s: New file.
9369 * testsuite/split_i386_2.s: New file.
9370 * testsuite/split_i386_3.s: New file.
9371 * testsuite/split_i386_4.s: New file.
9372 * testsuite/split_i386_n.s: New file.
9373 * testsuite/split_x86_64_1.s: New file.
9374 * testsuite/split_x86_64_2.s: New file.
9375 * testsuite/split_x86_64_3.s: New file.
9376 * testsuite/split_x86_64_4.s: New file.
9377 * testsuite/split_x86_64_n.s: New file.
9378 * testsuite/testfile.cc (Target_test): Update relocation_section
9380 * testsuite/Makefile.in: Rebuild.
9382 2009-10-06 Ian Lance Taylor <iant@google.com>
9384 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9385 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9386 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9387 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9388 the address on ldo_addrs_.
9389 (Target_i386::Relocate::fix_up_ldo): New function.
9391 2009-10-06 Rafael Espindola <espindola@google.com>
9393 * plugin.cc (add_input_library): New.
9394 (Plugin::load): Add add_input_library to tv.
9395 (Plugin_manager::add_input_file): Add the is_lib argument.
9396 (add_input_file): Update call to Plugin_manager::add_input_file.
9397 (add_input_library): New.
9398 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9400 2009-09-30 Doug Kwan <dougkwan@google.com>
9402 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9403 symbol and call Symbol::may_need_copy_reloc to determine if
9404 a copy reloc is needed.
9405 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9406 nocopyreloc is given in command line.
9407 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9408 given in command line.
9409 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9410 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9411 of the removed Target_i386::may_need_copy_reloc.
9412 * options.h (copyreloc): New option with default value false.
9413 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9414 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9415 instead of the removed Target_powerpc::may_need_copy_reloc.
9416 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9417 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9418 instead of the removed Target_sparc::may_need_copy_reloc.
9419 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9420 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9421 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9422 instead of the removed Target_x86_64::may_need_copy_reloc.
9424 2009-09-30 Ian Lance Taylor <iant@google.com>
9426 * object.h (class Object): Remove target_ field, and target,
9427 sized_target, and set_target methods.
9428 (Object::sized_target): Remove.
9429 (class Sized_relobj): Update declarations. Remove sized_target.
9430 * object.cc (Sized_relobj::setup): Remove target parameter.
9432 (Input_objects::add_object): Don't do anything with the target.
9433 (make_elf_sized_object): Add punconfigured parameter. Change all
9434 callers. Set or test parameter target.
9435 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9437 * parameters.cc (Parameters::set_target): Change parameter type to
9439 (Parameters::default_target): Remove.
9440 (set_parameters_target): Change parameter type to be non-const.
9441 (parameters_force_valid_target): New function.
9442 (parameters_clear_target): New function.
9443 * parameters.h (class Parameters): Update declarations. Remove
9444 default_target method. Add sized_target and clear_target
9445 methods. Change target_ to be non-const.
9446 (set_parameters_target): Update declaration.
9447 (parameters_force_valid_target): Declare.
9448 (parameters_clear_target): Declare.
9449 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9450 as NULL if we aren't searching.
9451 (Add_symbols::run): Don't check for compatible target.
9452 * fileread.cc (Input_file::open_binary): Call
9453 parameters_force_valid_target.
9454 * gold.cc (queue_middle_tasks): Likewise.
9455 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9456 set_target on object.
9457 * dynobj.h (class Sized_dynobj): Update declarations.
9458 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9459 make_elf_object returns NULL.
9460 (Archive::include_member): Don't check whether object target is
9462 * output.cc (Output_section::add_input_section): Get target from
9464 (Output_section::relax_input_section): Likewise.
9465 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9467 (Sized_relobj::do_scan_relocs): Likewise.
9468 (Sized_relobj::relocate_sections): Likewise.
9469 * resolve.cc (Symbol_table::resolve): Likewise.
9470 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9471 parameter. Change all callers.
9472 (Symbol_table::add_from_object): Get target from parameters.
9473 (Symbol_table::add_from_relobj): Don't check object target.
9474 (Symbol_table::add_from_dynobj): Likewise.
9475 (Symbol_table::define_special_symbol): Get target from
9477 * symtab.h (class Symbol_table): Update declaration.
9478 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9479 parameter. Change all callers. Clear parameter target.
9480 (Binary_test): Test target here.
9481 * testsuite/object_unittest.cc (gold_testsuite): Remove
9482 target_test_pointer parameter. Change all callers.
9483 (Object_test): Test target here.
9485 2009-09-26 Ian Lance Taylor <iant@google.com>
9487 * testsuite/initpri1.c: Don't try to use constructor priorities if
9488 compiling with gcc before 4.3.
9490 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9492 * testsuite/retain_symbols_file_test.sh (check_present): Change
9493 output file name to retain_symbols_file_test.stdout.
9494 (check_absent): Likewise.
9496 2009-09-18 Craig Silverstein <csilvers@google.com>
9498 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9499 * options.cc: Include <cerrno> and <fstream>.
9500 (General_options::finalize): Parse -retain-symbols-file tag.
9501 * options.h: New flag.
9502 (General_options): New method should_retain_symbol, new
9503 variable symbols_to_retain.
9504 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9505 should_retain_symbol map.
9506 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9507 * testsuite/Makefile.in: Regenerate.
9508 * testsuite/retain_symbols_file_test.sh: New file.
9510 2009-09-18 Nick Clifton <nickc@redhat.com>
9512 * po/es.po: Updated Spanish translation.
9514 2009-09-17 Doug Kwan <dougkwan@google.com>
9516 * debug.h (DEBUG_RELAXATION): New constant.
9517 (DEBUG_ALL): Add DEBUG_RELAXATION.
9518 (debug_string_to_enum): Add relaxation debug option.
9520 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9521 Layout::Relaxation_debug_check::read_sections,
9522 Layout::Relaxation_debug_check::read_sections): New method definitions.
9523 (Layout::Layout): Initialize data members
9524 record_output_section_data_from_scrips_,
9525 script_output_section_data_list_ and relaxation_debug_check_.
9526 (Layout::save_segments, Layout::restore_segments,
9527 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9528 Layout::relaxation_loop_body): New method definitions.
9529 (Layout::finalize): Support relaxation. Move section layout code to
9530 Layout::relaxation_loop_body.
9531 (Layout::set_asection_address_from_script): Move code for orphan
9532 section placement out.
9533 (Layout::place_orphan_sections_in_script): New method definition.
9534 * layout.h (Output_segment_headers, Output_file_header):
9535 New forward class declarations.
9536 (Layout::~Layout): Define.
9537 (Layout::new_output_section_data_from_script): New method definition.
9538 (Layout::place_orphan_sections_in_script): New method declaration.
9539 (Layout::Segment_states): New type declaration.
9540 (Layout::save_segments, Layout::restore_segments,
9541 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9542 Layout::relaxation_loop_body): New method declarations.
9543 (Layout::Output_section_data_list): New type declaration.
9544 (Layout::Relaxation_debug_check): New class definition.
9545 (Layout::record_output_section_data_from_script_,
9546 Layout::script_output_section_data_list_, Layout::segment_states_,
9547 Layout::relaxation_debug_check_): New data members.
9548 * output.cc: (Output_section_headers::do_size): New method definition.
9549 (Output_section_headers::Output_section_headers): Move size
9550 computation to Output_section_headers::do_size.
9551 (Output_segment_headers::do_size): New method definition.
9552 (Output_file_header::Output_file_header): Move size computation to
9553 Output_file_header::do_size and call it.
9554 (Output_file_header::do_size): New method definition.
9555 (Output_data_group::Output_data_group): Adjust call to
9556 Output_section_data.
9557 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9558 (Output_symtab_xindex::do_write): Add array bound check.
9559 (Output_section::Input_section::print_to_mapfile): Handle
9560 RELAXED_INPUT_SECTION_CODE.
9561 (Output_section::Output_section): Initialize data member checkpoint_.
9562 (Output_section::~Output_section): Delete checkpoint object pointed
9564 (Output_section::add_input_section): Always add an Input_section if
9566 (Output_section::add_merge_input_section): Add assert.
9567 (Output_section::relax_input_section): New method definition.
9568 (Output_section::set_final_data_size): Set load address to zero for
9569 an unallocated section.
9570 (Output_section::do_address_and_file_offset_have_reset_values):
9571 New method definition.
9572 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9573 Handle relaxed input section.
9574 (Output_section::sort_attached_input_sections): Checkpoint input
9575 section list lazily.
9576 (Output_section::get_input_sections): Change type of input_sections to
9577 list of Simple_input_section pointers. Checkpoint input section list
9578 lazily. Also handle relaxed input sections.
9579 (Output_section::add_input_section_for_script): Take a reference to
9580 a Simple_input_section object instead of Relobj pointer and section
9581 index as parameter. Handle relaxed input sections.
9582 (Output_section::save_states, Output_section::restore_states): New
9584 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9585 (Output_data::is_data_size_fixed): New method definition.
9586 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9588 (Output_data::address_and_file_offset_have_reset_values): New method
9590 (Output_data::do_address_and_file_offset_have_reset_values): New method
9592 (Output_data::set_data_size): Check that data size is not fixed.
9593 (Output_data::fix_data_size): New method definition.
9594 (Output_data::is_data_size_fixed_): New data member.
9595 (Output_section_headers::set_final_data_size): New method definition.
9596 (Output_section_headers::do_size): New method declaration.
9597 (Output_segment_headers::set_final_data_size): New method definition.
9598 (Output_segment_headers::do_size): New method declaration.
9599 (Output_file_header::set_final_data_size)::New method definition.
9600 (Output_file_header::do_size)::New method declaration.
9601 (Output_section_data::Output_section_data): Add new parameter
9602 is_data_size_fixed and use it to fix data size.
9603 (Output_data_const::Output_data_const): Adjust call to base class
9604 constructor and fix data size.
9605 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9606 base class constructor and fix data size.
9607 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9608 base class constructor and fix data size.
9609 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9610 class constructor and fix data size.
9611 (Output_data_group::set_final_data_size): New method definition.
9612 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9613 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9614 class constructor and fix data size.
9615 (Output_relaxed_input_section): New class definition.
9616 (Output_section::Simple_input_section): New class definition.
9617 (Output_section::get_input_sections): Adjust parameter list.
9618 (Output_section::add_input_section_for_script): Same.
9619 (Output_section::save_states, Output_section::restore_states,
9620 Output_section::do_address_and_file_offset_have_reset_values,
9621 (Output_section::Input_section::Input_section): Handle
9622 RELAXED_INPUT_SECTION_CODE. Add new overload for
9623 Output_relaxed_input_section.
9624 (Output_section::Input_section::is_input_section,
9625 Output_section::Input_section::set_output_section): Handle relaxed
9627 (Output_section::Input_section::is_relaxed_input_section,
9628 Output_section::Input_section::output_section_data,
9629 Output_section::Input_section::relaxed_input_section): New method
9631 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9633 (Output_section::Input_section::u1_): Update comments.
9634 (Output_section::Input_section::u2_): Add new union member poris.
9635 (Output_section::Checkpoint_output_section): New classs definition.
9636 (Output_section::relax_input_section): New method declaration.
9637 (Output_section::checkpoint_): New data member.
9638 (Output_segment): Update comments.
9639 (Output_segment::Output_segment): Un-privatize copy constructor.
9640 (Output_segment::operator=): Un-privatize.
9641 * script-sections.cc (Output_section_element::Input_section_list):
9642 Change element type to Output_section::Simple_input_section.
9643 (Output_section_element_dot_assignment::set_section_addresses):
9644 Register output section data for relaxation clean up.
9645 (Output_data_exression::Output_data_expression): Adjust call to base
9646 constructor to fix data size.
9647 (Output_section_element_data::set_section_addresses): Register
9648 Output_data_expression object for relaxation clean up.
9649 (struct Input_section_info): Replace Relobj pointer and section index
9650 pair with Output_section::Simple_input_section and Convert struct to a
9652 (Input_section_sorter::operator()): Adjust access to
9653 Input_section_info data member to use accessors.
9654 (Output_section_element_input::set_section_addresses): Use layout
9655 parameter. Adjust code to use Output_section::Simple_input_section
9656 and Input_secction_info classes. Register filler for relaxation
9658 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9659 and section index pair with Output_section::Simple_input_section
9660 class. Adjust code accordingly.
9661 (Phdrs_element::release_segment): New method definition.
9662 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9664 (Script_sections::release_segments): New method definition.
9665 * gold/script-sections.h (Script_sections::release_segments): New
9667 * gold/target.h (Target::may_relax, Target::relax,
9668 Target::do_may_relax, Target::do_relax): New method definitions.
9670 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9672 * arm.cc (has_signed_unsigned_overflow): New function.
9673 (Arm_relocate_functions::abs8): New function.
9674 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9675 (Target_arm::Scan::global): Likewise.
9676 (Target_arm::relocate::relocate): Likewise.
9677 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9680 2009-09-16 Cary Coutant <ccoutant@google.com>
9682 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9683 * testsuite/Makefile.in: Regenerate.
9685 2009-09-11 Nick Clifton <nickc@redhat.com>
9687 * po/gold.pot: Updated by the Translation project.
9689 2009-09-08 Cary Coutant <ccoutant@google.com>
9691 * output.cc (Output_file::open): Add execute permission to empty file.
9692 * testsuite/Makefile.am (permission_test): New test.
9693 * testsuite/Makefile.in: Regenerate.
9695 2009-09-02 Ian Lance Taylor <iant@google.com>
9697 * output.cc (Output_file::resize): Call map_no_anonymous rather
9700 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9702 * gold.cc: Include "incremental.h".
9703 (queue_initial_tasks): Call Incremental_checker methods.
9704 * incremental.cc: Include "output.h".
9705 (Incremental_checker::can_incrementally_link_output_file): New
9707 * incremental.h (Incremental_checker): New class.
9709 * output.cc (Output_file::open_for_modification): New method.
9710 (Output_file::map_anonymous): Changed return type to bool. Record
9712 (Output_file::map_no_anonymous): New method, broken out of map.
9713 (Output_file::map): Use map_no_anonymous and map_anonymous.
9714 * output.h (class Output_file): Update declarations.
9716 2009-08-24 Cary Coutant <ccoutant@google.com>
9718 * options.h (Command_line::Pre_options): New class.
9719 (Command_line::pre_options): New member.
9720 * options.cc (gold::options::ready_to_register): New variable.
9721 (One_option::register_option): Do nothing if not registering options.
9722 Assert if same short option registered twice.
9723 (General_options::General_options): Turn off option registration when
9725 (Command_line::Pre_options::Pre_options): New constructor.
9727 2009-08-24 Cary Coutant <ccoutant@google.com>
9729 * options.h (General_options::no_keep_memory): Remove incorrect
9732 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9734 * Makefile.am (am__skiplex, am__skipyacc): New.
9735 * Makefile.in: Regenerate.
9737 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9739 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9740 (INCLUDES): ... this.
9741 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9742 (AM_CPPFLAGS): Renamed from ...
9743 (INCLUDE): ... this.
9744 * Makefile.in, testsuite/Makefile.in: Regenerate.
9746 * Makefile.in: Regenerate.
9747 * aclocal.m4: Likewise.
9748 * config.in: Likewise.
9749 * configure: Likewise.
9750 * testsuite/Makefile.in: Likewise.
9752 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9753 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9754 * Makefile.in: Regenerate.
9755 * testsuite/Makefile.in: Regenerate.
9757 2009-08-19 Cary Coutant <ccoutant@google.com>
9759 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9760 symbols in shared libraries overridden by hidden or internal symbols
9761 in the main program.
9763 2009-08-19 Chris Demetriou <cgd@google.com>
9765 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9766 checking source file names in error messages.
9768 2009-08-18 Doug Kwan <dougkwan@google.com>
9770 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9771 an elcpp::Ehdr as parameter. Adjust call to set_target.
9772 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9773 an elfcpp::Ehdr as parameter.
9774 * object.cc (Object::set_target): Remove the version that looks up
9775 a target and sets it.
9776 (Sized_relobj::setup): Take a Target object instead of
9777 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9778 (make_elf_sized_object): Find target and ask target to
9780 * object.h: (Object::set_target): Remove the version that looks up
9781 a target and sets it.
9782 (Sized_relobj::setup): Take a Target object instead of
9783 an elfcpp:Ehdr as parameter.
9784 * target.cc: Include dynobj.h.
9785 (Target::do_make_elf_object_implementation): New.
9786 (Target::do_make_elf_object): New.
9787 * target.h (Target::make_elf_object): New template declaration.
9788 (Target::do_make_elf_object): New method declarations.
9789 (Target::do_make_elf_object_implementation): New template declaration.
9791 2009-08-14 Ian Lance Taylor <iant@google.com>
9793 * gold.h (FUNCTION_NAME): Define.
9794 (gold_unreachable): Use FUNCTION_NAME.
9796 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9798 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9799 symbol in the --keep-unique list is not found.
9801 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9803 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9804 been maked as --keep-unique.
9805 (Icf::unfold_section): New function.
9806 * icf.h (Icf::unfold_section): New function.
9807 * options.h (General_options::keep_unique): New option.
9808 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9809 * testsuite/Makefile.in: Regenerate.
9810 * testsuite/icf_keep_unique_test.sh: New file.
9811 * testsuite/icf_keep_unique_test.cc: New file.
9813 2009-08-12 Cary Coutant <ccoutant@google.com>
9816 * resolve.cc (Symbol_table::resolve): Check for references from
9817 dynamic objects to hidden and internal symbols.
9818 * testsuite/Makefile.am (hidden_test.sh): New test.
9819 * testsuite/Makefile.in: Regenerate.
9820 * testsuite/hidden_test.sh: New script.
9821 * testsuite/hidden_test_1.c: New test source.
9822 * testsuite/hidden_test_main.c: New test source.
9824 2009-08-11 Doug Kwan <dougkwan@google.com>
9826 * arm.cc: Update comments.
9827 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9828 segment to locate the .ARM.exidx section if present.
9830 2009-08-09 Doug Kwan <dougkwan@google.com>
9832 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9835 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9836 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9839 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9841 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9842 valid tls_segment only for non-debug-section relocations.
9843 * testsuite/Makefile.am: Add gc_tls_test.
9844 * testsuite/Makefile.in: Regenerate.
9845 * testsuite/gc_tls_test.cc: New file.
9846 * testsuite/gc_tls_test.sh: New file.
9848 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9852 * Makefile.am (CCFILES): Add icf.cc.
9854 * Makefile.in: Regenerate.
9855 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9856 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9857 section, symbol and addend information for the relocs.
9858 * gold.cc (queue_middle_tasks): Call identical code folding.
9859 * gold.h: Add defines for multimap.
9860 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9861 to the call of finalize_local_symbols.
9862 * main.cc (main): Create object of class Icf.
9863 * object.cc (Sized_relobj::do_layout): Allow this function to be
9864 called twice during icf.
9865 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9866 to sections marked as identical by icf.
9867 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9869 (Sized_relobj::do_section_entsize): New function.
9870 * object.h (Object::section_entsize): New function.
9871 (Object::do_section_entsize): New pure virtual function.
9872 (Relobj::finalize_local_symbols): Add new parameter.
9873 (Relobj::do_section_entsize): New function.
9874 * options.h (General_options::icf): New option.
9875 (General_options::icf_iterations): New option.
9876 (General_options::print_icf_sections): New option.
9877 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9878 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9879 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9881 * symtab.cc (Symbol_table::is_section_folded): New function.
9882 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9883 to sections marked as identical by icf.
9884 * symtab.h (Symbol_table::set_icf): New function.
9885 (Symbol_table::icf): New function.
9886 (Symbol_table::is_section_folded): New function.
9887 (Symbol_table::icf_): New data member.
9888 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9889 * testsuite/Makefile.am: Add commands to build icf_test.
9890 * testsuite/Makefile.in: Regenerate.
9891 * testsuite/icf_test.sh: New file.
9892 * testsuite/icf_test.cc: New file.
9894 2009-07-24 Chris Demetriou <cgd@google.com>
9896 * layout.cc (is_compressible_debug_section): Fix incorrect
9897 comment about compressed section names.
9899 2009-07-20 Ian Lance Taylor <ian@airs.com>
9902 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9904 2009-07-16 Ian Lance Taylor <iant@google.com>
9907 * layout.h: #include <map>.
9908 (class Kept_section): Change from struct to class. Add accessors
9909 and setters. Add section size to Comdat_group mapping. Change
9910 Comdat_group to std::map. Add is_comdat_ field. Add
9911 linkonce_size field in union.
9912 (class Layout): Update declaration of find_or_add_kept_section.
9913 Don't declare find_kept_object.
9914 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9915 parameter. Add object, shndx, is_comdat, and is_group_name
9916 parameters. Change all callers. Adjust for new Kept_section.
9917 (Layout::find_kept_object): Remove.
9918 * object.cc (Sized_relobj::include_section_group): Update use of
9919 Kept_section. Rename secnum to shndx. Only record
9920 Kept_comdat_section if sections are the same size.
9921 (Sized_relobj::include_linkonce_section): Update use of
9922 Kept_section. Only record Kept_comdat_section if sections are the
9923 same size. Set size of linkonce section.
9924 (Sized_relobj::map_to_kept_section): Update call to
9925 get_kept_comdat_section.
9926 * object.h (class Sized_relobj): Rename fields in
9927 Kept_comdat_section to drop trailing underscores; change object
9928 field to Relobj*. Change Kept_comdat_section_table to store
9929 struct rather than pointer.
9930 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9931 Add kept_object and kept_shndx parameters. Change all callers.
9932 (Sized_relobj::get_kept_comdat_section): Change return type to
9933 bool. Add kept_object and kept_shndx parameters. Change all
9935 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9936 Layout::find_or_add_kept_section.
9938 2009-07-09 Ian Lance Taylor <iant@google.com>
9940 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9941 Reserve space in the hash table.
9943 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9945 * fileread.cc (File_read::get_mtime): New method.
9946 * fileread.h (Timespec): New structure.
9947 (File_read::get_mtime): New method.
9948 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9949 Renamed from timestamp_nsec.
9950 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9952 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9954 (Incremental_inputs::report_archive): Save mtime; style fix.
9955 (Incremental_inputs::report_obejct): Save mtime; style fix.
9956 (Incremental_inputs::report_script): Save mtime; style fix.
9957 (Incremental_inputs::finalize_inputs): Style fix.
9958 (Incremental_inputs::finalize): Style fix.
9959 (Incremental_inputs::create_input_section_data): Store inputs
9961 * incremental.h (Incremental_inputs::report_script): Add mtime
9963 (Incremental_inputs::Input_info::Input_info): Intialize only one
9965 (Incremental_inputs::Input_info::archive): Move to nameless
9967 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9968 (Incremental_inputs::Input_info::script): Move to nameless union.
9969 (Incremental_inputs::mtime): New field.
9970 * script.cc (read_input_script): Pass file mtime to
9972 * script.h (Script_info::inputs): Style fix.
9974 2009-07-01 Ian Lance Taylor <ian@airs.com>
9976 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9979 2009-06-24 Ian Lance Taylor <iant@google.com>
9982 * layout.cc (Layout::choose_output_section): If we find an
9983 existing section, update the flags.
9984 (Layout::create_notes): New function, broken out of
9986 (Layout::finalize): Don't create note sections.
9987 (Layout::create_note): Don't crash if linker script discards
9989 (Layout::create_gold_note): Likewise.
9990 (Layout::create_build_id): Likewise. Don't set
9991 after_input_sections on the section.
9992 (Layout::create_executable_stack_info): Remove target parameter.
9994 * layout.h (class Layout): Declare create_notes. Update
9995 declaration of create_executable_stack_info.
9996 * gold.cc (queue_middle_tasks): Call create_notes.
9997 * output.cc (Output_section::update_flags_for_input_section): Move
9998 here from output.h. If SHF_ALLOC flag is newly set, mark address
10000 * output.h (Output_data::mark_address_invalid): New function.
10001 (class Output_section): Only declare, not define,
10002 update_flags_for_input_section. Remove set_flags.
10004 2009-06-24 Ian Lance Taylor <iant@google.com>
10006 * script-sections.cc (Output_section_definition::
10007 set_section_addresses): Rename shadowing local load_address to
10010 2009-06-24 Ian Lance Taylor <iant@google.com>
10013 * reloc.cc (relocate_sections): Skip empty relocation sections.
10015 2009-06-23 Ian Lance Taylor <iant@google.com>
10018 * layout.cc (Layout::create_note): Use choose_output_section
10019 rather than make_output_section.
10021 2009-06-23 Ian Lance Taylor <iant@google.com>
10024 * options.cc (General_options::parse_V): Set printed_version_.
10025 (General_options::General_options): Initialize printed_version_.
10026 * options.h (class General_options): Add printed_version_ field.
10027 * gold.cc (queue_initial_tasks): If there are no input files,
10028 don't give a fatal error if we printed the version information.
10029 (queue_middle_tasks): If using -r with a shared object, give a
10030 fatal error rather than an ordinary error.
10032 2009-06-23 Ian Lance Taylor <iant@google.com>
10035 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10036 (Layout::make_output_section): Set have_stabstr_section_ if we see
10037 a .stab*str section.
10038 (Layout::finalize): Call link_stabs_sections.
10039 (Layout::link_stabs_sections): New file.
10040 * layout.h (class Layout): Add have_stabstr_section_ field.
10041 Declare link_stabs_sections.
10043 2009-06-23 Doug Kwan <dougkwan@google.com>
10045 * Makefile.am (libgold_a_LIBADD): New.
10046 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10047 * Makefile.in: Regenerate.
10048 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10049 * configure: Regenerate.
10050 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10051 * fileread.cc: Include sys/state.h
10052 * gold.h: Declare memmem and strndup if found missing.
10053 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10055 2009-06-23 Ian Lance Taylor <iant@google.com>
10057 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10058 * configure: Rebuild.
10060 2009-06-23 Ian Lance Taylor <iant@google.com>
10063 * object.cc (Object::section_contents): Don't try to get a view if
10064 the section has length zero.
10065 (Object::handle_gnu_warning_section): If the section is empty, use
10066 the name of the section as the warning.
10068 2009-06-23 Ian Lance Taylor <iant@google.com>
10071 * stringpool.h (class Stringpool_template): Add optimize_ field.
10072 (Stringpool_template::set_optimize): New function.
10073 * stringpool.cc (Stringpool_template::Stringpool_template):
10074 Initialize optimize_ field.
10075 (Stringpool_template::set_string_offsets): Test local optimize
10076 fild rather than parameter.
10077 * layout.cc (Layout::Layout): Call set_optimize on the section
10080 2009-06-22 Ian Lance Taylor <iant@google.com>
10083 * yyscript.y: Parse TARGET.
10084 * script.cc (script_set_target): New function.
10085 * script-c.h (script_set_target): Declare.
10086 * options.cc (General_options::string_to_object_format): Rename
10087 from string_to_object_format in anonymous namespace. Change
10089 * options.h (class General_options): Declare
10090 string_to_object_format.
10092 2009-06-22 Ian Lance Taylor <iant@google.com>
10094 * script-sections.cc (Script_sections::create_segments): Don't put
10095 program headers in a PT_LOAD segment if -n or -N.
10097 2009-06-22 Ian Lance Taylor <iant@google.com>
10100 * options.h (class General_options): Add -z lazy and -z now. Sort
10101 -z options into alphabetical order.
10102 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10104 2009-06-21 Ian Lance Taylor <iant@google.com>
10106 * layout.cc (Layout::make_output_section): Call
10107 Target::new_output_section.
10108 (Layout::attach_allocated_section_to_segment): Put large section
10109 sections in a separate load segment with the large segment flag
10111 (Layout::segment_precedes): Sort large data segments after other
10113 (align_file_offset): New static function.
10114 (Layout::set_segment_offsets): Use align_file_offset.
10115 * output.h (class Output_section): Add is_small_section_ and
10116 is_large_section_ fields.
10117 (Output_section::is_small_section): New function.
10118 (Output_section::set_is_small_section): New function.
10119 (Output_section::is_large_section): New function.
10120 (Output_section::set_is_large_section): New function.
10121 (Output_section::is_large_data_section): New function.
10122 (class Output_segment): Add is_large_data_segment_ field.
10123 (Output_segment::is_large_data_segment): New function.
10124 (Output_segment::set_is_large_data_segment): New function.
10125 * output.cc (Output_section::Output_section): Initialize new
10127 (Output_segment::Output_segment): Likewise.
10128 (Output_segment::add_output_section): Add assertion that large
10129 data sections always go in large data segments. Force small data
10130 sections to the end of the list of data sections. Force small BSS
10131 sections to the start of the list of BSS sections. For large BSS
10132 sections to the end of the list of BSS sections.
10133 * symtab.h (class Symbol): Declare is_common_shndx.
10134 (Symbol::is_defined): Check Symbol::is_common_shndx.
10135 (Symbol::is_common): Likewise.
10136 (class Symbol_table): Define enum Commons_section_type. Update
10137 declarations. Add small_commons_ and large_commons_ fields.
10138 * symtab.cc (Symbol::is_common_shndx): New function.
10139 (Symbol_table::Symbol_table): Initialize new fields.
10140 (Symbol_table::add_from_object): Put small and large common
10141 symbols in the right list.
10142 (Symbol_table::sized_finalized_symbol): Check
10143 Symbol::is_common_shndx.
10144 (Symbol_table::sized_write_globals): Likewise.
10145 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10146 common symbol lists. Don't call do_allocate_commons_list if the
10148 (Symbol_table::do_allocate_commons_list): Remove is_tls
10149 parameter. Add comons_section_type parameter. Change all
10150 callers. Handle small and large common symbols.
10151 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10152 Symbol::is_common_shndx.
10153 * resolve.cc (symbol_to_bits): Likewise.
10154 * target.h (Target::small_common_shndx): New function.
10155 (Target::small_common_section_flags): New function.
10156 (Target::large_common_shndx): New function.
10157 (Target::large_common_section_flags): New function.
10158 (Target::new_output_section): New function.
10159 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10160 small_common_section_flags, and large_common_section_flags
10162 (Target::do_new_output_section): New virtual function.
10163 * arm.cc (Target_arm::arm_info): Initialize new fields.
10164 * i386.cc (Target_i386::i386_info): Likewise.
10165 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10167 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10168 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10169 (Target_x86_64::do_new_output_section): New function.
10170 * configure.ac: Define conditional MCMODEL_MEDIUM.
10171 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10172 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10173 (large_LDFLAGS): Define.
10174 * testsuite/large.c: New file.
10175 * testsuite/testfile.cc (Target_test::test_target_info):
10176 Initialize new fields.
10177 * configure, testsuite/Makefile.in: Rebuild.
10179 2009-06-05 Doug Kwan <dougkwan@google.com>
10181 * Makefile.am (CCFILES): Add target.cc.
10182 * Makefile.in: Regenerate.
10183 * i386.cc (class Target_i386): Define new virtual method to
10184 override do_is_local_label_name in parent.
10185 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10186 local symbols if --discard-locals or -X is given.
10187 * options.h (class General_options): Declare new options
10188 '--discard-locals' and '-X' for discarding locals.
10189 * target.h (class Target): Define new methods is_local_label_name.
10190 Declare new virtual method do_is_local_label_name.
10191 * target.cc: New file.
10192 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10193 (check_SCRIPTS): Add discard_locals_test.sh.
10194 (check_DATA): Add discard_local_tests.syms.
10195 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10196 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10197 * testsuite/Makefile.in: Regenerate.
10198 * testsuite/discard_locals_test.c: New file.
10199 * testsuite/discard_locals_test.sh: Same.
10201 2009-06-05 Doug Kwan <dougkwan@google.com>
10203 * object.cc (Sized_relobj::Sized_relobj): Initialize
10204 discarded_eh_frame_shndx_ to -1U.
10205 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10207 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10208 a discarded .eh_frame section.
10209 (Sized_relobj::do_finalize_local_symbols): Ditto.
10210 * object.h (class Sized_relobj): Declare new member
10211 discarded_eh_frame_shndx_.
10212 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10213 (local_labels_test.o, local_labels_test): New rules.
10214 * testsuite/Makefile.in: Regenerate.
10216 2009-06-04 Doug Kwan <dougkwan@google.com>
10218 * layout.cc (Layout::section_name_mapping): Add mapping for
10219 special ARM sections.
10221 2009-06-03 Doug Kwan <dougkwan@google.com>
10223 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10224 (utils::has_overflow): Same.
10226 2009-06-03 Ian Lance Taylor <iant@google.com>
10228 * layout.cc (Layout::section_name_mapping): New array, replacing
10229 Layout::linkonce_mapping.
10230 (Layout::section_name_mapping_count): New variable, replacing
10231 Layout::linkonce_mapping_count.
10232 (Layout::linkonce_output_name): Remove.
10233 (Layout::output_section_name): Rewrite.
10234 * layout.h (class Layout): Rename Linkonce_mapping to
10235 Section_name_mapping, linkonce_mapping to section_name_mapping,
10236 linkonce_mapping_count to section_name_mapping_count. Don't
10237 declare linkonce_output_name.
10239 2009-06-03 Doug Kwan <dougkwan@google.com>
10241 * gold/arm.cc (namespace utils): New.
10242 (Target_arm::reloc_is_non_pic): Define new method.
10243 (class Arm_relocate_functions): New.
10244 (Target_arm::Relocate::relocate): Handle relocation types used by
10247 2009-06-03 Ian Lance Taylor <iant@google.com>
10249 * arm.cc (Target_arm::scan::global): Use || instead of |.
10251 2009-06-02 Doug Kwan <dougkwan@google.com>
10253 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10254 issued_non_pic_error_.
10255 (class Target_arm::Scan): Declare new method check_non_pic.
10256 Define new method symbol_needs_plt_entry.
10257 Declare new data member issued_non_pic_error_.
10258 (class Target_arm::Relocate): Declare new method
10259 should_apply_static_reloc.
10260 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10261 (Target_arm::Scan::check_non_pic): Define new method.
10262 (Target_arm::Scan::local): Handle a small subset of reloc types used
10264 (Target_arm::Scan::local): Same.
10265 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10267 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10269 * incremental.cc (Incremental_inputs::report_command_line): Filter
10270 out --incremental-* options.
10272 2009-05-29 Doug Kwan <dougkwan@google.com>
10274 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10276 (class Target_arm): Update comment.
10277 (Target_arm::Target_arm): Initialize new data members GOT_,
10278 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10279 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10280 and Target_arm::rel_dyn_section.
10281 Declare new_enum Target_arm::Got_type.
10282 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10284 Update commments for member do_dynsym_value.
10285 (Target_arm::got_size, Target_arm::plt_section,
10286 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10287 new methods inside class defintion.
10288 (Target_arm::got_section): Define new method.
10289 (Target_arm::rel_dyn_section): Same.
10290 (Output_data_plt_arm): New template class.
10291 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10292 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10293 (Output_data_plt_arm::add_entry): Same.
10294 (Output_data_plt_arm::first_plt_entry): Define new
10295 static data member for PLT instruction template.
10296 (Output_data_plt_arm::plt_entry): Same.
10297 (Output_data_plt_arm::do_write): Define new method.
10298 (Target_arm::make_plt_entry): Same.
10299 (Target_arm::do_finalize_sections): Same.
10300 (Target_arm::do_dynsym_value): Same.
10302 2009-05-28 Doug Kwan <dougkwan@google.com>
10304 * Makefile.am (TARGETSOURCES): Add arm.cc.
10305 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10306 * Makefile.in: Regenerate.
10307 * arm.cc: New file.
10308 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10310 2009-05-26 Doug Kwan <dougkwan@google.com>
10312 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10313 (General_options::check_excluded_libs): Strip off directories in
10314 archive name before matching like GNU ld does.
10315 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10316 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10317 (exclude_libs_test_LDFLAGS): Add linker option
10318 -Wl,--exclude-libs,libexclude_libs_test_3
10319 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10320 an explicit archive without using -l.
10321 (alt/libexclude_libs_test_3.a): New make rule.
10322 * testsuite/Makefile.in: Regenerate.
10323 * testsuite/exclude_libs_test.c : Declare lib3_default().
10325 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10326 * exclude_libs_test_3.c: New file.
10328 2009-05-26 Nick Clifton <nickc@redhat.com>
10330 * po/id.po: New Indonesian translation.
10331 * po/gold.pot: Updated template file.
10333 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10335 * testsuite/Makefile.am: Add -ffunction-sections to compile
10336 gc_comdat_test files. Add -Wl,--gc-sections to build
10338 * testsuite/Makefile.in: Regenerate.
10339 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10341 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10343 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10344 kept comdat section was garbage collected.
10345 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10346 * testsuite/Makefile.in: Regenerate.
10347 * testsuite/gc_comdat_test.sh: New file.
10348 * testsuite/gc_comdat_test_1.cc: New file.
10349 * testsuite/gc_comdat_test_2.cc: New file.
10351 2009-05-19 Doug Kwan <dougkwan@google.com>
10353 * archive.cc (Archive::Archive): Move constructor from archive.h
10354 to here. Initialize no_export_.
10355 (Archive::get_elf_object_for_member): Set no_export flag of object.
10356 * archive.h (Archive::Archive): Move constructor body to
10358 (Archive::no_export): New method.
10359 (Archive::no_export_): New field.
10360 * object.h (Object::Object): Initialize no_export_ to false.
10361 (Object::no_export, Object::set_no_export): New methods.
10362 (Object::no_export_): New field.
10363 * options.cc (General_options::parse_exclude_libs): New method.
10364 (General_options::check_excluded_libs) Same.
10365 * options.h (exclude_libs): New option.
10366 (General_options::check_excluded_libs): New method declaration.
10367 (General_options::excluded_libs_): New field.
10368 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10369 default or protected visibility if an object has no-export flag set.
10370 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10371 (check_SCRIPTS): Add exclude_libs_test.sh.
10372 (check_DATA): Add exclude_libs_test.syms.
10373 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10374 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10375 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10376 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10377 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10378 libexclude_libs_test_2.a): New rules.
10379 * testsuite/Makefile.in: Regenerate.
10380 * testsuite/exclude_libs_test.c: New file.
10381 * testsuite/exclude_libs_test.sh: Ditto.
10382 * testsuite/exclude_libs_test_1.c: Ditto.
10383 * testsuite/exclude_libs_test_2.c: Ditto.
10385 2009-05-15 Ian Lance Taylor <iant@google.com>
10387 * configure.ac: Check for declarations for cases where libiberty.h
10388 checks HAVE_DECL_xxx.
10389 * configure, config.in: Rebuild.
10391 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10393 * gold.h (Incremental_argument_list): Remove (invalid) forward
10395 * incremental.cc (Incremental_inputs::report_achive): New method.
10396 (Incremental_inputs::report_object): New method.
10397 (Incremental_inputs::report_script): New method.
10398 (Incremental_inputs::finalize_inputs): New method.
10399 (Incremental_inputs::finalize): Call finalize_inputs().
10400 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10401 Create inputs entries.
10402 * incremental.h (Incremental_input_type): New enum.
10403 (Incremental_inputs::Incremental_input): Initialize new fields.
10404 (Incremental_inputs::report_inputs): New method.
10405 (Incremental_inputs::report_achive): New method.
10406 (Incremental_inputs::report_object): New method.
10407 (Incremental_inputs::report_script): New method.
10408 (Incremental_inputs::finalize_inputs): New method.
10409 (Incremental_inputs::Input_info): New struct.
10410 (Incremental_inputs::Input_info_map): New typedef.
10411 (Incremental_inputs::lock_): New field.
10412 (Incremental_inputs::Inputs_): New field.
10413 (Incremental_inputs::Inputs_map): New field.
10414 * main.cc (main): Call Incremental_input::report_inputs.
10415 * options.h (Input_argument_list): Typedef moved from
10417 (Input_file_group::Files): Remove, use ::Input_argument_list.
10418 (Input_file_group::Input_argument_list): Remove, use
10419 ::Input_argument_list.
10420 * plugin.cc (Plugin_manager::add_input_file): Add error in
10422 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10424 * script.cc (read_input_script): Call
10425 Incremental_input::report_script.
10426 * script.h (Script_info): New class.
10428 2009-04-27 Ian Lance Taylor <iant@google.com>
10430 * x86_64.cc (do_adjust_output_section): Set entsize to
10433 2009-04-23 Elliott Hughes <enh@google.com>
10435 * output.cc (Output_file::close): After short writes, continue
10436 writing from the correct offset in the buffer being written.
10438 2009-04-23 Chris Demetriou <cgd@google.com>
10440 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10441 * configure: Regenerate.
10442 * config.in: Regenerate.
10443 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10444 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10446 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10448 * incremental.cc (Incremental_inputs_header_data): Renamed from
10449 Incremental_input_header_data.
10450 (Incremental_inputs_header_data::data_size): New field.
10451 (Incremental_inputs_header_data::put_input_file_count): Renamed
10452 from input_file_count.
10453 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10454 from command_line_offset.
10455 (Incremental_inputs_header_data::put_reserved): Renamed from
10457 (Incremental_inputs_entry_data): Renamed from
10458 Incremental_input_entry_data.
10459 (Incremental_inputs_entry_data::data_size): New field.
10460 (Incremental_inputs::report_command_line): New method.
10461 (Incremental_inputs::finalize): New method.
10462 (Incremental_inputs::create_incremental_inputs_data): New method.
10463 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10464 * incremental.h: New file.
10465 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10466 (Layout::finalize): Create incremental inputs section in
10467 incremental builds.
10468 (Layout::create_incremental_info_sections): New method.
10469 * layout.h (Layout::incremental_inputs): New method.
10470 (Layout::create_incremental_info_sections): New method.
10471 (Layout::incremental_inputs_): New field.
10472 * main.cc (main): Notify Incremental_input of the command line.
10474 2009-04-01 Ian Lance Taylor <iant@google.com>
10475 Mikolaj Zalewski <mikolajz@google.com>
10477 * gold.h (reserve_unordered_map): Define, three versions, one for
10478 each version of Unordered_map.
10479 * layout.cc (Layout::Layout): Remove options parameter. Add
10480 number_of_input_files parameter. Don't initialize options_.
10481 Initialize number_of_input_files_ and resized_signatures_. Move
10482 sections_are_attached_.
10483 (Layout::layout_group): Reserve space for group_signatures_.
10484 (Layout::find_or_add_kept_section): Change name parameter to be a
10485 reference. Resize signatures_ map when it gets large enough.
10486 (Layout::layout_eh_frame): Use parameters->options() instead of
10488 (Layout::make_output_section): Likewise.
10489 (Layout::attach_allocated_section_to_segment): Likewise.
10490 (Layout::finalize, Layout::create_executable_stack): Likewise.
10491 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10492 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10493 * layout.h (class Layout): Update declarations. Remove options_
10494 field. Add number_of_input_files_ and resized_signatures_
10495 fields. Move sections_are_attached_ field.
10496 * main.cc (main): Pass number of input files to Layout
10497 constructor. Don't pass options.
10499 2009-03-30 Ian Lance Taylor <iant@google.com>
10501 * ffsll.c (ffsll): Correct implementation.
10503 2009-03-27 Ian Lance Taylor <iant@google.com>
10505 * ffsll.c: New file.
10506 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10507 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10508 * ftruncate.c (ftruncate): Declare before definition.
10509 * mremap.c (mremap): Likewise.
10510 * pread.c (pread): Likewise.
10511 * configure, Makefile.in, config.in: Rebuild.
10513 * mremap.c: New file.
10514 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10515 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10516 (mremap): Declare if HAVE_MREMAP is not defined.
10517 * configure, Makefile.in, config.in: Rebuild.
10519 2009-03-27 Cary Coutant <ccoutant@google.com>
10521 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10522 position independent.
10523 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10524 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10526 2009-03-24 Cary Coutant <ccoutant@google.com>
10528 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10530 (needs_dynamic_reloc): Likewise.
10532 2009-03-24 Ian Lance Taylor <iant@google.com>
10534 * yyscript.y (file_cmd): Recognize EXTERN.
10535 (extern_name_list, extern_name_list_body): New nonterminals.
10536 * script.cc (script_add_extern): Define.
10537 * script-c.h (script_add_extern): Declare.
10539 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10541 * object.cc (is_elf_object): Define.
10542 * object.h (is_elf_object): Declare.
10543 * archive.cc (Archive::get_elf_object_for_member): Call
10545 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10547 2009-03-24 Elliott Hughes <enh@google.com>
10549 * output.cc (Output_file::map_anonymous): Define.
10550 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10551 try an anonymous one. Report the size if the mmap fails.
10552 * output.h (class Output_file): Declare map_anonymous.
10554 2009-03-24 Ian Lance Taylor <iant@google.com>
10556 * target-select.cc (instantiate_target): Don't acquire the lock if
10557 the instantiated_target_ field has already been set.
10559 2009-03-23 Ian Lance Taylor <iant@google.com>
10561 * gold-threads.h (class Initialize_lock): Define.
10562 * gold-threads.cc (class Initialize_lock_once): Define.
10563 (initialize_lock_control): New static variable.
10564 (initialize_lock_pointer): New static variable.
10565 (initialize_lock_once): New static function.
10566 (Initialize_lock::Initialize_lock): Define.
10567 (Initialize_lock::initialize): Define.
10568 * target-select.h: Include "gold-threads.h".
10569 (class Target_selector): Add lock_ and initialize_lock_ fields.
10570 Don't define instantiate_target, just declare it.
10571 * target-select.cc (Target_selector::Target_selector): Initialize
10573 (Target_selector::instantiate_target): Define.
10574 * descriptors.h: Include "gold-threads.h".
10575 (class Descriptors): Add initialize_lock_ field.
10576 * descriptors.cc (Descriptors::Descriptors): Initialize new
10578 (Descriptors::open): Use initialize_lock_ field
10579 * errors.h (class Errors): Add initialize_lock_ field.
10580 * errors.cc (Errors::Errors): Initialize new field.
10581 (Errors::initialize_lock): Use initialize_lock_ field.
10582 * powerpc.cc (class Target_selector_powerpc): Remove
10583 instantiated_target_ field. In do_recognize call
10584 instantiate_target rather than do_instantiate_target. In
10585 do_instantiate_target just allocate a new target.
10586 * sparc.cc (class Target_selector_sparc): Likewise.
10588 * freebsd.h: New file.
10589 * i386.cc: Include "freebsd.h".
10590 (Target_i386): Derive from Target_freebsd rather than
10592 (Target_selector_i386): Derive from Target_selector_freebsd rather
10593 than Target_selector.
10594 * x86_64.cc: Include "freebsd.h".
10595 (Target_x86_64): Derive from Target_freebsd rather than
10597 (Target_selector_x86_64): Derive from Target_selector_freebsd
10598 rather than Target_selector.
10599 * target.h (class Target): Add adjust_elf_header and
10600 do_adjust_elf_header.
10601 * output.cc (Output_file_header:: do_sized_write): Call target
10602 adjust_elf_header routine.
10603 * configure.tgt: Set targ_osabi.
10604 * configure.ac: Define GOLD_DEFAULT_OSABI.
10605 * parameters.cc (Parameters::default_target): Pass
10606 GOLD_DEFAULT_OSABI to select_target.
10607 * target-select.h (class Target_selector): Make instantiate_target
10608 protected rather than private.
10609 * Makefile.am (HFILES): Add freebsd.h.
10610 * configure, Makefile.in, config.in: Rebuild.
10612 * merge.cc (do_add_input_section): Correct pend value. Change
10613 message about last entry not being null terminated from error to
10616 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10618 * incremental.cc: New file.
10619 * Makefile.am (CCFILES): Add incremental.cc.
10620 * Makefile.in: Rebuild.
10622 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10624 * layout.cc (Layout::output_section_name): Preserve names
10625 of '.note.' sections.
10627 2009-03-19 Ian Lance Taylor <iant@google.com>
10629 * descriptors.cc (Descriptors::open): Check that the options are
10630 valid before using them.
10632 2009-03-18 Ian Lance Taylor <iant@google.com>
10634 * script-sections.h: Include <list>.
10635 (class Script_sections): Change Sections_elements from std::vector
10636 to std::list. Typedef public Elements_iterator. Add
10637 orphan_section_placement_, data_segment_align_start_, and
10638 saw_data_segment_align_ fields. Remove data_segment_align_index_
10640 * script-sections.cc (class Orphan_section_placement): New class.
10641 (class Sections_element): Add virtual functions is_relro and
10642 orphan_section_init. Remove virtual function place_orphan_here.
10643 (class Output_section_definition): Add is_relro and
10644 orphan_section_init. Remove place_orphan_here.
10645 (class Orphan_output_section): Likewise.
10646 (Script_sections::Script_sections): Update for field changes.
10647 (Script_sections::data_segment_align): Set saw_data_segment_align_
10648 and data_segment_align_start_, not data_segment_align_index.
10649 (Script_sections::data_segment_relro_end): Check
10650 saw_data_segment_align_. Use data_segment_align_start_ rather
10651 than data_segment_align_index_.
10652 (Script_sections::place_orphan): Rewrite to use
10653 Orphan_section_placement.
10655 2009-03-17 Ian Lance Taylor <iant@google.com>
10657 * archive.cc (Archive::add_symbols): Check for a version attached
10658 to the symbol name in the archive map.
10659 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10660 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10661 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10662 (ver_test_11.a): New target.
10663 * testsuite/Makefile.in: Rebuild.
10665 * configure.ac: Check for chsize and posix_fallocate. Replace
10667 * ftruncate.c: New file, from gnulib.
10668 * output.cc (posix_fallocate): Define dummy version if not
10669 HAVE_POSIX_FALLOCATE.
10670 (Output_file::map): Call posix_fallocate rather than lseek and
10672 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10673 * configure, Makefile.in, config.in: Rebuild.
10675 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10677 * layout.h (Layout::create_note): Add section_name parameter.
10678 * layout.cc (Layout::create_note): Likewise.
10679 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10681 2009-03-17 Ian Lance Taylor <iant@google.com>
10683 * descriptors.cc: Include "options.h".
10684 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10685 (Descriptors::open): Always use O_CLOEXEC when opening a new
10686 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10687 then set FD_CLOEXEC.
10689 * sparc.cc (class Target_sparc): Add has_got_section.
10690 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10691 make sure we have a GOT section.
10693 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10694 (Target_sparc::Scan::local): Likewise.
10695 (Target_sparc::Scan::global): Likewise.
10696 (Target_sparc::Relocate::relocate): Likewise.
10697 (Target_sparc::Relocate::relocate_tls): Likewise.
10699 * symtab.cc (Symbol_table::define_default_version): New function,
10700 broken out of add_from_object.
10701 (Symbol_table::add_from_object): Call define_default_version.
10702 (Symbol_table::define_special_symbol): Add resolve_oldsym
10703 parameter. Change all callers. If the version for a symbol comes
10704 from a version script, resolve it with the symbol with the same
10705 name with no version. Also add the symbol without a version if
10707 (do_define_in_output_data): If resolving with oldsym, don't delete
10709 (do_define_in_output_segment): Likewise.
10710 (do_define_as_constant): Likewise.
10711 * symtab.h (class Symbol_table): Update declarations.
10713 2009-03-13 Ian Lance Taylor <iant@google.com>
10715 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10716 (Read_symbols::requeue): New function.
10717 (Read_symbols::do_read_symbols): If make_elf_object fails because
10718 the target type is not configured, and the file was searched for,
10719 issue a warning and retry with the next directory.
10720 (Add_symbols::run): If the file has an incompatible format, and
10721 it was searched for, requeue the Read_symbols task. On error,
10722 release the object.
10723 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10724 dirindex parameter to constructor. Change all callers. Declare
10725 incompatible_warning and requeue.
10726 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10727 input_argument_ and input_group_ fields. Add them to
10728 constructor. Change all callers.
10729 (class Read_script): Add dirindex_ field. Add it to constructor.
10730 Change all callers.
10731 * archive.cc (Archive::setup): Remove input_objects parameter.
10732 Change all callers.
10733 (Archive::get_file_and_offset): Likewise.
10734 (Archive::read_all_symbols): Likewise.
10735 (Archive::read_symbols): Likewise.
10736 (Archive::get_elf_object_for_member): Remove input_objects
10737 parameter. Add punconfigured parameter. Change all callers.
10738 (Archive::add_symbols): Change return type to bool. Check return
10739 value of include_member.
10740 (Archive::include_all_members): Likewise.
10741 (Archive::include_member): Change return type to bool. Return
10742 false if first included object has incompatible target. Set
10743 included_member_ field.
10744 (Add_archive_symbols::run): If add_symbols returns false, requeue
10746 * archive.h (class Archive): Add included_member_ field.
10747 Initialize it in constructor. Add input_file and searched_for
10748 methods. Update declarations.
10749 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10750 input_argument_ fields. Add them to constructor. Change all
10752 * script.cc: Include "target-select.h".
10753 (class Parser_closure): Add skip_on_incompatible_target_ and
10754 found_incompatible_target_ fields. Add
10755 skip_on_incompatible_target parameter to constructor. Change all
10756 callers. Add methods skip_on_incompatible_target,
10757 clear_skip_on_incompatible_target, found_incompatible_target, and
10758 set_found_incompatible_target.
10759 (read_input_script): Add dirindex parameter. Change all callers.
10760 If parser finds an incompatible target, requeue Read_symbols
10762 (script_set_symbol): Clear skip_on_incompatible_target in
10764 (script_add_assertion, script_parse_option): Likewise.
10765 (script_start_sections, script_add_phdr): Likewise.
10766 (script_check_output_format): New function.
10767 * script.h (read_input_script): Update declaration.
10768 * script-c.h (script_check_output_format): Declare.
10769 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10770 (ignore_cmd): Remove OUTPUT_FORMAT.
10771 * fileread.cc (Input_file::Input_file): Add explicit this.
10772 (Input_file::will_search_for): New function.
10773 (Input_file::open): Add pindex parameter. Change all callers.
10774 * fileread.h (class Input_file): Add input_file_argument method.
10775 Declare will_search_for. Update declarations.
10776 * object.cc (make_elf_object): Add punconfigured parameter.
10777 Change all callers.
10778 * object.h (class Object): Make input_file public. Add
10779 searched_for method.
10780 (make_elf_object): Update declaration.
10781 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10783 * dirsearch.h (class Dirsearch): Update declaration.
10784 * options.h (class General_options): Add --warn-search-mismatch.
10785 * parameters.cc (Parameters::is_compatible_target): New function.
10786 * parameters.h (class Parameters): Declare is_compatible_target.
10787 * workqueue.cc (Workqueue::add_blocker): New function.
10788 * workqueue.h (class Workqueue): Declare add_blocker.
10790 * fileread.cc (Input_file::open): Remove options parameter.
10791 Change all callers.
10792 (Input_file::open_binary): Likewise.
10793 * script.cc (read_input_script): Likewise.
10794 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10795 options parameter from constructor. Change all callers.
10796 (class Read_script): Likewise.
10797 * fileread.h (class Input_file): Update declarations.
10798 * script.h (read_input_script): Update declaration.
10800 2009-03-10 Nick Clifton <nickc@redhat.com>
10802 * po/es.po: New Spanish translation.
10804 2009-03-06 Cary Coutant <ccoutant@google.com>
10806 * options.cc (parse_short_option): Keep dash_z from registering itself.
10808 2009-03-03 Ian Lance Taylor <iant@google.com>
10811 * target-reloc.h (relocate_section): Pass output_section to
10813 * i386.cc (Target_i386::should_apply_static_reloc): Add
10814 output_section parameter. Change all callers.
10815 (Target_i386::Relocate::relocate): Add output_section parameter.
10816 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10817 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10818 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10819 * testsuite/two_file_shared.sh: New script.
10820 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10821 (check_DATA): Add two_file_shared.dbg.
10822 (two_file_shared.dbg): New target.
10823 * testsuite/Makefile.in: Rebuild.
10825 2009-03-01 Ian Lance Taylor <iant@google.com>
10827 * configure.ac: Check for byteswap.h.
10828 * configure: Rebuild.
10829 * config.in: Rebuild.
10831 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10833 * layout.cc (Layout::find_or_add_kept_section): New function.
10834 (Layout::add_comdat): Removed.
10835 * layout.h (struct Kept_section): Move out of class Layout.
10836 Remove trailing underscores from field names. Add group_sections
10837 field. Rename group_ field to is_group. Change all uses.
10838 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10839 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10840 comdat_groups_ field.
10841 (Sized_relobj::include_section_group): Use
10842 find_or_add_kept_section and Kept_section::group_sections.
10843 (Sized_relobj::include_linkonce_section): Likewise.
10844 * object.cc (class Sized_relobj): Don't define Comdat_group or
10845 Comdat_group_table. Remove find_comdat_group and
10846 add_comdat_group. Remove comdat_groups_ field.
10847 * plugin.cc (include_comdat_group): Use
10848 Layout::find_or_add_kept_section.
10850 2009-02-28 Ian Lance Taylor <iant@google.com>
10852 * README: --gc-sections and map files are now supported. Document
10853 some build requirements.
10856 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10857 relocatable link set the value of the section symbol to zero.
10858 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10859 relocatable link don't include the section address in the local
10862 2009-02-27 Ian Lance Taylor <iant@google.com>
10865 * options.h (class Search_directory): Add is_system_directory.
10866 (class General_options): Declare is_in_system_directory.
10867 * options.cc (get_relative_sysroot): Make static.
10868 (get_default_sysroot): Make static.
10869 (General_optoins::is_in_system_directory): New function.
10870 * fileread.cc (Input_file::is_in_system_directory): New function.
10871 * fileread.h (class Input_file): Declare is_in_system_directory.
10872 * object.h (class Object): Add is_in_system_directory.
10873 (class Input_objects): Remove system_library_directory_ field.
10874 * object.cc (Input_objects::add_object): Don't set
10875 system_library_directory_.
10876 (input_objects::found_in_system_library_directory): Remove.
10877 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10878 parameter. Change all callers.
10879 (Symbol_table::sized_write_globals): Likewise.
10880 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10881 Call Object::is_in_system_directory.
10882 * symtab.h (class Symbol_table): Update declarations.
10885 * descriptors.h (Open_descriptor): Add is_on_stack field.
10886 * descriptors.cc (Descriptors::open): If the descriptor is on the
10887 top of the stack, remove it. Initialize is_on_stack field.
10888 (Descriptors::release): Only add pod to stack if it is not on the
10890 (Descriptors::close_some_descriptor): Clear stack_next and
10891 is_on_stack fields.
10894 * output.cc (Output_section::find_starting_output_address): Rename
10895 from starting_output_address; add PADDR parameter; change return
10897 * output.h (class Output_section): Declare
10898 find_starting_output_address instead of starting_output_address.
10899 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10900 section symbol for which we can't find a merge section.
10903 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10904 hidden or internal, force the symbol to be local.
10905 * resolve.cc (Symbol::override_visibility): Define.
10906 (Symbol::override_base): Use override_visibility.
10907 (Symbol_table::resolve): Likewise.
10908 (Symbol::override_base_with_special): Likewise.
10909 (Symbol_table::override_with_special): If the visibility is hidden
10910 or internal, force the symbol to be local.
10911 * symtab.h (class Symbol): Add set_visibility and
10912 override_visibility.
10913 * testsuite/ver_test_1.sh: New file.
10914 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10915 (check_DATA): Add ver_test_1.syms.
10916 (ver_test_1.syms): New target.
10917 * testsuite/Makefile.in: Rebuild.
10919 2009-02-25 Cary Coutant <ccoutant@google.com>
10921 * layout.cc (Layout::choose_output_section): Don't rename sections
10922 when using a linker script that has a SECTIONS clause.
10923 * Makefile.in: Regenerate.
10925 * testsuite/Makefile.am (script_test_5.sh): New test case.
10926 * testsuite/Makefile.in: Regenerate.
10927 * testsuite/script_test_5.cc: New file.
10928 * testsuite/script_test_5.sh: New file.
10929 * testsuite/script_test_5.t: New file.
10931 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10933 * archive.cc (Archive::include_member): Update calls to add_symbols.
10934 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10935 the Layout argument.
10936 * dynobj.h (do_add_symbols): Add the Layout argument.
10937 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10939 * object.h (Object::add_symbols): Add the Layout argument.
10940 (Object::do_add_symbols): Add the Layout argument.
10941 (Sized_relobj::do_add_symbols): Add the Layout argument.
10942 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10943 Unify the two versions.
10944 (Add_plugin_symbols): Remove.
10945 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10946 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10947 (Add_plugin_symbols): Remove.
10948 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10949 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10950 (Add_symbols::run): Make it work with Pulginobj.
10952 2009-02-06 Ian Lance Taylor <iant@google.com>
10954 * object.cc (Sized_relobj::do_layout): Make info message start
10955 with lower case letter.
10957 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10959 * binary.cc: Fix file comment.
10961 * options.h (enum Incremental_disposition): Define.
10962 (class General_options): Add new options: --incremental,
10963 --incremental_changed, --incremental_unchanged,
10964 --incremental_unknown. Add incremental_disposition_ and
10965 implicit_incremental_ fields.
10966 (General_options::incremental_disposition): New function.
10967 (class Position_dependent_options): Add incremental_disposition
10969 (Position_dependent_options::copy_from_options): Set incremental
10971 * options.cc (General_options::parse_incremental_changed): New
10973 (General_options::parse_incremental_unchanged): New function.
10974 (General_options::parse_incremental_unknown): New function.
10975 (General_options::General_options): Initialize new fields
10976 incremental_disposition_ and implicit_incremental_.
10977 (General_options::finalize): Check for uasge of --incremental-*
10978 without --incremental.
10980 2009-02-06 Chris Demetriou <cgd@google.com>
10982 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10983 pointer and to report location as the file name associated with
10985 (gold_undefined_symbol_at_location): New function to replace the
10986 old gold_undefined_symbol functionality.
10987 * target-reloc.h (relocate_section): Update to use
10988 gold_undefined_symbol_at_location.
10989 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10990 Call gold_undefined_symbol function rather than gold_error.
10991 * errors.h (Errors::undefined_symbol): Take location as a
10992 string, rather than calculating it from a relocation.
10993 * errors.cc (Errors::fatal): Print "fatal error:" before the
10995 (Errors::error, Errors::error_at_location): Print "error: "
10996 before the formatted message.
10997 (Errors::undefined_symbol): Take location as a string, rather
10998 than calculating it from a relocation.
10999 (gold_undefined_symbol_at_location): New function akin to
11000 old gold_undefined_symbol, calculates location from relocation.
11001 (gold_undefined_symbol): Change to take only a Symbol pointer
11002 and to report location as the file name associated with the symbol.
11003 * testsuite/debug_msg.sh: Update for changed error messages.
11004 * testsuite/undef_symbol.sh: Likewise.
11006 2009-02-04 Duncan Sands <baldrick@free.fr>
11009 * reduced_debug_output.h
11010 (Output_reduced_debug_abbrev_section::failed): Use format for
11012 (Output_reduced_debug_info_section::faild): Likewise.
11014 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11016 * script.cc (Lazy_demangler): New class.
11017 (Version_script_info::get_symbol_version_helper): Demangle a
11020 2009-01-29 Cary Coutant <ccoutant@google.com>
11022 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11024 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11026 2009-01-28 Ian Lance Taylor <iant@google.com>
11028 * version.cc (version_string): Bump to 1.9.
11030 * gold.h: Include <cstring> and <stdint.h>.
11031 * version.cc: Include <cstdio>.
11032 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11034 * reduced_debug_output.cc (insert_into_vector): Rename from
11035 Insert_into_vector; change all callers. Use Swap_unaligned to
11036 avoid aliasing issue; remove union since it is unnecessary.
11038 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11040 * Makefile.am (CCFILES): Add gc.cc.
11041 (HFILES): Add gc.h.
11042 * Makefile.in: Regenerate.
11043 * gold.cc (Gc_runner): New class.
11044 (queue_initial_tasks): Call garbage collection related tasks
11045 when corresponding options are invoked.
11046 (queue_middle_gc_tasks): New function.
11047 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11048 processed early before laying out sections during garbage collection.
11049 * gold.h (queue_middle_gc_tasks): New function.
11050 (is_prefix_of): Move from "layout.cc".
11051 * i386.cc (Target_i386::gc_process_relocs): New function.
11052 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11053 * main.cc (main): Create object of class "Garbage_collection".
11054 * object.cc (Relobj::copy_symbols_data): New function.
11055 (Relobj::is_section_name_included): New function.
11056 (Sized_relobj::do_layout): Allow this function to be called twice
11057 during garbage collection and defer layout of section during the
11059 * object.h (Relobj::get_symbols_data): New function.
11060 (Relobj::is_section_name_included): New function.
11061 (Relobj::copy_symbols_data): New function.
11062 (Relobj::set_symbols_data): New function.
11063 (Relobj::get_relocs_data): New function.
11064 (Relobj::set_relocs_data): New function.
11065 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11066 (Relobj::gc_process_relocs): New function.
11067 (Relobj::do_gc_process_relocs): New pure virtual function.
11068 (Relobj::sd_): New data member.
11069 (Sized_relobj::is_output_section_offset_invalid): New function.
11070 (Sized_relobj::do_gc_process_relocs): New function.
11071 * options.h (General_options::gc_sections): Modify to not be a no-op.
11072 (General_options::print_gc_sections): New option.
11073 * plugin.cc (Plugin_finish::run): Remove function call to
11074 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11075 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11076 * reloc.cc (Read_relocs::run): Add task to process relocs and
11077 determine unreferenced sections when doing garbage collection.
11078 (Gc_process_relocs): New class.
11079 (Sized_relobj::do_gc_process_relocs): New function.
11080 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11081 sections that are garbage collected.
11082 * reloc.h (Gc_process_relocs): New class.
11083 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11084 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11085 symbols whose corresponding sections are garbage collected.
11086 (Symbol_table::Symbol_table): Add new parameter for the garbage
11088 (Symbol_table::gc_mark_undef_symbols): New function.
11089 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11090 (Symbol_table::gc_mark_dyn_syms): New function.
11091 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11093 (Symbol_table::add_from_object): Likewise.
11094 (Symbol_table::add_from_relobj): When building shared objects, do not
11095 treat externally visible symbols as garbage.
11096 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11097 table information for static and relocatable links.
11098 * symtab.h (Symbol_table::set_gc): New function.
11099 (Symbol_table::gc): New function.
11100 (Symbol_table::gc_mark_undef_symbols): New function.
11101 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11102 (Symbol_table::gc_mark_dyn_syms): New function.
11103 (Symbol_table::gc_): New data member.
11104 * target.h (Sized_target::gc_process_relocs): New pure virtual
11106 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11107 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11109 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11111 * options.h (General_options::gc_sections): Define as a no-op for now.
11112 (General_options::no_keep_memory): Ditto.
11113 (General_options::Bshareable): Define.
11114 * options.cc (General_options::finalize): Honor -Bshareable.
11116 2009-01-20 Andreas Schwab <schwab@suse.de>
11118 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11119 read the value in the contents, since we don't use it. Use the
11120 template endianness when writing.
11121 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11123 2009-01-19 Andreas Schwab <schwab@suse.de>
11125 * configure.tgt (powerpc64-*): Fix targ_obj.
11127 2009-01-15 Ian Lance Taylor <iant@google.com>
11129 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11130 local symbols when stripping all symbols.
11132 2009-01-14 Cary Coutant <ccoutant@google.com>
11134 * output.cc (Output_reloc): Add explicit instantiations.
11136 2009-01-14 Cary Coutant <ccoutant@google.com>
11138 * archive.cc (Archive::get_elf_object_for_member): Remove call
11139 to File_read::claim_for_plugin.
11140 * descriptors.cc (Descriptors::open): Remove reference to
11142 (Descriptors::claim_for_plugin): Remove.
11143 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11144 (Descriptors::is_claimed): Remove.
11145 (claim_descriptor_for_plugin): Remove.
11146 * fileread.cc (File_read::claim_for_plugin): Remove.
11147 * fileread.h (File_read::claim_for_plugin): Remove.
11148 (File_read::descriptor): Reopen descriptor if necessary.
11149 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11150 (Plugin_manager::all_symbols_read): Add task parameter. Change
11152 (Plugin_manager::get_input_file): New function.
11153 (Plugin_manager::release_input_file): New function.
11154 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11155 corresponding data member.
11156 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11157 and pass to base constructor. Change all callers.
11158 (get_input_file, release_input_file): New functions.
11159 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11160 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11161 (Plugin_manager::all_symbols_read): Add task parameter.
11162 (Plugin_manager::get_input_file): New function.
11163 (Plugin_manager::release_input_file): New function.
11164 (Plugin_manager::task_): New data member.
11165 (Pluginobj::Pluginobj): Add filesize parameter.
11166 (Pluginobj::filename): New function.
11167 (Pluginobj::descriptor): New function.
11168 (Pluginobj::filesize): New function.
11169 (Pluginobj::filesize_): New data member.
11170 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11171 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11172 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11174 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11175 with archive libraries.
11176 * testsuite/Makefile.in: Regenerate.
11177 * testsuite/plugin_test.c (struct sym_info): New type.
11178 (get_input_file, release_input_file): New static variables.
11179 (onload): Capture new transfer vector entries.
11180 (claim_file_hook): Stop reading at end of file according to filesize.
11181 Factor out parsing of readelf output into separate function.
11182 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11183 APIs and get the source file name from the symbol table. Convert
11184 source file name to corresponding object file name. Print info
11185 message when adding new input files.
11186 (parse_readelf_line): New function.
11187 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11188 * testsuite/plugin_test_2.sh: Likewise.
11189 * testsuite/plugin_test_3.sh: Likewise.
11190 * testsuite/plugin_test_4.sh: New test case.
11192 2009-01-07 Ian Lance Taylor <iant@google.com>
11194 * version.cc (version_string): Bump to 1.8.
11196 2008-12-23 Cary Coutant <ccoutant@google.com>
11198 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11199 * plugin.cc (Plugin_manager::finish): Rename as
11200 layout_deferred_objects. Move cleanup to separate function.
11201 (Plugin_manager::cleanup): New function.
11202 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11204 * plugin.h (Plugin_manager::finish): Rename as
11205 layout_deferred_objects.
11206 (Plugin_manager::cleanup): New function.
11207 (Plugin_manager::cleanup_done): New field.
11209 2008-12-23 Cary Coutant <ccoutant@google.com>
11211 * plugin.cc (is_visible_from_outside): New function.
11212 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11213 so we don't return "IR only" status for exported symbols or -r links.
11215 * testsuite/Makefile.am (plugin_test_3): New test case.
11216 * testsuite/Makefile.in: Regenerate.
11217 * testsuite/plugin_test_3.sh: New file.
11219 2008-12-22 Cary Coutant <ccoutant@google.com>
11221 * object.cc (Sized_relobj::layout_section): New function.
11222 (Sized_relobj::do_layout): Defer layout of input sections until after
11223 plugin has provided replacement files.
11224 (Sized_relobj::do_layout_deferred_sections): New function.
11225 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11226 (Relobj::layout_deferred_sections): New function.
11227 (Relobj::do_layout_deferred_sections): New function.
11228 (Sized_relobj::do_layout_deferred_sections): New function.
11229 (Sized_relobj::layout_section): New function.
11230 (Sized_relobj::Deferred_layout): New structure.
11231 (Sized_relobj::deferred_layout_): New field.
11232 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11233 Change all callers. Layout deferred sections.
11234 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11236 (Plugin_hook::run): Move code from do_plugin_hook inline.
11237 (Plugin_hook::do_plugin_hook): Remove.
11238 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11239 (Plugin_manager::finish): Renamed, was cleanup.
11240 (Plugin_manager::should_defer_layout): New function.
11241 (Plugin_manager::add_deferred_layout_object): New function.
11242 (Plugin_manager::Deferred_layout_list): New type.
11243 (Plugin_manager::deferred_layout_objects_): New field.
11244 (Plugin_hook::do_plugin_hook): Remove.
11246 2008-12-17 Ian Lance Taylor <iant@google.com>
11248 * options.h (class General_options): Add --no case for
11251 2008-12-16 Cary Coutant <ccoutant@google.com>
11253 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11255 (Plugin_manager::claim_file): Create plugin object even if
11256 plugin did not call the add_symbols callback.
11257 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11258 asking for more symbols than were added.
11259 * testsuite/Makefile.am (plugin_test_1): Add test case with
11261 (empty.syms): New target.
11262 * testsuite/Makefile.in: Regenerate.
11263 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11264 message. Don't call add_symbols if no globals.
11265 (all_symbols_read_hook): Don't provide replacement for empty
11268 2008-12-12 Ian Lance Taylor <iant@google.com>
11270 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11271 r_type == 0 for a local symbol with r_sym == 0.
11272 (scan_relocatable_relocs): Pass r_sym to
11273 local_non_section_strategy.
11274 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11277 * configure.ac: Update test for TLS descriptors: they are
11278 supported as of glibc 2.9.
11279 * configure: Rebuild.
11281 2008-12-11 Ian Lance Taylor <iant@google.com>
11284 * target-reloc.h (Default_scan_relocatable_relocs): For each
11285 function, map r_type == 0 to RELOC_DISCARD.
11287 2008-12-10 Cary Coutant <ccoutant@google.com>
11289 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11290 object to override a kept COMDAT group from a plugin object.
11292 2008-12-09 Ian Lance Taylor <iant@google.com>
11295 * yyscript.y (file_cmd): Handle INPUT.
11297 * testsuite/initpri1.c: Change all declarations to be full
11298 prototypes by adding void, to avoid compiler warnings.
11300 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11302 * options.cc (General_options::parse_plugin_opt): New.
11303 (General_options::add_plugin): The argument now is just the filename.
11304 (General_options::add_plugin_option): New.
11305 * options.h (plugin_opt): New.
11306 (add_plugin): Change argument name.
11307 (add_plugin_option): New.
11308 * plugin.cc (Plugin::load): Don't parse the plugin option.
11309 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11310 (Plugin::add_option): New.
11311 (Plugin::args_): Change type.
11312 (Plugin::filename_): New.
11313 (Plugin_manager::add_plugin_option): New.
11314 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11315 * testsuite/Makefile.in: Regenerate.
11317 2008-12-05 Cary Coutant <ccoutant@google.com>
11319 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11320 Handle --strip-lto-sections option.
11321 * options.h (strip_lto_sections): New option.
11323 2008-12-01 Cary Coutant <ccoutant@google.com>
11325 * plugin.cc (ld_plugin_message): Change format parameter to const.
11326 Fix mismatch between new[] and delete.
11328 2008-11-14 Cary Coutant <ccoutant@google.com>
11330 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11333 2008-11-05 Craig Silverstein <csilvers@google.com>
11335 * options.cc (General_options::parse_dynamic_list): New function.
11336 * options.h (General_options): New flags dynamic_list,
11337 dynamic_list_data, dynamic_list_cpp_new, and
11338 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11339 (General_options::in_dynamic_list): New function.
11340 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11341 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11342 (Lex::can_continue_name): Likewise.
11344 (read_script_file): New parameter script_options.
11345 (read_dynamic_list): New function.
11346 (Script_options::define_dynamic_list): New function.
11347 (dynamic_list_keyword_parsecodes): New variable.
11348 (dynamic_list_keywords): New variable.
11349 * script.h (Script_options::define_dynamic_list): New function
11351 (read_dynamic_list): New function prototype.
11352 * symtab.cc (strprefix): New macro.
11353 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11354 dynamic_list_data, dynamic_list_cpp_new, and
11355 dynamic_list_cpp_typeinfo.
11356 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11357 (dynamic_list_expr): New rule.
11358 (dynamic_list_nodes): Likewise.
11359 (dynamic_list_node): Likewise.
11360 * testsuite/Makefile.am (dynamic_list): New test.
11361 * testsuite/Makefile.in: Regenerated.
11362 * testsuite/dynamic_list.t: New file.
11363 * testsuite/dynamic_list.sh: New file.
11365 2008-11-05 Craig Silverstein <csilvers@google.com>
11367 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11368 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11369 (t11_last): Likewise.
11370 * testsuite/ver_test_6.c (main): Likewise.
11372 2008-10-07 Cary Coutant <ccoutant@google.com>
11374 * options.c (General_options::finalize): Add check for -static and
11376 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11379 2008-10-02 Cary Coutant <ccoutant@google.com>
11381 * plugin.cc (make_sized_plugin_object): Fix conditional
11382 compilation to work when not all targets are enabled.
11384 2008-09-29 Cary Coutant <ccoutant@google.com>
11386 * archive.cc (Archive::get_file_and_offset): Use filename instead
11387 of name to get library path.
11388 (Archive::include_member): Unlock external member of a thin archive.
11390 * testsuite/Makefile.am (TEST_AR): New variable.
11391 (thin_archive_test_1): New test.
11392 (thin_archive_test_2): New test.
11393 * testsuite/Makefile.in: Regenerate.
11394 * testsuite/thin_archive_main.cc: New file.
11395 * testsuite/thin_archive_test_1.cc: New file.
11396 * testsuite/thin_archive_test_2.cc: New file.
11397 * testsuite/thin_archive_test_3.cc: New file.
11398 * testsuite/thin_archive_test_4.cc: New file.
11400 2008-09-29 Cary Coutant <ccoutant@google.com>
11402 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11403 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11405 (Sized_relobj::do_finalize_local_symbols): Likewise.
11406 (Sized_relobj::map_to_kept_section): Likewise.
11407 * object.h (Sized_relobj::invalid_address): New constant.
11408 (Sized_relobj::do_output_section_offset): Check for invalid_address
11410 * output.cc (Output_reloc::local_section_offset): Use constant
11411 invalid_address instead of -1U.
11412 (Output_reloc::get_address): Likewise.
11413 (Output_section::output_address): Change -1U to -1ULL.
11414 * output.h (Output_reloc::invalid_address): New constant.
11415 * reloc.cc (Sized_relobj::write_sections): Use constant
11416 invalid_address instead of -1U.
11417 (Sized_relobj::relocate_sections): Likewise.
11418 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11419 values for merge sections.
11420 * target-reloc.h (relocate_for_relocatable): Use constant
11421 invalid_address instead of -1U.
11423 2008-09-19 Cary Coutant <ccoutant@google.com>
11425 Add plugin functionality for link-time optimization (LTO).
11426 * configure.ac (plugins): Add --enable-plugins option.
11427 * configure: Regenerate.
11428 * config.in: Regenerate.
11429 * Makefile.am (LIBDL): New variable.
11430 (CCFILES): Add plugin.cc.
11431 (HFILES): Add plugin.h.
11432 (ldadd_var): Add LIBDL.
11433 * Makefile.in: Regenerate.
11435 * archive.cc: Include "plugin.h".
11436 (Archive::setup): Don't preread archive symbols when using a plugin.
11437 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11438 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11440 (Archive::include_member): Add symbols from plugin objects.
11441 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11442 * descriptors.cc (Descriptors::open): Check for file descriptors
11443 abandoned by plugins.
11444 (Descriptors::claim_for_plugin): New function.
11445 * descriptors.h (Descriptors::claim_for_plugin): New function.
11446 (Open_descriptor::is_claimed): New field.
11447 (claim_descriptor_for_plugin): New function.
11448 * fileread.cc (File_read::claim_for_plugin): New function.
11449 * fileread.h (File_read::claim_for_plugin): New function.
11450 (File_read::descriptor): New function.
11451 * gold.cc: Include "plugin.h".
11452 (queue_initial_tasks): Add task to call plugin hooks for generating
11454 * main.cc: Include "plugin.h".
11455 (main): Load plugin libraries.
11456 * object.h (Pluginobj): Declare.
11457 (Object::pluginobj): New function.
11458 (Object::do_pluginobj): New function.
11459 (Object::set_target): New function.
11460 * options.cc: Include "plugin.h".
11461 (General_options::parse_plugin): New function.
11462 (General_options::General_options): Initialize plugins_ field.
11463 (General_options::add_plugin): New function.
11464 * options.h (Plugin_manager): Declare.
11465 (General_options): Add --plugin option.
11466 (General_options::has_plugins): New function.
11467 (General_options::plugins): New function.
11468 (General_options::add_plugin): New function.
11469 (General_options::plugins_): New field.
11470 * plugin.cc: New file.
11471 * plugin.h: New file.
11472 * readsyms.cc: Include "plugin.h".
11473 (Read_symbols::do_read_symbols): Check for archive before checking
11474 for ELF file. Call plugin hooks to claim files.
11475 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11476 from a real object file; force override when processing replacement
11478 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11479 (Symbol::init_base_object): Likewise.
11480 (Symbol::init_base_output_data): Likewise.
11481 (Symbol::init_base_output_segment): Likewise.
11482 (Symbol::init_base_constant): Likewise.
11483 (Symbol::init_base_undefined): Likewise.
11484 (Symbol::output_section): Assert that object is not a plugin.
11485 (Symbol_table::add_from_pluginobj): New function.
11486 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11488 (Symbol_table::sized_write_globals): Likewise.
11489 (Symbol_table::add_from_pluginobj): Instantiate template.
11490 * symtab.h (Sized_pluginobj): Declare.
11491 (Symbol::in_real_elf): New function.
11492 (Symbol::set_in_real_elf): New function.
11493 (Symbol::in_real_elf_): New field.
11494 (Symbol_table::add_from_pluginobj): New function.
11496 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11497 (LIBDL): New variable.
11498 (LDADD): Add LIBDL.
11499 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11500 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11501 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11502 (MOSTLYCLEANFILES): Likewise.
11503 * testsuite/Makefile.in: Regenerate.
11504 * testsuite/plugin_test.c: New file.
11505 * testsuite/plugin_test_1.sh: New file.
11506 * testsuite/plugin_test_2.sh: New file.
11508 2008-09-16 Ian Lance Taylor <iant@google.com>
11510 * target-reloc.h (relocate_section): Check whether a symbol is
11511 defined by the ABI before reporting an undefined symbol error.
11512 * target.h (Target::is_defined_by_abi): Make parameter const.
11513 (Target::do_is_defined_by_abi): Likewise.
11514 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11515 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11516 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11517 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11518 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11519 * testsuite/Makefile.in: Rebuild.
11521 * fileread.cc (make_view): Add casts to avoid warning.
11523 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11525 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11526 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11528 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11530 * options.h (General_options::output_is_executable): New.
11531 (General_options::output_is_pie): New.
11532 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11533 for shared libraries.
11534 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11536 2008-09-11 Chris Demetriou <cgd@google.com>
11538 * options.h (origin): New -z option.
11539 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11540 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11543 2008-09-05 Cary Coutant <ccoutant@google.com>
11545 * fileread.cc (File_read::make_view): Add check for attempt to map
11546 beyond end of file.
11548 2008-09-05 Cary Coutant <ccoutant@google.com>
11550 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11551 explicit instantiations.
11553 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11556 * options.cc (General_options::finalize): Allow undefined symbols
11557 in shlibs if linking -shared.
11560 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11561 symbols as not needing a dynsym entry.
11563 2008-08-20 Craig Silverstein <csilvers@google.com>
11565 * fileread.cc (File_read::open): Do not lock the file unless it
11566 was successfully opened.
11568 2008-08-14 Cary Coutant <ccoutant@google.com>
11570 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11571 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11572 * testsuite/tls_test.cc (struct int128): 128-bit struct
11573 for testing TLS relocs with non-zero addend.
11574 (v12): New TLS variable.
11576 (t_last): Add check for v12.
11577 * testsuite/tls_test.h (t12): New function.
11578 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11580 2008-08-13 Ian Lance Taylor <iant@google.com>
11582 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11583 set tls_segment_ or relro_segment_.
11584 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11586 * output.h (Output_section::clear_is_relro): New function.
11587 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11588 sections specially even when output_data_ is empty.
11589 (Output_segment::maximum_alignment): When first section is relro,
11590 only force alignment for PT_LOAD segments.
11591 * script.cc (script_data_segment_align): New function.
11592 (script_data_segment_relro_end): New function.
11593 * script-c.h (script_data_segment_align): Declare.
11594 (script_data_segment_relro_end): Declare.
11595 * script-sections.h (class Script_sections): Declare
11596 data_segment_align and data_segment_relro_end. Add fields
11597 segment_align_index_ and saw_relro_end_.
11598 * script-sections.cc (class Sections_element): Add set_is_relro
11599 virtual function. Add new bool* parameter to place_orphan_here.
11600 Add get_output_section virtual function.
11601 (class Output_section_definition): Add set_is_relro. Add new
11602 bool* parameter to place_orphan_here. Add get_output_section.
11603 Add is_relro_ field.
11604 (Output_section_definition::Output_section_definition): Initialize
11605 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11606 and is_relro_ fields.
11607 (Output_section_definition::place_orphan_here): Add is_relro
11609 (Output_section_definition::set_section_addresses): Set relro for
11611 (Output_section_definition::alternate_constraint): Likewise.
11612 (class Orphan_output_section): Add new bool* parameter to
11613 place_orphan_here. Add get_output_section.
11614 (Orphan_output_section::place_orphan_here): Add is_relro
11616 (Script_sections::Script_sections): Initialize
11617 data_segment_align_index_ and saw_relro_end_.
11618 (Script_sections::data_segment_align): New function.
11619 (Script_sections::data_segment_relro_end): New function.
11620 (Script_sections::place_orphan): Set or clear is_relro.
11621 (Script_sections::set_section_addresses): Force alignment of first
11623 * yyscript.y (exp): Call script_data_segment_align and
11624 script_data_segment_relro_end.
11625 * testsuite/relro_script_test.t: New file.
11626 * testsuite/relro_test.cc (using_script): Declare.
11627 (t1, t2): Test using_script.
11628 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11629 (relro_script_test_SOURCES): Define.
11630 (relro_script_test_DEPENDENCIES): Define.
11631 (relro_script_test_LDFLAGS): Define.
11632 (relro_script_test_LDADD): Define.
11633 (relro_script_test.so): New target.
11634 * testsuite/Makefile.in: Rebuild.
11636 2008-08-06 Cary Coutant <ccoutant@google.com>
11638 * archive.cc (Archive::total_archives, Archive::total_members)
11639 (Archive::total_members_loaded): New variables.
11640 (Archive::setup): Add parameter. Add option to preread
11642 (Archive::read_armap): Add counter.
11643 (Archive::get_file_and_offset): New function.
11644 (Archive::get_elf_object_for_member): New function.
11645 (Archive::read_all_symbols): New function.
11646 (Archive::read_symbols): New function.
11647 (Archive::add_symbols): Add counters.
11648 (Archive::include_all_members): Use armap to find members if it's
11650 (Archive::include_member): Skip reading symbols if already read.
11651 Factored code into Archive::get_file_and_offset and
11652 Archive::get_elf_object_for_member. Changed call to
11653 Mapfile::report_include_archive_member.
11654 (Archive::print_stats): New function.
11655 * archive.h: Declare Object and Read_symbols_data classes.
11656 (Archive::Archive): Add initializers for new members.
11657 (Archive::setup): Add parameter.
11658 (Archive::print_stats): New function.
11659 (Archive::total_archives, Archive::total_members)
11660 (Archive::total_members_loaded): New variables.
11661 (Archive::get_file_and_offset): New function.
11662 (Archive::get_elf_object_for_member): New function.
11663 (Archive::read_all_symbols): New function.
11664 (Archive::read_symbols): New function.
11665 (Archive::Archive_member): New class.
11666 (Archive::members_): New member.
11667 (Archive::num_members_): New member.
11668 * main.cc: Include archive.h.
11669 (main): Call Archive::print_stats.
11670 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11671 archive parameter; member_name is now the fully-decorated name.
11672 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11673 * options.h: (General_options): Add --preread-archive-symbols option.
11674 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11677 2008-08-04 Ian Lance Taylor <iant@google.com>
11679 * symtab.h (Symbol::use_plt_offset): New function.
11680 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11681 * powerpc.cc (Relocate::relocate): Likewise.
11682 * sparc.cc (Relocate::relocate): Likewise.
11683 * x86_64.cc (Relocate::relocate): Likewise.
11684 * testsuite/weak_plt.sh: New test.
11685 * testsuite/weak_plt_main.cc: New test.
11686 * testsuite/weak_plt_shared.cc: New test.
11687 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11688 (check_PROGRAMS): Add weak_plt.
11689 (check_DATA): Add weak_plt_shared.so.
11690 (weak_plt_main_pic.o, weak_plt): New targets.
11691 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11692 * testsuite/Makefile.in: Rebuild.
11694 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11696 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11697 * testsuite/Makefile.in: Rebuild.
11699 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11701 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11702 * Makefile.in: Regenerate.
11703 * po/POTFILES.in: Regenerate.
11705 2008-07-29 Ian Lance Taylor <iant@google.com>
11707 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11708 symbols before other symbols.
11709 * testsuite/script_test_2.cc (test_addr): Declare.
11710 (test_addr_alias): Declare.
11711 (main): Check that test_addr and test_addr_alias have the right
11713 * testsuite/script_test_2.t: Define test_addr_alias and
11716 2008-07-24 Ian Lance Taylor <iant@google.com>
11719 * descriptors.cc: New file.
11720 * descriptors.h: New file.
11721 * gold-threads.h (class Hold_optional_lock): New class.
11722 * fileread.cc: Include "descriptors.h".
11723 (File_read::~File_read): Release descriptor rather than closing
11725 (File_read::open) [file]: Call open_descriptor rather than open.
11726 Set is_descriptor_opened_.
11727 (File_read::open) [memory]: Assert that descriptor is not open.
11728 (File_read::reopen_descriptor): New function.
11729 (File_read::release): Release descriptor.
11730 (File_read::do_read): Make non-const. Reopen descriptor.
11731 (File_read::read): Make non-const.
11732 (File_read::make_view): Reopen descriptor.
11733 (File_read::do_readv): Likewise.
11734 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11735 Update declarations.
11736 * layout.cc: Include "descriptors.h".
11737 (Layout::create_build_id): Use open_descriptor rather than open.
11738 * output.cc: Include "descriptors.h".
11739 (Output_file::open): Use open_descriptor rather than open.
11740 * archive.cc (Archive::const_iterator): Change Archive to be
11742 (Archive::begin, Archive::end): Make non-const.
11743 (Archive::count_members): Likewise.
11744 * archive.h (class Archive): Update declarations.
11745 * object.h (Object::read): Make non-const.
11746 * Makefile.am (CCFILES): Add descriptors.cc.
11747 (HFILES): Add descriptors.h.
11748 * Makefile.in: Rebuild.
11751 * gold.h: Always include <clocale>. Add Solaris workarounds
11752 following code in binutils/sysdep.h.
11755 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11756 this->eh_frame_hdr_ is NULL before using it.
11758 * dynobj.cc (Versions::Versions): Update comment.
11760 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11761 the base version name.
11763 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11764 array size plus one.
11765 (Stringpool_template::set_string_offsets): Subtract one from key
11766 before using it as an array index.
11767 (Stringpool_template::get_offset_with_length): Likewise.
11768 (Stringpool_template::write_to_buffer): Likewise.
11769 * stringpool.h (Stringpool_template::get_offset_from_key):
11772 2008-07-23 Ian Lance Taylor <iant@google.com>
11775 * object.h (Merged_symbol_value::value): Do our best to handle a
11779 * script.cc (Version_script_info::get_versions): Don't add empty
11780 version tag to return value.
11781 (Version_script_info::get_symbol_version_helper): Change return
11782 type to bool. Add pversion parameter. Change all callers.
11783 (script_register_vers_node): Don't require a non-NULL tag.
11784 * script.h (class Version_script_info): Update declarations.
11785 (Version_script_info::get_symbol_version): Change return type to
11786 bool. Add version parameter. Change all callers.
11787 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11788 handling. Handle an empty version from a version script.
11789 (Symbol_table::define_special_symbol): Likewise.
11790 * testsuite/ver_test_10.script: New file.
11791 * testsuite/ver_test_10.sh: New file.
11792 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11793 (check_DATA): Add ver_test_10.syms.
11794 (ver_test_10.syms, ver_test_10.so): New target.
11795 * testsuite/Makefile.in: Rebuild.
11797 2008-07-23 Simon Baldwin <simonb@google.com>
11799 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11800 to zero for undefined symbols from dynamic libraries.
11802 2008-07-23 Ian Lance Taylor <iant@google.com>
11804 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11805 Change all callers.
11806 * symtab.h (class Symbol_table): Update declaration.
11807 * testsuite/ver_test_9.cc: New file.
11808 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11809 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11810 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11811 (ver_test_9.so, ver_test_9.o): New targets.
11812 * testsuite/Makefile.in: Rebuild.
11814 2008-07-22 Ian Lance Taylor <iant@google.com>
11816 * options.h (class General_options): Define --check-sections.
11817 * layout.cc (Layout::set_segment_offsets): Handle
11820 * options.h (class General_options): Define -n/--nmagic and
11822 * options.cc (General_options::finalize): For -n/--nmagic or
11823 -N/--omagic, set -static.
11824 * layout.cc (Layout::attach_allocated_section_to_segment): If
11825 -N/--omagic, don't put read-only and read-write sections in
11826 different segments.
11827 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11828 finding a read-only segment.
11829 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11830 don't set the minimum segment alignment to the common page size,
11831 and don't set the file offset to the address modulo the page size.
11832 * script-sections.cc (Script_sections::create_segments): If
11833 -n/--omagic, don't put read-only and read-write sections in
11834 different segments.
11836 * cref.cc: New file.
11837 * cref.h: New file.
11838 * options.h (class General_options): Add --print-symbol-counts.
11839 * main.cc (main): Issue defined symbol report if requested.
11840 * archive.cc (Archive::interpret_header): Make into a const member
11842 (Archive::add_symbols): Call Input_objects::archive_start and
11844 (Archive::const_iterator): Define new class.
11845 (Archive::begin, Archive::end): New functions.
11846 (Archive::include_all_members): Rewrite to use iterator.
11847 (Archive::count_members): New function.
11848 * archive.h (class Archive): Update declarations.
11849 (Archive::filename): New function.
11850 * object.cc: Include "cref.h".
11851 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11852 (Sized_relobj::do_get_global_symbol_counts): New function.
11853 (Input_objects::add_object): Add object to cross-referencer.
11854 (Input_objects::archive_start): New function.
11855 (Input_objects::archive_stop): New function.
11856 (Input_objects::print_symbol_counts): New function.
11857 * object.h: Declare Cref and Archive.
11858 (Object::get_global_symbol_counts): New function.
11859 (Object::do_get_global_symbol_counts): New pure virtual function.
11860 (class Sized_relobj): Add defined_count_ field. Update
11862 (class Input_objects): Add cref_ field. Update constructor.
11863 Update declarations.
11864 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11866 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11868 (Sized_dynobj::do_get_global_symbol_counts): New function.
11869 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11870 defined_count_. Update declarations. Define Symbols typedef.
11871 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11872 parameter. Change all callers.
11873 (Symbol_table::add_from_dynobj): Add sympointers and defined
11874 parameters. Change all callers.
11875 * symtab.h (class Symbol_table): Update declarations.
11876 * Makefile.am (CCFILES): Add cref.cc.
11877 (HFILES): Add cref.h.
11878 * Makefile.in: Rebuild.
11880 2008-07-22 Simon Baldwin <simonb@google.com>
11882 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11883 to zero when writing undefined symbols.
11885 2008-07-22 Ian Lance Taylor <iant@google.com>
11887 * output.cc (Output_section::add_input_section): Don't try to
11888 merge empty merge sections.
11890 2008-07-21 Craig Silverstein <csilvers@google.com>
11892 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11893 Include symbol version in error message.
11895 2008-07-20 Chris Demetriou <cgd@google.com>
11897 * configure.ac (gold_cv_c_random_seed): New configured variable.
11898 (RANDOM_SEED_CFLAGS): New substituted variable.
11899 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11900 * configure: Rebuild.
11901 * Makefile.in: Likewise.
11902 * testsuite/Makefile.in: Likewise.
11904 2008-07-18 Ian Lance Taylor <iant@google.com>
11906 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11907 where we see NAME/NULL and NAME/VERSION as separate symbols.
11908 * testsuite/ver_test_main.cc (main): Call t4.
11909 (t4, t4_2a): Define.
11910 * testsuite/ver_test_2.cc (t4_2): Define.
11911 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11912 * testsuite/ver_test_4.cc (t4_2a): Define.
11913 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11914 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11916 2008-07-17 Ian Lance Taylor <iant@google.com>
11918 * dynobj.cc (Versions::add_def): If we give an error about a
11919 missing version, go ahead and create the version anyhow.
11921 2008-07-10 Ian Lance Taylor <iant@google.com>
11923 Handle output sections with more than 0x7fffffff bytes.
11924 * object.h (class Relobj): Change map_to_output_ to
11925 output_sections_, and just keep a section pointer. Change all
11926 uses. Move comdat group support to Sized_relobj.
11927 (Relobj::is_section_specially_mapped): Remove.
11928 (Relobj::output_section): Remove poff parameter. Change all
11930 (Relobj::output_section_offset): New function.
11931 (Relobj::set_section_offset): Rewrite.
11932 (Relobj::map_to_output): Remove.
11933 (Relobj::output_sections): New function.
11934 (Relobj::do_output_section_offset): New pure virtual function.
11935 (Relobj::do_set_section_offset): Likewise.
11936 (class Sized_relobj): Add section_offsets_ field. Add comdat
11937 group support from Relobj. Update declarations.
11938 (Sized_relobj::get_output_section_offset): New function.
11939 (Sized_relobj::do_output_section_offset): New function.
11940 (Sized_relobj::do_set_section_offset): New function.
11941 * object.cc (Relobj::output_section_address): Remove.
11942 (Sized_relobj::Sized_relobj): Initialize new fields.
11943 (Sized_relobj::include_section_group): Cast find_kept_object to
11945 (Sized_relobj::include_linkonce_section): Likewise.
11946 (Sized_relobj::do_layout): Use separate arrays for output section
11948 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11950 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11951 output_sections and section_offsets.
11952 (Sized_relobj::write_local_symbols): Likewise.
11953 (map_to_kept_section): Compute output address directly.
11954 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11955 output_sections and section_offsets.
11956 (Sized_relobj::write_sections): Likewise.
11957 (Sized_relobj::relocate_sections): Likewise.
11958 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11959 * output.h (class Output_reloc): Update declarations. Change
11960 u2_.relobj to Sized_relobj*.
11961 (class Output_data_reloc): Change add functions to use
11963 * output.cc (Output_reloc::Output_reloc): Change relobj to
11965 (Output_reloc::local_section_offset): Change return type to
11966 Elf_Addr. Use get_output_section_offset.
11967 (Output_reloc::get_address): Likewise.
11968 (Output_section::is_input_address_mapped): Don't call
11969 is_section_specially_mapped.
11970 (Output_section::output_offset): Likewise.
11971 (Output_section::output_address): Likewise.
11972 (Output_section::starting_output_address): Likewise.
11973 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11974 parameter to Sized_relobj*.
11975 (Copy_relocs::need_copy_reloc): Likewise.
11976 (Copy_relocs::save): Likewise.
11977 * copy-relocs.h (class Copy_relocs): Update declarations.
11978 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11979 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11980 * target-reloc.h (relocate_for_relocatable): Change
11981 offset_in_output_section type to Elf_Addr. Change code that uses
11983 * layout.cc (Layout::layout): Always set *off.
11984 * mapfile.cc (Mapfile::print_input_section): Use
11985 output_section_offset.
11986 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11988 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11989 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11990 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11992 2008-07-03 Ian Lance Taylor <iant@google.com>
11994 * layout.cc (Layout::include_section): Do not discard unrecognized
11995 SHT_STRTAB sections.
11997 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11999 * script.cc (Lex::can_continue_name): Make '?' allowable in
12000 version-script names.
12001 * testsuite/version_script.map: Change glob pattern to use '?'
12003 2008-06-30 Manish Singh <yosh@gimp.org>
12006 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12009 2008-06-30 Ian Lance Taylor <iant@google.com>
12013 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12014 versions]: Don't try to read the value in the contents, since we
12015 don't use it. Use the template endianness when writing.
12017 2008-06-25 Cary Coutant <ccoutant@google.com>
12019 * fileread.cc (File_read::make_view): Assert on zero-length view.
12020 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12021 symbol table when there are no symbols to read.
12023 2008-06-23 Craig Silverstein <csilvers@google.com>
12025 * version.cc (version_string): Bump to 1.7
12027 2008-06-18 Craig Silverstein <csilvers@google.com>
12029 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12030 constant 0xFFFF to type Valtype.
12031 (Powerpc_relocate_functions::rel16_ha): Likewise.
12033 2008-06-17 Ian Lance Taylor <iant@google.com>
12035 * output.h (Output_section::Input_section): Initialize p2align_ to
12036 zero for Output_section_data constructors.
12037 (Output_section::Input_section::addralign): If not an input
12038 section, return the alignment of the Output_section_data.
12039 * testsuite/copy_test.cc: New file.
12040 * testsuite/copy_test_1.cc: New file.
12041 * testsuite/copy_test_2.cc: New file.
12042 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12043 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12044 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12045 (copy_test_1_pic.o, copy_test_1.so): New targets.
12046 (copy_test_2_pic.o, copy_test_2.so): New targets.
12047 * testsuite/Makefile.in: Rebuild.
12049 * script-sections.cc (Script_sections::place_orphan): Initialize
12050 local variable exact.
12052 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12054 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12056 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12057 David S. Miller <davem@davemloft.net>
12059 * powerpc.cc: New file.
12060 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12061 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12062 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12063 * Makefile.in: Rebuild.
12065 2008-06-09 Ian Lance Taylor <iant@google.com>
12067 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12069 (throwing, orig_terminate): New static variables.
12070 (terminate_handler): New static function.
12071 (t2): Set terminate handler.
12073 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12076 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12079 2008-05-30 Cary Coutant <ccoutant@google.com>
12081 * archive.cc (Archive::include_all_members) Correct to step
12082 over symbol table and extended name table in thin archives.
12084 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12087 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12090 2008-05-28 Caleb Howe <cshowe@google.com>
12092 * reduced_debug_output.cc: New file.
12093 * reduced_debug_output.h: New file.
12094 * options.h (class General_options): Add --strip-debug-non-line.
12095 * options.cc (General_options::finalize): Add strip_debug_non_line
12096 to the strip heirarchy.
12097 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12099 * layout.cc: Include "reduced_debug_output.h".
12100 (Layout::Layout): Initialize new fields.
12101 (line_only_debug_sections): New static array.
12102 (is_lines_only_debug_sections): New static inline function.
12103 (Layout::include_section): Handle --strip-debug-non-line.
12104 (Layout::make_output_section): If --strip-debug-non-line, build
12105 new output sections for .debug_abbrev and .debug_info.
12106 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12107 gold. Warn about possible overflow.
12108 (read_signed_LEB_128): Likewise.
12109 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12110 (read_signed_LEB_128): Declare.
12111 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12112 (HFILES): Add reduced_debug_output.h.
12113 * Makefile.in: Rebuild.
12115 2008-05-21 Ian Lance Taylor <iant@google.com>
12117 * mapfile.cc: New file.
12118 * mapfile.h: New file.
12119 * options.h (class General_options): Add -M/--print-map and -Map.
12120 * options.cc (General_options::finalize): Make -M equivalent to
12122 * main.cc: Include <cstdio> and "mapfile.h".
12123 (main): Open mapfile if requested.
12124 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12125 constructor. Change caller.
12126 (queue_initial_tasks): Add mapfile parameter. Change caller.
12127 (queue_middle_tasks): Likewise.
12128 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12130 * archive.cc: Include "mapfile.h".
12131 (Archive::add_symbols): Add mapfile parameter. Change all
12132 callers. Pass mapfile, symbol, and reason to include_member.
12133 (Archive::include_all_members): Add mapfile parameter. Change all
12135 (Archive::include_member): Add mapfile, sym, and why parameters.
12136 Change all callers. Report inclusion to map file.
12137 * archive.h: Include "fileread.h".
12138 (class Archive): Update declarations.
12139 (Archive::file): New const method.
12140 (class Add_archive_symbols): Add mapfile_ field. Update
12141 constructor. Change all callers.
12142 * readsyms.h (class Read_symbols): Likewise.
12143 (class Finish_group): Likewise.
12144 (class Read_script): Likewise.
12145 * common.cc: Include "mapfile.h".
12146 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12148 (Symbol_table::do_allocate_commons): Likewise.
12149 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12150 symbol allocation to mapfile.
12151 * common.h (class Allocate_commons_task): Add mapfile_ field.
12152 Update constructor. Change all callers.
12153 * symtab.h (class Symbol_table): Update declarations.
12154 * layout.cc: Include "mapfile.h".
12155 (Layout_task_runner::run): Print information to mapfile.
12156 (Layout::create_gold_note): Change Output_data_fixed_space to
12157 Output_data_zero_fill.
12158 (Layout::create_build_id): Likewise.
12159 (Layout::print_to_mapfile): New function.
12160 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12161 constructor. Change caller.
12162 (class Layout): Declare print_to_mapfile.
12163 * output.cc (Output_section::Input_section::print_to_mapfile): New
12165 (Output_section::add_input_section): If producing a map, always
12166 add to input_sections_ list.
12167 (Output_section::do_print_to_mapfile): New function.
12168 (Output_segment::print_sections_to_mapfile): New function.
12169 (Output_segment::print_section_list_to_mapfile): New function.
12170 * output.h: Include "mapfile.h".
12171 (Output_data::print_to_mapfile): New function.
12172 (Output_data::do_print_to_mapfile): New virtual function.
12173 (Output_segment_headers::do_print_to_mapfile): New function.
12174 (Output_file_header::do_print_to_mapfile): New function.
12175 (Output_data_const::do_print_to_mapfile): New function.
12176 (class Output_data_const_buffer): Add map_name_ field. Update
12177 constructor. Change all callers. Add do_print_to_mapfile
12179 (class Output_data_fixed_space): Likewise.
12180 (class Output_data_space): Likewise.
12181 (class Output_data_zero_fill): New class.
12182 (Output_data_strtab::do_print_to_mapfile): New function.
12183 (Output_data_reloc_base::do_print_to_mapfile): New function.
12184 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12185 (Output_data_group::do_print_to_mapfile): New function.
12186 (Output_data_got::do_print_to_mapfile): New function.
12187 (Output_data_dynamic::do_print_to_mapfile): New function.
12188 (Output_symtab_xindex::do_print_to_mapfile): New function.
12189 (class Output_section): Declare do_print_to_mapflie. Declare
12190 print_to_mapfile in Input_section.
12191 (class Output_segment): Declare new functions.
12192 * object.h (Sized_relobj::symbol_count): New function.
12193 * script-sections.cc
12194 (Output_section_element_dot_assignment::set_section_addresses):
12195 Change Output_data_fixed_space to Output_data_zero_fill.
12196 (Output_data_expression::do_print_to_mapfile): New function.
12197 * script.cc (read_input_script): Add mapfile parameter. Change
12199 * script.h (read_input_script): Update declaration.
12200 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12201 (Eh_frame::do_print_to_mapfile): New function.
12202 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12203 (Output_merge_string::do_print_to_mapfile): New function.
12204 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12206 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12208 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12210 * Makefile.am (CCFILES): Add mapfile.cc.
12211 (HFILES): Add mapfile.h.
12212 * Makefile.in: Rebuild.
12214 2008-05-19 Ian Lance Taylor <iant@google.com>
12216 * options.h (class General_options): Add -z relro.
12217 * layout.cc (Layout::Layout): Initialize relro_segment_.
12218 (Layout::add_output_section_data): Return the output section.
12219 (Layout::make_output_section): Rcognize relro sections and mark
12220 them appropriately.
12221 (Layout::attach_allocated_section_to_segment): Put relro sections
12222 in a PT_GNU_RELRO segment.
12223 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12225 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12227 (Layout::linkonce_mapping): Map d.rel.ro.local to
12228 .data.rel.ro.local.
12229 (Layout::output_section_name): Us .data.rel.ro.local for any
12230 section which begins with that.
12231 * layout.h (class Layout): Update add_output_section_data
12232 declaration. Add relro_segment_ field.
12233 * output.cc (Output_section::Output_section): Initialize is_relro_
12234 and is_relro_local_ fields.
12235 (Output_segment::add_output_section): Group relro sections.
12236 (Output_segment::is_first_section_relro): New function.
12237 (Output_segment::maximum_alignment): If there is a relro section,
12238 align the segment to the common page size.
12239 (Output_segment::set_section_addresses): Track whether we are
12240 looking at relro sections. If the last section is a relro
12241 section, align to the common page size.
12242 (Output_segment::set_section_list_addresses): Add in_relro
12243 parameter. Change all callers. Align to the page size when
12244 moving from relro to non-relro section.
12245 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12247 * output.h (class Output_section): Add is_relro_ and
12248 is_relro_local_ fields.
12249 (Output_section::is_relro): New function.
12250 (Output_section::set_is_relro): New function.
12251 (Output_section::is_relro_local): New function.
12252 (Output_section::set_is_relro_local): New function.
12253 (class Output_segment): Update declarations.
12254 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12255 * sparc.cc (Target_sparc::got_section): Likewise.
12256 * x86_64.cc (Target_x86_64::got_section): Likewise.
12257 * testsuite/relro_test_main.cc: New file.
12258 * testsuite/relro_test.cc: New file.
12259 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12260 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12261 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12262 (relro_test.so, relro_test_pic.o): New targets.
12263 * testsuite/Makefile.in: Rebuild.
12265 2008-05-16 Ian Lance Taylor <iant@google.com>
12267 * output.cc (Output_segment::add_output_section): Remove front
12269 * output.h (class Output_segment): Remove
12270 add_initial_output_section and overloaded add_output_section.
12271 Update declaration of remaining add_output_section.
12272 * layout.cc (Layout::create_interp): Call add_output_section
12273 rather than add_initial_output_section.
12274 (Layout::finish_dynamic_section): Likewise.
12276 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12277 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12278 know the dynamic type.
12279 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12280 field. Initialize it in constructor.
12281 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12282 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12283 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12286 * output.cc (Output_reloc::get_address): Change return type to
12288 * output.h (class Output_reloc): Update get_address declaration.
12289 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12290 for section addresses.
12292 2008-05-09 Ian Lance Taylor <iant@google.com>
12295 * gold.cc (gold_nomem): Use return value of write.
12297 2008-05-08 Ian Lance Taylor <iant@google.com>
12299 * symtab.c (Symbol::init_base_output_data): Add version
12300 parameter. Change all callers.
12301 (Symbol::init_base_output_segment): Likewise.
12302 (Symbol::init_base_constant): Likewise.
12303 (Symbol::init_base_undefined): Likewise.
12304 (Sized_symbol::init_output_data): Likewise.
12305 (Sized_symbol::init_output_segment): Likewise.
12306 (Sized_symbol::init_constant): Likewise.
12307 (Sized_symbol::init_undefined): Likewise.
12308 (Symbol_table::do_define_in_output_data): If the new symbol has a
12309 version, mark it as the default.
12310 (Symbol_table::do_define_in_output_segment): Likewise.
12311 (Symbol_table::do_define_as_constant): Likewise.
12312 * symtab.h (class Symbol): Update declarations.
12313 (class Sized_symbol): Likewise.
12314 * resolve.cc (Symbol::override_version): New function.
12315 (Symbol::override_base): Call override_version.
12316 (Symbol::override_base_with_special): Likewise.
12317 * testsuite/ver_script_8.script: New file.
12318 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12319 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12320 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12321 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12323 2008-05-06 Ian Lance Taylor <iant@google.com>
12326 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12328 (class General_options): Remove existing --undefined, and add
12329 --no-undefined instead. Add new --undefined as synonym for -u.
12330 * archive.cc (Archive::add_symbols): Check whether symbol was
12332 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12333 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12334 all uses. Add IS_UNDEFINED. Update declarations to split
12335 different versions of init_base. Declare init_base_undefined.
12336 (Symbol::is_defined): Handle IS_UNDEFINED.
12337 (Symbol::is_undefined): Likewise.
12338 (Symbol::is_weak_undefined): Call is_undefined.
12339 (Symbol::is_absolute): Handle IS_CONSTANT.
12340 (class Sized_symbol): Update declarations to split different
12341 versions of init. Declare init_undefined.
12342 (class Symbol_table): Declare new functions.
12343 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12344 Change all callers.
12345 (Symbol::init_base_output_data): Likewise.
12346 (Symbol::init_base_output_segment): Likewise.
12347 (Symbol::init_base_constant): Likewise.
12348 (Symbol::init_base_undefined): New function.
12349 (Sized_symbol::init_object): Rename from init. Change all
12351 (Sized_symbol::init_output_data): Likewise.
12352 (Sized_symbol::init_output_segment): Likewise.
12353 (Sized_symbol::init_constant): Likewise.
12354 (Sized_symbol::init_undefined): New function.
12355 (Symbol_table::add_undefined_symbols_from_command_line): New
12357 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12359 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12360 (Symbol::output_section): Likewise.
12361 (Symbol::set_output_section): Likewise.
12362 (Symbol_table::sized_finalize_symbol): Likewise.
12363 (Symbol_table::sized_write_globals): Likewise.
12364 * resolve.cc (Symbol_table::should_override): Likewise.
12365 (Symbol::override_base_with_special): Likewise.
12367 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12368 symbol, change it to have default visibility.
12369 * testsuite/protected_1.cc: New file.
12370 * testsuite/protected_2.cc: New file.
12371 * testsuite/protected_3.cc: New file.
12372 * testsuite/protected_main_1.cc: New file.
12373 * testsuite/protected_main_2.cc: New file.
12374 * testsuite/protected_main_3.cc: New file.
12375 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12376 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12377 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12378 (protected_1.so): New target.
12379 (protected_1_pic.o, protected_2_pic.o): New targets.
12380 (protected_3_pic.o): New target.
12381 (check_PROGRAMS): Add protected_2.
12382 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12383 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12384 * testsuite/Makefile.in: Rebuild.
12386 * options.h (DEFINE_var): Add set_user_set_##varname__.
12387 (DEFINE_bool_alias): New macro.
12388 (class General_options): Define -Bstatic using DEFINE_bool_alias
12389 rather than DEFINE_special. Add --undefined as an alias for -z
12391 * options.cc (General_options::parse_Bstatic): Remove.
12393 * options.h (class General_options): Add --fatal-warnings.
12394 * main.cc (main): Implement --fatal-warnings.
12395 * errors.h (Errors::warning_count): New function.
12397 * options.h (class General_options): Add -Bsymbolic-functions.
12398 * symtab.h (Symbol::is_preemptible): Check for
12399 -Bsymbolic-functions.
12401 2008-05-05 Ian Lance Taylor <iant@google.com>
12403 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12404 as noVARNAME rather than no-VARNAME.
12405 (class General_options): Add option -z combreloc.
12406 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12408 (Output_reloc::sort_before) [SHT_REL]: New function.
12409 (Output_reloc::sort_before) [SHT_RELA]: New function.
12410 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12411 Sort_relocs_comparison.
12412 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12413 parameter. Change all callers.
12414 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12415 sort_relocs parameter. Change all callers.
12416 * output.cc (Output_reloc::get_address): New function, broken out
12418 (Output_reloc::write_rel): Call it.
12419 (Output_reloc::compare): New function.
12420 (Output_data_reloc_base::do_write): Optionally sort relocs.
12422 * configure.ac: If targ_extra_obj is set, link it in.
12423 * configure.tgt: Initialize all variables.
12424 (x86_64*): Set targ_extra_obj and targ_extra_size.
12425 * configure: Rebuild.
12427 * object.cc (Sized_relobj::include_section_group): Adjust section
12428 indexes read from group data. Build vector to pass to
12430 * layout.cc (Layout::layout_group): Add flags and shndxes
12431 parameters. Remove contents parameter. Change caller. Update
12432 explicit instantiations.
12433 * layout.h (class Layout): Update layout_group declaration.
12434 * output.cc (Output_data_group::Output_data_group): Add flags and
12435 input_shndxes parameters. Remove contents parameter. Change
12437 (Output_data_group::do_write): Change input_sections_ to
12439 * output.h (class Output_data_group): Update constructor
12440 declaration. Rename input_sections_ to input_shndxes_.
12441 * testsuite/many_sections_test.cc: Add template.
12443 2008-04-30 Cary Coutant <ccoutant@google.com>
12445 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12447 * layout.cc (Layout::include_section): Refactored check for debug
12449 (Layout::add_comdat): Add new parameters. Change type
12450 of signature parameter. Add object and shndx to signatures table.
12451 (Layout::find_kept_object): New function.
12452 * layout.h: Include <cstring>.
12453 (Layout::is_debug_info_section): New function.
12454 (Layout::add_comdat): Add new parameters.
12455 (Layout::find_kept_object): New function.
12456 (Layout::Kept_section): New struct.
12457 (Layout::Signatures): Change type of map range.
12458 * object.cc (Relobj::output_section_address): New function.
12459 (Sized_relobj::include_section_group): Add new parameters. Change
12460 calls to Layout::add_comdat. Change to build table of kept comdat
12461 groups and table mapping discarded sections to kept sections.
12462 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12463 (Sized_relobj::do_layout): Change calls to include_section_group and
12464 include_linkonce_section.
12465 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12466 value to zero when section is discarded.
12467 (Sized_relobj::map_to_kept_section): New function.
12468 * object.h (Relobj::output_section_address): New function.
12469 (Relobj::Comdat_group): New type.
12470 (Relobj::find_comdat_group): New function.
12471 (Relobj::Comdat_group_table): New type.
12472 (Relobj::Kept_comdat_section): New type.
12473 (Relobj::Kept_comdat_section_table): New type.
12474 (Relobj::add_comdat_group): New function.
12475 (Relobj::set_kept_comdat_section): New function.
12476 (Relobj::get_kept_comdat_section): New function.
12477 (Relobj::comdat_groups_): New field.
12478 (Relobj::kept_comdat_sections_): New field.
12479 (Symbol_value::input_value): Update comment.
12480 (Sized_relobj::map_to_kept_section) New function.
12481 (Sized_relobj::include_linkonce_section): Add new parameter.
12482 * target-reloc.h (Comdat_behavior): New type.
12483 (get_comdat_behavior): New function.
12484 (relocate_section): Add code to map a discarded section to the
12485 corresponding kept section when applying a relocation.
12487 2008-04-30 Craig Silverstein <csilvers@google.com>
12489 * dwarf_reader.cc (next_generation_count): New static var.
12490 (Addr2line_cache_entry): New struct.
12491 (addr2line_cache): New static var.
12492 (Dwarf_line_info::one_addr2line): Added caching.
12493 (Dwarf_line_info::clear_addr2line_cache): New function.
12494 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12495 cache-size parameter.
12496 (Dwarf_line_info::one_addr2line_cache): New function.
12497 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12498 new cache-size argument to one_addr2line(), and clear cache.
12500 2008-04-28 Cary Coutant <ccoutant@google.com>
12502 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12503 R_386_PC8 relocations.
12505 2008-04-23 Ian Lance Taylor <iant@google.com>
12507 * object.cc (Sized_relobj::include_section_group): Check for
12508 invalid section group.
12510 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12513 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12514 than read for file header.
12515 * archive.cc (Archive::include_member): Likewise.
12517 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12519 * aclocal.m4: Regenerate.
12520 * configure: Regenerate.
12522 2008-04-19 Ian Lance Taylor <iant@google.com>
12524 * version.cc (version_string): Bump to 1.6.
12526 * testsuite/Makefile.am (many_sections_r_test): New target.
12527 (many_sections_r_test_SOURCES): Remove.
12528 (many_sections_r_test_DEPENDENCIES): Remove.
12529 (many_sections_r_test_LDFLAGS): Remove.
12530 (many_sections_r_test_LDADD): Remove.
12532 * object.cc (Sized_relobj::do_add_symbols): Always pass
12533 local_symbol_count_ to add_from_relobj.
12535 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12536 every thousand variables.
12537 * testsuite/Makefile.in: Rebuild.
12539 * object.cc (Xindex::initialize_symtab_xindex): New function.
12540 (Xindex::read_symtab_xindex): New function.
12541 (Xindex::sym_xindex_to_shndx): New function.
12542 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12544 (Sized_relobj::do_initialize_xindex): New function.
12545 (Sized_relobj::do_read_symbols): Adjust section links.
12546 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12547 parameter. Change all callers.
12548 (Sized_relobj::include_section_group): Adjust section links and
12549 symbol section indexes.
12550 (Sized_relobj::do_layout): Adjust section links.
12551 (Sized_relobj::do_count_local_symbols): Adjust section links and
12552 symbol section indexes.
12553 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12554 ordinary and special symbols.
12555 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12556 dynsym_xindex parameters. Change all callers. Adjust section
12557 links. Use SHN_XINDEX when needed.
12558 (Sized_relobj::get_symbol_location_info): Adjust section links.
12559 Don't get fooled by special symbols.
12560 * object.h (class Xindex): Define.
12561 (class Object): Add xindex_ parameter. Declare virtual functoin
12562 do_initialize_xindex.
12563 (Object::adjust_sym_shndx): New function.
12564 (Object::set_xindex): New protected function.
12565 (class Symbol_value): Add is_ordinary_shndx_ field.
12566 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12567 (Symbol_value::value): Assert ordinary section.
12568 (Symbol_value::initialize_input_to_output_map): Likewise.
12569 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12570 Change all callers.
12571 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12573 (class Sized_relobj): Update declarations.
12574 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12575 parameter. Change all callers.
12576 (Sized_relobj::adjust_shndx): New function.
12577 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12579 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12580 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12581 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12582 (Sized_dynobj::read_dynsym_section): Adjust section links.
12583 (Sized_dynobj::read_dynamic): Likewise.
12584 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12586 (Sized_dynobj::do_initialize_xindex): New function.
12587 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12588 do_initialize_xindex.
12589 (Sized_dynobj::adjust_shndx): New function.
12590 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12591 dynsym_xindex_ fields.
12592 (Layout::finalize): Add a call to set_section_indexes before
12593 creating the symtab sections.
12594 (Layout::set_section_indexes): Don't do anything if the section
12595 already has a section index.
12596 (Layout::create_symtab_sections): Add shnum parameter. Change
12597 caller. Create .symtab_shndx section if needed.
12598 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12600 (Layout::allocated_output_section_count): New function.
12601 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12603 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12604 fields. Update declarations.
12605 (Layout::symtab_xindex): New function.
12606 (Layout::dynsym_xindex): New function.
12607 (class Write_symbols_task): Add layout_ field.
12608 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12610 * output.cc (Output_section_headers::Output_section_headers): Add
12611 shstrtab_section parameter. Change all callers.
12612 (Output_section_headers::do_sized_write): Store overflow values
12613 for section count and section string table section index in
12614 section header zero.
12615 (Output_file_header::do_sized_write): Check for overflow of
12616 section count and section string table section index.
12617 (Output_symtab_xindex::do_write): New function.
12618 (Output_symtab_xindex::endian_do_write): New function.
12619 * output.h (class Output_section_headers): Add shstrtab_section_.
12620 Update declarations.
12621 (class Output_symtab_xindex): Define.
12622 (Output_section::has_out_shndx): New function.
12623 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12625 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12626 Change all callers.
12627 (Sized_symbol::init): Likewise.
12628 (Symbol::output_section): Check for ordinary symbol.
12629 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12630 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12632 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12633 Change all callers. Simplify handling of symbols from sections
12634 not included in the link.
12635 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12637 (Weak_alias_sorter::operator()): Assert that symbols are
12639 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12641 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12642 parameters. Change all callers.
12643 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12644 symbol distinction. Use SHN_XINDEX when needed.
12645 (Symbol_table::write_section_symbol): Add symtab_xindex
12646 parameter. Change all callers.
12647 (Symbol_table::sized_write_section_symbol): Likewise. Use
12648 SHN_XINDEX when needed.
12649 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12651 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12652 (Symbol::is_defined): Check is_ordinary.
12653 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12654 (Symbol::is_absolute, Symbol::is_common): Likewise.
12655 (class Sized_symbol): Update declarations.
12656 (class Symbol_table): Update declarations.
12657 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12658 parameters. Change all callers.
12659 (Sized_symbol::override): Likewise.
12660 (Symbol_table::override): Likewise.
12661 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12662 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12663 is_ordinary, and orig_st_shndx parameters. Change all callers.
12664 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12665 to be in an ordinary section.
12666 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12667 object and is_ordinary parameters. Change all callers.
12668 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12669 Change all callers. Don't add undefined or non-ordinary symbols
12671 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12672 Change all callers.
12673 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12675 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12676 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12677 (Sized_relobj::relocate_sections): Likewise.
12678 * target-reloc.h (scan_relocs): Adjust section symbol index.
12679 (scan_relocatable_relocs): Likewise.
12680 * i386.cc (Scan::local): Check for ordinary symbols.
12681 * sparc.cc (Scan::local): Likewise.
12682 * x86_64.cc (Scan::local): Likewise.
12683 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12684 to symbol_section_and_value.
12685 * testsuite/many_sections_test.cc: New file.
12686 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12687 (check_PROGRAMS): Add many_sections_test.
12688 (many_sections_test_SOURCES): Define.
12689 (many_sections_test_DEPENDENCIES): Define.
12690 (many_sections_test_LDFLAGS): Define.
12691 (BUILT_SOURCES): Add many_sections_define.h.
12692 (many_sections_define.h): New target.
12693 (BUILT_SOURCES): Add many_sections_check.h.
12694 (many_sections_check.h): New target.
12695 (check_PROGRAMS): Add many_sections_r_test.
12696 (many_sections_r_test_SOURCES): Define.
12697 (many_sections_r_test_DEPENDENCIES): Define.
12698 (many_sections_r_test_LDFLAGS): Define.
12699 (many_sections_r_test_LDADD): Define.
12700 (many_sections_r_test.o): New target.
12701 * testsuite/Makefile.in: Rebuild.
12703 2008-04-17 Cary Coutant <ccoutant@google.com>
12705 * errors.cc (Errors::info): New function.
12706 (gold_info): New function.
12707 * errors.h (Errors::info): New function.
12708 * gold.h (gold_info): New function.
12709 * object.cc (Input_objects::add_object): Print trace output.
12710 * options.cc (options::parse_set): New function.
12711 (General_options::parse_wrap): Deleted.
12712 (General_options::General_options): Deleted initializer.
12713 * options.h (options::String_set): New typedef.
12714 (options::parse_set): New function.
12715 (DEFINE_set): New macro.
12716 (General_options::wrap): Changed to use DEFINE_set. Changed
12717 callers of any_wrap_symbols and is_wrap_symbol.
12718 (General_options::trace, General_options::trace_symbol):
12720 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12721 (General_options::wrap_symbols_): Deleted.
12722 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12724 2008-04-17 David S. Miller <davem@davemloft.net>
12726 * options.cc (General_options::parse_V): New function.
12727 * options.h: Add entries for -V and -Qy.
12729 2008-04-17 Ian Lance Taylor <iant@google.com>
12731 * common.cc (Symbol_table::allocate_commons): Remove options
12732 parameter. Change caller.
12733 (Symbol_table::do_allocate_commons): Remove options parameter.
12734 Change caller. Just call do_allocate_commons_list twice.
12735 (Symbol_table::do_allocate_commons_list): New function, broken out
12736 of do_allocate_commons.
12737 * common.h (class Allocate_commons_task): Remove options_ field.
12738 Update constructor.
12739 * symtab.cc (Symbol_table::Symbol_table): Initialize
12741 (Symbol_table::add_from_object): Put TLS common symbols on
12743 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12744 which are IN_OUTPUT_DATA.
12745 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12746 allocate_commons and do_allocate_commons declarations. Declare
12747 do_allocate_commons_list.
12748 * gold.cc (queue_middle_tasks): Update creation of
12749 Allocate_commons_task to not pass options.
12750 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12751 (TLS_TEST_C_FLAGS): New variable.
12752 (tls_test_c_pic.o): New target.
12753 (tls_test_shared.so): Link in tls_test_c_pic.o.
12754 (tls_test_c_pic_ie.o): New target.
12755 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12756 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12757 (tls_test_c.o): New target.
12758 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12759 (tls_pic_test_LDADD): Likewise.
12760 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12761 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12762 (tls_test_c_gnu2.o): New target.
12763 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12765 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12766 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12767 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12768 * testsuite/tls_test.cc: Include "config.h".
12769 (t_last): Call t11_last.
12770 * testsuite/tls_test.h (t11, t11_last): Declare.
12771 * testsuite/tls_test_c.c: New file.
12772 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12773 * configure.ac: Check for OpenMP support.
12774 * configure, config.in, Makefile.in: Rebuild.
12775 * testsuite/Makefile.in: Rebuild.
12777 2008-04-16 Cary Coutant <ccoutant@google.com>
12779 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12780 (Target_i386::tls_base_symbol_defined_): New field.
12781 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12782 (Target_i386::Scan::global): Likewise.
12783 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12784 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12785 (Target_x86_64::tls_base_symbol_defined_): New field.
12786 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12787 (Target_x86_64::Scan::global): Likewise.
12789 2008-04-16 Cary Coutant <ccoutant@google.com>
12791 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12792 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12793 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12794 building shared libraries.
12795 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12796 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12797 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12798 * testsuite/Makefile.in: Rebuild.
12799 * testsuite/weak_undef.h: New file.
12800 * testsuite/weak_undef_file1.cc: Add extra test cases.
12801 * testsuite/weak_undef_file2.cc: Likewise.
12802 * testsuite/weak_undef_test.cc: Likewise.
12804 2008-04-16 David S. Miller <davem@davemloft.net>
12806 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12807 Add issued_non_pic_error_ field. Declare check_non_pic.
12808 (Target_sparc::Scan::check_non_pic): New function.
12809 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12810 (Target_sparc::Scan::global): Likewise.
12812 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12813 * configure: Rebuild.
12815 * options.h (DEFINE_enable): New macro.
12816 (new_dtags): New enable option.
12817 (initfirst, interpose, loadfltr, nodefaultlib,
12818 nodelete, nodlopen, nodump): New -z options.
12819 * layout.cc (Layout:finish_dynamic_section): If new
12820 dtags enabled, emit DT_RUNPATH. Also, emit a
12821 DT_FLAGS_1 containing any specified -z flags.
12823 2008-04-16 Ian Lance Taylor <iant@google.com>
12825 * copy-relocs.cc: New file.
12826 * copy-relocs.h: New file.
12827 * reloc.cc: Remove Copy_relocs code.
12828 * reloc.h: Likewise.
12829 * reloc-types.h (struct Reloc_types) [both versions]: Add
12830 get_reloc_addend_noerror.
12831 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12832 variants of add_global which take an addend which must be zero.
12833 * i386.cc: Include "copy-relocs.h".
12834 (class Target_i386): Change type of copy_relocs_ to variable,
12835 update initializer.
12836 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12837 Change all callers.
12838 (Target_i386::do_finalize_sections): Change handling of
12840 * sparc.cc: Include "copy-relocs.h".
12841 (class Target_sparc): Change type of copy_relocs_ to variable,
12842 update initializer.
12843 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12844 Change all callers.
12845 (Target_sparc::do_finalize_sections): Change handling of
12847 * x86_64.cc: Include "copy-relocs.h".
12848 (class Target_x86_64): Change type of copy_relocs_ to variable,
12849 update initializer.
12850 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12851 class. Change all callers.
12852 (Target_x86_64::do_finalize_sections): Change handling of
12854 * Makefile.am (CCFILES): Add copy-relocs.cc.
12855 (HFILES): Add copy-relocs.h.
12857 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12859 * testsuite/script_test_4.sh: Permit leading zeroes.
12861 2008-04-15 Ian Lance Taylor <iant@google.com>
12863 * script-sections.cc (Script_sections::create_segments): Use
12864 header_size_adjustment even when there is enough room for the
12866 * testsuite/script_test_4.sh: New file.
12867 * testsuite/script_test_4.t: New file.
12868 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12869 (check_DATA): Add script_test_4.stdout.
12870 (MOSTLYCLEANFILES): Likewise.
12871 (script_test_4): New target.
12872 (script_test_4.stdout): New target.
12873 * testsuite/Makefile.in: Rebuild.
12875 * sparc.cc: Add definitions for Output_data_plt_sparc class
12878 2008-04-14 David S. Miller <davem@davemloft.net>
12880 * sparc.cc: New file.
12881 * Makefile.am (TARGETSOURCES): Add sparc.cc
12882 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12883 * configure.tgt: Document targ_extra_size and
12884 targ_extra_big_endian. Add entries for sparc-* and
12886 * configure.ac: Handle targ_extra_size and
12887 targ_extra_big_endian.
12888 * Makefile.in: Rebuild.
12889 * configure: Likewise.
12890 * po/POTFILES.in: Likewise.
12891 * po/gold.pot: Likewise.
12893 2008-04-14 Ian Lance Taylor <iant@google.com>
12895 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12896 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12897 in the name/type/flags to section mapping. Don't call
12898 allocate_output_section.
12899 (Layout::choose_output_section): Change parameter from adjust_name
12900 to is_input_section. Don't permit input sections after sections
12901 are attached to segments. Don't call allocate_output_section.
12902 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12903 not write_enable_output_section.
12904 (Layout::make_output_section): Don't push to
12905 unattached_section_list_ nor call attach_to_segment. Call
12906 attach_section_to_segment if sections are attached.
12907 (Layout::attach_sections_to_segments): New function.
12908 (Layout::attach_section_to_segment): New function.
12909 (Layout::attach_allocated_section_to_segment): Rename from
12910 attach_to_segment. Remove flags parameter.
12911 (Layout::allocate_output_section): Remove function.
12912 (Layout::write_enable_output_section): Remove function.
12913 * layout.h (class Layout): Update for above changes. Add new
12914 field sections_are_attached_.
12915 * output.h (Output_section::update_flags_for_input_section): New
12917 * output.cc (Output_section::add_input_section): Call
12918 update_flags_for_input_section.
12919 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12921 2008-04-11 Cary Coutant <ccoutant@google.com>
12923 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12924 thought unnecessary.
12925 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12927 2008-04-11 Ian Lance Taylor <iant@google.com>
12929 * output.h (class Output_section_data): Remove inline definition
12931 * output.cc (Output_section_data::set_addralign): New function.
12933 2008-04-11 Cary Coutant <ccoutant@google.com>
12935 Add support for TLS descriptors for i386 and x86_64.
12936 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12937 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12938 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12940 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12941 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12942 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12944 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12945 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12946 Fix problem with initial-exec relocations.
12947 (Target_i386::Relocate::relocate_tls): Likewise.
12948 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12950 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12951 support for section-plus-offset dynamic table entries.
12952 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12953 (Output_data_dynamic::Dynamic_entry): Add support for
12954 section-plus-offset dynamic table entries.
12955 (Output_data_dynamic::Classification): Likewise.
12956 (Output_data_dynamic::classification_): Renamed offset_.
12957 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12958 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12959 (Target_x86_64::make_plt_section): New function.
12960 (Target_x86_64::reserve_tlsdesc_entries): New function.
12961 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12962 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12963 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12964 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12965 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12966 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12967 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12968 add extra PLT entry for TLS descriptors.
12969 (Output_data_plt_x86_64::got_): New field.
12970 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12971 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12973 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12975 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12976 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12977 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12978 R_386_TLS_DESC_CALL relocations.
12979 (Target_x86_64::Scan::global): Likewise.
12980 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12981 for TLS descriptors.
12982 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12983 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12984 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12985 GD-to-IE relaxation.
12986 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12987 and TLS_DESCRIPTORS.
12988 * Makefile.in: Rebuild.
12989 * configure: Rebuild.
12990 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12991 (tls_test_shared2.so): New target.
12992 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12993 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12994 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12995 (tls_shared_gd_to_ie_test_LDADD): New variable.
12996 (tls_shared_gnu2_gd_to_ie_test): New target.
12997 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12999 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13000 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13001 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13002 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13003 (tls_shared_gnu2_test): New target.
13004 (tls_test_gnu2_shared.so): New target.
13005 (tls_shared_gnu2_test_SOURCES): New variable.
13006 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13007 (tls_shared_gnu2_test_LDFLAGS): New variable.
13008 (tls_shared_gnu2_test_LDADD): New variable.
13009 * testsuite/Makefile.in: Rebuild.
13010 * testsuite/Makefile.
13012 2008-04-11 Ian Lance Taylor <iant@google.com>
13014 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13016 * testsuite/Makefile.in: Rebuild.
13018 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13020 * testsuite/script_test_2.cc (main): Adjust test.
13022 2008-04-11 David S. Miller <davem@davemloft.net>
13023 Ian Lance Taylor <iant@google.com>
13025 * options.h (General_options): Add entries for '-Y' and
13027 * options.cc (General_options:finalize): If -Y was used, add those
13028 entries to the library path instead of the default "/lib" and
13031 2008-04-11 David S. Miller <davem@davemloft.net>
13033 * testsuite/justsyms.t: Start at 0x100.
13034 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13035 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13037 * testsuite/script_test_2.cc: Adjust string and section length
13040 2008-04-09 Ian Lance Taylor <iant@google.com>
13043 * script-sections.cc (Sections_element::allocate_to_segment): Add
13045 (Output_section_definition::allocate_to_segment): Likewise.
13046 (Orphan_output_section::allocate_to_segment): Likewise.
13047 (Script_sections::attach_sections_using_phdrs_clause): Don't
13048 propagate non-PT_LOAD segments to orphan sections.
13049 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13050 readelf rather than objdump.
13051 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13052 .interp section and PT_INTERP segment are the same size.
13053 * testsuite/Makefile.in: Rebuild.
13055 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13056 aliases for symbols defined in the same object.
13057 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13058 (weak_alias_test_SOURCES): New variable.
13059 (weak_alias_test_DEPENDENCIES): New variable.
13060 (weak_alias_test_LDFLAGS): New variable.
13061 (weak_alias_test_LDADD): New variable.
13062 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13063 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13064 (weak_alias_test_3.o): New target.
13065 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13066 * testsuite/weak_alias_test_main.cc: New file.
13067 * testsuite/weak_alias_test_1.cc: New file.
13068 * testsuite/weak_alias_test_2.cc: New file.
13069 * testsuite/weak_alias_test_3.cc: New file.
13071 2008-04-08 Ian Lance Taylor <iant@google.com>
13073 * options.h (class General_options): Add --noinhibit-exec option.
13074 * main.cc (main): Check --noinhibit-exec.
13076 * options.h (class General_options): Define --wrap as a special
13077 option. Add wrap_symbols_ field.
13078 (General_options::any_wrap_symbols): New function.
13079 (General_options::is_wrap_symbol): New function.
13080 * options.cc (General_options::parse_wrap): New function.
13081 (General_options::General_options): Initialize wrap_symbols_.
13082 * symtab.cc (Symbol_table::wrap_symbol): New function.
13083 (Symbol_table::add_from_object): Handle --wrap.
13084 * symtab.h (class Symbol_table): Declare wrap_symbol.
13085 * target.h (Target::wrap_char): New function.
13086 (Target::Target_info): Add wrap_char field.
13087 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13088 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13089 * testsuite/testfile.cc (Target_test::test_target_info):
13092 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13095 * layout.h (class Layout): Add added_eh_frame_data_ field.
13096 * layout.cc (Layout::Layout): Initialize new field.
13097 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13098 output section until we find a section we merged successfully.
13099 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13100 that the size be non-zero.
13102 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13105 2008-04-08 Craig Silverstein <csilvers@google.com>
13107 * configure.ac: Export new conditional variable HAVE_ZLIB.
13108 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13110 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13111 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13113 2008-04-07 Ian Lance Taylor <iant@google.com>
13115 * version.cc (version_string): Set to "1.5".
13117 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13118 Add issued_non_pic_error_ field. Declare check_non_pic.
13119 (Target_x86_64::Scan::check_non_pic): New function.
13120 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13121 (Target_x86_64::Scan::global): Likewise.
13123 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13124 addend parameter. Change caller. Handle merge sections.
13125 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13126 Address to Addend. Don't add in the result of
13127 local_section_offset, pass down the addend and use the returned
13129 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13130 Update declarations of local_section_offset and symbol_value.
13131 * testsuite/two_file_test_1.cc (t18): New function.
13132 * testsuite/two_file_test_2.cc (f18): New function.
13133 * testsuite/two_file_test_main.cc (main): Call t18.
13134 * testsuite/two_file_test.h (t18, f18): Declare.
13136 * configure.ac: Don't test for objdump, c++filt, or readelf.
13137 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13139 (TEST_READELF): New variable.
13140 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13141 (check_PROGRAMS): Add two_file_strip_test.
13142 (two_file_strip_test): New target.
13143 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13144 (two_file_same_shared_strip_test_SOURCES): New variable.
13145 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13146 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13147 (two_file_same_shared_strip_test_LDADD): New variable.
13148 (two_file_shared_strip.so): New target.
13149 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13150 (ver_test_5.syms, ver_test_7.syms): Likewise.
13151 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13152 (strip_test_3.stdout): Use TEST_OBJDUMP.
13153 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13155 2008-04-04 Cary Coutant <ccoutant@google.com>
13157 * symtab.h (Symbol::is_weak_undefined): New function.
13158 (Symbol::is_strong_undefined): New function.
13159 (Symbol::is_absolute): New function.
13160 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13161 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13163 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13164 (weak_undef_test): New target.
13165 * testsuite/Makefile.in: Rebuild.
13166 * testsuite/weak_undef_file1.cc: New file.
13167 * testsuite/weak_undef_file2.cc: New file.
13168 * testsuite/weak_undef_test.cc: New file.
13170 2008-04-03 Craig Silverstein <csilvers@google.com>
13172 * compressed_output.h (class Output_compressed_section): Use
13174 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13176 (zlib_compressed_suffix): Removed.
13177 (Output_compressed_section::set_final_data_size): Use unsigned
13179 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13180 Fix linker invocation.
13181 (flagstest_o_specialfile_and_compress_debug_sections):
13183 * testsuite/Makefile.in: Regenerated.
13185 2008-04-02 David S. Miller <davem@davemloft.net>
13187 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13188 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13190 2008-04-02 Craig Silverstein <csilvers@google.com>
13194 2008-04-02 Ian Lance Taylor <iant@google.com>
13196 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13197 parameters. Update for new key type to views_. Change all
13199 (File_read::read): Adjust for byteshift in returned view.
13200 (File_read::add_view): New function, broken out of
13201 find_and_make_view.
13202 (File_read::make_view): New function, broken out of
13203 find_and_make_view.
13204 (File_read::find_or_make_view): Add offset and aligned
13205 parameters. Rewrite accordingly. Change all callers.
13206 (File_read::get_view): Add offset and aligned parameters. Adjust
13207 for byteshift in return value.
13208 (File_read::get_lasting_view): Likewise.
13209 * fileread.h (class File_read): Update declarations.
13210 (class File_read::View): Add byteshift_ field. Add byteshift to
13211 constructor. Add byteshift method.
13212 * archive.h (Archive::clear_uncached_views): New function.
13213 (Archive::get_view): Add aligned parameter. Change all callers.
13214 * object.h (Object::get_view): Add aligned parameter. Change all
13216 (Object::get_lasting_view): Likewise.
13218 * fileread.cc (File_read::release): Don't call clear_views if
13219 there are multiple objects.
13220 * fileread.h (File_read::clear_uncached_views): New function.
13221 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13224 2008-03-31 Cary Coutant <ccoutant@google.com>
13226 Add thin archive support.
13227 * archive.cc (Archive::armagt): New const.
13228 (Archive::setup): Remove task parameter and calls to unlock.
13229 (Archive::unlock_nested_archives): New function.
13230 (Archive::read_header): Add nested_off parameter. Change
13232 (Archive::interpret_header): Likewise.
13233 (Archive::include_all_members): Change to handle thin
13235 (Archive::include_member): Likewise.
13236 * archive.h (Archive::Archive): Add new parameters and
13238 (Archive::armagt): New const.
13239 (Archive::setup): Remove task parameter.
13240 (Archive::unlock_nested_archives): New function.
13241 (Archive::read_header): Add nested_off parameter.
13242 (Archive::interpret_header): Likewise.
13243 (Archive::Nested_archive_table): New typedef.
13244 (Archive::is_thin_archive_): New field.
13245 (Archive::nested_archives_): New field.
13246 (Archive::options_): New field.
13247 (Archive::dirpath_): New field.
13248 (Archive::task_): New field.
13249 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13250 for thin archives. Pass additional parameters to
13251 Archive::Archive. Unlock the archive file after calling
13254 2008-03-29 Ian Lance Taylor <iant@google.com>
13256 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13257 version symbol to be local.
13258 * testsuite/ver_test_4.sh: New file.
13259 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13260 (check_DATA): Add ver_test_4.syms.
13261 (ver_test_4.syms): New target.
13262 * testsuite/Makefile.in: Rebuild.
13265 (Output_section::Input_section_sort_entry::has_priority): New
13267 (Output_section::Input_section_sort_entry::match_file_name): New
13269 (Output_section::Input_section_sort_entry::match_section_name):
13271 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13273 (Output_section::Input_section_sort_entry::match_section_file):
13275 (Output_section::Input_section_sort_compare::operator()): Rewrite
13276 using new Input_section_sort_entry functions. Sort crtbegin and
13277 crtend first. Sort sections with no priority before sections with
13279 * testsuite/initpri1.c (d3): Check j != 4.
13280 (cd5): New constructor/destructor function.
13281 (main): Check j != 2.
13283 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13284 new symbol when resolving, don't call set_is_default.
13285 * testsuite/ver_test_7.cc: New file.
13286 * testsuite/ver_test_7.sh: New file.
13287 * testsuite/Makefile.am (ver_test_7.so): New target.
13288 (ver_test_7.o): New target.
13289 (check_SCRIPTS): Add ver_test_7.sh.
13290 (check_DATA): Add ver_test_7.syms.
13291 (ver_test_7.syms): New target.
13293 2008-03-28 Ian Lance Taylor <iant@google.com>
13295 * layout.cc (Layout::layout): If we see an input section with a
13296 name that needs sorting, set the must_sort flag for the output
13298 (Layout::make_output_section): If the name of the output section
13299 indicates that it might require sorting, set the may_sort flag.
13300 * output.h (Output_section::may_sort_attached_input_sections): New
13302 (Output_section::set_may_sort_attached_input_sections): New
13304 (Output_section::must_sort_attached_input_sections): New
13306 (Output_section::set_must_sort_attached_input_sections): New
13308 (class Output_section): Declare Input_section_sort_entry. Define
13309 Input_section_sort_compare. Declare
13310 sort_attached_input_sections. Add new fields:
13311 may_sort_attached_input_sections_,
13312 must_sort_attached_input_sections_,
13313 attached_input_sections_are_sorted_.
13314 * output.cc (Output_section::Output_section): Initialize new
13316 (Output_section::add_input_section): Add an entry to
13317 input_sections_ if may_sort or must_sort are true.
13318 (Output_section::set_final_data_size): Call
13319 sort_attached_input_sections if necessary.
13320 (Output_section::Input_section_sort_entry): Define new class.
13321 (Output_section::Input_section_sort_compare::operator()): New
13323 (Output_section::sort_attached_input_sections): New function.
13324 * configure.ac: Check whether the compiler supports constructor
13325 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13326 * testsuite/initpri1.c: New file.
13327 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13328 CONSTRUCTOR_PRIORITY.
13329 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13330 (initpri1_LDFLAGS): New variable.
13331 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13333 2008-03-27 Ian Lance Taylor <iant@google.com>
13335 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13336 * testsuite/common_test_1.c: New file.
13337 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13338 (common_test_1_SOURCES): New variable.
13339 (common_test_1_DEPENDENCIES): New variable.
13340 (common_test_1_LDFLAGS): New variable.
13342 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13343 and commons_ correctly when NAME/VERSION does not override
13345 * testsuite/ver_test_6.c: New file.
13346 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13347 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13348 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13350 2008-03-26 Ian Lance Taylor <iant@google.com>
13352 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13353 of an undefined symbol from a version script.
13354 * testsuite/Makefile.am (ver_test_5.so): New target.
13355 (ver_test_5.o): New target.
13356 (check_SCRIPTS): Add ver_test_5.sh.
13357 (check_DATA): Add ver_test_5.syms.
13358 (ver_test_5.syms): New target.
13359 * testsuite/ver_test_5.cc: New file.
13360 * testsuite/ver_test_5.script: New file.
13361 * testsuite/ver_test_5.sh: New file.
13362 * Makefile.in, testsuite/Makefile.in: Rebuild.
13365 Fix problems building gold with gcc 4.3.0.
13366 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13367 (gold_error_at_location, gold_warning_at_location): Use it.
13368 * configure.ac: Check whether we can compile and use a template
13369 function with a printf attribute.
13370 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13371 when jumping over bytes.
13372 * object.cc: Instantiate Object::read_section_data.
13373 * debug.h: Include <cstring>
13374 * dwarf_reader.cc: Include <algorithm>
13375 * main.cc: Include <cstring>.
13376 * options.cc: Include <cstring>.
13377 * output.cc: Include <cstring>.
13378 * script.cc: Include <cstring>.
13379 * script.h: Include <string>.
13380 * symtab.cc: Include <cstring> and <algorithm>.
13381 * target-select.cc: Include <cstring>.
13382 * version.cc: Include <string>.
13383 * testsuite/testmain.cc: Include <cstdlib>.
13384 * configure, config.in: Rebuild.
13386 2008-03-25 Ian Lance Taylor <iant@google.com>
13388 * options.cc: Include "../bfd/bfdver.h".
13389 (options::help): Print bug reporting address.
13391 * version.cc (print_version): Adjust output for current value of
13392 BFD_VERSION_STRING.
13396 * options.cc (options::help): Print list of supported targets.
13397 * target-select.h: Include <vector>.
13398 (class Target_selector): Make machine_, size_, and is_big_endian_
13399 fields const. Add bfd_name_ and instantiated_target_ fields.
13400 (Target_selector::Target_selector): Add bfd_name parameter.
13401 (Target_selector::recognize): Make non-virtual, call
13403 (Target_selector::recognize_by_name): Make non-virtual, call
13404 do_recognize_by_name.
13405 (Target_selector::supported_names): New function.
13406 (Target_selector::bfd_name): New function.
13407 (Target_selector::do_instantiate_target): New pure virtual
13409 (Target_selector::do_recognize): New virtual function.
13410 (Target_selector::do_recognize_by_name): New virtual function.
13411 (Target_selector::instantiate_target): New private function.
13412 (supported_target_names): Declare.
13413 * target-select.cc (Target_selector::Target_selector): Update for
13414 new parameter and fields.
13415 (select_target_by_name): Check that the name matches before
13416 calling recognize_by_name.
13417 (supported_target_names): New function.
13418 * i386.cc (class Target_selector_i386): Update Target_selector
13419 constructor call. Remove recognize and recognize_by_name. Add
13420 do_instantiate_target.
13421 * x86_64.cc (class Target_selector_x86_64): Likewise.
13422 * testsuite/testfile.cc (class Target_selector_test): Update for
13423 changes to Target_selector.
13425 * README: Rewrite, with some notes on unsupported features.
13427 2008-03-24 Cary Coutant <ccoutant@google.com>
13429 * i386.cc (Target_i386::Got_type): New enum declaration.
13430 (Target_i386::Scan::local): Updated callers of Output_data_got
13432 (Target_i386::Scan::global): Likewise.
13433 (Target_i386::Relocate::relocate): Likewise.
13434 (Target_i386::Relocate::relocate_tls): Likewise.
13435 * object.h (Got_offset_list): New class.
13436 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13437 (Sized_relobj::local_got_offset): Likewise.
13438 (Sized_relobj::set_local_got_offset): Likewise.
13439 (Sized_relobj::local_has_tls_got_offset): Removed.
13440 (Sized_relobj::local_tls_got_offset): Removed.
13441 (Sized_relobj::set_local_tls_got_offset): Removed.
13442 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13443 * output.cc (Output_data_got::add_global): Added got_type parameter.
13444 (Output_data_got::add_global_with_rel): Likewise.
13445 (Output_data_got::add_global_with_rela): Likewise.
13446 (Output_data_got::add_global_pair_with_rel): New function.
13447 (Output_data_got::add_global_pair_with_rela): New function.
13448 (Output_data_got::add_local): Added got_type parameter.
13449 (Output_data_got::add_local_with_rel): Likewise.
13450 (Output_data_got::add_local_with_rela): Likewise.
13451 (Output_data_got::add_local_pair_with_rel): New function.
13452 (Output_data_got::add_local_pair_with_rela): New function.
13453 (Output_data_got::add_global_tls): Removed.
13454 (Output_data_got::add_global_tls_with_rel): Removed.
13455 (Output_data_got::add_global_tls_with_rela): Removed.
13456 (Output_data_got::add_local_tls): Removed.
13457 (Output_data_got::add_local_tls_with_rel): Removed.
13458 (Output_data_got::add_local_tls_with_rela): Removed.
13459 * output.h (Output_data_got::add_global): Added got_type parameter.
13460 (Output_data_got::add_global_with_rel): Likewise.
13461 (Output_data_got::add_global_with_rela): Likewise.
13462 (Output_data_got::add_global_pair_with_rel): New function.
13463 (Output_data_got::add_global_pair_with_rela): New function.
13464 (Output_data_got::add_local): Added got_type parameter.
13465 (Output_data_got::add_local_with_rel): Likewise.
13466 (Output_data_got::add_local_with_rela): Likewise.
13467 (Output_data_got::add_local_pair_with_rel): New function.
13468 (Output_data_got::add_local_pair_with_rela): New function.
13469 (Output_data_got::add_global_tls): Removed.
13470 (Output_data_got::add_global_tls_with_rel): Removed.
13471 (Output_data_got::add_global_tls_with_rela): Removed.
13472 (Output_data_got::add_local_tls): Removed.
13473 (Output_data_got::add_local_tls_with_rel): Removed.
13474 (Output_data_got::add_local_tls_with_rela): Removed.
13475 * resolve.cc (Symbol::override_base_with_special): Removed
13476 reference to has_got_offset_ field.
13477 * symtab.cc (Symbol::init_fields): Replaced initialization
13478 of got_offset_ with got_offsets_. Removed initialization
13480 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13481 (Symbol::got_offset): Likewise.
13482 (Symbol::set_got_offset): Likewise.
13483 (Symbol::has_tls_got_offset): Removed.
13484 (Symbol::tls_got_offset): Removed.
13485 (Symbol::set_tls_got_offset): Removed.
13486 (Symbol::got_offset_): Removed.
13487 (Symbol::tls_mod_got_offset_): Removed.
13488 (Symbol::tls_pair_got_offset_): Removed.
13489 (Symbol::got_offsets_): New field.
13490 (Symbol::has_got_offset): Removed.
13491 (Symbol::has_tls_mod_got_offset): Removed.
13492 (Symbol::has_tls_pair_got_offset): Removed.
13493 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13494 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13496 (Target_x86_64::Scan::global): Likewise.
13497 (Target_x86_64::Relocate::relocate): Likewise.
13498 (Target_x86_64::Relocate::relocate_tls): Likewise.
13500 2008-03-25 Ben Elliston <bje@au.ibm.com>
13502 * yyscript.y: Fix spelling error in comment.
13504 2008-03-24 Ian Lance Taylor <iant@google.com>
13506 * options.h (class General_options): Define build_id option.
13507 * layout.h (class Layout): Declare write_build_id, create_note,
13508 create_build_id. Add build_id_note_ member.
13509 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13510 "libiberty.h", "md5.h", "sha1.h".
13511 (Layout::Layout): Initialize eh_frame_data_,
13512 eh_frame_hdr_section_, and build_id_note_.
13513 (Layout::finalize): Call create_build_id.
13514 (Layout::create_note): New function, broken out of
13515 Layout::create_gold_note.
13516 (Layout::create_gold_note): Call create_note.
13517 (Layout::create_build_id): New function.
13518 (Layout::write_build_id): New function.
13519 (Close_task_runner::run): Call write_build_id.
13521 * x86_64.cc: Correct license to GPLv3.
13523 2008-03-23 Ian Lance Taylor <iant@google.com>
13525 * options.cc: Include "demangle.h".
13526 (parse_optional_string): New function.
13527 (parse_long_option): Handle takes_optional_argument.
13528 (parse_short_option): Update dash_z initializer. Handle
13529 takes_optional_argument.
13530 (General_options::General_options): Initialize do_demangle_.
13531 (General_options::finalize): Set do_demangle_. Handle demangling
13533 * options.h (parse_optional_string): Declare.
13534 (struct One_option): Add optional_arg field. Update constructor.
13535 Update call constructor calls. Add takes_optional_argument
13537 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13538 (DEFINE_optional_string): Define.
13539 (General_options::demangle): Change from DEFINE_bool to
13540 DEFINE_optional_string.
13541 (General_options::no_demangle): New function.
13542 (General_options::do_demangle): New function.
13543 (General_options::set_do_demangle): New function.
13544 (General_options::execstack_status_): Move definition to end of
13546 (General_options::static_): Likewise.
13547 (General_options::do_demangle_): New field.
13548 * object.cc (big_endian>::get_symbol_location_info): Call
13549 Options::do_demangle, not Options::demangle.
13550 * symtab.cc (demangle): Likewise.
13552 2008-03-22 Ian Lance Taylor <iant@google.com>
13554 * gold.h: Include <cstddef> and <sys/types.h>
13555 * options.h: Include <cstring>.
13557 2008-03-21 Ian Lance Taylor <iant@google.com>
13559 * Added source code to GNU binutils.