1 2012-08-31 Alan Modra <amodra@gmail.com>
3 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4 (Powerpc_relobj::toc_base_offset): New stub function.
5 (Target_powerpc): Add tp_offset, dtp_offset. Rename
6 got_mod_index_offset to tlsld_got_offset. Update all refs.
7 (Target_powerpc::Relocate::enum skip_tls): New.
8 (Target_powerpc::call_tls_get_addr_): New var.
9 (Target_powerpc::is_branch_reloc): Move to file scope.
10 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
11 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
13 (Target_powerpc::enum Got_type): Delete old values, add new ones.
14 (powerpc_info): Correct common_pagesize for ppc64.
15 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
16 (Powerpc_relocate_functions): Add overflow check enums and functions.
17 Add non-shift version of rela, rela_ua. Delete all rel public
18 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
19 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
20 addr16_ha3, addr14 functions.
21 (Output_data_got_powerpc::add_constant_pair): New function.
22 (Output_data_got_powerpc::got_base_offset): Likewise.
23 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
24 (instruction constants): Sort, add some more.
25 (Output_data_glink::do_write): Add and use Address typedef. Use
26 object->toc_base_offset() stub for 64-bit.
27 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
28 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
29 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
30 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
31 Always treat .opd relocs as against locally defined symbol.
32 Correct condition for RELATIVE relocs.
33 (Target_powerpc::do_finalize_sections): Test for NULL sections.
34 (Target_powerpc::Relocate::relocate): Use plt call stub as value
35 for 32-bit syms with a plt entry. Correct ppc64 toc base
36 calculations. Handle TLS relocs, and more. Add overflow
37 checking and adjust for Powerpc_relocate_functions changes.
38 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
39 Reinstate --emit-relocs code with FIXME.
41 2012-08-30 Alan Modra <amodra@gmail.com>
43 * layout.cc (Layout::set_segment_offsets): Set p_align to
44 abi_pagesize, not common_pagesize.
45 (Layout::relaxation_loop_body): Similarly use abi_pagesize
46 to determine whether file header can go in segment.
48 2012-08-30 Alan Modra <amodra@gmail.com>
50 * output.h (Output_reloc::Output_reloc <output section>): Add
51 is_relative param. Adjust calls.
52 (Output_reloc::add_output_section_relative): New functions.
53 * output.cc (Output_reloc::Output_reloc <output section>): Handle
55 (Output_reloc::symbol_value): Handle SECTION_CODE.
57 2012-08-24 Sriraman Tallam <tmsriram@google.com>
59 * gold.cc (queue_middle_tasks): Call layout again when unique
60 segments for sections is desired.
61 * layout.cc (Layout::Layout): Initialize new members.
62 (Layout::get_output_section_flags): New function.
63 (Layout::choose_output_section): Call get_output_section_flags.
64 (Layout::layout): Make output section for mapping to a unique segment.
65 (Layout::insert_section_segment_map): New function.
66 (Layout::attach_allocated_section_to_segment): Make unique segment for
67 output sections marked so.
68 (Layout::segment_precedes): Check for unique segments when sorting.
69 * layout.h (Layout::Unique_segment_info): New struct.
70 (Layout::Section_segment_map): New typedef.
71 (Layout::insert_section_segment_map): New function.
72 (Layout::get_output_section_flags): New function.
73 (Layout::is_unique_segment_for_sections_specified): New function.
74 (Layout::set_unique_segment_for_sections_specified): New function.
75 (Layout::unique_segment_for_sections_specified_): New member.
76 (Layout::section_segment_map_): New member.
77 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
78 Rename is_gc_pass_one to is_pass_one.
79 Rename is_gc_pass_two to is_pass_two.
80 Rename is_gc_or_icf to is_two_pass.
81 Check for which pass based on whether symbols data is present.
82 Make it two pass when unique segments for sections is desired.
83 * output.cc (Output_section::Output_section): Initialize new
85 * output.h (Output_section::is_unique_segment): New function.
86 (Output_section::set_is_unique_segment): New function.
87 (Output_section::is_unique_segment_): New member.
88 (Output_section::extra_segment_flags): New function.
89 (Output_section::set_extra_segment_flags): New function.
90 (Output_section::extra_segment_flags_): New member.
91 (Output_section::segment_alignment): New function.
92 (Output_section::set_segment_alignment): New function.
93 (Output_section::segment_alignment_): New member.
94 (Output_segment::Output_segment): Initialize is_unique_segment_.
95 (Output_segment::is_unique_segment): New function.
96 (Output_segment::set_is_unique_segment): New function.
97 (Output_segment::is_unique_segment_): New member.
98 * plugin.cc (allow_unique_segment_for_sections): New function.
99 (unique_segment_for_sections): New function.
100 (Plugin::load): Add new functions to transfer vector.
101 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
102 * Makefile.in: Regenerate.
103 * testsuite/plugin_final_layout.sh: Check if unique segment
105 * testsuite/plugin_section_order.c (onload): Check if new interfaces
107 (allow_unique_segment_for_sections): New global.
108 (unique_segment_for_sections): New global.
109 (claim_file_hook): Call allow_unique_segment_for_sections.
110 (all_symbols_read_hook): Call unique_segment_for_sections.
112 2012-08-22 Cary Coutant <ccoutant@google.com>
114 * layout.cc (Layout::include_section): Don't assert on GROUP
115 sections with --emit-relocs.
117 2012-08-21 Cary Coutant <ccoutant@google.com>
119 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
120 if --export-dynamic-symbol names an undef symbol.
122 2012-08-18 Alan Modra <amodra@gmail.com>
124 * powerpc.cc: Formatting and white space.
125 (Powerpc_relobj): Rename got2_section_ to special_.
126 Add opd_ent_shndx_ and opd_ent_off_ vectors.
127 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
128 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
129 (Target_powerpc): Add Address typedef and invalid_address. Use
131 (Target_powerpc::is_branch_reloc): New function.
132 (Powerpc_relocate_functions): Add Address typedef, use throughout.
133 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
134 for dst_mask, value and addend.
135 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
136 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
137 (Output_data_glink::do_write): Correct toc base. Don't try to use
138 uint16_t for 24-bit offset. Use get_output_section_offset and
140 (Target_powerpc::Scan::local): Handle more relocs.
141 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
142 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
143 Plug in toc restoring insn after plt calls. Translate branches
144 to function descriptor symbols to corresponding entry point.
145 (Target_powerpc::relocate_for_relocatable): Check return from
146 get_output_section_offset.
147 * symtab.h: Comment typo.
149 2012-08-14 Ian Lance Taylor <iant@google.com>
151 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
152 unsupported_relocal_local to call unsupported_reloc_global.
154 2012-08-14 Nick Clifton <nickc@redhat.com>
157 * script-sections.cc (Sections_element::output_section_name): Add
158 keep return parameter.
159 (Output_section_element::match_name): Add keep return parameter.
160 Return the value of the keep_ member.
161 * script-sections.h (class Output_section): Update
162 output_section_name prototype.
163 * layout.cc (Layout::keep_input_section): New public member
165 (Layout::choose_output_section): Pass keep parameter to
167 * layout.h (class Layout): Add keep_input_section.
168 * object.cc (Sized_relobj_file::do_layout): Check for kept input
170 * testsuite/Makefile.am: Add a test.
171 * testsuite/Makefile.in: Regenerate.
172 * testsuite/pr14265.c: Source file for the test.
173 * testsuite/pr14265.t: Linker script for the test.
174 * testsuite/pr14265.sh: Shell script for the test.
176 2012-08-14 Alan Modra <amodra@gmail.com>
178 * target.h (Target::output_section_name): New function.
179 (Target::do_output_section_name): New function.
180 * layout.cc (Layout::choose_output_section): Call the above.
181 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
183 2012-08-14 Alan Modra <amodra@gmail.com>
185 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
186 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
187 for replace_constant call.
188 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
189 (Output_data_glink::do_print_to_mapfile): New function.
190 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
191 (Target_powerpc::Relocate::relocate): Likewise.
193 2012-08-14 Alan Modra <amodra@gmail.com>
195 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
196 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
197 (Output_data_glink::add_entry,find_entry): Remove shndx param.
198 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
199 all references to shndx_. Handle special case for R_PPC_PLTREL24
201 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
202 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
203 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
205 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
206 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
208 2012-08-12 Alan Modra <amodra@gmail.com>
210 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
211 (glink insn constants): Use uint32_t.
212 (Output_data_glink::add_entry): Use insert, not [] operator.
214 2012-08-11 Alan Modra <amodra@gmail.com>
216 * object.h (Sized_relobj_file::find_shdr): New function.
217 (Sized_relobj_file::find_special_sections): New function.
218 * object.cc (Sized_relobj_file::find_shdr): New function.
219 (Sized_relobj_file::find_eh_frame): Use find_shdr.
220 (Sized_relobj_file::find_special_sections): New function, split out..
221 (Sized_relobj_file::do_read_symbols): ..from here.
222 * output.h (Output_data_got::replace_constant): New function.
223 (Output_data_got::num_entries): New function.
224 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
225 (Output_data_got::got_offset): Protected rather than private.
226 (Output_data_got::replace_got_entry): New function.
227 * output.cc (Output_data_got::replace_got_entry): New function.
228 * powerpc.cc (class Powerpc_relobj): New.
229 (class Powerpc_relocate_functions): Delete all psymval variants or
230 convert to value,addend type. Delete pcrela, pcrela_unaligned.
231 Implement _ha functions using corresponding _hi function.
232 (Powerpc_relobj::find_special_sections): New function.
233 (Target_powerpc::do_make_elf_object): New function.
234 (class Output_data_got_powerpc): New.
235 (class Output_data_glink): New.
236 (class Powerpc_scan_relocatable_reloc): New.
237 Many more changes througout file.
239 2012-08-09 Nick Clifton <nickc@redhat.com>
241 * po/vi.po: Updated Vietnamese translation.
243 2012-08-07 Ian Lance Taylor <iant@google.com>
245 * layout.cc (Layout::add_target_dynamic_tags): If
246 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
249 2012-07-30 Nick Clifton <nickc@redhat.com>
251 * po/gold.pot: Updated template.
252 * po/es.po: Updated Spanish translation.
254 2012-07-18 Cary Coutant <ccoutant@google.com>
257 * configure.ac: Add check for -gpubnames support.
258 * configure: Regenerate.
259 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
260 support; force -gno-pubnames.
261 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
263 (gdb_index_test_4): New test.
264 * testsuite/Makefile.in: Regenerate.
265 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
266 * testsuite/gdb_index_test_2.sh: Likewise.
267 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
268 * testsuite/gdb_index_test_4.sh: New script.
269 * testsuite/gdb_index_test_comm.sh: New script with common code;
270 don't look for space after colon.
272 2012-07-16 Sriraman Tallam <tmsriram@google.com>
274 * gold.cc (queue_middle_tasks): Update function order only after
275 deferred objects due to plugins are processed.
277 2012-07-11 Ian Lance Taylor <iant@google.com>
279 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
280 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
281 (Target_arm::scan_reloc_for_stub): Likewise.
282 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
283 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
284 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
285 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
286 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
288 2012-07-10 Dodji Seketeli <dodji@redhat.com>
289 Ian Lance Taylor <iant@google.com>
292 * configure.ac: Test whether std::tr1::hash<off_t> works.
293 * gold.h: Add a specialization for std::tr1::hash<off_t> if
295 * output.h (class Output_fill): Add virtual destructor.
296 * configure, config.in: Rebuild.
298 2012-06-22 Roland McGrath <mcgrathr@google.com>
300 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
302 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
304 * plugin.cc (Plugin::load): Handle position independent executables.
306 2012-06-06 Cary Coutant <ccoutant@google.com>
308 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
310 (lines_only_debug_sections): Likewise.
311 (gdb_fast_lookup_sections): New static array.
312 (is_gdb_debug_section): Rename formal parameter.
313 (is_lines_only_debug_section): Likewise.
314 (is_gdb_fast_lookup_section): New function.
315 (Layout::include_section): Check for ".zdebug_" prefix; pass
316 section name suffix to is_gdb_debug_section, et al.; check for
317 fast-lookup sections when building .gdb_index.
318 * options.h (--strip-debug-gdb): Update GDB version number.
320 2012-06-06 Cary Coutant <ccoutant@google.com>
322 * configure.ac: Add check for fallocate.
323 * configure: Regenerate.
324 * config.in: Regenerate.
326 * options.h (class General_options): Add --mmap-output-file and
327 --posix-fallocate options.
328 * output.cc: (posix_fallocate): Remove; replace with...
329 (gold_fallocate): New function.
330 (Output_file::map_no_anonymous): Call gold_fallocate.
331 (Output_file::map): Check --mmap-output-file option.
333 2012-06-05 Jing Yu <jingyu@google.com>
335 * gold.h (textdomain): Add do {} to empty while(0).
336 (bindtextdomain): Likewise.
338 2012-06-04 Cary Coutant <ccoutant@google.com>
340 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
343 2012-05-25 Sriraman Tallam <tmsriram@google.com>
345 * symtab.cc (Symbol_table::define_special_symbol):
346 Initialize *poldsym to prevent uninitialized variable errors.
348 2012-05-23 Cary Coutant <ccoutant@google.com>
350 * layout.cc (Layout::section_name_mapping): Add rules to handle
351 exact match on .data.rel.ro.local or .data.rel.ro.
352 (Layout::output_section_name): Check for exact matches.
354 2012-05-23 Cary Coutant <ccoutant@google.com>
356 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
359 2012-05-22 Cary Coutant <ccoutant@google.com>
361 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
362 object before exporting symbol.
364 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
366 * testsuite/tls_test.cc: Include "config.h" first.
367 * testsuite/tls_test_c.c: Likewise.
369 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
370 Nick Clifton <nickc@redhat.com>
373 * configure.in: Add check that sysdep.h has been included before
374 any system header files.
375 * configure: Regenerate.
376 * config.in: Regenerate.
378 2012-05-14 Cary Coutant <ccoutant@google.com>
380 * layout.cc (Layout::make_output_section): Mark .tdata section
382 * testsuite/relro_test.cc: Add a TLS variable.
384 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
387 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
388 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
391 2012-05-08 Cary Coutant <ccoutant@google.com>
393 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
394 (lines_only_debug_sections): Likewise.
396 2012-05-02 Roland McGrath <mcgrathr@google.com>
400 * Makefile.am (CCFILES, HFILES): Add them.
401 * Makefile.in: Regenerate.
402 * i386.cc (Output_data_plt_i386_nacl): New class.
403 (Output_data_plt_i386_nacl_exec): New class.
404 (Output_data_plt_i386_nacl_dyn): New class.
405 (Target_i386_nacl): New class.
406 (Target_selector_i386_nacl): New class.
407 (target_selector_i386): Use it instead of Target_selector_i386.
408 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
409 (Target_x86_64_nacl): New class.
410 (Target_selector_x86_64_nacl): New class.
411 (target_selector_x86_64, target_selector_x32): Use it instead of
412 Target_selector_x86_64.
413 * arm.cc (Output_data_plt_arm_nacl): New class.
414 (Target_arm_nacl): New class.
415 (Target_selector_arm_nacl): New class.
416 (target_selector_arm, target_selector_armbe): Use it instead of
419 * target-select.cc (select_target): Take new Input_file* and off_t
420 arguments, pass them on to recognize method of selector.
421 * object.cc (make_elf_sized_object): Update caller.
422 * parameters.cc (parameters_force_valid_target): Likewise.
423 * incremental.cc (make_sized_incremental_binary): Likewise.
424 * target-select.h: Update decl.
425 (Target_selector::recognize): Take new Input_file* argument,
426 pass it on to do_recognize.
427 (Target_selector::do_recognize): Take new Input_file* argument.
428 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
429 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
430 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
431 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
433 * target.h (Target::Target_info): New members isolate_execinstr
435 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
436 * arm.cc (Target_arm::arm_info): Update initializer.
437 * i386.cc (Target_i386::i386_info): Likewise.
438 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
439 * sparc.cc (Target_sparc::sparc_info): Likewise.
440 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
441 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
442 * layout.cc (Layout::attach_allocated_section_to_segment):
443 Take new const Target* argument. If target->isolate_execinstr(), act
445 (Layout::find_first_load_seg): Take new const Target* argument;
446 if target->isolate_execinstr(), reject PF_X segments.
447 (Layout::relaxation_loop_body): Update caller.
448 (Layout::set_segment_offsets): If target->isolate_execinstr(),
449 reset file offset to zero when we hit LOAD_SEG, and then do a second
450 loop over the segments before LOAD_SEG to reassign offsets after
451 addresses have been determined. Handle target->rosegment_gap().
452 (Layout::attach_section_to_segment): Take new const Target* argument;
453 pass it to attach_allocated_section_to_segment.
454 (Layout::make_output_section): Update caller.
455 (Layout::attach_sections_to_segments): Take new const Target* argument;
456 pass it to attach_section_to_segment.
457 * gold.cc (queue_middle_tasks): Update caller.
458 * layout.h (Layout): Update method decls with new arguments.
460 * arm.cc (Target_arm::Target_arm): Take optional argument for the
461 Target_info pointer to use.
462 (Target_arm::do_make_data_plt): New virtual method.
463 (Target_arm::make_data_plt): New method that calls it.
464 (Target_arm::make_plt_entry): Use it.
465 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
466 for the section alignment.
467 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
469 (Output_data_plt_arm::first_plt_entry_offset): Call it.
470 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
472 (Output_data_plt_arm::get_plt_entry_size): Call it.
473 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
474 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
475 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
477 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
478 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
479 method instead of sizeof(plt_entry).
480 (Output_data_plt_arm::add_entry): Likewise.
481 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
482 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
484 (Target_arm::plt_entry_size): Likewise.
485 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
487 (Output_data_plt_arm_standard): ... here, new class.
488 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
489 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
490 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
492 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
493 Take additional argument for the PLT entry size.
494 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
495 Use get_plt_entry_size method rather than plt_entry_size variable.
496 (Output_data_plt_x86_64::reserve_slot): Likewise.
497 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
498 (Output_data_plt_x86_64::add_entry): Likewise.
499 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
500 (Output_data_plt_x86_64::address_for_global): Likewise.
501 (Output_data_plt_x86_64::address_for_local): Likewise.
502 (Output_data_plt_x86_64::set_final_data_size): Likewise.
503 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
504 Make method non-static.
505 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
507 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
508 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
509 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
510 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
512 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
513 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
515 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
516 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
518 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
519 (Output_data_plt_x86_64::plt_entry_size)
520 (Output_data_plt_x86_64::first_plt_entry)
521 (Output_data_plt_x86_64::plt_entry)
522 (Output_data_plt_x86_64::tlsdesc_plt_entry)
523 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
524 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
525 (Output_data_plt_x86_64_standard): ... here, new class.
526 (Target_x86_64::Target_x86_64): Take optional argument for the
527 Target_info pointer to use.
528 (Target_x86_64::do_make_data_plt): New virtual method.
529 (Target_x86_64::make_data_plt): New method to call it.
530 (Target_x86_64::init_got_plt_for_update): Use that.
531 Call this->plt_->add_eh_frame method here.
532 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
533 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
534 rather than static method.
535 (Target_x86_64::plt_entry_size): Likewise.
536 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
537 rather than plt_entry_size variable. Move guts of PLT filling to...
538 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
539 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
540 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
542 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
543 additional argument for the section alignment.
544 Don't do add_eh_frame_for_plt here.
545 (Output_data_plt_i386::first_plt_entry_offset): Make the method
546 non-static. Use get_plt_entry_size method rather than plt_entry_size
548 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
550 (Output_data_plt_i386::get_plt_entry_size): Call it.
551 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
552 (Output_data_plt_i386::add_eh_frame): New method to call it.
553 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
555 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
556 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
558 (Output_data_plt_i386::fill_plt_entry): New method to call it.
559 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
560 method instead of plt_entry_size.
561 (Output_data_plt_i386::plt_entry_size)
562 (Output_data_plt_i386::plt_eh_frame_fde_size)
563 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
564 (Output_data_plt_i386_standard): ... here, new class.
565 (Output_data_plt_i386_exec): New class.
566 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
567 (Output_data_plt_i386_exec::first_plt_entry): ... here.
568 (Output_data_plt_i386::exec_plt_entry): Move to ...
569 (Output_data_plt_i386_exec::plt_entry): ... here.
570 (Output_data_plt_i386_dyn): New class.
571 (Output_data_plt_i386::first_plt_entry): Move to ...
572 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
573 (Output_data_plt_i386::dyn_plt_entry): Move to ...
574 (Output_data_plt_i386_dyn::plt_entry): ... here.
575 (Target_i386::Target_i386): Take optional argument for the Target_info
577 (Target_i386::do_make_data_plt): New virtual method.
578 (Target_i386::make_data_plt): New method to call it.
579 (Target_i386::make_plt_section): Use that.
580 Call this->plt_->add_eh_frame method here.
581 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
582 rather than plt_entry_size variable.
583 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
584 (Output_data_plt_i386::address_for_local): Likewise.
585 (Output_data_plt_i386::do_write): Likewise.
586 Move guts of PLT filling to...
587 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
588 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
589 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
590 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
592 2012-05-01 Cary Coutant <ccoutant@google.com>
594 * dwarf_reader.cc (Dwarf_die::read_attributes)
595 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
596 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
597 * reduced_debug_output.cc
598 (Output_reduced_debug_info_section::get_die_end): Remove
599 DW_FORM_GNU_ref_index. Add default case.
601 2012-04-26 Mark Wielaard <mjw@redhat.com>
603 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
604 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
605 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
606 DW_AT_high_pc as offset from DW_AT_low_pc.
608 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
609 * testsuite/Makefile.in: Regenerate.
610 * testsuite/gdb_index_test_3.c: New test source file.
611 * testsuite/gdb_index_test_3.sh: New test source file.
613 2012-04-25 Ian Lance Taylor <iant@google.com>
615 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
617 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
618 as a class, not a struct.
619 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
620 (Target_arm::apply_cortex_a8_workaround): Likewise.
621 * gc.h: Declare Reloc_types as a struct, not a class.
622 * object.h: Declare Symbols_data as a struct.
623 * reloc.h: Declare Read_relocs_data as a struct.
624 * target.h: Declare Relocate_info as a struct.
626 2012-04-24 David S. Miller <davem@davemloft.net>
628 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
629 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
632 2012-04-24 Cary Coutant <ccoutant@google.com>
634 * incremental-dump.cc (find_input_containing_global): Replace
635 magic number with symbolic constant.
636 (dump_incremental_inputs): Update version number.
637 * incremental.cc (Output_section_incremental_inputs): Update version
638 number; import symbolic constants from Incremental_inputs_reader.
639 (Incremental_inputs::create_data_sections): Align relocations
640 section correctly for 64-bit targets.
641 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
642 constants; add padding.
643 (Output_section_incremental_inputs::write_header): Add assert for
645 (Output_section_incremental_inputs::write_input_files): Add assert
646 for input_entry_size.
647 (Output_section_incremental_inputs::write_info_blocks): Add padding;
648 add assert for object_info_size, input_section_entry_size,
649 global_sym_entry_size.
650 * incremental.h (Incremental_inputs_reader): Add symbolic constants
651 for data structure sizes; use them.
652 (Incremental_input_entry_reader): Import symbolic constants from
653 Incremental_inputs_reader; use them.
655 2012-04-23 David S. Miller <davem@davemloft.net>
657 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
659 (Target_sparc::Target_sparc): Initialize new fields.
660 (Target_sparc::do_make_elf_object): New function.
661 (Target_sparc::do_adjust_elf_header): New function.
663 2012-04-23 Cary Coutant <ccoutant@google.com>
665 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
666 CU range table of gdb index.
668 2012-04-20 David S. Miller <davem@davemloft.net>
670 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
673 2012-04-16 David S. Miller <davem@davemloft.net>
675 * sparc.cc (Target_sparc::got_address): New function.
676 (Sparc_relocate_functions::gdop_hix22): New function.
677 (Sparc_relocate_functions::gdop_lox10): New function.
678 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
680 (Target_sparc::Scan::local): Likewise if the global symbol is not
681 preemptible and is not IFUNC.
682 (Target_sparc::Relocate::relocate): Perform GOTDATA code
683 transformations for local and non-preemptible non-IFUNC global
686 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
687 writing out 64-bit part of ranges.
689 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
690 -fpic and -fpie respectively.
691 * Makefile.in: Regenerate.
693 * sparc.cc (class Target_sparc): Add rela_ifunc_.
694 (Target_sparc::Target_sparc): Initialize new field.
695 (Target_sparc::do_plt_section_for_global): New function.
696 (Target_sparc::do_plt_section_for_local): New function.
697 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
698 (Target_sparc::make_plt_section): New function, broken out of
699 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
700 (Target_sparc::make_plt_entry): Call make_plt_section.
701 (Target_sparc::make_local_ifunc_plt_entry): New function.
702 (Target_sparc::rela_ifunc_section): New function.
703 (Target_sparc::plt_section): Remove const.
704 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
705 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
706 and ifunc_count_ fields.
707 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
708 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
709 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
710 (Output_data_plt_sparc::rela_ifunc): New function.
711 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
712 (Output_data_plt_sparc::has_ifunc_section): New function.
713 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
714 (Output_data_plt_sparc::address_for_global): New function.
715 (Output_data_plt_sparc::address_for_local): New function.
716 (Output_data_plt_sparc::plt_index_to_offset): New function.
717 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
719 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
721 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
722 R_SPARC_JMP_IREL to switch.
723 (Target_sparc::Scan::check_non_pic): Likewise.
724 (Target_sparc::Scan::local): Handle IFUNC symbols.
725 (Target_sparc::Scan::local): Likewise.
726 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
727 and plt_address_for_local.
728 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
729 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
731 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
732 (class Output_data_reloc): Adjust calls to Output_reloc_type.
733 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
734 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
736 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
737 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
739 * sparc.cc (Target_sparc::Scan::global): Likewise.
740 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
742 2012-04-16 Cary Coutant <ccoutant@google.com>
744 * archive.cc (Library_base::should_include_member): Check for
745 --export-dynamic-symbol.
746 * options.h (class General_options): Add --export-dynamic-symbol.
747 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
748 --export-dynamic-symbol.
749 (Symbol_table::gc_mark_undef_symbols): Likewise.
750 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
752 2012-04-12 David S. Miller <davem@davemloft.net>
754 * sparc.cc (Reloc::wdisp10): New relocation method.
755 (Reloc::h34): Likewise.
756 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
757 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
759 (Target_sparc::Scan::local): Likewise.
760 (Target_sparc::Scan::global): Likewise.
761 (Target_sparc::Relocate::relocate): Likewise.
763 2012-04-09 Cary Coutant <ccoutant@google.com>
765 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
768 2012-04-06 Ian Lance Taylor <iant@google.com>
770 * timer.cc: #include <unistd.h>.
772 2012-04-06 Roland McGrath <mcgrathr@google.com>
774 * configure.in (AC_CHECK_HEADERS): Add locale.h.
775 * config.in: Regenerate.
776 * configure: Regenerate.
778 2012-04-05 Nick Clifton <nickc@redhat.com>
780 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
781 (AM_LC_MESSAGES): Add.
782 * aclocal.m4: Regenerate.
783 * config.in: Regenerate.
784 * configure: Regenerate.
786 2012-03-21 Cary Coutant <ccoutant@google.com>
788 * Makefile.am: Add gdb-index.cc, gdb-index.h.
789 * Makefile.in: Regenerate.
790 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
791 (Sized_elf_reloc_mapper::symbol_section): New function.
792 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
793 (make_elf_reloc_mapper): New function.
794 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
795 (Dwarf_abbrev_table::do_read_abbrevs): New function.
796 (Dwarf_abbrev_table::do_get_abbrev): New function.
797 (Dwarf_ranges_table::read_ranges_table): New function.
798 (Dwarf_ranges_table::read_range_list): New function.
799 (Dwarf_pubnames_table::read_section): New function.
800 (Dwarf_pubnames_table::read_header): New function.
801 (Dwarf_pubnames_table::next_name): New function.
802 (Dwarf_die::Dwarf_die): New function.
803 (Dwarf_die::read_attributes): New function.
804 (Dwarf_die::skip_attributes): New function.
805 (Dwarf_die::set_name): New function.
806 (Dwarf_die::set_linkage_name): New function.
807 (Dwarf_die::attribute): New function.
808 (Dwarf_die::string_attribute): New function.
809 (Dwarf_die::int_attribute): New function.
810 (Dwarf_die::uint_attribute): New function.
811 (Dwarf_die::ref_attribute): New function.
812 (Dwarf_die::child_offset): New function.
813 (Dwarf_die::sibling_offset): New function.
814 (Dwarf_info_reader::check_buffer): New function.
815 (Dwarf_info_reader::parse): New function.
816 (Dwarf_info_reader::do_parse): New function.
817 (Dwarf_info_reader::do_read_string_table): New function.
818 (Dwarf_info_reader::lookup_reloc): New function.
819 (Dwarf_info_reader::get_string): New function.
820 (Dwarf_info_reader::visit_compilation_unit): New function.
821 (Dwarf_info_reader::visit_type_unit): New function.
822 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
823 Sized_elf_reloc_mapper.
824 (Sized_dwarf_line_info::symbol_section): Remove function.
825 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
826 (Sized_dwarf_line_info::read_line_mappings): Remove object
827 parameter, adjust callers.
828 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
829 * dwarf_reader.h: Include <sys/types.h>.
830 (class Track_relocs): Remove forward declaration.
831 (class Elf_reloc_mapper): New class.
832 (class Sized_elf_reloc_mapper): New class.
833 (class Dwarf_abbrev_table): New class.
834 (class Dwarf_range_list): New class.
835 (class Dwarf_ranges_table): New class.
836 (class Dwarf_pubnames_table): New class.
837 (class Dwarf_die): New class.
838 (class Dwarf_info_reader): New class.
839 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
840 (Sized_dwarf_line_info::symbol_section): Remove member function.
841 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
843 * gdb-index.cc: New source file.
844 * gdb-index.h: New source file.
845 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
846 and .debug_types sections, call Layout::add_to_gdb_index.
847 (Sized_relobj_incr::do_section_name): Implement.
848 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
849 return type; Implement.
850 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
852 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
853 parameter list and return type.
854 (Sized_incr_dynobj::do_section_contents): Likewise.
855 * layout.cc: Include gdb-index.h.
856 (Layout::Layout): Initialize gdb_index_data_.
857 (Layout::init_fixed_output_section): Check for .gdb_index section.
858 (Layout::add_to_gdb_index): New function. Instantiate.
859 * layout.h: Add forward declaration for class Gdb_index.
860 (Layout::add_to_gdb_index): New member function.
861 (Layout::gdb_index_data_): New data member.
862 * main.cc: Include gdb-index.h.
863 (main): Print statistics for gdb index.
864 * object.cc (Object::section_contents): Move code into
866 (need_decompressed_section): Check for sections needed when building
868 (build_compressed_section_map): Likewise.
869 (Sized_relobj_file::do_read_symbols): Need local symbols when building
871 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
872 sections; call Layout::add_to_gdb_index.
873 (Sized_relobj_file::do_decompressed_section_contents): Call
874 do_section_contents directly.
875 * object.h (Object::do_section_contents): Adjust parameter list and
877 (Object::do_decompressed_section_contents): Call do_section_contents
879 (Sized_relobj_file::do_section_contents): Adjust parameter list and
881 * options.h (class General_options): Add --gdb-index option.
882 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
883 list and return type.
884 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
885 * reloc.h (Track_relocs::checkpoint): New function.
886 (Track_relocs::reset): New function.
888 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
890 * testsuite/Makefile.in: Regenerate.
891 * testsuite/gdb_index_test.cc: New test source file.
892 * testsuite/gdb_index_test_1.sh: New test source file.
893 * testsuite/gdb_index_test_2.sh: New test source file.
895 2012-03-19 Doug Kwan <dougkwan@google.com>
897 * arm.cc (Target_arm::do_define_standard_symbols): New method.
898 (Target_arm::do_finalize_sections): Remove code which defines
899 __exidx_start and __exidx_end. Make symbol table parameter
900 anonymous as it is not used.
901 * gold.cc (queue_middle_tasks): Call target hook to define any
902 target-specific symbols.
903 * target.h (Target::define_standard_symbols): New method.
904 (Target::do_define_standard_symbols): Same.
905 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
906 * testsuite/Makefile.in: Regenerate.
907 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
909 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
910 relocations are generated for __exidx_start and __exidx_end.
912 2012-03-16 Doug Kwan <dougkwan@google.com>
914 * testsuite/Makefile.am: Disable test initpri3b.
915 * testsuite/Makefile.in: Regenerate.
917 2012-03-15 Doug Kwan <dougkwan@google.com>
919 * arm.cc (Target_arm::got_section): Make .got section read-only
922 2012-03-15 Ian Lance Taylor <iant@google.com>
925 * layout.cc (Layout::make_output_section): Correctly mark
926 SHT_INIT_ARRAY, et. al., as relro.
928 2012-03-14 Doug Kwan <dougkwan@google.com>
930 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
931 dynamic relocations for protected symbols in shared objects.
933 2012-03-13 Ian Lance Taylor <iant@google.com>
935 * resolve.cc (Symbol_table::resolve): When merging common symbols,
936 keep the larger alignment.
938 2012-03-12 Cary Coutant <ccoutant@google.com>
940 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
941 handling of DW_LNE_define_file.
943 2012-03-12 Cary Coutant <ccoutant@google.com>
945 * reduced_debug_output.cc
946 (Output_reduced_debug_info_section::get_die_end): Add new FORM
949 2012-02-29 Cary Coutant <ccoutant@google.com>
951 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
953 2012-02-29 Cary Coutant <ccoutant@google.com>
955 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
956 Call Object::decompressed_section_contents.
957 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
959 (Sized_dwarf_line_info::buffer_start_): New data member.
960 * merge.cc (Output_merge_data::do_add_input_section): Call
961 Object::decompressed_section_contents.
962 (Output_merge_string::do_add_input_section): Likewise.
963 * object.cc (need_decompressed_section): New function.
964 (build_compressed_section_map): Decompress sections needed later.
965 (Sized_relobj_file::do_decompressed_section_contents): New function.
966 (Sized_relobj_file::do_discard_decompressed_sections): New function.
967 * object.h (Object::decompressed_section_contents): New function.
968 (Object::discard_decompressed_sections): New function.
969 (Object::do_decompressed_section_contents): New function.
970 (Object::do_discard_decompressed_sections): New function.
971 (Compressed_section_info): New type.
972 (Compressed_section_map): Include decompressed section contents.
973 (Sized_relobj_file::do_decompressed_section_contents): New function.
974 (Sized_relobj_file::do_discard_decompressed_sections): New function.
976 2012-02-16 Cary Coutant <ccoutant@google.com>
978 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
979 * testsuite/Makefile.in: Regenerate.
981 2012-02-14 Cary Coutant <ccoutant@google.com>
983 * options.cc (General_options::finalize): Disallow -pie and -static.
985 2012-02-03 Doug Kwan <dougkwan@google.com>
987 * arm.cc (Arm_relocate_functions::abs8,
988 Arm_relocate_functions::abs16): Use
989 Bits::has_signed_unsigned_overflow32.
990 (Arm_relocate_functions::thm_abs8): Correct range of
992 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
995 2012-02-02 Doug Kwan <dougkwan@google.com>
997 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
998 position independent outputs, not just shared objects.
1000 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1002 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1003 * configure: Regenerated.
1005 2012-01-27 Ian Lance Taylor <iant@google.com>
1007 * reloc.h (Bits): New class with static functions, copied from
1008 namespace utils in arm.cc.
1009 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1012 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1014 * incremental.cc (write_info_blocks): Correct relocation offset.
1016 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1018 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1019 (Relocate::tls_gd_to_le): Likewise.
1021 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1023 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1025 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1027 * configure.ac: Check if -mcmodel=medium works.
1028 * configure: Regenerated.
1030 2012-01-24 Cary Coutant <ccoutant@google.com>
1032 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1034 (read_unsigned_LEB_128_x): ... this new function.
1035 (read_signed_LEB_128): Replaced with inline definition and ...
1036 (read_signed_LEB_128_x): ... this new function.
1037 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1038 (read_unsigned_LEB_128): Add inline definition.
1039 (read_signed_LEB_128_x): New function.
1040 (read_signed_LEB_128): Add inline definition.
1041 * testsuite/Makefile.am (leb128_unittest): New unit test.
1042 * testsuite/Makefile.in: Regenerate.
1043 * testsuite/leb128_unittest.cc: New unit test.
1045 2012-01-23 Ian Lance Taylor <iant@google.com>
1048 * i386.cc (Target_i386::do_code_fill): When using a jmp
1049 instruction, pad with nop instructions.
1050 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1052 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1054 * x86_64.cc (gc_process_relocs): Add typename on types used in
1056 (scan_relocs): Likewise.
1057 (relocate_section): Likewise.
1058 (apply_relocation): Likewise.
1060 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1062 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1063 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1066 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1068 * x86_64.cc: Initial support for x32.
1070 2012-01-03 Cary Coutant <ccoutant@google.com>
1072 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1073 Use abstract base class for GOT.
1074 * gold/output.h (class Output_data_got_base): New abstract base class.
1075 (class Output_data_got): Derive from new base class, adjust ctors.
1076 (Output_data_got::reserve_slot): Make virtual; rename to
1077 do_reserve_slot; Adjust callers.
1078 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1079 pointer to abstract base class.
1080 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1082 2011-12-18 Ian Lance Taylor <iant@google.com>
1084 * object.h (Relobj::local_symbol_value): New function.
1085 (Relobj::local_plt_offset): New function.
1086 (Relobj::local_has_got_offset): New function.
1087 (Relobj::local_got_offset): New function.
1088 (Relobj::set_local_got_offset): New function.
1089 (Relobj::do_local_symbol_value): New pure virtual function.
1090 (Relobj::do_local_plt_offset): Likewise.
1091 (Relobj::do_local_has_got_offset): Likewise.
1092 (Relobj::do_local_got_offset): Likewise.
1093 (Relobj::do_set_local_got_offset): Likewise.
1094 (Sized_relobj::do_local_has_got_offset): Rename from
1095 local_has_got_offset.
1096 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1097 (Sized_relobj::do_set_local_got_offset): Rename from
1098 set_local_got_offset.
1099 (Sized_relobj_file::do_local_plt_offset): Rename from
1101 (Sized_relobj_file::do_local_symbol_value): New function.
1102 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1104 * output.cc (Output_data_got::Got_entry::write): Change object to
1105 Relobj. Use local_symbol_value.
1106 (Output_data_got::add_global_with_rel): Change rel_dyn to
1107 Output_data_reloc_generic*. Use add_global_generic.
1108 (Output_data_got::add_global_with_rela): Remove. Change all
1109 callers to use add_global_with_rel.
1110 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1111 Output_data_reloc_generic*. Use add_global_generic.
1112 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1113 callers to use add_global_pair_with_rel.
1114 (Output_data_got::add_local): Change object to Relobj*.
1115 (Output_data_got::add_local_plt): Likewise.
1116 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1117 change rel_dyn to Output_data_reloc_generic*. Use
1119 (Output_data_got::add_local_with_rela): Remove. Change all
1120 callers to use all_local_with_rel.
1121 (Output_data_got::add_local_pair_with_rel): Change object to
1122 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1123 add_output_section_generic.
1124 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1125 callers to use add_local_pair_with_rel.
1126 (Output_data_got::reserve_local): Change object to Relobj*.
1127 * output.h: (class Output_data_reloc_generic): Add pure virtual
1128 declarations for add_global_generic, add_local_generic,
1129 add_output_section_generic.
1130 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1131 functions for Output_data_reloc_generic. Update declarations for
1132 changes listed in output.cc.
1133 (class Output_data_got): Change template parameter to got_size.
1134 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1135 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1137 (Sized_relobj_incr::do_local_plt_offset): New function.
1138 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1141 2011-12-17 Cary Coutant <ccoutant@google.com>
1143 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1144 * resolve.cc (Symbol_table::resolve): Likewise.
1145 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1147 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1149 2011-12-16 Ian Lance Taylor <iant@google.com>
1151 * output.h (Output_data_reloc_generic::add): Only call
1152 add_dynamic_reloc if this is a dynamic reloc section.
1154 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1157 * target-reloc.h (apply_relocation): Replace <64, false> with
1160 2011-11-25 Nick Clifton <nickc@redhat.com>
1162 * po/it.po: New Italian translation.
1164 2011-11-17 Sterling Augustine <saugustine@google.com>
1166 * script.cc (script_include_directive): Implement.
1167 (read_script_file): New local variables name and search_path. Update
1168 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1169 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1170 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1172 2011-11-11 Sterling Augustine <saugustine@google.com>
1174 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1175 (file_or_sections_cmd): Likewise.
1177 2011-11-11 Doug Kwan <dougkwan@google.com>
1179 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1180 if --just-symbols is given.
1182 2011-11-10 Doug Kwan <dougkwan@google.com>
1185 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1186 when processing data relocs.
1187 * reloc.h (Relocate_functions::rel_unaligned): New method.
1188 (Relocate_functions::pcrel_unaligned): Ditto.
1189 (Relocate_functions::rel32_unaligned): Ditto.
1190 (Relocate_functions::pcrel32_unaligned): Ditto.
1192 2011-11-09 Doug Kwan <dougkwan@google.com>
1195 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1196 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1197 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1198 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1199 (Relocate_functions::rel_unaligned): New.
1200 (Relocate_functions::rel32_unaligned): New.
1201 * target-reloc.h (relocate_for_relocatable): Add code to handle
1202 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1203 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1204 arm_unaligned_reloc_r): New targets.
1205 * testsuite/Makefile.in: Regenerate.
1206 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1209 2011-11-02 Ian Lance Taylor <iant@google.com>
1211 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1213 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1214 * options.cc (General_options::finalize): Use library search path
1215 from configure script if specified. If not native and no sysroot,
1216 only search TOOLLIBDIR.
1217 * options.h (Search_directory::Search_directory): Change name to
1219 (General_options::add_to_library_path_with_sysroot): Change arg to
1221 * configure, Makefile.in, config.in: Rebuild.
1223 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1225 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1226 we are working around the ARM1176 Erratum.
1227 * options.h (General_options::fix_arm1176): Add option.
1228 * testsuite/Makefile.am: Add testcases, and keep current ones
1230 * testsuite/Makefile.in: Regenerate.
1231 * testsuite/arm_fix_1176.s: New file.
1232 * testsuite/arm_fix_1176.sh: Likewise.
1234 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1236 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1238 (Target_arm::may_use_blx): Remove method.
1239 (Target_arm::set_may_use_blx): Likewise.
1240 (Target_arm::may_use_v4t_interworking): New method.
1241 (Target_arm::may_use_v5t_interworking): Likewise.
1242 (Target_arm::may_use_blx_): Remove member variable.
1243 (Arm_relocate_functions::arm_branch_common): Check for v5T
1245 (Arm_relocate_functions::thumb_branch_common): Likewise.
1246 (Reloc_stub::stub_type_for_reloc): Likewise.
1247 (Target_arm::do_finalize_sections): Correct interworking checks.
1248 * testsuite/Makefile.am: Add new tests.
1249 * testsuite/Makefile.in: Regenerate.
1250 * testsuite/arm_farcall_arm_arm.s: New test.
1251 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1252 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1253 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1254 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1255 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1256 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1257 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1259 2011-10-31 Cary Coutant <ccoutant@google.com>
1262 * expression.cc (Expression::eval_with_dot): Add
1263 is_section_dot_assignment parameter.
1264 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1265 absolute and assigning to dot within a section.
1266 * script-sections.cc
1267 (Output_section_element_assignment::set_section_addresses): Pass
1268 dot_section to set_if_absolute.
1269 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1270 as is_section_dot_assignment flag to eval_with_dot.
1271 (Output_section_element_dot_assignment::set_section_addresses):
1273 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1274 parameter. Also set value if relative to dot_section; set the
1275 symbol's output_section.
1276 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1277 parameter. Adjust all callers.
1278 (Expression::eval_maybe_dot): Likewise.
1279 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1281 * testsuite/script_test_2.t: Test assignment of an absolute value
1282 to dot within an output section element.
1284 2011-10-31 Cary Coutant <ccoutant@google.com>
1286 * options.h (class General_options): Add --[no-]gnu-unique options.
1287 * symtab.cc (Symbol_table::sized_write_globals): Convert
1288 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1290 2011-10-31 Cary Coutant <ccoutant@google.com>
1293 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1294 unnecessary assertion.
1295 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1297 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1299 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1301 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1303 Change to just keep the section associated with symbol.
1304 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1305 they are externally visible and --export-dynamic is turned on.
1306 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1308 2011-10-19 Ian Lance Taylor <iant@google.com>
1311 * script-sections.cc
1312 (Output_section_element_dot_assignment::needs_output_section): New
1315 2011-10-19 Ian Lance Taylor <iant@google.com>
1318 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1319 --section-start option was seen.
1320 * options.h (General_options::any_section_start): New function.
1322 2011-10-18 David S. Miller <davem@davemloft.net>
1325 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1326 member to track relocation locations that have moved during TLS
1327 reloc optimizations.
1328 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1329 (Target_sparc::Relocate::relocate): Adjust view down by 4
1330 bytes if it matches reloc_adjust_addr_.
1331 (Target_sparc::Relocate::relocate_tls): Always move the
1332 __tls_get_addr call delay slot instruction forward 4 bytes when
1333 performing relaxation.
1335 2011-10-18 Cary Coutant <ccoutant@google.com>
1337 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1338 (Output_file::map_no_anonymous): Check for non-zero
1339 return code from posix_fallocate.
1341 2011-10-17 Cary Coutant <ccoutant@google.com>
1344 * plugin.cc (is_visible_from_outside): Check for symbols
1345 referenced from dynamic objects.
1346 * resolve.cc (Symbol_table::resolve): Don't count references
1347 from dynamic objects as references from real ELF files.
1348 * testsuite/plugin_test_2.sh: Adjust expected result.
1350 2011-10-17 Cary Coutant <ccoutant@google.com>
1352 * gold.cc: Include timer.h.
1353 (queue_middle_tasks): Stamp time.
1354 (queue_final_tasks): Likewise.
1355 * main.cc (main): Store timer in parameters. Print timers
1357 * parameters.cc (Parameters::Parameters): Initialize timer_.
1358 (Parameters::set_timer): New function.
1359 (set_parameters_timer): New function.
1360 * parameters.h (Parameters::set_timer): New function.
1361 (Parameters::timer): New function.
1362 (Parameters::timer_): New data member.
1363 (set_parameters_timer): New function.
1364 * timer.cc (Timer::stamp): New function.
1365 (Timer::get_pass_time): New function.
1366 * timer.h (Timer::stamp): New function.
1367 (Timer::get_pass_time): New function.
1368 (Timer::pass_times_): New data member.
1370 2011-10-17 Cary Coutant <ccoutant@google.com>
1372 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1373 task for members of lib groups.
1375 2011-10-17 Cary Coutant <ccoutant@google.com>
1378 * fileread.cc (File_read::find_view): Add assert.
1379 (File_read::make_view): Move bounds check (replace with assert)...
1380 (File_read::find_or_make_view): ... to here.
1382 2011-10-12 Cary Coutant <ccoutant@google.com>
1384 * output.cc (Output_file::open_base_file): Handle case where
1385 ::read returns less than requested size.
1387 2011-10-10 Cary Coutant <ccoutant@google.com>
1389 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1390 Initialize defined_count_.
1391 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1392 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1393 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1394 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1395 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1396 * incremental.h (Sized_relobj_incr::defined_count_): New data
1398 (Sized_incr_dynobj::defined_count_): New data member.
1399 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1400 Return zeroes instead of internal error.
1402 2011-10-10 Cary Coutant <ccoutant@google.com>
1405 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1406 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1407 * output.h (class Output_reloc): Add use_plt_offset flag.
1408 (Output_reloc::type_): Adjust size of bit field.
1409 (Output_reloc::use_plt_offset_): New bit field.
1410 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1411 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1412 flag. Adjust all callers.
1413 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1414 creating RELATIVE relocations.
1416 2011-10-10 Nick Clifton <nickc@redhat.com>
1418 * po/es.po: Updated Spanish translation.
1419 * po/fi.po: Updated Finnish translation.
1421 2011-10-03 Diego Novillo <dnovillo@google.com>
1423 * options.cc (parse_uint): Fix dereference of RETVAL.
1425 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1427 * layout.h (section_order_map_): New member.
1428 (get_section_order_map): New member function.
1429 * output.cc (Output_section::add_input_section): Check for patterns
1430 only when --section-ordering-file is specified.
1431 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1432 output_sections have been formed.
1433 * layout.cc (Layout_Layout): Initialize section_order_map_.
1434 * plugin.cc (update_section_order): Store order in order_map. Do not
1436 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1437 * testsuite/Makefile.in: Regenerate.
1438 * testsuite/plugin_section_order.c: New file.
1439 * testsuite/plugin_final_layout.cc: New file.
1440 * testsuite/plugin_final_layout.sh: New file.
1442 2011-09-29 Cary Coutant <ccoutant@google.com>
1444 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1446 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1447 symbols during incremental update.
1448 (Symbol_table::add_from_dynobj): Likewise.
1450 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1451 Ian Lance Taylor <iant@google.com>
1453 * symtab.cc (Symbol_table::define_special_symbol): Always
1454 canonicalize version string.
1456 2011-09-26 Cary Coutant <ccoutant@google.com>
1458 * gold.cc (queue_initial_tasks): Move option checks ...
1459 * options.cc (General_options::finalize): ... to here. Disable
1460 some options; make others fatal.
1462 2011-09-26 Cary Coutant <ccoutant@google.com>
1465 * plugin.cc (get_symbols_v2): New function.
1466 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1467 (is_referenced_from_outside): New function.
1468 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1469 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1470 (get_symbols): Pass version parameter.
1471 (get_symbols_v2): New function.
1472 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1474 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1475 (onload): Add LDPT_GET_SYMBOLS_V2.
1476 (all_symbols_read_hook): Use get_symbols_v2; check for
1477 LDPR_PREVAILING_DEF_IRONLY_EXP.
1478 * testsuite/plugin_test_3.sh: Update expected results.
1480 2011-09-23 Simon Baldwin <simonb@google.com>
1482 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1483 configuration options.
1484 * configure: Regenerate.
1485 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1486 * Makefile.in: Regenerate.
1487 * testsuite/Makefile.in: Regenerate.
1489 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1491 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1493 2011-09-19 Cary Coutant <ccoutant@google.com>
1495 * incremental.cc (can_incremental_update): Fix typo in comment.
1496 * incremental.h (can_incremental_update): Likewise.
1498 2011-09-18 Cary Coutant <ccoutant@google.com>
1500 * incremental.cc (can_incremental_update): New function.
1501 * incremental.h (can_incremental_update): New function.
1502 * layout.cc (Layout::init_fixed_output_section): Call it.
1503 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1504 * object.cc (Sized_relobj_file::do_layout): Call
1505 can_incremental_update.
1507 2011-09-13 Cary Coutant <ccoutant@google.com>
1509 * configure.ac: Check for glibc support for gnu_indirect_function
1510 support with static linking, setting automake conditional
1512 * Makefile.in: Regenerate.
1513 * configure: Regenerate.
1515 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1516 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1518 * testsuite/Makefile.in: Regenerate.
1520 2011-09-13 Cary Coutant <ccoutant@google.com>
1522 * incremental.cc (Sized_relobj_incr::do_layout): Call
1523 report_comdat_group for kept comdat sections.
1524 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1525 * testsuite/Makefile.in: Regenerate.
1526 * testsuite/incr_comdat_test_1.cc: New source file.
1527 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1528 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1529 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1531 2011-09-13 Ian Lance Taylor <iant@google.com>
1533 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1534 variable external_symbols_offset.
1536 2011-09-12 Ian Lance Taylor <iant@google.com>
1538 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1539 triggered if object has no symbols.
1541 2011-09-09 David S. Miller <davem@davemloft.net>
1543 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1544 (Output_fill_debug_line::do_write): Likewise.
1546 2011-08-29 Cary Coutant <ccoutant@google.com>
1548 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1549 casts to match formatting specs.
1550 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1552 2011-08-26 Cary Coutant <ccoutant@google.com>
1554 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1555 remaining hole size when allocating.
1556 (Layout::make_output_section): Set fill methods for debug sections.
1557 * layout.h (Free_list::Free_list_node): Move from private to
1559 (Free_list::set_min_hole_size): New function.
1560 (Free_list::begin, Free_list::end): New functions.
1561 (Free_list::min_hole_): New data member.
1562 * output.cc: Include dwarf.h.
1563 (Output_fill_debug_info::do_minimum_hole_size): New function.
1564 (Output_fill_debug_info::do_write): New function.
1565 (Output_fill_debug_line::do_minimum_hole_size): New function.
1566 (Output_fill_debug_line::do_write): New function.
1567 (Output_section::Output_section): Initialize new data member.
1568 (Output_section::set_final_data_size): Ensure patch space is larger
1569 than minimum hole size.
1570 (Output_section::do_write): Fill holes in debug sections.
1571 * output.h (Output_fill): New class.
1572 (Output_fill_debug_info): New class.
1573 (Output_fill_debug_line): New class.
1574 (Output_section::set_free_space_fill): New function.
1575 (Output_section::free_space_fill_): New data member.
1576 * testsuite/Makefile.am (incremental_test_3): Add
1577 --incremental-patch option.
1578 (incremental_test_4): Likewise.
1579 (incremental_test_5): Likewise.
1580 (incremental_test_6): Likewise.
1581 (incremental_copy_test): Likewise.
1582 (incremental_common_test_1): Likewise.
1583 * testsuite/Makefile.in: Regenerate.
1585 2011-08-26 Nick Clifton <nickc@redhat.com>
1587 * po/es.po: Updated Spanish translation.
1589 2011-08-01 Cary Coutant <ccoutant@google.com>
1591 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1592 * gold/testsuite/Makefile.in: Regenerate.
1593 * gold/testsuite/justsyms_exec.c: New source file.
1594 * gold/testsuite/justsyms_lib.c: New source file.
1596 2011-08-01 Cary Coutant <ccoutant@google.com>
1598 * layout.cc (Layout::set_segment_offsets): Don't realign text
1599 segment if -Ttext was specified.
1600 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1602 * object.h (Sized_relobj_file::e_type): New function.
1603 (Sized_relobj_file::e_type_): New data member.
1604 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1605 base address for ET_EXEC files.
1606 * target.cc (Target::do_make_elf_object_implementation): Allow
1607 ET_EXEC files with --just-symbols option.
1609 2011-07-28 Cary Coutant <ccoutant@google.com>
1611 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1612 Add thread_number parameter.
1613 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1614 * workqueue-threads.cc
1615 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1616 current thread if its thread number is greater than desired thread
1618 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1619 Add thread_number parameter.
1620 (Workqueue::should_cancel_thread): Likewise.
1621 (Workqueue::find_runnable_or_wait): Pass thread_number to
1622 should_cancel_thread.
1623 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1626 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1628 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1629 only after checking if it cannot be forced local.
1630 * symtab.h (is_externally_visible): Check if the symbol is not forced
1633 2011-07-15 Ian Lance Taylor <iant@google.com>
1635 * options.h (class General_options): Add --print-output-format.
1636 Move -EL next to -EB, for better --help output.
1637 * target-select.cc: Include <cstdio>, "options.h", and
1639 (Target_selector::do_target_bfd_name): New function.
1640 (print_output_format): New function.
1641 * target-select.h (class Target_selector): Update declarations.
1642 (Target_selector::target_bfd_name): New function.
1643 (print_output_format): Declare.
1644 * main.cc: Include "target-select.h".
1645 (main): Handle --print-output-format.
1646 * gold.cc: Include "target-select.h".
1647 (queue_initial_tasks): Handle --print-output-format when there are
1649 * parameters.cc (parameters_force_valid_target): Give a better
1650 error message if -EB/-EL does not match target.
1651 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1654 2011-07-15 Ian Lance Taylor <iant@google.com>
1656 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1657 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1658 (Output_data_plt_i386::do_write): Write address of .dynamic
1659 section to first entry in .got.plt section.
1660 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1661 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1663 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1664 section to first entry in .got.plt section.
1665 * layout.h (Layout::dynamic_section): New function.
1667 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1669 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1671 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1672 input_section_position_, and input_section_glob_.
1673 (read_layout_from_file): Call function section_ordering_specified.
1674 * layout.h (is_section_ordering_specified): New function.
1675 (section_ordering_specified): New function.
1676 (section_ordering_specified_): New boolean member.
1677 * main.cc(main): Call load_plugins after layout object is defined.
1678 * output.cc (Output_section::add_input_section): Use
1679 function section_ordering_specified to check if section ordering is
1681 * output.cc (Output_section::add_relaxed_input_section): Use
1682 function section_ordering_specified to check if section ordering is
1684 (Output_section::update_section_layout): New function.
1685 (Output_section::sort_attached_input_sections): Check if input section
1687 * output.h (Output_section::update_section_layout): New function.
1688 * plugin.cc (get_section_count): New function.
1689 (get_section_type): New function.
1690 (get_section_name): New function.
1691 (get_section_contents): New function.
1692 (update_section_order): New function.
1693 (allow_section_ordering): New function.
1694 (Plugin::load): Add the new interfaces to the transfer vector.
1695 (Plugin_manager::load_plugins): New parameter.
1696 (Plugin_manager::all_symbols_read): New parameter.
1697 (Plugin_manager::claim_file): New parameter. Save the elf object for
1699 (Plugin_manager::get_elf_object): New function.
1700 (Plugin_manager::get_view): Change to directly use the bool to check
1701 if get_view is called from claim_file_hook.
1702 * plugin.h (input_objects): New function
1703 (Plugin__manager::load_plugins): New parameter.
1704 (Plugin_manager::claim_file): New parameter.
1705 (Plugin_manager::get_elf_object): New function.
1706 (Plugin_manager::in_claim_file_handler): New function.
1707 (Plugin_manager::in_claim_file_handler_): New member.
1708 (layout): New function.
1709 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1710 handler with an extra parameter. Make the elf object before calling
1712 * testsuite/plugin_test.c (get_section_count): New function pointer.
1713 (get_section_type): New function pointer.
1714 (get_section_name): New function pointer.
1715 (get_section_contents): New function pointer.
1716 (update_section_order): New function pointer.
1717 (allow_section_ordering): New function pointer.
1718 (onload): Check if the new interfaces exist.
1720 2011-07-13 Ian Lance Taylor <iant@google.com>
1722 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1724 * x86_64.cc (Target_x86_64::got_section): Likewise.
1725 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1726 (relro_now_test_SOURCES): New variable.
1727 (relro_now_test_DEPENDENCIES): New variable.
1728 (relro_now_test_LDFLAGS): New variable.
1729 (relro_now_test_LDADD): New variable.
1730 (relro_now_test.so): New target.
1731 * testsuite/Makefile.in: Rebuild.
1733 2011-07-12 Ian Lance Taylor <iant@google.com>
1736 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1737 GLOB_DAT relocation rather than a RELATIVE relocation for a
1738 protected symbol when creating a shared library.
1739 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1740 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1741 * testsuite/protected_main_1.cc (main): Test that protected
1742 function has same address.
1744 2011-07-11 Ian Lance Taylor <iant@google.com>
1747 * options.h (class General_options): Add -Bgroup.
1748 * options.cc (General_options::finalize): If -Bgroup is set,
1749 default to --unresolved-symbols=report-all.
1750 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1751 * target-reloc.h (issue_undefined_symbol_error): Handle
1752 --unresolved-symbols=report-all.
1754 2011-07-08 Ian Lance Taylor <iant@google.com>
1757 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1758 if linker script discards key sections.
1759 (Layout::create_dynamic_symtab): Likewise.
1760 (Layout::assign_local_dynsym_offsets): Likewise.
1761 (Layout::sized_create_version_sections): Likewise.
1762 (Layout::create_interp): Likewise.
1763 (Layout::finish_dynamic_section): Likewise.
1764 (Layout::set_dynamic_symbol_size): Likewise.
1766 2011-07-08 Ian Lance Taylor <iant@google.com>
1769 * options.h (class General_options): Add --unresolved-symbols.
1770 * target-reloc.h (issue_undefined_symbol_error): Check
1771 --unresolved-symbols. Add comments.
1773 2011-07-08 Ian Lance Taylor <iant@google.com>
1775 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1776 expression more complex.
1778 2011-07-08 Ian Lance Taylor <iant@google.com>
1781 * target-reloc.h (issue_undefined_symbol_error): New inline
1782 function, broken out of relocate_section.
1783 (relocate_section): Call issue_undefined_symbol_error.
1784 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1785 there is no TLS segment if we are about to issue an undefined
1787 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1789 2011-07-08 Ian Lance Taylor <iant@google.com>
1792 * resolve.cc (Symbol_table::should_override): Add fromtype
1793 parameter. Change all callers. Give error when linking together
1794 TLS and non-TLS symbol.
1795 (Symbol_table::should_override_with_special): Add fromtype
1796 parameter. Change all callers.
1797 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1798 there is no TLS segment if we have reported some errors.
1799 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1801 2011-07-08 Ian Lance Taylor <iant@google.com>
1804 * target.h (Target::plt_address_for_global): New function.
1805 (Target::plt_address_for_local): New function.
1806 (Target::plt_section_for_global): Remove.
1807 (Target::plt_section_for_local): Remove.
1808 (Target::do_plt_address_for_global): New virtual function.
1809 (Target::do_plt_address_for_local): New virtual function.
1810 (Target::do_plt_section_for_global): Remove.
1811 (Target::do_plt_section_for_local): Remove.
1812 (Target::register_global_plt_entry): Add Symbol_table and Layout
1814 * output.cc (Output_data_got::Got_entry::write): Use
1815 plt_address_for_global and plt_address_for_local.
1816 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1817 address of output section.
1818 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1819 got_irelative_, and irelative_count_ fields. Update
1821 (Output_data_plt_i386::has_irelative_section): New function.
1822 (Output_data_plt_i386::entry_count): Add irelative_count_.
1823 (Output_data_plt_i386::set_final_data_size): Likewise.
1824 (class Target_i386): Add got_irelative_ and rel_irelative_
1825 fields. Update declarations.
1826 (Target_i386::Target_i386): Initialize new fields.
1827 (Target_i386::do_plt_address_for_global): New function replacing
1828 do_plt_section_for_global.
1829 (Target_i386::do_plt_address_for_local): New function replacing
1830 do_plt_section_for_local.
1831 (Target_i386::got_section): Create got_irelative_.
1832 (Target_i386::rel_irelative_section): New function.
1833 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1834 fields. Don't define __rel_iplt_{start,end}.
1835 (Output_data_plt_i386::add_entry): Add symtab and layout
1836 parameters. Change all callers. Use different PLT and GOT for
1838 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1839 layout parameters. Change all callers. Use different PLT and
1841 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1842 (Output_data_plt_i386::rel_irelative): New function.
1843 (Output_data_plt_i386::address_for_global): New function.
1844 (Output_data_plt_i386::address_for_local): New function.
1845 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1846 IRELATIVE GOT when changing IFUNC GOT entries.
1847 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1849 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1850 if we didn't create an IRELATIVE GOT.
1851 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1852 plt_address_for_local.
1853 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1854 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1855 got_irelative_, and irelative_count_ fields. Update
1857 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1858 Initialize new fields. Remove symtab parameter. Change all
1860 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1862 (Output_data_plt_x86_64::has_irelative_section): New function.
1863 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1864 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1865 fields. Update declarations.
1866 (Target_x86_64::Target_x86_64): Initialize new fields.
1867 (Target_x86_64::do_plt_address_for_global): New function replacing
1868 do_plt_section_for_global.
1869 (Target_x86_64::do_plt_address_for_local): New function replacing
1870 do_plt_section_for_local.
1871 (Target_x86_64::got_section): Create got_irelative_.
1872 (Target_x86_64::rela_irelative_section): New function.
1873 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1874 all callers. Don't create __rel_iplt_{start,end}.
1875 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1876 parameters. Change all callers. Use different PLT and GOT for
1878 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1879 layout parameters. Change all callers. Use different PLT and
1881 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1882 parameters. Change all callers. Use different PLT and GOT for
1884 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1885 (Output_data_plt_x86_64::rela_irelative): New function.
1886 (Output_data_plt_x86_64::address_for_global): New function.
1887 (Output_data_plt_x86_64::address_for_local): New function.
1888 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1889 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1890 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1891 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1893 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1895 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1896 symbols if we didn't create an IRELATIVE GOT.
1897 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1898 plt_address_for_local.
1899 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1900 * testsuite/ifuncvar1.c: New test file.
1901 * testsuite/ifuncvar2.c: New test file.
1902 * testsuite/ifuncvar3.c: New test file.
1903 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1904 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1905 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1906 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1907 * testsuite/Makefile.in: Rebuild.
1909 2011-07-07 Cary Coutant <ccoutant@google.com>
1911 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1912 (two_file_test_1_ndebug.o): Likewise.
1913 (two_file_test_1b_ndebug.o): Likewise.
1914 (two_file_test_2_ndebug.o): Likewise.
1915 (two_file_test_main_ndebug.o): Likewise.
1916 (incremental_test_2): Link with no-debug versions.
1918 2011-07-06 Cary Coutant <ccoutant@google.com>
1920 * gold/incremental.cc
1921 (Output_section_incremental_inputs::write_info_blocks): Check for
1922 hidden and internal symbols.
1924 2011-07-06 Cary Coutant <ccoutant@google.com>
1926 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1927 Check disposition for startup file.
1928 (Incremental_inputs::report_command_line): Ignore
1929 --incremental-startup-unchanged option.
1930 * options.cc (General_options::parse_incremental_startup_unchanged):
1932 (General_options::General_options): Initialize new data member.
1933 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1934 (General_options): Add --incremental-startup-unchanged option.
1935 (General_options::incremental_startup_disposition): New function.
1936 (General_options::incremental_startup_disposition_): New data member.
1938 2011-07-06 Cary Coutant <ccoutant@google.com>
1940 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1941 input file index to Script_info ctor.
1942 (Sized_incremental_binary::do_file_has_changed): Find the
1943 command-line argument for files named in scripts.
1944 * incremental.h (Script_info::Script_info): New ctor
1945 with input file index.
1946 (Script_info::input_file_index): New function.
1947 (Script_info::input_file_index_): New data member.
1948 (Incremental_binary::get_library): Add const.
1949 (Incremental_binary::get_script_info): Add const.
1950 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1951 * testsuite/Makefile.am (incremental_test_5): New test case.
1952 (incremental_test_6): New test case.
1953 * testsuite/Makefile.in: Regenerate.
1955 2011-07-06 Cary Coutant <ccoutant@google.com>
1957 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1958 debug output when command lines differ.
1960 2011-07-06 Cary Coutant <ccoutant@google.com>
1962 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1963 --incremental-patch option.
1964 * layout.cc (Free_list::allocate): Extend allocation beyond original
1966 (Layout::make_output_section): Mark sections that should get
1968 * options.cc (parse_percent): New function.
1969 * options.h (parse_percent): New function.
1970 (DEFINE_percent): New macro.
1971 (General_options): Add --incremental-patch option.
1972 * output.cc (Output_section::Output_section): Initialize new data
1974 (Output_section::add_input_section): Print section name when out
1976 (Output_section::add_output_section_data): Likewise.
1977 (Output_section::set_final_data_size): Add patch space when
1978 doing --incremental-full.
1979 (Output_section::do_reset_address_and_file_offset): Remove patch
1981 (Output_segment::set_section_list_addresses): Print debug output
1982 only if --incremental-update.
1983 * output.h (Output_section::set_is_patch_space_allowed): New function.
1984 (Output_section::is_patch_space_allowed_): New data member.
1985 (Output_section::patch_space_): New data member.
1986 * parameters.cc (Parameters::incremental_full): New function.
1987 * parameters.h (Parameters::incremental_full): New function
1988 * testsuite/Makefile.am (incremental_test_2): Add test for
1989 --incremental-patch option.
1990 * testsuite/Makefile.in: Regenerate.
1991 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1992 (t18): Remove function body.
1994 2011-07-05 Doug Kwan <dougkwan@google.com>
1997 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1998 Arm_Address type for relocation result.
1999 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2001 (Arm_relocate_functions::abs32): Use unaligned access.
2002 (Arm_relocate_functions::rel32): Ditto.
2003 (Arm_relocate_functions::prel31): Ditto.
2004 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2005 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2006 static data relocations.
2007 * testsuite/Makefile.in: Regnerate.
2008 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2010 2011-07-05 Ian Lance Taylor <iant@google.com>
2013 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2014 symbols if necessary.
2015 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2017 2011-07-05 Ian Lance Taylor <iant@google.com>
2020 * resolve.cc (Symbol::override_base_with_special): Simply override
2021 version with special symbol version, ignoring previous version.
2023 2011-07-05 Ian Lance Taylor <iant@google.com>
2025 * object.cc (Sized_relobj_file::include_section_group): Add
2026 information to comment about signature location.
2028 2011-07-02 Ian Lance Taylor <iant@google.com>
2031 * options.h (class General_options): Add -f and -F.
2032 * options.cc (General_options::finalize): Fatal error if -f/-F
2033 are used without -shared.
2034 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2036 2011-07-02 Ian Lance Taylor <iant@google.com>
2038 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2040 2011-07-01 Ian Lance Taylor <iant@google.com>
2044 * resolve.cc (Symbol::override_base_with_special): Don't override
2045 the version if the overriding symbol has a different name.
2046 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2047 all callers. If we give an error about an undefined version,
2048 define the base version if necessary.
2049 * dynobj.h (class Versions): Update declaration.
2050 * testsuite/weak_alias_test_5.cc: New file.
2051 * testsuite/weak_alias_test.script: New file.
2052 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2053 and versioned_alias have the right value, and call t2.
2054 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2055 weak_alias_test_5.so.
2056 (weak_alias_test_LDADD): Likewise.
2057 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2058 * testsuite/Makefile.in: Rebuild.
2060 2011-07-01 Ian Lance Taylor <iant@google.com>
2063 * options.h (class General_options): Support -z notext.
2064 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2066 (two_file_shared_nonpic.so): Likewise.
2067 (two_file_shared_mixed.so): Likewise.
2068 (two_file_shared_mixed_1.so): Likewise.
2069 (weak_undef_lib_nonpic.so): Likewise.
2070 (alt/weak_undef_lib_nonpic.so): Likewise.
2071 (tls_test_shared_nonpic.so): Likewise.
2072 * testsuite/Makefile.in: Rebuild.
2074 2011-07-01 Ian Lance Taylor <iant@google.com>
2077 * configure.ac: Test whether static linking works, setting
2078 the automake conditional HAVE_STATIC.
2079 * testsuite/Makefile.am: Disable tests using -static if
2080 HAVE_STATIC is not true.
2081 * configure, testsuite/Makefile.in: Rebuild.
2083 2011-07-01 Ian Lance Taylor <iant@google.com>
2086 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2087 Assert if we see DW_EH_PE_indirect.
2088 * target.h (Target::ehframe_datarel_base): New function.
2089 (Target::do_ehframe_datarel_base): New target function.
2090 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2091 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2094 2011-07-01 Ian Lance Taylor <iant@google.com>
2097 * options.h (class General_options): Add
2098 --ld-generated-unwind-info.
2099 * ehframe.cc (Fde::write): Add address parameter. Change all
2100 callers. If associated with PLT, fill in address and size.
2101 (Cie::set_output_offset): Only add merge mapping if there is an
2103 (Cie::write): Add address parameter. Change all callers.
2104 (Eh_frame::add_ehframe_for_plt): New function.
2105 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2106 input_offset_ fields into union u_, with new plt field.
2107 (Fde::Fde): Adjust for new union field.
2108 (Fde::Fde) [Output_data version]: New constructor.
2109 (Fde::add_mapping): Only add merge mapping if there is an object.
2110 (class Cie): Update declarations.
2111 (class Eh_frame): Declare add_ehframe_for_plt.
2112 * layout.cc (Layout::layout_eh_frame): Break out code into
2113 make_eh_frame_section, and call it.
2114 (Layout::make_eh_frame_section): New function.
2115 (Layout::add_eh_frame_for_plt): New function.
2116 * layout.h (class Layout): Update declarations.
2117 * merge.cc (Merge_map::add_mapping): Add assertion.
2118 * i386.cc: Include "dwarf.h".
2119 (class Output_data_plt_i386): Make first_plt_entry,
2120 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2121 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2122 and plt_eh_frame_fde.
2123 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2124 boundary. Call add_eh_frame_for_plt if appropriate.
2125 * x86_64.cc: Include "dwarf.h".
2126 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2127 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2128 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2129 and plt_eh_frame_fde.
2130 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2133 2011-06-29 Ian Lance Taylor <iant@google.com>
2136 * object.cc (Sized_relobj_file::layout_section): Change shdr
2137 parameter to be const.
2138 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2140 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2141 appropriate. Call layout_eh_frame_section.
2142 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2144 * object.h (class Sized_relobj_file): Update declarations.
2146 2011-06-29 Ian Lance Taylor <iant@google.com>
2149 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2151 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2153 2011-06-29 Ian Lance Taylor <iant@google.com>
2156 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2158 * layout.cc (Layout::layout_eh_frame): Likewise.
2160 2011-06-29 Ian Lance Taylor <iant@google.com>
2163 * layout.cc (Layout::symtab_section_shndx): New function.
2164 * layout.h (class Layout): Declare symtab_section_shndx.
2165 * output.cc (Output_section::write_header): Call it.
2167 2011-06-29 Ian Lance Taylor <iant@google.com>
2170 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2171 symbols which are not used in a relocation.
2173 2011-06-28 Ian Lance Taylor <iant@google.com>
2176 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2177 script create indistinguishable segments.
2178 (Layout::set_segment_offsets): Use stable_sort when sorting
2179 segments. Pass this to Compare_segments constructor.
2180 * layout.h (class Layout): Make segment_precedes non-static.
2181 (class Compare_segments): Change from struct to class. Add
2182 layout_ field. Add constructor.
2183 * script-sections.cc
2184 (Script_sections::attach_sections_using_phdrs_clause): Rename
2185 local orphan to is_orphan. Don't report failure to put empty
2186 section in segment. On attachment failure, report name of
2187 section, and attach to first PT_LOAD segment.
2189 2011-06-28 Ian Lance Taylor <iant@google.com>
2192 * target-select.cc (Target_selector::Target_selector): Add
2193 emulation parameter. Change all callers.
2194 (select_target_by_bfd_name): Rename from select_target_by_name.
2196 (select_target_by_emulation): New function.
2197 (supported_emulation_names): New function.
2198 * target-select.h (class Target_selector): Add emulation_ field.
2199 Update declarations.
2200 (Target_selector::recognize_by_bfd_name): Rename from
2201 recognize_by_name. Change all callers.
2202 (Target_selector::supported_bfd_names): Rename from
2203 supported_names. Change all callers.
2204 (Target_selector::recognize_by_emulation): New function.
2205 (Target_selector::supported_emulations): New function.
2206 (Target_selector::emulation): New function.
2207 (Target_selector::do_recognize_by_bfd_name): Rename from
2208 do_recognize_by_name. Change all callers.
2209 (Target_selector::do_supported_bfd_names): Rename from
2210 do_supported_names. Change all callers.
2211 (Target_selector::do_recognize_by_emulation): New function.
2212 (Target_selector::do_supported_emulations): New function.
2213 (select_target_by_bfd_name): Change name in declaration.
2214 (select_target_by_emulation): Declare.
2215 (supported_emulation_names): Declare.
2216 * parameters.cc (parameters_force_valid_target): Try to find
2217 target based on emulation from -m option.
2218 * options.h (class General_options): Change doc string for -m.
2219 * options.cc (help): Print emulations.
2220 (General_options::parse_V): Likewise.
2221 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2222 Add emulation parameter. Change all callers.
2224 2011-06-28 Ian Lance Taylor <iant@google.com>
2226 * target.h (class Target): Add osabi_ field.
2227 (Target::osabi): New function.
2228 (Target::set_osabi): New function.
2229 (Target::Target): Initialize osabi_.
2230 (Target::do_adjust_elf_header): Make pure virtual.
2231 (Sized_target::do_adjust_elf_header): Declare.
2232 * target.cc (Sized_target::do_adjust_elf_header): New function.
2233 (class Sized_target): Instantiate all versions.
2234 * freebsd.h (class Target_freebsd): Remove.
2235 (Target_selector_freebsd::do_recognize): Call set_osabi on
2237 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2238 (Target_selector_freebsd::set_osabi): Remove.
2239 * i386.cc (class Target_i386): Inherit from Sized_target rather
2240 than Target_freebsd.
2241 * x86_64.cc (class Target_x86_64): Likewise.
2243 2011-06-28 Ian Lance Taylor <iant@google.com>
2245 * target.h (Target::can_check_for_function_pointers): Rewrite.
2247 (Target::can_icf_inline_merge_sections): Likewise.
2248 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2249 (Target::Target_info): Add can_icf_inline_merge_sections field.
2250 (Target::do_can_check_for_function_pointers): New virtual
2252 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2253 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2254 from can_check_for_function_pointers, move in file.
2255 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2256 section_may_have_icf_unsafe_poineters, move in file.
2257 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2258 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2259 Rename from can_check_for_function_pointers, move in file.
2260 (Target_i386::can_icf_inline_merge_sections): Remove.
2261 (Target_i386::i386_info): Initialize
2262 can_icf_inline_merge_sections.
2263 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2264 Initialize can_icf_inline_merge_sections.
2265 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2266 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2267 Rename from can_check_for_function_pointers, move in file.
2268 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2269 (Target_x86_64::x86_64_info): Initialize
2270 can_icf_inline_merge_sections.
2271 * testsuite/testfile.cc (Target_test::test_target_info):
2273 * icf.cc (get_section_contents): Correct formatting.
2275 2011-06-27 Ian Lance Taylor <iant@google.com>
2277 * symtab.cc (Symbol::versioned_name): New function.
2278 (Symbol_table::add_to_final_symtab): Use versioned_name when
2280 (Symbol_table::sized_write_symbol): Likewise.
2281 * symtab.h (class Symbol): Declare versioned_name.
2282 * stringpool.h (class Stringpool_template): Add variant of add
2283 which takes a std::basic_string.
2284 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2285 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2286 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2287 (ver_test_12.o): New target.
2288 * testsuite/Makefile.in: Rebuild.
2290 2011-06-27 Doug Kwan <dougkwan@google.com>
2292 * arm.cc (Arm_relocate_functions::thm_jump8,
2293 Arm_relocate_functions::thm_jump11): Use a wider signed
2294 type to compute offset.
2295 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2297 * testsuite/Makefile.in: Regenerate.
2298 * testsuite/arm_branch_in_range.sh: Check test results of
2299 arm_thm_jump11 and arm_thm_jump8.
2300 * testsuite/arm_thm_jump11.s: New test source file.
2301 * testsuite/arm_thm_jump11.t: New linker script.
2302 * testsuite/arm_thm_jump8.s: New test source file.
2303 * testsuite/arm_thm_jump8.t: New linker script.
2305 2011-06-24 Ian Lance Taylor <iant@google.com>
2307 * layout.cc: Include "object.h".
2308 (ctors_sections_in_init_array): New static variable.
2309 (Layout::is_ctors_in_init_array): New function.
2310 (Layout::layout): Add entry to ctors_sections_in_init_array if
2312 * layout.h (class Layout): Declare is_ctors_in_init_array.
2313 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2314 is_ctors_reverse_view is set.
2315 (Sized_relobj_file::write_sections): Add layout parameter. Change
2316 all callers. Set is_ctors_reverse_view field of View_size.
2317 (Sized_relobj_file::reverse_words): New function.
2318 * object.h (Sized_relobj_file::View_size): Add
2319 is_ctors_reverse_view field.
2320 (class Sized_relobj_file): Update declarations.
2321 * testsuite/initpri3.c: New test.
2322 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2324 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2325 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2326 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2327 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2328 * testsuite/Makefile.in: Rebuild.
2330 2011-06-24 Cary Coutant <ccoutant@google.com>
2332 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2333 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2334 (debug_msg_cdebug.err): New targets.
2335 * testsuite/Makefile.in: Regenerate.
2336 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2337 Fix checks for link with shared library.
2339 2011-06-24 Doug Kwan <dougkwan@google.com>
2341 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2342 skip empty text sections.
2343 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2345 2011-06-22 Ian Lance Taylor <iant@google.com>
2348 * options.h (class General_options): Add --ctors-in-init-array.
2349 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2350 friends as SHT_PROGBITS for merging sections.
2351 (Layout::layout): Remove special handling of .init_array and
2352 friends. Don't sort if doing relocatable link. Sort for .ctors
2353 and .dtors if ctors_in_init_array.
2354 (Layout::make_output_section): Force correct section types for
2355 .init_array and friends. Don't sort if doing relocatable link,
2356 Don't sort .ctors and .dtors if ctors_in_init_array.
2357 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2358 (Layout::output_section_name): Add relobj parameter. Change all
2359 callers. Handle .ctors. and .dtors. in code rather than table.
2360 Handle .ctors and .dtors if ctors_in_init_array.
2361 (Layout::match_file_name): New function, moved from output.cc.
2362 * layout.h (class Layout): Update declarations.
2363 * output.cc: Include "layout.h".
2364 (Input_section_sort_entry::get_priority): New function.
2365 (Input_section_sort_entry::match_file_name): Just call
2366 Layout::match_file_name.
2367 (Output_section::Input_section_sort_init_fini_compare::operator()):
2368 Handle .ctors and .dtors. Sort by explicit priority rather than
2370 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2371 * testsuite/initpri2.c: New test.
2372 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2373 (check_PROGRAMS): Add initpri2.
2374 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2375 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2376 * configure, testsuite/Makefile.in: Rebuild.
2378 2011-06-19 Ian Lance Taylor <iant@google.com>
2381 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2382 .interp section to a PT_INTERP segment even if we have seen a
2383 --dynamic-linker option. Don't do it if we have seen a PHDRS
2384 clause in a linker script.
2385 (Layout::finalize): Don't create a .interp section if we've
2386 already create a PT_INTERP segment.
2387 (Layout::create_interp): Always call choose_output_section (revert
2388 patch of 2011-06-17). Don't create PT_INTERP segment.
2389 * script-sections.cc
2390 (Script_sections::create_note_and_tls_segments): Add a .interp
2391 section to a PT_INTERP segment even if we have seen a
2392 --dynamic-linker option.
2394 2011-06-18 Ian Lance Taylor <iant@google.com>
2396 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2397 merely because a non-PT_LOAD segment has a dynamic reloc.
2399 2011-06-18 Ian Lance Taylor <iant@google.com>
2401 * layout.cc (Layout::finish_dynamic_section): Don't create
2402 DT_FLAGS entry if not needed.
2404 2011-06-18 Ian Lance Taylor <iant@google.com>
2407 * layout.cc (Layout::layout_eh_frame): Correct handling of
2408 writable .eh_frame section.
2410 2011-06-17 Ian Lance Taylor <iant@google.com>
2413 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2414 symbol is redefined with the exact same object and value.
2416 2011-06-17 Ian Lance Taylor <iant@google.com>
2419 * layout.h (class Layout): Add interp_segment_ field.
2420 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2421 (Layout::attach_allocated_section_to_segment): If making shared
2422 library, put .interp section in PT_INTERP segment.
2423 (Layout::finalize): Also call create_interp if -dynamic-linker
2425 (Layout::create_interp): Assert that there is no PT_INTERP
2426 segment. If not using a SECTIONS clause, use make_output_section.
2427 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2428 * script-sections.cc
2429 (Script_sections::create_note_and_tls_segments): If making shared
2430 library, put .interp section in PT_INTERP segment.
2432 2011-06-17 Ian Lance Taylor <iant@google.com>
2434 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2435 when making a shared library.
2437 2011-06-17 Ian Lance Taylor <iant@google.com>
2439 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2440 parameter. Change all callers. Don't issue warning about PC32
2441 against locally defined symbol.
2443 2011-06-16 Ian Lance Taylor <iant@google.com>
2445 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2446 occurs in same object.
2448 2011-06-14 Alan Modra <amodra@gmail.com>
2450 * po/POTFILES.in: Regenerate.
2452 2011-06-09 Ian Lance Taylor <iant@google.com>
2454 * script-sections.cc
2455 (Orphan_output_section::set_section_addresses): For a relocatable
2456 link set address to 0.
2458 2011-06-09 Cary Coutant <ccoutant@google.com>
2461 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2462 used with --compress-debug-sections.
2463 * gold/object.cc (Sized_relobj_file::do_layout): Report
2464 uncompressed size of compressed input sections.
2466 2011-06-08 Cary Coutant <ccoutant@google.com>
2469 * testsuite/two_file_test_2_v1.cc: Change initialization of
2470 v2 to keep it in .data.
2472 2011-06-07 Cary Coutant <ccoutant@google.com>
2474 * common.cc (Symbol_table::do_allocate_commons_list): Call
2476 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2477 (Errors::fallback): New function.
2478 (gold_fallback): New function.
2479 * errors.h (Errors::fallback): New function.
2480 * gold.cc (gold_exit): Change status parameter to enum; adjust
2482 (queue_initial_tasks): Call gold_fallback.
2483 * gold.h: Include cstdlib.
2484 (Exit_status): New enum type.
2485 (gold_exit): Change status parameter to enum.
2486 (gold_fallback): New function.
2487 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2488 (Layout::create_symtab_sections): Likewise.
2489 (Layout::create_shdrs): Likewise.
2490 * main.cc (main): Adjust call to gold_exit.
2491 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2492 (Output_data_got::add_got_entry_pair): Likewise.
2493 (Output_section::add_input_section): Likewise.
2494 (Output_section::add_output_section_data): Likewise.
2495 (Output_segment::set_section_list_addresses): Likewise.
2496 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2498 2011-06-07 Cary Coutant <ccoutant@google.com>
2500 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2501 for incremental links.
2502 * output.cc (Output_segment::set_section_list_addresses): Remove
2503 FIXME and test for TLS or BSS.
2505 2011-06-07 Cary Coutant <ccoutant@google.com>
2507 * testsuite/Makefile.am: Add incremental_copy_test,
2508 incremental_common_test_1.
2509 * testsuite/Makefile.in: Regenerate.
2510 * testsuite/common_test_1_v1.c: New source file.
2511 * testsuite/common_test_1_v2.c: New source file.
2512 * testsuite/copy_test_v1.cc: New source file.
2514 2011-06-07 Cary Coutant <ccoutant@google.com>
2516 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2517 update, allocate common from bss section's free list.
2518 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2519 linker-defined symbols.
2520 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2521 Skip GOT and PLT entries that are no longer referenced.
2522 (Output_section_incremental_inputs::write_info_blocks): Mark
2523 linker-defined symbols.
2524 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2525 * output.cc (Output_section::allocate): New function.
2526 * output.h (Output_section::allocate): New function.
2527 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2528 linker-defined symbols.
2529 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2530 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2531 (Symbol::init_base_output_data): Likewise.
2532 (Symbol::init_base_output_segment): Likewise.
2533 (Symbol::init_base_constant): Likewise.
2534 (Sized_symbol::init_output_data): Likewise.
2535 (Sized_symbol::init_output_segment): Likewise.
2536 (Sized_symbol::init_constant): Likewise.
2537 (Symbol_table::do_define_in_output_data): Likewise.
2538 (Symbol_table::do_define_in_output_segment): Likewise.
2539 (Symbol_table::do_define_as_constant): Likewise.
2540 * symtab.h (Symbol::is_predefined): New function.
2541 (Symbol::init_base_output_data): Add is_predefined parameter.
2542 (Symbol::init_base_output_segment): Likewise.
2543 (Symbol::init_base_constant): Likewise.
2544 (Symbol::is_predefined_): New data member.
2545 (Sized_symbol::init_output_data): Add is_predefined parameter.
2546 (Sized_symbol::init_output_segment): Likewise.
2547 (Sized_symbol::init_constant): Likewise.
2548 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2550 2011-06-07 Cary Coutant <ccoutant@google.com>
2552 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2553 instead of emit_copy_reloc.
2554 (Copy_relocs::emit_copy_reloc): Refactor.
2555 (Copy_relocs::make_copy_reloc): New function.
2556 (Copy_relocs::add_copy_reloc): Remove.
2557 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2559 (Copy_relocs::make_copy_reloc): New function.
2560 (Copy_relocs::add_copy_reloc): Remove.
2561 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2562 unchanged input files.
2563 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2564 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2565 Reserve BSS space for COPY relocations.
2566 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2567 (Output_section_incremental_inputs::write_info_blocks): Record
2568 whether a symbol is copied from a shared object.
2569 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2570 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2571 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2572 (Incremental_input_entry_reader::get_output_symbol_index): Add
2574 (Incremental_binary::emit_copy_relocs): New function.
2575 (Incremental_binary::do_emit_copy_relocs): New function.
2576 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2578 (Sized_incremental_binary::add_copy_reloc): New function.
2579 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2580 (Sized_incremental_binary::Copy_reloc): New struct.
2581 (Sized_incremental_binary::Copy_relocs): New typedef.
2582 (Sized_incremental_binary::copy_relocs_): New data member.
2583 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2584 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2585 * target.h (Sized_target::emit_copy_reloc): New function.
2586 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2588 2011-06-02 Cary Coutant <ccoutant@google.com>
2591 * gold/archive.cc (Archive::Archive): Initialize new data member.
2592 (Archive::include_all_members): Return if archive has already been
2594 * gold/archive.h (Archive::include_all_members_): New data member.
2596 2011-06-02 Nick Clifton <nickc@redhat.com>
2598 * dynobj.h: Fix spelling mistake in comment.
2599 * output.cc: Likewise.
2601 2011-05-31 Doug Kwan <dougkwan@google.com>
2605 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2606 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2607 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2608 redundant arm_exidx_test.so.
2609 * testsuite/Makefile.in: Regenerate.
2610 (check_SCRIPTS): Add pr12826.sh
2611 (check_DATA): Add pr12826.stdout
2612 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2613 * testsuite/pr12826.sh: New file.
2614 * testsuite/pr12826_1.s: Ditto.
2615 * testsuite/pr12826_1.s: Ditto.
2617 2011-05-30 Ian Lance Taylor <iant@google.com>
2619 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2622 2011-05-29 Ian Lance Taylor <iant@google.com>
2625 * testsuite/Makefile.am: Use different file name for two_file_test
2626 temporary file for each incremental test.
2627 * testsuite/Makefile.in: Rebuild.
2629 2011-05-29 Ian Lance Taylor <iant@google.com>
2631 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2632 binary input file is empty.
2634 2011-05-27 Ian Lance Taylor <iant@google.com>
2636 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2637 (ver_test_9.so): Likewise.
2638 * testsuite/Makefile.in: Rebuild.
2640 2011-05-26 Cary Coutant <ccoutant@google.com>
2642 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2643 * incremental.cc (Incremental_inputs::report_input_section): Fix
2644 comment, indentation.
2645 (Incremental_inputs::report_comdat_group): New function.
2646 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2647 of data for incremental input file entry.
2648 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2649 group count, COMDAT group signatures.
2650 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2651 an unchanged input file.
2652 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2653 Initialize new data member.
2654 (Incremental_object_entry::add_comdat_group): New function.
2655 (Incremental_object_entry::get_comdat_group_count): New function.
2656 (Incremental_object_entry::get_comdat_signature_key): New function.
2657 (Incremental_object_entry::groups_): New data member.
2658 (Incremental_inputs::report_comdat_group): New function.
2659 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2660 data for incremental input file entry.
2661 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2662 (Incremental_input_entry_reader::get_input_section): Adjust size of
2663 data for incremental input file entry.
2664 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2665 (Incremental_input_entry_reader::get_comdat_group_signature): New
2667 * object.cc (Sized_relobj::include_section_group): Report kept
2668 COMDAT groups for incremental links.
2670 2011-05-24 David Meyer <pdox@google.com>
2672 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2673 with name parameter. Add found_name parameter.
2674 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2675 * dirsearch.h (class Dirsearch): Update declaration.
2677 2011-05-24 Ian Lance Taylor <iant@google.com>
2679 * archive.cc (Library_base::should_include_member): Pull in object
2680 from archive if it defines the entry symbol.
2681 * parameters.cc (Parameters::entry): New function.
2682 * parameters.h (class Parameters): Declare entry.
2683 * output.h (class Output_file_header): Remove entry_ field.
2684 * output.cc (Output_file_header::Output_file_header): Remove entry
2685 parameter. Change all callers.
2686 (Output_file_header::entry): Use parameters->entry.
2687 * gold.cc (queue_middle_tasks): Likewise.
2688 * plugin.cc (Plugin_hook::run): Likewise.
2690 2011-05-24 Cary Coutant <ccoutant@google.com>
2692 * gold.cc (queue_initial_tasks): Pass incremental base filename
2693 to Output_file::open_base_file; don't print error message.
2694 * incremental-dump.cc (main): Adjust call to
2695 Output_file::open_for_modification.
2696 * incremental-dump.cc (main): Likewise.
2697 * incremental.cc (Incremental_inputs::report_command_line):
2698 Ignore --incremental-base option when comparing command lines.
2699 Ignore parameter when given as separate argument.
2700 * options.h (class General_options): Add --incremental-base.
2701 * output.cc (Output_file::Output_file):
2702 (Output_file::open_base_file): Add base_name and writable parameters;
2703 read base file into new file; print error message here.
2704 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2706 * output.h (Output_file::open_for_modification): Rename to...
2707 (Output_file::open_base_file): ...this; add base_name and
2708 writable parameters; adjust all callers.
2709 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2711 * testsuite/Makefile.am (incremental_test_4): Test
2713 * testsuite/Makefile.in: Regenerate.
2715 2011-05-24 Cary Coutant <ccoutant@google.com>
2717 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2719 * testsuite/Makefile.in: Regenerate.
2720 * testsuite/two_file_test_1_v1.cc: New test source file.
2721 * testsuite/two_file_test_1b_v1.cc: New test source file.
2722 * testsuite/two_file_test_2_v1.cc: New test source file.
2724 2011-05-24 Cary Coutant <ccoutant@google.com>
2726 * dynobj.h (Dynobj::do_dynobj): New function.
2727 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2728 flag and soname for shared objects.
2729 * incremental.cc (Incremental_inputs::report_object): Make
2730 either Incremental_object_entry or Incremental_dynobj_entry; add
2731 soname to string table.
2732 (Incremental_inputs::report_input_section): Add assertion.
2733 (Output_section_incremental_inputs::set_final_data_size): Adjust
2734 type of input file entry for shared libraries; adjust size of
2735 shared library info entry.
2736 (Output_section_incremental_inputs::write_input_files): Write
2737 as_needed flag for shared libraries.
2738 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2739 of input file entry for shared libraries; write soname.
2740 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2741 soname from incremental info.
2742 * incremental.h (enum Incremental_input_flags): Add
2743 INCREMENTAL_INPUT_AS_NEEDED.
2744 (Incremental_input_entry::Incremental_input_entry): Initialize new
2746 (Incremental_input_entry::set_as_needed): New function.
2747 (Incremental_input_entry::as_needed): New function.
2748 (Incremental_input_entry::do_dynobj_entry): New function.
2749 (Incremental_input_entry::as_needed_): New data member.
2750 (Incremental_object_entry::Incremental_object_entry): Don't check
2752 (Incremental_object_entry::do_type): Likewise.
2753 (class Incremental_dynobj_entry): New class.
2754 (Incremental_input_entry_reader::as_needed): New function.
2755 (Incremental_input_entry_reader::get_soname): New function.
2756 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2757 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2758 size of shared library info entry.
2759 * layout.cc (Layout::finish_dynamic_section): Don't test for
2760 incremental link when adding DT_NEEDED entries.
2761 * object.h (Object::Object): Initialize new data member.
2762 (Object::dynobj): New function.
2763 (Object::set_as_needed): New function.
2764 (Object::as_needed): New function.
2765 (Object::do_dynobj): New function.
2766 (Object::as_needed_): New data member.
2768 2011-05-24 Cary Coutant <ccoutant@google.com>
2770 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2771 info; adjust display of GOT entries.
2772 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2773 vector of input objects; remove file_status_.
2774 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2775 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2776 got_plt reader; call target hooks to reserve GOT entries.
2777 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2778 of input file info header and GOT info entry.
2779 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2781 (Got_plt_view_info::got_descriptor): Remove.
2782 (Got_plt_view_info::sym_index): New data member.
2783 (Got_plt_view_info::input_index): New data member.
2784 (Local_got_offset_visitor::visit): Write input file index.
2785 (Global_got_offset_visitor::visit): Write 0 for input file index.
2786 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2787 with sym_index and input_index.
2788 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2789 incremental info GOT entry; replace got_descriptor with input_index.
2790 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2791 map from input file index to object.
2792 (Sized_relobj_incr::do_layout): Replace direct data member reference
2793 with accessor function.
2794 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2795 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2796 Adjust size of input file info header.
2797 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2798 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2799 (Incremental_input_entry_reader::get_input_section): Adjust size of
2800 input file info header.
2801 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2802 of incremental info GOT entry.
2803 (Incremental_got_plt_reader::get_got_desc): Remove.
2804 (Incremental_got_plt_reader::get_got_symndx): New function.
2805 (Incremental_got_plt_reader::get_got_input_index): New function.
2806 (Sized_incremental_binary::Sized_incremental_binary): Remove
2807 file_status_; add input_objects_.
2808 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2809 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2810 (Sized_incremental_binary::file_is_unchanged): Remove.
2811 (Sized_incremental_binary::set_input_object): New function.
2812 (Sized_incremental_binary::input_object): New function.
2813 (Sized_incremental_binary::file_status_): Remove.
2814 (Sized_incremental_binary::input_objects_): New data member.
2815 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2817 (Sized_relobj_incr::invalid_address): Move to base class.
2818 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2820 (Sized_relobj_incr::do_output_section_offset): Likewise.
2821 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2822 (Sized_relobj_incr::section_offsets_): Likewise.
2823 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2825 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2826 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2827 with accessor function.
2828 (Sized_relobj_file::do_layout): Likewise.
2829 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2830 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2831 (Sized_relobj_file::compute_final_local_value): Replace refs to
2832 section_offsets_ with accessor function.
2833 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2834 * object.h (Relobj::Relobj): Initialize new data members.
2835 (Relobj::add_dyn_reloc): New function.
2836 (Relobj::first_dyn_reloc): New function.
2837 (Relobj::dyn_reloc_count): New function.
2838 (Relobj::first_dyn_reloc_): New data member.
2839 (Relobj::dyn_reloc_count_): New data member.
2840 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2842 (Sized_relobj::Address): New typedef.
2843 (Sized_relobj::invalid_address): Move here from child class.
2844 (Sized_relobj::Sized_relobj): Initialize new data members.
2845 (Sized_relobj::sized_relobj): New function.
2846 (Sized_relobj::is_output_section_offset_invalid): Move here from
2848 (Sized_relobj::get_output_section_offset): Likewise.
2849 (Sized_relobj::local_has_got_offset): Likewise.
2850 (Sized_relobj::local_got_offset): Likewise.
2851 (Sized_relobj::set_local_got_offset): Likewise.
2852 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2853 (Sized_relobj::clear_got_offsets): New function.
2854 (Sized_relobj::section_offsets): Move here from child class.
2855 (Sized_relobj::do_output_section_offset): Likewise.
2856 (Sized_relobj::do_set_section_offset): Likewise.
2857 (Sized_relobj::Local_got_offsets): Likewise.
2858 (Sized_relobj::local_got_offsets_): Likewise.
2859 (Sized_relobj::section_offsets_): Likewise.
2860 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2862 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2864 (Sized_relobj_file::sized_relobj): New function
2865 (Sized_relobj_file::local_has_got_offset): Move to base class.
2866 (Sized_relobj_file::local_got_offset): Likewise.
2867 (Sized_relobj_file::set_local_got_offset): Likewise.
2868 (Sized_relobj_file::get_output_section_offset): Likewise.
2869 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2870 (Sized_relobj_file::do_output_section_offset): Likewise.
2871 (Sized_relobj_file::do_set_section_offset): Likewise.
2872 (Sized_relobj_file::Local_got_offsets): Likewise.
2873 (Sized_relobj_file::local_got_offsets_): Likewise.
2874 (Sized_relobj_file::section_offsets_): Likewise.
2875 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2877 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2878 (Output_reloc::get_symbol_index): Likewise.
2879 (Output_reloc::local_section_offset): Likewise.
2880 (Output_reloc::get_address): Likewise.
2881 (Output_reloc::symbol_value): Likewise.
2882 (Output_data_got::reserve_slot): Move to class definition.
2883 (Output_data_got::reserve_local): New function.
2884 (Output_data_got::reserve_slot_for_global): Remove.
2885 (Output_data_got::reserve_global): New function.
2886 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2887 (all constructors, two instantiations).
2888 (Output_reloc::get_relobj): New function (two instantiations).
2889 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2890 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2891 (Output_data_reloc::add_global): Adjust type of relobj.
2892 (Output_data_reloc::add_global_relative): Likewise.
2893 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2894 (Output_data_reloc::add_local): Likewise.
2895 (Output_data_reloc::add_local_relative): Likewise.
2896 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2897 (Output_data_reloc::add_local_section): Likewise.
2898 (Output_data_reloc::add_output_section): Likewise.
2899 (Output_data_reloc::add_absolute): Likewise.
2900 (Output_data_reloc::add_target_specific): Likewise.
2901 (Output_data_got::reserve_slot): Move definition here.
2902 (Output_data_got::reserve_local): New function.
2903 (Output_data_got::reserve_global): New function.
2904 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2905 section_offsets_ with accessor function.
2906 (Sized_relobj_file::write_sections): Likewise.
2907 (Sized_relobj_file::do_relocate_sections): Likewise.
2908 * target.h (Sized_target::reserve_local_got_entry): New function.
2909 (Sized_target::reserve_global_got_entry): New function.
2910 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2911 (Target_x86_64::reserve_global_got_entry): New function.
2912 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2914 2011-05-23 Cary Coutant <ccoutant@google.com>
2916 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2917 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2918 bit when checking got_type.
2919 * incremental.cc (Sized_incremental_binary::setup_readers):
2920 Store symbol table and string table locations; initialize bit vector
2921 of file status flags.
2922 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2924 (Sized_incremental_binary::do_process_got_plt): New function.
2925 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2926 (Output_section_incremental_inputs::set_final_data_size): Record
2927 file index for each input file.
2928 (Output_section_incremental_inputs::write_got_plt): Store file index
2929 instead of input entry offset for each GOT entry.
2931 (Incremental_input_entry::Incremental_input_entry): Initialize new
2933 (Incremental_input_entry::set_offset): Store file index.
2934 (Incremental_input_entry::get_file_index): New function.
2935 (Incremental_input_entry::file_index_): New data member.
2936 (Incremental_binary::process_got_plt): New function.
2937 (Incremental_binary::do_process_got_plt): New function.
2938 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2940 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2941 (Sized_incremental_binary::set_file_is_unchanged): New function.
2942 (Sized_incremental_binary::file_is_unchanged): New function.
2943 (Sized_incremental_binary::do_process_got_plt): New function.
2944 (Sized_incremental_binary::file_status_): New data member.
2945 (Sized_incremental_binary::main_symtab_loc_): New data member.
2946 (Sized_incremental_binary::main_strtab_loc_): New data member.
2947 * output.cc (Output_data_got::Got_entry::write): Add case
2949 (Output_data_got::add_global): Call add_got_entry.
2950 (Output_data_got::add_global_plt): Likewise.
2951 (Output_data_got::add_global_with_rel): Likewise.
2952 (Output_data_got::add_global_with_rela): Likewise.
2953 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2954 (Output_data_got::add_global_pair_with_rela): Likewise.
2955 (Output_data_got::add_local): Call add_got_entry.
2956 (Output_data_got::add_local_plt): Likewise.
2957 (Output_data_got::add_local_with_rel): Likewise.
2958 (Output_data_got::add_local_with_rela): Likewise.
2959 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2960 (Output_data_got::add_local_pair_with_rela): Likewise.
2961 (Output_data_got::reserve_slot): New function.
2962 (Output_data_got::reserve_slot_for_global): New function.
2963 (Output_data_got::add_got_entry): New function.
2964 (Output_data_got::add_got_entry_pair): New function.
2965 (Output_section::add_output_section_data): Edit FIXME.
2967 (Output_section_data_build::Output_section_data_build): New
2968 constructor with size parameter.
2969 (Output_data_space::Output_data_space): Likewise.
2970 (Output_data_got::Output_data_got): Initialize new data member; new
2971 constructor with size parameter.
2972 (Output_data_got::add_constant): Call add_got_entry.
2973 (Output_data_got::reserve_slot): New function.
2974 (Output_data_got::reserve_slot_for_global): New function.
2975 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2976 (Output_data_got::add_got_entry): New function.
2977 (Output_data_got::add_got_entry_pair): New function.
2978 (Output_data_got::free_list_): New data member.
2979 * target.h (Sized_target::init_got_plt_for_update): New function.
2980 (Sized_target::register_global_plt_entry): New function.
2981 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2982 Initialize new data member; call init; add constructor with PLT count.
2983 (Output_data_plt_x86_64::init): New function.
2984 (Output_data_plt_x86_64::add_relocation): New function.
2985 (Output_data_plt_x86_64::reserve_slot): New function.
2986 (Output_data_plt_x86_64::free_list_): New data member.
2987 (Target_x86_64::init_got_plt_for_update): New function.
2988 (Target_x86_64::register_global_plt_entry): New function.
2989 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2990 incremental updates.
2991 (Output_data_plt_x86_64::add_relocation): New function.
2992 * testsuite/object_unittest.cc (Object_test): Set default options.
2994 2011-05-16 Ian Lance Taylor <iant@google.com>
2996 * options.h (class General_options): Make -i a synonym for -r.
2998 2011-05-16 Ian Lance Taylor <iant@google.com>
3000 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3002 2011-05-10 Cary Coutant <ccoutant@google.com>
3004 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3007 2011-05-06 Ian Lance Taylor <iant@google.com>
3009 * layout.cc (Layout::layout): If the output section flags change,
3010 update the ordering.
3012 2011-04-25 Cary Coutant <ccoutant@google.com>
3014 * incremental-dump.cc (dump_incremental_inputs): Print local
3015 symbol info for each input file.
3017 (Output_section_incremental_inputs::set_final_data_size): Add local
3018 symbol info to input file entries in incremental info.
3019 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3020 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3021 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3022 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3024 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3025 (Sized_incr_relobj::do_relocate): Write the local symbols.
3026 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3027 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3028 Adjust size of input file header.
3029 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3030 (Incremental_inputs_reader::get_local_symbol_count): New function.
3031 (Incremental_inputs_reader::get_input_section): Adjust size of input
3033 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3034 (Sized_incr_relobj::This): New typedef.
3035 (Sized_incr_relobj::sym_size): New const data member.
3036 (Sized_incr_relobj::Local_symbol): New struct.
3037 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3038 (Sized_incr_relobj::do_local_symbol_offset): New function.
3039 (Sized_incr_relobj::local_symbol_count_): New data member.
3040 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3041 (Sized_incr_relobj::local_symbol_index_): New data member.
3042 (Sized_incr_relobj::local_symbol_offset_): New data member.
3043 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3044 (Sized_incr_relobj::local_symbols_): New data member.
3045 * object.h (Relobj::output_local_symbol_count): New function.
3046 (Relobj::local_symbol_offset): New function.
3047 (Relobj::do_output_local_symbol_count): New function.
3048 (Relobj::do_local_symbol_offset): New function.
3049 (Sized_relobj::do_output_local_symbol_count): New function.
3050 (Sized_relobj::do_local_symbol_offset): New function.
3052 2011-04-22 Vladimir Simonov <sv@sw.ru>
3054 * descriptors.cc (set_close_on_exec): New function.
3055 (Descriptors::open): Use set_close_on_exec.
3056 * output.cc (S_ISLNK): Define if not defined.
3058 2011-04-22 Cary Coutant <ccoutant@google.com>
3060 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3062 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3063 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3064 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3066 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3067 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3068 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3070 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3072 (Incremental_binary::apply_incremental_relocs): New function.
3073 (Incremental_binary::do_apply_incremental_relocs): New function.
3074 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3076 (Sized_incremental_binary::add_global_symbol): New function.
3077 (Sized_incremental_binary::global_symbol): New function.
3078 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3079 (Sized_incremental_binary::symbol_map_): New data member.
3080 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3081 * target.h (Sized_target::apply_relocation): New function.
3082 * target-reloc.h (apply_relocation): New function.
3083 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3085 2011-04-22 Doug Kwan <dougkwan@google.com>
3087 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3088 flag of a SHT_ARM_EXIDX section.
3089 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3090 * testsuite/Makefile.in: Regenerate.
3091 * testsuite/arm_exidx_test.s: New file.
3092 * testsuite/arm_exidx_test.sh: Same.
3094 2011-04-20 Cary Coutant <ccoutant@google.com>
3097 * archive.h (Incremental_archive_entry::Archive_member):
3098 Initialize arg_serial_ (second constructor).
3100 2011-04-17 Ian Lance Taylor <iant@google.com>
3102 * object.cc (Relocate_info::location): Simplify location string.
3103 * errors.cc (Errors::error_at_location): Don't print program
3105 (Errors::warning_at_location): Likewise.
3106 (Errors::undefined_symbol): Likewise.
3107 * testsuite/debug_msg.sh: Update accordingly.
3109 2011-04-14 Cary Coutant <ccoutant@google.com>
3111 * gold/layout.cc (Layout::symtab_section_offset): New function.
3112 * gold/layout.h (Layout::symtab_section_offset): New function.
3113 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3115 2011-04-12 Ian Lance Taylor <iant@google.com>
3117 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3118 with MREMAP_MAYMOVE.
3119 * output.h (class Output_file): Add map_is_allocated_ field.
3120 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3121 not available, provide stubs. If mremap is not available, #define
3123 (MREMAP_MAYMOVE): Define if not defined.
3124 (Output_file::Output_file): Initialize map_is_allocated_.
3125 (Output_file::resize): Check map_is_allocated_.
3126 (Output_file::map_anonymous): If mmap fails, use malloc.
3127 (Output_file::unmap): Don't do anything for an anonymous map.
3128 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3129 is not available, provide stubs.
3130 (File_read::View::~View): Use free rather than delete[].
3131 (File_read::make_view): Use malloc rather than new[]. If mmap
3133 (File_read::find_or_make_view): Use malloc rather than new[].
3134 * gold.h: Remove HAVE_REMAP code.
3135 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3136 exists. Rename mremap to gold_mremap. If mmap is not available
3138 * configure, config.in: Rebuild.
3140 2011-04-11 Ian Lance Taylor <iant@google.com>
3142 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3143 initialize local variable v.
3145 2011-04-11 Cary Coutant <ccoutant@google.com>
3147 * archive.cc (Archive::include_member): Adjust call to
3149 (Add_archive_symbols::run): Track argument serial numbers.
3150 (Lib_group::include_member): Likewise.
3151 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3152 * archive.h (Incremental_archive_entry::Archive_member):
3153 Initialize arg_serial_.
3154 (Archive_member::arg_serial_): New data member.
3155 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3156 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3158 (Sized_dynobj::do_for_all_local_got_entries): New function.
3159 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3161 * fileread.cc (get_mtime): New function.
3162 * fileread.h (get_mtime): New function.
3163 * gold.cc (queue_initial_tasks): Check for incremental update.
3164 (process_incremental_input): New function.
3165 (queue_middle_tasks): Don't force valid target for incremental
3167 * incremental-dump.cc (find_input_containing_global): Adjust
3168 size of symbol info entry.
3169 (dump_incremental_inputs): Dump argument serial number and
3170 in_system_directory flag; bias shndx by 1; print symbol names
3171 when dumping per-file symbol lists; use new symbol info readers.
3173 (Output_section_incremental_inputs:update_data_size): New function.
3174 (Sized_incremental_binary::setup_readers): Setup input readers
3175 for each input file; build maps for files added from libraries
3177 (Sized_incremental_binary::check_input_args): New function.
3178 (Sized_incremental_binary::do_check_inputs): Build map of argument
3179 serial numbers to input arguments.
3180 (Sized_incremental_binary::do_file_has_changed): Rename
3181 do_file_is_unchanged to this; compare file modification times.
3182 (Sized_incremental_binary::do_init_layout): New function.
3183 (Sized_incremental_binary::do_reserve_layout): New function.
3184 (Sized_incremental_binary::do_get_input_reader): Remove.
3185 (Sized_incremental_binary::get_symtab_view): New function.
3186 (Incremental_checker::can_incrementally_link_output_file): Remove.
3187 (Incremental_inputs::report_command_line): Exclude --debug options.
3188 (Incremental_inputs::report_archive_begin): Add parameter; track
3189 argument serial numbers; don't put input file entry for archive
3190 before archive members.
3191 (Incremental_inputs::report_archive_end): Put input file entry
3192 for archive after archive members.
3193 (Incremental_inputs::report_object): Add parameter; track argument
3194 serial numbers and in_system_directory flag.
3195 (Incremental_inputs::report_script): Add parameter; track argument
3197 (Output_section_incremental_inputs::set_final_data_size): Adjust
3198 size of symbol info entry; check for forwarding symbols.
3199 (Output_section_incremental_inputs::write_input_files): Write
3200 in_system_directory flag and argument serial number.
3201 (Output_section_incremental_inputs::write_info_blocks): Map section
3202 indices between incremental info and original input file; store
3203 input section index for each symbol.
3204 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3205 change operator() to visit().
3206 (class Global_got_offset_visitor): Likewise.
3207 (class Global_symbol_visitor_got_plt):
3208 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3210 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3211 (Sized_incr_relobj::do_read_symbols): New function.
3212 (Sized_incr_relobj::do_layout): New function.
3213 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3214 (Sized_incr_relobj::do_add_symbols): New function.
3215 (Sized_incr_relobj::do_should_include_member): New function.
3216 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3217 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3218 (Sized_incr_relobj::do_section_size): New function.
3219 (Sized_incr_relobj::do_section_name): New function.
3220 (Sized_incr_relobj::do_section_contents): New function.
3221 (Sized_incr_relobj::do_section_flags): New function.
3222 (Sized_incr_relobj::do_section_entsize): New function.
3223 (Sized_incr_relobj::do_section_address): New function.
3224 (Sized_incr_relobj::do_section_type): New function.
3225 (Sized_incr_relobj::do_section_link): New function.
3226 (Sized_incr_relobj::do_section_info): New function.
3227 (Sized_incr_relobj::do_section_addralign): New function.
3228 (Sized_incr_relobj::do_initialize_xindex): New function.
3229 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3230 (Sized_incr_relobj::do_read_relocs): New function.
3231 (Sized_incr_relobj::do_gc_process_relocs): New function.
3232 (Sized_incr_relobj::do_scan_relocs): New function.
3233 (Sized_incr_relobj::do_count_local_symbols): New function.
3234 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3235 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3236 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3237 (Sized_incr_relobj::do_relocate): New function.
3238 (Sized_incr_relobj::do_set_section_offset): New function.
3239 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3240 (Sized_incr_dynobj::do_read_symbols): New function.
3241 (Sized_incr_dynobj::do_layout): New function.
3242 (Sized_incr_dynobj::do_add_symbols): New function.
3243 (Sized_incr_dynobj::do_should_include_member): New function.
3244 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3245 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3246 (Sized_incr_dynobj::do_section_size): New function.
3247 (Sized_incr_dynobj::do_section_name): New function.
3248 (Sized_incr_dynobj::do_section_contents): New function.
3249 (Sized_incr_dynobj::do_section_flags): New function.
3250 (Sized_incr_dynobj::do_section_entsize): New function.
3251 (Sized_incr_dynobj::do_section_address): New function.
3252 (Sized_incr_dynobj::do_section_type): New function.
3253 (Sized_incr_dynobj::do_section_link): New function.
3254 (Sized_incr_dynobj::do_section_info): New function.
3255 (Sized_incr_dynobj::do_section_addralign): New function.
3256 (Sized_incr_dynobj::do_initialize_xindex): New function.
3257 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3258 (make_sized_incremental_object): New function.
3259 (Incremental_library::copy_unused_symbols): New function.
3260 (Incremental_library::do_for_all_unused_symbols): New function.
3261 * incremental.h (enum Incremental_input_flags): New type.
3262 (class Incremental_checker): Remove.
3263 (Incremental_input_entry::Incremental_input_entry): Add argument
3265 (Incremental_input_entry::arg_serial): New function.
3266 (Incremental_input_entry::set_is_in_system_directory): New function.
3267 (Incremental_input_entry::is_in_system_directory): New function.
3268 (Incremental_input_entry::arg_serial_): New data member.
3269 (Incremental_input_entry::is_in_system_directory_): New data member.
3270 (class Script_info): Move here from script.h.
3271 (Script_info::Script_info): Add filename parameter.
3272 (Script_info::filename): New function.
3273 (Script_info::filename_): New data member.
3274 (Incremental_script_entry::Incremental_script_entry): Add argument
3276 (Incremental_object_entry::Incremental_object_entry): Likewise.
3277 (Incremental_object_entry::add_input_section): Build list of input
3278 sections with map to original shndx.
3279 (Incremental_object_entry::get_input_section_index): New function.
3280 (Incremental_object_entry::shndx_): New data member.
3281 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3282 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3283 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3285 (Incremental_inputs::report_archive_begin): Likewise.
3286 (Incremental_inputs::report_object): Likewise.
3287 (Incremental_inputs::report_script): Likewise.
3288 (class Incremental_global_symbol_reader): New class.
3289 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3290 and store flags and input file type.
3291 (Incremental_input_entry_reader::arg_serial): New function.
3292 (Incremental_input_entry_reader::type): Extract type from flags.
3293 (Incremental_input_entry_reader::is_in_system_directory): New function.
3294 (Incremental_input_entry_reader::get_input_section_count): Call
3295 accessor function for type.
3296 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3297 function for type; adjust size of global symbol entry.
3298 (Incremental_input_entry_reader::get_global_symbol_count): Call
3299 accessor function for type.
3300 (Incremental_input_entry_reader::get_object_count): Likewise.
3301 (Incremental_input_entry_reader::get_object_offset): Likewise.
3302 (Incremental_input_entry_reader::get_member_count): Likewise.
3303 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3304 (Incremental_input_entry_reader::get_member_offset): Likewise.
3305 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3306 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3307 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3308 (Incremental_input_entry_reader::get_global_symbol_reader): New
3310 (Incremental_input_entry_reader::get_output_symbol_index): New
3312 (Incremental_input_entry_reader::type_): Remove.
3313 (Incremental_input_entry_reader::flags_): New data member.
3314 (Incremental_inputs_reader::input_file_offset): New function.
3315 (Incremental_inputs_reader::input_file_index): New function.
3316 (Incremental_inputs_reader::input_file): Call input_file_offset.
3317 (Incremental_inputs_reader::input_file_at_offset): New function.
3318 (Incremental_relocs_reader::get_r_type): Reformat.
3319 (Incremental_relocs_reader::get_r_shndx): Reformat.
3320 (Incremental_relocs_reader::get_r_offset): Reformat.
3321 (Incremental_relocs_reader::data): New function.
3322 (Incremental_binary::Incremental_binary): Initialize new data members.
3323 (Incremental_binary::check_inputs): Add cmdline parameter.
3324 (Incremental_binary::file_is_unchanged): Remove.
3325 (Input_reader::arg_serial): New function.
3326 (Input_reader::get_unused_symbol_count): New function.
3327 (Input_reader::get_unused_symbol): New function.
3328 (Input_reader::do_arg_serial): New function.
3329 (Input_reader::do_get_unused_symbol_count): New function.
3330 (Input_reader::do_get_unused_symbol): New function.
3331 (Incremental_binary::input_file_count): New function.
3332 (Incremental_binary::get_input_reader): Change signature to use
3333 index instead of filename.
3334 (Incremental_binary::file_has_changed): New function.
3335 (Incremental_binary::get_input_argument): New function.
3336 (Incremental_binary::get_library): New function.
3337 (Incremental_binary::get_script_info): New function.
3338 (Incremental_binary::init_layout): New function.
3339 (Incremental_binary::reserve_layout): New function.
3340 (Incremental_binary::output_file): New function.
3341 (Incremental_binary::do_check_inputs): New function.
3342 (Incremental_binary::do_file_is_unchanged): Remove.
3343 (Incremental_binary::do_file_has_changed): New function.
3344 (Incremental_binary::do_init_layout): New function.
3345 (Incremental_binary::do_reserve_layout): New function.
3346 (Incremental_binary::do_input_file_count): New function.
3347 (Incremental_binary::do_get_input_reader): Change signature.
3348 (Incremental_binary::input_args_map_): New data member.
3349 (Incremental_binary::library_map_): New data member.
3350 (Incremental_binary::script_map_): New data member.
3351 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3353 (Sized_incremental_binary::output_section): New function.
3354 (Sized_incremental_binary::inputs_reader): Add const.
3355 (Sized_incremental_binary::symtab_reader): Add const.
3356 (Sized_incremental_binary::relocs_reader): Add const.
3357 (Sized_incremental_binary::got_plt_reader): Add const.
3358 (Sized_incremental_binary::get_symtab_view): New function.
3359 (Sized_incremental_binary::Inputs_reader): New typedef.
3360 (Sized_incremental_binary::Input_entry_reader): New typedef.
3361 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3362 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3363 (Sized_incremental_binary::do_file_has_changed): New function.
3364 (Sized_incremental_binary::do_init_layout): New function.
3365 (Sized_incremental_binary::do_reserve_layout): New function.
3366 (Sized_input_reader::Inputs_reader): Remove.
3367 (Sized_input_reader::Input_entry_reader): Remove.
3368 (Sized_input_reader::do_arg_serial): New function.
3369 (Sized_input_reader::do_get_unused_symbol_count): New function.
3370 (Sized_input_reader::do_get_unused_symbol): New function.
3371 (Sized_incremental_binary::do_input_file_count): New function.
3372 (Sized_incremental_binary::do_get_input_reader): Change signature;
3373 use index instead of filename.
3374 (Sized_incremental_binary::section_map_): New data member.
3375 (Sized_incremental_binary::input_entry_readers_): New data member.
3376 (class Sized_incr_relobj): New class.
3377 (class Sized_incr_dynobj): New class.
3378 (make_sized_incremental_object): New function.
3379 (class Incremental_library): New class.
3380 * layout.cc (Free_list::num_lists): New static data member.
3381 (Free_list::num_nodes): New static data member.
3382 (Free_list::num_removes): New static data member.
3383 (Free_list::num_remove_visits): New static data member.
3384 (Free_list::num_allocates): New static data member.
3385 (Free_list::num_allocate_visits): New static data member.
3386 (Free_list::init): New function.
3387 (Free_list::remove): New function.
3388 (Free_list::allocate): New function.
3389 (Free_list::dump): New function.
3390 (Free_list::print_stats): New function.
3391 (Layout_task_runner::run): Resize output file for incremental updates.
3392 (Layout::Layout): Initialize new data members.
3393 (Layout::set_incremental_base): New function.
3394 (Layout::init_fixed_output_section): New function.
3395 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3396 incremental updates.
3397 (Layout::create_gold_note): Do not create gold note section for
3398 incremental updates.
3399 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3400 for incremental updates.
3401 (Layout::set_section_offsets): For incremental updates, allocate space
3403 (Layout::create_symtab_sections): Layout with offsets relative to
3404 start of section; for incremental updates, allocate space from free
3406 (Layout::create_shdrs): For incremental updates, allocate space from
3408 (Layout::finish_dynamic_section): For incremental updates, do not
3409 check --as-needed (fixed in subsequent patch).
3410 * layout.h (class Free_list): New class.
3411 (Layout::set_incremental_base): New function.
3412 (Layout::incremental_base): New function.
3413 (Layout::init_fixed_output_section): New function.
3414 (Layout::allocate): New function.
3415 (Layout::incremental_base_): New data member.
3416 (Layout::free_list_): New data member.
3417 * main.cc (main): Print Free_list statistics.
3418 * object.cc (Relobj::finalize_incremental_relocs): Add
3419 clear_counts parameter; clear counts only when clear_counts is set.
3420 (Sized_relobj::Sized_relobj): Initialize new base class.
3421 (Sized_relobj::do_layout): Don't report special sections.
3422 (Sized_relobj::do_for_all_local_got_entries): New function.
3423 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3424 symtab_off to all symbol table offsets.
3425 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3426 * object.h (class Got_offset_list): Move to top of file.
3427 (Object::Object): Allow case where input_file == NULL.
3428 (Object::~Object): Likewise.
3429 (Object::input_file): Assert that input_file != NULL.
3430 (Object::lock): Allow case where input_file == NULL.
3431 (Object::unlock): Likewise.
3432 (Object::is_locked): Likewise.
3433 (Object::token): Likewise.
3434 (Object::release): Likewise.
3435 (Object::is_incremental): New function.
3436 (Object::get_mtime): New function.
3437 (Object::for_all_local_got_entries): New function.
3438 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3439 (Object::set_is_in_system_directory): New function.
3440 (Object::is_in_system_directory): New function.
3441 (Object::do_is_incremental): New function.
3442 (Object::do_get_mtime): New function.
3443 (Object::do_for_all_local_got_entries): New function.
3444 (Object::is_in_system_directory_): New data member.
3445 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3446 (class Sized_relobj_base): New class.
3447 (class Sized_relobj): Derive from Sized_relobj_base.
3448 (class Sized_relobj::Symbols): Redeclare from base class.
3449 (class Sized_relobj::local_got_offset_list): Remove.
3450 (class Sized_relobj::Output_sections): Redeclare from base class.
3451 (class Sized_relobj::do_for_all_local_got_entries): New function.
3452 (class Sized_relobj::write_local_symbols): Add offset parameter.
3453 (class Sized_relobj::local_symbol_offset_): Update comment.
3454 (class Sized_relobj::local_dynsym_offset_): Update comment.
3455 * options.cc (Input_arguments::add_file): Remove const.
3456 * options.h (Input_file_argument::Input_file_argument):
3457 Initialize arg_serial_ (all constructors).
3458 (Input_file_argument::set_arg_serial): New function.
3459 (Input_file_argument::arg_serial): New function.
3460 (Input_file_argument::arg_serial_): New data member.
3461 (Input_arguments::Input_arguments): Initialize file_count_.
3462 (Input_arguments::add_file): Remove const.
3463 (Input_arguments::number_of_input_files): New function.
3464 (Input_arguments::file_count_): New data member.
3465 (Command_line::number_of_input_files): Call
3466 Input_arguments::number_of_input_files.
3467 * output.cc (Output_segment_headers::Output_segment_headers):
3469 (Output_section::Input_section::current_data_size): New function.
3470 (Output_section::Output_section): Initialize new data members.
3471 (Output_section::add_input_section): Don't do merge sections for
3472 an incremental link; allocate space from free list for an
3474 (Output_section::add_output_section_data): Allocate space from
3475 free list for an incremental update.
3476 (Output_section::update_data_size): New function.
3477 (Output_section::set_fixed_layout): New function.
3478 (Output_section::reserve): New function.
3479 (Output_segment::set_section_addresses): Remove const.
3480 (Output_segment::set_section_list_addresses): Remove const; allocate
3481 space from free list for an incremental update.
3482 (Output_segment::set_offset): Adjust size of RELRO segment for an
3484 * output.h (Output_data::current_data_size): Move here from
3486 (Output_data::pre_finalize_data_size): New function.
3487 (Output_data::update_data_size): New function.
3488 (Output_section_headers::update_data_size): new function.
3489 (Output_section_data_build::current_data_size): Move to Output_data.
3490 (Output_data_strtab::update_data_size): New function.
3491 (Output_section::current_data_size): Move to Output_data.
3492 (Output_section::set_fixed_layout): New function.
3493 (Output_section::has_fixed_layout): New function.
3494 (Output_section::reserve): New function.
3495 (Output_section::update_data_size): New function.
3496 (Output_section::has_fixed_layout_): New data member.
3497 (Output_section::free_list_): New data member.
3498 (Output_segment::set_section_addresses): Remove const.
3499 (Output_segment::set_section_list_addresses): Remove const.
3500 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3502 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3504 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3505 parameter when calling Add_symbols constructor; store argument
3506 serial number for members of a lib group.
3507 (Add_symbols::locks): Allow case where token == NULL.
3508 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3509 (Read_member::~Read_member): New function.
3510 (Read_member::is_runnable): New function.
3511 (Read_member::locks): New function.
3512 (Read_member::run): New function.
3513 (Check_script::~Check_script): New function.
3514 (Check_script::is_runnable): New function.
3515 (Check_script::locks): New function.
3516 (Check_script::run): New function.
3517 (Check_library::~Check_library): New function.
3518 (Check_library::is_runnable): New function.
3519 (Check_library::locks): New function.
3520 (Check_library::run): New function.
3521 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3522 (Add_symbols::library_): New data member.
3523 (class Read_member): New class.
3524 (class Check_script): New class.
3525 (class Check_library): New class.
3526 * reloc.cc (Read_relocs::is_runnable): Allow case where
3528 (Read_relocs::locks): Likewise.
3529 (Scan_relocs::locks): Likewise.
3530 (Relocate_task::locks): Likewise.
3531 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3533 (Sized_relobj::incremental_relocs_scan): Fix comment.
3534 (Sized_relobj::do_relocate): Pass output file offset to
3535 write_local_symbols.
3536 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3537 from class declaration.
3538 * script.cc (read_input_script): Allocate Script_info; pass
3539 argument serial number to report_script.
3540 * script.h (class Script_info): Move to incremental.h.
3541 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3542 * symtab.h (Symbol_table::add_from_incrobj): New function.
3543 (Symbol_table::set_file_offset): New function.
3545 2011-04-05 Cary Coutant <ccoutant@google.com>
3547 * incremental-dump.cc (dump_incremental_inputs): Change signature
3548 to take a Sized_incremental_binary; change caller. Use readers
3549 in Sized_incremental_binary.
3551 (Sized_incremental_binary::find_incremental_inputs_sections):
3552 Rename do_find_incremental_inputs_sections to this.
3553 (Sized_incremental_binary::setup_readers): New function.
3554 (Sized_incremental_binary::do_check_inputs): Check
3555 has_incremental_info_ flag; move setup code to setup_readers;
3557 (Sized_incremental_binary::do_file_is_unchanged): New function.
3558 (Sized_incremental_binary::do_get_input_reader): New function.
3559 * incremental.h (class Incremental_binary): Move to end of file.
3560 (Incremental_binary::file_is_unchanged): New function.
3561 (Incremental_binary::do_file_is_unchanged): New function.
3562 (Incremental_binary::Input_reader): New class.
3563 (Incremental_binary::get_input_reader): New function.
3564 (class Sized_incremental_binary): Move to end of file.
3565 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3566 input section reader classes.
3567 (Sized_incremental_binary::has_incremental_info): New function.
3568 (Sized_incremental_binary::inputs_reader): New function.
3569 (Sized_incremental_binary::symtab_reader): New function.
3570 (Sized_incremental_binary::relocs_reader): New function.
3571 (Sized_incremental_binary::got_plt_reader): New function.
3572 (Sized_incremental_binary::do_file_is_unchanged): New function.
3573 (Sized_incremental_binary::Sized_input_reader): New class.
3574 (Sized_incremental_binary::get_input_reader): New function.
3575 (Sized_incremental_binary::find_incremental_inputs_sections):
3576 Rename do_find_incremental_inputs_sections to this.
3577 (Sized_incremental_binary::setup_readers): New function.
3578 (Sized_incremental_binary::has_incremental_info_): New data member.
3579 (Sized_incremental_binary::inputs_reader_): New data member.
3580 (Sized_incremental_binary::symtab_reader_): New data member.
3581 (Sized_incremental_binary::relocs_reader_): New data member.
3582 (Sized_incremental_binary::got_plt_reader_): New data member.
3583 (Sized_incremental_binary::current_input_file_): New data member.
3585 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3588 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3591 2011-03-30 Cary Coutant <ccoutant@google.com>
3593 * archive.cc (Archive::include_member): Adjust call to report_object.
3594 (Add_archive_symbols::run): Add script_info to call to
3595 report_archive_begin.
3596 (Lib_group::include_member): Adjust call to report_object.
3597 (Add_lib_group_symbols::run): Adjust call to report_object.
3598 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3599 blocks. Add object count for script input files.
3600 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3601 script_info parameter; change all callers.
3602 (Incremental_inputs::report_object): Add script_info parameter;
3604 (Incremental_inputs::report_script): Store backpointer to
3605 incremental info entry.
3606 (Output_section_incremental_inputs::set_final_data_size): Record
3607 additional information for scripts.
3608 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3609 * incremental.h (Incremental_script_entry::add_object): New function.
3610 (Incremental_script_entry::get_object_count): New function.
3611 (Incremental_script_entry::get_object): New function.
3612 (Incremental_script_entry::objects_): New data member; adjust
3614 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3615 (Incremental_inputs::report_object): Add script_info parameter.
3616 (Incremental_inputs_reader::get_object_count): New function.
3617 (Incremental_inputs_reader::get_object_offset): New function.
3618 * options.cc (Input_arguments::add_file): Return reference to
3620 * options.h (Input_argument::set_script_info): New function.
3621 (Input_argument::script_info): New function.
3622 (Input_argument::script_info_): New data member; adjust all
3624 (Input_file_group::add_file): Return reference to new input argument.
3625 (Input_file_lib::add_file): Likewise.
3626 (Input_arguments::add_file): Likewise.
3627 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3628 * script.cc (Parser_closure::Parser_closure): Add script_info
3629 parameter; adjust all callers.
3630 (Parser_closure::script_info): New function.
3631 (Parser_closure::script_info_): New data member.
3632 (read_input_script): Report scripts earlier to incremental info.
3633 (script_add_file): Set script_info in Input_argument.
3634 (script_add_library): Likewise.
3635 * script.h (Script_options::Script_info): Rewrite class.
3637 2011-03-29 Cary Coutant <ccoutant@google.com>
3639 * archive.cc (Library_base::should_include_member): Move
3640 method here from class Archive.
3641 (Archive::Archive): Initialize base class.
3642 (Archive::should_include_member): Move to base class.
3643 (Archive::do_for_all_unused_symbols): New function.
3644 (Add_archive_symbols::run): Remove redundant access to
3646 (Lib_group::Lib_group): Initialize base class.
3647 (Lib_group::do_filename): New function.
3648 (Lib_group::include_member): Pass pointer to Lib_group to
3650 (Lib_group::do_for_all_unused_symbols): New function.
3651 (Add_lib_group_symbols::run): Report archive information for
3653 * archive.h (class Library_base): New base class.
3654 (class Archive): Derive from Library_base.
3655 (Archive::filename): Move to base class.
3656 (Archive::set_incremental_info): Likewise.
3657 (Archive::incremental_info): Likewise.
3658 (Archive::Should_include): Likewise.
3659 (Archive::should_include_member): Likewise.
3660 (Archive::Armap_entry): Remove.
3661 (Archive::Unused_symbol_iterator): Remove.
3662 (Archive::unused_symbols_begin): Remove.
3663 (Archive::unused_symbols_end): Remove.
3664 (Archive::do_filename): New function.
3665 (Archive::do_get_mtime): New function.
3666 (Archive::do_for_all_unused_symbols): New function.
3667 (Archive::task_): Move to base class.
3668 (Archive::incremental_info_): Likewise.
3669 (class Lib_group): Derive from Library_base.
3670 (Lib_group::do_filename): New function.
3671 (Lib_group::do_get_mtime): New function.
3672 (Lib_group::do_for_all_unused_symbols): New function.
3673 (Lib_group::task_): Move to base class.
3674 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3676 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3678 * incremental.cc (Incremental_inputs::report_archive_begin):
3679 Use Library_base; call library's get_mtime; add incremental inputs
3680 entry before members.
3681 (class Unused_symbol_visitor): New class.
3682 (Incremental_inputs::report_archive_end): Use Library_base; use
3683 visitor class to record unused symbols; don't add incremental inputs
3684 entry after members.
3685 (Incremental_inputs::report_object): Use Library_base.
3687 (Incremental_archive_entry::Incremental_archive_entry): Remove
3688 unused Archive parameter.
3689 (Incremental_inputs::report_archive_begin): Use Library_base.
3690 (Incremental_inputs::report_archive_end): Likewise.
3691 (Incremental_inputs::report_object): Likewise.
3692 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3694 * object.h (Object::for_all_global_symbols): New function.
3695 (Object::do_for_all_global_symbols): New function.
3696 (Sized_relobj::do_for_all_global_symbols): New function.
3697 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3699 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3702 2011-03-27 Ian Lance Taylor <iant@google.com>
3704 * archive.cc (Archive::interpret_header): Return -1 if something
3705 goes wrong. Change callers accordingly.
3707 2011-03-25 Cary Coutant <ccoutant@google.com>
3709 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3710 * testsuite/Makefile.in: Regenerate.
3712 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3714 * plugin.cc (get_view): New.
3715 (Plugin::load): Pass get_view to the plugin.
3716 (Plugin_manager::get_view): New.
3718 2011-03-21 Ian Lance Taylor <iant@google.com>
3720 * testsuite/final_layout.sh: Rewrite to not use dc.
3721 * testsuite/relro_test.sh: Fail if dc is not present.
3723 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3725 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3727 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3728 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3730 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3731 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3733 2011-03-14 Ian Lance Taylor <iant@google.com>
3735 * script-sections.cc (Sort_output_sections::script_compare):
3736 Rename from is_before, change return type.
3737 (Sort_output_sections::operator()): Adjust accordingly.
3739 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3742 * testsuite/odr_violation2.cc: Add comment to make all error line
3743 numbers double digits.
3744 * testsuite/debug_msg.sh: Adjust expected errors.
3746 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3748 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3749 but mark earlier ones as non-canonical
3750 (offset_to_iterator): Update search target and example
3751 (do_addr2line): Return extra lines in a vector*
3752 (format_file_lineno): Extract from do_addr2line
3753 (one_addr2line): Add vector* out-param
3754 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3755 when a lineno entry appeared last for its instruction
3756 (Dwarf_line_info): Add vector* out-param
3757 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3758 * symtab.cc (Odr_violation_compare): Include the lineno in the
3760 (linenos_from_loc): New. Combine the canonical line for an
3761 address with its other lines.
3762 (True_if_intersect): New. Helper functor to make
3763 std::set_intersection a query.
3764 (detect_odr_violations): Compare sets of lines instead of just
3765 one line for each function. This became less deterministic, but
3766 has fewer false positives.
3767 * symtab.h: Declarations.
3768 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3769 mix an optimized and non-optimized object in the same binary
3770 (odr_violation2.so): Same.
3771 * testsuite/Makefile.in: Regenerate from Makefile.am.
3772 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3773 * testsuite/debug_msg.sh: Update line numbers and add
3775 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3776 non-optimized context.
3777 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3778 isn't inlined, and use OdrDerived in an optimized context.
3779 * testsuite/odr_header1.h: Defines OdrDerived, where
3780 optimization will change the
3781 first-instruction-in-the-destructor's file and line number.
3782 * testsuite/odr_header2.h: Defines OdrBase.
3784 2011-03-09 Ian Lance Taylor <iant@google.com>
3786 * fileread.cc (File_read::clear_views): Don't delete the whole
3789 2011-03-08 Ian Lance Taylor <iant@google.com>
3792 * fileread.cc: #include <climits>.
3793 (GOLD_IOV_MAX): Define.
3794 (File_read::read_multiple): Limit number of entries by iov_max.
3795 * fileread.h (class File_read): Always set max_readv_entries to
3798 2011-03-07 Ian Lance Taylor <iant@google.com>
3801 * options.h (class General_options): Add -dy and -dn.
3803 2011-03-02 Cary Coutant <ccoutant@google.com>
3805 * testsuite/script_test_9.t: Add TLS segment.
3807 2011-03-02 Simon Baldwin <simonb@google.com>
3809 * configure.ac: Add check for gnu_indirect_function support in
3810 the toolchain building binutils.
3811 * configure: Rebuild.
3813 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3815 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3816 plugin only symbols.
3817 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3818 in plugin files as not needed in the symbol table.
3820 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3822 * output.cc (Output_section::add_input_section): Delay fill
3823 generation for section ordering.
3825 2011-02-09 Ian Lance Taylor <iant@google.com>
3828 * object.h (class Sized_relobj): Remove clear_local_symbols.
3829 * reloc.cc (Sized_relobj::do_relocate): Don't call
3830 clear_local_symbols.
3832 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3834 * plugin.cc (is_visible_from_outside): Return true for symbols
3837 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3839 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3842 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3844 * icf.h (is_section_foldable_candidate): Change type of parameter
3846 * icf.cc (Icf::find_identical_sections): Change type of local variable
3847 section_name to be std::string.
3848 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3850 2011-01-25 Ian Lance Taylor <iant@google.com>
3852 * script.cc (script_add_extern): Rewrite to use
3853 add_symbol_reference.
3855 2011-01-25 Doug Kwan <dougkwan@google.com>
3857 * icf.cc (get_section_contents): Always lock section's object.
3859 2011-01-24 Ian Lance Taylor <iant@google.com>
3861 * options.h (class General_options): Accept
3862 --no-detect-odr-violations.
3864 2011-01-24 Ian Lance Taylor <iant@google.com>
3866 * version.cc (version_string): Bump to 1.11.
3868 2011-01-24 Ian Lance Taylor <iant@google.com>
3870 * plugin.cc (class Plugin_rescan): Define new class.
3871 (Plugin_manager::claim_file): Set any_claimed_.
3872 (Plugin_manager::save_archive): New function.
3873 (Plugin_manager::save_input_group): New function.
3874 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3876 (Plugin_manager::new_undefined_symbol): New function.
3877 (Plugin_manager::rescan): New function.
3878 (Plugin_manager::rescannable_defines): New function.
3879 (Plugin_manager::add_input_file): Set any_added_.
3880 * plugin.h (class Plugin_manager): define new fields rescannable_,
3881 undefined_symbols_, any_claimed_, and any_added_. Declare
3882 Plugin_rescan as friend. Declare new functions.
3883 (Plugin_manager::Rescannable): Define type.
3884 (Plugin_manager::Rescannable_list): Define type.
3885 (Plugin_manager::Undefined_symbol_list): Define type.
3886 (Plugin_manager::Plugin_manager): Initialize new fields.
3887 * archive.cc (Archive::defines_symbol): New function.
3888 (Add_archive_symbols::run): Pass archive to plugins if any.
3889 * archive.h (class Archive): Declare defines_symbol.
3890 * readsyms.cc (Input_group::~Input_group): New function.
3891 (Finish_group::run): Pass input_group to plugins if any.
3892 * readsyms.h (class Input_group): Declare destructor.
3893 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3896 2011-01-10 Ian Lance Taylor <iant@google.com>
3898 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3900 (Layout::set_segment_offsets): Reset increase_relro before calling
3901 set_section_addresses a second time.
3903 2011-01-04 Cary Coutant <ccoutant@google.com>
3905 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3906 sections before NOBITS sections.
3908 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3910 * version.cc (print_version): Update copyright to 2011.
3912 2010-12-23 Cary Coutant <ccoutant@google.com>
3914 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3915 of OS to this->add. Add OD parameter to second form of the function.
3917 2010-12-20 Ian Lance Taylor <iant@google.com>
3919 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3920 second of two consecutive entries with same offset.
3922 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3924 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3925 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3926 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3927 to avoid unneeded links against $(LDADD).
3928 * testsuite/Makefile.in: Regenerate.
3930 2010-12-15 Ian Lance Taylor <iant@google.com>
3933 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3934 for R_X86_64_32 and R_X86_64_PC32.
3935 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3936 ver_matching_def_pic.o.
3937 (ver_matching_def_pic.o): New target.
3939 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3941 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3942 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3943 Move definition before File_read::View member definitions.
3944 (File_read::View::~View): Initialize and hold lock before
3945 updating current_mapped_bytes.
3947 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3949 * dwarf_reader.cc: Remove outdated comment.
3950 * gold-threads.cc: Fix typo in error message.
3951 * archive.cc: Fix typos in comments.
3952 * archive.h: Likewise.
3953 * arm-reloc-property.cc: Likewise.
3954 * arm-reloc-property.h: Likewise.
3955 * arm-reloc.def: Likewise.
3957 * attributes.h: Likewise.
3958 * cref.cc: Likewise.
3959 * ehframe.cc: Likewise.
3960 * fileread.h: Likewise.
3962 * i386.cc: Likewise.
3964 * incremental.h: Likewise.
3965 * int_encoding.cc: Likewise.
3966 * layout.h: Likewise.
3967 * main.cc: Likewise.
3968 * merge.h: Likewise.
3969 * object.cc: Likewise.
3970 * object.h: Likewise.
3971 * options.cc: Likewise.
3972 * readsyms.cc: Likewise.
3973 * reduced_debug_output.cc: Likewise.
3974 * reloc.cc: Likewise.
3975 * script-sections.cc: Likewise.
3976 * sparc.cc: Likewise.
3977 * symtab.h: Likewise.
3978 * target-reloc.h: Likewise.
3979 * target.cc: Likewise.
3980 * target.h: Likewise.
3981 * timer.cc: Likewise.
3982 * timer.h: Likewise.
3983 * x86_64.cc: Likewise.
3985 2010-12-09 Cary Coutant <ccoutant@google.com>
3987 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3989 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3990 parameter; change all callers.
3991 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3992 * options.h (warn_execstack): New option.
3994 2010-12-07 Doug Kwan <dougkwan@google.com>
3996 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3997 like function call relocations.
3999 2010-12-07 Ian Lance Taylor <iant@google.com>
4001 * archive.cc (Archive::get_elf_object_for_member): Permit
4002 punconfigured to be NULL.
4003 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4004 (Archive::include_member): Pass NULL to get_elf_object_for_member
4005 if we searched for the archive and this is the first included
4008 2010-12-01 Ian Lance Taylor <iant@google.com>
4010 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4011 track_relocs_type_ field.
4012 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4013 Set track_relocs_type_.
4014 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4015 contents when using RELA relocs.
4016 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4018 * reloc.cc (Track_relocs::next_addend): New function.
4019 * reloc.h (class Track_relocs): Declare next_addend.
4021 2010-12-01 Ian Lance Taylor <iant@google.com>
4023 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4026 2010-12-01 Ian Lance Taylor <iant@google.com>
4028 * README: Update compilers known to work and fail.
4030 2010-11-23 Matthias Klose <doko@ubuntu.com>
4032 * configure.in: For --enable-gold, handle value `default' instead of
4033 `both*'. Always install ld as ld.bfd, install as ld if gold is
4035 * configure: Regenerate.
4037 2010-11-18 Doug Kwan <dougkwan@google.com>
4039 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4040 and right_alignment to be zero. Store result alignment only if it is
4041 greater than existing alignment.
4043 2010-11-16 Cary Coutant <ccoutant@google.com>
4046 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4047 Check for ".zdebug_line".
4049 2010-11-16 Doug Kwan <dougkwan@google.com>
4050 Cary Coutant <ccoutant@google.com>
4052 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4053 by reference; adjust all callers.
4054 * output.cc (Output_segment::set_section_addresses): Adjust references
4055 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4057 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4058 end at page boundary.
4060 2010-11-16 Cary Coutant <ccoutant@google.com>
4063 * layout.cc (Layout::choose_output_section): Transform names of
4064 compressed sections even when using a script with a SECTIONS clause.
4065 (Layout::output_section_name): Remove code to transform
4066 compressed debug section names.
4067 * output.cc (Output_section::add_input_section): Use uncompressed
4068 section size when tracking input sections.
4070 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4072 * symtab.h (Symbol::NON_PIC_REF): Remove.
4073 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4074 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4075 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4076 (Symbol::use_plt_offset): Take a flags argument and pass it
4077 directly to needs_dynamic_reloc. Restrict check for undefined
4078 weak symbols to function calls.
4079 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4080 (Target_arm::Scan::global): Use it.
4081 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4082 (Target_arm::Relocate::relocate): Likewise.
4083 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4084 parameter with an r_type parameter. Use get_reference_flags
4086 (Target_arm::Relocate::relocate): Update accordingly.
4087 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4088 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4089 (Target_i386::Scan::global): Likewise.
4090 (Target_i386::Relocate::relocate): Likewise.
4091 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4092 parameter with an r_type parameter. Use get_reference_flags
4094 (Target_i386::Relocate::relocate): Update accordingly.
4095 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4096 (Target_powerpc::Scan::global): Use it.
4097 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4098 (Target_powerpc::Relocate::relocate): Likewise.
4099 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4100 (Target_sparc::Scan::global): Use it.
4101 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4102 (Target_sparc::Relocate::relocate): Likewise.
4103 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4104 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4105 (Target_x86_64::Scan::global): Likewise.
4106 (Target_x86_64::Relocate::relocate): Likewise.
4108 2010-11-08 Doug Kwan <dougkwan@google.com>
4109 Cary Coutant <ccoutant@google.com>
4111 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4112 (Arm_exidx_merge_section::section_contents_): New data member.
4113 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4114 (Arm_input_section::~Arm_input_section): De-allocate memory.
4115 (Arm_input_section::original_contents_): New data member.
4116 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4117 in parameters instead of calling Object::section_contents without
4119 (Arm_output_section::group_section): New parameter TASK. Pass it
4120 to callees that need locking objects.
4121 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4122 to lock EXIDX input sections. Fix a formatting issue. Call
4123 Arm_exidx_merged_section::build_contents to create merged section
4125 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4126 to lock object of stub table owner.
4127 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4128 TEXT_SIZE to initialize data member TEXT_SIZE_.
4129 (Arm_exidx_input_section::addralign): Fix typo in comment.
4130 (Arm_exidx_input_section::text_size): New method.
4131 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4132 that require locking objects. Lock objects before scanning for stubs
4133 and updating local symbols.
4134 (Arm_input_section<big_endian>::init): Copy contents of original
4136 (Arm_input_section<big_endian>::do_write): Use saved contents of
4137 original input section instead of calling Object::section_contents
4139 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4140 size without calling Object::section_size().
4141 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4142 for size. Allocate a buffer for merged EXIDX entries.
4143 (Arm_exidx_merged_section::build_contents): New method.
4144 (Arm_exidx_merged_section::do_write): Move merge section contents
4145 building code to Arm_exidx_merged_section::build_contetns. Write
4146 out contetns in buffer instead of building it on the fly.
4147 (Arm_relobj::make_exidx_input_section): Also pass text section size
4148 to Arm_exidx_input_section constructor.
4149 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4150 (Arm_dynobj::do_read_symbols): Fix memory leak.
4151 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4152 * target.h: (class Task): Add forward declaration.
4153 (Target::relax): Add new parameter TASK and pass it to
4155 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4157 2010-11-05 Cary Coutant <ccoutant@google.com>
4160 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4161 object when reading from the file.
4162 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4164 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4165 when reading section contents.
4166 (get_section_contents): Likewise.
4167 (icf::find_identical_sections): Likewise.
4168 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4169 object when reading from the file.
4170 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4171 the object when doing deferred section layout.
4173 2010-11-03 Nick Clifton <nickc@redhat.com>
4176 * script.h (class Symbol_assignment: name): New member. Returns
4177 the name of the symbol.
4178 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4179 Returns true if the given symbol name is on the list of
4180 assignments wating to be processed.
4181 * archive.cc (should_incldue_member): If the symbol is undefined,
4182 check to see if it is on the list of symbols pending assignment.
4184 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4186 * script-sections.cc (Script_sections::find_memory_region): Check
4187 for a NULL output section pointer.
4189 2010-10-29 Doug Kwan <dougkwan@google.com>
4191 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4192 Output_section::add_relaxed_input_section.
4193 * output.cc (Output_section::add_relaxed_input_section): Add new
4194 arguments LAYOUT and NAME. Set section order index.
4195 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4196 Copy section order index.
4197 * output.h (Output_section::add_relaxed_input_section): Add new
4198 arguments LAYOUT and NAME.
4200 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4202 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4203 NATIVE_OR_CROSS_LINKER.
4204 * testsuite/Makefile.in: Regenerate.
4206 2010-10-20 Doug Kwan <dougkwan@google.com>
4208 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4209 without SHF_LINK_ORDER flags.
4210 * layout.cc (Layout::choose_output_section): Do not filter
4211 SHF_LINK_ORDER flag in a relocatable link.
4213 2010-10-17 Cary Coutant <ccoutant@google.com>
4215 * output.h (Output_segment::set_section_addresses): Change function
4216 signature. Update all callers.
4217 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4219 (Output_segment::set_section_addresses): Align after last TLS
4220 section. Add padding before last relro section instead of after.
4222 2010-10-17 Doug Kwan <dougkwan@google.com>
4224 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4225 GOT output section to be writable.
4227 2010-10-14 Cary Coutant <ccoutant@google.com>
4229 * debug.h (DEBUG_INCREMENTAL): New flag.
4230 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4231 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4233 * incremental.cc (report_command_line): Ignore all forms of
4235 * layout.cc (Layout::Layout): Check parameters for incremental link
4237 * options.cc (General_options::parse_incremental): New function.
4238 (General_options::parse_no_incremental): New function.
4239 (General_options::parse_incremental_full): New function.
4240 (General_options::parse_incremental_update): New function.
4241 (General_options::incremental_mode_): New data member.
4242 (General_options::finalize): Check incremental_mode_.
4243 * options.h (General_options): Update help text for --incremental.
4244 Add --no-incremental, --incremental-full, --incremental-update.
4245 (General_options::Incremental_mode): New enum type.
4246 (General_options::incremental_mode): New function.
4247 (General_options::incremental_mode_): New data member.
4248 * parameters.cc (Parameters::incremental_mode_): New data member.
4249 (Parameters::set_options): Set incremental_mode_.
4250 (Parameters::set_incremental_full): New function.
4251 (Parameters::incremental): New function.
4252 (Parameters::incremental_update): New function.
4253 (set_parameters_incremental_full): New function.
4254 * parameters.h (Parameters::set_incremental_full): New function.
4255 (Parameters::incremental): New function.
4256 (Parameters::incremental_update): New function.
4257 (Parameters::incremental_mode_): New data member.
4258 (set_parameters_incremental_full): New function.
4259 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4260 incremental link mode.
4261 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4262 (Sized_relobj::do_relocate_sections): Likewise.
4263 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4265 * testsuite/Makefile.in: Regenerate.
4266 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4268 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4270 * script-sections.h (class Script_sections): Make
4271 Sections_elements typedef public.
4272 * script-sections.cc (class Sort_output_sections): Add elements_
4273 field. Add constructor which sets it; change all callers.
4274 (Sort_output_sections::is_before): New function.
4275 (Sort_output_sections::operator()): Call is_before.
4276 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4278 * testsuite/script_test_10.sh: New test. Test script section
4280 * testsuite/script_test_10.t: Likewise.
4281 * testsuite/script_test_10.s: Likewise.
4282 * testsuite/Makefile.am: Wrap the cross linker tests and the
4283 common tests into NATIVE_OR_CROSS_LINKER.
4284 (check_SCRIPTS): Add script_test_10.sh.
4285 (check_DATA): Add script_test_10.stdout.
4286 (script_test_10.o, script_test_10): New targets.
4287 (script_test_10.stdout): New target.
4288 * configure, testsuite/Makefile.in: Regenerate.
4290 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4292 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4293 error for the deprecated relocations.
4294 (Target_arm::Scan::global): Likewise.
4295 (Target_arm::Relocate::relocate): Likewise.
4297 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4299 * fileread.cc (Input_file::find_file): Initialize *found_name
4300 and *namep when using the fallback search for case 4.
4302 2010-10-11 Cary Coutant <ccoutant@google.com>
4304 * options.h (class General_options): Redefine -z lazy as an alias for
4305 the negation of -z now.
4307 2010-10-11 Ian Lance Taylor <iant@google.com>
4309 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4312 2010-10-06 Nick Clifton <nickc@redhat.com>
4314 * script-sections.cc(class Memory_region): Remove
4315 current_lma_offset_ field. Rename current_vma_offset_ to
4316 current_offset_. Add last_section_ field.
4317 (Memory_region::get_current_vma_address): Rename to
4318 get_current_address.
4319 (Memory_region::get_current_lma_address): Delete.
4320 (Memory_region::increment_vma_offset): Rename to
4322 (Memory_region::increment_lma_offset): Delete.
4323 (Memory_region::attributes_compatible): New method. Returns
4324 true if the provided section is compatible with the region.
4325 (Memory_region::get_last_section): New method. Returns the last
4326 section to use the region.
4327 (Memory_region::set_last_section): New method. Stores the last
4328 section to use the region.
4329 (Script_sections::block_in_region): New method. Returns true if
4330 a block of memory is contained within a region.
4331 (Script_sections::find_memory_region): New method. Locates a
4332 memory region to be used to set a VMA or LMA address.
4333 (Output_section_definition::set_section_addresses): Add code to
4334 check for addresses set by memory regions.
4335 (Output_segment::set_section_addresses): Remove memory region
4337 (Script_sections::create_segment): Add a warning if a header
4338 segment is created outside of any region.
4339 * script-sections.h (class Script_sections): Add prototypes for
4340 find_memory_region and block_in_region methods.
4341 * testsuite/memory_test.s: Use .long instead of .word.
4342 * testsuite/memory_test.t: Add some more output sections.
4343 * testsuite/memory_test.sh: Update expected output.
4345 2010-10-02 Doug Kwan <dougkwan@google.com>
4347 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4348 defintion to symtab.h
4349 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4350 declaration to defintion.
4352 2010-10-01 Nick Clifton <nickc@redhat.com>
4354 * expression.cc (eval): Replace dummy argument with NULL.
4355 (eval_maybe_dot): Check for a NULL result section pointer.
4356 (Symbol_expression::value): Likewise.
4357 (Dot_expression::value): Likewise.
4358 (BINARY_EXPRESSION): Likewise.
4359 (Max_expression::value): Likewise.
4360 (Min_expression::value): Likewise.
4361 (Absolute_expression::value): Likewise.
4362 (Addr_expression::value_from_output_section): Likewise.
4363 (Loaddddr_expression::value_from_output_section): Likewise.
4364 (Segment_start_expression::value): Likewise.
4365 * script-sections.cc
4366 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4368 (Sections_elememt_dot_assignment::set_section_addresses):
4370 (Output_data_expression::do_write_to_buffer): Likewise.
4371 (Output_section_definition::finalize_symbols): Likewise.
4372 (Output_section_definition::set_section_addresses): Likewise.
4374 2010-09-30 Doug Kwan <dougkwan@google.com>
4376 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4378 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4380 * target.h (Target::can_icf_inline_merge_sections): New virtual
4382 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4384 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4386 * icf.cc (get_section_contents): Inline merge sections only when
4389 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4391 * configure: Regenerate.
4393 2010-09-17 Ian Lance Taylor <iant@google.com>
4395 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4396 * testsuite/Makefile.am (memory_test.o): New target.
4397 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4399 * testsuite/Makefile.in: Rebuild.
4401 2010-09-17 Doug Kwan <dougkwan@google.com>
4403 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4404 defintion if relocation uses GOT entries of the symbol.
4405 * testsuite/icf_safe_test.sh: Fix test.
4406 * testsuite/icf_safe_so_test.sh: Fix test.
4408 2010-09-16 Cary Coutant <ccoutant@google.com>
4410 * script_sections.cc (class Memory_region): Remove "NULL" from
4411 vector initializations.
4413 2010-09-15 Cary Coutant <ccoutant@google.com>
4415 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4416 Resolve forwarding symbols.
4418 2010-09-15 Doug Kwan <dougkwan@google.com>
4420 * gold/testsuite/script_test_3.t: Add ARM special sections.
4421 * gold/testsuite/script_test_4.t: Same.
4422 * gold/testsuite/script_test_5.t: Same.
4423 * gold/testsuite/script_test_6.t: Same.
4424 * gold/testsuite/script_test_7.t: Same.
4425 * gold/testsuite/script_test_7.t: Same.
4426 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4428 2010-09-14 Cary Coutant <ccoutant@google.com>
4430 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4431 (Target_x86_64::Relocate::relocate_tls): Replace check for
4432 saw_tls_block_reloc_ with test for executable section.
4434 2010-09-12 Cary Coutant <ccoutant@google.com>
4436 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4437 position-independent executables to shared libraries need dynamic
4439 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4440 position-independent executables.
4441 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4442 * testsuite/Makefile.in: Regenerate.
4444 2010-09-10 Nick Clifton <nickc@redhat.com>
4447 * testsuite/memory_test.t: Discard any sections that are not
4450 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4453 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4454 "This::" to work around a bug in gcc 4.2.
4456 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4458 2010-09-09 Rafael Espindola <espindola@google.com>
4460 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4461 sections with different PF_X flags in the same segment.
4462 (Layout::find_first_load_seg): Search all segments to find the first
4464 * options.h (rosegment): New.
4466 2010-09-08 Rafael Espindola <espindola@google.com>
4468 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4470 2010-09-08 Doug Kwan <dougkwan@google.com>
4472 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4473 (Arm_relobj::do_relocate_sections): Add new parameter for output
4474 file to match the parent.
4475 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4476 of local symbols instead of input values. Update code to track
4477 changes in gold::relocate_section.
4478 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4479 (Sized_relobj::compute_final_local_value_internal): New methods.
4480 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4481 body into private version of Sized_relobj::compute_final_local_value.
4482 Call the inline method.
4483 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4484 merged symbol value if there is one.
4485 (Symbol_value::has_output_value): New method defintiion.
4486 (Sized_relobj::Compute_final_local_value_status): New enum type.
4487 (Sized_relobj::compute_final_local_value): New methods.
4488 (Sized_relobj::compute_final_local_value_internal): New methods.
4489 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4490 and arm_cortex_a8.sh.
4491 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4492 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4494 * Makefile.in: Regenerate.
4495 * testsuite/arm_bl_out_of_range.s: Update test.
4496 * testsuite/thumb_bl_out_of_range.s: Ditto.
4497 * testsuite/thumb_blx_out_of_range.s: Ditto.
4498 * testsuite/arm_branch_out_of_range.sh: New file.
4499 * testsuite/arm_cortex_a8.sh: Ditto.
4500 * testsuite/arm_cortex_a8_b.s: Ditto.
4501 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4502 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4503 * testsuite/arm_cortex_a8_bl.s: Ditto.
4504 * testsuite/arm_cortex_a8_blx.s: Ditto.
4505 * testsuite/arm_cortex_a8_local.s: Ditto.
4506 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4507 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4509 2010-09-08 Rafael Espindola <espindola@google.com>
4511 * Makefile.am (memory_test.stdout): Run readelf with -W.
4512 * Makefile.in: Regenerate.
4513 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4516 2010-09-08 Rafael Espindola <espindola@google.com>
4518 * script-sections.cc (Script_sections::add_memory_region): Convert
4519 field precision to int.
4520 * script.cc (script_set_section_region, script_set_section_region):
4521 Convert field precision to int.
4523 2010-09-08 Rafael Espindola <espindola@google.com>
4525 * arm.cc (do_finalize_sections): Create the __exidx_start and
4526 __exdix_end symbols even when the section is missing.
4528 2010-09-08 Nick Clifton <nickc@redhat.com>
4530 * README: Remove claim that MEMORY is not supported.
4531 * expression.cc (script_exp_function_origin)
4532 (script_exp_function_length): Move from here to ...
4533 * script.cc: ... here.
4534 (script_set_section_region, script_add_memory)
4535 (script_parse_memory_attr, script_include_directive): New
4537 * script-sections.cc
4538 (class Memory_region): New class.
4539 (class Output_section_definition): Add set_memory_region,
4540 set_section_vma, set_section_lma and get_section_name methods.
4541 (class Script_Sections): Add add_memory_region,
4542 find_memory_region, find_memory_region_origin,
4543 find_memory_region_length and set_memory_region methods.
4544 Have set_section_addresses method walk the list of set memory
4546 Extend the print methos to display memory regions.
4547 * script-sections.h: Add prototypes for new methods.
4548 Add enum for MEMORY region attributes.
4549 * yyscript.y: Add support for parsing MEMORY regions.
4550 * script-c.h: Add prototypes for new functions.
4551 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4552 * testsuite/Makefile.in: Regenerate.
4553 * testsuite/memory_test.sh: New script.
4554 * testsuite/memory_test.s: New assembler source file.
4555 * testsuite/memory_test.t: New linker script.
4557 2010-08-27 Doug Kwan <dougkwan@google.com>
4559 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4560 reference override an existing dynamic weak reference.
4561 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4562 * testsuite/Makefile.in: Regenerate.
4563 * testsuite/dyn_weak_ref.sh: New file.
4564 * testsuite/dyn_weak_ref_1.c: Ditto.
4565 * testsuite/dyn_weak_ref_2.c: Ditto.
4567 2010-08-27 Ian Lance Taylor <iant@google.com>
4569 * incremental.h (class Incremental_input_entry): Add virtual
4572 2010-08-27 Ian Lance Taylor <iant@google.com>
4574 * testsuite/start_lib_test_3.c: Mark t3 as used.
4576 2010-08-27 Nick Clifton <nickc@redhat.com>
4578 * options.cc (version_script): Fix small typo in previous
4581 2010-08-25 Nick Clifton <nickc@redhat.com>
4583 * archive.cc: Formatting fixes: Remove whitespace between
4584 typename and following asterisk. Remove whitespace between
4585 function name and opening parenthesis.
4586 * archive.h: Likewise.
4588 * attributes.cc: Likewise.
4589 * attributes.h: Likewise.
4590 * common.cc: Likewise.
4591 * copy-relocs.cc: Likewise.
4592 * dirsearch.h: Likewise.
4593 * dynobj.cc: Likewise.
4594 * ehframe.cc: Likewise.
4595 * ehframe.h: Likewise.
4596 * expression.cc: Likewise.
4597 * fileread.cc: Likewise.
4598 * fileread.h: Likewise.
4600 * gold-threads.cc: Likewise.
4601 * gold.cc: Likewise.
4602 * i386.cc: Likewise.
4604 * incremental-dump.cc: Likewise.
4605 * incremental.cc: Likewise.
4606 * layout.cc: Likewise.
4607 * layout.h: Likewise.
4608 * main.cc: Likewise.
4609 * merge.cc: Likewise.
4610 * merge.h: Likewise.
4611 * object.cc: Likewise.
4612 * object.h: Likewise.
4613 * options.cc: Likewise.
4614 * options.h: Likewise.
4615 * output.cc: Likewise.
4616 * output.h: Likewise.
4617 * plugin.cc: Likewise.
4618 * plugin.h: Likewise.
4619 * powerpc.cc: Likewise.
4620 * reloc.cc: Likewise.
4621 * script-c.h: Likewise.
4622 * script-sections.cc: Likewise.
4623 * script.cc: Likewise.
4624 * stringpool.cc: Likewise.
4625 * symtab.cc: Likewise.
4626 * symtab.h: Likewise.
4627 * target.cc: Likewise.
4628 * timer.cc: Likewise.
4629 * timer.h: Likewise.
4630 * version.cc: Likewise.
4631 * x86_64.cc: Likewise.
4633 2010-08-24 Nick Clifton <nickc@redhat.com>
4636 * layout.cc (segment_precedes): Sort segments by their physical
4637 addresses, if they have been set.
4639 2010-08-23 Cary Coutant <ccoutant@google.com>
4641 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4643 (Lib_group::include_member): Unlock object after deleting its
4645 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4648 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4649 Cary Coutant <ccoutant@google.com>
4651 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4652 constructor, and set_blocker.
4653 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4655 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4656 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4657 * testsuite/Makefile.am (start_lib_test): New test case.
4658 * testsuite/Makefile.in: Regenerate.
4659 * testsuite/start_lib_test_main.c: New file.
4660 * testsuite/start_lib_test_1.c: New file.
4661 * testsuite/start_lib_test_2.c: New file.
4662 * testsuite/start_lib_test_3.c: New file.
4664 2010-08-19 Ian Lance Taylor <iant@google.com>
4666 * Makefile.in: Rebuild with automake 1.11.1.
4667 * aclocal.m4: Likewise.
4668 * testsuite/Makefile.in: Likewise.
4670 2010-08-19 Ian Lance Taylor <iant@google.com>
4673 * i386.cc (class Output_data_plt_i386): Update declarations.
4674 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4675 local_ifuncs_ fields.
4676 (Target_i386::do_plt_section_for_global): New function.
4677 (Target_i386::do_plt_section_for_local): New function.
4678 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4679 parameter; change all callers. Initialize global_ifuncs_ and
4680 local_ifuncs_. If doing a static link define __rel_iplt_start and
4682 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4683 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4684 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4686 (Target_i386::make_plt_section): New function, broken out of
4687 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4688 (Target_i386::make_plt_entry): Call make_plt_section.
4689 (Target_i386::make_local_ifunc_plt_entry): New function.
4690 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4691 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4692 R_386_IRELATIVE to switch.
4693 (Target_i386::Scan::global): Likewise.
4694 (Target_i386::Relocate::relocate): Likewise.
4695 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4697 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4698 (Target_x86_64::do_plt_section_for_global): New function.
4699 (Target_x86_64::do_plt_section_for_local): New function.
4700 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4701 parameter; change all callers. If doing a static link define
4702 __rela_iplt_start and __rela_iplt_end.
4703 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4704 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4705 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4707 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4708 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4710 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4711 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4712 R_X86_64_IRELATIVE to switch.
4713 (Target_x86_64::Scan::global): Likewise.
4714 (Target_x86_64::Relocate::relocate): Likewise.
4715 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4717 * target.h (class Target): Add plt_section_for_global and
4718 plt_section_for_local functions. Add do_plt_section_for_global
4719 and do_plt_section_for_local virtual functions.
4720 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4721 clarifying comments.
4722 (Symbol::use_plt_offset): Handle IFUNC symbol.
4723 * object.cc (Sized_relobj::Sized_relobj): Initialize
4725 (Sized_relobj::local_has_plt_offset): New function.
4726 (Sized_relobj::local_plt_offset): New function.
4727 (Sized_relobj::set_local_plt_offset): New function.
4728 (Sized_relobj::do_count): Handle IFUNC symbol.
4729 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4730 a bit away from input_shndx_ field. Add set_is_func_symbol and
4731 is_ifunc_symbol functions.
4732 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4733 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4734 local_plt_offsets_ field.
4735 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4736 * output.h (class Output_section_data): Add non-const
4737 output_section function.
4738 (class Output_data_got): Update declarations.
4739 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4740 Add use_plt_offset parameter to global and local constructors.
4741 Change all callers. Change local_sym_index_ field to 31 bits.
4742 Change GSYM_CODE and CONSTANT_CODE accordingly.
4743 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4744 doing a static link don't set sh_link field.
4745 (Output_data_got::Got_entry::write): Use PLT offset if
4747 (Output_data_got::add_global_plt): New function.
4748 (Output_data_got::add_local_plt): New function.
4749 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4750 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4751 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4752 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4753 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4755 * testsuite/ifunc-sel.h: New file.
4756 * testsuite/ifuncmain1.c: New file.
4757 * testsuite/ifuncmain1vis.c: New file.
4758 * testsuite/ifuncmod1.c: New file.
4759 * testsuite/ifuncdep2.c: New file.
4760 * testsuite/ifuncmain2.c: New file.
4761 * testsuite/ifuncmain3.c: New file.
4762 * testsuite/ifuncmod3.c: New file.
4763 * testsuite/ifuncmain4.c: New file.
4764 * testsuite/ifuncmain5.c: New file.
4765 * testsuite/ifuncmod5.c: New file.
4766 * testsuite/ifuncmain6pie.c: New file.
4767 * testsuite/ifuncmod6.c: New file.
4768 * testsuite/ifuncmain7.c: New file.
4769 * configure, testsuite/Makefile.in: Rebuild.
4771 2010-08-18 Ian Lance Taylor <iant@google.com>
4774 (Output_section_incremental_inputs::write_input_files): Add cast
4775 to avoid signed/unsigned comparison warning.
4776 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4778 2010-08-12 Cary Coutant <ccoutant@google.com>
4780 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4782 2010-08-13 Ian Lance Taylor <iant@google.com>
4784 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4786 2010-08-12 Cary Coutant <ccoutant@google.com>
4787 Doug Kwan <dougkwan@google.com>
4789 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4790 defintion overrides non-weak undef, remember that the original undef
4792 * symtab.cc (Symbol_table::sized_write_global): For undef without
4793 an original weak binding, set binding to global in output.
4794 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4795 * testsuite/Makefile.in: Regenerate.
4796 * testsuite/strong_ref_weak_def.sh: New file.
4797 * testsuite/strong_ref_weak_def_1.c: Ditto.
4798 * testsuite/strong_ref_weak_def_2.c: Ditto.
4800 2010-08-12 Cary Coutant <ccoutant@google.com>
4802 * testsuite/incremental_test.sh: Rewrite.
4803 * testsuite/incremental_test_1.c: Rewrite.
4804 * testsuite/incremental_test_2.c: Rewrite.
4806 2010-08-12 Cary Coutant <ccoutant@google.com>
4808 * arm.cc (Target_arm::got_size): Add const.
4809 (Target_arm::got_entry_count): New function.
4810 (Target_arm::plt_entry_count): New function.
4811 (Target_arm::first_plt_entry_offset): New function.
4812 (Target_arm::plt_entry_size): New function.
4813 (Output_data_plt_arm::entry_count): New function.
4814 (Output_data_plt_arm::first_plt_entry_offset): New function.
4815 (Output_data_plt_arm::get_plt_entry_size): New function.
4816 * i386.cc (Target_i386::got_size): Add const.
4817 (Target_i386::got_entry_count): New function.
4818 (Target_i386::plt_entry_count): New function.
4819 (Target_i386::first_plt_entry_offset): New function.
4820 (Target_i386::plt_entry_size): New function.
4821 (Output_data_plt_i386::entry_count): New function.
4822 (Output_data_plt_i386::first_plt_entry_offset): New function.
4823 (Output_data_plt_i386::get_plt_entry_size): New function.
4824 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4825 find_incremental_inputs_sections. Dump incremental_got_plt section.
4826 * incremental.cc: Include target.h.
4827 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4828 parameter. Adjust all callers. Find incremental_got_plt section.
4829 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4831 (Output_section_incremental_inputs::set_final_data_size): Calculate
4832 size of incremental_got_plt section.
4833 (Output_section_incremental_inputs::do_write): Write the
4834 incremental_got_plt section.
4835 (Got_plt_view_info): New struct.
4836 (Local_got_offset_visitor): New class.
4837 (Global_got_offset_visitor): New class.
4838 (Global_symbol_visitor_got_plt): New class.
4839 (Output_section_incremental_inputs::write_got_plt): New function.
4840 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4841 Add parameter. Adjust all callers.
4842 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4843 (Incremental_inputs::got_plt_section): New function.
4844 (Incremental_inputs::got_plt_section_): New data member.
4845 (Incremental_got_plt_reader): New class.
4846 * layout.cc (Layout::create_incremental_info_sections): Add the
4847 incremental_got_plt section.
4848 * object.h (Got_offset_list::get_list): New function.
4849 (Got offset_list::for_all_got_offsets): New function.
4850 (Sized_relobj::local_got_offset_list): New function.
4851 * powerpc.cc (Target_powerpc::got_size): Add const.
4852 (Target_powerpc::got_entry_count): New function.
4853 (Target_powerpc::plt_entry_count): New function.
4854 (Target_powerpc::first_plt_entry_offset): New function.
4855 (Target_powerpc::plt_entry_size): New function.
4856 (Output_data_plt_powerpc::entry_count): New function.
4857 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4858 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4859 * sparc.cc (Target_sparc::got_size): Add const.
4860 (Target_sparc::got_entry_count): New function.
4861 (Target_sparc::plt_entry_count): New function.
4862 (Target_sparc::first_plt_entry_offset): New function.
4863 (Target_sparc::plt_entry_size): New function.
4864 (Output_data_plt_sparc::entry_count): New function.
4865 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4866 (Output_data_plt_sparc::get_plt_entry_size): New function.
4867 * symtab.h (Symbol::got_offset_list): New function.
4868 (Symbol_table::for_all_symbols): New function.
4869 * target.h (Sized_target::got_entry_count): New function.
4870 (Sized_target::plt_entry_count): New function.
4871 (Sized_target::plt_entry_size): New function.
4872 * x86_64.cc (Target_x86_64::got_size): Add const.
4873 (Target_x86_64::got_entry_count): New function.
4874 (Target_x86_64::plt_entry_count): New function.
4875 (Target_x86_64::first_plt_entry_offset): New function.
4876 (Target_x86_64::plt_entry_size): New function.
4877 (Output_data_plt_x86_64::entry_count): New function.
4878 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4879 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4881 2010-08-12 Cary Coutant <ccoutant@google.com>
4883 * archive.cc: Include incremental.h.
4884 (Archive::Archive): Initialize incremental_info_.
4885 (Archive::include_member): Record archive members in incremental info.
4886 (Add_archive_symbols::run): Record begin and end of an archive in
4888 (Lib_group::include_member): Record objects in incremental info.
4889 * archive.h (Incremental_archive_entry): Forward declaration.
4890 (Archive::set_incremental_info): New member function.
4891 (Archive::incremental_info): New member function.
4892 (Archive::Unused_symbol_iterator): New class.
4893 (Archive::unused_symbols_begin): New member function.
4894 (Archive::unused_symbols_end): New member function.
4895 (Archive::incremental_info_): New data member.
4896 * incremental-dump.cc (find_input_containing_global): New function.
4897 (dump_incremental_inputs): Dump new incremental info sections.
4898 * incremental.cc: Include symtab.h.
4899 (Output_section_incremental_inputs): New class.
4900 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4901 new incremental info sections.
4902 (Sized_incremental_binary::do_check_inputs): Likewise.
4903 (Incremental_inputs::report_archive): Remove.
4904 (Incremental_inputs::report_archive_begin): New function.
4905 (Incremental_inputs::report_archive_end): New function.
4906 (Incremental_inputs::report_object): New function.
4907 (Incremental_inputs::finalize_inputs): Remove.
4908 (Incremental_inputs::report_input_section): New function.
4909 (Incremental_inputs::report_script): Rewrite.
4910 (Incremental_inputs::finalize): Do nothing but finalize string table.
4911 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4912 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4913 (Incremental_inputs::create_data_sections): New function.
4914 (Incremental_inputs::relocs_entsize): New function.
4915 (Output_section_incremental_inputs::set_final_data_size): New function.
4916 (Output_section_incremental_inputs::do_write): New function.
4917 (Output_section_incremental_inputs::write_header): New function.
4918 (Output_section_incremental_inputs::write_input_files): New function.
4919 (Output_section_incremental_inputs::write_info_blocks): New function.
4920 (Output_section_incremental_inputs::write_symtab): New function.
4921 * incremental.h (Incremental_script_entry): Forward declaration.
4922 (Incremental_object_entry): Forward declaration.
4923 (Incremental_archive_entry): Forward declaration.
4924 (Incremental_inputs): Forward declaration.
4925 (Incremental_inputs_header_data): Remove.
4926 (Incremental_inputs_header): Remove.
4927 (Incremental_inputs_header_write): Remove.
4928 (Incremental_inputs_entry_data): Remove.
4929 (Incremental_inputs_entry): Remove.
4930 (Incremental_inputs_entry_write): Remove.
4931 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4932 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4933 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4934 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4936 (Incremental_input_entry): New class.
4937 (Incremental_script_entry): New class.
4938 (Incremental_object_entry): New class.
4939 (Incremental_archive_entry): New class.
4940 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4941 (Incremental_inputs::report_inputs): Remove.
4942 (Incremental_inputs::report_archive): Remove.
4943 (Incremental_inputs::report_archive_begin): New function.
4944 (Incremental_inputs::report_archive_end): New function.
4945 (Incremental_inputs::report_object): Change prototype.
4946 (Incremental_inputs::report_input_section): New function.
4947 (Incremental_inputs::report_script): Change prototype.
4948 (Incremental_inputs::get_reloc_count): New function.
4949 (Incremental_inputs::set_reloc_count): New function.
4950 (Incremental_inputs::create_data_sections): New function.
4951 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4952 (Incremental_inputs::inputs_section): New function.
4953 (Incremental_inputs::symtab_section): New function.
4954 (Incremental_inputs::relocs_section): New function.
4955 (Incremental_inputs::get_stringpool): Add const.
4956 (Incremental_inputs::command_line): Add const.
4957 (Incremental_inputs::inputs): Remove.
4958 (Incremental_inputs::command_line_key): New function.
4959 (Incremental_inputs::input_file_count): New function.
4960 (Incremental_inputs::input_files): New function.
4961 (Incremental_inputs::relocs_entsize): New function.
4962 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4963 (Incremental_inputs::finalize_inputs): Remove.
4964 (Incremental_inputs::Input_info): Remove.
4965 (Incremental_inputs::lock_): Remove.
4966 (Incremental_inputs::inputs_): Change type.
4967 (Incremental_inputs::inputs_map_): Remove.
4968 (Incremental_inputs::current_object_entry_): New data member.
4969 (Incremental_inputs::inputs_section_): New data member.
4970 (Incremental_inputs::symtab_section_): New data member.
4971 (Incremental_inputs::relocs_section_): New data member.
4972 (Incremental_inputs::reloc_count_): New data member.
4973 (Incremental_inputs_reader): New class.
4974 (Incremental_symtab_reader): New class.
4975 (Incremental_relocs_reader): New class.
4976 * layout.cc (Layout::finalize): Move finalization of incremental info
4977 and creation of incremental info sections to follow finalization of
4978 symbol table. Set offsets for postprocessing sections.
4979 (Layout::create_incremental_info_sections): Call
4980 Incremental_inputs::create_data_sections. Add incremental symtab
4981 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4982 sections to layout after input sections.
4983 * layout.h (struct Timespec): Forward declaration.
4984 (Layout::incremental_inputs): Add const.
4985 (Layout::create_incremental_info_sections): Add parameter.
4986 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4987 * object.cc: Include incremental.h.
4988 (Relobj::finalize_incremental_relocs): New function.
4989 (Sized_relobj::do_layout): Record input sections in incremental info.
4990 * object.h (Object::output_section): New function.
4991 (Object::output_section_offset): Moved from Relobj.
4992 (Object::get_incremental_reloc_base): New function.
4993 (Object::get_incremental_reloc_count): New function.
4994 (Object::do_output_section): New function.
4995 (Object::do_output_section_offset): Moved from Relobj.
4996 (Object::do_get_incremental_reloc_base): New function.
4997 (Object::do_get_incremental_reloc_count): New function.
4998 (Object::Object): Initialize new data members.
4999 (Relobj::output_section): Renamed do_output_section and moved to
5001 (Relobj::output_section_offset): Moved to Object.
5002 (Relobj::do_get_incremental_reloc_base): New function.
5003 (Relobj::do_get_incremental_reloc_count): New function.
5004 (Relobj::allocate_incremental_reloc_counts): New function.
5005 (Relobj::count_incremental_reloc): New function.
5006 (Relobj::finalize_incremental_relocs): New function.
5007 (Relobj::next_incremental_reloc_index): New function.
5008 (Relobj::reloc_counts_): New data member.
5009 (Relobj::reloc_bases_): New data member.
5010 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5011 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5012 (Sized_relobj::incremental_relocs_scan): New function.
5013 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5014 (Sized_relobj::incremental_relocs_write): New function.
5015 (Sized_relobj::incremental_relocs_write_reltype): New function.
5016 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5018 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5019 archives and object files elsewhere.
5020 (Add_symbols::run): Report object files here.
5021 (Finish_group::run): Report end of archive at end of group.
5022 * reloc.cc: Include layout.h, incremental.h.
5023 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5024 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5025 (Sized_relobj::incremental_relocs_scan): New function.
5026 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5027 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5028 (Sized_relobj::incremental_relocs_write): New function.
5029 (Sized_relobj::incremental_relocs_write_reltype): New function.
5030 * script.cc (read_input_script): Rewrite test for incremental link.
5031 Change call to Incremental_inputs::report_script.
5032 * symtab.h (Symbol_table::first_global_index): New function.
5033 (Symbol_table::output_count): New function.
5035 2010-08-12 Doug Kwan <dougkwan@google.com>
5037 * arm.cc (Target_arm::merge_object_attributes): Check command line
5038 options --no-wchar-size-warning and --no-enum-size-warning.
5039 * options.h (General_options): Add ld-compatible options
5040 --no-enum-size-warning and --no-wchar-size-warning.
5042 2010-08-04 Ian Lance Taylor <iant@google.com>
5044 * x86_64.cc (Target_x86_64::Scan::local): Use
5045 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5046 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5047 (Target_x86_64::Scan::global): Likewise.
5048 (Target_x86_64::Relocate::relocate): Likewise.
5049 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5052 2010-08-03 Cary Coutant <ccoutant@google.com>
5054 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5055 to reserve space in merged_strings vector. Keep total input size
5057 (Output_merge_string::do_print_merge_stats): Print total input size.
5058 * merge.h (Output_merge_string): Add input_size_ field.
5059 * stringpool.cc (Stringpool_template::string_length): Move
5060 implementations out of Stringpool_template class and place in
5062 * stringpool.h (string_length): Move out of Stringpool_template.
5064 2010-08-03 Ian Lance Taylor <iant@google.com>
5067 * layout.cc (relaxation_loop_body): If address of load segment is
5068 set, adjust address to include headers if possible.
5070 2010-08-03 Ian Lance Taylor <iant@google.com>
5072 * version.cc (version_string): Bump to 1.10.
5074 2010-08-03 Ian Lance Taylor <iant@google.com>
5077 * layout.h (enum Output_section_order): Define.
5078 (class Layout): Update declarations.
5079 * layout.cc (Layout::get_output_section): Add order parameter.
5080 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5081 is_first_non_relro parameters. Change all callers.
5082 (Layout::choose_output_section): Likewise.
5083 (Layout::add_output_section_data): Likewise.
5084 (Layout::make_output_section): Likewise. Set order.
5085 (Layout::default_section_order): New function.
5086 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5087 * output.cc (Output_section::Output_section): Initialize order_.
5088 Don't initialize deleted fields.
5089 (Output_segment::Output_segment): Don't initialize deleted
5091 (Output_segment::add_output_section_to_load): New function
5092 replacing add_output_section. Change all callers to call this or
5093 add_output_section_to_nonload.
5094 (Output_segment::add_output_section_to_nonload): New function.
5095 (Output_segment::remove_output_section): Rewrite.
5096 (Output_segment::add_initial_output_data): Likewise.
5097 (Output_segment::has_any_data_sections): Likewise.
5098 (Output_segment::is_first_section_relro): Likewise.
5099 (Output_segment::maximum_alignment): Likewise.
5100 (Output_segment::has_dynamic_reloc): New function replacing
5101 dynamic_reloc_count. Change all callers.
5102 (Output_segment::has_dynamic_reloc_list): New function replacing
5103 dynamic_reloc_count_list. Change all callers.
5104 (Output_segment::set_section_addresses): Rewrite.
5105 (Output_segment::set_offset): Rewrite.
5106 (Output_segment::find_first_and_last_list): Remove.
5107 (Output_segment::set_tls_offsets): Rewrite.
5108 (Output_segment::first_section_load_address): Likewise.
5109 (Output_segment::output_section_count): Likewise.
5110 (Output_segment::section_with_lowest_load_address): Likewise.
5111 (Output_segment::write_section_headers): Likewise.
5112 (Output_segment::print_sections_to_map): Likewise.
5113 * output.h (class Output_data): Remove dynamic_reloc_count_
5114 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5115 (Output_data::add_dynamic_reloc): Rewrite.
5116 (Output_data::has_dynamic_reloc): New function.
5117 (Output_data::dynamic_reloc_count): Remove.
5118 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5119 is_last_relro_, is_first_non_relro_, is_interp_,
5120 is_dynamic_linker_section_ fields. Add order and set_order
5121 functions. Remove is_relro_local, set_is_relro_local,
5122 is_last_relro, set_is_last_relro, is_first_non_relro,
5123 set_is_first_non_relro functions, is_interp, set_is_interp,
5124 is_dynamic_linker_section, and set_is_dynamic_linker_section
5126 (class Output_segment): Change Output_data_list from std::list to
5127 std:;vector. Add output_lists_ field. Remove output_data_ and
5128 output_bss_ fields. Update declarations.
5130 2010-08-02 Ian Lance Taylor <iant@google.com>
5132 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5133 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5134 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5136 2010-08-02 Ian Lance Taylor <iant@google.com>
5139 * script.cc (Script_options::Script_options): Initialize
5140 symbol_definitions_ and symbol_references_.
5141 (Script_options::add_symbol_assignment): Update
5142 symbol_definitions_ and symbol_references_.
5143 (Script_options::add_symbol_reference): New function.
5144 (script_symbol): New function.
5145 * script.h (class Script_options): Add symbol_definitions_ and
5146 symbol_references_ fields.
5147 (Script_options::referenced_const_iterator): New type.
5148 (Script_options::referenced_begin): New function.
5149 (Script_options::referenced_end): New function.
5150 (Script_options::is_referenced): New function.
5151 (Script_options::any_unreferenced): New function.
5152 * script-c.h (script_symbol): Declare.
5153 * yyscript.y (exp): Call script_symbol.
5154 * symtab.cc: Include "script.h".
5155 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5156 Change all callers. Check symbols referenced by scripts.
5157 (Symbol_table::add_undefined_symbols_from_command_line): Add
5158 layout parameter. Change all callers.
5159 (Symbol_table::do_add_undefined_symbols_from_command_line):
5160 Likewise. Break out loop body. Check symbols referenced by
5162 (Symbol_table::add_undefined_symbol_from_command_line): New
5163 function broken out of
5164 do_add_undefined_symbols_from_command_line.
5165 * symtab.h (class Symbol_table): Update declarations.
5166 * archive.cc: Include "layout.h".
5167 (Archive::should_include_member): Add layout parameter. Change
5168 all callers. Check for symbol mentioned in expression.
5169 * archive.h (class Archive): Update declaration.
5170 * object.cc (Sized_relobj::do_should_include_member): Add layout
5172 * object.h (Object::should_include_member): Add layout parameter.
5174 (Object::do_should_include_member): Add layout parameter.
5175 (class Sized_relobj): Update declaration.
5176 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5178 * dynobj.h (class Sized_dynobj): Update declaration.
5179 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5181 * plugin.h (class Sized_pluginobj): Update declaration.
5183 2010-08-02 Ian Lance Taylor <iant@google.com>
5186 * output.cc (Output_segment::set_offset): Search for the first and
5187 last sections rather than assuming that the list is in order.
5188 (Output_segment::find_first_and_last_list): New function.
5189 * output.h (class Output_segment): Update declarations.
5190 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5191 (relro_strip_test_SOURCES): New variable.
5192 (relro_strip_test_DEPENDENCIES): New variable.
5193 (relro_strip_test_LDFLAGS): New variable.
5194 (relro_strip_test_LDADD): New variable.
5195 (relro_strip_test.so): New target.
5197 2010-08-02 Ian Lance Taylor <iant@google.com>
5199 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5200 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5201 (Target_i386::got_tlsdesc_section): New function.
5202 (Target_i386::got_section): Create space for GOT entries for
5203 TLSDESC relocations.
5204 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5206 (Target_i386::Scan::global): Likewise.
5207 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5209 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5210 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5211 (Target_x86_64::got_tlsdesc_section): New function.
5212 (Target_x86_64::got_section): Create space for GOT entries for
5213 TLSDESC relocations.
5214 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5216 (Target_x86_64::Scan::global): Likewise.
5217 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5220 2010-08-02 Ian Lance Taylor <iant@google.com>
5222 * testsuite/final_layout.sh: Use dc to convert from hex to
5225 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5227 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5228 paramter to the call to gold::gc_process_relocs.
5229 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5230 paramter to the call to gold::gc_process_relocs.
5231 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5232 parameter to the call to gold::gc_process_relocs.
5233 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5234 template parameter to the call to gold::gc_process_relocs.
5235 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5236 paramter to the call to gold::gc_process_relocs.
5237 * gc.h (get_embedded_addend_size): New function.
5238 (gc_process_relocs): Save the size of the reloc for use by ICF.
5239 * icf.cc (get_section_contents): Get the addend from the text section
5240 for SHT_REL relocation sections.
5241 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5242 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5243 * int_encoding.h (read_from_pointer): New overloaded function.
5244 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5245 * testsuite/icf_sht_rel_addend_test.sh: New file.
5246 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5247 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5249 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5251 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5252 * Makefile.in: Regenerate.
5253 * testsuite/Makefile.in: Regenerate.
5255 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5257 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5258 * gold/testsuite/debug_msg.cc: Likewise.
5259 * gold/testsuite/odr_violation1.cc
5260 * gold/testsuite/odr_violation2.cc
5262 2010-07-21 Cary Coutant <ccoutant@google.com>
5264 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5265 string, and length fields.
5266 (Output_merge_string::Merged_strings_list): New type.
5267 (Output_merge_string::Merged_strings_lists): New typedef.
5268 (Output_merge_string): Replace merged_strings_ with
5269 merged_strings_lists_.
5270 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5271 Merged_strings_list per input object and section. Don't store pointer
5272 to the string. Don't store length with each merged string entry.
5273 (Output_merge_string::finalize_merged_data): Loop over list of merged
5274 strings lists. Recompute length of each merged string.
5276 2010-07-15 Cary Coutant <ccoutant@google.com>
5278 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5281 2010-07-14 Ian Lance Taylor <iant@google.com>
5283 * descriptors.cc (Descriptors::open): Report correct name in error
5286 2010-07-13 Doug Kwan <dougkwan@google.com>
5288 * arm.cc (Arm_input_section::Arm_input_section): For a
5289 SHT_ARM_EXIDX section, always keeps the input sections.
5290 (Arm_input_section::set_exidx_section_link): New method.
5291 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5292 has_errors_ to false.
5293 (Arm_exidx_input_section::has_errors,
5294 Arm_exidx_input_section::set_has_errors): New methods.
5295 (Arm_exidx_input_section::has_errors_): New data member.
5296 (Arm_relobj::get_exidx_shndx_list): New method.
5297 (Arm_output_section::append_text_sections_to_list): Do not skip
5298 section without SHF_EXECINSTR.
5299 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5301 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5302 section header. Make error messages more verbose. Check for
5303 a non-executable section linked to an EXIDX section.
5304 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5305 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5306 check that there is no deferred EXIDX section if we exit early.
5307 Instead of not making an EXIDX section in case of an error, make one
5308 and set the has_errors flag of it.
5309 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5310 in a relocatable link.
5311 (Target_arm::do_relax): Look for the EXIDX output section instead of
5312 assuming that it is called .ARM.exidx.
5313 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5314 section list. Do not check for SHF_EXECINSTR section flags but
5315 skip any input section with errors.
5316 * output.cc (Output_section::Output_section): Initialize
5317 always_keeps_input_sections_ to false.
5318 (Output_section::add_input_section): Check for
5319 always_keeps_input_sections_.
5320 * output.h (Output_section::always_keeps_input_sections,
5321 Output_section::set_always_keeps_input_sections): New methods.
5322 (Output_section::always_keeps_input_sections): New data member.
5324 2010-07-13 Rafael Espindola <espindola@google.com>
5326 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5327 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5329 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5330 Ian Lance Taylor <iant@google.com>
5332 * output.h (Output_section_lookup_maps::add_merge_section):
5333 Correct check of whether value was inserted.
5334 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5335 (Output_section_lookup_maps::add_relaxed_input_section):
5337 * arm.cc (Target_arm::got_section): Remove used local os.
5338 * i386.cc (Target_i386::got_section): Likewise.
5339 * x86_64.cc (Target_x86_64::got_section): Likewise.
5340 * sparc.cc (Target_sparc::got_section): Likewise.
5341 (Target_sparc::relocate): Remove unused local have_got_offset.
5342 * powerpc.cc (Target_powerpc::relocate): Likewise.
5344 2010-07-13 Ian Lance Taylor <iant@google.com>
5346 * compressed_output.cc (zlib_decompress): Fix signature in
5349 * archive.cc (Archive::include_member): Unlock an external member
5350 of a thin archive. Don't bother to delete an object we know is
5353 2010-07-12 Cary Coutant <ccoutant@google.com>
5355 * compressed_output.cc (zlib_decompress): New function.
5356 (get_uncompressed_size): New function.
5357 (decompress_input_section): New function.
5358 * compressed_output.h (get_uncompressed_size): New function.
5359 (decompress_input_section): New function.
5360 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5361 Handle compressed debug sections.
5362 * layout.cc (is_compressed_debug_section): New function.
5363 (Layout::output_section_name): Map compressed section names to
5365 * layout.h (is_compressed_debug_section): New function.
5366 (is_debug_info_section): Recognize compressed debug sections.
5367 * merge.cc: Include compressed_output.h.
5368 (Output_merge_data::do_add_input_section): Handle compressed
5370 (Output_merge_string::do_add_input_section): Handle compressed
5372 * object.cc: Include compressed_output.h.
5373 (Sized_relobj::Sized_relobj): Initialize new data members.
5374 (build_compressed_section_map): New function.
5375 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5376 * object.h (Object::section_is_compressed): New method.
5377 (Object::do_section_is_compressed): New method.
5378 (Sized_relobj::Compressed_section_map): New type.
5379 (Sized_relobj::do_section_is_compressed): New method.
5380 (Sized_relobj::compressed_sections_): New data member.
5381 * output.cc (Output_section::add_input_section): Handle compressed
5383 * reloc.cc: Include compressed_output.h.
5384 (Sized_relobj::write_sections): Handle compressed debug sections.
5386 2010-07-08 Cary Coutant <ccoutant@google.com>
5388 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5389 weak when resolving to a dynamic def.
5390 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5391 for weak undef/dynamic def cases. Adjust callers.
5392 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5393 undef_binding_weak_.
5394 (Symbol_table::sized_write_globals): Adjust symbol binding.
5395 (Symbol_table::sized_write_symbol): Add binding parameter.
5396 * symtab.h (Symbol::set_undef_binding): New method.
5397 (Symbol::is_undef_binding_weak): New method.
5398 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5399 (Symbol_table::should_override): Add new parameter.
5400 (Symbol_table::sized_write_symbol): Add new parameter.
5402 * testsuite/weak_undef_file1.cc: Add new test case.
5403 * testsuite/weak_undef_file2.cc: Fix header comment.
5404 * testsuite/weak_undef_test.cc: Add new test case.
5406 2010-06-29 Doug Kwan <dougkwan@google.com>
5408 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5409 Initialize USE_SYMBOL_.
5410 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5412 (Arm_reloc_property::uses_symbol_): New data member declaration.
5413 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5414 uses symbol value and symbol is undefined but not weakly undefined.
5416 2010-06-28 Rafael Espindola <espindola@google.com>
5418 * plugin.cc (Plugin::load): Use dlerror.
5420 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5422 * symtab.cc (detect_odr_violations): When reporting an ODR
5423 violation, report an object where the symbol is defined.
5425 2010-06-25 Doug Kwan <dougkwan@google.com>
5427 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5428 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5430 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5431 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5432 target hook to detect function points.
5433 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5434 * icf.h (Icf::check_section_for_function_pointers): Change type of
5435 parameter SECTION_NAME to const reference to std::string. Use
5436 target hook to determine if section may have unsafe pointers.
5437 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5440 2010-06-21 Rafael Espindola <espindola@google.com>
5442 * fileread.cc (Input_file::find_fie): New
5443 (Input_file::open): Use Input_file::find_fie.
5444 * fileread.h (Input_file::find_fie): New
5445 * plugin.cc (set_extra_library_path): New.
5446 (Plugin::load): Add set_extra_library_path to the transfer vector.
5447 (Plugin_manager::set_extra_library_path): New.
5448 (Plugin_manager::add_input_file): Use the extra search path if set.
5449 (set_extra_library_path(): New.
5450 * plugin.h (Plugin_manager): Add set_extra_library_path and
5453 2010-06-19 Cary Coutant <ccoutant@google.com>
5455 * layout.cc (gdb_sections): Add .debug_types.
5456 (lines_only_debug_sections): Likewise.
5458 2010-06-18 Rafael Espindola <espindola@google.com>
5460 * plugin.cc (add_input_file,add_input_library)
5461 (Plugin_manager::add_input_file): Make filename arguments const.
5462 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5465 2010-06-16 Doug Kwan <dougkwan@google.com>
5467 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5468 .ARM.attributes section if we have not merged any input
5469 attributes sections.
5471 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5473 * arm.cc: Allow combining objects with no EABI version
5476 2010-06-15 Rafael Espindola <espindola@google.com>
5478 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5480 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5482 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5483 (struct iovec): Correct !HAVE_READV definition.
5485 2010-06-10 Cary Coutant <ccoutant@google.com>
5487 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5488 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5490 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5493 * symtab.h (Symbol::is_placeholder): New member function.
5494 * target-reloc.h (relocate_section): Check for placeholder symbols.
5496 * testsuite/Makefile.am (plugin_test_8): New test.
5497 (plugin_test_9): New test.
5498 * testsuite/Makefile.in: Regenerate.
5500 2010-06-09 Nick Clifton <nickc@redhat.com>
5502 * yyscript.y (input_list_element): Allow strings prefixed with
5503 the '-' character. Treat these as libraries.
5504 * script.cc (script_add_library): New function. Adds a library
5505 specified by "-l<name>" found in an input script.
5506 * script-c.h: Add prototype for script_add_library.
5508 2010-06-07 Doug Kwan <dougkwan@google.com>
5510 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5511 Restrict stub-group size to be within long conditional branch
5512 range when working around cortex-A8 erratum.
5514 2010-06-07 Damien Diederen <dd@crosstwine.com>
5516 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5519 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5523 (Output_section::Input_section_sort_entry::compare_section_ordering):
5524 Change to return non-zero correctly.
5525 (Output_section::Input_section_sort_section_order_index_compare
5526 ::operator()): Change to fix ambiguity in comparisons.
5528 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5530 * gold.h (is_wildcard_string): New function.
5531 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5532 (Layout::layout_eh_frame): Ditto.
5533 (Layout::find_section_order_index): New method.
5534 (Layout::read_layout_from_file): New method.
5535 * layout.h (Layout::find_section_order_index): New method.
5536 (Layout::read_layout_from_file): New method.
5537 (Layout::input_section_position_): New private member.
5538 (Layout::input_section_glob_): New private member.
5539 * main.cc (main): Call read_layout_from_file here.
5540 * options.h (--section-ordering-file): New option.
5541 * output.cc (Output_section::input_section_order_specified_): New
5543 (Output_section::Output_section): Initialize new member.
5544 (Output_section::add_input_section): Add new parameter.
5545 Keep input sections when --section-ordering-file is used.
5546 (Output_section::set_final_data_size): Sort input sections when
5547 section ordering file is specified.
5548 (Output_section::Input_section_sort_entry): Add new parameter.
5550 (Output_section::Input_section_sort_entry::compare_section_ordering):
5552 (Output_section::Input_section_sort_compare::operator()): Change to
5553 consider section_order_index.
5554 (Output_section::Input_section_sort_init_fini_compare::operator()):
5555 Change to consider section_order_index.
5556 (Output_section::Input_section_sort_section_order_index_compare
5557 ::operator()): New method.
5558 (Output_section::sort_attached_input_sections): Change to sort
5559 according to section order when specified.
5560 (Output_section::add_input_section<32, true>): Add new parameter.
5561 (Output_section::add_input_section<64, true>): Add new parameter.
5562 (Output_section::add_input_section<32, false>): Add new parameter.
5563 (Output_section::add_input_section<64, false>): Add new parameter.
5564 * output.h (Output_section::add_input_section): Add new parameter.
5565 (Output_section::input_section_order_specified): New
5567 (Output_section::set_input_section_order_specified): New method.
5568 (Input_section::Input_section): Initialize section_order_index_.
5569 (Input_section::section_order_index): New method.
5570 (Input_section::set_section_order_index): New method.
5571 (Input_section::section_order_index_): New member.
5572 (Input_section::Input_section_sort_section_order_index_compare): New
5574 (Output_section::input_section_order_specified_): New member.
5575 * script-sections.cc (is_wildcard_string): Delete and move modified
5577 (Output_section_element_input::Output_section_element_input): Modify
5578 call to is_wildcard_string.
5579 (Output_section_element_input::Input_section_pattern
5580 ::Input_section_pattern): Ditto.
5581 (Output_section_element_input::Output_section_element_input): Ditto.
5582 * testsuite/Makefile.am (final_layout): New test case.
5583 * testsuite/Makefile.in: Regenerate.
5584 * testsuite/final_layout.cc: New file.
5585 * testsuite/final_layout.sh: New file.
5587 2010-06-01 Rafael Espindola <espindola@google.com>
5589 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5591 2010-06-01 Rafael Espindola <espindola@google.com>
5593 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5594 visibility of symbols.
5596 2010-05-27 Doug Kwan <dougkwan@google.com>
5598 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5599 from start of output section instead of address for a local symbol
5600 in a merged or relaxed section when doing a relocatable link.
5602 2010-05-26 Rafael Espindola <espindola@google.com>
5605 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5606 adding sections the garbage collector removed.
5607 * gold/testsuite/Makefile.am: Add test.
5608 * gold/testsuite/Makefile.in: Regenerate.
5609 * gold/testsuite/plugin_test_7.sh: New.
5610 * gold/testsuite/plugin_test_7_1.c: New.
5611 * gold/testsuite/plugin_test_7_2.c: New.
5613 2010-05-26 Rafael Espindola <espindola@google.com>
5615 * script-sections.cc (Output_section_definition::set_section_addresses):
5616 Check for --section-start.
5618 2010-05-26 Doug Kwan <dougkwan@google.com>
5620 * arm.cc (Arm_scan_relocatable_relocs): New class.
5621 (Target_arm::relocate_special_relocatable): New method.
5622 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5623 (Arm_relocate_functions::thumb_branch_common): Same.
5624 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5625 instead of Default_scan_relocatable_relocs.
5626 * target-reloc.h (relocate_for_relocatable): Let target handle
5627 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5628 * target.h (Sized_target::relocate_special_relocatable): New method.
5630 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5632 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5634 2010-05-23 Doug Kwan <dougkwan@google.com>
5636 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5638 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5639 with a direct branch, not a conditional branch, to a stub.
5640 * merge.cc (Output_merge_base::record_input_section): New method
5642 (Output_merge_data::do_add_input_section): Record input section if
5643 keeps-input-sections flag is set.
5644 (Output_merge_string::do_add_input_section): Ditto.
5645 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5646 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5648 (Output_merge_base::keeps_input_sections,
5649 Output_merge_base::set_keeps_input_sections,
5650 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5652 (Output_merge_base::Input_sections): New type declaration.
5653 (Output_merge_base::input_sections_begin,
5654 Output_merge_base::input_sections_end,
5655 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5656 (Output_merge_base::bool keeps_input_sections_,
5657 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5658 Output_merge_base::input_sections_): New data members.
5659 (Output_merge_data::do_set_keeps_input_sections): New method
5661 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5662 * output.cc (Output_section::Input_section::relobj): Move method
5663 defintion from class declaration to here and handle merge sections.
5664 (Output_section::Input_section::shndx): Ditto.
5665 (Output_section::Output_section): Remove initializations of removed
5666 data members and initialize new data member LOOKUP_MAPS_.
5667 (Output_section::add_input_section): Set keeps-input-sections flag
5668 for a newly created merge output section as appropriate. Adjust code
5669 to use Output_section_lookup_maps class.
5670 (Output_section::add_relaxed_input_section): Adjst code for lookup
5671 maps code refactoring.
5672 (Output_section::add_merge_input_section): Add a new parameter
5673 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5674 class. If adding input section to a newly created merge output
5675 section fails, remove the new merge section.
5676 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5677 Adjust code for use of the Output_section_lookup_maps class.
5678 (Output_section::find_merge_section): Ditto.
5679 (Output_section::build_lookup_maps): New method defintion.
5680 (Output_section::find_relaxed_input_section): Adjust code to use
5681 Output_section_lookup_maps class.
5682 (Output_section::get_input_sections): Export merge sections. Adjust
5683 code to use Output_section_lookup_maps class.
5684 (Output_section:::add_script_input_section): Adjust code to use
5685 Output_section_lookup_maps class. Update lookup maps for merge
5687 (Output_section::discard_states): Use Output_section_lookup_maps.
5688 (Output_section::restore_states): Same.
5689 * output.h (Merge_section_properties): Move class defintion out of
5691 (Output_section_lookup_maps): New class.
5692 (Output_section::Input_section::is_merge_section): New method
5694 (Output_section::Input_section::relobj): Move defintion out of class
5695 defintion. Declare method only.
5696 (Output_section::Input_section::shndx): Ditto.
5697 (Output_section::Input_section::output_merge_base): New method defintion.
5698 (Output_section::Input_section::u2_.pomb): New union field.
5699 (Output_section::Merge_section_by_properties_map,
5700 Output_section::Output_section_data_by_input_section_map,
5701 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5703 (Output_section::add_merge_input_section): Add new parameter
5704 KEEPS_INPUT_SECTIONS.
5705 (Output_section::build_lookup_maps): New method declaration.
5706 (Output_section::merge_section_map_,
5707 Output_section::merge_section_by_properties_map_,
5708 Output_section::relaxed_input_section_map_,
5709 Output_section::is_relaxed_input_section_map_valid_): Remove data
5711 (Output_section::lookup_maps_): New data member.
5713 2010-05-21 Doug Kwan <dougkwan@google.com>
5716 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5717 avoid a compilation error.
5719 2010-05-19 Rafael Espindola <espindola@google.com>
5721 * script-sections.cc (Output_section_definition::allocate_to_segment):
5722 Update the phdrs_list even when the output section is NULL.
5723 * testsuite/Makefile.am: Add test.
5724 * testsuite/Makefile.in: Regenerate.
5725 * testsuite/script_test_9.cc: New.
5726 * testsuite/script_test_9.sh: New.
5727 * testsuite/script_test_9.t: New.
5729 2010-05-19 Doug Kwan <dougkwan@google.com>
5731 * arm.cc (Arm_input_section::original_size): New method.
5732 (Arm_input_section::do_addralign): Add a cast.
5733 (Arm_input_section::do_output_offset): Remove static cast.
5734 (Arm_input_section::original_addralign,
5735 Arm_input_section::original_size_): Change type to uint32_t.
5736 (Arm_input_section::init): Add safe casts for section alignment
5738 (Arm_input_section::set_final_data_size): Do not set address and
5739 offset of stub table.
5740 (Arm_output_section::fix_exidx_coverage): Change use of of
5741 Output_section::Simple_input_section to that of
5742 Output_section::Input_section.
5743 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5744 except for the first pass.
5745 * output.cc (Output_section::get_input_sections): Change type of
5746 input_sections to std::list<Input_section>.
5747 (Output_section::add_script_input_section): Rename from
5748 Output_section::add_simple_input_section. Change type of SIS
5749 parameter from Simple_input_section to Input_section.
5750 * output.h (Output_section::Simple_input_section): Remove class.
5751 (Output_section::Input_section): Change class visibility to public.
5752 (Output_section::Input_section::addralign): Use stored alignments
5753 for special input sections if set.
5754 (Output_section::Input_section::set_addralign): New method.
5755 (Output_section::get_input_sections): Change parameter type from
5756 list of Simple_input_section to list of Input_section.
5757 (Output_section::add_script_input_section): Rename from
5758 Output_section::add_simple_input_section. Change first parameter's
5759 type from Simple_input_section to Input_section and remove the
5760 second and third parameters.
5761 * script-sections.cc (Input_section::Input_section_list): Change
5762 type to list of Output_section::Input_section/
5763 (Input_section_info::Input_section_info): Change parameter type of
5764 INPUT_SECTION to Output_section::Input_section.
5765 (Input_section_info::input_section): Change return type.
5766 (Input_section_info::input_section_): Change type to
5767 Output_section::Input_section.
5768 (Output_section_element_input::set_section_addresses): Adjust code
5769 to use Output_section::Input_section instead of
5770 Output_section::Simple_input_section. Adjust code for renaming
5771 of Output_section::add_simple_input_section.
5772 (Orphan_output_section::set_section_addresses): Ditto.
5774 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5776 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5777 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5779 2010-05-18 Rafael Espindola <espindola@google.com>
5781 * options.cc (General_options::finalize): Handle -nostdlib.
5782 * options.h (nostdlib): New option.
5783 * script.cc (script_add_search_dir): Handle -nostdlib.
5785 2010-05-12 Doug Kwan <dougkwan@google.com>
5787 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5788 attributes section only if there no attributes section after merging.
5789 (Target_arm::merge_object_attributes): Move value of
5790 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5791 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5792 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5793 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5794 and arm_attr_merge_7.stdout.
5795 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5796 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5797 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5798 arm_attr_merge_7b.o): New rules.
5799 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5801 * testsuite/Makefile.in: Regenerate.
5802 * testsuite/arm_attr_merge.sh: New file.
5803 * testsuite/arm_attr_merge_[67][ab].s: Same.
5805 2010-05-05 Nick Clifton <nickc@redhat.com>
5807 * po/es.po: Updated Spanish translation.
5809 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5811 * Makefile.am (install-exec-local): Properly install gold as
5812 default cross linker.
5813 * Makefile.in: Regenerated.
5815 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5816 Nick Clifton <nickc@redhat.com>
5818 * configure.ac (install_as_default): Define and set to false
5819 unless --enable-gold or --enable-gold=both/gold has been
5821 * configure: Regenerate.
5823 * Makefile.am (install-exec-local): Install the executable as
5824 'ld.gold'. If install_as_default is true then also install it as
5826 * Makefile.in: Regenerated.
5828 2010-04-24 Ian Lance Taylor <iant@google.com>
5830 * layout.cc (Layout::layout_reloc): In relocatable link don't
5831 combine reloc sections for grouped sections.
5833 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5835 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5836 sections that are not ordinary to icf.
5837 * icf.cc (get_section_contents): Handle relocation pointing to section
5838 with no object or shndx information.
5839 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5840 * testsuite/Makefile.in: Regenerate.
5841 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5842 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5844 2010-04-22 Ian Lance Taylor <iant@google.com>
5846 * expression.cc (Expression::Expression_eval_info): Add
5847 result_alignment_pointer field.
5848 (Expression::eval_with_dot): Add result_alignment_pointer
5849 parameter. Change all callers.
5850 (Expression::eval_maybe_dot): Likewise.
5851 (class Binary_expression): Add alignment_pointer parameter to
5852 left_value and right_value. Change all callers.
5853 (BINARY_EXPRESSION): Set result alignment.
5854 (class Trinary_expression): Add alignment_pointer parameter to
5855 arg2_value and arg3_value. Change all callers.
5856 (Trinary_cond::value): Set result alignment.
5857 (Max_expression::value, Min_expression::value): Likewise.
5858 (Align_expression::value): Likewise.
5859 * script-sections.cc (class Sections_element): Add dot_alignment
5860 parameter to set_section_addresses virtual function. Update
5862 (class Output_section_element): Likewise.
5863 (Script_sections::create_segments): Add dot_alignment parameter.
5865 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5866 (Script_sections::set_phdrs_clause_addresses): Likewise.
5867 * script-sections.h: Update declarations.
5868 * script.h: Update declarations.
5869 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5871 * testsuite/script_test_3.t: Set large alignment.
5872 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5873 segment has expected alignment.
5875 2010-04-22 Nick Clifton <nickc@redhat.com>
5877 * po/gold.pot: Updated by the Translation project.
5878 * po/vi.po: Updated Vietnamese translation.
5880 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5882 * testsuite/Makefile.am (check_PROGRAMS): Add
5883 icf_virtual_function_folding_test.
5884 * testsuite/Makefile.in: Regenerated.
5886 2010-04-15 Andrew Haley <aph@redhat.com>
5888 * options.h (merge_exidx_entries): New option.
5889 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5890 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5891 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5892 (Target_arm::merge_exidx_entries): New function.
5893 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5894 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5895 to Arm_exidx_fixup constructor.
5896 Add new arg, merge_exidx_entries.
5897 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5898 Arm_output_section::fix_exidx_coverage.
5900 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5902 * icf.cc (get_section_contents): Check for preemptible functions.
5903 Ignore addend when appropriate.
5904 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5906 (add_from_relobj): Check for section folded.
5907 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5908 * symtab.h (should_add_dynsym_entry): Add new parameter.
5909 * target-reloc.h (scan_relocs): Check for section folded.
5910 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5911 Check reloc types for function pointers in shared objects.
5912 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5914 (icf_preemptible_functions_test): New test case.
5915 (icf_string_merge_test): New test case.
5916 * testsuite.Makefile.in: Regenerate.
5917 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5918 bar_glob. Refactor code.
5919 * testsuite/icf_preemptible_functions_test.cc: New file.
5920 * testsuite/icf_preemptible_functions_test.sh: New file.
5921 * testsuite/icf_string_merge_test.cc: New file.
5922 * testsuite/icf_string_merge_test.sh: New file.
5923 * testsuite/icf_virtual_function_folding_test.cc: New file.
5924 * testsuite/icf_virtual_function_folding_test.sh: New file.
5926 2010-04-14 Doug Kwan <dougkwan@google.com>
5928 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5929 for local symbol recounting if we remove a section due to ICF.
5930 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5931 there are no regular objects in input.
5933 2010-04-13 Doug Kwan <dougkwan@google.com>
5935 * arm.cc (Arm_input_section::set_final_data_size): Compute
5936 accurate final data size instead of using current data size.
5938 2010-04-09 Doug Kwan <dougkwan@google.com>
5940 * layout.cc (Layout::choose_output_section): Handle script section
5942 (Layout::make_output_section_for_script): Add section type parameter.
5943 Handle script section types.
5944 * layout.h (Layout::make_output_section_for_script): Add section
5946 * output.cc (Output_section::Output_section): Initialize data member
5948 (Output_section::do_reset_address_and_file_offset): Do not set address
5949 to 0 if section is a NOLOAD section.
5950 * output.h (Output_section::is_noload): New method.
5951 (Output_section::set_is_noload): Ditto.
5952 (Output_section::is_noload_): New data member.
5953 * script-c.h (Script_section_type): New enum type.
5954 (struct Parser_output_section_header): Add new file section_type.
5955 * script-sections.cc (Sections_element::output_section_name): Add
5956 parameter for returning script section type.
5957 (Output_section_definition::output_section_name): Ditto.
5958 (Output_section_definition::section_type)P; New method.
5959 (Output_section_definiton::script_section_type_name): Ditto.
5960 (Output_section_definition::script_section_type_): New data member.
5961 (Output_section_definition::Output_section_definition): Initialize
5962 data member Output_section_definition::script_section_type_.
5963 (Output_section_definition::create_sections): Pass script section type
5964 to Layout::make_output_section_for_script.
5965 (Output_section_definition::output_section_name): Return script
5966 section type to caller.
5967 (Output_section_definition::set_section_address): Do not advance
5968 dot value and load address if section type is NOLOAD. Set address
5969 of NOLOAD sections regardless of section flags.
5970 (Output_section_definition::print): Print section type if it is
5971 not SCRIPT_SECTION_TYPE_NONE.
5972 (Output_section_definition::section_type): New method.
5973 (Output_section_definition::script_section_type_name): Ditto.
5974 (Script_sections::output_section_name): Add new parameter
5975 PSECTION_TYPE for returning script section type. Pass it to
5976 section elements. Handle discard sections.
5977 (Sort_output_sections::operator()): Handle NOLOAD sections.
5978 * script-sections.h (Script_sections::Section_type): New enum type.
5979 (Script_sections::output_section_name): Add a new parameter for
5980 returning script section type.
5981 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5983 * yyscript.y (union): Add new field SECTION_TYPE.
5984 (COPY, DSECT, INFO, NOLOAD): New tokens.
5985 (opt_address_and_section_type): Change type to output_section_header.
5986 (section_type): New non-terminal
5987 (section_header): Handle section type.
5988 (opt_address_and_section_type): Return section type value.
5990 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5992 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5993 * testsuite/plugin_common_test_2.c (foo): Likewise.
5995 2010-04-08 Doug Kwan <dougkwan@google.com>
5997 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5999 * output.cc (Output_section::add_merge_input_section): Simplify
6000 code and return status of Output_merge_base::add_input_section.
6001 Update merge section map only if Output_merge_base::add_input_section
6004 2010-04-07 Doug Kwan <dougkwan@google.com>
6006 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6007 if section is marked as containing instructions but has no mapping
6009 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6010 correct section index.
6011 (Arm_relobj::find_linked_text_section): Ditto.
6013 2010-04-07 Cary Coutant <ccoutant@google.com>
6015 * archive.cc (include_member): Destroy Read_symbols_data object before
6017 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6018 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6019 (Read_symbols_data::~Read_symbols_data) New destructor.
6020 (Section_relocs::Section_relocs) New constructor.
6021 (Section_relocs::~Section_relocs) New destructor.
6022 (Read_relocs_data::Read_relocs_data) New constructor.
6023 (Read_relocs_data::~Read_relocs_data) New destructor.
6024 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6025 pointers to NULL after deleting.
6027 2010-04-07 Doug Kwan <dougkwan@google.com>
6029 * arm.cc: Replace "endianity" with "endianness" in comments.
6030 (Arm_exidx_cantunwind): Ditto.
6031 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6032 (Arm_relobj::merge_flags_and_attributes): New method.
6033 (Arm_relobj::merge_flags_and_attributes_): New data member.
6034 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6035 (Arm_relobj::scan_sections_for_stubs): Ditto.
6036 (Arm_relobj::do_read_symbols): Check to see if we really want to
6037 merge processor-specific flags and attributes. Exit early if
6038 an object is empty except for section names and the undefined symbol.
6039 (Target_arm::do_finalize_sections): Move check for ELF format to
6040 Arm_relobj::do_read_symbols. Merge processor specific flags and
6041 attributes from a regular object only when we have determined that
6042 it is aapropriate. Do not create an .ARM.attributes section in
6043 output if there is no regular input object.
6044 (Target_arm::merge_processor_specific_flags): Check
6045 --warn-mismatch before printing any error.
6046 (Target_arm::merge_object_attributes): Ditto.
6047 * gold.cc (queue_middle_tasks): Handle the case in which there is
6048 no regular object in input.
6049 * options.cc (General_options::parse_EB): New method.
6050 (General_options::parse_EL): Same.
6051 (General_options::General_options): Initialize endianness_.
6052 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6054 (General_options::Endianness): New enum.
6055 (General_options::endianness): New method.
6056 (General_options::endianness_): New data member.
6057 * parameters.cc (Parameters::set_options): Check target endianness.
6058 (Parameters::set_target_once): Ditto.
6059 (Parameters::check_target_endianness): New method.
6060 (parameters_force_valid_target): If either -EL or -EB is specified,
6061 use it to define endianness of default target.
6062 * parameters.h (Parameters::check_target_endianness): New method
6064 * target.h (class Target): Change "endianity" to "endianness"
6067 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6069 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6070 * configure: Regenerate.
6071 * Makefile.in: Regenerate.
6072 * testsuite/Makefile.in: Regenerate.
6074 2010-04-06 Cary Coutant <ccoutant@google.com>
6077 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6078 prevailing definitions of common symbols.
6079 * testsuite/plugin_test_6.sh: New test case.
6080 * testsuite/plugin_common_test_1.c: New test case.
6081 * testsuite/plugin_common_test_2.c: New test case.
6082 * testsuite/Makefile.am (plugin_test_6): New test case.
6083 * testsuite/Makefile.in: Regenerate.
6085 2010-04-06 Nick Clifton <nickc@redhat.com>
6087 * po/vi.po: New Vietnamese translation.
6089 2010-03-30 Doug Kwan <dougkwan@google.com>
6091 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6093 2010-03-25 Doug Kwan <dougkwan@google.com>
6095 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6096 to avoid a conversion warning on a 32-bit host.
6098 2010-03-24 Ian Lance Taylor <iant@google.com>
6100 * testsuite/script_test_3.t: Add a TLS segment.
6101 * testsuite/Makefile.am (check_PROGRAMS): Add
6102 tls_phdrs_script_test.
6103 (tls_phdrs_script_test_SOURCES): Define.
6104 (tls_phdrs_script_test_DEPENDENCIES): Define.
6105 (tls_phdrs_script_test_LDFLAGS): Define.
6106 (tls_phdrs_script_test_LDADD): Define.
6107 * testsuite/Makefile.in: Rebuild.
6109 2010-03-23 Cary Coutant <ccoutant@google.com>
6111 * fileread.cc (find_or_make_view): Fix comment.
6113 2010-03-23 Ian Lance Taylor <iant@google.com>
6115 * script-sections.cc (class Orphan_section_placement): Define
6116 PLACE_TLS and PLACE_TLS_BSS.
6117 (Orphan_section_placement::Orphan_section_placement): Initialize
6119 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6120 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6121 (tls_script_test_SOURCES): Define.
6122 (tls_script_test_DEPENDENCIES): Define.
6123 (tls_script_test_LDFLAGS): Define.
6124 (tls_script_test_LDADD): Define.
6125 * testsuite/Makefile.in: Rebuild.
6127 2010-03-22 Doug Kwan <dougkwan@google.com>
6129 * arm.cc (Arm_relocate_functions::abs8,
6130 Arm_relocate_functions::abs16): Use correct check for overflow
6131 specified in the ARM ELF specs.
6132 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6133 target of a BLX instruction specially.
6134 (Reloc_stub::stub_type_for_reloc): Ditto.
6135 (Relocate::relocate): Use symbolic names instead of numeric relocation
6136 codes to report error.
6137 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6139 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6140 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6141 thumb2_blx_out_of_range.stdout
6142 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6143 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6144 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6145 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6146 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6147 thumb2_blx_in_range, thumb2_blx_in_range.o,
6148 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6149 thumb2_blx_out_of_range.o): New rules.
6150 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6151 thumb2_blx_in_range and thumb2_blx_out_of_range.
6152 * testsuite/Makefile.in: Regenerate.
6153 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6154 * testsuite/thumb_blx_in_range.s: New file.
6155 * testsuite/thumb_blx_out_of_range.s: New file.
6157 2010-03-22 Rafael Espindola <espindola@google.com>
6159 * archive.cc (Should_include): Move to archive.h.
6160 (should_include_member): Make it a member of Archive.
6162 (Add_lib_group_symbols): New.
6163 * archive.h: Include options.h.
6164 (Archive_member): Moved from Archive.
6165 (Should_include): Moved from archive.cc.
6167 (Add_lib_group_symbols): New.
6168 * dynobj.cc (do_should_include_member): New.
6169 * dynobj.h (do_should_include_member): New.
6170 * gold.cc (queue_initial_tasks): Update call to queue.
6171 * main.cc (main): Print lib group stats.
6172 * object.cc (do_should_include_member): New.
6173 * object.h: Include archive.h.
6174 (Object::should_include_member): New.
6175 (Object::do_should_include_member): New.
6176 (Sized_relobj::do_should_include_member): New.
6177 * options.cc (General_options::parse_start_lib): New.
6178 (General_options::parse_end_lib): New.
6179 (Input_arguments::add_file): Handle lib groups.
6180 (Input_arguments::start_group): Check we are not in a lib.
6181 (Input_arguments::start_lib): New.
6182 (Input_arguments::end_lib): New.
6183 * options.h (General_options): Add start_lib and end_lib.
6184 (Input_argument::lib_): New.
6185 (Input_argument::lib): New.
6186 (Input_argument::is_lib): New.
6187 (Input_file_lib): New.
6188 (Input_arguments::in_lib_): New.
6189 (Input_arguments::in_lib): New.
6190 (Input_arguments::start_lib): New.
6191 (Input_arguments::end_lib_): New.
6192 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6193 in unused members as preempted.
6194 (Sized_pluginobj::do_should_include_member): New.
6195 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6196 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6198 (Read_symbols::do_whole_lib_group): New.
6199 (Read_symbols::do_lib_group): New.
6200 (Read_symbols::do_read_symbols): Handle lib groups.
6201 (Read_symbols::get_name): Handle lib groups.
6202 * readsyms.h (Read_symbols): Add an archive member pointer.
6203 (Read_symbols::do_whole_lib_group): New.
6204 (Read_symbols::do_lib_group): New.
6205 (Read_symbols::member_): New.
6206 * script.cc (read_input_script): Update call to queue_soon.
6208 2010-03-19 Doug Kwan <dougkwan@google.com>
6210 * arm.cc (Stub_table::Stub_table): Initialize new data members
6211 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6212 (Stub_table::add_reloc_stub): Assign stub offset and update
6213 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6214 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6216 (Stub_table::update_data_size_and_addralign): Use
6217 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6218 instead of going over all reloc stubs.
6219 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6220 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6221 Stringpool_template::offset_ to size of Stringpool_char.
6222 (Stringpool_template::new_key_offset): Remove code to initialize
6223 Stringpool_template::offset_.
6224 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6225 Stringpool_template::offset_ to zero.
6227 2010-03-15 Doug Kwan <dougkwan@google.com>
6229 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6231 (Stringpool_template::new_key_offset): New method.
6232 (Stringpool_template::add_string): Assign offsets when adding new
6234 (Stringpool_template::set_string_offsets): Do not set string offsets
6235 when not optimizing.
6236 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6238 (Chunked_vector::clear): Clear size_.
6239 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6240 (Chunked_vector::size): Return size_.
6241 (Chunked_vector::push_back): Use size_ to find insert position.
6242 (Chunked_vector::size_): New data member.
6243 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6244 (Stringpool_template::new_key_offset): New method declaration.
6245 (Stringpool_template::offset_): New data member.
6247 2010-03-15 Rafael Espindola <espindola@google.com>
6249 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6250 Add_symbols' constructor.
6251 * readsyms.h (Add_symbols): Remove the input_group member.
6253 2010-03-10 Ian Lance Taylor <iant@google.com>
6255 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6256 target to ask whether a reference to a symbol requires a stack
6258 * target.h (Target::is_call_to_non_split): New function.
6259 (Target::do_is_call_to_non_split): Declare virtual function.
6260 * target.cc: Include "symtab.h".
6261 (Target::do_is_call_to_non_split): New function.
6262 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6264 2010-03-10 Cary Coutant <ccoutant@google.com>
6266 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6267 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6268 (File_read::open[2]): Add whole_file_view_ to list of views.
6269 (File_read::make_view): Remove test of whole_file_view_.
6270 (File_read::find_or_make_view): Create whole_file_view_ if
6272 (File_read::clear_views): Replace bool parameter with enum;
6273 adjust all callers. Don't delete views with permanent data;
6274 do delete cached views and views from archives if
6275 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6276 if clearing the corresponding view.
6277 * fileread.h (File_read::Clear_views_mode): New enum.
6278 (File_read::View::is_permanent_view): New method.
6279 (File_read::clear_views): Replace bool parameter
6280 with enum; adjust all callers.
6281 * options.h (General_options): Change keep_files_mapped option;
6282 add map_whole_files.
6283 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6285 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6288 2010-03-10 David S. Miller <davem@davemloft.net>
6290 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6292 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6294 * icf.cc (get_section_contents): Add '@' marker after processing the
6297 2010-03-08 Doug Kwan <dougkwan@google.com>
6299 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6300 due to a conversion warning.
6301 (Arm_relobj::update_output_local_symbol_count): Check for local
6302 symbol with unset output index.
6304 2010-03-05 Ian Lance Taylor <iant@google.com>
6306 * options.h (class General_options): Add --spare-dynamic-tags.
6307 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6308 --spare-dynamic-tags.
6310 2010-03-05 Ian Lance Taylor <iant@google.com>
6312 * incremental.cc: Include "libiberty.h".
6314 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6316 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6317 function, is_info_ member.
6318 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6319 (Versions::Versions): Update caller.
6320 (Versions::define_base_version): Likewise.
6321 (Versions::add_def): Likewise.
6323 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6325 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6326 (Scan::possible_function_pointer_reloc): New function.
6327 (Scan::local_reloc_may_be_function_pointer): Change to call
6328 possible_function_pointer_reloc.
6329 (Scan::global_reloc_may_be_function_pointer): Ditto.
6330 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6331 relocations in ".data.rel.ro._ZTV" section.
6332 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6333 * testsuite/icf_safe_so_test.cc: Ditto.
6334 * testsuite/icf_safe_test.cc: Ditto.
6335 * testsuite/icf_safe_test.sh: Ditto.
6337 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6338 Ian Lance Taylor <iant@google.com>
6340 * target-reloc.h (relocate_section): Check the symbol table index
6341 for -1U before setting the local symbol index.
6342 (scan_relocatable_relocs): If copying the relocation, record that
6343 the local symbol is required.
6344 * object.h (Symbol_value::is_output_symtab_index_set): New
6346 (Symbol_value::may_be_discarded_from_output_symtab): New
6348 (Symbol_value::has_output_symtab_entry): New function.
6349 (Symbol_value::needs_output_symtab_entry): Remove.
6350 (Symbol_value::output_symtab_index): Make sure the symbol index is
6352 (Symbol_value::set_output_symtab_index): Make sure the symbol
6353 index is not set. Make sure the new index is valid.
6354 (Symbol_value::set_must_have_output_symtab_entry): New function.
6355 (Symbol_value::has_output_dynsym_entry): New function.
6356 (Symbol_value::set_output_dynsym_index): Make sure the new index
6358 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6359 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6360 local symbol if permitted.
6361 (Sized_relobj::do_finalize_local_symbols): Call
6362 is_output_symtab_index_set rather than needs_output_symtab_entry.
6363 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6364 rather than needs_output_symtab_entry. Call
6365 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6366 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6367 is_output_symtab_index_set rather than needs_output_symtab_entry.
6368 * testsuite/discard_locals_relocatable_test.c: New file.
6369 * testsuite/discard_locals_test.sh: Test -r.
6370 * testsuite/Makefile.am (check_DATA): Add
6371 discard_locals_relocatable_test1.syms,
6372 discard_local_relocatable_test2.syms.
6373 (MOSTLYCLEANFILES): Likewise. Also add
6374 discard_locals_relocatable_test1.lout and
6375 discard_locals_relocatable_test2.out.
6376 (discard_locals_relocatable_test1.syms): New target.
6377 (discard_locals_relocatable_test.o): New target.
6378 (discard_locals_relocatable_test1.out): New target.
6379 (discard_locals_relocatable_test2.syms): New target.
6380 (discard_locals_relocatable_test2.out): New target.
6381 (various): Add missing ../ld-new dependencies.
6382 * testsuite/Makefile.in: Rebuild.
6384 2010-03-03 Nick Clifton <nickc@redhat.com>
6386 * po/fi.po: New Finnish translation.
6388 2010-03-01 Doug Kwan <dougkwan@google.com>
6390 * layout.cc (Layout::Layout): Force section types of .init_array*,
6391 .preinit_array* and .fini_array* sections.
6392 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6393 Fix check of return value of std::string::find.().
6394 (Output_section::Input_section_sort_compare::operator()): Remove
6395 comment about .init_array.
6396 (Output_section::Input_section_sort_init_fini_compare::operator()):
6398 (Output_section::sort_attached_input_sections): Handle .init_array
6399 and .fini_array specially.
6400 * output.h (Output_section::Inut_section_sort_compare): Update
6402 (Output_section::Input_section_sort_init_fini_compare): New struct.
6404 2010-02-26 Doug Kwan <dougkwan@google.com>
6406 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6407 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6408 * testsuite/debug_msg.sh: Avoid matching source line number for
6409 use of global variable undef_int.
6411 2010-02-26 Doug Kwan <dougkwan@google.com>
6413 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6414 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6415 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6416 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6417 * options.cc (General_options::General_options): Initialize member
6419 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6420 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6421 and rm_no_fix_v4bx.stdout
6422 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6423 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6424 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6425 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6426 and arm_no_fix_v4bx.
6427 * Makefile.in: Regenerate.
6428 * testsuite/arm_fix_v4bx.s: New file.
6429 * testsuite/arm_fix_v4bx.sh: Ditto.
6431 2010-02-24 Doug Kwan <dougkwan@google.com>
6433 * arm.cc (Target_arm::got_section): Make the .got section the first
6434 non RELRO section in the data segment.
6435 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6436 suffixes of section names.
6438 2010-02-24 Doug Kwan <dougkwan@google.com>
6440 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6441 flags and attributes merging if an input file is a binary file.
6442 * fileread.cc (Input_file::open): Record format of original file.
6443 * fileread.h (Input_file::Format): New enum type.
6444 (Input_file::Input_file): Initialize data member format_.
6445 (Input_file::format): New method definition.
6446 (Input_file::format_):: New data member.
6448 2010-02-24 Doug Kwan <dougkwan@google.com>
6450 * arm.cc (Arm_output_data_got): New class.
6451 (ARM_TCB_SIZE): New constant
6452 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6453 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6454 If user uses a script with a SECTIONS clause, issue only a warning
6455 for a misplaced EXIDX input section. Otherwise, issue an error.
6456 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6458 (Target_arm::got_mode_index_entry): Handle static linking.
6459 (Target_arm::Scan::local): Ditto.
6460 (Target_arm::Scan::global): Ditto.
6461 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6462 all incorrectly implemented relocations.
6463 (Target_arm::fix_exidx_coverage): Pass layout to
6464 Arm_output_section::fix_exidx_coverage.
6465 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6466 from ".ARM.exidx." and ".ARM.extab.".
6468 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6470 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6471 section if it does not already exist.
6472 * attributes.cc (Attributes_section_data::Attributes_section_data):
6473 Don't crash if size is zero.
6475 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6476 Ian Lance Taylor <iant@google.com>
6478 * gold.cc (queue_middle_tasks): If no input files were opened,
6480 * workqueue.h (Task_function::Task_function): Assert that there is
6483 2010-02-22 Doug Kwan <dougkwan@google.com>
6485 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6486 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6487 types to avoid warnings due to different uint64_t implementations
6490 2010-02-21 Doug Kwan <dougkwan@google.com>
6492 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6493 handling of the maximum backward branch offset.
6494 (Arm_relocate_functions::thumb_branch_common): Ditto.
6495 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6496 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6497 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6498 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6499 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6500 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6501 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6502 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6503 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6504 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6505 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6506 thumb2_bl_out_of_range.o): New rules.
6507 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6508 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6509 thumb2_bl_out_of_range
6510 * testsuite/Makefile.in: Regenerate.
6511 * testsuite/arm_bl_in_range.s: New file.
6512 * testsuite/arm_bl_out_of_range.s: Ditto.
6513 * testsuite/arm_branch_in_range.sh: Ditto.
6514 * testsuite/arm_branch_range.t: Ditto.
6515 * testsuite/thumb2_branch_range.t: Ditto.
6516 * testsuite/thumb_bl_in_range.s: Ditto.
6517 * testsuite/thumb_bl_out_of_range.s: Ditto.
6518 * testsuite/thumb_branch_range.t: Ditto.
6520 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6522 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6523 Add reloc offset information.
6524 * icf.cc (get_section_contents): Change iterators to point to the new
6525 vectors. Add reloc offset information to the contents.
6526 * icf.h (Icf::Sections_reachable_info): New typedef.
6527 (Icf::Sections_reachable_list): New typedef.
6528 (Icf::Offset_info): New typedef.
6529 (Icf::Reloc_info): New struct typedef.
6530 (Icf::Reloc_info_list): New typedef.
6531 (Icf::symbol_reloc_list): Delete method.
6532 (Icf::addend_reloc_list): Delete method.
6533 (Icf::section_reloc_list): Delete method.
6534 (Icf::reloc_info_list): New method.
6535 (Icf::reloc_info_list_): New member.
6537 2010-02-19 Doug Kwan <dougkwan@google.com>
6539 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6540 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6541 * arm.cc (Arm_relocation_functions): New forward declaration.
6542 (Target_arm::Target_arm): Initialize new data members
6543 got_mod_index_offset_ and tls_base_symbol_defined_.
6544 (Target_arm::Relocate::relocate_tls): New method.
6545 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6546 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6548 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6549 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6550 (Target_arm::got_mod_index_offset_,
6551 Target_arm::tls_base_symbol_defined_): New data members.
6552 (Target_arm::Scan::local, Target::Scan::global,
6553 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6556 2010-02-18 Doug Kwan <dougkwan@google.com>
6558 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6559 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6560 text section as a parameter becuase some broken tools may not set
6561 the link in section header.
6562 (Target_arm::has_got_section): New method.
6563 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6564 without any mapping symbol as data only. Remove warning.
6565 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6566 link in its section header, try to discover the link by inspecting the
6567 REL31 relocation at the beginning of the section.
6568 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6570 (Target_arm::Scan::global): Treat any reference to the symbol
6571 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6573 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6575 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6576 (Scan::global_reloc_may_be_function_pointer): New function.
6577 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6578 (Scan::global_reloc_may_be_function_pointer): New function.
6579 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6580 (Scan::global_reloc_may_be_function_pointer): New function.
6581 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6582 (Scan::global_reloc_may_be_function_pointer): New function.
6583 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6584 (Scan::global_reloc_may_be_function_pointer): New function.
6585 (Scan::possible_function_pointer_reloc): New function.
6586 (Target_x86_64::can_check_for_function_pointers): New function.
6587 * gc.h (gc_process_relocs): Scan relocation types to determine if
6588 function pointers were taken for targets that support it.
6589 * icf.cc (Icf::find_identical_sections): Include functions for
6590 folding in safe ICF whose pointer is not taken.
6591 * icf.h (Secn_fptr_taken_set): New typedef.
6592 (fptr_section_id_): New member.
6593 (section_has_function_pointers): New function.
6594 (set_section_has_function_pointers): New function.
6595 (check_section_for_function_pointers): New function.
6596 * options.h: Fix comment for safe ICF option.
6597 * target.h (can_check_for_function_pointers): New function.
6598 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6599 Modify icf_safe_test for X86-64.
6600 * testsuite/Makefile.in: Regenerate.
6601 * testsuite/icf_safe_so_test.cc: New file.
6602 * testsuite/icf_safe_so_test.sh: New file.
6603 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6604 (main): Change to take pointer to function kept_func_3.
6605 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6606 folding is done correctly for X86-64.
6608 2010-02-12 David S. Miller <davem@davemloft.net>
6610 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6611 is_symbolless parameter.
6612 (Output_reloc<SHT_REL>::is_symbolless): New.
6613 (Output_reloc<SHT_REL>::is_symbolless_): New.
6614 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6615 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6616 (Output_reloc<SHT_RELA>::is_symbolless): New.
6617 (Output_data_reloc::add_global): Handle is_symbolless.
6618 (Output_data_reloc::add_global_relative): Likewise.
6619 (Output_data_reloc::add_local): Likewise.
6620 (Output_data_reloc::add_local_relative): Likewise.
6621 (Output_data_reloc::add_symbolless_global_addend): New.
6622 (Output_data_reloc::add_symbolless_local_addend): New.
6623 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6625 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6626 instead of ->is_relative_
6627 (Output_reloc::write): Likewise.
6628 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6629 (Output_reloc::write_rel): Simplify.
6631 * sparc.cc (Target_sparc::Scan::local): Use
6632 ->add_symbolless_local_addend as needed.
6633 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6634 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6635 based upon relocation offset.
6637 2010-02-11 Doug Kwan <dougkwan@google.com>
6639 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6640 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6641 beginning of function.
6642 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6643 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6644 parameter is_32bit in calls to should_apply_static_reloc.
6645 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6646 (check_DATA): Add arm_abs_global.stdout.
6647 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6648 arm_abs_global.stdout): New rules.
6649 (MOSTLLYCLEANFILES): Add arm_abs_global
6650 * Makefile.in: Regenerate.
6651 * testsuite/arm_abs_global.s: New file.
6652 * testsuite/arm_abs_global.sh: Ditto.
6653 * testsuite/arm_abs_lib.s: Ditto.
6655 2010-02-11 Ian Lance Taylor <iant@google.com>
6657 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6659 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6660 Allocate_commons_task first.
6661 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6662 task, rather than symtab_lock_.
6663 (Gc_process_relocs::~Gc_process_relocs): New function.
6664 (Gc_process_relocs::is_runnable): Check this_blocker_.
6665 (Gc_process_relocs::locks): Use next_blocker_ rather than
6667 (Scan_relocs::~Scan_relocs): New function.
6668 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6670 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6672 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6673 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6674 constructor accordingly.
6675 (class Gc_process_relocs): Likewise.
6676 (class Scan_relocs): Likewise.
6677 * common.h (class Allocate_commons_task): Remove symtab_lock_
6678 field, and corresponding constructor parameter.
6679 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6681 (Allocate_commons_task::locks): Likewise.
6683 2010-02-11 Ian Lance Taylor <iant@google.com>
6685 * gold-threads.h (class Once): Define.
6686 (class Initialize_lock): Rewrite as child of Once.
6687 * gold-threads.cc (class Once_initialize): Define.
6688 (once_pointer_control): New static variable.
6689 (once_pointer, once_arg): New static variables.
6690 (c_run_once): New static function.
6691 (Once::Once, Once::run_once, Once::internal_run): New functions.
6692 (class Initialize_lock_once): Remove.
6693 (initialize_lock_control): Remove.
6694 (initialize_lock_pointer): Remove.
6695 (initialize_lock_once): Remove.
6696 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6697 (Initialize_lock::initialize): Rewrite.
6698 (Initialize_lock::do_run_once): New function.
6699 * archive.cc (Archive::interpret_header): Only clear name if it is
6701 * fileread.cc: Include "gold-threads.h"
6702 (file_counts_lock): New static variable.
6703 (file_counts_initialize_lock): Likewise.
6704 (File_read::release): Only increment counts when using --stats.
6705 Use a lock around the increment.
6706 * parameters.cc (class Set_parameters_target_once): Define.
6707 (set_parameters_target_once): New static variable.
6708 (Parameters::Parameters): Move here from parameters.h.
6709 (Parameters::set_target): Rewrite.
6710 (Parameters::set_target_once): New function.
6711 (Parameters::clear_target): Move here and rewrite.
6712 * parameters.h (class Parameters): Update declarations. Add
6713 set_parameters_target_once_ field.
6714 (Parameters::Parameters): Move to parameters.cc.
6715 (Parameters::clear_target): Likewise.
6716 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6718 (Start_group::~Start_group): New function.
6719 (Start_group::is_runnable): New function.
6720 (Start_group::locks, Start_group::run): New functions.
6721 (Finish_group::run): Change saw_undefined to size_t.
6722 * readsyms.h (class Start_group): Define.
6723 (class Finish_group): Change saw_undefined_ field to size_t.
6724 (Finish_group::Finish_group): Remove saw_undefined and
6725 this_blocker parameters. Change all callers.
6726 (Finish_group::set_saw_undefined): New function.
6727 (Finish_group::set_blocker): New function.
6728 * symtab.h (class Symbol_table): Change saw_undefined to return
6729 size_t. Change saw_undefined_ field to size_t.
6730 * target-select.cc (Set_target_once::do_run_once): New function.
6731 (Target_selector::Target_selector): Initialize set_target_once_
6732 field. Don't initialize lock_ and initialize_lock_ fields.
6733 (Target_selector::instantiate_target): Rewrite.
6734 (Target_selector::set_target): New function.
6735 * target-select.h (class Set_target_once): Define.
6736 (class Target_selector): Update declarations. Make
6737 Set_target_once a friend. Remove lock_ and initialize_lock_
6738 fields. Add set_target_once_ field.
6740 2010-02-10 Ian Lance Taylor <iant@google.com>
6742 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6744 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6745 (queue_middle_tasks): Add all blockers before queueing any tasks.
6746 (queue_final_tasks): Likewise.
6747 * token.h (Task_token::add_blockers): New function.
6748 * object.h (Input_objects::number_of_relobjs): New function.
6750 2010-02-10 Ian Lance Taylor <iant@google.com>
6752 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6753 shared, not if not position independent.
6754 * x86_64.cc (Relocate::relocate_tls): Likewise.
6755 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6756 (tls_pie_pic_test): New target.
6757 * testsuite/Makefile.in: Rebuild.
6759 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6760 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6761 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6762 * testsuite/Makefile.in: Rebuild.
6764 2010-02-09 David S. Miller <davem@davemloft.net>
6766 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6767 R_SPARC_RELATIVE using ->add_local_relative().
6768 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6770 * output.h (Output_data_dynamic::add_section_size): New method
6771 that takes two Output_data objects.
6772 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6773 entry param. Handle it in initializers.
6774 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6775 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6776 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6778 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6779 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6780 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6781 for dynrel_includes_plt.
6782 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6783 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6784 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6786 (Target_sparc::do_finalize_sections): Update to pass true for
6787 dynrel_includes_plt.
6788 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6789 output before .rela.plt
6790 (Target_powerpc::do_finalize_sections): Update to pass true for
6791 dynrel_includes_plt when 32-bit.
6793 2010-02-08 Doug Kwan <dougkwan@google.com>
6795 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6797 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6798 Arm_relobj::scan_section_for_cortex_a8_stubs,
6799 Arm_relobj::do_relocation_section): Instead of calling
6800 Output_section::output_address, use faster
6801 Arm_relobj::simple_input_section_output_address.
6803 2010-02-08 David S. Miller <davem@davemloft.net>
6805 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6806 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6807 relocation helper function.
6809 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6810 just like R_SPARC_GOT{10,13,22}.
6811 (Target_sparc::Scan::local): Likewise.
6812 (Target_sparc::Relocate:relocate): Likewise.
6814 2010-02-06 Ian Lance Taylor <iant@google.com>
6816 * configure.ac: Rewrite targetobjs duplicate removal code to use
6817 only shell constructs.
6818 * configure: Rebuild.
6820 2010-02-05 Doug Kwan <dougkwan@google.com>
6823 * arm.cc (Arm_relobj::section_is_scannable): New method.
6824 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6825 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6827 2010-02-04 Doug Kwan <dougkwan@google.com>
6830 * arm-reloc-property.cc (cstdio): Include.
6831 * configure.ac (targetobjs): Remove duplicates.
6832 * configure: Regenerate.
6833 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6834 big and little endian version for a given address size.
6836 2010-02-03 Doug Kwan <dougkwan@google.com>
6838 * arm-reloc-property.cc
6839 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6841 * arm-reloc-property.h
6842 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6843 New method definition.
6844 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6846 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6848 (GOT_PREL): Change implemented to Y.
6849 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6850 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6851 (Arm_relocate_functions::movw_abs_nc): Remove method.
6852 (Arm_relocate_functions::movt_abs): Ditto.
6853 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6854 (Arm_relocate_functions::thm_movt_abs): Ditto.
6855 (Arm_relocate_functions::movw_rel_nc): Ditto.
6856 (Arm_relocate_functions::movw_rel): Ditto.
6857 (Arm_relocate_functions::movt_rel): Ditto.
6858 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6859 (Arm_relocate_functions:thm_movw_rel): Ditto.
6860 (Arm_relocate_functions:thm_movt_rel): Ditto.
6861 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6862 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6863 New method definitions.
6864 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6865 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6866 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6867 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6868 (Target_arm::Relocate::relocate): Check for non-static or
6869 unimplemented relocation code and exit early. Change calls to
6870 Target_arm::reloc_uses_thumb_bit and
6871 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6872 instead. Refactor code to handle similar relocations to increase
6873 code sharing. Remove check for unsupported relocation code in switch
6875 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6876 relocation property table to find out size. Change error message to
6877 print out the name of a relocation code instead of the numeric value.
6878 (Target_arm::scan_reloc_for_stub): Use relocation property table
6879 instead of calling Target_arm::reloc_uses_thumb_bit().
6881 2010-02-02 Doug Kwan <dougkwan@google.com>
6883 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6884 types of relaxed input section.
6886 2010-02-02 Doug Kwan <dougkwan@google.com>
6888 * Makefile.am (HFILES): Add arm-reloc-property.h.
6890 (TARGETSOURCES): Add arm-reloc-property.cc
6891 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6892 (libgold_a_SOURCES): $(DEFFILES)
6893 * Makefile.in: Regenerate.
6894 * arm-reloc-property.cc: New file.
6895 * arm-reloc-property.h: New file.
6896 * arm-reloc.def: New file.
6897 * arm.cc: Update comments.
6898 (arm-reloc-property.h): New included header.
6899 (arm_reloc_property_table): New global variable.
6900 (Target_arm::do_select_as_default_target): New method definition.
6901 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6902 arm-reloc-property to targ_extra_obj.
6903 * parameters.cc (set_parameters_target): Call
6904 Target::select_as_default_target().
6905 * target.h (Target::select_as_default_target): New method definition.
6906 (Target::do_select_as_default_target): Same.
6908 2010-02-01 Doug Kwan <dougkwan@google.com>
6910 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6911 first_output_text_section_.
6912 (Arm_exidx_fixup::first_output_text_section): New method definition.
6913 (Arm_exidx_fixup::first_output_text_section_): New data member.
6914 (Arm_exidx_fixup::process_exidx_section): Record the first text
6915 output section seen.
6916 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6917 and entsize in output section header.
6919 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6921 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6922 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6923 (Arm_relocate_functions::thm_alu11): New Method.
6924 (Arm_relocate_functions::thm_pc8): New Method.
6925 (Arm_relocate_functions::thm_pc12): New Method.
6926 (Target_arm::Scan::local): Handle the relocations.
6927 (Target_arm::Scan::global): Likewise.
6928 (Target_arm::Relocate::relocate): Likewise.
6929 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6931 2010-01-29 Doug Kwan <dougkwan@google.com>
6933 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6934 of relocation types as ld.
6936 2010-01-29 Doug Kwan <dougkwan@google.com>
6938 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6940 (Arm_relocate_functions::thumb_branch_common): Ditto.
6941 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6942 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6943 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6944 Arm_relocate_functions::jump24): Remove.
6945 (Target_arm::Relocate::relocate): Adjust code to call
6946 Arm_relocation_functions::arm_branch_common and
6947 Arm_relocation_functions::thumb_branch_common instead of their removed
6948 wrappers. Merge switch-cases together to reduce source code size.
6950 2010-01-29 Doug Kwan <dougkwan@google.com>
6952 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6953 output_local_symbol_count_needs_update_.
6954 (Arm_relobj::output_local_symbol_count_needs_update,
6955 Arm_relobj::set_output_local_symbol_count_needs_update,
6956 Arm_relobj::update_output_local_symbol_count): New methods.
6957 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6959 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6960 of pointed function as in a R_ARM_PREL31 relocation.
6961 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6962 for output local symbol count updating.
6963 (Target_arm::do_relax): Update output local symbol counts in objects
6965 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6967 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6969 * arm.cc: Added support for the ARM relocations:
6970 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6971 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6972 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6974 (Arm_relocate_functions::movw_rel): New method.
6975 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6976 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6978 (Arm_relocate_functions::thm_movw_rel): New method.
6979 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6981 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6983 (Target_arm::Scan::global): Likewise.
6984 (Target_arm::Relocate::relocate): Likewise.
6985 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6988 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6990 * arm.cc: Added support for ARM group relocations.
6991 (Target_arm::reloc_needs_sym_origin): New method.
6992 (Arm_relocate_functions::calc_grp_kn): New method.
6993 (Arm_relocate_functions::calc_grp_residual): New method.
6994 (Arm_relocate_functions::calc_grp_gn): New method.
6995 (Arm_relocate_functions::arm_grp_alu): New Method.
6996 (Arm_relocate_functions::arm_grp_ldr): New Method.
6997 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6998 (Arm_relocate_functions::arm_grp_ldc): New Method.
6999 (Target_arm::Scan::local): Handle the ARM group relocations.
7000 (Target_arm::Scan::global): Likewise.
7001 (Target_arm::Relocate::relocate): Likewise.
7002 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7005 2010-01-26 Doug Kwan <dougkwan@google.com>
7007 * arm.cc (set): Include.
7008 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7010 (Arm_output_section::Text_section_list): New type.
7011 (Arm_output_section::append_text_sections_to_list): New method.
7012 (Arm_output_section::fix_exidx_coverage): Ditto.
7013 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7014 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7015 Relobj::set_section_offset() instead of
7016 Sized_relobj::invalidate_section_offset().
7017 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7018 parameter for section headers. Ignore relocation sections for
7019 unallocated sections and EXIDX sections.
7020 (Target_arm::fix_exidx_coverage): New method.
7021 (Target_arm::output_section_address_less_than): New type.
7022 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7023 linked text section instead of the EXIDX section.
7024 (Arm_output_section::create_stub_group): Add an assertion to check
7025 that this is not an EXIDX output section.
7026 (Arm_output_section::append_text_sections_to_list): New method.
7027 (Arm_output_section::fix_exidx_coverage): Ditto.
7028 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7029 Arm_relobj::section_needs_reloc_stub_scanning.
7030 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7032 (Target_arm::fix_exidx_coverage): New method.
7033 * object.h (Relobj::set_output_section): New method.
7034 (Sized_relobj::invalidate_section_offset): Remove method.
7035 (Sized_relobj::do_invalidate_section_offset): Remove method.
7036 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7038 2010-01-25 Doug Kwan <dougkwan@google.com>
7040 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7041 Fix warning due to signed and unsigned comparison on a 32-bit host.
7043 2010-01-22 Doug Kwan <dougkwan@google.com>
7045 * arm.cc (Target_arm::do_relax): Record an output section for section
7046 offset adjustment it contains any stub table that has changed.
7047 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7048 offsets in an output section if necessary.
7049 * output.cc (Output_section::Output_section): Initialize
7050 section_offsets_need_adjustments_.
7051 (Output_section::add_input_section_for_script): Renamed to
7052 Output_section::add_simple_input_section.
7053 (Output_section::save_states): Add a comment.
7054 (Output_section::discard_states): New method defintion.
7055 (Output_section::adjust_section_offsets): Same.
7056 * output.h (Output_section::add_input_section_for_script): Renamed to
7057 Output_section::add_simple_input_section.
7058 (Output_section::discard_states): New method declaration.
7059 (Output_section::adjust_section_offsets): Same.
7060 (Output_section::section_offsets_need_adjustment,
7061 Output_section::set_section_offsets_need_adjustment): New method
7063 (Output_section::section_offsets_need_adjustment_): New data member.
7064 * script-sections.cc
7065 (Output_section_element_input::set_section_address): Adjust code for
7066 renaming of Output_section::add_input_section_for_script.
7067 (Orphan_output_section::set_section_address): Same.
7069 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7071 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7072 Fix_v4bx enum values .
7073 * gold/options.h (General_options): New option definitions.
7074 (General_options::fix_v4bx): New method.
7075 (General_options::Fix_v4bx): New enum.
7076 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7077 (General_options::parse_fix_v4bx_interworking): New method.
7079 2010-01-22 Doug Kwan <dougkwan@google.com>
7081 * arm.cc (Arm_exidx_fixup): New class.
7083 2010-01-21 Doug Kwan <dougkwan@google.com>
7085 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7087 (Arm_exidx_section_offset_map): New type.
7089 2010-01-21 Doug Kwan <dougkwan@google.com>
7091 * arm.cc (Arm_exidx_input_section): New class.
7092 (Arm_relobj::exidx_input_section_by_link,
7093 Arm_relobj::exidx_input_section_by_shndx,
7094 Arm_relobj::make_exidx_input_section): New methods.
7095 (read_arm_attributes_section): Remove.
7096 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7097 information about them.
7098 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7101 2010-01-20 Doug Kwan <dougkwan@google.com>
7103 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7104 Input_section_specifier to Section_id.
7105 (Target_arm::new_arm_input_section: Adjust code for change of key
7107 (Target_arm::find_arm_input_section): Ditto.
7108 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7109 (Section_id): Remove.
7110 (Garbage_collection::Section_id_hash): Remove.
7111 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7112 (Section_id): Remove.
7113 (Icf::Section_id_hash): Remove.
7114 * object.h (Section_id, Const_section_id, Section_id_hash,
7115 Const_section_id_hash): New type definitions.
7116 * output.cc (Output_section::add_relaxed_input_section): Change to
7117 use Const_section_id instead of Input_section_specifier as key type.
7118 (Output_section::add_merge_input_section): Ditto.
7119 (Output_section::build_relaxation_map): Change to use Section_id
7120 instead of Input_section_specifier as key type.
7121 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7123 (Output_section::convert_input_sections_to_relaxed_sections): Change
7124 to use Const_section_id instead of Input_section_specifier as key type.
7125 (Output_section::find_merge_section): Ditto.
7126 (Output_section::find_relaxed_input_section): Ditto.
7127 * output.h (Input_section_specifier): Remove class.
7128 (Output_section::Output_section_data_by_input_section_map): Change
7129 key type to Const_section_id.
7130 (Output_section::Output_relaxed_input_section_by_input_section_map):
7132 (Output_section::Relaxation_map): Change key type to Section_id.
7134 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7136 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7137 (class Arm_v4bx_stub): New class.
7138 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7139 (Stub_factory::make_arm_v4bx_stub): New method.
7140 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7141 (Stub_table::empty): Handle v4bx stubs.
7142 (Stub_table::add_arm_v4bx_stub): New method.
7143 (Stub_table::find_arm_v4bx_stub): New method.
7144 (Arm_relocate_functions::v4bx): New method.
7145 (Target_arm::fix_v4bx): New method.
7146 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7147 (Stub_table::relocate_stubs): Likewise.
7148 (Stub_table::do_write): Likewise.
7149 (Stub_table::update_data_size_and_addralign): Likewise.
7150 (Stub_table::finalize_stubs): Likewise.
7151 (Target_arm::Scan::local): Likewise.
7152 (Target_arm::Scan::global): Likewise.
7153 (Target_arm::do_finalize_sections): Likewise.
7154 (Target_arm::Relocate::relocate): Likewise.
7155 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7157 (Target_arm::scan_reloc_for_stub): Likewise.
7158 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7160 2010-01-19 Ian Lance Taylor <iant@google.com>
7162 * output.cc (Output_section_headers::do_sized_write): Write large
7163 segment count to sh_info field.
7164 (Output_file_header::do_sized_write): For large segment count,
7165 write PN_XNUM to e_phnum field.
7167 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7169 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7170 (Arm_relocate_functions::thm_jump8): New function.
7171 (Arm_relocate_functions::thm_jump11): New function.
7172 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7174 (Target_arm::Scan::global): Likewise.
7175 (Target_arm::Relocate::relocate): Likewise.
7176 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7179 2010-01-14 Doug Kwan <dougkwan@google.com>
7181 * arm.cc (map, utility): Include headers.
7182 (Target_arm::apply_cortex_a8_workaround): New method.
7183 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7184 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7185 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7186 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7187 the --[no-]fix-cortex-a8 command line options.
7188 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7189 (Target_arm::relocate_stub): Use addend in instruction template.
7190 * options.h (DEFINE_bool): Set the user-set flag.
7191 (General_options): Add --[no-]-fix-cortex options.
7192 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7193 : Update fast look-up map after conversion.
7195 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7197 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7198 in the first pass of do_layout.
7200 2010-01-13 Doug Kwan <dougkwan@google.com>
7202 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7203 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7204 apparent compiler problem of not folding static constant integral
7205 data members of elfcpp::Elf_sizes<32>.
7207 2010-01-13 Doug Kwan <dougkwan@google.com>
7209 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7210 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7211 Arm_relobj::scan_section_for_cortex_a8_erratum,
7212 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7213 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7214 sections to scan for relocation stubs into a new method
7215 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7216 relocation and Cortex-A8 stub scanning.
7217 (Target_arm::do_relax): Force stubs to be after stubbed sections
7218 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7219 the beginning of a new relaxation pass. Update a comment.
7220 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7222 2010-01-12 Ian Lance Taylor <iant@google.com>
7224 * target-reloc.h (visibility_error): New inline function.
7225 (relocate_section): Call visibility_error.
7226 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7227 (MOSTLYCLEANFILES): Likewise.
7228 (protected_4_pic.o, protected_3.err): New targets.
7229 * testsuite/protected_4.cc: New file.
7231 2010-01-12 Doug Kwan <dougkwan@google.com>
7233 * arm.cc (Cortex_a8_reloc): New class.
7234 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7235 and cortex_a8_relocs_info_.
7236 (Target_arm::fix_cortex_a8): New method definition.
7237 (Target_arm::Cortex_a8_relocs_info): New type.
7238 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7239 New data member declarations.
7240 (Target_arm::scan_reloc_for_stub): Record information about
7241 relocations for THUMB branches that might be exempted from the
7242 Cortex-A8 workaround.
7243 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7244 at the beginning of a relaxation pass.
7246 2010-01-12 Doug Kwan <dougkwan@google.com>
7248 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7249 (Arm_relobj::Mapping_symbol_position,
7250 Arm_reloj::Mapping_symbol_position_less,
7251 Arm_relobj::Mapping_symbols_info): New types.
7252 (Target_arm::is_mapping_symbol_name): New method definition.
7253 (Arm_relobj::do_count_local_symbols): Save information about mapping
7256 2010-01-11 Doug Kwan <dougkwan@google.com>
7258 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7259 Arm_relocate_functions::thumb32_branch_upper,
7260 Arm_relocate_functions::thumb32_branch_lower,
7261 Arm_relocate_functions::thumb32_cond_branch_offset,
7262 Arm_relocate_functions::thumb32_cond_branch_upper,
7263 Arm_relocate_functions::thumb32_cond_branch_lower,
7264 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7265 branch offset encoding.
7266 (Arm_relocate_functions::thumb_branch_common): Use new branch
7267 offset encoding methods to avoid code duplication.
7268 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7269 (Stub_addend_reader::operator()): Use new branch encoding method
7270 to avoid code duplication.
7272 2010-01-11 Doug Kwan <dougkwan@google.com>
7274 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7275 (Target_arm::do_finalize_sections): Define special EXIDX section
7276 symbols only if referenced.
7277 * gc.h (Garbage_collection::add_reference): New method.
7278 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7281 2010-01-11 Ian Lance Taylor <iant@google.com>
7283 * script.cc (Version_script_info::build_expression_list_lookup):
7284 Change complaing about duplicate wildcard match from error to
7287 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7289 (Version_script_info::Version_script_info): Initialize globs_,
7290 default_version_, default_is_global_, and exact_. Don't
7291 initialize globals_ or locals_.
7292 (Version_script_info::build_lookup_tables): Build local symbols
7294 (Version_script_info::unquote): New function.
7295 (Version_script_info::add_exact_match): New function.
7296 (Version_script_info::build_expression_list_lookup): Remove lookup
7297 parameter. Add is_global parameter. Change all callers. Handle
7298 wildcard pattern specially. Unquote pattern. Call
7300 (Version_script_info::get_name_to_match): New function.
7301 (Version_script_info::get_symbol_version): New function.
7302 (Version_script_info::get_symbol_version_helper): Remove.
7303 (Version_script_info::check_unmatched_names): Call unquote.
7304 * script.h (class Version_script_info): Change get_symbol_version
7305 to be non-inline and add is_global parameter; change all callers.
7306 Rewrite symbol_is_local. Update declarations. Define struct
7307 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7308 Remove globals_ and locals_ members. Add exact_, globs_,
7309 default_version_, is_global_.
7310 (Version_script_info::Glob): Remove pattern, add expression and
7311 is_global. Update constructor. Change all callers.
7312 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7314 (Versions::symbol_section_contents): If a symbol is undefined, or
7315 defined in a dynamic object, set the version index to
7317 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7319 (Symbol_table::add_from_pluginobj): Likewise.
7320 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7322 2010-01-11 Doug Kwan <dougkwan@google.com>
7324 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7325 (incremental_dump_LDADD): Add linking option for libintl.
7326 * Makefile.in: Regenerate.
7328 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7331 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7333 * testsuite/Makefile.in: Regenerated.
7335 2010-01-10 Doug Kwan <dougkwan@google.com>
7337 * options.h (DEFINE_var): Use parentheses around argument varname__
7338 in macro body to avoid any unintended subsequent substitutions.
7340 2010-01-10 Ian Lance Taylor <iant@google.com>
7342 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7343 candidates before doing symbol resolution.
7345 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7346 ODR candidates if only one is weak.
7348 2010-01-08 Ian Lance Taylor <iant@google.com>
7350 * script.cc (Version_script_info::build_expression_list_lookup):
7351 Don't warn about ambiguous version, just record the ambiguity.
7352 (Version_script_info::get_symbol_version_helper): Give error if
7353 version is ambiguous.
7355 2010-01-08 Doug Kwan <dougkwan@google.com>
7357 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7358 prev_data_size_ and prev_addralign_. Remove initializer for
7359 deleted data member has_been_changed_.
7360 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7361 to determine if the table is empty.
7362 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7364 (Stub_table::add_reloc_stub): Define method in class definition
7365 instead of just declaring it there.
7366 (Stub_table::add_cortex_a8_stub): New method definition.
7367 (Stub_table::update_data_size_and_addralign): Ditto.
7368 (Stub_table::finalize_stubs): Ditto.
7369 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7370 (Stub_table::do_addralign_): Return address alignment in the
7371 (Stub_table::do_reset_address_and_file_offset): Define method in
7372 class definition instead of declaring it there. Set current data
7373 size to be the data size of the previous pass.
7374 (Stub_table::set_final_data_size): Use current data size as the
7376 (Stub_table::relocate_stub): Change parameter type of stub from
7377 Reloc_stub pointer to Stub pointer.
7378 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7379 (Stub_table::Cortex_a8_stub_list): New typedef.
7380 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7381 Stub_table::prev_addralign_): New data member.
7382 (Arm_relobj::Arm_relobj): Initialize data member
7383 section_has_cortex_a8_workaround_.
7384 (Arm_relobj::section_has_cortex_a8_workaround,
7385 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7387 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7389 (Target_arm::relocate_stub): Change parameter type of stub from
7390 Reloc_stub pointer to Stub pointer.
7391 (Insn_template::size, Insn_template::alignment): Handle
7392 THUMB16_SPECIAL_TYPE.
7393 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7394 Stub_table::update_data_size_and_addralign,
7395 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7397 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7398 (Stub_table::do_write): Ditto.
7399 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7401 2010-01-08 Ian Lance Taylor <iant@google.com>
7404 * symtab.h (class Symbol): Remove fields is_target_special_ and
7405 has_plt_offset_. Add field is_defined_in_discarded_section_.
7406 (Symbol::is_defined_in_discarded_section): New function.
7407 (Symbol::set_is_defined_in_discarded_section): New function.
7408 (Symbol::has_plt_offset): Rewrite.
7409 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7410 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7411 Don't initialize is_target_special_ or has_plt_offset_.
7412 Initialize is_defined_in_discarded_section_.
7413 (Symbol_table::add_from_relobj): If appropriate, set
7414 is_defined_in_discarded_section.
7415 * resolve.cc (Symbol::override_base_with_special): Don't test
7416 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7417 * target-reloc.h (relocate_section): Do special handling for
7418 symbols defined in discarded sections for global symbols as well
7421 2010-01-08 Ian Lance Taylor <iant@google.com>
7423 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7424 the SHT_SYMTAB case.
7426 2010-01-08 Ian Lance Taylor <iant@google.com>
7428 * object.cc (Sized_relobj::do_layout): Don't get confused if
7429 layout_eh_frame returns NULL.
7431 2010-01-08 Ian Lance Taylor <iant@google.com>
7434 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7435 dynamic symbol table, use the normal symbol table.
7436 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7439 2010-01-08 Ian Lance Taylor <iant@google.com>
7442 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7445 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7447 * version.cc (print_version): Change to "Copyright 2010".
7449 2010-01-08 Ian Lance Taylor <iant@google.com>
7453 * i386.cc (class Target_i386): Change return type of plt_section
7455 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7456 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7457 tls_desc_rel_ field.
7458 (Output_data_plt_i386::rel_tls_desc): New function.
7459 (Target_i386::rel_tls_desc_section): New function.
7460 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7461 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7462 R_386_TLS_DESC reloc in rel_tls_desc_section.
7463 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7464 Define struct Tlsdesc_info.
7465 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7466 (Target_x86_64::do_reloc_symbol_index): New function.
7467 (Target_x86_64::add_tlsdesc_info): New function.
7468 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7469 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7471 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7473 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7474 (Target_x86_64::rela_tlsdesc_section): New function.
7475 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7477 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7478 (Target_x86_64::do_reloc_addend): New function.
7479 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7480 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7481 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7482 (Output_reloc::type): New function.
7483 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7484 (Output_reloc::is_target_specific): New function.
7485 (Output_reloc::target_arg): New function.
7486 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7487 absolute relocs and target specific relocs.
7488 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7489 add_target_specific.
7490 (class Output_data_reloc) [SHT_RELA]: Likewise.
7491 * output.cc (Output_reloc::Output_reloc): Add four new versions
7492 for absolute relocs and target specific relocs.
7493 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7494 (Output_reloc::get_symbol_index): Likewise.
7495 (Output_reloc::local_section_offset): Check that local_sym_index_
7496 is not TARGET_CODE or 0.
7497 (Output_reloc::symbol_value): Likewise.
7498 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7500 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7501 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7503 * layout.cc (add_target_dynamic_tags): Use output section for
7504 DT_PLTRELSZ and DT_JMPREL.
7506 2010-01-07 Ian Lance Taylor <iant@google.com>
7509 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7511 (class Output_data_reloc_generic): Define.
7512 (class Output_data_reloc_base): Change base class to
7513 Output_data_reloc_generic. Change add() method to call
7514 bump_relative_reloc_count for a relative reloc. Remove
7516 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7518 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7519 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7521 * layout.h (class Layout): Update declaration.
7523 2010-01-07 Ian Lance Taylor <iant@google.com>
7525 * output.h (class Output_data): Add const version of
7526 output_section and do_output_section.
7527 (class Output_section_data): Add const version of
7529 (class Output_section): Likewise.
7530 * layout.cc (Layout::add_target_dynamic_tags): New function.
7531 * layout.h (class Layout): Update declarations.
7532 * arm.cc (Target_arm::do_finalize_sections): Use
7533 add_target_dynamic_tags.
7534 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7535 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7536 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7537 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7539 2010-01-07 Ian Lance Taylor <iant@google.com>
7542 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7545 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7546 Ian Lance Taylor <iant@google.com>
7549 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7550 Xindex::read_symtab_xindex.
7552 2010-01-07 Doug Kwan <dougkwan@google.com>
7554 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7555 (Insn_template::thumb16_bcond_insn): New method declaration.
7556 (Insn_template): Fix spelling.
7557 (Stub::thumb16_special): New method declaration.
7558 (Stub::do_write): Define virtual method which was previously pure
7560 (Stub::do_thumb16_special): New method declaration.
7561 (Stub::do_fixed_endian_write): New template member.
7562 (Reloc_stub::do_write): Remove.
7563 (Reloc_stub::do_fixed_endian_write): Remove.
7564 (Cortex_a8_stub): New class definition.
7565 (Stub_factory::make_cortex_a8_stub): New method definition.
7566 (Stub_factory::Stub_factory): Add missing static storage class
7567 qualifier for elf32_arm_stub_a8_veneer_blx.
7569 2010-01-07 Ian Lance Taylor <iant@google.com>
7572 * options.h (class General_options): Add --warn-unresolved-symbols
7573 and --error-unresolved-symbols.
7574 * errors.cc (Errors::undefined_symbol): Implement
7575 --warn-unresolved-symbols.
7577 * options.h (class General_options): Add -z text and -z textoff.
7578 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7580 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7582 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7583 (Garbage_collection::cident_sections): New function.
7584 (Garbage_collection::add_cident_section): New function.
7585 (Garbage_collection::cident_sections_): New member.
7586 (gc_process_relocs): Add references to sections whose names are C
7588 * gold.h (cident_section_start_prefix): New constant.
7589 (cident_section_stop_prefix): New constant.
7590 (is_cident): New function.
7591 * layout.cc (Layout::define_section_symbols): Replace string constants
7592 with the newly defined constants.
7593 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7595 * testsuite/Makefile.am: Add gc_orphan_section_test.
7596 * testsuite/Makefile.in: Regenerate.
7597 * testsuite/gc_orphan_section_test.cc: New file.
7598 * testsuite/gc_orphan_section_test.sh: New file.
7600 2010-01-06 Ian Lance Taylor <iant@google.com>
7603 * options.h (class General_options): Add --warn-shared-textrel.
7604 * layout.cc (Layout::finish_dynamic_section): Implement
7605 --warn-shared-textrel.
7608 * options.h (class General_options): Add --warn-multiple-gp.
7610 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7612 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7613 $(THREADSLIB) and $(LIBDL).
7614 * Makefile.in: Rebuild.
7616 2010-01-06 Ian Lance Taylor <iant@google.com>
7619 * options.cc (General_options::parse_section_start): New function.
7620 (General_options::section_start): New function.
7621 (General_options::General_options): Initialize all members.
7622 * options.h: Include <map>
7623 (class General_options): Add --section-start. Add section_starts_
7625 * layout.cc (Layout::attach_allocated_section_to_segment): If
7626 --section-start was used, set the address of the segment. Remove
7627 local sort_sections.
7628 (Layout::relaxation_loop_body): If the address of the load segment
7629 has been set by --section-start, don't use it.
7630 * output.h (Output_segment::update_flags_for_output_section): New
7632 * output.cc (Output_segment::add_output_section): Call
7633 update_flags_for_output_section.
7635 2010-01-05 Ian Lance Taylor <iant@google.com>
7638 * options.h (class General_options): Add --undefined-version.
7639 * script.cc (struct Version_expression): Add was_matched_by_symbol
7641 (Version_script_info::matched_symbol): New function.
7642 (Version_script_info::get_symbol_version_helper): Call
7644 (Version_script_info::check_unmatched_names): New function.
7645 * script.h (class Version_script_info): Update declarations.
7646 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7648 * options.h (class General_options): Use DEFINE_bool_alias for
7649 allow_multiple_definition.
7650 * resolve.cc (Symbol_table::should_override): Don't test
7651 allow_multiple_definition.
7654 * options.h (class General_options): Add --cref.
7655 * main.cc (main): Print cref table if --cref. Don't close mapfile
7656 until after printing cref table.
7657 * cref.cc: Include "symtab.h".
7658 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7659 (Cref_table_compare::operator()): New function.
7660 (Cref_inputs::gather_cref): New function.
7661 (filecol): New static const.
7662 (Cref_inputs::print_cref): New function.
7663 (Cref::print_cref): New function.
7664 * cref.h: Include <cstdio>.
7665 (class Cref): Update declarations.
7666 * mapfile.h (Mapfile::file): New function.
7667 * object.h (class Object): Define Symbols. Declare virtual
7668 do_get_global_symbols.
7669 (Object::get_global_symbols): New function.
7670 * object.cc (Input_objects::add_object): Pass object to cref_ if
7672 (Input_objects::archive_start): Likewise.
7673 (Input_objects::archive_stop): Likewise.
7674 (Input_objects::print_cref): New function.
7675 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7676 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7678 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7680 * plugin.h (class Sized_pluginobj): Update declarations.
7682 2010-01-05 Ian Lance Taylor <iant@google.com>
7684 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7685 to is_default_version. Rename insdef to insdefault.
7686 (Symbol_table::add_from_relobj): Rename def to is_default_version
7687 and local to is_forced_local.
7688 (Symbol_table::add_from_pluginobj): Likewise.
7689 (Symbol_table::add_from_dynobj): Likewise.
7690 (Symbol_table::define_special_symbol): Rename insdef to
7693 2010-01-04 Ian Lance Taylor <iant@google.com>
7696 * options.h (class General_options): Add
7697 --allow-multiple-definition and -z muldefs.
7698 * resolve.cc (Symbol_table::should_override): Don't warn about a
7699 multiple symbol definition if --allow-multiple-definition or -z
7703 * options.h (class General_options): Add --add-needed and
7704 --copy-dt-needed-entries. Tweak --as-needed help entry.
7705 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7706 error if --copy-dt-needed-entries aka --add-needed is used and
7707 would cause a change in behaviour.
7710 * options.h (class General_options): Add -G as a short version of
7711 --shared. Add no-op options -assert, -g, and -i.
7713 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7715 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7716 check for .text or .gnu.linkonce.t sections.
7717 * icf.cc (Icf::find_identical_sections): Ditto.
7718 Change the detection for mangled function name within the section
7720 * icf.h (is_section_foldable_candidate): New function.
7722 2009-12-30 Ian Lance Taylor <iant@google.com>
7725 * options.h (class General_options): Permit two dashes with
7726 --retain-symbols-file.
7728 2009-12-30 Ian Lance Taylor <iant@google.com>
7731 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7732 don't put the file header and segment headers in the text
7736 * common.cc (Sort_commons::operator()): Stabilize sort when both
7738 (Symbol_table::do_allocate_commons_list): When allocating common
7739 symbols, skip a symbol which is no longer common.
7740 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7741 an object before checking its type.
7742 * testsuite/common_test_2.c: New file.
7743 * testsuite/common_test_3.c: New file.
7744 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7745 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7746 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7747 (common_test_2_pic.o, common_test_2.so): New targets.
7748 (common_test_3_pic.o, common_test_3.so): New targets.
7749 * testsuite/Makefile.in: Rebuild.
7752 * script.cc (read_input_script): If we see a new SECTIONS clause,
7753 and we have added an input section, give an error.
7754 * layout.h (class Layout): Add have_added_input_section function.
7755 Add have_added_input_section_ field.
7756 * layout.cc (Layout::Layout): Initialize
7757 have_added_input_section_.
7758 (Layout::layout): Set have_added_input_section_.
7759 (Layout::layout_eh_frame): Likewise.
7761 2009-12-30 Ian Lance Taylor <iant@google.com>
7764 * options.h (class General_options): Add --sort-common option.
7765 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7766 * common.cc (Sort_common): Add sort_order parameter to
7767 constructor. Add sort_order_ field.
7768 (Sort_commons::operator): Check sort_order_.
7769 (Symbol_table::allocate_commons): Determine the sort order.
7770 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7772 (Symbol_table::do_allocate_commons_list): Likewise.
7774 2009-12-30 Ian Lance Taylor <iant@google.com>
7777 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7778 symbols from this object, don't change the visibility of an
7780 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7782 2009-12-30 Ian Lance Taylor <iant@google.com>
7785 * script.h (class Version_script_info): Define Language enum.
7786 Update declarations. Define Glob, Exact, and Lookup types. Add
7787 new fields globals_, locals_, and is_finalized_.
7788 * script.cc: Various formatting fixes.
7789 (class Parser_closure): Change language_stack_ from a vector of
7790 std::string to one of Version_script_info::Language. Adjust all
7792 (class Lazy_demangler): Remove.
7793 (struct Version_expression): Change language from std::string to
7794 Version_script_info::Language.
7795 (Version_script_info::Version_script_info): New function.
7796 (Version_script_info::~Version_script_info): Don't call clear.
7797 (Version_script_info::finalize): New function.
7798 (Version_script_info::build_lookup_tables): New function.
7799 (Version_script_info::build_expression_list_lookup): New
7801 (Version_script_info::get_symbol_version_helper): Rewrite to use
7803 (Version_script_info::print_expression_list): Adjust to use
7804 Version_script_info::Language.
7805 (script_push_lex_into_version_mode): Check that the version script
7806 has not been finalized.
7807 (version_script_push_lang): Change language string to
7808 Version_script_info::Language.
7809 * options.cc (Command_line::version_script): New function.
7810 * options.h (class General_options): Add finalize_dynamic_list
7811 function. Change version_script from declaration to definition.
7812 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7813 * testsuite/version_script.map: Remove duplicate def of foo.
7814 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7816 * testsuite/Makefile.in: Rebuild.
7818 2009-12-30 Ian Lance Taylor <iant@google.com>
7821 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7822 if the input symbol index is 0, make the output symbol index 0.
7824 2009-12-30 Ian Lance Taylor <iant@google.com>
7827 * options.h (class General_options): Add -x/--discard-all.
7828 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7829 --discard-all. If the local symbol needs a dynamic entry, check
7830 that before handling --discard-locals.
7832 2009-12-30 Ian Lance Taylor <iant@google.com>
7835 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7837 (Output_segment::add_output_section): Don't change the flags if
7841 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7842 GNU hash table if they need a dynamic value. Otherwise, don't add
7843 them if they are defined in a dynamic object or are forced local.
7845 2009-12-29 Ian Lance Taylor <iant@google.com>
7848 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7849 .gnu.hash table for a 32-bit target.
7852 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7853 regular and a dynamic object only needs a dynamic symbol table
7854 entry if it is externally visible.
7857 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7858 constructor. Add global_offset_table_ field.
7859 (Target_i386::got_section): Set global_offset_table_.
7860 (Target_i386::do_finalize_sections): Set global_offset_table_
7862 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7863 in constructor. Add global_offset_table_ field.
7864 (Target_x86_64::got_section): Set global_offset_table_.
7865 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7868 * layout.cc (Layout::Layout): Initialize increase_relro_.
7869 (Layout::get_output_section): Add is_relro, is_last_relro, and
7870 is_first_non_relro parameters. Change all callers.
7871 (Layout::choose_output_section): Likewise.
7872 (Layout::add_output_section_data): Likewise.
7873 (Layout::make_output_section): Likewise.
7874 (Layout::set_segment_offsets): Clear increase_relro when using a
7876 * layout.h (class Layout): Add increase_relro method. Add
7877 increase_relro_ field. Update declarations.
7878 * output.cc (Output_section::Output_section): Initialize
7879 is_last_relro_ and is_first_non_relro_.
7880 (Output_segment::add_output_section): Group relro sections is
7881 do_sort is true. Handle is_last_relro and is_first_non_relro.
7882 (Output_segment::maximum_alignment): Remove relro handling.
7883 (Output_segment::set_section_addresses): Add increase_relro
7884 parameter. Change all callers. Add initial alignment to align
7885 relro sections on separate page. Remove old relro handling.
7886 (Output_segment::set_section_list_addresses): Remove in_relro
7887 parameter. Change all callers.
7888 (Output_segment::set_offset): Add increase parameter. Change all
7889 callers. Remove old relro handling.
7890 * output.h (class Output_section): Add new methods: is_last_relro,
7891 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7892 Add is_last_relro_ and is_first_non_relro_ fields.
7893 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7894 Create separate .got.plt section. Call increase_relro.
7895 * x86_64.cc (Target_x86_64::got_section): Likewise.
7896 * testsuite/relro_script_test.t: Add .got.plt.
7899 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7900 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7901 (Layout::finalize): Call set_dynamic_symbol_size.
7902 (Layout::set_dynamic_symbol_size): New function.
7903 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7904 set_dynamic_symbol_size.
7907 * output.h (class Output_section): Add is_entsize_zero_ field.
7908 * output.cc (Output_section::Output_section): Initialize
7910 (Output_section::set_entsize): If two different entsizes are
7911 requested, force it to zero.
7912 (Output_section::add_input_section): Set flags for .debug_str
7913 before updating section flags. Set entsize.
7914 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7915 and SHF_STRING if all input sections have those flags.
7917 2009-12-29 Rafael Espindola <espindola@google.com>
7919 * main.cc (main): Fix the sys time reporting.
7920 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7923 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7925 * options.cc (General_options::parse_version): Allow -v to exit
7926 without an error if there is nothing to link.
7928 2009-12-29 Ian Lance Taylor <iant@google.com>
7930 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7931 using a version of gcc before 4.1.
7932 * configure: Rebuild.
7934 2009-12-28 Chris Demetriou <cgd@google.com>
7936 * attributes.cc (Output_attributes_section_data::do_write): Use
7937 std::vector::front rather than std::vector::data.
7939 2009-12-28 Ian Lance Taylor <iant@google.com>
7941 * symtab.h (class Symbol_table): Add enum Defined.
7942 * resolve.cc (Symbol_table::should_override): Add defined
7943 parameter. Change all callers. Test whether object is NULL
7944 before calling a method on it.
7945 (Symbol_table::report_resolve_problem): Add defined parameter.
7947 (Symbol_table::should_override_with_special): Likewise.
7948 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7949 parameter. Change all callers.
7950 (Symbol_table::do_define_in_output_data): Likewise.
7951 (Symbol_table::define_in_output_segment): Likewise.
7952 (Symbol_table::do_define_in_output_segment): Likewise.
7953 (Symbol_table::define_as_constant): Likewise.
7954 (Symbol_table::do_define_as_constant): Likewise.
7955 * script.h (class Symbol_assignment): Add is_defsym parameter to
7956 constructor; change all callers.
7957 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7958 parameter. Change all callers. Add is_defsym_ field.
7959 (class Parser_closure): Add parsing_defsym parameter to
7960 constructor; change all callers. Add parsing_defsym accessor
7961 function. Add parsing_defsym_ field.
7963 2009-12-28 Ian Lance Taylor <iant@google.com>
7965 * gold.cc (queue_middle_tasks): Fix formatting.
7966 * object.cc (Relobj::is_section_name_included): Likewise.
7968 2009-12-23 Ian Lance Taylor <iant@google.com>
7970 * i386.cc (Target_i386::do_calls_non_split): Recognize
7971 -fsplit-stack prologue for a function with a static chain.
7972 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7973 -fsplit-stack prologue when using %r11.
7975 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7977 * options.cc (General_options::parse_version): Make -v continue and do
7978 the link like GNU ld does.
7980 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7982 * Makefile.am (CCFILES): Add timer.cc.
7983 (HFILES): Add timer.h.
7984 * configure.ac: Check for sysconf and times.
7985 * main.cc: include timer.h.
7986 (main): Use Timer instead of get_run_time.
7989 * workqueue.cc: include timer.h.
7990 (Workqueue::find_and_run_task):
7991 Report user, sys and wall time.
7992 * Makefile.in: Regenerate.
7993 * config.in: Regenerate.
7994 * configure: Regenerate.
7996 2009-12-16 Doug Kwan <dougkwan@google.com>
7998 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8000 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8001 relaxed input sections.
8002 * output.cc (Output_section::find_relaxed_input_section): Change
8003 return type to Output_relaxed_input_section pointer. Adjust code
8004 for new type of relaxed_input_section_map_.
8005 * output.h (Output_section::find_relaxed_input_section): Change
8006 return type to Output_relaxed_input_section pointer.
8007 (Output_section::Output_relaxed_input_section_by_input_section_map):
8009 (Output_section::relaxed_input_section_map_): Change type to
8010 Output_section::Output_relaxed_input_section_by_input_section_map.
8011 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8014 2009-12-15 Ian Lance Taylor <iant@google.com>
8016 * layout.cc (Layout::create_shstrtab): Only write out after input
8017 sections if we are compressing debug sections.
8019 2009-12-15 Ian Lance Taylor <iant@google.com>
8021 * archive.cc (Archive::add_symbols): Only look up a symbol without
8022 a version if there is, in fact, a version.
8024 2009-12-14 Ian Lance Taylor <iant@google.com>
8026 Revert -Wshadow changes, all changes from:
8027 2009-12-11 Doug Kwan <dougkwan@google.com>
8028 2009-12-11 Nick Clifton <nickc@redhat.com>
8029 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8031 2009-12-11 Doug Kwan <dougkwan@google.com>
8033 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8035 * attributes.cc (Object_attribute::size): Ditto.
8036 (Attributes_section_data::size): Ditto.
8037 (Attributes_section_data::Attributes_section_data): Ditto.
8038 (Output_attributes_section_data::do_write): Ditto.
8039 * attributes.h (Object_attribute::set_type): Ditto.
8040 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8042 2009-12-11 Nick Clifton <nickc@redhat.com>
8044 * archive.cc: Fix shadowed variable warnings.
8046 * compressed_output.cc: Likewise.
8047 * compressed_output.h: Likewise.
8048 * configure: Likewise.
8049 * dwarf_reader.cc: Likewise.
8050 * dynobj.cc: Likewise.
8051 * dynobj.h: Likewise.
8052 * ehframe.cc: Likewise.
8053 * ehframe.h: Likewise.
8054 * errors.cc: Likewise.
8055 * expression.cc: Likewise.
8056 * fileread.cc: Likewise.
8057 * fileread.h: Likewise.
8058 * freebsd.h: Likewise.
8059 * i386.cc: Likewise.
8061 * incremental.h: Likewise.
8062 * layout.cc: Likewise.
8063 * layout.h: Likewise.
8064 * mapfile.cc: Likewise.
8065 * merge.cc: Likewise.
8066 * merge.h: Likewise.
8067 * object.cc: Likewise.
8068 * object.h: Likewise.
8069 * options.h: Likewise.
8070 * output.cc: Likewise.
8071 * output.h: Likewise.
8072 * parameters.cc: Likewise.
8073 * plugin.cc: Likewise.
8074 * powerpc.cc: Likewise.
8075 * reduced_debug_output.cc: Likewise.
8076 * reduced_debug_output.h: Likewise.
8077 * reloc.cc: Likewise.
8078 * reloc.h: Likewise.
8079 * resolve.cc: Likewise.
8080 * script-sections.cc: Likewise.
8081 * script.cc: Likewise.
8082 * script.h: Likewise.
8083 * sparc.cc: Likewise.
8084 * symtab.cc: Likewise.
8085 * symtab.h: Likewise.
8086 * target-select.cc: Likewise.
8087 * target-select.h: Likewise.
8088 * token.h: Likewise.
8089 * workqueue.cc: Likewise.
8090 * workqueue.h: Likewise.
8091 * x86_64.cc: Likewise.
8093 2009-12-10 Doug Kwan <dougkwan@google.com>
8095 * arm.cc (attributes.h): New include.
8096 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8097 (Arm_relobj::~Arm_relobj): Delete object pointed by
8098 attributes_section_data_.
8099 (Arm_relobj::attributes_section_data): New method definition.
8100 (Arm_relobj::attributes_section_data_): New data member declaration.
8101 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8102 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8103 attributes_section_data_.
8104 (Arm_dynobj::attributes_section_data): New method definition.
8105 (Arm_dynobj::attributes_section_data_): New data member declaration.
8106 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8107 initialization value of may_use_blx_ to false.
8108 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8109 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8110 object attributes to compute results instead of hard-coding.
8111 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8112 Target_arm::get_secondary_compatible_arch,
8113 Target_arm::set_secondary_compatible_arch
8114 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8115 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8116 New method declarations.
8117 (Target_arm::get_aeabi_object_attribute): New method definition.
8118 (Target_arm::attributes_section_data_): New data member declaration.
8119 (read_arm_attributes_section): New template definition.
8120 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8121 (Arm_dynobj::do_read_symbols): Ditto.
8122 (Target_arm::do_finalize_sections): Merge attributes sections from
8123 input. Check for BLX use after attributes section merging.
8124 Fix __exidx_start and __exidx_end visibility. Create an
8125 .ARM.attributes section if necessary.
8126 (Target_arm::get_secondary_compatible_arch,
8127 Target_arm::set_secondary_compatible_arch,
8128 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8129 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8130 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8131 New method definitions.
8133 2009-12-09 Ian Lance Taylor <iant@google.com>
8135 * plugin.cc (Plugin::load): Don't cast from void* to a function
8138 2009-12-09 Ian Lance Taylor <iant@google.com>
8140 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8143 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8145 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8146 Replace two_file_shared_1.so with two_file_shared_2.so.
8147 * testsuite/Makefile.in: Regenerated.
8149 2009-12-08 Doug Kwan <dougkwan@google.com>
8151 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8152 (HFILES): Add attributes.h and int_encoding.h.
8153 * Makefile.in: Regenerate.
8154 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8155 function definitions to int_encoding.cc
8156 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8157 prototypes to int_encoding.h
8158 * reduced_debug_output.cc (int_encoding.h): New include.
8159 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8160 function definitions to int_encoding.cc
8161 (insert_into_vector, read_from_pointer): Move template definitions to
8163 * attributes.cc: New file.
8164 * attributes.h: New file.
8165 * int_encoding.cc: New file.
8166 * int_encoding.h: New file.
8168 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8171 * incremental-dump.cc (dump_incremental_inputs): New.
8172 (main): Use dump_incremental_inputs.
8174 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8177 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8178 checking elfcpp::STT_FUNC.
8179 (Target_i386::Relocate::relocate): Likewise.
8180 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8182 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8183 symbols from shared libraries into normal FUNC symbols.
8185 * symtab.h (Symbol): Add is_func and use it.
8187 2009-12-05 Doug Kwan <dougkwan@google.com>
8189 * arm.cc (Target_arm::arm_info): Initialize new fields
8190 attributes_section and attributes_vendor.
8191 * i386.cc (Target_i386::i386_info): Same.
8192 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8193 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8194 fields attributes_section and attributes_vendor.
8195 * sparc.cc (Target_sparc::sparc_info): Same.
8196 * target.h (Target::attributes_section, Target::attributes_vendor,
8197 Target::is_attributes_section, Target::attribute_arg_type,
8198 Target::attributes_order): New method definitions.
8199 (Target::Target_info::attributes_section,
8200 Target::Target_info::attributes_vendor): New fields.
8201 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8202 virtual method definitions.
8203 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8204 attributes_section and attributes_vendor.
8205 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8207 2009-12-05 Doug Kwan <dougkwan@google.com>
8209 * arm.cc: Update comments about interworking and stub generation.
8210 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8211 considered as non-PIC.
8212 (Arm_relocate_functions::base_abs): Fix formatting.
8213 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8214 of function to use GOT entry address instead of offset.
8215 (Target_arm::Scan::global): Issue an error if a symbol would need a
8216 PLT does not get one because it is untyped. Remove code to create
8217 dynamic symbols for relative branches.
8218 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8219 takes unsigned integer instead of boolean.
8221 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8223 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8224 (two_file_test_LDADD): Likewise.
8225 (common_test_1_LDADD): Likewise.
8226 (exception_test_LDADD) Likewise.
8227 (weak_test_LDADD): Likewise.
8228 (many_sections_test_LDADD): Likewise.
8229 (initpri1_LDADD): Likewise.
8230 (script_test_1_LDADD): Likewise.
8231 (script_test_2_LDADD): Likewise.
8232 (justsyms_LDADD): Likewise.
8233 (binary_test_LDADD): Likewise.
8234 (large_LDADD): Likewise.
8235 * testsuite/Makefile.in: Regenerated.
8237 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8239 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8240 (Symbol_table::override_with_special): Likewise.
8241 (Symbol_table::add_from_object): Likewise.
8243 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8245 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8246 Don't set the data_offset twice.
8248 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8250 * testsuite/Makefile.in: Regenerate.
8252 2009-12-03 Doug Kwan <dougkwan@google.com>
8254 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8255 (Target_arm::do_finalize_sections): Add parameter for symbol table
8256 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8257 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8258 parameter for symbol table pointer.
8259 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8260 an additional parameter for a pointer to symbol table.
8261 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8262 parameter for a symbol table pointer.
8263 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8264 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8266 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8267 parameter for a symbol table pointer.
8269 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8271 * incremental.cc (Incremental_inputs_header)
8272 (Incremental_inputs_header_write, Incremental_inputs_entry)
8273 (Incremental_inputs_entry_write): Move ...
8274 * incremental.h (Incremental_inputs_header)
8275 (Incremental_inputs_header_write, Incremental_inputs_entry)
8276 (Incremental_inputs_entry_write): here.
8278 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8280 * incremental.cc (make_sized_incremental_binary): Set the target.
8281 Error if it is incompatible.
8282 * output.h (Output_file): Add filename method.
8284 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8286 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8287 from the get_* methods.
8289 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8291 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8292 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8293 Write 0 for the data_offset of scripts.
8295 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8297 * testsuite/Makefile.am: Add the incremental_test.sh test.
8298 * testsuite/incremental_test.sh: New.
8299 * testsuite/incremental_test_1.c: New.
8300 * testsuite/incremental_test_2.c: New.
8302 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8304 * incremental-dump.cc (main): Fix typos.
8306 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8309 * incremental-dump.cc (main): Use llu to print 64 bit values.
8311 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8312 H.J. Lu <hongjiu.lu@intel.com>
8314 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8316 (incremental_dump_LDADD): Likewise.
8317 * Makefile.in: Regenerated.
8319 2009-11-25 Doug Kwan <dougkwan@google.com>
8323 2009-11-25 Doug Kwan <dougkwan@google.com>
8325 * arm.cc (Target_arm::Target_arm): Move method definition
8326 outside of class definition. Add code to handle
8327 --target1-rel, --target1-abs and --target2= options.
8328 (Target_arm::get_reloc_reloc_type): Change method to be
8329 non-static and const.
8330 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8331 New data member declaration.
8332 (Target_arm::Scan::local, Target_arm::Scan::global,
8333 Target_arm::Relocate::relocate,
8334 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8335 Adjust call to Target_arm::get_real_reloc_type.
8336 (Target_arm::get_real_reloc_type): Use command line options
8337 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8338 * options.h (--target1-rel, --target1-abs, --target2): New
8341 2009-11-25 Doug Kwan <dougkwan@google.com>
8343 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8344 class definition. Add code to handle --target1-rel, --target1-abs
8345 and --target2= options.
8346 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8348 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8350 (Target_arm::Scan::local, Target_arm::Scan::global,
8351 Target_arm::Relocate::relocate,
8352 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8353 call to Target_arm::get_real_reloc_type.
8354 (Target_arm::get_real_reloc_type): Use command line options to
8355 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8356 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8359 2009-11-25 Doug Kwan <dougkwan@google.com>
8361 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8362 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8363 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8365 (Arm_relocate_functions::thm_call): Replace body with a call to
8366 Arm_relocate_functions::thumb_branch_common.
8367 (Arm_relocate_functions::thm_jump24,
8368 Arm_relocate_functions::thm_xpc22): New method definitions.
8369 (Arm_relocate_functions::thumb_branch_common): New method definition.
8370 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8372 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8373 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8375 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8377 * Makefile.am: Build incremental-dump
8378 * Makefile.in: Regenerate.
8379 * incremental-dump.cc: New.
8380 * incremental.cc (Incremental_inputs_header_data,
8381 Incremental_inputs_entry_data): Move to incremental.h
8382 * incremental.h: (Incremental_inputs_header_data,
8383 Incremental_inputs_entry_data): Move from incremental.cc
8385 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8387 * incremental.cc (Incremental_inputs_header,
8388 Incremental_inputs_header_write, Incremental_inputs_entry,
8389 Incremental_inputs_entry_write): Add a typedef with the data type.
8391 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8393 * incremental.cc (Incremental_inputs_header,
8394 Incremental_inputs_header_write, Incremental_inputs_entry,
8395 Incremental_inputs_entry_write): Update comment about which
8396 type has the filed descriptions.
8398 2009-11-15 Doug Kwan <dougkwan@google.com>
8400 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8401 (Arm_relocate_functions::arm_branch_common): Change method defintion
8402 in class definition to a method declaration and update list of formal
8404 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8405 Arm_relocation_functions::jump24): Adjust call to
8406 Arm_relocate_functions::arm_branch_common. Update list of formal
8408 (Arm_relocate_functions::xpc25): New method definition.
8409 (Arm_relocate_functions::arm_branch_common): Move method defintion
8410 out from class definition. Use stubs for mode-switching and extending
8412 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8413 specially. Change code to enable use of stubs in ARM branches.
8415 2009-11-10 Doug Kwan <dougkwan@google.com>
8417 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8418 in method declaration.
8419 (Target_arm::relocate_stub): New method declaration.
8420 (Target_arm::default_target): Change to return a pointer instead of
8422 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8423 Target_arm::default_target.
8424 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8426 (Target_arm::relocate_section): Adjust view.
8427 (Target_arm::relocate_stub): New method definition.
8429 2009-11-10 Doug Kwan <dougkwan@google.com>
8431 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8433 * incremental.cc (open_incremental_binary): Initialized local
8434 variables to avoid warnings.
8435 * object.cc (make_elf_object): Ditto.
8436 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8439 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8442 * testsuite/plugin_test.c: Include "config.h".
8444 2009-11-09 Doug Kwan <dougkwan@google.com>
8446 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8447 (arm_symbol_value): Remove.
8448 (Arm_relocate_functions::arm_branch_common,
8449 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8450 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8451 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8452 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8453 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8454 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8455 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8456 Arm_relocate_functions::thm_mobw_abs_nc,
8457 Arm_relocate_functions::thm_mov_abs,
8458 Arm_relocate_functions::movw_prel_nc,
8459 Arm_relocate_functions::thm_movt_abs,
8460 Arm_relocate_functions::movt_prel,
8461 Arm_relocate_functions::thm_movw_prel_nc,
8462 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8463 (Target_arm::Relocate::relocate): Only decompose address into two
8464 parts if relocation type uses the thumb-bit and pass the actual
8465 bit instead of a flag indicating that the thumb-bit is used. Adjust
8466 calls to methods in Arm_relocate_functions for this change.
8468 2009-11-08 Ian Lance Taylor <iant@google.com>
8471 * reloc.cc: Instantiate
8472 Sized_relobj::initialize_input_to_output_maps and
8473 Sized_relobj:free_input_to_output_maps.
8475 2009-11-06 Ian Lance Taylor <iant@google.com>
8478 * defstd.cc (in_segment): Set only_if_ref true for "end".
8480 2009-11-06 Doug Kwan <dougkwan@google.com>
8482 * arm.cc (class Reloc_stub): Correct a comment.
8483 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8484 (Target_arm::scan_section_for_stubs): New method declaration.
8485 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8486 Change methods from private to protected.
8487 (Target_arm::do_may_relax): New method definition.
8488 (Target_arm::do_relax, Target_arm::group_sections,
8489 Target_arm::scan_reloc_for_stub,
8490 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8491 (Target_arm::arm_input_section_map_): New data member declaration.
8492 (Target_arm::scan_reloc_for_stub,
8493 Target_arm::scan_reloc_section_for_stubs,
8494 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8495 Target_arm::do_relax): New method definitions.
8497 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8499 * configure.ac: Check for (struct stat)::st_mtim
8500 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8501 * config.in: Regenerate.
8502 * configure: Regenerate.
8504 2009-11-05 Ian Lance Taylor <iant@google.com>
8507 * output.cc (Output_segment::add_output_section): Add missing
8510 2009-11-04 Ian Lance Taylor <iant@google.com>
8513 * object.h (class Object): Add is_needed and set_is_needed
8514 methods. Add is_needed_ field. Make bool fields into bitfields.
8515 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8516 defined in a dynamic object and referenced by a regular object,
8517 set is_needed for the dynamic object.
8518 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8519 if the file is marked with as_needed and it is not needed.
8521 2009-11-04 Ian Lance Taylor <iant@google.com>
8524 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8525 tags if data is discarded by linker script.
8526 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8527 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8528 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8529 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8531 2009-11-04 Ian Lance Taylor <iant@google.com>
8533 * layout.cc (Layout::get_output_section): Add is_interp and
8534 is_dynamic_linker_section parameters. Change all callers.
8535 (Layout::choose_output_section): Likewise.
8536 (Layout::make_output_section): Likewise.
8537 (Layout::add_output_section_data): Add is_dynamic_linker_section
8538 parameter. Change all callers.
8539 * layout.h (class Layout): Update declarations.
8540 * output.h (class Output_section): Add is_interp, set_is_interp,
8541 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8542 Add is_interp_, is_dynamic_linker_section_ fields. Change
8543 generate_code_fills_at_write_ to a bitfield.
8544 * output.cc (Output_section::Output_sections): Initialize new
8546 (Output_segment::add_output_section): Add do_sort parameter.
8549 2009-11-03 Ian Lance Taylor <iant@google.com>
8552 * options.h (class General_options): Add --warn-common.
8553 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8554 merging two common symbols.
8555 (Symbol_table::should_override): Handle --warn-common when merging
8556 a common symbol with a defined symbol. Use report_resolve_problem
8557 for multiple definitions.
8558 (Symbol_table::report_resolve_problem): New function.
8559 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8561 2009-11-03 Doug Kwan <dougkwan@google.com>
8563 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8565 (Target_arm::stub_factory): New method definition.
8566 (Target_arm::new_arm_input_section,
8567 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8568 Target_arm::reloc_uses_thumb_bit): New method declarations.
8569 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8570 New type definitions.
8571 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8572 member declarations.
8573 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8574 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8575 New method definitions.
8577 2009-11-03 Ian Lance Taylor <iant@google.com>
8579 * options.h (class General_options): Add --warn_constructors.
8581 2009-11-03 Ian Lance Taylor <iant@google.com>
8584 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8585 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8587 2009-11-03 Ian Lance Taylor <iant@google.com>
8590 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8591 --msgid-bugs-address.
8592 (install-pdf): New target.
8593 (install-data_yes): Look up one directory to find mkinstalldirs.
8595 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8597 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8600 2009-10-30 Doug Kwan <dougkwan@google.com>
8602 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8604 2009-10-30 Doug Kwan <dougkwan@google.com>
8606 * arm.cc (Stub_addend_reader): New struct template definition
8607 and partial specializations.
8608 (Stub_addend_reader::operator()): New method definition for a
8609 partially specialized template.
8611 2009-10-30 Doug Kwan <dougkwan@google.com>
8613 * arm.cc (Arm_relobj::processor_specific_flags): New method
8615 (Arm_relobj::do_read_symbols): New method declaration.
8616 (Arm_relobj::processor_specific_flags_): New data member declaration.
8617 (Arm_dynobj): New class definition.
8618 (Target_arm::do_finalize_sections): Add input_objects parameter.
8619 (Target_arm::do_adjust_elf_header): New method declaration.
8620 (Target_arm::are_eabi_versions_compatible,
8621 (Target_arm::merge_processor_specific_flags): New method declaration.
8622 (Target_arm::do_make_elf_object): New overloaded method definitions
8624 (Arm_relobj::do_read_symbols): New method definition.
8625 (Arm_dynobj::do_read_symbols): Ditto.
8626 (Target_arm::do_finalize_sections): Add input_objects parameters.
8627 Merge processor-specific flags from all input objects.
8628 (Target_arm::are_eabi_versions_compatible,
8629 Target_arm::merge_processor_specific_flags,
8630 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8631 New method definitions.
8632 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8633 Input_objects pointer type parameter.
8634 * layout.cc (Layout::finalize): Pass input objects to target's.
8635 finalize_sections function.
8636 * output.cc (Output_file_header::do_sized_write): Set ELF file
8637 header's processor-specific flags.
8638 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8639 Input_objects pointer type parameter.
8640 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8641 * target.h (Input_objects): New forward class declaration.
8642 (Target::processor_specific_flags,
8643 Target::are_processor_specific_flags_sect): New method definitions.
8644 (Target::finalize_sections): Add input_objects parameter.
8645 (Target::Target): Initialize processor_specific_flags_ and
8646 are_processor_specific_flags_set_.
8647 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8649 (Target::set_processor_specific_flags): New method definition.
8650 (Target::processor_specific_flags_,
8651 Target::are_processor_specific_flags_set_): New data member
8653 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8654 Input_objects pointer type parameter.
8656 2009-10-30 Doug Kwan <dougkwan@google.com>
8658 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8660 2009-10-28 Ian Lance Taylor <iant@google.com>
8662 * object.h (class Relobj): Drop options parameter from
8663 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8664 do_scan_relocs, do_relocate. Change all callers.
8665 (class Sized_relobj): Drop options parameters from
8666 do_gc_process_relocs, do_scan_relocs, do_relocate,
8667 do_relocate_sections, relocate_sections, emit_relocs_scan,
8668 emit_relocs_scan_reltype. Change all callers.
8669 (struct Relocate_info): Remove options field and all references to
8671 * reloc.h (class Read_relocs): Remove options constructor
8672 parameter and options_ field. Change all callers.
8673 (class Gc_process_relocs, class Scan_relocs): Likewise.
8674 (class Relocate_task): Likewise.
8675 * target-reloc.h (scan_relocs): Remove options parameter. Change
8677 (scan_relocatable_relocs): Likewise.
8678 * target.h (class Sized_target): Remove options parameter from
8679 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8681 * gc.h (gc_process_relocs): Remove options parameter. Change all
8683 * arm.cc: Update functions to remove options parameters.
8684 * i386.cc: Likewise.
8685 * powerpc.cc: Likewise.
8686 * sparc.cc: Likewise.
8687 * x86_64.cc: Likewise.
8688 * testsuite/testfile.cc: Likewise.
8690 2009-10-28 Doug Kwan <dougkwan@google.com>
8692 * arm.cc (Arm_relobj): New class definition.
8693 (Arm_relobj::scan_sections_for_stubs,
8694 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8695 New method definitions.
8697 2009-10-28 Cary Coutant <ccoutant@google.com>
8699 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8700 (Plugin::cleanup_done_): New member.
8701 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8702 (Plugin_manager::cleanup_done_): Remove.
8703 (Plugin_manager::add_input_file): Edit error message.
8704 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8705 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8707 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8709 * fileread.cc: (File_read::View::~View): Use the new
8710 data_ownership_ filed.
8711 (File_read::~File_read): Dispose the new whole_file_view_.
8712 (File_read::open): Mmap the whole file if needed.
8713 (File_read::open): Use whole_file_view_ instead of contents_.
8714 (File_read::find_view): Use whole_file_view_ if applicable.
8715 (File_read::do_read): Use whole_file_view_ instead of contents_.
8716 (File_read::make_view): Use whole_file_view_ instead of contents_,
8717 update File_read::View::View call.
8718 (File_read::find_or_make_view): Update File_read::View::View
8720 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8722 (File_read::View::Data_ownership): New enum.
8723 (File_read::View::View): Replace bool mapped_ with Data_ownership
8725 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8726 (File_read::View::data_ownership_): New field.
8727 (File_read::contents_): Remove (replaced by whole_file_view_).
8728 (File_read::whole_file_view_): New field.
8729 * options.h (class General_options): Add --keep-files-mapped.
8731 2009-10-27 Cary Coutant <ccoutant@google.com>
8733 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8734 * testsuite/Makefile.am (plugin_test_5): New test case.
8735 * testsuite/Makefile.in: Regenerate.
8737 2009-10-25 Doug Kwan <dougkwan@google.com>
8739 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8740 from private to protected to allow access by child class.
8741 (Sized_relobj::do_relocate_sections): New method declaration.
8742 (Sized_relobj::relocate_sections): Virtualize.
8743 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8744 Sized_relobj::relocate_sections. Instantiate template explicitly
8745 for different target sizes and endianity.
8747 2009-10-24 Doug Kwan <dougkwan@google.com>
8749 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8750 (Arm_input_section::as_arm_input_section): New method.
8751 (Arm_output_section): New class definition.
8752 (Arm_output_section::create_stub_group,
8753 Arm_output_section::group_sections): New method definitions.
8755 2009-10-22 Doug Kwan <dougkwan@google.com>
8757 * arm.cc (Arm_input_section): New class definition.
8758 (Arm_input_section::init, Arm_input_section:do_write,
8759 Arm_input_section::set_final_data_size,
8760 Arm_input_section::do_reset_address_and_file_offset): New method
8763 2009-10-21 Doug Kwan <dougkwan@google.com>
8765 * arm.cc (Stub_table, Arm_input_section): New forward class
8767 (Stub_table): New class defintion.
8768 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8769 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8770 New method definition.
8772 2009-10-21 Doug Kwan <dougkwan@google.com>
8774 * arm.cc: Update copyright comments.
8775 (Target_arm): New forward class template declaration.
8776 (Arm_address): New type.
8777 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8778 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8779 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8781 (Insn_template): Same.
8782 (DEF_STUBS): New macro.
8783 (Stub_type): New enum type.
8784 (Stub_template): New class definition.
8787 (Stub_factory): Same.
8788 (Target_arm::Target_arm): Initialize may_use_blx_ and
8789 should_force_pic_veneer_.
8790 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8791 Target_arm::should_force_pic_veneer,
8792 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8793 Target_arm::using_thumb_only, Target_arm:;default_target): New
8795 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8796 New data member declarations.
8797 (Insn_template::size, Insn_template::alignment): New method defintions.
8798 (Stub_template::Stub_template): New method definition.
8799 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8800 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8801 (Stub_factory::Stub_factory): New method definition.
8802 * gold.h (string_hash): New template.
8803 * output.h (Input_section_specifier::hash_value): Use
8805 (Input_section_specifier::string_hash): Remove.
8806 * stringpool.cc (Stringpool_template::string_hash): Use
8809 2009-10-20 Doug Kwan <dougkwan@google.com>
8811 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8812 symbols of relaxed input sections.
8813 * output.h (Output_section::find_relaxed_input_section): Make
8816 2009-10-16 Doug Kwan <dougkwan@google.com>
8818 * dynobj.cc (Versions::Versions): Initialize version_script_.
8819 Only insert base version symbol definition for a shared object
8820 if version script defines any version versions.
8821 (Versions::define_base_version): New method definition.
8822 (Versions::add_def): Check that base version is not needed.
8823 (Versions::add_need): Define base version lazily.
8824 * dynobj.h (Versions::define_base_version): New method declaration.
8825 (Versions::needs_base_version_): New data member declaration.
8826 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8827 (check_DATA): Add no_version_test.stdout.
8828 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8830 * testsuite/Makefile.in: Regenerate.
8831 * testsuite/no_version_test.c: New file.
8832 * testsuite/no_version_test.sh: Ditto.
8834 2009-10-16 Doug Kwan <dougkwan@google.com>
8836 * expression.cc (class Segment_start_expression): New class definition.
8837 (Segment_start_expression::value): New method definition.
8838 (script_exp_function_segment_start): Return a new
8839 Segment_start_expression.
8840 * gold/script-c.h (script_saw_segment_start_expression): New function
8842 * script-sections.cc (Script_sections::Script_sections): Initialize
8843 SAW_SEGMENT_START_EXPRESSION_ to false.
8844 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8845 and -Tbbs options to specify section addresses if given in
8846 command line and no SEGMENT_START expression is seen in a script.
8847 * script-sections.h (Script_sections::saw_segment_start_expression,
8848 Script_sections::set_saw_segment_start_expression): New method
8850 (Script_sections::saw_segment_start_expression_): New data member
8852 * script.cc (script_saw_segment_start_expression): New function.
8853 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8854 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8855 script_test_7.sh and script_test_8.sh.
8856 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8857 script_test_8.stdout.
8858 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8859 (script_test_6, script_test_6.stdout, script_test_7,
8860 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8861 * Makefile.in: Regenerate.
8862 * testsuite/script_test_6.sh: New file.
8863 * testsuite/script_test_6.t: Same.
8864 * testsuite/script_test_7.sh: Same.
8865 * testsuite/script_test_7.t: Same.
8866 * testsuite/script_test_8.sh: Same.
8868 2009-10-16 Doug Kwan <dougkwan@google.com>
8870 * output.cc (Output_segment::set_section_list_address): Cast
8871 expressions to unsigned long long type to avoid format warnings.
8873 2009-10-15 Ian Lance Taylor <iant@google.com>
8875 * script.cc (Script_options::add_symbol_assignment): Always add a
8876 dot assignment to script_sections_.
8877 * script-sections.cc (Script_sections::add_dot_assignment):
8878 Initialize if necessary.
8880 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8881 program headers with no load segment if there is a linker script.
8883 * layout.cc (Layout::set_segment_offsets): Align the file offset
8884 to the segment aligment for -N or -n with no load segment.
8885 * output.cc (Output_segment::add_output_section): Don't crash if
8886 the first section is a TLS section.
8887 (Output_segment::set_section_list_addresses): Print an error
8888 message if the address moves backward in a linker script.
8889 * script-sections.cc
8890 (Output_section_element_input::set_section_addresses): Don't
8891 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8892 (Orphan_output_section::set_section_addresses): Likewise.
8894 2009-10-15 Doug Kwan <dougkwan@google.com>
8896 * layout.cc (Layout::finish_dynamic_section): Generate tags
8897 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8898 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8899 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8901 2009-10-14 Ian Lance Taylor <iant@google.com>
8903 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8905 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8906 data_shdr fields of relinfo.
8907 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8908 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8909 R_386_TLS_LDO_32, adjust based on section flags.
8910 (Target_i386::Relocate::fix_up_ldo): Remove.
8912 2009-10-13 Ian Lance Taylor <iant@google.com>
8914 Add support for -pie.
8915 * options.h (class General_options): Add -pie and
8917 (General_options::output_is_position_independent): Test -pie.
8918 (General_options::output_is_executable): Return true if not shared
8919 and not relocatable.
8920 (General_options::output_is_pie): Remove.
8921 * options.cc (General_options::finalize): Reject incompatible uses
8923 * gold.cc (queue_middle_tasks): A -pie link is not static.
8924 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8925 * symtab.cc (Symbol::final_value_is_known): Return false if
8926 output_is_position_independent.
8927 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8928 output_is_position_independent.
8929 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8930 output_is_position_independent.
8931 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8932 output_is_position_independent.
8933 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8935 (basic_pie_test.o, basic_pie_test): New targets.
8936 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8937 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8938 (two_file_pie_test): New target.
8939 * testsuite/Makefile.in: Rebuild.
8940 * README: Remove note saying that -pie is not supported.
8942 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8944 * options.h (class General_options): Add -init and -fini.
8945 * layout.cc (Layout::finish_dynamic_section): Emit
8946 given init and fini functions.
8948 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8950 * gc.h (gc_process_relocs): Check if icf is enabled using new
8952 * gold.cc (queue_initial_tasks): Likewise.
8953 (queue_middle_tasks): Likewise.
8954 * object.cc (do_layout): Likewise.
8955 * symtab.cc (is_section_folded): Likewise.
8956 * main.cc (main): Likewise.
8957 * reloc.cc (Read_relocs::run): Likewise.
8958 (Sized_relobj::do_scan_relocs): Likewise.
8959 * icf.cc (is_function_ctor_or_dtor): New function.
8960 (Icf::find_identical_sections): Check if function is ctor or dtor when
8962 * options.h (General_options::icf): Change option to be an enum.
8963 (Icf_status): New enum.
8964 (icf_enabled): New method.
8965 (icf_safe_folding): New method.
8966 (set_icf_status): New method.
8967 (icf_status_): New variable.
8968 * (options.cc) (General_options::finalize): Set icf_status_.
8969 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8970 icf_test and icf_keep_unique_test to use the --icf enum flag.
8971 * testsuite/icf_safe_test.sh: New file.
8972 * testsuite/icf_safe_test.cc: New file.
8974 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8976 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8977 includes to gc.h and icf.h.
8978 * arm.cc: Include gc.h.
8979 * gold.cc: Likewise.
8980 * i386.cc: Likewise.
8981 * powerpc.cc: Likewise.
8982 * sparc.cc: Likewise.
8983 * x86_64.cc: Likewise.
8984 * gc.h: Include icf.h.
8986 2009-10-11 Ian Lance Taylor <iant@google.com>
8988 * plugin.cc: Include "gold.h" before other header files.
8990 2009-10-10 Chris Demetriou <cgd@google.com>
8992 * options.h (Input_file_argument::Input_file_type): New enum.
8993 (Input_file_argument::is_lib_): Replace with...
8994 (Input_file_argument::type_): New member.
8995 (Input_file_argument::Input_file_argument): Take Input_file_type
8996 'type' rather than boolean 'is_lib' as second argument.
8997 (Input_file_argument::is_lib): Use type_.
8998 (Input_file_argument::is_searched_file): New function.
8999 (Input_file_argument::may_need_search): Handle is_searched_file.
9000 * options.cc (General_options::parse_library): Support -l:filename.
9001 (General_options::parse_just_symbols): Update for Input_file_argument
9003 (Command_line::process): Likewise.
9004 * archive.cc (Archive::get_file_and_offset): Likewise.
9005 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9006 * script.cc (read_script_file, script_add_file): Likewise.
9007 * fileread.cc (Input_file::Input_file): Likewise.
9008 (Input_file::will_search_for): Handle is_searched_file.
9009 (Input_file::open): Likewise.
9010 * readsyms.cc (Read_symbols::get_name): Likewise.
9011 * testsuite/Makefile.am (searched_file_test): New test.
9012 * testsuite/Makefile.in: Regenerate.
9013 * testsuite/searched_file_test.cc: New file.
9014 * testsuite/searched_file_test_lib.cc: New file.
9016 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9017 Ian Lance Taylor <iant@google.com>
9019 * descriptor.cc: Include <cstdio> and "binary-io.h".
9020 (Descriptors::open): Open the files in binary mode always.
9021 * script.cc (Lex::get_token): Treat \r as whitespace.
9023 2009-10-09 Ian Lance Taylor <iant@google.com>
9025 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9027 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9028 Ian Lance Taylor <iant@google.com>
9030 * configure.ac: Check for readv function also.
9031 * fileread.cc (readv): Define if not HAVE_READV.
9032 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9034 * config.in: Regenerate.
9035 * configure: Regenerate.
9037 2009-10-09 Doug Kwan <dougkwan@google.com>
9039 * layout.cc (Layout::make_output_section): Call target hook to make
9040 ordinary output section.
9041 (Layout::finalize): Adjust parameter list of call the
9042 Target::may_relax().
9043 * layout.h (class Layout::section_list): New method.
9044 * merge.h (Output_merge_base::entsize): Change visibility to public.
9045 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9047 (Output_merge_string::do_is_string): New method.
9048 * object.cc (Sized_relobj::do_setup): renamed from
9049 Sized_relobj::set_up.
9050 * object.h (Sized_relobj::adjust_shndx,
9051 Sized_relobj::initializ_input_to_output_maps,
9052 Sized_relobj::free_input_to_output_maps): Change visibilities to
9054 (Sized_relobj::setup): Virtualize.
9055 (Sized_relobj::do_setup): New method declaration.
9056 (Sized_relobj::invalidate_section_offset,
9057 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9058 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9059 * options.cc (parse_int): New function.
9060 * options.h (parse_int): New declaration.
9061 (DEFINE_int): New macro.
9062 (stub_group_size): New option.
9063 * output.cc (Output_section::Output_section): Initialize memebers
9064 merge_section_map_, merge_section_by_properties_map_,
9065 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9066 (Output_section::add_input_section): Handled deferred code-fill
9067 generation and remove an old comment.
9068 (Output_section::add_relaxed_input_section): New method definition.
9069 (Output_section::add_merge_input_section): Use merge section by
9070 properties map to speed to search. Update merge section maps
9072 (Output_section::build_relaxation_map): New method definition.
9073 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9075 (Output_section::relax_input_section): Renamed to
9076 Output_section::convert_input_sections_to_relaxed_sections and change
9077 interface to take a vector of pointers to relaxed sections.
9078 (Output_section::find_merge_section,
9079 Output_section::find_relaxed_input_section): New method definitions.
9080 (Output_section::is_input_address_mapped,
9081 Output_section::output_offset, Output_section::output_address):
9082 Use output section data maps to speed up searching.
9083 (Output_section::find_starting_output_address): Add comments.
9084 (Output_section::do_write,
9085 Output_section::write_to_postprocessing_buffer): Do code-fill
9086 generation as appropriate.
9087 (Output_section::get_input_sections): Invalidate relaxed input section
9089 (Output_section::restore_states): Adjust type of checkpoint .
9090 Invalidate relaxed input section map.
9091 * output.h (Output_merge_base): New class declaration.
9092 (Input_section_specifier): New class defintion.
9093 (class Output_relaxed_input_section) Change base class to
9094 Output_section_data_build.
9095 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9096 base class initializer.
9097 (Output_section::add_relaxed_input_section): New method declaration.
9098 (Output_section::Input_section): Change visibility to protected.
9099 (Output_section::Input_section::relobj,
9100 Output_section::Input_section::shndx): Handle relaxed input sections.
9101 Output_section::input_sections) Change visibility to protected. Also
9102 define overload to return a non-const pointer.
9103 (Output_section::Merge_section_properties): New class defintion.
9104 (Output_section::Merge_section_by_properties_map,
9105 Output_section::Output_section_data_by_input_section_map,
9106 Output_section::Relaxation_map): New types.
9107 (Output_section::relax_input_section): Rename method to
9108 Output_section::convert_input_sections_to_relaxed_sections and change
9109 interface to take a vector of relaxed section pointers.
9110 (Output_section::find_merge_section,
9111 Output_section::find_relaxed_input_section,
9112 Output_section::build_relaxation_map,
9113 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9114 New method declarations.
9115 (Output_section::merge_section_map_
9116 Output_section::merge_section_by_properties_map_,
9117 Output_section::relaxed_input_section_map_,
9118 Output_section::is_relaxed_input_section_map_valid_,
9119 Output_section::generate_code_fills_at_write_): New data members.
9120 * script-sections.cc
9121 (Output_section_element_input::set_section_addresses): Call
9122 current_data_size and addralign methods of relaxed input sections.
9123 (Orphan_output_section::set_section_addresses): Call current_data_size
9124 and addralign methods of relaxed input sections.
9125 * symtab.cc (Symbol_table::compute_final_value): Extract template
9126 from the body of Symbol_table::sized_finalize_symbol.
9127 (Symbol_table::sized_finalized_symbol): Call
9128 Symbol_table::compute_final_value.
9129 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9130 (Symbol_table::compute_final_value): New templated method declaration.
9131 * target.cc (Target::do_make_output_section): New method defintion.
9132 * target.h (Target::make_output_section): New method declaration.
9133 (Target::relax): Add more parameters for input objects, symbol table
9134 and layout. Adjust call to do_relax.
9135 (Target::do_make_output_section): New method declaration.
9136 (Target::do_relax): Add parameters for input objects, symbol table
9139 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9141 * pread.c: Include stdio.h.
9143 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9145 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9148 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9150 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9151 Change read_shndx type to unsigned int.
9152 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9154 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9155 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9156 Change read_shndx type to unsigned int.
9157 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9159 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9160 * layout.cc (Layout::create_symtab_sections): Cast the result of
9161 local_symcount * symsize to off_t in the gold_assert.
9163 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9165 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9166 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9168 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9169 (Arm_relocate_functions::thm_abs5): New function.
9170 (Arm_relocate_functions::abs12): New function.
9171 (Arm_relocate_functions::abs16): New function.
9172 (Arm_relocate_functions::base_abs): New function.
9173 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9174 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9175 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9177 (Scan::global): Likewise.
9178 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9179 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9180 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9181 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9184 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9186 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9187 (Arm_relocate_functions::movt_prel): New function.
9188 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9189 (Arm_relocate_functions::thm_movt_prel): New function.
9190 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9191 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9192 (Scan::global, Relocate::relocate): Likewise.
9193 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9195 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9197 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9198 Incremental_checker.
9199 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9201 (class Incremental_inputs_header): New class.
9202 (Incremental_inputs_header_writer): Edit comment.
9203 (Incremental_inputs_entry): New class.
9204 (Incremental_inputs_entry_writer): Edit comment.
9205 (Sized_incremental_binary::do_find_incremental_inputs_section):
9206 Add *strtab_shndx parameter, fill it.
9207 (Sized_incremental_binary::do_check_inputs): New method.
9208 (Incremental_checker::can_incrementally_link_output_file): Use
9209 Sized_incremental_binary::check_inputs.
9210 (Incremental_inputs::report_command_line): Save command line in
9213 (Incremental_binary::find_incremental_inputs_section): New
9215 (Incremental_binary::do_find_incremental_inputs_section): Add
9216 strtab_shndx parameter.
9217 (Incremental_binary::do_check_inputs): New pure virtual method.
9218 (Sized_incremental_binary::do_check_inputs): Declare.
9219 (Incremental_checker::Incremental_checker): Add incremental_inputs
9220 parameter, use it to initialize incremental_inputs_.
9221 (Incremental_checker::incremental_inputs_): New field.
9222 (Incremental_checker::command_line): New method.
9223 (Incremental_checker::inputs): New method.
9224 (Incremental_checker::command_line_): New field.
9226 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9228 * incremental.cc: Include <cstdarg> and "target-select.h".
9229 (vexplain_no_incremental): New function.
9230 (explain_no_incremental): New function.
9231 (Incremental_binary::error): New method.
9232 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9234 (make_sized_incremental_binary): New function.
9235 (open_incremental_binary): New function.
9236 (can_incrementally_link_file): Add checks if output is ELF and has
9238 * incremental.h: Include "elfcpp_file.h" and "output.h".
9239 (Incremental_binary): New class.
9240 (Sized_incremental_binary): New class.
9241 (open_incremental_binary): Declare.
9242 * object.cc (is_elf_object): Use
9243 elfcpp::Elf_recognizer::is_elf_file.
9244 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9245 * output.h (Output_file::filesize): New method.
9247 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9249 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9251 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9252 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9254 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9256 (Arm_relocate_functions::movw_abs_nc): New function.
9257 (Arm_relocate_functions::movt_abs): New function.
9258 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9259 (Arm_relocate_functions::thm_movt_abs): New function.
9260 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9261 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9262 (Scan::global): Likewise.
9263 (Relocate::relocate): Likewise.
9264 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9266 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9268 * arm.cc (Arm_relocate_functions::got_prel) New function.
9269 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9270 (Relocate::relocate): Likewise.
9271 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9273 2009-10-06 Ian Lance Taylor <iant@google.com>
9275 * options.h (class General_options): Define
9276 split_stack_adjust_size parameter.
9277 * object.h (class Object): Add uses_split_stack_ and
9278 has_no_split_stack_ fields. Add uses_split_stack and
9279 has_no_split_stack accessor functions. Declare
9280 handle_split_stack_section.
9281 (class Reloc_symbol_changes): Define.
9282 (class Sized_relobj): Define Function_offsets. Declare
9283 split_stack_adjust, split_stack_adjust_reltype, and
9285 * object.cc (Object::handle_split_stack_section): New function.
9286 (Sized_relobj::do_layout): Call handle_split_stack_section.
9287 * dynobj.cc (Sized_dynobj::do_layout): Call
9288 handle_split_stack_section.
9289 * reloc.cc (Sized_relobj::relocate_sections): Call
9290 split_stack_adjust for executable sections in split_stack
9291 objects. Pass reloc_map to relocate_section.
9292 (Sized_relobj::split_stack_adjust): New function.
9293 (Sized_relobj::split_stack_adjust_reltype): New function.
9294 (Sized_relobj::find_functions): New function.
9295 * target-reloc.h: Include "object.h".
9296 (relocate_section): Add reloc_symbol_changes parameter. Change
9298 * target.h (class Target): Add calls_non_split method. Declare
9299 do_calls_non_split virtual method. Declare match_view and
9301 * target.cc: Include "elfcpp.h".
9302 (Target::do_calls_non_split): New function.
9303 (Target::match_view): New function.
9304 (Target::set_view_to_nop): New function.
9305 * gold.cc (queue_middle_tasks): Give an error if mixing
9306 split-stack and non-split-stack objects with -r.
9307 * i386.cc (Target_i386::relocate_section): Add
9308 reloc_symbol_changes parameter.
9309 (Target_i386::do_calls_non_split): New function.
9310 * x86_64.cc (Target_x86_64::relocate_section): Add
9311 reloc_symbol_changes parameter.
9312 (Target_x86_64::do_calls_non_split): New function.
9313 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9315 * powerpc.cc (Target_powerpc::relocate_section): Add
9316 reloc_symbol_changes parameter.
9317 * sparc.cc (Target_sparc::relocate_section): Add
9318 reloc_symbol_changes parameter.
9319 * configure.ac: Call AM_CONDITIONAL for the default target.
9320 * configure: Rebuild.
9321 * testsuite/Makefile.am (TEST_AS): New variable.
9322 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9323 (check_DATA): Add split_i386 and split_x86_64 files.
9324 (SPLIT_DEFSYMS): Define.
9325 (split_i386_[1234n].o): New targets.
9326 (split_i386_[124]): New targets.
9327 (split_i386_[1234r].stdout): New targets.
9328 (split_x86_64_[1234n].o): New targets.
9329 (split_x86_64_[124]): New targets.
9330 (split_x86_64_[1234r].stdout): New targets.
9331 (MOSTLYCLEANFILES): Add new executables.
9332 * testsuite/split_i386.sh: New file.
9333 * testsuite/split_x86_64.sh: New file.
9334 * testsuite/split_i386_1.s: New file.
9335 * testsuite/split_i386_2.s: New file.
9336 * testsuite/split_i386_3.s: New file.
9337 * testsuite/split_i386_4.s: New file.
9338 * testsuite/split_i386_n.s: New file.
9339 * testsuite/split_x86_64_1.s: New file.
9340 * testsuite/split_x86_64_2.s: New file.
9341 * testsuite/split_x86_64_3.s: New file.
9342 * testsuite/split_x86_64_4.s: New file.
9343 * testsuite/split_x86_64_n.s: New file.
9344 * testsuite/testfile.cc (Target_test): Update relocation_section
9346 * testsuite/Makefile.in: Rebuild.
9348 2009-10-06 Ian Lance Taylor <iant@google.com>
9350 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9351 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9352 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9353 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9354 the address on ldo_addrs_.
9355 (Target_i386::Relocate::fix_up_ldo): New function.
9357 2009-10-06 Rafael Espindola <espindola@google.com>
9359 * plugin.cc (add_input_library): New.
9360 (Plugin::load): Add add_input_library to tv.
9361 (Plugin_manager::add_input_file): Add the is_lib argument.
9362 (add_input_file): Update call to Plugin_manager::add_input_file.
9363 (add_input_library): New.
9364 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9366 2009-09-30 Doug Kwan <dougkwan@google.com>
9368 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9369 symbol and call Symbol::may_need_copy_reloc to determine if
9370 a copy reloc is needed.
9371 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9372 nocopyreloc is given in command line.
9373 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9374 given in command line.
9375 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9376 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9377 of the removed Target_i386::may_need_copy_reloc.
9378 * options.h (copyreloc): New option with default value false.
9379 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9380 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9381 instead of the removed Target_powerpc::may_need_copy_reloc.
9382 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9383 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9384 instead of the removed Target_sparc::may_need_copy_reloc.
9385 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9386 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9387 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9388 instead of the removed Target_x86_64::may_need_copy_reloc.
9390 2009-09-30 Ian Lance Taylor <iant@google.com>
9392 * object.h (class Object): Remove target_ field, and target,
9393 sized_target, and set_target methods.
9394 (Object::sized_target): Remove.
9395 (class Sized_relobj): Update declarations. Remove sized_target.
9396 * object.cc (Sized_relobj::setup): Remove target parameter.
9398 (Input_objects::add_object): Don't do anything with the target.
9399 (make_elf_sized_object): Add punconfigured parameter. Change all
9400 callers. Set or test parameter target.
9401 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9403 * parameters.cc (Parameters::set_target): Change parameter type to
9405 (Parameters::default_target): Remove.
9406 (set_parameters_target): Change parameter type to be non-const.
9407 (parameters_force_valid_target): New function.
9408 (parameters_clear_target): New function.
9409 * parameters.h (class Parameters): Update declarations. Remove
9410 default_target method. Add sized_target and clear_target
9411 methods. Change target_ to be non-const.
9412 (set_parameters_target): Update declaration.
9413 (parameters_force_valid_target): Declare.
9414 (parameters_clear_target): Declare.
9415 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9416 as NULL if we aren't searching.
9417 (Add_symbols::run): Don't check for compatible target.
9418 * fileread.cc (Input_file::open_binary): Call
9419 parameters_force_valid_target.
9420 * gold.cc (queue_middle_tasks): Likewise.
9421 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9422 set_target on object.
9423 * dynobj.h (class Sized_dynobj): Update declarations.
9424 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9425 make_elf_object returns NULL.
9426 (Archive::include_member): Don't check whether object target is
9428 * output.cc (Output_section::add_input_section): Get target from
9430 (Output_section::relax_input_section): Likewise.
9431 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9433 (Sized_relobj::do_scan_relocs): Likewise.
9434 (Sized_relobj::relocate_sections): Likewise.
9435 * resolve.cc (Symbol_table::resolve): Likewise.
9436 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9437 parameter. Change all callers.
9438 (Symbol_table::add_from_object): Get target from parameters.
9439 (Symbol_table::add_from_relobj): Don't check object target.
9440 (Symbol_table::add_from_dynobj): Likewise.
9441 (Symbol_table::define_special_symbol): Get target from
9443 * symtab.h (class Symbol_table): Update declaration.
9444 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9445 parameter. Change all callers. Clear parameter target.
9446 (Binary_test): Test target here.
9447 * testsuite/object_unittest.cc (gold_testsuite): Remove
9448 target_test_pointer parameter. Change all callers.
9449 (Object_test): Test target here.
9451 2009-09-26 Ian Lance Taylor <iant@google.com>
9453 * testsuite/initpri1.c: Don't try to use constructor priorities if
9454 compiling with gcc before 4.3.
9456 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9458 * testsuite/retain_symbols_file_test.sh (check_present): Change
9459 output file name to retain_symbols_file_test.stdout.
9460 (check_absent): Likewise.
9462 2009-09-18 Craig Silverstein <csilvers@google.com>
9464 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9465 * options.cc: Include <cerrno> and <fstream>.
9466 (General_options::finalize): Parse -retain-symbols-file tag.
9467 * options.h: New flag.
9468 (General_options): New method should_retain_symbol, new
9469 variable symbols_to_retain.
9470 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9471 should_retain_symbol map.
9472 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9473 * testsuite/Makefile.in: Regenerate.
9474 * testsuite/retain_symbols_file_test.sh: New file.
9476 2009-09-18 Nick Clifton <nickc@redhat.com>
9478 * po/es.po: Updated Spanish translation.
9480 2009-09-17 Doug Kwan <dougkwan@google.com>
9482 * debug.h (DEBUG_RELAXATION): New constant.
9483 (DEBUG_ALL): Add DEBUG_RELAXATION.
9484 (debug_string_to_enum): Add relaxation debug option.
9486 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9487 Layout::Relaxation_debug_check::read_sections,
9488 Layout::Relaxation_debug_check::read_sections): New method definitions.
9489 (Layout::Layout): Initialize data members
9490 record_output_section_data_from_scrips_,
9491 script_output_section_data_list_ and relaxation_debug_check_.
9492 (Layout::save_segments, Layout::restore_segments,
9493 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9494 Layout::relaxation_loop_body): New method definitions.
9495 (Layout::finalize): Support relaxation. Move section layout code to
9496 Layout::relaxation_loop_body.
9497 (Layout::set_asection_address_from_script): Move code for orphan
9498 section placement out.
9499 (Layout::place_orphan_sections_in_script): New method definition.
9500 * layout.h (Output_segment_headers, Output_file_header):
9501 New forward class declarations.
9502 (Layout::~Layout): Define.
9503 (Layout::new_output_section_data_from_script): New method definition.
9504 (Layout::place_orphan_sections_in_script): New method declaration.
9505 (Layout::Segment_states): New type declaration.
9506 (Layout::save_segments, Layout::restore_segments,
9507 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9508 Layout::relaxation_loop_body): New method declarations.
9509 (Layout::Output_section_data_list): New type declaration.
9510 (Layout::Relaxation_debug_check): New class definition.
9511 (Layout::record_output_section_data_from_script_,
9512 Layout::script_output_section_data_list_, Layout::segment_states_,
9513 Layout::relaxation_debug_check_): New data members.
9514 * output.cc: (Output_section_headers::do_size): New method definition.
9515 (Output_section_headers::Output_section_headers): Move size
9516 computation to Output_section_headers::do_size.
9517 (Output_segment_headers::do_size): New method definition.
9518 (Output_file_header::Output_file_header): Move size computation to
9519 Output_file_header::do_size and call it.
9520 (Output_file_header::do_size): New method definition.
9521 (Output_data_group::Output_data_group): Adjust call to
9522 Output_section_data.
9523 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9524 (Output_symtab_xindex::do_write): Add array bound check.
9525 (Output_section::Input_section::print_to_mapfile): Handle
9526 RELAXED_INPUT_SECTION_CODE.
9527 (Output_section::Output_section): Initialize data member checkpoint_.
9528 (Output_section::~Output_section): Delete checkpoint object pointed
9530 (Output_section::add_input_section): Always add an Input_section if
9532 (Output_section::add_merge_input_section): Add assert.
9533 (Output_section::relax_input_section): New method definition.
9534 (Output_section::set_final_data_size): Set load address to zero for
9535 an unallocated section.
9536 (Output_section::do_address_and_file_offset_have_reset_values):
9537 New method definition.
9538 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9539 Handle relaxed input section.
9540 (Output_section::sort_attached_input_sections): Checkpoint input
9541 section list lazily.
9542 (Output_section::get_input_sections): Change type of input_sections to
9543 list of Simple_input_section pointers. Checkpoint input section list
9544 lazily. Also handle relaxed input sections.
9545 (Output_section::add_input_section_for_script): Take a reference to
9546 a Simple_input_section object instead of Relobj pointer and section
9547 index as parameter. Handle relaxed input sections.
9548 (Output_section::save_states, Output_section::restore_states): New
9550 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9551 (Output_data::is_data_size_fixed): New method definition.
9552 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9554 (Output_data::address_and_file_offset_have_reset_values): New method
9556 (Output_data::do_address_and_file_offset_have_reset_values): New method
9558 (Output_data::set_data_size): Check that data size is not fixed.
9559 (Output_data::fix_data_size): New method definition.
9560 (Output_data::is_data_size_fixed_): New data member.
9561 (Output_section_headers::set_final_data_size): New method definition.
9562 (Output_section_headers::do_size): New method declaration.
9563 (Output_segment_headers::set_final_data_size): New method definition.
9564 (Output_segment_headers::do_size): New method declaration.
9565 (Output_file_header::set_final_data_size)::New method definition.
9566 (Output_file_header::do_size)::New method declaration.
9567 (Output_section_data::Output_section_data): Add new parameter
9568 is_data_size_fixed and use it to fix data size.
9569 (Output_data_const::Output_data_const): Adjust call to base class
9570 constructor and fix data size.
9571 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9572 base class constructor and fix data size.
9573 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9574 base class constructor and fix data size.
9575 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9576 class constructor and fix data size.
9577 (Output_data_group::set_final_data_size): New method definition.
9578 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9579 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9580 class constructor and fix data size.
9581 (Output_relaxed_input_section): New class definition.
9582 (Output_section::Simple_input_section): New class definition.
9583 (Output_section::get_input_sections): Adjust parameter list.
9584 (Output_section::add_input_section_for_script): Same.
9585 (Output_section::save_states, Output_section::restore_states,
9586 Output_section::do_address_and_file_offset_have_reset_values,
9587 (Output_section::Input_section::Input_section): Handle
9588 RELAXED_INPUT_SECTION_CODE. Add new overload for
9589 Output_relaxed_input_section.
9590 (Output_section::Input_section::is_input_section,
9591 Output_section::Input_section::set_output_section): Handle relaxed
9593 (Output_section::Input_section::is_relaxed_input_section,
9594 Output_section::Input_section::output_section_data,
9595 Output_section::Input_section::relaxed_input_section): New method
9597 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9599 (Output_section::Input_section::u1_): Update comments.
9600 (Output_section::Input_section::u2_): Add new union member poris.
9601 (Output_section::Checkpoint_output_section): New classs definition.
9602 (Output_section::relax_input_section): New method declaration.
9603 (Output_section::checkpoint_): New data member.
9604 (Output_segment): Update comments.
9605 (Output_segment::Output_segment): Un-privatize copy constructor.
9606 (Output_segment::operator=): Un-privatize.
9607 * script-sections.cc (Output_section_element::Input_section_list):
9608 Change element type to Output_section::Simple_input_section.
9609 (Output_section_element_dot_assignment::set_section_addresses):
9610 Register output section data for relaxation clean up.
9611 (Output_data_exression::Output_data_expression): Adjust call to base
9612 constructor to fix data size.
9613 (Output_section_element_data::set_section_addresses): Register
9614 Output_data_expression object for relaxation clean up.
9615 (struct Input_section_info): Replace Relobj pointer and section index
9616 pair with Output_section::Simple_input_section and Convert struct to a
9618 (Input_section_sorter::operator()): Adjust access to
9619 Input_section_info data member to use accessors.
9620 (Output_section_element_input::set_section_addresses): Use layout
9621 parameter. Adjust code to use Output_section::Simple_input_section
9622 and Input_secction_info classes. Register filler for relaxation
9624 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9625 and section index pair with Output_section::Simple_input_section
9626 class. Adjust code accordingly.
9627 (Phdrs_element::release_segment): New method definition.
9628 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9630 (Script_sections::release_segments): New method definition.
9631 * gold/script-sections.h (Script_sections::release_segments): New
9633 * gold/target.h (Target::may_relax, Target::relax,
9634 Target::do_may_relax, Target::do_relax): New method definitions.
9636 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9638 * arm.cc (has_signed_unsigned_overflow): New function.
9639 (Arm_relocate_functions::abs8): New function.
9640 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9641 (Target_arm::Scan::global): Likewise.
9642 (Target_arm::relocate::relocate): Likewise.
9643 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9646 2009-09-16 Cary Coutant <ccoutant@google.com>
9648 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9649 * testsuite/Makefile.in: Regenerate.
9651 2009-09-11 Nick Clifton <nickc@redhat.com>
9653 * po/gold.pot: Updated by the Translation project.
9655 2009-09-08 Cary Coutant <ccoutant@google.com>
9657 * output.cc (Output_file::open): Add execute permission to empty file.
9658 * testsuite/Makefile.am (permission_test): New test.
9659 * testsuite/Makefile.in: Regenerate.
9661 2009-09-02 Ian Lance Taylor <iant@google.com>
9663 * output.cc (Output_file::resize): Call map_no_anonymous rather
9666 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9668 * gold.cc: Include "incremental.h".
9669 (queue_initial_tasks): Call Incremental_checker methods.
9670 * incremental.cc: Include "output.h".
9671 (Incremental_checker::can_incrementally_link_output_file): New
9673 * incremental.h (Incremental_checker): New class.
9675 * output.cc (Output_file::open_for_modification): New method.
9676 (Output_file::map_anonymous): Changed return type to bool. Record
9678 (Output_file::map_no_anonymous): New method, broken out of map.
9679 (Output_file::map): Use map_no_anonymous and map_anonymous.
9680 * output.h (class Output_file): Update declarations.
9682 2009-08-24 Cary Coutant <ccoutant@google.com>
9684 * options.h (Command_line::Pre_options): New class.
9685 (Command_line::pre_options): New member.
9686 * options.cc (gold::options::ready_to_register): New variable.
9687 (One_option::register_option): Do nothing if not registering options.
9688 Assert if same short option registered twice.
9689 (General_options::General_options): Turn off option registration when
9691 (Command_line::Pre_options::Pre_options): New constructor.
9693 2009-08-24 Cary Coutant <ccoutant@google.com>
9695 * options.h (General_options::no_keep_memory): Remove incorrect
9698 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9700 * Makefile.am (am__skiplex, am__skipyacc): New.
9701 * Makefile.in: Regenerate.
9703 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9705 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9706 (INCLUDES): ... this.
9707 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9708 (AM_CPPFLAGS): Renamed from ...
9709 (INCLUDE): ... this.
9710 * Makefile.in, testsuite/Makefile.in: Regenerate.
9712 * Makefile.in: Regenerate.
9713 * aclocal.m4: Likewise.
9714 * config.in: Likewise.
9715 * configure: Likewise.
9716 * testsuite/Makefile.in: Likewise.
9718 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9719 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9720 * Makefile.in: Regenerate.
9721 * testsuite/Makefile.in: Regenerate.
9723 2009-08-19 Cary Coutant <ccoutant@google.com>
9725 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9726 symbols in shared libraries overridden by hidden or internal symbols
9727 in the main program.
9729 2009-08-19 Chris Demetriou <cgd@google.com>
9731 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9732 checking source file names in error messages.
9734 2009-08-18 Doug Kwan <dougkwan@google.com>
9736 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9737 an elcpp::Ehdr as parameter. Adjust call to set_target.
9738 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9739 an elfcpp::Ehdr as parameter.
9740 * object.cc (Object::set_target): Remove the version that looks up
9741 a target and sets it.
9742 (Sized_relobj::setup): Take a Target object instead of
9743 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9744 (make_elf_sized_object): Find target and ask target to
9746 * object.h: (Object::set_target): Remove the version that looks up
9747 a target and sets it.
9748 (Sized_relobj::setup): Take a Target object instead of
9749 an elfcpp:Ehdr as parameter.
9750 * target.cc: Include dynobj.h.
9751 (Target::do_make_elf_object_implementation): New.
9752 (Target::do_make_elf_object): New.
9753 * target.h (Target::make_elf_object): New template declaration.
9754 (Target::do_make_elf_object): New method declarations.
9755 (Target::do_make_elf_object_implementation): New template declaration.
9757 2009-08-14 Ian Lance Taylor <iant@google.com>
9759 * gold.h (FUNCTION_NAME): Define.
9760 (gold_unreachable): Use FUNCTION_NAME.
9762 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9764 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9765 symbol in the --keep-unique list is not found.
9767 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9769 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9770 been maked as --keep-unique.
9771 (Icf::unfold_section): New function.
9772 * icf.h (Icf::unfold_section): New function.
9773 * options.h (General_options::keep_unique): New option.
9774 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9775 * testsuite/Makefile.in: Regenerate.
9776 * testsuite/icf_keep_unique_test.sh: New file.
9777 * testsuite/icf_keep_unique_test.cc: New file.
9779 2009-08-12 Cary Coutant <ccoutant@google.com>
9782 * resolve.cc (Symbol_table::resolve): Check for references from
9783 dynamic objects to hidden and internal symbols.
9784 * testsuite/Makefile.am (hidden_test.sh): New test.
9785 * testsuite/Makefile.in: Regenerate.
9786 * testsuite/hidden_test.sh: New script.
9787 * testsuite/hidden_test_1.c: New test source.
9788 * testsuite/hidden_test_main.c: New test source.
9790 2009-08-11 Doug Kwan <dougkwan@google.com>
9792 * arm.cc: Update comments.
9793 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9794 segment to locate the .ARM.exidx section if present.
9796 2009-08-09 Doug Kwan <dougkwan@google.com>
9798 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9801 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9802 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9805 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9807 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9808 valid tls_segment only for non-debug-section relocations.
9809 * testsuite/Makefile.am: Add gc_tls_test.
9810 * testsuite/Makefile.in: Regenerate.
9811 * testsuite/gc_tls_test.cc: New file.
9812 * testsuite/gc_tls_test.sh: New file.
9814 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9818 * Makefile.am (CCFILES): Add icf.cc.
9820 * Makefile.in: Regenerate.
9821 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9822 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9823 section, symbol and addend information for the relocs.
9824 * gold.cc (queue_middle_tasks): Call identical code folding.
9825 * gold.h: Add defines for multimap.
9826 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9827 to the call of finalize_local_symbols.
9828 * main.cc (main): Create object of class Icf.
9829 * object.cc (Sized_relobj::do_layout): Allow this function to be
9830 called twice during icf.
9831 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9832 to sections marked as identical by icf.
9833 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9835 (Sized_relobj::do_section_entsize): New function.
9836 * object.h (Object::section_entsize): New function.
9837 (Object::do_section_entsize): New pure virtual function.
9838 (Relobj::finalize_local_symbols): Add new parameter.
9839 (Relobj::do_section_entsize): New function.
9840 * options.h (General_options::icf): New option.
9841 (General_options::icf_iterations): New option.
9842 (General_options::print_icf_sections): New option.
9843 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9844 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9845 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9847 * symtab.cc (Symbol_table::is_section_folded): New function.
9848 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9849 to sections marked as identical by icf.
9850 * symtab.h (Symbol_table::set_icf): New function.
9851 (Symbol_table::icf): New function.
9852 (Symbol_table::is_section_folded): New function.
9853 (Symbol_table::icf_): New data member.
9854 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9855 * testsuite/Makefile.am: Add commands to build icf_test.
9856 * testsuite/Makefile.in: Regenerate.
9857 * testsuite/icf_test.sh: New file.
9858 * testsuite/icf_test.cc: New file.
9860 2009-07-24 Chris Demetriou <cgd@google.com>
9862 * layout.cc (is_compressible_debug_section): Fix incorrect
9863 comment about compressed section names.
9865 2009-07-20 Ian Lance Taylor <ian@airs.com>
9868 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9870 2009-07-16 Ian Lance Taylor <iant@google.com>
9873 * layout.h: #include <map>.
9874 (class Kept_section): Change from struct to class. Add accessors
9875 and setters. Add section size to Comdat_group mapping. Change
9876 Comdat_group to std::map. Add is_comdat_ field. Add
9877 linkonce_size field in union.
9878 (class Layout): Update declaration of find_or_add_kept_section.
9879 Don't declare find_kept_object.
9880 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9881 parameter. Add object, shndx, is_comdat, and is_group_name
9882 parameters. Change all callers. Adjust for new Kept_section.
9883 (Layout::find_kept_object): Remove.
9884 * object.cc (Sized_relobj::include_section_group): Update use of
9885 Kept_section. Rename secnum to shndx. Only record
9886 Kept_comdat_section if sections are the same size.
9887 (Sized_relobj::include_linkonce_section): Update use of
9888 Kept_section. Only record Kept_comdat_section if sections are the
9889 same size. Set size of linkonce section.
9890 (Sized_relobj::map_to_kept_section): Update call to
9891 get_kept_comdat_section.
9892 * object.h (class Sized_relobj): Rename fields in
9893 Kept_comdat_section to drop trailing underscores; change object
9894 field to Relobj*. Change Kept_comdat_section_table to store
9895 struct rather than pointer.
9896 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9897 Add kept_object and kept_shndx parameters. Change all callers.
9898 (Sized_relobj::get_kept_comdat_section): Change return type to
9899 bool. Add kept_object and kept_shndx parameters. Change all
9901 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9902 Layout::find_or_add_kept_section.
9904 2009-07-09 Ian Lance Taylor <iant@google.com>
9906 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9907 Reserve space in the hash table.
9909 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9911 * fileread.cc (File_read::get_mtime): New method.
9912 * fileread.h (Timespec): New structure.
9913 (File_read::get_mtime): New method.
9914 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9915 Renamed from timestamp_nsec.
9916 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9918 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9920 (Incremental_inputs::report_archive): Save mtime; style fix.
9921 (Incremental_inputs::report_obejct): Save mtime; style fix.
9922 (Incremental_inputs::report_script): Save mtime; style fix.
9923 (Incremental_inputs::finalize_inputs): Style fix.
9924 (Incremental_inputs::finalize): Style fix.
9925 (Incremental_inputs::create_input_section_data): Store inputs
9927 * incremental.h (Incremental_inputs::report_script): Add mtime
9929 (Incremental_inputs::Input_info::Input_info): Intialize only one
9931 (Incremental_inputs::Input_info::archive): Move to nameless
9933 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9934 (Incremental_inputs::Input_info::script): Move to nameless union.
9935 (Incremental_inputs::mtime): New field.
9936 * script.cc (read_input_script): Pass file mtime to
9938 * script.h (Script_info::inputs): Style fix.
9940 2009-07-01 Ian Lance Taylor <ian@airs.com>
9942 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9945 2009-06-24 Ian Lance Taylor <iant@google.com>
9948 * layout.cc (Layout::choose_output_section): If we find an
9949 existing section, update the flags.
9950 (Layout::create_notes): New function, broken out of
9952 (Layout::finalize): Don't create note sections.
9953 (Layout::create_note): Don't crash if linker script discards
9955 (Layout::create_gold_note): Likewise.
9956 (Layout::create_build_id): Likewise. Don't set
9957 after_input_sections on the section.
9958 (Layout::create_executable_stack_info): Remove target parameter.
9960 * layout.h (class Layout): Declare create_notes. Update
9961 declaration of create_executable_stack_info.
9962 * gold.cc (queue_middle_tasks): Call create_notes.
9963 * output.cc (Output_section::update_flags_for_input_section): Move
9964 here from output.h. If SHF_ALLOC flag is newly set, mark address
9966 * output.h (Output_data::mark_address_invalid): New function.
9967 (class Output_section): Only declare, not define,
9968 update_flags_for_input_section. Remove set_flags.
9970 2009-06-24 Ian Lance Taylor <iant@google.com>
9972 * script-sections.cc (Output_section_definition::
9973 set_section_addresses): Rename shadowing local load_address to
9976 2009-06-24 Ian Lance Taylor <iant@google.com>
9979 * reloc.cc (relocate_sections): Skip empty relocation sections.
9981 2009-06-23 Ian Lance Taylor <iant@google.com>
9984 * layout.cc (Layout::create_note): Use choose_output_section
9985 rather than make_output_section.
9987 2009-06-23 Ian Lance Taylor <iant@google.com>
9990 * options.cc (General_options::parse_V): Set printed_version_.
9991 (General_options::General_options): Initialize printed_version_.
9992 * options.h (class General_options): Add printed_version_ field.
9993 * gold.cc (queue_initial_tasks): If there are no input files,
9994 don't give a fatal error if we printed the version information.
9995 (queue_middle_tasks): If using -r with a shared object, give a
9996 fatal error rather than an ordinary error.
9998 2009-06-23 Ian Lance Taylor <iant@google.com>
10001 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10002 (Layout::make_output_section): Set have_stabstr_section_ if we see
10003 a .stab*str section.
10004 (Layout::finalize): Call link_stabs_sections.
10005 (Layout::link_stabs_sections): New file.
10006 * layout.h (class Layout): Add have_stabstr_section_ field.
10007 Declare link_stabs_sections.
10009 2009-06-23 Doug Kwan <dougkwan@google.com>
10011 * Makefile.am (libgold_a_LIBADD): New.
10012 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10013 * Makefile.in: Regenerate.
10014 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10015 * configure: Regenerate.
10016 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10017 * fileread.cc: Include sys/state.h
10018 * gold.h: Declare memmem and strndup if found missing.
10019 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10021 2009-06-23 Ian Lance Taylor <iant@google.com>
10023 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10024 * configure: Rebuild.
10026 2009-06-23 Ian Lance Taylor <iant@google.com>
10029 * object.cc (Object::section_contents): Don't try to get a view if
10030 the section has length zero.
10031 (Object::handle_gnu_warning_section): If the section is empty, use
10032 the name of the section as the warning.
10034 2009-06-23 Ian Lance Taylor <iant@google.com>
10037 * stringpool.h (class Stringpool_template): Add optimize_ field.
10038 (Stringpool_template::set_optimize): New function.
10039 * stringpool.cc (Stringpool_template::Stringpool_template):
10040 Initialize optimize_ field.
10041 (Stringpool_template::set_string_offsets): Test local optimize
10042 fild rather than parameter.
10043 * layout.cc (Layout::Layout): Call set_optimize on the section
10046 2009-06-22 Ian Lance Taylor <iant@google.com>
10049 * yyscript.y: Parse TARGET.
10050 * script.cc (script_set_target): New function.
10051 * script-c.h (script_set_target): Declare.
10052 * options.cc (General_options::string_to_object_format): Rename
10053 from string_to_object_format in anonymous namespace. Change
10055 * options.h (class General_options): Declare
10056 string_to_object_format.
10058 2009-06-22 Ian Lance Taylor <iant@google.com>
10060 * script-sections.cc (Script_sections::create_segments): Don't put
10061 program headers in a PT_LOAD segment if -n or -N.
10063 2009-06-22 Ian Lance Taylor <iant@google.com>
10066 * options.h (class General_options): Add -z lazy and -z now. Sort
10067 -z options into alphabetical order.
10068 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10070 2009-06-21 Ian Lance Taylor <iant@google.com>
10072 * layout.cc (Layout::make_output_section): Call
10073 Target::new_output_section.
10074 (Layout::attach_allocated_section_to_segment): Put large section
10075 sections in a separate load segment with the large segment flag
10077 (Layout::segment_precedes): Sort large data segments after other
10079 (align_file_offset): New static function.
10080 (Layout::set_segment_offsets): Use align_file_offset.
10081 * output.h (class Output_section): Add is_small_section_ and
10082 is_large_section_ fields.
10083 (Output_section::is_small_section): New function.
10084 (Output_section::set_is_small_section): New function.
10085 (Output_section::is_large_section): New function.
10086 (Output_section::set_is_large_section): New function.
10087 (Output_section::is_large_data_section): New function.
10088 (class Output_segment): Add is_large_data_segment_ field.
10089 (Output_segment::is_large_data_segment): New function.
10090 (Output_segment::set_is_large_data_segment): New function.
10091 * output.cc (Output_section::Output_section): Initialize new
10093 (Output_segment::Output_segment): Likewise.
10094 (Output_segment::add_output_section): Add assertion that large
10095 data sections always go in large data segments. Force small data
10096 sections to the end of the list of data sections. Force small BSS
10097 sections to the start of the list of BSS sections. For large BSS
10098 sections to the end of the list of BSS sections.
10099 * symtab.h (class Symbol): Declare is_common_shndx.
10100 (Symbol::is_defined): Check Symbol::is_common_shndx.
10101 (Symbol::is_common): Likewise.
10102 (class Symbol_table): Define enum Commons_section_type. Update
10103 declarations. Add small_commons_ and large_commons_ fields.
10104 * symtab.cc (Symbol::is_common_shndx): New function.
10105 (Symbol_table::Symbol_table): Initialize new fields.
10106 (Symbol_table::add_from_object): Put small and large common
10107 symbols in the right list.
10108 (Symbol_table::sized_finalized_symbol): Check
10109 Symbol::is_common_shndx.
10110 (Symbol_table::sized_write_globals): Likewise.
10111 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10112 common symbol lists. Don't call do_allocate_commons_list if the
10114 (Symbol_table::do_allocate_commons_list): Remove is_tls
10115 parameter. Add comons_section_type parameter. Change all
10116 callers. Handle small and large common symbols.
10117 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10118 Symbol::is_common_shndx.
10119 * resolve.cc (symbol_to_bits): Likewise.
10120 * target.h (Target::small_common_shndx): New function.
10121 (Target::small_common_section_flags): New function.
10122 (Target::large_common_shndx): New function.
10123 (Target::large_common_section_flags): New function.
10124 (Target::new_output_section): New function.
10125 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10126 small_common_section_flags, and large_common_section_flags
10128 (Target::do_new_output_section): New virtual function.
10129 * arm.cc (Target_arm::arm_info): Initialize new fields.
10130 * i386.cc (Target_i386::i386_info): Likewise.
10131 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10133 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10134 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10135 (Target_x86_64::do_new_output_section): New function.
10136 * configure.ac: Define conditional MCMODEL_MEDIUM.
10137 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10138 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10139 (large_LDFLAGS): Define.
10140 * testsuite/large.c: New file.
10141 * testsuite/testfile.cc (Target_test::test_target_info):
10142 Initialize new fields.
10143 * configure, testsuite/Makefile.in: Rebuild.
10145 2009-06-05 Doug Kwan <dougkwan@google.com>
10147 * Makefile.am (CCFILES): Add target.cc.
10148 * Makefile.in: Regenerate.
10149 * i386.cc (class Target_i386): Define new virtual method to
10150 override do_is_local_label_name in parent.
10151 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10152 local symbols if --discard-locals or -X is given.
10153 * options.h (class General_options): Declare new options
10154 '--discard-locals' and '-X' for discarding locals.
10155 * target.h (class Target): Define new methods is_local_label_name.
10156 Declare new virtual method do_is_local_label_name.
10157 * target.cc: New file.
10158 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10159 (check_SCRIPTS): Add discard_locals_test.sh.
10160 (check_DATA): Add discard_local_tests.syms.
10161 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10162 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10163 * testsuite/Makefile.in: Regenerate.
10164 * testsuite/discard_locals_test.c: New file.
10165 * testsuite/discard_locals_test.sh: Same.
10167 2009-06-05 Doug Kwan <dougkwan@google.com>
10169 * object.cc (Sized_relobj::Sized_relobj): Initialize
10170 discarded_eh_frame_shndx_ to -1U.
10171 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10173 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10174 a discarded .eh_frame section.
10175 (Sized_relobj::do_finalize_local_symbols): Ditto.
10176 * object.h (class Sized_relobj): Declare new member
10177 discarded_eh_frame_shndx_.
10178 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10179 (local_labels_test.o, local_labels_test): New rules.
10180 * testsuite/Makefile.in: Regenerate.
10182 2009-06-04 Doug Kwan <dougkwan@google.com>
10184 * layout.cc (Layout::section_name_mapping): Add mapping for
10185 special ARM sections.
10187 2009-06-03 Doug Kwan <dougkwan@google.com>
10189 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10190 (utils::has_overflow): Same.
10192 2009-06-03 Ian Lance Taylor <iant@google.com>
10194 * layout.cc (Layout::section_name_mapping): New array, replacing
10195 Layout::linkonce_mapping.
10196 (Layout::section_name_mapping_count): New variable, replacing
10197 Layout::linkonce_mapping_count.
10198 (Layout::linkonce_output_name): Remove.
10199 (Layout::output_section_name): Rewrite.
10200 * layout.h (class Layout): Rename Linkonce_mapping to
10201 Section_name_mapping, linkonce_mapping to section_name_mapping,
10202 linkonce_mapping_count to section_name_mapping_count. Don't
10203 declare linkonce_output_name.
10205 2009-06-03 Doug Kwan <dougkwan@google.com>
10207 * gold/arm.cc (namespace utils): New.
10208 (Target_arm::reloc_is_non_pic): Define new method.
10209 (class Arm_relocate_functions): New.
10210 (Target_arm::Relocate::relocate): Handle relocation types used by
10213 2009-06-03 Ian Lance Taylor <iant@google.com>
10215 * arm.cc (Target_arm::scan::global): Use || instead of |.
10217 2009-06-02 Doug Kwan <dougkwan@google.com>
10219 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10220 issued_non_pic_error_.
10221 (class Target_arm::Scan): Declare new method check_non_pic.
10222 Define new method symbol_needs_plt_entry.
10223 Declare new data member issued_non_pic_error_.
10224 (class Target_arm::Relocate): Declare new method
10225 should_apply_static_reloc.
10226 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10227 (Target_arm::Scan::check_non_pic): Define new method.
10228 (Target_arm::Scan::local): Handle a small subset of reloc types used
10230 (Target_arm::Scan::local): Same.
10231 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10233 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10235 * incremental.cc (Incremental_inputs::report_command_line): Filter
10236 out --incremental-* options.
10238 2009-05-29 Doug Kwan <dougkwan@google.com>
10240 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10242 (class Target_arm): Update comment.
10243 (Target_arm::Target_arm): Initialize new data members GOT_,
10244 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10245 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10246 and Target_arm::rel_dyn_section.
10247 Declare new_enum Target_arm::Got_type.
10248 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10250 Update commments for member do_dynsym_value.
10251 (Target_arm::got_size, Target_arm::plt_section,
10252 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10253 new methods inside class defintion.
10254 (Target_arm::got_section): Define new method.
10255 (Target_arm::rel_dyn_section): Same.
10256 (Output_data_plt_arm): New template class.
10257 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10258 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10259 (Output_data_plt_arm::add_entry): Same.
10260 (Output_data_plt_arm::first_plt_entry): Define new
10261 static data member for PLT instruction template.
10262 (Output_data_plt_arm::plt_entry): Same.
10263 (Output_data_plt_arm::do_write): Define new method.
10264 (Target_arm::make_plt_entry): Same.
10265 (Target_arm::do_finalize_sections): Same.
10266 (Target_arm::do_dynsym_value): Same.
10268 2009-05-28 Doug Kwan <dougkwan@google.com>
10270 * Makefile.am (TARGETSOURCES): Add arm.cc.
10271 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10272 * Makefile.in: Regenerate.
10273 * arm.cc: New file.
10274 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10276 2009-05-26 Doug Kwan <dougkwan@google.com>
10278 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10279 (General_options::check_excluded_libs): Strip off directories in
10280 archive name before matching like GNU ld does.
10281 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10282 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10283 (exclude_libs_test_LDFLAGS): Add linker option
10284 -Wl,--exclude-libs,libexclude_libs_test_3
10285 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10286 an explicit archive without using -l.
10287 (alt/libexclude_libs_test_3.a): New make rule.
10288 * testsuite/Makefile.in: Regenerate.
10289 * testsuite/exclude_libs_test.c : Declare lib3_default().
10291 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10292 * exclude_libs_test_3.c: New file.
10294 2009-05-26 Nick Clifton <nickc@redhat.com>
10296 * po/id.po: New Indonesian translation.
10297 * po/gold.pot: Updated template file.
10299 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10301 * testsuite/Makefile.am: Add -ffunction-sections to compile
10302 gc_comdat_test files. Add -Wl,--gc-sections to build
10304 * testsuite/Makefile.in: Regenerate.
10305 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10307 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10309 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10310 kept comdat section was garbage collected.
10311 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10312 * testsuite/Makefile.in: Regenerate.
10313 * testsuite/gc_comdat_test.sh: New file.
10314 * testsuite/gc_comdat_test_1.cc: New file.
10315 * testsuite/gc_comdat_test_2.cc: New file.
10317 2009-05-19 Doug Kwan <dougkwan@google.com>
10319 * archive.cc (Archive::Archive): Move constructor from archive.h
10320 to here. Initialize no_export_.
10321 (Archive::get_elf_object_for_member): Set no_export flag of object.
10322 * archive.h (Archive::Archive): Move constructor body to
10324 (Archive::no_export): New method.
10325 (Archive::no_export_): New field.
10326 * object.h (Object::Object): Initialize no_export_ to false.
10327 (Object::no_export, Object::set_no_export): New methods.
10328 (Object::no_export_): New field.
10329 * options.cc (General_options::parse_exclude_libs): New method.
10330 (General_options::check_excluded_libs) Same.
10331 * options.h (exclude_libs): New option.
10332 (General_options::check_excluded_libs): New method declaration.
10333 (General_options::excluded_libs_): New field.
10334 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10335 default or protected visibility if an object has no-export flag set.
10336 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10337 (check_SCRIPTS): Add exclude_libs_test.sh.
10338 (check_DATA): Add exclude_libs_test.syms.
10339 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10340 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10341 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10342 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10343 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10344 libexclude_libs_test_2.a): New rules.
10345 * testsuite/Makefile.in: Regenerate.
10346 * testsuite/exclude_libs_test.c: New file.
10347 * testsuite/exclude_libs_test.sh: Ditto.
10348 * testsuite/exclude_libs_test_1.c: Ditto.
10349 * testsuite/exclude_libs_test_2.c: Ditto.
10351 2009-05-15 Ian Lance Taylor <iant@google.com>
10353 * configure.ac: Check for declarations for cases where libiberty.h
10354 checks HAVE_DECL_xxx.
10355 * configure, config.in: Rebuild.
10357 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10359 * gold.h (Incremental_argument_list): Remove (invalid) forward
10361 * incremental.cc (Incremental_inputs::report_achive): New method.
10362 (Incremental_inputs::report_object): New method.
10363 (Incremental_inputs::report_script): New method.
10364 (Incremental_inputs::finalize_inputs): New method.
10365 (Incremental_inputs::finalize): Call finalize_inputs().
10366 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10367 Create inputs entries.
10368 * incremental.h (Incremental_input_type): New enum.
10369 (Incremental_inputs::Incremental_input): Initialize new fields.
10370 (Incremental_inputs::report_inputs): New method.
10371 (Incremental_inputs::report_achive): New method.
10372 (Incremental_inputs::report_object): New method.
10373 (Incremental_inputs::report_script): New method.
10374 (Incremental_inputs::finalize_inputs): New method.
10375 (Incremental_inputs::Input_info): New struct.
10376 (Incremental_inputs::Input_info_map): New typedef.
10377 (Incremental_inputs::lock_): New field.
10378 (Incremental_inputs::Inputs_): New field.
10379 (Incremental_inputs::Inputs_map): New field.
10380 * main.cc (main): Call Incremental_input::report_inputs.
10381 * options.h (Input_argument_list): Typedef moved from
10383 (Input_file_group::Files): Remove, use ::Input_argument_list.
10384 (Input_file_group::Input_argument_list): Remove, use
10385 ::Input_argument_list.
10386 * plugin.cc (Plugin_manager::add_input_file): Add error in
10388 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10390 * script.cc (read_input_script): Call
10391 Incremental_input::report_script.
10392 * script.h (Script_info): New class.
10394 2009-04-27 Ian Lance Taylor <iant@google.com>
10396 * x86_64.cc (do_adjust_output_section): Set entsize to
10399 2009-04-23 Elliott Hughes <enh@google.com>
10401 * output.cc (Output_file::close): After short writes, continue
10402 writing from the correct offset in the buffer being written.
10404 2009-04-23 Chris Demetriou <cgd@google.com>
10406 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10407 * configure: Regenerate.
10408 * config.in: Regenerate.
10409 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10410 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10412 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10414 * incremental.cc (Incremental_inputs_header_data): Renamed from
10415 Incremental_input_header_data.
10416 (Incremental_inputs_header_data::data_size): New field.
10417 (Incremental_inputs_header_data::put_input_file_count): Renamed
10418 from input_file_count.
10419 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10420 from command_line_offset.
10421 (Incremental_inputs_header_data::put_reserved): Renamed from
10423 (Incremental_inputs_entry_data): Renamed from
10424 Incremental_input_entry_data.
10425 (Incremental_inputs_entry_data::data_size): New field.
10426 (Incremental_inputs::report_command_line): New method.
10427 (Incremental_inputs::finalize): New method.
10428 (Incremental_inputs::create_incremental_inputs_data): New method.
10429 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10430 * incremental.h: New file.
10431 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10432 (Layout::finalize): Create incremental inputs section in
10433 incremental builds.
10434 (Layout::create_incremental_info_sections): New method.
10435 * layout.h (Layout::incremental_inputs): New method.
10436 (Layout::create_incremental_info_sections): New method.
10437 (Layout::incremental_inputs_): New field.
10438 * main.cc (main): Notify Incremental_input of the command line.
10440 2009-04-01 Ian Lance Taylor <iant@google.com>
10441 Mikolaj Zalewski <mikolajz@google.com>
10443 * gold.h (reserve_unordered_map): Define, three versions, one for
10444 each version of Unordered_map.
10445 * layout.cc (Layout::Layout): Remove options parameter. Add
10446 number_of_input_files parameter. Don't initialize options_.
10447 Initialize number_of_input_files_ and resized_signatures_. Move
10448 sections_are_attached_.
10449 (Layout::layout_group): Reserve space for group_signatures_.
10450 (Layout::find_or_add_kept_section): Change name parameter to be a
10451 reference. Resize signatures_ map when it gets large enough.
10452 (Layout::layout_eh_frame): Use parameters->options() instead of
10454 (Layout::make_output_section): Likewise.
10455 (Layout::attach_allocated_section_to_segment): Likewise.
10456 (Layout::finalize, Layout::create_executable_stack): Likewise.
10457 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10458 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10459 * layout.h (class Layout): Update declarations. Remove options_
10460 field. Add number_of_input_files_ and resized_signatures_
10461 fields. Move sections_are_attached_ field.
10462 * main.cc (main): Pass number of input files to Layout
10463 constructor. Don't pass options.
10465 2009-03-30 Ian Lance Taylor <iant@google.com>
10467 * ffsll.c (ffsll): Correct implementation.
10469 2009-03-27 Ian Lance Taylor <iant@google.com>
10471 * ffsll.c: New file.
10472 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10473 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10474 * ftruncate.c (ftruncate): Declare before definition.
10475 * mremap.c (mremap): Likewise.
10476 * pread.c (pread): Likewise.
10477 * configure, Makefile.in, config.in: Rebuild.
10479 * mremap.c: New file.
10480 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10481 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10482 (mremap): Declare if HAVE_MREMAP is not defined.
10483 * configure, Makefile.in, config.in: Rebuild.
10485 2009-03-27 Cary Coutant <ccoutant@google.com>
10487 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10488 position independent.
10489 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10490 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10492 2009-03-24 Cary Coutant <ccoutant@google.com>
10494 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10496 (needs_dynamic_reloc): Likewise.
10498 2009-03-24 Ian Lance Taylor <iant@google.com>
10500 * yyscript.y (file_cmd): Recognize EXTERN.
10501 (extern_name_list, extern_name_list_body): New nonterminals.
10502 * script.cc (script_add_extern): Define.
10503 * script-c.h (script_add_extern): Declare.
10505 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10507 * object.cc (is_elf_object): Define.
10508 * object.h (is_elf_object): Declare.
10509 * archive.cc (Archive::get_elf_object_for_member): Call
10511 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10513 2009-03-24 Elliott Hughes <enh@google.com>
10515 * output.cc (Output_file::map_anonymous): Define.
10516 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10517 try an anonymous one. Report the size if the mmap fails.
10518 * output.h (class Output_file): Declare map_anonymous.
10520 2009-03-24 Ian Lance Taylor <iant@google.com>
10522 * target-select.cc (instantiate_target): Don't acquire the lock if
10523 the instantiated_target_ field has already been set.
10525 2009-03-23 Ian Lance Taylor <iant@google.com>
10527 * gold-threads.h (class Initialize_lock): Define.
10528 * gold-threads.cc (class Initialize_lock_once): Define.
10529 (initialize_lock_control): New static variable.
10530 (initialize_lock_pointer): New static variable.
10531 (initialize_lock_once): New static function.
10532 (Initialize_lock::Initialize_lock): Define.
10533 (Initialize_lock::initialize): Define.
10534 * target-select.h: Include "gold-threads.h".
10535 (class Target_selector): Add lock_ and initialize_lock_ fields.
10536 Don't define instantiate_target, just declare it.
10537 * target-select.cc (Target_selector::Target_selector): Initialize
10539 (Target_selector::instantiate_target): Define.
10540 * descriptors.h: Include "gold-threads.h".
10541 (class Descriptors): Add initialize_lock_ field.
10542 * descriptors.cc (Descriptors::Descriptors): Initialize new
10544 (Descriptors::open): Use initialize_lock_ field
10545 * errors.h (class Errors): Add initialize_lock_ field.
10546 * errors.cc (Errors::Errors): Initialize new field.
10547 (Errors::initialize_lock): Use initialize_lock_ field.
10548 * powerpc.cc (class Target_selector_powerpc): Remove
10549 instantiated_target_ field. In do_recognize call
10550 instantiate_target rather than do_instantiate_target. In
10551 do_instantiate_target just allocate a new target.
10552 * sparc.cc (class Target_selector_sparc): Likewise.
10554 * freebsd.h: New file.
10555 * i386.cc: Include "freebsd.h".
10556 (Target_i386): Derive from Target_freebsd rather than
10558 (Target_selector_i386): Derive from Target_selector_freebsd rather
10559 than Target_selector.
10560 * x86_64.cc: Include "freebsd.h".
10561 (Target_x86_64): Derive from Target_freebsd rather than
10563 (Target_selector_x86_64): Derive from Target_selector_freebsd
10564 rather than Target_selector.
10565 * target.h (class Target): Add adjust_elf_header and
10566 do_adjust_elf_header.
10567 * output.cc (Output_file_header:: do_sized_write): Call target
10568 adjust_elf_header routine.
10569 * configure.tgt: Set targ_osabi.
10570 * configure.ac: Define GOLD_DEFAULT_OSABI.
10571 * parameters.cc (Parameters::default_target): Pass
10572 GOLD_DEFAULT_OSABI to select_target.
10573 * target-select.h (class Target_selector): Make instantiate_target
10574 protected rather than private.
10575 * Makefile.am (HFILES): Add freebsd.h.
10576 * configure, Makefile.in, config.in: Rebuild.
10578 * merge.cc (do_add_input_section): Correct pend value. Change
10579 message about last entry not being null terminated from error to
10582 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10584 * incremental.cc: New file.
10585 * Makefile.am (CCFILES): Add incremental.cc.
10586 * Makefile.in: Rebuild.
10588 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10590 * layout.cc (Layout::output_section_name): Preserve names
10591 of '.note.' sections.
10593 2009-03-19 Ian Lance Taylor <iant@google.com>
10595 * descriptors.cc (Descriptors::open): Check that the options are
10596 valid before using them.
10598 2009-03-18 Ian Lance Taylor <iant@google.com>
10600 * script-sections.h: Include <list>.
10601 (class Script_sections): Change Sections_elements from std::vector
10602 to std::list. Typedef public Elements_iterator. Add
10603 orphan_section_placement_, data_segment_align_start_, and
10604 saw_data_segment_align_ fields. Remove data_segment_align_index_
10606 * script-sections.cc (class Orphan_section_placement): New class.
10607 (class Sections_element): Add virtual functions is_relro and
10608 orphan_section_init. Remove virtual function place_orphan_here.
10609 (class Output_section_definition): Add is_relro and
10610 orphan_section_init. Remove place_orphan_here.
10611 (class Orphan_output_section): Likewise.
10612 (Script_sections::Script_sections): Update for field changes.
10613 (Script_sections::data_segment_align): Set saw_data_segment_align_
10614 and data_segment_align_start_, not data_segment_align_index.
10615 (Script_sections::data_segment_relro_end): Check
10616 saw_data_segment_align_. Use data_segment_align_start_ rather
10617 than data_segment_align_index_.
10618 (Script_sections::place_orphan): Rewrite to use
10619 Orphan_section_placement.
10621 2009-03-17 Ian Lance Taylor <iant@google.com>
10623 * archive.cc (Archive::add_symbols): Check for a version attached
10624 to the symbol name in the archive map.
10625 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10626 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10627 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10628 (ver_test_11.a): New target.
10629 * testsuite/Makefile.in: Rebuild.
10631 * configure.ac: Check for chsize and posix_fallocate. Replace
10633 * ftruncate.c: New file, from gnulib.
10634 * output.cc (posix_fallocate): Define dummy version if not
10635 HAVE_POSIX_FALLOCATE.
10636 (Output_file::map): Call posix_fallocate rather than lseek and
10638 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10639 * configure, Makefile.in, config.in: Rebuild.
10641 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10643 * layout.h (Layout::create_note): Add section_name parameter.
10644 * layout.cc (Layout::create_note): Likewise.
10645 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10647 2009-03-17 Ian Lance Taylor <iant@google.com>
10649 * descriptors.cc: Include "options.h".
10650 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10651 (Descriptors::open): Always use O_CLOEXEC when opening a new
10652 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10653 then set FD_CLOEXEC.
10655 * sparc.cc (class Target_sparc): Add has_got_section.
10656 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10657 make sure we have a GOT section.
10659 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10660 (Target_sparc::Scan::local): Likewise.
10661 (Target_sparc::Scan::global): Likewise.
10662 (Target_sparc::Relocate::relocate): Likewise.
10663 (Target_sparc::Relocate::relocate_tls): Likewise.
10665 * symtab.cc (Symbol_table::define_default_version): New function,
10666 broken out of add_from_object.
10667 (Symbol_table::add_from_object): Call define_default_version.
10668 (Symbol_table::define_special_symbol): Add resolve_oldsym
10669 parameter. Change all callers. If the version for a symbol comes
10670 from a version script, resolve it with the symbol with the same
10671 name with no version. Also add the symbol without a version if
10673 (do_define_in_output_data): If resolving with oldsym, don't delete
10675 (do_define_in_output_segment): Likewise.
10676 (do_define_as_constant): Likewise.
10677 * symtab.h (class Symbol_table): Update declarations.
10679 2009-03-13 Ian Lance Taylor <iant@google.com>
10681 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10682 (Read_symbols::requeue): New function.
10683 (Read_symbols::do_read_symbols): If make_elf_object fails because
10684 the target type is not configured, and the file was searched for,
10685 issue a warning and retry with the next directory.
10686 (Add_symbols::run): If the file has an incompatible format, and
10687 it was searched for, requeue the Read_symbols task. On error,
10688 release the object.
10689 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10690 dirindex parameter to constructor. Change all callers. Declare
10691 incompatible_warning and requeue.
10692 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10693 input_argument_ and input_group_ fields. Add them to
10694 constructor. Change all callers.
10695 (class Read_script): Add dirindex_ field. Add it to constructor.
10696 Change all callers.
10697 * archive.cc (Archive::setup): Remove input_objects parameter.
10698 Change all callers.
10699 (Archive::get_file_and_offset): Likewise.
10700 (Archive::read_all_symbols): Likewise.
10701 (Archive::read_symbols): Likewise.
10702 (Archive::get_elf_object_for_member): Remove input_objects
10703 parameter. Add punconfigured parameter. Change all callers.
10704 (Archive::add_symbols): Change return type to bool. Check return
10705 value of include_member.
10706 (Archive::include_all_members): Likewise.
10707 (Archive::include_member): Change return type to bool. Return
10708 false if first included object has incompatible target. Set
10709 included_member_ field.
10710 (Add_archive_symbols::run): If add_symbols returns false, requeue
10712 * archive.h (class Archive): Add included_member_ field.
10713 Initialize it in constructor. Add input_file and searched_for
10714 methods. Update declarations.
10715 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10716 input_argument_ fields. Add them to constructor. Change all
10718 * script.cc: Include "target-select.h".
10719 (class Parser_closure): Add skip_on_incompatible_target_ and
10720 found_incompatible_target_ fields. Add
10721 skip_on_incompatible_target parameter to constructor. Change all
10722 callers. Add methods skip_on_incompatible_target,
10723 clear_skip_on_incompatible_target, found_incompatible_target, and
10724 set_found_incompatible_target.
10725 (read_input_script): Add dirindex parameter. Change all callers.
10726 If parser finds an incompatible target, requeue Read_symbols
10728 (script_set_symbol): Clear skip_on_incompatible_target in
10730 (script_add_assertion, script_parse_option): Likewise.
10731 (script_start_sections, script_add_phdr): Likewise.
10732 (script_check_output_format): New function.
10733 * script.h (read_input_script): Update declaration.
10734 * script-c.h (script_check_output_format): Declare.
10735 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10736 (ignore_cmd): Remove OUTPUT_FORMAT.
10737 * fileread.cc (Input_file::Input_file): Add explicit this.
10738 (Input_file::will_search_for): New function.
10739 (Input_file::open): Add pindex parameter. Change all callers.
10740 * fileread.h (class Input_file): Add input_file_argument method.
10741 Declare will_search_for. Update declarations.
10742 * object.cc (make_elf_object): Add punconfigured parameter.
10743 Change all callers.
10744 * object.h (class Object): Make input_file public. Add
10745 searched_for method.
10746 (make_elf_object): Update declaration.
10747 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10749 * dirsearch.h (class Dirsearch): Update declaration.
10750 * options.h (class General_options): Add --warn-search-mismatch.
10751 * parameters.cc (Parameters::is_compatible_target): New function.
10752 * parameters.h (class Parameters): Declare is_compatible_target.
10753 * workqueue.cc (Workqueue::add_blocker): New function.
10754 * workqueue.h (class Workqueue): Declare add_blocker.
10756 * fileread.cc (Input_file::open): Remove options parameter.
10757 Change all callers.
10758 (Input_file::open_binary): Likewise.
10759 * script.cc (read_input_script): Likewise.
10760 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10761 options parameter from constructor. Change all callers.
10762 (class Read_script): Likewise.
10763 * fileread.h (class Input_file): Update declarations.
10764 * script.h (read_input_script): Update declaration.
10766 2009-03-10 Nick Clifton <nickc@redhat.com>
10768 * po/es.po: New Spanish translation.
10770 2009-03-06 Cary Coutant <ccoutant@google.com>
10772 * options.cc (parse_short_option): Keep dash_z from registering itself.
10774 2009-03-03 Ian Lance Taylor <iant@google.com>
10777 * target-reloc.h (relocate_section): Pass output_section to
10779 * i386.cc (Target_i386::should_apply_static_reloc): Add
10780 output_section parameter. Change all callers.
10781 (Target_i386::Relocate::relocate): Add output_section parameter.
10782 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10783 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10784 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10785 * testsuite/two_file_shared.sh: New script.
10786 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10787 (check_DATA): Add two_file_shared.dbg.
10788 (two_file_shared.dbg): New target.
10789 * testsuite/Makefile.in: Rebuild.
10791 2009-03-01 Ian Lance Taylor <iant@google.com>
10793 * configure.ac: Check for byteswap.h.
10794 * configure: Rebuild.
10795 * config.in: Rebuild.
10797 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10799 * layout.cc (Layout::find_or_add_kept_section): New function.
10800 (Layout::add_comdat): Removed.
10801 * layout.h (struct Kept_section): Move out of class Layout.
10802 Remove trailing underscores from field names. Add group_sections
10803 field. Rename group_ field to is_group. Change all uses.
10804 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10805 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10806 comdat_groups_ field.
10807 (Sized_relobj::include_section_group): Use
10808 find_or_add_kept_section and Kept_section::group_sections.
10809 (Sized_relobj::include_linkonce_section): Likewise.
10810 * object.cc (class Sized_relobj): Don't define Comdat_group or
10811 Comdat_group_table. Remove find_comdat_group and
10812 add_comdat_group. Remove comdat_groups_ field.
10813 * plugin.cc (include_comdat_group): Use
10814 Layout::find_or_add_kept_section.
10816 2009-02-28 Ian Lance Taylor <iant@google.com>
10818 * README: --gc-sections and map files are now supported. Document
10819 some build requirements.
10822 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10823 relocatable link set the value of the section symbol to zero.
10824 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10825 relocatable link don't include the section address in the local
10828 2009-02-27 Ian Lance Taylor <iant@google.com>
10831 * options.h (class Search_directory): Add is_system_directory.
10832 (class General_options): Declare is_in_system_directory.
10833 * options.cc (get_relative_sysroot): Make static.
10834 (get_default_sysroot): Make static.
10835 (General_optoins::is_in_system_directory): New function.
10836 * fileread.cc (Input_file::is_in_system_directory): New function.
10837 * fileread.h (class Input_file): Declare is_in_system_directory.
10838 * object.h (class Object): Add is_in_system_directory.
10839 (class Input_objects): Remove system_library_directory_ field.
10840 * object.cc (Input_objects::add_object): Don't set
10841 system_library_directory_.
10842 (input_objects::found_in_system_library_directory): Remove.
10843 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10844 parameter. Change all callers.
10845 (Symbol_table::sized_write_globals): Likewise.
10846 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10847 Call Object::is_in_system_directory.
10848 * symtab.h (class Symbol_table): Update declarations.
10851 * descriptors.h (Open_descriptor): Add is_on_stack field.
10852 * descriptors.cc (Descriptors::open): If the descriptor is on the
10853 top of the stack, remove it. Initialize is_on_stack field.
10854 (Descriptors::release): Only add pod to stack if it is not on the
10856 (Descriptors::close_some_descriptor): Clear stack_next and
10857 is_on_stack fields.
10860 * output.cc (Output_section::find_starting_output_address): Rename
10861 from starting_output_address; add PADDR parameter; change return
10863 * output.h (class Output_section): Declare
10864 find_starting_output_address instead of starting_output_address.
10865 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10866 section symbol for which we can't find a merge section.
10869 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10870 hidden or internal, force the symbol to be local.
10871 * resolve.cc (Symbol::override_visibility): Define.
10872 (Symbol::override_base): Use override_visibility.
10873 (Symbol_table::resolve): Likewise.
10874 (Symbol::override_base_with_special): Likewise.
10875 (Symbol_table::override_with_special): If the visibility is hidden
10876 or internal, force the symbol to be local.
10877 * symtab.h (class Symbol): Add set_visibility and
10878 override_visibility.
10879 * testsuite/ver_test_1.sh: New file.
10880 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10881 (check_DATA): Add ver_test_1.syms.
10882 (ver_test_1.syms): New target.
10883 * testsuite/Makefile.in: Rebuild.
10885 2009-02-25 Cary Coutant <ccoutant@google.com>
10887 * layout.cc (Layout::choose_output_section): Don't rename sections
10888 when using a linker script that has a SECTIONS clause.
10889 * Makefile.in: Regenerate.
10891 * testsuite/Makefile.am (script_test_5.sh): New test case.
10892 * testsuite/Makefile.in: Regenerate.
10893 * testsuite/script_test_5.cc: New file.
10894 * testsuite/script_test_5.sh: New file.
10895 * testsuite/script_test_5.t: New file.
10897 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10899 * archive.cc (Archive::include_member): Update calls to add_symbols.
10900 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10901 the Layout argument.
10902 * dynobj.h (do_add_symbols): Add the Layout argument.
10903 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10905 * object.h (Object::add_symbols): Add the Layout argument.
10906 (Object::do_add_symbols): Add the Layout argument.
10907 (Sized_relobj::do_add_symbols): Add the Layout argument.
10908 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10909 Unify the two versions.
10910 (Add_plugin_symbols): Remove.
10911 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10912 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10913 (Add_plugin_symbols): Remove.
10914 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10915 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10916 (Add_symbols::run): Make it work with Pulginobj.
10918 2009-02-06 Ian Lance Taylor <iant@google.com>
10920 * object.cc (Sized_relobj::do_layout): Make info message start
10921 with lower case letter.
10923 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10925 * binary.cc: Fix file comment.
10927 * options.h (enum Incremental_disposition): Define.
10928 (class General_options): Add new options: --incremental,
10929 --incremental_changed, --incremental_unchanged,
10930 --incremental_unknown. Add incremental_disposition_ and
10931 implicit_incremental_ fields.
10932 (General_options::incremental_disposition): New function.
10933 (class Position_dependent_options): Add incremental_disposition
10935 (Position_dependent_options::copy_from_options): Set incremental
10937 * options.cc (General_options::parse_incremental_changed): New
10939 (General_options::parse_incremental_unchanged): New function.
10940 (General_options::parse_incremental_unknown): New function.
10941 (General_options::General_options): Initialize new fields
10942 incremental_disposition_ and implicit_incremental_.
10943 (General_options::finalize): Check for uasge of --incremental-*
10944 without --incremental.
10946 2009-02-06 Chris Demetriou <cgd@google.com>
10948 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10949 pointer and to report location as the file name associated with
10951 (gold_undefined_symbol_at_location): New function to replace the
10952 old gold_undefined_symbol functionality.
10953 * target-reloc.h (relocate_section): Update to use
10954 gold_undefined_symbol_at_location.
10955 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10956 Call gold_undefined_symbol function rather than gold_error.
10957 * errors.h (Errors::undefined_symbol): Take location as a
10958 string, rather than calculating it from a relocation.
10959 * errors.cc (Errors::fatal): Print "fatal error:" before the
10961 (Errors::error, Errors::error_at_location): Print "error: "
10962 before the formatted message.
10963 (Errors::undefined_symbol): Take location as a string, rather
10964 than calculating it from a relocation.
10965 (gold_undefined_symbol_at_location): New function akin to
10966 old gold_undefined_symbol, calculates location from relocation.
10967 (gold_undefined_symbol): Change to take only a Symbol pointer
10968 and to report location as the file name associated with the symbol.
10969 * testsuite/debug_msg.sh: Update for changed error messages.
10970 * testsuite/undef_symbol.sh: Likewise.
10972 2009-02-04 Duncan Sands <baldrick@free.fr>
10975 * reduced_debug_output.h
10976 (Output_reduced_debug_abbrev_section::failed): Use format for
10978 (Output_reduced_debug_info_section::faild): Likewise.
10980 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10982 * script.cc (Lazy_demangler): New class.
10983 (Version_script_info::get_symbol_version_helper): Demangle a
10986 2009-01-29 Cary Coutant <ccoutant@google.com>
10988 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10990 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10992 2009-01-28 Ian Lance Taylor <iant@google.com>
10994 * version.cc (version_string): Bump to 1.9.
10996 * gold.h: Include <cstring> and <stdint.h>.
10997 * version.cc: Include <cstdio>.
10998 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11000 * reduced_debug_output.cc (insert_into_vector): Rename from
11001 Insert_into_vector; change all callers. Use Swap_unaligned to
11002 avoid aliasing issue; remove union since it is unnecessary.
11004 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11006 * Makefile.am (CCFILES): Add gc.cc.
11007 (HFILES): Add gc.h.
11008 * Makefile.in: Regenerate.
11009 * gold.cc (Gc_runner): New class.
11010 (queue_initial_tasks): Call garbage collection related tasks
11011 when corresponding options are invoked.
11012 (queue_middle_gc_tasks): New function.
11013 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11014 processed early before laying out sections during garbage collection.
11015 * gold.h (queue_middle_gc_tasks): New function.
11016 (is_prefix_of): Move from "layout.cc".
11017 * i386.cc (Target_i386::gc_process_relocs): New function.
11018 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11019 * main.cc (main): Create object of class "Garbage_collection".
11020 * object.cc (Relobj::copy_symbols_data): New function.
11021 (Relobj::is_section_name_included): New function.
11022 (Sized_relobj::do_layout): Allow this function to be called twice
11023 during garbage collection and defer layout of section during the
11025 * object.h (Relobj::get_symbols_data): New function.
11026 (Relobj::is_section_name_included): New function.
11027 (Relobj::copy_symbols_data): New function.
11028 (Relobj::set_symbols_data): New function.
11029 (Relobj::get_relocs_data): New function.
11030 (Relobj::set_relocs_data): New function.
11031 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11032 (Relobj::gc_process_relocs): New function.
11033 (Relobj::do_gc_process_relocs): New pure virtual function.
11034 (Relobj::sd_): New data member.
11035 (Sized_relobj::is_output_section_offset_invalid): New function.
11036 (Sized_relobj::do_gc_process_relocs): New function.
11037 * options.h (General_options::gc_sections): Modify to not be a no-op.
11038 (General_options::print_gc_sections): New option.
11039 * plugin.cc (Plugin_finish::run): Remove function call to
11040 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11041 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11042 * reloc.cc (Read_relocs::run): Add task to process relocs and
11043 determine unreferenced sections when doing garbage collection.
11044 (Gc_process_relocs): New class.
11045 (Sized_relobj::do_gc_process_relocs): New function.
11046 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11047 sections that are garbage collected.
11048 * reloc.h (Gc_process_relocs): New class.
11049 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11050 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11051 symbols whose corresponding sections are garbage collected.
11052 (Symbol_table::Symbol_table): Add new parameter for the garbage
11054 (Symbol_table::gc_mark_undef_symbols): New function.
11055 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11056 (Symbol_table::gc_mark_dyn_syms): New function.
11057 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11059 (Symbol_table::add_from_object): Likewise.
11060 (Symbol_table::add_from_relobj): When building shared objects, do not
11061 treat externally visible symbols as garbage.
11062 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11063 table information for static and relocatable links.
11064 * symtab.h (Symbol_table::set_gc): New function.
11065 (Symbol_table::gc): New function.
11066 (Symbol_table::gc_mark_undef_symbols): New function.
11067 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11068 (Symbol_table::gc_mark_dyn_syms): New function.
11069 (Symbol_table::gc_): New data member.
11070 * target.h (Sized_target::gc_process_relocs): New pure virtual
11072 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11073 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11075 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11077 * options.h (General_options::gc_sections): Define as a no-op for now.
11078 (General_options::no_keep_memory): Ditto.
11079 (General_options::Bshareable): Define.
11080 * options.cc (General_options::finalize): Honor -Bshareable.
11082 2009-01-20 Andreas Schwab <schwab@suse.de>
11084 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11085 read the value in the contents, since we don't use it. Use the
11086 template endianness when writing.
11087 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11089 2009-01-19 Andreas Schwab <schwab@suse.de>
11091 * configure.tgt (powerpc64-*): Fix targ_obj.
11093 2009-01-15 Ian Lance Taylor <iant@google.com>
11095 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11096 local symbols when stripping all symbols.
11098 2009-01-14 Cary Coutant <ccoutant@google.com>
11100 * output.cc (Output_reloc): Add explicit instantiations.
11102 2009-01-14 Cary Coutant <ccoutant@google.com>
11104 * archive.cc (Archive::get_elf_object_for_member): Remove call
11105 to File_read::claim_for_plugin.
11106 * descriptors.cc (Descriptors::open): Remove reference to
11108 (Descriptors::claim_for_plugin): Remove.
11109 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11110 (Descriptors::is_claimed): Remove.
11111 (claim_descriptor_for_plugin): Remove.
11112 * fileread.cc (File_read::claim_for_plugin): Remove.
11113 * fileread.h (File_read::claim_for_plugin): Remove.
11114 (File_read::descriptor): Reopen descriptor if necessary.
11115 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11116 (Plugin_manager::all_symbols_read): Add task parameter. Change
11118 (Plugin_manager::get_input_file): New function.
11119 (Plugin_manager::release_input_file): New function.
11120 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11121 corresponding data member.
11122 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11123 and pass to base constructor. Change all callers.
11124 (get_input_file, release_input_file): New functions.
11125 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11126 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11127 (Plugin_manager::all_symbols_read): Add task parameter.
11128 (Plugin_manager::get_input_file): New function.
11129 (Plugin_manager::release_input_file): New function.
11130 (Plugin_manager::task_): New data member.
11131 (Pluginobj::Pluginobj): Add filesize parameter.
11132 (Pluginobj::filename): New function.
11133 (Pluginobj::descriptor): New function.
11134 (Pluginobj::filesize): New function.
11135 (Pluginobj::filesize_): New data member.
11136 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11137 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11138 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11140 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11141 with archive libraries.
11142 * testsuite/Makefile.in: Regenerate.
11143 * testsuite/plugin_test.c (struct sym_info): New type.
11144 (get_input_file, release_input_file): New static variables.
11145 (onload): Capture new transfer vector entries.
11146 (claim_file_hook): Stop reading at end of file according to filesize.
11147 Factor out parsing of readelf output into separate function.
11148 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11149 APIs and get the source file name from the symbol table. Convert
11150 source file name to corresponding object file name. Print info
11151 message when adding new input files.
11152 (parse_readelf_line): New function.
11153 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11154 * testsuite/plugin_test_2.sh: Likewise.
11155 * testsuite/plugin_test_3.sh: Likewise.
11156 * testsuite/plugin_test_4.sh: New test case.
11158 2009-01-07 Ian Lance Taylor <iant@google.com>
11160 * version.cc (version_string): Bump to 1.8.
11162 2008-12-23 Cary Coutant <ccoutant@google.com>
11164 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11165 * plugin.cc (Plugin_manager::finish): Rename as
11166 layout_deferred_objects. Move cleanup to separate function.
11167 (Plugin_manager::cleanup): New function.
11168 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11170 * plugin.h (Plugin_manager::finish): Rename as
11171 layout_deferred_objects.
11172 (Plugin_manager::cleanup): New function.
11173 (Plugin_manager::cleanup_done): New field.
11175 2008-12-23 Cary Coutant <ccoutant@google.com>
11177 * plugin.cc (is_visible_from_outside): New function.
11178 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11179 so we don't return "IR only" status for exported symbols or -r links.
11181 * testsuite/Makefile.am (plugin_test_3): New test case.
11182 * testsuite/Makefile.in: Regenerate.
11183 * testsuite/plugin_test_3.sh: New file.
11185 2008-12-22 Cary Coutant <ccoutant@google.com>
11187 * object.cc (Sized_relobj::layout_section): New function.
11188 (Sized_relobj::do_layout): Defer layout of input sections until after
11189 plugin has provided replacement files.
11190 (Sized_relobj::do_layout_deferred_sections): New function.
11191 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11192 (Relobj::layout_deferred_sections): New function.
11193 (Relobj::do_layout_deferred_sections): New function.
11194 (Sized_relobj::do_layout_deferred_sections): New function.
11195 (Sized_relobj::layout_section): New function.
11196 (Sized_relobj::Deferred_layout): New structure.
11197 (Sized_relobj::deferred_layout_): New field.
11198 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11199 Change all callers. Layout deferred sections.
11200 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11202 (Plugin_hook::run): Move code from do_plugin_hook inline.
11203 (Plugin_hook::do_plugin_hook): Remove.
11204 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11205 (Plugin_manager::finish): Renamed, was cleanup.
11206 (Plugin_manager::should_defer_layout): New function.
11207 (Plugin_manager::add_deferred_layout_object): New function.
11208 (Plugin_manager::Deferred_layout_list): New type.
11209 (Plugin_manager::deferred_layout_objects_): New field.
11210 (Plugin_hook::do_plugin_hook): Remove.
11212 2008-12-17 Ian Lance Taylor <iant@google.com>
11214 * options.h (class General_options): Add --no case for
11217 2008-12-16 Cary Coutant <ccoutant@google.com>
11219 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11221 (Plugin_manager::claim_file): Create plugin object even if
11222 plugin did not call the add_symbols callback.
11223 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11224 asking for more symbols than were added.
11225 * testsuite/Makefile.am (plugin_test_1): Add test case with
11227 (empty.syms): New target.
11228 * testsuite/Makefile.in: Regenerate.
11229 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11230 message. Don't call add_symbols if no globals.
11231 (all_symbols_read_hook): Don't provide replacement for empty
11234 2008-12-12 Ian Lance Taylor <iant@google.com>
11236 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11237 r_type == 0 for a local symbol with r_sym == 0.
11238 (scan_relocatable_relocs): Pass r_sym to
11239 local_non_section_strategy.
11240 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11243 * configure.ac: Update test for TLS descriptors: they are
11244 supported as of glibc 2.9.
11245 * configure: Rebuild.
11247 2008-12-11 Ian Lance Taylor <iant@google.com>
11250 * target-reloc.h (Default_scan_relocatable_relocs): For each
11251 function, map r_type == 0 to RELOC_DISCARD.
11253 2008-12-10 Cary Coutant <ccoutant@google.com>
11255 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11256 object to override a kept COMDAT group from a plugin object.
11258 2008-12-09 Ian Lance Taylor <iant@google.com>
11261 * yyscript.y (file_cmd): Handle INPUT.
11263 * testsuite/initpri1.c: Change all declarations to be full
11264 prototypes by adding void, to avoid compiler warnings.
11266 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11268 * options.cc (General_options::parse_plugin_opt): New.
11269 (General_options::add_plugin): The argument now is just the filename.
11270 (General_options::add_plugin_option): New.
11271 * options.h (plugin_opt): New.
11272 (add_plugin): Change argument name.
11273 (add_plugin_option): New.
11274 * plugin.cc (Plugin::load): Don't parse the plugin option.
11275 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11276 (Plugin::add_option): New.
11277 (Plugin::args_): Change type.
11278 (Plugin::filename_): New.
11279 (Plugin_manager::add_plugin_option): New.
11280 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11281 * testsuite/Makefile.in: Regenerate.
11283 2008-12-05 Cary Coutant <ccoutant@google.com>
11285 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11286 Handle --strip-lto-sections option.
11287 * options.h (strip_lto_sections): New option.
11289 2008-12-01 Cary Coutant <ccoutant@google.com>
11291 * plugin.cc (ld_plugin_message): Change format parameter to const.
11292 Fix mismatch between new[] and delete.
11294 2008-11-14 Cary Coutant <ccoutant@google.com>
11296 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11299 2008-11-05 Craig Silverstein <csilvers@google.com>
11301 * options.cc (General_options::parse_dynamic_list): New function.
11302 * options.h (General_options): New flags dynamic_list,
11303 dynamic_list_data, dynamic_list_cpp_new, and
11304 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11305 (General_options::in_dynamic_list): New function.
11306 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11307 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11308 (Lex::can_continue_name): Likewise.
11310 (read_script_file): New parameter script_options.
11311 (read_dynamic_list): New function.
11312 (Script_options::define_dynamic_list): New function.
11313 (dynamic_list_keyword_parsecodes): New variable.
11314 (dynamic_list_keywords): New variable.
11315 * script.h (Script_options::define_dynamic_list): New function
11317 (read_dynamic_list): New function prototype.
11318 * symtab.cc (strprefix): New macro.
11319 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11320 dynamic_list_data, dynamic_list_cpp_new, and
11321 dynamic_list_cpp_typeinfo.
11322 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11323 (dynamic_list_expr): New rule.
11324 (dynamic_list_nodes): Likewise.
11325 (dynamic_list_node): Likewise.
11326 * testsuite/Makefile.am (dynamic_list): New test.
11327 * testsuite/Makefile.in: Regenerated.
11328 * testsuite/dynamic_list.t: New file.
11329 * testsuite/dynamic_list.sh: New file.
11331 2008-11-05 Craig Silverstein <csilvers@google.com>
11333 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11334 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11335 (t11_last): Likewise.
11336 * testsuite/ver_test_6.c (main): Likewise.
11338 2008-10-07 Cary Coutant <ccoutant@google.com>
11340 * options.c (General_options::finalize): Add check for -static and
11342 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11345 2008-10-02 Cary Coutant <ccoutant@google.com>
11347 * plugin.cc (make_sized_plugin_object): Fix conditional
11348 compilation to work when not all targets are enabled.
11350 2008-09-29 Cary Coutant <ccoutant@google.com>
11352 * archive.cc (Archive::get_file_and_offset): Use filename instead
11353 of name to get library path.
11354 (Archive::include_member): Unlock external member of a thin archive.
11356 * testsuite/Makefile.am (TEST_AR): New variable.
11357 (thin_archive_test_1): New test.
11358 (thin_archive_test_2): New test.
11359 * testsuite/Makefile.in: Regenerate.
11360 * testsuite/thin_archive_main.cc: New file.
11361 * testsuite/thin_archive_test_1.cc: New file.
11362 * testsuite/thin_archive_test_2.cc: New file.
11363 * testsuite/thin_archive_test_3.cc: New file.
11364 * testsuite/thin_archive_test_4.cc: New file.
11366 2008-09-29 Cary Coutant <ccoutant@google.com>
11368 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11369 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11371 (Sized_relobj::do_finalize_local_symbols): Likewise.
11372 (Sized_relobj::map_to_kept_section): Likewise.
11373 * object.h (Sized_relobj::invalid_address): New constant.
11374 (Sized_relobj::do_output_section_offset): Check for invalid_address
11376 * output.cc (Output_reloc::local_section_offset): Use constant
11377 invalid_address instead of -1U.
11378 (Output_reloc::get_address): Likewise.
11379 (Output_section::output_address): Change -1U to -1ULL.
11380 * output.h (Output_reloc::invalid_address): New constant.
11381 * reloc.cc (Sized_relobj::write_sections): Use constant
11382 invalid_address instead of -1U.
11383 (Sized_relobj::relocate_sections): Likewise.
11384 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11385 values for merge sections.
11386 * target-reloc.h (relocate_for_relocatable): Use constant
11387 invalid_address instead of -1U.
11389 2008-09-19 Cary Coutant <ccoutant@google.com>
11391 Add plugin functionality for link-time optimization (LTO).
11392 * configure.ac (plugins): Add --enable-plugins option.
11393 * configure: Regenerate.
11394 * config.in: Regenerate.
11395 * Makefile.am (LIBDL): New variable.
11396 (CCFILES): Add plugin.cc.
11397 (HFILES): Add plugin.h.
11398 (ldadd_var): Add LIBDL.
11399 * Makefile.in: Regenerate.
11401 * archive.cc: Include "plugin.h".
11402 (Archive::setup): Don't preread archive symbols when using a plugin.
11403 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11404 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11406 (Archive::include_member): Add symbols from plugin objects.
11407 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11408 * descriptors.cc (Descriptors::open): Check for file descriptors
11409 abandoned by plugins.
11410 (Descriptors::claim_for_plugin): New function.
11411 * descriptors.h (Descriptors::claim_for_plugin): New function.
11412 (Open_descriptor::is_claimed): New field.
11413 (claim_descriptor_for_plugin): New function.
11414 * fileread.cc (File_read::claim_for_plugin): New function.
11415 * fileread.h (File_read::claim_for_plugin): New function.
11416 (File_read::descriptor): New function.
11417 * gold.cc: Include "plugin.h".
11418 (queue_initial_tasks): Add task to call plugin hooks for generating
11420 * main.cc: Include "plugin.h".
11421 (main): Load plugin libraries.
11422 * object.h (Pluginobj): Declare.
11423 (Object::pluginobj): New function.
11424 (Object::do_pluginobj): New function.
11425 (Object::set_target): New function.
11426 * options.cc: Include "plugin.h".
11427 (General_options::parse_plugin): New function.
11428 (General_options::General_options): Initialize plugins_ field.
11429 (General_options::add_plugin): New function.
11430 * options.h (Plugin_manager): Declare.
11431 (General_options): Add --plugin option.
11432 (General_options::has_plugins): New function.
11433 (General_options::plugins): New function.
11434 (General_options::add_plugin): New function.
11435 (General_options::plugins_): New field.
11436 * plugin.cc: New file.
11437 * plugin.h: New file.
11438 * readsyms.cc: Include "plugin.h".
11439 (Read_symbols::do_read_symbols): Check for archive before checking
11440 for ELF file. Call plugin hooks to claim files.
11441 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11442 from a real object file; force override when processing replacement
11444 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11445 (Symbol::init_base_object): Likewise.
11446 (Symbol::init_base_output_data): Likewise.
11447 (Symbol::init_base_output_segment): Likewise.
11448 (Symbol::init_base_constant): Likewise.
11449 (Symbol::init_base_undefined): Likewise.
11450 (Symbol::output_section): Assert that object is not a plugin.
11451 (Symbol_table::add_from_pluginobj): New function.
11452 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11454 (Symbol_table::sized_write_globals): Likewise.
11455 (Symbol_table::add_from_pluginobj): Instantiate template.
11456 * symtab.h (Sized_pluginobj): Declare.
11457 (Symbol::in_real_elf): New function.
11458 (Symbol::set_in_real_elf): New function.
11459 (Symbol::in_real_elf_): New field.
11460 (Symbol_table::add_from_pluginobj): New function.
11462 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11463 (LIBDL): New variable.
11464 (LDADD): Add LIBDL.
11465 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11466 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11467 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11468 (MOSTLYCLEANFILES): Likewise.
11469 * testsuite/Makefile.in: Regenerate.
11470 * testsuite/plugin_test.c: New file.
11471 * testsuite/plugin_test_1.sh: New file.
11472 * testsuite/plugin_test_2.sh: New file.
11474 2008-09-16 Ian Lance Taylor <iant@google.com>
11476 * target-reloc.h (relocate_section): Check whether a symbol is
11477 defined by the ABI before reporting an undefined symbol error.
11478 * target.h (Target::is_defined_by_abi): Make parameter const.
11479 (Target::do_is_defined_by_abi): Likewise.
11480 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11481 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11482 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11483 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11484 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11485 * testsuite/Makefile.in: Rebuild.
11487 * fileread.cc (make_view): Add casts to avoid warning.
11489 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11491 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11492 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11494 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11496 * options.h (General_options::output_is_executable): New.
11497 (General_options::output_is_pie): New.
11498 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11499 for shared libraries.
11500 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11502 2008-09-11 Chris Demetriou <cgd@google.com>
11504 * options.h (origin): New -z option.
11505 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11506 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11509 2008-09-05 Cary Coutant <ccoutant@google.com>
11511 * fileread.cc (File_read::make_view): Add check for attempt to map
11512 beyond end of file.
11514 2008-09-05 Cary Coutant <ccoutant@google.com>
11516 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11517 explicit instantiations.
11519 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11522 * options.cc (General_options::finalize): Allow undefined symbols
11523 in shlibs if linking -shared.
11526 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11527 symbols as not needing a dynsym entry.
11529 2008-08-20 Craig Silverstein <csilvers@google.com>
11531 * fileread.cc (File_read::open): Do not lock the file unless it
11532 was successfully opened.
11534 2008-08-14 Cary Coutant <ccoutant@google.com>
11536 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11537 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11538 * testsuite/tls_test.cc (struct int128): 128-bit struct
11539 for testing TLS relocs with non-zero addend.
11540 (v12): New TLS variable.
11542 (t_last): Add check for v12.
11543 * testsuite/tls_test.h (t12): New function.
11544 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11546 2008-08-13 Ian Lance Taylor <iant@google.com>
11548 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11549 set tls_segment_ or relro_segment_.
11550 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11552 * output.h (Output_section::clear_is_relro): New function.
11553 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11554 sections specially even when output_data_ is empty.
11555 (Output_segment::maximum_alignment): When first section is relro,
11556 only force alignment for PT_LOAD segments.
11557 * script.cc (script_data_segment_align): New function.
11558 (script_data_segment_relro_end): New function.
11559 * script-c.h (script_data_segment_align): Declare.
11560 (script_data_segment_relro_end): Declare.
11561 * script-sections.h (class Script_sections): Declare
11562 data_segment_align and data_segment_relro_end. Add fields
11563 segment_align_index_ and saw_relro_end_.
11564 * script-sections.cc (class Sections_element): Add set_is_relro
11565 virtual function. Add new bool* parameter to place_orphan_here.
11566 Add get_output_section virtual function.
11567 (class Output_section_definition): Add set_is_relro. Add new
11568 bool* parameter to place_orphan_here. Add get_output_section.
11569 Add is_relro_ field.
11570 (Output_section_definition::Output_section_definition): Initialize
11571 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11572 and is_relro_ fields.
11573 (Output_section_definition::place_orphan_here): Add is_relro
11575 (Output_section_definition::set_section_addresses): Set relro for
11577 (Output_section_definition::alternate_constraint): Likewise.
11578 (class Orphan_output_section): Add new bool* parameter to
11579 place_orphan_here. Add get_output_section.
11580 (Orphan_output_section::place_orphan_here): Add is_relro
11582 (Script_sections::Script_sections): Initialize
11583 data_segment_align_index_ and saw_relro_end_.
11584 (Script_sections::data_segment_align): New function.
11585 (Script_sections::data_segment_relro_end): New function.
11586 (Script_sections::place_orphan): Set or clear is_relro.
11587 (Script_sections::set_section_addresses): Force alignment of first
11589 * yyscript.y (exp): Call script_data_segment_align and
11590 script_data_segment_relro_end.
11591 * testsuite/relro_script_test.t: New file.
11592 * testsuite/relro_test.cc (using_script): Declare.
11593 (t1, t2): Test using_script.
11594 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11595 (relro_script_test_SOURCES): Define.
11596 (relro_script_test_DEPENDENCIES): Define.
11597 (relro_script_test_LDFLAGS): Define.
11598 (relro_script_test_LDADD): Define.
11599 (relro_script_test.so): New target.
11600 * testsuite/Makefile.in: Rebuild.
11602 2008-08-06 Cary Coutant <ccoutant@google.com>
11604 * archive.cc (Archive::total_archives, Archive::total_members)
11605 (Archive::total_members_loaded): New variables.
11606 (Archive::setup): Add parameter. Add option to preread
11608 (Archive::read_armap): Add counter.
11609 (Archive::get_file_and_offset): New function.
11610 (Archive::get_elf_object_for_member): New function.
11611 (Archive::read_all_symbols): New function.
11612 (Archive::read_symbols): New function.
11613 (Archive::add_symbols): Add counters.
11614 (Archive::include_all_members): Use armap to find members if it's
11616 (Archive::include_member): Skip reading symbols if already read.
11617 Factored code into Archive::get_file_and_offset and
11618 Archive::get_elf_object_for_member. Changed call to
11619 Mapfile::report_include_archive_member.
11620 (Archive::print_stats): New function.
11621 * archive.h: Declare Object and Read_symbols_data classes.
11622 (Archive::Archive): Add initializers for new members.
11623 (Archive::setup): Add parameter.
11624 (Archive::print_stats): New function.
11625 (Archive::total_archives, Archive::total_members)
11626 (Archive::total_members_loaded): New variables.
11627 (Archive::get_file_and_offset): New function.
11628 (Archive::get_elf_object_for_member): New function.
11629 (Archive::read_all_symbols): New function.
11630 (Archive::read_symbols): New function.
11631 (Archive::Archive_member): New class.
11632 (Archive::members_): New member.
11633 (Archive::num_members_): New member.
11634 * main.cc: Include archive.h.
11635 (main): Call Archive::print_stats.
11636 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11637 archive parameter; member_name is now the fully-decorated name.
11638 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11639 * options.h: (General_options): Add --preread-archive-symbols option.
11640 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11643 2008-08-04 Ian Lance Taylor <iant@google.com>
11645 * symtab.h (Symbol::use_plt_offset): New function.
11646 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11647 * powerpc.cc (Relocate::relocate): Likewise.
11648 * sparc.cc (Relocate::relocate): Likewise.
11649 * x86_64.cc (Relocate::relocate): Likewise.
11650 * testsuite/weak_plt.sh: New test.
11651 * testsuite/weak_plt_main.cc: New test.
11652 * testsuite/weak_plt_shared.cc: New test.
11653 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11654 (check_PROGRAMS): Add weak_plt.
11655 (check_DATA): Add weak_plt_shared.so.
11656 (weak_plt_main_pic.o, weak_plt): New targets.
11657 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11658 * testsuite/Makefile.in: Rebuild.
11660 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11662 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11663 * testsuite/Makefile.in: Rebuild.
11665 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11667 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11668 * Makefile.in: Regenerate.
11669 * po/POTFILES.in: Regenerate.
11671 2008-07-29 Ian Lance Taylor <iant@google.com>
11673 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11674 symbols before other symbols.
11675 * testsuite/script_test_2.cc (test_addr): Declare.
11676 (test_addr_alias): Declare.
11677 (main): Check that test_addr and test_addr_alias have the right
11679 * testsuite/script_test_2.t: Define test_addr_alias and
11682 2008-07-24 Ian Lance Taylor <iant@google.com>
11685 * descriptors.cc: New file.
11686 * descriptors.h: New file.
11687 * gold-threads.h (class Hold_optional_lock): New class.
11688 * fileread.cc: Include "descriptors.h".
11689 (File_read::~File_read): Release descriptor rather than closing
11691 (File_read::open) [file]: Call open_descriptor rather than open.
11692 Set is_descriptor_opened_.
11693 (File_read::open) [memory]: Assert that descriptor is not open.
11694 (File_read::reopen_descriptor): New function.
11695 (File_read::release): Release descriptor.
11696 (File_read::do_read): Make non-const. Reopen descriptor.
11697 (File_read::read): Make non-const.
11698 (File_read::make_view): Reopen descriptor.
11699 (File_read::do_readv): Likewise.
11700 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11701 Update declarations.
11702 * layout.cc: Include "descriptors.h".
11703 (Layout::create_build_id): Use open_descriptor rather than open.
11704 * output.cc: Include "descriptors.h".
11705 (Output_file::open): Use open_descriptor rather than open.
11706 * archive.cc (Archive::const_iterator): Change Archive to be
11708 (Archive::begin, Archive::end): Make non-const.
11709 (Archive::count_members): Likewise.
11710 * archive.h (class Archive): Update declarations.
11711 * object.h (Object::read): Make non-const.
11712 * Makefile.am (CCFILES): Add descriptors.cc.
11713 (HFILES): Add descriptors.h.
11714 * Makefile.in: Rebuild.
11717 * gold.h: Always include <clocale>. Add Solaris workarounds
11718 following code in binutils/sysdep.h.
11721 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11722 this->eh_frame_hdr_ is NULL before using it.
11724 * dynobj.cc (Versions::Versions): Update comment.
11726 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11727 the base version name.
11729 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11730 array size plus one.
11731 (Stringpool_template::set_string_offsets): Subtract one from key
11732 before using it as an array index.
11733 (Stringpool_template::get_offset_with_length): Likewise.
11734 (Stringpool_template::write_to_buffer): Likewise.
11735 * stringpool.h (Stringpool_template::get_offset_from_key):
11738 2008-07-23 Ian Lance Taylor <iant@google.com>
11741 * object.h (Merged_symbol_value::value): Do our best to handle a
11745 * script.cc (Version_script_info::get_versions): Don't add empty
11746 version tag to return value.
11747 (Version_script_info::get_symbol_version_helper): Change return
11748 type to bool. Add pversion parameter. Change all callers.
11749 (script_register_vers_node): Don't require a non-NULL tag.
11750 * script.h (class Version_script_info): Update declarations.
11751 (Version_script_info::get_symbol_version): Change return type to
11752 bool. Add version parameter. Change all callers.
11753 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11754 handling. Handle an empty version from a version script.
11755 (Symbol_table::define_special_symbol): Likewise.
11756 * testsuite/ver_test_10.script: New file.
11757 * testsuite/ver_test_10.sh: New file.
11758 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11759 (check_DATA): Add ver_test_10.syms.
11760 (ver_test_10.syms, ver_test_10.so): New target.
11761 * testsuite/Makefile.in: Rebuild.
11763 2008-07-23 Simon Baldwin <simonb@google.com>
11765 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11766 to zero for undefined symbols from dynamic libraries.
11768 2008-07-23 Ian Lance Taylor <iant@google.com>
11770 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11771 Change all callers.
11772 * symtab.h (class Symbol_table): Update declaration.
11773 * testsuite/ver_test_9.cc: New file.
11774 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11775 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11776 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11777 (ver_test_9.so, ver_test_9.o): New targets.
11778 * testsuite/Makefile.in: Rebuild.
11780 2008-07-22 Ian Lance Taylor <iant@google.com>
11782 * options.h (class General_options): Define --check-sections.
11783 * layout.cc (Layout::set_segment_offsets): Handle
11786 * options.h (class General_options): Define -n/--nmagic and
11788 * options.cc (General_options::finalize): For -n/--nmagic or
11789 -N/--omagic, set -static.
11790 * layout.cc (Layout::attach_allocated_section_to_segment): If
11791 -N/--omagic, don't put read-only and read-write sections in
11792 different segments.
11793 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11794 finding a read-only segment.
11795 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11796 don't set the minimum segment alignment to the common page size,
11797 and don't set the file offset to the address modulo the page size.
11798 * script-sections.cc (Script_sections::create_segments): If
11799 -n/--omagic, don't put read-only and read-write sections in
11800 different segments.
11802 * cref.cc: New file.
11803 * cref.h: New file.
11804 * options.h (class General_options): Add --print-symbol-counts.
11805 * main.cc (main): Issue defined symbol report if requested.
11806 * archive.cc (Archive::interpret_header): Make into a const member
11808 (Archive::add_symbols): Call Input_objects::archive_start and
11810 (Archive::const_iterator): Define new class.
11811 (Archive::begin, Archive::end): New functions.
11812 (Archive::include_all_members): Rewrite to use iterator.
11813 (Archive::count_members): New function.
11814 * archive.h (class Archive): Update declarations.
11815 (Archive::filename): New function.
11816 * object.cc: Include "cref.h".
11817 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11818 (Sized_relobj::do_get_global_symbol_counts): New function.
11819 (Input_objects::add_object): Add object to cross-referencer.
11820 (Input_objects::archive_start): New function.
11821 (Input_objects::archive_stop): New function.
11822 (Input_objects::print_symbol_counts): New function.
11823 * object.h: Declare Cref and Archive.
11824 (Object::get_global_symbol_counts): New function.
11825 (Object::do_get_global_symbol_counts): New pure virtual function.
11826 (class Sized_relobj): Add defined_count_ field. Update
11828 (class Input_objects): Add cref_ field. Update constructor.
11829 Update declarations.
11830 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11832 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11834 (Sized_dynobj::do_get_global_symbol_counts): New function.
11835 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11836 defined_count_. Update declarations. Define Symbols typedef.
11837 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11838 parameter. Change all callers.
11839 (Symbol_table::add_from_dynobj): Add sympointers and defined
11840 parameters. Change all callers.
11841 * symtab.h (class Symbol_table): Update declarations.
11842 * Makefile.am (CCFILES): Add cref.cc.
11843 (HFILES): Add cref.h.
11844 * Makefile.in: Rebuild.
11846 2008-07-22 Simon Baldwin <simonb@google.com>
11848 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11849 to zero when writing undefined symbols.
11851 2008-07-22 Ian Lance Taylor <iant@google.com>
11853 * output.cc (Output_section::add_input_section): Don't try to
11854 merge empty merge sections.
11856 2008-07-21 Craig Silverstein <csilvers@google.com>
11858 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11859 Include symbol version in error message.
11861 2008-07-20 Chris Demetriou <cgd@google.com>
11863 * configure.ac (gold_cv_c_random_seed): New configured variable.
11864 (RANDOM_SEED_CFLAGS): New substituted variable.
11865 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11866 * configure: Rebuild.
11867 * Makefile.in: Likewise.
11868 * testsuite/Makefile.in: Likewise.
11870 2008-07-18 Ian Lance Taylor <iant@google.com>
11872 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11873 where we see NAME/NULL and NAME/VERSION as separate symbols.
11874 * testsuite/ver_test_main.cc (main): Call t4.
11875 (t4, t4_2a): Define.
11876 * testsuite/ver_test_2.cc (t4_2): Define.
11877 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11878 * testsuite/ver_test_4.cc (t4_2a): Define.
11879 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11880 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11882 2008-07-17 Ian Lance Taylor <iant@google.com>
11884 * dynobj.cc (Versions::add_def): If we give an error about a
11885 missing version, go ahead and create the version anyhow.
11887 2008-07-10 Ian Lance Taylor <iant@google.com>
11889 Handle output sections with more than 0x7fffffff bytes.
11890 * object.h (class Relobj): Change map_to_output_ to
11891 output_sections_, and just keep a section pointer. Change all
11892 uses. Move comdat group support to Sized_relobj.
11893 (Relobj::is_section_specially_mapped): Remove.
11894 (Relobj::output_section): Remove poff parameter. Change all
11896 (Relobj::output_section_offset): New function.
11897 (Relobj::set_section_offset): Rewrite.
11898 (Relobj::map_to_output): Remove.
11899 (Relobj::output_sections): New function.
11900 (Relobj::do_output_section_offset): New pure virtual function.
11901 (Relobj::do_set_section_offset): Likewise.
11902 (class Sized_relobj): Add section_offsets_ field. Add comdat
11903 group support from Relobj. Update declarations.
11904 (Sized_relobj::get_output_section_offset): New function.
11905 (Sized_relobj::do_output_section_offset): New function.
11906 (Sized_relobj::do_set_section_offset): New function.
11907 * object.cc (Relobj::output_section_address): Remove.
11908 (Sized_relobj::Sized_relobj): Initialize new fields.
11909 (Sized_relobj::include_section_group): Cast find_kept_object to
11911 (Sized_relobj::include_linkonce_section): Likewise.
11912 (Sized_relobj::do_layout): Use separate arrays for output section
11914 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11916 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11917 output_sections and section_offsets.
11918 (Sized_relobj::write_local_symbols): Likewise.
11919 (map_to_kept_section): Compute output address directly.
11920 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11921 output_sections and section_offsets.
11922 (Sized_relobj::write_sections): Likewise.
11923 (Sized_relobj::relocate_sections): Likewise.
11924 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11925 * output.h (class Output_reloc): Update declarations. Change
11926 u2_.relobj to Sized_relobj*.
11927 (class Output_data_reloc): Change add functions to use
11929 * output.cc (Output_reloc::Output_reloc): Change relobj to
11931 (Output_reloc::local_section_offset): Change return type to
11932 Elf_Addr. Use get_output_section_offset.
11933 (Output_reloc::get_address): Likewise.
11934 (Output_section::is_input_address_mapped): Don't call
11935 is_section_specially_mapped.
11936 (Output_section::output_offset): Likewise.
11937 (Output_section::output_address): Likewise.
11938 (Output_section::starting_output_address): Likewise.
11939 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11940 parameter to Sized_relobj*.
11941 (Copy_relocs::need_copy_reloc): Likewise.
11942 (Copy_relocs::save): Likewise.
11943 * copy-relocs.h (class Copy_relocs): Update declarations.
11944 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11945 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11946 * target-reloc.h (relocate_for_relocatable): Change
11947 offset_in_output_section type to Elf_Addr. Change code that uses
11949 * layout.cc (Layout::layout): Always set *off.
11950 * mapfile.cc (Mapfile::print_input_section): Use
11951 output_section_offset.
11952 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11954 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11955 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11956 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11958 2008-07-03 Ian Lance Taylor <iant@google.com>
11960 * layout.cc (Layout::include_section): Do not discard unrecognized
11961 SHT_STRTAB sections.
11963 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11965 * script.cc (Lex::can_continue_name): Make '?' allowable in
11966 version-script names.
11967 * testsuite/version_script.map: Change glob pattern to use '?'
11969 2008-06-30 Manish Singh <yosh@gimp.org>
11972 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11975 2008-06-30 Ian Lance Taylor <iant@google.com>
11979 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11980 versions]: Don't try to read the value in the contents, since we
11981 don't use it. Use the template endianness when writing.
11983 2008-06-25 Cary Coutant <ccoutant@google.com>
11985 * fileread.cc (File_read::make_view): Assert on zero-length view.
11986 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11987 symbol table when there are no symbols to read.
11989 2008-06-23 Craig Silverstein <csilvers@google.com>
11991 * version.cc (version_string): Bump to 1.7
11993 2008-06-18 Craig Silverstein <csilvers@google.com>
11995 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11996 constant 0xFFFF to type Valtype.
11997 (Powerpc_relocate_functions::rel16_ha): Likewise.
11999 2008-06-17 Ian Lance Taylor <iant@google.com>
12001 * output.h (Output_section::Input_section): Initialize p2align_ to
12002 zero for Output_section_data constructors.
12003 (Output_section::Input_section::addralign): If not an input
12004 section, return the alignment of the Output_section_data.
12005 * testsuite/copy_test.cc: New file.
12006 * testsuite/copy_test_1.cc: New file.
12007 * testsuite/copy_test_2.cc: New file.
12008 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12009 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12010 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12011 (copy_test_1_pic.o, copy_test_1.so): New targets.
12012 (copy_test_2_pic.o, copy_test_2.so): New targets.
12013 * testsuite/Makefile.in: Rebuild.
12015 * script-sections.cc (Script_sections::place_orphan): Initialize
12016 local variable exact.
12018 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12020 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12022 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12023 David S. Miller <davem@davemloft.net>
12025 * powerpc.cc: New file.
12026 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12027 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12028 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12029 * Makefile.in: Rebuild.
12031 2008-06-09 Ian Lance Taylor <iant@google.com>
12033 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12035 (throwing, orig_terminate): New static variables.
12036 (terminate_handler): New static function.
12037 (t2): Set terminate handler.
12039 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12042 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12045 2008-05-30 Cary Coutant <ccoutant@google.com>
12047 * archive.cc (Archive::include_all_members) Correct to step
12048 over symbol table and extended name table in thin archives.
12050 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12053 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12056 2008-05-28 Caleb Howe <cshowe@google.com>
12058 * reduced_debug_output.cc: New file.
12059 * reduced_debug_output.h: New file.
12060 * options.h (class General_options): Add --strip-debug-non-line.
12061 * options.cc (General_options::finalize): Add strip_debug_non_line
12062 to the strip heirarchy.
12063 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12065 * layout.cc: Include "reduced_debug_output.h".
12066 (Layout::Layout): Initialize new fields.
12067 (line_only_debug_sections): New static array.
12068 (is_lines_only_debug_sections): New static inline function.
12069 (Layout::include_section): Handle --strip-debug-non-line.
12070 (Layout::make_output_section): If --strip-debug-non-line, build
12071 new output sections for .debug_abbrev and .debug_info.
12072 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12073 gold. Warn about possible overflow.
12074 (read_signed_LEB_128): Likewise.
12075 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12076 (read_signed_LEB_128): Declare.
12077 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12078 (HFILES): Add reduced_debug_output.h.
12079 * Makefile.in: Rebuild.
12081 2008-05-21 Ian Lance Taylor <iant@google.com>
12083 * mapfile.cc: New file.
12084 * mapfile.h: New file.
12085 * options.h (class General_options): Add -M/--print-map and -Map.
12086 * options.cc (General_options::finalize): Make -M equivalent to
12088 * main.cc: Include <cstdio> and "mapfile.h".
12089 (main): Open mapfile if requested.
12090 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12091 constructor. Change caller.
12092 (queue_initial_tasks): Add mapfile parameter. Change caller.
12093 (queue_middle_tasks): Likewise.
12094 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12096 * archive.cc: Include "mapfile.h".
12097 (Archive::add_symbols): Add mapfile parameter. Change all
12098 callers. Pass mapfile, symbol, and reason to include_member.
12099 (Archive::include_all_members): Add mapfile parameter. Change all
12101 (Archive::include_member): Add mapfile, sym, and why parameters.
12102 Change all callers. Report inclusion to map file.
12103 * archive.h: Include "fileread.h".
12104 (class Archive): Update declarations.
12105 (Archive::file): New const method.
12106 (class Add_archive_symbols): Add mapfile_ field. Update
12107 constructor. Change all callers.
12108 * readsyms.h (class Read_symbols): Likewise.
12109 (class Finish_group): Likewise.
12110 (class Read_script): Likewise.
12111 * common.cc: Include "mapfile.h".
12112 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12114 (Symbol_table::do_allocate_commons): Likewise.
12115 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12116 symbol allocation to mapfile.
12117 * common.h (class Allocate_commons_task): Add mapfile_ field.
12118 Update constructor. Change all callers.
12119 * symtab.h (class Symbol_table): Update declarations.
12120 * layout.cc: Include "mapfile.h".
12121 (Layout_task_runner::run): Print information to mapfile.
12122 (Layout::create_gold_note): Change Output_data_fixed_space to
12123 Output_data_zero_fill.
12124 (Layout::create_build_id): Likewise.
12125 (Layout::print_to_mapfile): New function.
12126 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12127 constructor. Change caller.
12128 (class Layout): Declare print_to_mapfile.
12129 * output.cc (Output_section::Input_section::print_to_mapfile): New
12131 (Output_section::add_input_section): If producing a map, always
12132 add to input_sections_ list.
12133 (Output_section::do_print_to_mapfile): New function.
12134 (Output_segment::print_sections_to_mapfile): New function.
12135 (Output_segment::print_section_list_to_mapfile): New function.
12136 * output.h: Include "mapfile.h".
12137 (Output_data::print_to_mapfile): New function.
12138 (Output_data::do_print_to_mapfile): New virtual function.
12139 (Output_segment_headers::do_print_to_mapfile): New function.
12140 (Output_file_header::do_print_to_mapfile): New function.
12141 (Output_data_const::do_print_to_mapfile): New function.
12142 (class Output_data_const_buffer): Add map_name_ field. Update
12143 constructor. Change all callers. Add do_print_to_mapfile
12145 (class Output_data_fixed_space): Likewise.
12146 (class Output_data_space): Likewise.
12147 (class Output_data_zero_fill): New class.
12148 (Output_data_strtab::do_print_to_mapfile): New function.
12149 (Output_data_reloc_base::do_print_to_mapfile): New function.
12150 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12151 (Output_data_group::do_print_to_mapfile): New function.
12152 (Output_data_got::do_print_to_mapfile): New function.
12153 (Output_data_dynamic::do_print_to_mapfile): New function.
12154 (Output_symtab_xindex::do_print_to_mapfile): New function.
12155 (class Output_section): Declare do_print_to_mapflie. Declare
12156 print_to_mapfile in Input_section.
12157 (class Output_segment): Declare new functions.
12158 * object.h (Sized_relobj::symbol_count): New function.
12159 * script-sections.cc
12160 (Output_section_element_dot_assignment::set_section_addresses):
12161 Change Output_data_fixed_space to Output_data_zero_fill.
12162 (Output_data_expression::do_print_to_mapfile): New function.
12163 * script.cc (read_input_script): Add mapfile parameter. Change
12165 * script.h (read_input_script): Update declaration.
12166 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12167 (Eh_frame::do_print_to_mapfile): New function.
12168 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12169 (Output_merge_string::do_print_to_mapfile): New function.
12170 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12172 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12174 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12176 * Makefile.am (CCFILES): Add mapfile.cc.
12177 (HFILES): Add mapfile.h.
12178 * Makefile.in: Rebuild.
12180 2008-05-19 Ian Lance Taylor <iant@google.com>
12182 * options.h (class General_options): Add -z relro.
12183 * layout.cc (Layout::Layout): Initialize relro_segment_.
12184 (Layout::add_output_section_data): Return the output section.
12185 (Layout::make_output_section): Rcognize relro sections and mark
12186 them appropriately.
12187 (Layout::attach_allocated_section_to_segment): Put relro sections
12188 in a PT_GNU_RELRO segment.
12189 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12191 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12193 (Layout::linkonce_mapping): Map d.rel.ro.local to
12194 .data.rel.ro.local.
12195 (Layout::output_section_name): Us .data.rel.ro.local for any
12196 section which begins with that.
12197 * layout.h (class Layout): Update add_output_section_data
12198 declaration. Add relro_segment_ field.
12199 * output.cc (Output_section::Output_section): Initialize is_relro_
12200 and is_relro_local_ fields.
12201 (Output_segment::add_output_section): Group relro sections.
12202 (Output_segment::is_first_section_relro): New function.
12203 (Output_segment::maximum_alignment): If there is a relro section,
12204 align the segment to the common page size.
12205 (Output_segment::set_section_addresses): Track whether we are
12206 looking at relro sections. If the last section is a relro
12207 section, align to the common page size.
12208 (Output_segment::set_section_list_addresses): Add in_relro
12209 parameter. Change all callers. Align to the page size when
12210 moving from relro to non-relro section.
12211 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12213 * output.h (class Output_section): Add is_relro_ and
12214 is_relro_local_ fields.
12215 (Output_section::is_relro): New function.
12216 (Output_section::set_is_relro): New function.
12217 (Output_section::is_relro_local): New function.
12218 (Output_section::set_is_relro_local): New function.
12219 (class Output_segment): Update declarations.
12220 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12221 * sparc.cc (Target_sparc::got_section): Likewise.
12222 * x86_64.cc (Target_x86_64::got_section): Likewise.
12223 * testsuite/relro_test_main.cc: New file.
12224 * testsuite/relro_test.cc: New file.
12225 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12226 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12227 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12228 (relro_test.so, relro_test_pic.o): New targets.
12229 * testsuite/Makefile.in: Rebuild.
12231 2008-05-16 Ian Lance Taylor <iant@google.com>
12233 * output.cc (Output_segment::add_output_section): Remove front
12235 * output.h (class Output_segment): Remove
12236 add_initial_output_section and overloaded add_output_section.
12237 Update declaration of remaining add_output_section.
12238 * layout.cc (Layout::create_interp): Call add_output_section
12239 rather than add_initial_output_section.
12240 (Layout::finish_dynamic_section): Likewise.
12242 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12243 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12244 know the dynamic type.
12245 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12246 field. Initialize it in constructor.
12247 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12248 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12249 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12252 * output.cc (Output_reloc::get_address): Change return type to
12254 * output.h (class Output_reloc): Update get_address declaration.
12255 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12256 for section addresses.
12258 2008-05-09 Ian Lance Taylor <iant@google.com>
12261 * gold.cc (gold_nomem): Use return value of write.
12263 2008-05-08 Ian Lance Taylor <iant@google.com>
12265 * symtab.c (Symbol::init_base_output_data): Add version
12266 parameter. Change all callers.
12267 (Symbol::init_base_output_segment): Likewise.
12268 (Symbol::init_base_constant): Likewise.
12269 (Symbol::init_base_undefined): Likewise.
12270 (Sized_symbol::init_output_data): Likewise.
12271 (Sized_symbol::init_output_segment): Likewise.
12272 (Sized_symbol::init_constant): Likewise.
12273 (Sized_symbol::init_undefined): Likewise.
12274 (Symbol_table::do_define_in_output_data): If the new symbol has a
12275 version, mark it as the default.
12276 (Symbol_table::do_define_in_output_segment): Likewise.
12277 (Symbol_table::do_define_as_constant): Likewise.
12278 * symtab.h (class Symbol): Update declarations.
12279 (class Sized_symbol): Likewise.
12280 * resolve.cc (Symbol::override_version): New function.
12281 (Symbol::override_base): Call override_version.
12282 (Symbol::override_base_with_special): Likewise.
12283 * testsuite/ver_script_8.script: New file.
12284 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12285 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12286 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12287 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12289 2008-05-06 Ian Lance Taylor <iant@google.com>
12292 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12294 (class General_options): Remove existing --undefined, and add
12295 --no-undefined instead. Add new --undefined as synonym for -u.
12296 * archive.cc (Archive::add_symbols): Check whether symbol was
12298 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12299 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12300 all uses. Add IS_UNDEFINED. Update declarations to split
12301 different versions of init_base. Declare init_base_undefined.
12302 (Symbol::is_defined): Handle IS_UNDEFINED.
12303 (Symbol::is_undefined): Likewise.
12304 (Symbol::is_weak_undefined): Call is_undefined.
12305 (Symbol::is_absolute): Handle IS_CONSTANT.
12306 (class Sized_symbol): Update declarations to split different
12307 versions of init. Declare init_undefined.
12308 (class Symbol_table): Declare new functions.
12309 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12310 Change all callers.
12311 (Symbol::init_base_output_data): Likewise.
12312 (Symbol::init_base_output_segment): Likewise.
12313 (Symbol::init_base_constant): Likewise.
12314 (Symbol::init_base_undefined): New function.
12315 (Sized_symbol::init_object): Rename from init. Change all
12317 (Sized_symbol::init_output_data): Likewise.
12318 (Sized_symbol::init_output_segment): Likewise.
12319 (Sized_symbol::init_constant): Likewise.
12320 (Sized_symbol::init_undefined): New function.
12321 (Symbol_table::add_undefined_symbols_from_command_line): New
12323 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12325 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12326 (Symbol::output_section): Likewise.
12327 (Symbol::set_output_section): Likewise.
12328 (Symbol_table::sized_finalize_symbol): Likewise.
12329 (Symbol_table::sized_write_globals): Likewise.
12330 * resolve.cc (Symbol_table::should_override): Likewise.
12331 (Symbol::override_base_with_special): Likewise.
12333 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12334 symbol, change it to have default visibility.
12335 * testsuite/protected_1.cc: New file.
12336 * testsuite/protected_2.cc: New file.
12337 * testsuite/protected_3.cc: New file.
12338 * testsuite/protected_main_1.cc: New file.
12339 * testsuite/protected_main_2.cc: New file.
12340 * testsuite/protected_main_3.cc: New file.
12341 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12342 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12343 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12344 (protected_1.so): New target.
12345 (protected_1_pic.o, protected_2_pic.o): New targets.
12346 (protected_3_pic.o): New target.
12347 (check_PROGRAMS): Add protected_2.
12348 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12349 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12350 * testsuite/Makefile.in: Rebuild.
12352 * options.h (DEFINE_var): Add set_user_set_##varname__.
12353 (DEFINE_bool_alias): New macro.
12354 (class General_options): Define -Bstatic using DEFINE_bool_alias
12355 rather than DEFINE_special. Add --undefined as an alias for -z
12357 * options.cc (General_options::parse_Bstatic): Remove.
12359 * options.h (class General_options): Add --fatal-warnings.
12360 * main.cc (main): Implement --fatal-warnings.
12361 * errors.h (Errors::warning_count): New function.
12363 * options.h (class General_options): Add -Bsymbolic-functions.
12364 * symtab.h (Symbol::is_preemptible): Check for
12365 -Bsymbolic-functions.
12367 2008-05-05 Ian Lance Taylor <iant@google.com>
12369 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12370 as noVARNAME rather than no-VARNAME.
12371 (class General_options): Add option -z combreloc.
12372 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12374 (Output_reloc::sort_before) [SHT_REL]: New function.
12375 (Output_reloc::sort_before) [SHT_RELA]: New function.
12376 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12377 Sort_relocs_comparison.
12378 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12379 parameter. Change all callers.
12380 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12381 sort_relocs parameter. Change all callers.
12382 * output.cc (Output_reloc::get_address): New function, broken out
12384 (Output_reloc::write_rel): Call it.
12385 (Output_reloc::compare): New function.
12386 (Output_data_reloc_base::do_write): Optionally sort relocs.
12388 * configure.ac: If targ_extra_obj is set, link it in.
12389 * configure.tgt: Initialize all variables.
12390 (x86_64*): Set targ_extra_obj and targ_extra_size.
12391 * configure: Rebuild.
12393 * object.cc (Sized_relobj::include_section_group): Adjust section
12394 indexes read from group data. Build vector to pass to
12396 * layout.cc (Layout::layout_group): Add flags and shndxes
12397 parameters. Remove contents parameter. Change caller. Update
12398 explicit instantiations.
12399 * layout.h (class Layout): Update layout_group declaration.
12400 * output.cc (Output_data_group::Output_data_group): Add flags and
12401 input_shndxes parameters. Remove contents parameter. Change
12403 (Output_data_group::do_write): Change input_sections_ to
12405 * output.h (class Output_data_group): Update constructor
12406 declaration. Rename input_sections_ to input_shndxes_.
12407 * testsuite/many_sections_test.cc: Add template.
12409 2008-04-30 Cary Coutant <ccoutant@google.com>
12411 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12413 * layout.cc (Layout::include_section): Refactored check for debug
12415 (Layout::add_comdat): Add new parameters. Change type
12416 of signature parameter. Add object and shndx to signatures table.
12417 (Layout::find_kept_object): New function.
12418 * layout.h: Include <cstring>.
12419 (Layout::is_debug_info_section): New function.
12420 (Layout::add_comdat): Add new parameters.
12421 (Layout::find_kept_object): New function.
12422 (Layout::Kept_section): New struct.
12423 (Layout::Signatures): Change type of map range.
12424 * object.cc (Relobj::output_section_address): New function.
12425 (Sized_relobj::include_section_group): Add new parameters. Change
12426 calls to Layout::add_comdat. Change to build table of kept comdat
12427 groups and table mapping discarded sections to kept sections.
12428 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12429 (Sized_relobj::do_layout): Change calls to include_section_group and
12430 include_linkonce_section.
12431 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12432 value to zero when section is discarded.
12433 (Sized_relobj::map_to_kept_section): New function.
12434 * object.h (Relobj::output_section_address): New function.
12435 (Relobj::Comdat_group): New type.
12436 (Relobj::find_comdat_group): New function.
12437 (Relobj::Comdat_group_table): New type.
12438 (Relobj::Kept_comdat_section): New type.
12439 (Relobj::Kept_comdat_section_table): New type.
12440 (Relobj::add_comdat_group): New function.
12441 (Relobj::set_kept_comdat_section): New function.
12442 (Relobj::get_kept_comdat_section): New function.
12443 (Relobj::comdat_groups_): New field.
12444 (Relobj::kept_comdat_sections_): New field.
12445 (Symbol_value::input_value): Update comment.
12446 (Sized_relobj::map_to_kept_section) New function.
12447 (Sized_relobj::include_linkonce_section): Add new parameter.
12448 * target-reloc.h (Comdat_behavior): New type.
12449 (get_comdat_behavior): New function.
12450 (relocate_section): Add code to map a discarded section to the
12451 corresponding kept section when applying a relocation.
12453 2008-04-30 Craig Silverstein <csilvers@google.com>
12455 * dwarf_reader.cc (next_generation_count): New static var.
12456 (Addr2line_cache_entry): New struct.
12457 (addr2line_cache): New static var.
12458 (Dwarf_line_info::one_addr2line): Added caching.
12459 (Dwarf_line_info::clear_addr2line_cache): New function.
12460 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12461 cache-size parameter.
12462 (Dwarf_line_info::one_addr2line_cache): New function.
12463 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12464 new cache-size argument to one_addr2line(), and clear cache.
12466 2008-04-28 Cary Coutant <ccoutant@google.com>
12468 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12469 R_386_PC8 relocations.
12471 2008-04-23 Ian Lance Taylor <iant@google.com>
12473 * object.cc (Sized_relobj::include_section_group): Check for
12474 invalid section group.
12476 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12479 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12480 than read for file header.
12481 * archive.cc (Archive::include_member): Likewise.
12483 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12485 * aclocal.m4: Regenerate.
12486 * configure: Regenerate.
12488 2008-04-19 Ian Lance Taylor <iant@google.com>
12490 * version.cc (version_string): Bump to 1.6.
12492 * testsuite/Makefile.am (many_sections_r_test): New target.
12493 (many_sections_r_test_SOURCES): Remove.
12494 (many_sections_r_test_DEPENDENCIES): Remove.
12495 (many_sections_r_test_LDFLAGS): Remove.
12496 (many_sections_r_test_LDADD): Remove.
12498 * object.cc (Sized_relobj::do_add_symbols): Always pass
12499 local_symbol_count_ to add_from_relobj.
12501 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12502 every thousand variables.
12503 * testsuite/Makefile.in: Rebuild.
12505 * object.cc (Xindex::initialize_symtab_xindex): New function.
12506 (Xindex::read_symtab_xindex): New function.
12507 (Xindex::sym_xindex_to_shndx): New function.
12508 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12510 (Sized_relobj::do_initialize_xindex): New function.
12511 (Sized_relobj::do_read_symbols): Adjust section links.
12512 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12513 parameter. Change all callers.
12514 (Sized_relobj::include_section_group): Adjust section links and
12515 symbol section indexes.
12516 (Sized_relobj::do_layout): Adjust section links.
12517 (Sized_relobj::do_count_local_symbols): Adjust section links and
12518 symbol section indexes.
12519 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12520 ordinary and special symbols.
12521 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12522 dynsym_xindex parameters. Change all callers. Adjust section
12523 links. Use SHN_XINDEX when needed.
12524 (Sized_relobj::get_symbol_location_info): Adjust section links.
12525 Don't get fooled by special symbols.
12526 * object.h (class Xindex): Define.
12527 (class Object): Add xindex_ parameter. Declare virtual functoin
12528 do_initialize_xindex.
12529 (Object::adjust_sym_shndx): New function.
12530 (Object::set_xindex): New protected function.
12531 (class Symbol_value): Add is_ordinary_shndx_ field.
12532 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12533 (Symbol_value::value): Assert ordinary section.
12534 (Symbol_value::initialize_input_to_output_map): Likewise.
12535 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12536 Change all callers.
12537 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12539 (class Sized_relobj): Update declarations.
12540 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12541 parameter. Change all callers.
12542 (Sized_relobj::adjust_shndx): New function.
12543 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12545 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12546 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12547 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12548 (Sized_dynobj::read_dynsym_section): Adjust section links.
12549 (Sized_dynobj::read_dynamic): Likewise.
12550 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12552 (Sized_dynobj::do_initialize_xindex): New function.
12553 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12554 do_initialize_xindex.
12555 (Sized_dynobj::adjust_shndx): New function.
12556 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12557 dynsym_xindex_ fields.
12558 (Layout::finalize): Add a call to set_section_indexes before
12559 creating the symtab sections.
12560 (Layout::set_section_indexes): Don't do anything if the section
12561 already has a section index.
12562 (Layout::create_symtab_sections): Add shnum parameter. Change
12563 caller. Create .symtab_shndx section if needed.
12564 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12566 (Layout::allocated_output_section_count): New function.
12567 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12569 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12570 fields. Update declarations.
12571 (Layout::symtab_xindex): New function.
12572 (Layout::dynsym_xindex): New function.
12573 (class Write_symbols_task): Add layout_ field.
12574 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12576 * output.cc (Output_section_headers::Output_section_headers): Add
12577 shstrtab_section parameter. Change all callers.
12578 (Output_section_headers::do_sized_write): Store overflow values
12579 for section count and section string table section index in
12580 section header zero.
12581 (Output_file_header::do_sized_write): Check for overflow of
12582 section count and section string table section index.
12583 (Output_symtab_xindex::do_write): New function.
12584 (Output_symtab_xindex::endian_do_write): New function.
12585 * output.h (class Output_section_headers): Add shstrtab_section_.
12586 Update declarations.
12587 (class Output_symtab_xindex): Define.
12588 (Output_section::has_out_shndx): New function.
12589 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12591 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12592 Change all callers.
12593 (Sized_symbol::init): Likewise.
12594 (Symbol::output_section): Check for ordinary symbol.
12595 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12596 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12598 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12599 Change all callers. Simplify handling of symbols from sections
12600 not included in the link.
12601 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12603 (Weak_alias_sorter::operator()): Assert that symbols are
12605 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12607 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12608 parameters. Change all callers.
12609 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12610 symbol distinction. Use SHN_XINDEX when needed.
12611 (Symbol_table::write_section_symbol): Add symtab_xindex
12612 parameter. Change all callers.
12613 (Symbol_table::sized_write_section_symbol): Likewise. Use
12614 SHN_XINDEX when needed.
12615 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12617 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12618 (Symbol::is_defined): Check is_ordinary.
12619 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12620 (Symbol::is_absolute, Symbol::is_common): Likewise.
12621 (class Sized_symbol): Update declarations.
12622 (class Symbol_table): Update declarations.
12623 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12624 parameters. Change all callers.
12625 (Sized_symbol::override): Likewise.
12626 (Symbol_table::override): Likewise.
12627 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12628 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12629 is_ordinary, and orig_st_shndx parameters. Change all callers.
12630 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12631 to be in an ordinary section.
12632 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12633 object and is_ordinary parameters. Change all callers.
12634 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12635 Change all callers. Don't add undefined or non-ordinary symbols
12637 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12638 Change all callers.
12639 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12641 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12642 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12643 (Sized_relobj::relocate_sections): Likewise.
12644 * target-reloc.h (scan_relocs): Adjust section symbol index.
12645 (scan_relocatable_relocs): Likewise.
12646 * i386.cc (Scan::local): Check for ordinary symbols.
12647 * sparc.cc (Scan::local): Likewise.
12648 * x86_64.cc (Scan::local): Likewise.
12649 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12650 to symbol_section_and_value.
12651 * testsuite/many_sections_test.cc: New file.
12652 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12653 (check_PROGRAMS): Add many_sections_test.
12654 (many_sections_test_SOURCES): Define.
12655 (many_sections_test_DEPENDENCIES): Define.
12656 (many_sections_test_LDFLAGS): Define.
12657 (BUILT_SOURCES): Add many_sections_define.h.
12658 (many_sections_define.h): New target.
12659 (BUILT_SOURCES): Add many_sections_check.h.
12660 (many_sections_check.h): New target.
12661 (check_PROGRAMS): Add many_sections_r_test.
12662 (many_sections_r_test_SOURCES): Define.
12663 (many_sections_r_test_DEPENDENCIES): Define.
12664 (many_sections_r_test_LDFLAGS): Define.
12665 (many_sections_r_test_LDADD): Define.
12666 (many_sections_r_test.o): New target.
12667 * testsuite/Makefile.in: Rebuild.
12669 2008-04-17 Cary Coutant <ccoutant@google.com>
12671 * errors.cc (Errors::info): New function.
12672 (gold_info): New function.
12673 * errors.h (Errors::info): New function.
12674 * gold.h (gold_info): New function.
12675 * object.cc (Input_objects::add_object): Print trace output.
12676 * options.cc (options::parse_set): New function.
12677 (General_options::parse_wrap): Deleted.
12678 (General_options::General_options): Deleted initializer.
12679 * options.h (options::String_set): New typedef.
12680 (options::parse_set): New function.
12681 (DEFINE_set): New macro.
12682 (General_options::wrap): Changed to use DEFINE_set. Changed
12683 callers of any_wrap_symbols and is_wrap_symbol.
12684 (General_options::trace, General_options::trace_symbol):
12686 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12687 (General_options::wrap_symbols_): Deleted.
12688 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12690 2008-04-17 David S. Miller <davem@davemloft.net>
12692 * options.cc (General_options::parse_V): New function.
12693 * options.h: Add entries for -V and -Qy.
12695 2008-04-17 Ian Lance Taylor <iant@google.com>
12697 * common.cc (Symbol_table::allocate_commons): Remove options
12698 parameter. Change caller.
12699 (Symbol_table::do_allocate_commons): Remove options parameter.
12700 Change caller. Just call do_allocate_commons_list twice.
12701 (Symbol_table::do_allocate_commons_list): New function, broken out
12702 of do_allocate_commons.
12703 * common.h (class Allocate_commons_task): Remove options_ field.
12704 Update constructor.
12705 * symtab.cc (Symbol_table::Symbol_table): Initialize
12707 (Symbol_table::add_from_object): Put TLS common symbols on
12709 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12710 which are IN_OUTPUT_DATA.
12711 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12712 allocate_commons and do_allocate_commons declarations. Declare
12713 do_allocate_commons_list.
12714 * gold.cc (queue_middle_tasks): Update creation of
12715 Allocate_commons_task to not pass options.
12716 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12717 (TLS_TEST_C_FLAGS): New variable.
12718 (tls_test_c_pic.o): New target.
12719 (tls_test_shared.so): Link in tls_test_c_pic.o.
12720 (tls_test_c_pic_ie.o): New target.
12721 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12722 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12723 (tls_test_c.o): New target.
12724 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12725 (tls_pic_test_LDADD): Likewise.
12726 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12727 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12728 (tls_test_c_gnu2.o): New target.
12729 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12731 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12732 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12733 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12734 * testsuite/tls_test.cc: Include "config.h".
12735 (t_last): Call t11_last.
12736 * testsuite/tls_test.h (t11, t11_last): Declare.
12737 * testsuite/tls_test_c.c: New file.
12738 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12739 * configure.ac: Check for OpenMP support.
12740 * configure, config.in, Makefile.in: Rebuild.
12741 * testsuite/Makefile.in: Rebuild.
12743 2008-04-16 Cary Coutant <ccoutant@google.com>
12745 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12746 (Target_i386::tls_base_symbol_defined_): New field.
12747 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12748 (Target_i386::Scan::global): Likewise.
12749 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12750 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12751 (Target_x86_64::tls_base_symbol_defined_): New field.
12752 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12753 (Target_x86_64::Scan::global): Likewise.
12755 2008-04-16 Cary Coutant <ccoutant@google.com>
12757 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12758 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12759 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12760 building shared libraries.
12761 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12762 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12763 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12764 * testsuite/Makefile.in: Rebuild.
12765 * testsuite/weak_undef.h: New file.
12766 * testsuite/weak_undef_file1.cc: Add extra test cases.
12767 * testsuite/weak_undef_file2.cc: Likewise.
12768 * testsuite/weak_undef_test.cc: Likewise.
12770 2008-04-16 David S. Miller <davem@davemloft.net>
12772 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12773 Add issued_non_pic_error_ field. Declare check_non_pic.
12774 (Target_sparc::Scan::check_non_pic): New function.
12775 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12776 (Target_sparc::Scan::global): Likewise.
12778 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12779 * configure: Rebuild.
12781 * options.h (DEFINE_enable): New macro.
12782 (new_dtags): New enable option.
12783 (initfirst, interpose, loadfltr, nodefaultlib,
12784 nodelete, nodlopen, nodump): New -z options.
12785 * layout.cc (Layout:finish_dynamic_section): If new
12786 dtags enabled, emit DT_RUNPATH. Also, emit a
12787 DT_FLAGS_1 containing any specified -z flags.
12789 2008-04-16 Ian Lance Taylor <iant@google.com>
12791 * copy-relocs.cc: New file.
12792 * copy-relocs.h: New file.
12793 * reloc.cc: Remove Copy_relocs code.
12794 * reloc.h: Likewise.
12795 * reloc-types.h (struct Reloc_types) [both versions]: Add
12796 get_reloc_addend_noerror.
12797 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12798 variants of add_global which take an addend which must be zero.
12799 * i386.cc: Include "copy-relocs.h".
12800 (class Target_i386): Change type of copy_relocs_ to variable,
12801 update initializer.
12802 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12803 Change all callers.
12804 (Target_i386::do_finalize_sections): Change handling of
12806 * sparc.cc: Include "copy-relocs.h".
12807 (class Target_sparc): Change type of copy_relocs_ to variable,
12808 update initializer.
12809 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12810 Change all callers.
12811 (Target_sparc::do_finalize_sections): Change handling of
12813 * x86_64.cc: Include "copy-relocs.h".
12814 (class Target_x86_64): Change type of copy_relocs_ to variable,
12815 update initializer.
12816 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12817 class. Change all callers.
12818 (Target_x86_64::do_finalize_sections): Change handling of
12820 * Makefile.am (CCFILES): Add copy-relocs.cc.
12821 (HFILES): Add copy-relocs.h.
12823 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12825 * testsuite/script_test_4.sh: Permit leading zeroes.
12827 2008-04-15 Ian Lance Taylor <iant@google.com>
12829 * script-sections.cc (Script_sections::create_segments): Use
12830 header_size_adjustment even when there is enough room for the
12832 * testsuite/script_test_4.sh: New file.
12833 * testsuite/script_test_4.t: New file.
12834 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12835 (check_DATA): Add script_test_4.stdout.
12836 (MOSTLYCLEANFILES): Likewise.
12837 (script_test_4): New target.
12838 (script_test_4.stdout): New target.
12839 * testsuite/Makefile.in: Rebuild.
12841 * sparc.cc: Add definitions for Output_data_plt_sparc class
12844 2008-04-14 David S. Miller <davem@davemloft.net>
12846 * sparc.cc: New file.
12847 * Makefile.am (TARGETSOURCES): Add sparc.cc
12848 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12849 * configure.tgt: Document targ_extra_size and
12850 targ_extra_big_endian. Add entries for sparc-* and
12852 * configure.ac: Handle targ_extra_size and
12853 targ_extra_big_endian.
12854 * Makefile.in: Rebuild.
12855 * configure: Likewise.
12856 * po/POTFILES.in: Likewise.
12857 * po/gold.pot: Likewise.
12859 2008-04-14 Ian Lance Taylor <iant@google.com>
12861 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12862 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12863 in the name/type/flags to section mapping. Don't call
12864 allocate_output_section.
12865 (Layout::choose_output_section): Change parameter from adjust_name
12866 to is_input_section. Don't permit input sections after sections
12867 are attached to segments. Don't call allocate_output_section.
12868 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12869 not write_enable_output_section.
12870 (Layout::make_output_section): Don't push to
12871 unattached_section_list_ nor call attach_to_segment. Call
12872 attach_section_to_segment if sections are attached.
12873 (Layout::attach_sections_to_segments): New function.
12874 (Layout::attach_section_to_segment): New function.
12875 (Layout::attach_allocated_section_to_segment): Rename from
12876 attach_to_segment. Remove flags parameter.
12877 (Layout::allocate_output_section): Remove function.
12878 (Layout::write_enable_output_section): Remove function.
12879 * layout.h (class Layout): Update for above changes. Add new
12880 field sections_are_attached_.
12881 * output.h (Output_section::update_flags_for_input_section): New
12883 * output.cc (Output_section::add_input_section): Call
12884 update_flags_for_input_section.
12885 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12887 2008-04-11 Cary Coutant <ccoutant@google.com>
12889 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12890 thought unnecessary.
12891 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12893 2008-04-11 Ian Lance Taylor <iant@google.com>
12895 * output.h (class Output_section_data): Remove inline definition
12897 * output.cc (Output_section_data::set_addralign): New function.
12899 2008-04-11 Cary Coutant <ccoutant@google.com>
12901 Add support for TLS descriptors for i386 and x86_64.
12902 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12903 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12904 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12906 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12907 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12908 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12910 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12911 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12912 Fix problem with initial-exec relocations.
12913 (Target_i386::Relocate::relocate_tls): Likewise.
12914 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12916 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12917 support for section-plus-offset dynamic table entries.
12918 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12919 (Output_data_dynamic::Dynamic_entry): Add support for
12920 section-plus-offset dynamic table entries.
12921 (Output_data_dynamic::Classification): Likewise.
12922 (Output_data_dynamic::classification_): Renamed offset_.
12923 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12924 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12925 (Target_x86_64::make_plt_section): New function.
12926 (Target_x86_64::reserve_tlsdesc_entries): New function.
12927 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12928 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12929 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12930 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12931 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12932 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12933 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12934 add extra PLT entry for TLS descriptors.
12935 (Output_data_plt_x86_64::got_): New field.
12936 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12937 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12939 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12941 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12942 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12943 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12944 R_386_TLS_DESC_CALL relocations.
12945 (Target_x86_64::Scan::global): Likewise.
12946 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12947 for TLS descriptors.
12948 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12949 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12950 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12951 GD-to-IE relaxation.
12952 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12953 and TLS_DESCRIPTORS.
12954 * Makefile.in: Rebuild.
12955 * configure: Rebuild.
12956 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12957 (tls_test_shared2.so): New target.
12958 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12959 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12960 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12961 (tls_shared_gd_to_ie_test_LDADD): New variable.
12962 (tls_shared_gnu2_gd_to_ie_test): New target.
12963 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12965 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12966 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12967 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12968 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12969 (tls_shared_gnu2_test): New target.
12970 (tls_test_gnu2_shared.so): New target.
12971 (tls_shared_gnu2_test_SOURCES): New variable.
12972 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12973 (tls_shared_gnu2_test_LDFLAGS): New variable.
12974 (tls_shared_gnu2_test_LDADD): New variable.
12975 * testsuite/Makefile.in: Rebuild.
12976 * testsuite/Makefile.
12978 2008-04-11 Ian Lance Taylor <iant@google.com>
12980 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12982 * testsuite/Makefile.in: Rebuild.
12984 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12986 * testsuite/script_test_2.cc (main): Adjust test.
12988 2008-04-11 David S. Miller <davem@davemloft.net>
12989 Ian Lance Taylor <iant@google.com>
12991 * options.h (General_options): Add entries for '-Y' and
12993 * options.cc (General_options:finalize): If -Y was used, add those
12994 entries to the library path instead of the default "/lib" and
12997 2008-04-11 David S. Miller <davem@davemloft.net>
12999 * testsuite/justsyms.t: Start at 0x100.
13000 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13001 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13003 * testsuite/script_test_2.cc: Adjust string and section length
13006 2008-04-09 Ian Lance Taylor <iant@google.com>
13009 * script-sections.cc (Sections_element::allocate_to_segment): Add
13011 (Output_section_definition::allocate_to_segment): Likewise.
13012 (Orphan_output_section::allocate_to_segment): Likewise.
13013 (Script_sections::attach_sections_using_phdrs_clause): Don't
13014 propagate non-PT_LOAD segments to orphan sections.
13015 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13016 readelf rather than objdump.
13017 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13018 .interp section and PT_INTERP segment are the same size.
13019 * testsuite/Makefile.in: Rebuild.
13021 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13022 aliases for symbols defined in the same object.
13023 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13024 (weak_alias_test_SOURCES): New variable.
13025 (weak_alias_test_DEPENDENCIES): New variable.
13026 (weak_alias_test_LDFLAGS): New variable.
13027 (weak_alias_test_LDADD): New variable.
13028 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13029 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13030 (weak_alias_test_3.o): New target.
13031 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13032 * testsuite/weak_alias_test_main.cc: New file.
13033 * testsuite/weak_alias_test_1.cc: New file.
13034 * testsuite/weak_alias_test_2.cc: New file.
13035 * testsuite/weak_alias_test_3.cc: New file.
13037 2008-04-08 Ian Lance Taylor <iant@google.com>
13039 * options.h (class General_options): Add --noinhibit-exec option.
13040 * main.cc (main): Check --noinhibit-exec.
13042 * options.h (class General_options): Define --wrap as a special
13043 option. Add wrap_symbols_ field.
13044 (General_options::any_wrap_symbols): New function.
13045 (General_options::is_wrap_symbol): New function.
13046 * options.cc (General_options::parse_wrap): New function.
13047 (General_options::General_options): Initialize wrap_symbols_.
13048 * symtab.cc (Symbol_table::wrap_symbol): New function.
13049 (Symbol_table::add_from_object): Handle --wrap.
13050 * symtab.h (class Symbol_table): Declare wrap_symbol.
13051 * target.h (Target::wrap_char): New function.
13052 (Target::Target_info): Add wrap_char field.
13053 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13054 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13055 * testsuite/testfile.cc (Target_test::test_target_info):
13058 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13061 * layout.h (class Layout): Add added_eh_frame_data_ field.
13062 * layout.cc (Layout::Layout): Initialize new field.
13063 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13064 output section until we find a section we merged successfully.
13065 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13066 that the size be non-zero.
13068 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13071 2008-04-08 Craig Silverstein <csilvers@google.com>
13073 * configure.ac: Export new conditional variable HAVE_ZLIB.
13074 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13076 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13077 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13079 2008-04-07 Ian Lance Taylor <iant@google.com>
13081 * version.cc (version_string): Set to "1.5".
13083 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13084 Add issued_non_pic_error_ field. Declare check_non_pic.
13085 (Target_x86_64::Scan::check_non_pic): New function.
13086 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13087 (Target_x86_64::Scan::global): Likewise.
13089 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13090 addend parameter. Change caller. Handle merge sections.
13091 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13092 Address to Addend. Don't add in the result of
13093 local_section_offset, pass down the addend and use the returned
13095 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13096 Update declarations of local_section_offset and symbol_value.
13097 * testsuite/two_file_test_1.cc (t18): New function.
13098 * testsuite/two_file_test_2.cc (f18): New function.
13099 * testsuite/two_file_test_main.cc (main): Call t18.
13100 * testsuite/two_file_test.h (t18, f18): Declare.
13102 * configure.ac: Don't test for objdump, c++filt, or readelf.
13103 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13105 (TEST_READELF): New variable.
13106 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13107 (check_PROGRAMS): Add two_file_strip_test.
13108 (two_file_strip_test): New target.
13109 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13110 (two_file_same_shared_strip_test_SOURCES): New variable.
13111 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13112 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13113 (two_file_same_shared_strip_test_LDADD): New variable.
13114 (two_file_shared_strip.so): New target.
13115 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13116 (ver_test_5.syms, ver_test_7.syms): Likewise.
13117 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13118 (strip_test_3.stdout): Use TEST_OBJDUMP.
13119 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13121 2008-04-04 Cary Coutant <ccoutant@google.com>
13123 * symtab.h (Symbol::is_weak_undefined): New function.
13124 (Symbol::is_strong_undefined): New function.
13125 (Symbol::is_absolute): New function.
13126 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13127 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13129 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13130 (weak_undef_test): New target.
13131 * testsuite/Makefile.in: Rebuild.
13132 * testsuite/weak_undef_file1.cc: New file.
13133 * testsuite/weak_undef_file2.cc: New file.
13134 * testsuite/weak_undef_test.cc: New file.
13136 2008-04-03 Craig Silverstein <csilvers@google.com>
13138 * compressed_output.h (class Output_compressed_section): Use
13140 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13142 (zlib_compressed_suffix): Removed.
13143 (Output_compressed_section::set_final_data_size): Use unsigned
13145 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13146 Fix linker invocation.
13147 (flagstest_o_specialfile_and_compress_debug_sections):
13149 * testsuite/Makefile.in: Regenerated.
13151 2008-04-02 David S. Miller <davem@davemloft.net>
13153 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13154 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13156 2008-04-02 Craig Silverstein <csilvers@google.com>
13160 2008-04-02 Ian Lance Taylor <iant@google.com>
13162 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13163 parameters. Update for new key type to views_. Change all
13165 (File_read::read): Adjust for byteshift in returned view.
13166 (File_read::add_view): New function, broken out of
13167 find_and_make_view.
13168 (File_read::make_view): New function, broken out of
13169 find_and_make_view.
13170 (File_read::find_or_make_view): Add offset and aligned
13171 parameters. Rewrite accordingly. Change all callers.
13172 (File_read::get_view): Add offset and aligned parameters. Adjust
13173 for byteshift in return value.
13174 (File_read::get_lasting_view): Likewise.
13175 * fileread.h (class File_read): Update declarations.
13176 (class File_read::View): Add byteshift_ field. Add byteshift to
13177 constructor. Add byteshift method.
13178 * archive.h (Archive::clear_uncached_views): New function.
13179 (Archive::get_view): Add aligned parameter. Change all callers.
13180 * object.h (Object::get_view): Add aligned parameter. Change all
13182 (Object::get_lasting_view): Likewise.
13184 * fileread.cc (File_read::release): Don't call clear_views if
13185 there are multiple objects.
13186 * fileread.h (File_read::clear_uncached_views): New function.
13187 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13190 2008-03-31 Cary Coutant <ccoutant@google.com>
13192 Add thin archive support.
13193 * archive.cc (Archive::armagt): New const.
13194 (Archive::setup): Remove task parameter and calls to unlock.
13195 (Archive::unlock_nested_archives): New function.
13196 (Archive::read_header): Add nested_off parameter. Change
13198 (Archive::interpret_header): Likewise.
13199 (Archive::include_all_members): Change to handle thin
13201 (Archive::include_member): Likewise.
13202 * archive.h (Archive::Archive): Add new parameters and
13204 (Archive::armagt): New const.
13205 (Archive::setup): Remove task parameter.
13206 (Archive::unlock_nested_archives): New function.
13207 (Archive::read_header): Add nested_off parameter.
13208 (Archive::interpret_header): Likewise.
13209 (Archive::Nested_archive_table): New typedef.
13210 (Archive::is_thin_archive_): New field.
13211 (Archive::nested_archives_): New field.
13212 (Archive::options_): New field.
13213 (Archive::dirpath_): New field.
13214 (Archive::task_): New field.
13215 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13216 for thin archives. Pass additional parameters to
13217 Archive::Archive. Unlock the archive file after calling
13220 2008-03-29 Ian Lance Taylor <iant@google.com>
13222 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13223 version symbol to be local.
13224 * testsuite/ver_test_4.sh: New file.
13225 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13226 (check_DATA): Add ver_test_4.syms.
13227 (ver_test_4.syms): New target.
13228 * testsuite/Makefile.in: Rebuild.
13231 (Output_section::Input_section_sort_entry::has_priority): New
13233 (Output_section::Input_section_sort_entry::match_file_name): New
13235 (Output_section::Input_section_sort_entry::match_section_name):
13237 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13239 (Output_section::Input_section_sort_entry::match_section_file):
13241 (Output_section::Input_section_sort_compare::operator()): Rewrite
13242 using new Input_section_sort_entry functions. Sort crtbegin and
13243 crtend first. Sort sections with no priority before sections with
13245 * testsuite/initpri1.c (d3): Check j != 4.
13246 (cd5): New constructor/destructor function.
13247 (main): Check j != 2.
13249 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13250 new symbol when resolving, don't call set_is_default.
13251 * testsuite/ver_test_7.cc: New file.
13252 * testsuite/ver_test_7.sh: New file.
13253 * testsuite/Makefile.am (ver_test_7.so): New target.
13254 (ver_test_7.o): New target.
13255 (check_SCRIPTS): Add ver_test_7.sh.
13256 (check_DATA): Add ver_test_7.syms.
13257 (ver_test_7.syms): New target.
13259 2008-03-28 Ian Lance Taylor <iant@google.com>
13261 * layout.cc (Layout::layout): If we see an input section with a
13262 name that needs sorting, set the must_sort flag for the output
13264 (Layout::make_output_section): If the name of the output section
13265 indicates that it might require sorting, set the may_sort flag.
13266 * output.h (Output_section::may_sort_attached_input_sections): New
13268 (Output_section::set_may_sort_attached_input_sections): New
13270 (Output_section::must_sort_attached_input_sections): New
13272 (Output_section::set_must_sort_attached_input_sections): New
13274 (class Output_section): Declare Input_section_sort_entry. Define
13275 Input_section_sort_compare. Declare
13276 sort_attached_input_sections. Add new fields:
13277 may_sort_attached_input_sections_,
13278 must_sort_attached_input_sections_,
13279 attached_input_sections_are_sorted_.
13280 * output.cc (Output_section::Output_section): Initialize new
13282 (Output_section::add_input_section): Add an entry to
13283 input_sections_ if may_sort or must_sort are true.
13284 (Output_section::set_final_data_size): Call
13285 sort_attached_input_sections if necessary.
13286 (Output_section::Input_section_sort_entry): Define new class.
13287 (Output_section::Input_section_sort_compare::operator()): New
13289 (Output_section::sort_attached_input_sections): New function.
13290 * configure.ac: Check whether the compiler supports constructor
13291 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13292 * testsuite/initpri1.c: New file.
13293 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13294 CONSTRUCTOR_PRIORITY.
13295 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13296 (initpri1_LDFLAGS): New variable.
13297 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13299 2008-03-27 Ian Lance Taylor <iant@google.com>
13301 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13302 * testsuite/common_test_1.c: New file.
13303 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13304 (common_test_1_SOURCES): New variable.
13305 (common_test_1_DEPENDENCIES): New variable.
13306 (common_test_1_LDFLAGS): New variable.
13308 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13309 and commons_ correctly when NAME/VERSION does not override
13311 * testsuite/ver_test_6.c: New file.
13312 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13313 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13314 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13316 2008-03-26 Ian Lance Taylor <iant@google.com>
13318 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13319 of an undefined symbol from a version script.
13320 * testsuite/Makefile.am (ver_test_5.so): New target.
13321 (ver_test_5.o): New target.
13322 (check_SCRIPTS): Add ver_test_5.sh.
13323 (check_DATA): Add ver_test_5.syms.
13324 (ver_test_5.syms): New target.
13325 * testsuite/ver_test_5.cc: New file.
13326 * testsuite/ver_test_5.script: New file.
13327 * testsuite/ver_test_5.sh: New file.
13328 * Makefile.in, testsuite/Makefile.in: Rebuild.
13331 Fix problems building gold with gcc 4.3.0.
13332 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13333 (gold_error_at_location, gold_warning_at_location): Use it.
13334 * configure.ac: Check whether we can compile and use a template
13335 function with a printf attribute.
13336 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13337 when jumping over bytes.
13338 * object.cc: Instantiate Object::read_section_data.
13339 * debug.h: Include <cstring>
13340 * dwarf_reader.cc: Include <algorithm>
13341 * main.cc: Include <cstring>.
13342 * options.cc: Include <cstring>.
13343 * output.cc: Include <cstring>.
13344 * script.cc: Include <cstring>.
13345 * script.h: Include <string>.
13346 * symtab.cc: Include <cstring> and <algorithm>.
13347 * target-select.cc: Include <cstring>.
13348 * version.cc: Include <string>.
13349 * testsuite/testmain.cc: Include <cstdlib>.
13350 * configure, config.in: Rebuild.
13352 2008-03-25 Ian Lance Taylor <iant@google.com>
13354 * options.cc: Include "../bfd/bfdver.h".
13355 (options::help): Print bug reporting address.
13357 * version.cc (print_version): Adjust output for current value of
13358 BFD_VERSION_STRING.
13362 * options.cc (options::help): Print list of supported targets.
13363 * target-select.h: Include <vector>.
13364 (class Target_selector): Make machine_, size_, and is_big_endian_
13365 fields const. Add bfd_name_ and instantiated_target_ fields.
13366 (Target_selector::Target_selector): Add bfd_name parameter.
13367 (Target_selector::recognize): Make non-virtual, call
13369 (Target_selector::recognize_by_name): Make non-virtual, call
13370 do_recognize_by_name.
13371 (Target_selector::supported_names): New function.
13372 (Target_selector::bfd_name): New function.
13373 (Target_selector::do_instantiate_target): New pure virtual
13375 (Target_selector::do_recognize): New virtual function.
13376 (Target_selector::do_recognize_by_name): New virtual function.
13377 (Target_selector::instantiate_target): New private function.
13378 (supported_target_names): Declare.
13379 * target-select.cc (Target_selector::Target_selector): Update for
13380 new parameter and fields.
13381 (select_target_by_name): Check that the name matches before
13382 calling recognize_by_name.
13383 (supported_target_names): New function.
13384 * i386.cc (class Target_selector_i386): Update Target_selector
13385 constructor call. Remove recognize and recognize_by_name. Add
13386 do_instantiate_target.
13387 * x86_64.cc (class Target_selector_x86_64): Likewise.
13388 * testsuite/testfile.cc (class Target_selector_test): Update for
13389 changes to Target_selector.
13391 * README: Rewrite, with some notes on unsupported features.
13393 2008-03-24 Cary Coutant <ccoutant@google.com>
13395 * i386.cc (Target_i386::Got_type): New enum declaration.
13396 (Target_i386::Scan::local): Updated callers of Output_data_got
13398 (Target_i386::Scan::global): Likewise.
13399 (Target_i386::Relocate::relocate): Likewise.
13400 (Target_i386::Relocate::relocate_tls): Likewise.
13401 * object.h (Got_offset_list): New class.
13402 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13403 (Sized_relobj::local_got_offset): Likewise.
13404 (Sized_relobj::set_local_got_offset): Likewise.
13405 (Sized_relobj::local_has_tls_got_offset): Removed.
13406 (Sized_relobj::local_tls_got_offset): Removed.
13407 (Sized_relobj::set_local_tls_got_offset): Removed.
13408 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13409 * output.cc (Output_data_got::add_global): Added got_type parameter.
13410 (Output_data_got::add_global_with_rel): Likewise.
13411 (Output_data_got::add_global_with_rela): Likewise.
13412 (Output_data_got::add_global_pair_with_rel): New function.
13413 (Output_data_got::add_global_pair_with_rela): New function.
13414 (Output_data_got::add_local): Added got_type parameter.
13415 (Output_data_got::add_local_with_rel): Likewise.
13416 (Output_data_got::add_local_with_rela): Likewise.
13417 (Output_data_got::add_local_pair_with_rel): New function.
13418 (Output_data_got::add_local_pair_with_rela): New function.
13419 (Output_data_got::add_global_tls): Removed.
13420 (Output_data_got::add_global_tls_with_rel): Removed.
13421 (Output_data_got::add_global_tls_with_rela): Removed.
13422 (Output_data_got::add_local_tls): Removed.
13423 (Output_data_got::add_local_tls_with_rel): Removed.
13424 (Output_data_got::add_local_tls_with_rela): Removed.
13425 * output.h (Output_data_got::add_global): Added got_type parameter.
13426 (Output_data_got::add_global_with_rel): Likewise.
13427 (Output_data_got::add_global_with_rela): Likewise.
13428 (Output_data_got::add_global_pair_with_rel): New function.
13429 (Output_data_got::add_global_pair_with_rela): New function.
13430 (Output_data_got::add_local): Added got_type parameter.
13431 (Output_data_got::add_local_with_rel): Likewise.
13432 (Output_data_got::add_local_with_rela): Likewise.
13433 (Output_data_got::add_local_pair_with_rel): New function.
13434 (Output_data_got::add_local_pair_with_rela): New function.
13435 (Output_data_got::add_global_tls): Removed.
13436 (Output_data_got::add_global_tls_with_rel): Removed.
13437 (Output_data_got::add_global_tls_with_rela): Removed.
13438 (Output_data_got::add_local_tls): Removed.
13439 (Output_data_got::add_local_tls_with_rel): Removed.
13440 (Output_data_got::add_local_tls_with_rela): Removed.
13441 * resolve.cc (Symbol::override_base_with_special): Removed
13442 reference to has_got_offset_ field.
13443 * symtab.cc (Symbol::init_fields): Replaced initialization
13444 of got_offset_ with got_offsets_. Removed initialization
13446 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13447 (Symbol::got_offset): Likewise.
13448 (Symbol::set_got_offset): Likewise.
13449 (Symbol::has_tls_got_offset): Removed.
13450 (Symbol::tls_got_offset): Removed.
13451 (Symbol::set_tls_got_offset): Removed.
13452 (Symbol::got_offset_): Removed.
13453 (Symbol::tls_mod_got_offset_): Removed.
13454 (Symbol::tls_pair_got_offset_): Removed.
13455 (Symbol::got_offsets_): New field.
13456 (Symbol::has_got_offset): Removed.
13457 (Symbol::has_tls_mod_got_offset): Removed.
13458 (Symbol::has_tls_pair_got_offset): Removed.
13459 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13460 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13462 (Target_x86_64::Scan::global): Likewise.
13463 (Target_x86_64::Relocate::relocate): Likewise.
13464 (Target_x86_64::Relocate::relocate_tls): Likewise.
13466 2008-03-25 Ben Elliston <bje@au.ibm.com>
13468 * yyscript.y: Fix spelling error in comment.
13470 2008-03-24 Ian Lance Taylor <iant@google.com>
13472 * options.h (class General_options): Define build_id option.
13473 * layout.h (class Layout): Declare write_build_id, create_note,
13474 create_build_id. Add build_id_note_ member.
13475 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13476 "libiberty.h", "md5.h", "sha1.h".
13477 (Layout::Layout): Initialize eh_frame_data_,
13478 eh_frame_hdr_section_, and build_id_note_.
13479 (Layout::finalize): Call create_build_id.
13480 (Layout::create_note): New function, broken out of
13481 Layout::create_gold_note.
13482 (Layout::create_gold_note): Call create_note.
13483 (Layout::create_build_id): New function.
13484 (Layout::write_build_id): New function.
13485 (Close_task_runner::run): Call write_build_id.
13487 * x86_64.cc: Correct license to GPLv3.
13489 2008-03-23 Ian Lance Taylor <iant@google.com>
13491 * options.cc: Include "demangle.h".
13492 (parse_optional_string): New function.
13493 (parse_long_option): Handle takes_optional_argument.
13494 (parse_short_option): Update dash_z initializer. Handle
13495 takes_optional_argument.
13496 (General_options::General_options): Initialize do_demangle_.
13497 (General_options::finalize): Set do_demangle_. Handle demangling
13499 * options.h (parse_optional_string): Declare.
13500 (struct One_option): Add optional_arg field. Update constructor.
13501 Update call constructor calls. Add takes_optional_argument
13503 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13504 (DEFINE_optional_string): Define.
13505 (General_options::demangle): Change from DEFINE_bool to
13506 DEFINE_optional_string.
13507 (General_options::no_demangle): New function.
13508 (General_options::do_demangle): New function.
13509 (General_options::set_do_demangle): New function.
13510 (General_options::execstack_status_): Move definition to end of
13512 (General_options::static_): Likewise.
13513 (General_options::do_demangle_): New field.
13514 * object.cc (big_endian>::get_symbol_location_info): Call
13515 Options::do_demangle, not Options::demangle.
13516 * symtab.cc (demangle): Likewise.
13518 2008-03-22 Ian Lance Taylor <iant@google.com>
13520 * gold.h: Include <cstddef> and <sys/types.h>
13521 * options.h: Include <cstring>.
13523 2008-03-21 Ian Lance Taylor <iant@google.com>
13525 * Added source code to GNU binutils.