1 2012-08-30 Alan Modra <amodra@gmail.com>
3 * layout.cc (Layout::set_segment_offsets): Set p_align to
4 abi_pagesize, not common_pagesize.
5 (Layout::relaxation_loop_body): Similarly use abi_pagesize
6 to determine whether file header can go in segment.
8 2012-08-30 Alan Modra <amodra@gmail.com>
10 * output.h (Output_reloc::Output_reloc <output section>): Add
11 is_relative param. Adjust calls.
12 (Output_reloc::add_output_section_relative): New functions.
13 * output.cc (Output_reloc::Output_reloc <output section>): Handle
15 (Output_reloc::symbol_value): Handle SECTION_CODE.
17 2012-08-24 Sriraman Tallam <tmsriram@google.com>
19 * gold.cc (queue_middle_tasks): Call layout again when unique
20 segments for sections is desired.
21 * layout.cc (Layout::Layout): Initialize new members.
22 (Layout::get_output_section_flags): New function.
23 (Layout::choose_output_section): Call get_output_section_flags.
24 (Layout::layout): Make output section for mapping to a unique segment.
25 (Layout::insert_section_segment_map): New function.
26 (Layout::attach_allocated_section_to_segment): Make unique segment for
27 output sections marked so.
28 (Layout::segment_precedes): Check for unique segments when sorting.
29 * layout.h (Layout::Unique_segment_info): New struct.
30 (Layout::Section_segment_map): New typedef.
31 (Layout::insert_section_segment_map): New function.
32 (Layout::get_output_section_flags): New function.
33 (Layout::is_unique_segment_for_sections_specified): New function.
34 (Layout::set_unique_segment_for_sections_specified): New function.
35 (Layout::unique_segment_for_sections_specified_): New member.
36 (Layout::section_segment_map_): New member.
37 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
38 Rename is_gc_pass_one to is_pass_one.
39 Rename is_gc_pass_two to is_pass_two.
40 Rename is_gc_or_icf to is_two_pass.
41 Check for which pass based on whether symbols data is present.
42 Make it two pass when unique segments for sections is desired.
43 * output.cc (Output_section::Output_section): Initialize new
45 * output.h (Output_section::is_unique_segment): New function.
46 (Output_section::set_is_unique_segment): New function.
47 (Output_section::is_unique_segment_): New member.
48 (Output_section::extra_segment_flags): New function.
49 (Output_section::set_extra_segment_flags): New function.
50 (Output_section::extra_segment_flags_): New member.
51 (Output_section::segment_alignment): New function.
52 (Output_section::set_segment_alignment): New function.
53 (Output_section::segment_alignment_): New member.
54 (Output_segment::Output_segment): Initialize is_unique_segment_.
55 (Output_segment::is_unique_segment): New function.
56 (Output_segment::set_is_unique_segment): New function.
57 (Output_segment::is_unique_segment_): New member.
58 * plugin.cc (allow_unique_segment_for_sections): New function.
59 (unique_segment_for_sections): New function.
60 (Plugin::load): Add new functions to transfer vector.
61 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
62 * Makefile.in: Regenerate.
63 * testsuite/plugin_final_layout.sh: Check if unique segment
65 * testsuite/plugin_section_order.c (onload): Check if new interfaces
67 (allow_unique_segment_for_sections): New global.
68 (unique_segment_for_sections): New global.
69 (claim_file_hook): Call allow_unique_segment_for_sections.
70 (all_symbols_read_hook): Call unique_segment_for_sections.
72 2012-08-22 Cary Coutant <ccoutant@google.com>
74 * layout.cc (Layout::include_section): Don't assert on GROUP
75 sections with --emit-relocs.
77 2012-08-21 Cary Coutant <ccoutant@google.com>
79 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
80 if --export-dynamic-symbol names an undef symbol.
82 2012-08-18 Alan Modra <amodra@gmail.com>
84 * powerpc.cc: Formatting and white space.
85 (Powerpc_relobj): Rename got2_section_ to special_.
86 Add opd_ent_shndx_ and opd_ent_off_ vectors.
87 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
88 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
89 (Target_powerpc): Add Address typedef and invalid_address. Use
91 (Target_powerpc::is_branch_reloc): New function.
92 (Powerpc_relocate_functions): Add Address typedef, use throughout.
93 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
94 for dst_mask, value and addend.
95 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
96 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
97 (Output_data_glink::do_write): Correct toc base. Don't try to use
98 uint16_t for 24-bit offset. Use get_output_section_offset and
100 (Target_powerpc::Scan::local): Handle more relocs.
101 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
102 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
103 Plug in toc restoring insn after plt calls. Translate branches
104 to function descriptor symbols to corresponding entry point.
105 (Target_powerpc::relocate_for_relocatable): Check return from
106 get_output_section_offset.
107 * symtab.h: Comment typo.
109 2012-08-14 Ian Lance Taylor <iant@google.com>
111 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
112 unsupported_relocal_local to call unsupported_reloc_global.
114 2012-08-14 Nick Clifton <nickc@redhat.com>
117 * script-sections.cc (Sections_element::output_section_name): Add
118 keep return parameter.
119 (Output_section_element::match_name): Add keep return parameter.
120 Return the value of the keep_ member.
121 * script-sections.h (class Output_section): Update
122 output_section_name prototype.
123 * layout.cc (Layout::keep_input_section): New public member
125 (Layout::choose_output_section): Pass keep parameter to
127 * layout.h (class Layout): Add keep_input_section.
128 * object.cc (Sized_relobj_file::do_layout): Check for kept input
130 * testsuite/Makefile.am: Add a test.
131 * testsuite/Makefile.in: Regenerate.
132 * testsuite/pr14265.c: Source file for the test.
133 * testsuite/pr14265.t: Linker script for the test.
134 * testsuite/pr14265.sh: Shell script for the test.
136 2012-08-14 Alan Modra <amodra@gmail.com>
138 * target.h (Target::output_section_name): New function.
139 (Target::do_output_section_name): New function.
140 * layout.cc (Layout::choose_output_section): Call the above.
141 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
143 2012-08-14 Alan Modra <amodra@gmail.com>
145 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
146 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
147 for replace_constant call.
148 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
149 (Output_data_glink::do_print_to_mapfile): New function.
150 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
151 (Target_powerpc::Relocate::relocate): Likewise.
153 2012-08-14 Alan Modra <amodra@gmail.com>
155 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
156 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
157 (Output_data_glink::add_entry,find_entry): Remove shndx param.
158 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
159 all references to shndx_. Handle special case for R_PPC_PLTREL24
161 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
162 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
163 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
165 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
166 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
168 2012-08-12 Alan Modra <amodra@gmail.com>
170 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
171 (glink insn constants): Use uint32_t.
172 (Output_data_glink::add_entry): Use insert, not [] operator.
174 2012-08-11 Alan Modra <amodra@gmail.com>
176 * object.h (Sized_relobj_file::find_shdr): New function.
177 (Sized_relobj_file::find_special_sections): New function.
178 * object.cc (Sized_relobj_file::find_shdr): New function.
179 (Sized_relobj_file::find_eh_frame): Use find_shdr.
180 (Sized_relobj_file::find_special_sections): New function, split out..
181 (Sized_relobj_file::do_read_symbols): ..from here.
182 * output.h (Output_data_got::replace_constant): New function.
183 (Output_data_got::num_entries): New function.
184 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
185 (Output_data_got::got_offset): Protected rather than private.
186 (Output_data_got::replace_got_entry): New function.
187 * output.cc (Output_data_got::replace_got_entry): New function.
188 * powerpc.cc (class Powerpc_relobj): New.
189 (class Powerpc_relocate_functions): Delete all psymval variants or
190 convert to value,addend type. Delete pcrela, pcrela_unaligned.
191 Implement _ha functions using corresponding _hi function.
192 (Powerpc_relobj::find_special_sections): New function.
193 (Target_powerpc::do_make_elf_object): New function.
194 (class Output_data_got_powerpc): New.
195 (class Output_data_glink): New.
196 (class Powerpc_scan_relocatable_reloc): New.
197 Many more changes througout file.
199 2012-08-09 Nick Clifton <nickc@redhat.com>
201 * po/vi.po: Updated Vietnamese translation.
203 2012-08-07 Ian Lance Taylor <iant@google.com>
205 * layout.cc (Layout::add_target_dynamic_tags): If
206 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
209 2012-07-30 Nick Clifton <nickc@redhat.com>
211 * po/gold.pot: Updated template.
212 * po/es.po: Updated Spanish translation.
214 2012-07-18 Cary Coutant <ccoutant@google.com>
217 * configure.ac: Add check for -gpubnames support.
218 * configure: Regenerate.
219 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
220 support; force -gno-pubnames.
221 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
223 (gdb_index_test_4): New test.
224 * testsuite/Makefile.in: Regenerate.
225 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
226 * testsuite/gdb_index_test_2.sh: Likewise.
227 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
228 * testsuite/gdb_index_test_4.sh: New script.
229 * testsuite/gdb_index_test_comm.sh: New script with common code;
230 don't look for space after colon.
232 2012-07-16 Sriraman Tallam <tmsriram@google.com>
234 * gold.cc (queue_middle_tasks): Update function order only after
235 deferred objects due to plugins are processed.
237 2012-07-11 Ian Lance Taylor <iant@google.com>
239 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
240 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
241 (Target_arm::scan_reloc_for_stub): Likewise.
242 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
243 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
244 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
245 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
246 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
248 2012-07-10 Dodji Seketeli <dodji@redhat.com>
249 Ian Lance Taylor <iant@google.com>
252 * configure.ac: Test whether std::tr1::hash<off_t> works.
253 * gold.h: Add a specialization for std::tr1::hash<off_t> if
255 * output.h (class Output_fill): Add virtual destructor.
256 * configure, config.in: Rebuild.
258 2012-06-22 Roland McGrath <mcgrathr@google.com>
260 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
262 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
264 * plugin.cc (Plugin::load): Handle position independent executables.
266 2012-06-06 Cary Coutant <ccoutant@google.com>
268 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
270 (lines_only_debug_sections): Likewise.
271 (gdb_fast_lookup_sections): New static array.
272 (is_gdb_debug_section): Rename formal parameter.
273 (is_lines_only_debug_section): Likewise.
274 (is_gdb_fast_lookup_section): New function.
275 (Layout::include_section): Check for ".zdebug_" prefix; pass
276 section name suffix to is_gdb_debug_section, et al.; check for
277 fast-lookup sections when building .gdb_index.
278 * options.h (--strip-debug-gdb): Update GDB version number.
280 2012-06-06 Cary Coutant <ccoutant@google.com>
282 * configure.ac: Add check for fallocate.
283 * configure: Regenerate.
284 * config.in: Regenerate.
286 * options.h (class General_options): Add --mmap-output-file and
287 --posix-fallocate options.
288 * output.cc: (posix_fallocate): Remove; replace with...
289 (gold_fallocate): New function.
290 (Output_file::map_no_anonymous): Call gold_fallocate.
291 (Output_file::map): Check --mmap-output-file option.
293 2012-06-05 Jing Yu <jingyu@google.com>
295 * gold.h (textdomain): Add do {} to empty while(0).
296 (bindtextdomain): Likewise.
298 2012-06-04 Cary Coutant <ccoutant@google.com>
300 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
303 2012-05-25 Sriraman Tallam <tmsriram@google.com>
305 * symtab.cc (Symbol_table::define_special_symbol):
306 Initialize *poldsym to prevent uninitialized variable errors.
308 2012-05-23 Cary Coutant <ccoutant@google.com>
310 * layout.cc (Layout::section_name_mapping): Add rules to handle
311 exact match on .data.rel.ro.local or .data.rel.ro.
312 (Layout::output_section_name): Check for exact matches.
314 2012-05-23 Cary Coutant <ccoutant@google.com>
316 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
319 2012-05-22 Cary Coutant <ccoutant@google.com>
321 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
322 object before exporting symbol.
324 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
326 * testsuite/tls_test.cc: Include "config.h" first.
327 * testsuite/tls_test_c.c: Likewise.
329 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
330 Nick Clifton <nickc@redhat.com>
333 * configure.in: Add check that sysdep.h has been included before
334 any system header files.
335 * configure: Regenerate.
336 * config.in: Regenerate.
338 2012-05-14 Cary Coutant <ccoutant@google.com>
340 * layout.cc (Layout::make_output_section): Mark .tdata section
342 * testsuite/relro_test.cc: Add a TLS variable.
344 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
347 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
348 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
351 2012-05-08 Cary Coutant <ccoutant@google.com>
353 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
354 (lines_only_debug_sections): Likewise.
356 2012-05-02 Roland McGrath <mcgrathr@google.com>
360 * Makefile.am (CCFILES, HFILES): Add them.
361 * Makefile.in: Regenerate.
362 * i386.cc (Output_data_plt_i386_nacl): New class.
363 (Output_data_plt_i386_nacl_exec): New class.
364 (Output_data_plt_i386_nacl_dyn): New class.
365 (Target_i386_nacl): New class.
366 (Target_selector_i386_nacl): New class.
367 (target_selector_i386): Use it instead of Target_selector_i386.
368 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
369 (Target_x86_64_nacl): New class.
370 (Target_selector_x86_64_nacl): New class.
371 (target_selector_x86_64, target_selector_x32): Use it instead of
372 Target_selector_x86_64.
373 * arm.cc (Output_data_plt_arm_nacl): New class.
374 (Target_arm_nacl): New class.
375 (Target_selector_arm_nacl): New class.
376 (target_selector_arm, target_selector_armbe): Use it instead of
379 * target-select.cc (select_target): Take new Input_file* and off_t
380 arguments, pass them on to recognize method of selector.
381 * object.cc (make_elf_sized_object): Update caller.
382 * parameters.cc (parameters_force_valid_target): Likewise.
383 * incremental.cc (make_sized_incremental_binary): Likewise.
384 * target-select.h: Update decl.
385 (Target_selector::recognize): Take new Input_file* argument,
386 pass it on to do_recognize.
387 (Target_selector::do_recognize): Take new Input_file* argument.
388 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
389 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
390 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
391 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
393 * target.h (Target::Target_info): New members isolate_execinstr
395 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
396 * arm.cc (Target_arm::arm_info): Update initializer.
397 * i386.cc (Target_i386::i386_info): Likewise.
398 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
399 * sparc.cc (Target_sparc::sparc_info): Likewise.
400 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
401 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
402 * layout.cc (Layout::attach_allocated_section_to_segment):
403 Take new const Target* argument. If target->isolate_execinstr(), act
405 (Layout::find_first_load_seg): Take new const Target* argument;
406 if target->isolate_execinstr(), reject PF_X segments.
407 (Layout::relaxation_loop_body): Update caller.
408 (Layout::set_segment_offsets): If target->isolate_execinstr(),
409 reset file offset to zero when we hit LOAD_SEG, and then do a second
410 loop over the segments before LOAD_SEG to reassign offsets after
411 addresses have been determined. Handle target->rosegment_gap().
412 (Layout::attach_section_to_segment): Take new const Target* argument;
413 pass it to attach_allocated_section_to_segment.
414 (Layout::make_output_section): Update caller.
415 (Layout::attach_sections_to_segments): Take new const Target* argument;
416 pass it to attach_section_to_segment.
417 * gold.cc (queue_middle_tasks): Update caller.
418 * layout.h (Layout): Update method decls with new arguments.
420 * arm.cc (Target_arm::Target_arm): Take optional argument for the
421 Target_info pointer to use.
422 (Target_arm::do_make_data_plt): New virtual method.
423 (Target_arm::make_data_plt): New method that calls it.
424 (Target_arm::make_plt_entry): Use it.
425 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
426 for the section alignment.
427 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
429 (Output_data_plt_arm::first_plt_entry_offset): Call it.
430 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
432 (Output_data_plt_arm::get_plt_entry_size): Call it.
433 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
434 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
435 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
437 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
438 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
439 method instead of sizeof(plt_entry).
440 (Output_data_plt_arm::add_entry): Likewise.
441 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
442 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
444 (Target_arm::plt_entry_size): Likewise.
445 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
447 (Output_data_plt_arm_standard): ... here, new class.
448 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
449 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
450 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
452 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
453 Take additional argument for the PLT entry size.
454 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
455 Use get_plt_entry_size method rather than plt_entry_size variable.
456 (Output_data_plt_x86_64::reserve_slot): Likewise.
457 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
458 (Output_data_plt_x86_64::add_entry): Likewise.
459 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
460 (Output_data_plt_x86_64::address_for_global): Likewise.
461 (Output_data_plt_x86_64::address_for_local): Likewise.
462 (Output_data_plt_x86_64::set_final_data_size): Likewise.
463 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
464 Make method non-static.
465 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
467 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
468 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
469 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
470 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
472 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
473 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
475 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
476 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
478 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
479 (Output_data_plt_x86_64::plt_entry_size)
480 (Output_data_plt_x86_64::first_plt_entry)
481 (Output_data_plt_x86_64::plt_entry)
482 (Output_data_plt_x86_64::tlsdesc_plt_entry)
483 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
484 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
485 (Output_data_plt_x86_64_standard): ... here, new class.
486 (Target_x86_64::Target_x86_64): Take optional argument for the
487 Target_info pointer to use.
488 (Target_x86_64::do_make_data_plt): New virtual method.
489 (Target_x86_64::make_data_plt): New method to call it.
490 (Target_x86_64::init_got_plt_for_update): Use that.
491 Call this->plt_->add_eh_frame method here.
492 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
493 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
494 rather than static method.
495 (Target_x86_64::plt_entry_size): Likewise.
496 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
497 rather than plt_entry_size variable. Move guts of PLT filling to...
498 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
499 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
500 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
502 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
503 additional argument for the section alignment.
504 Don't do add_eh_frame_for_plt here.
505 (Output_data_plt_i386::first_plt_entry_offset): Make the method
506 non-static. Use get_plt_entry_size method rather than plt_entry_size
508 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
510 (Output_data_plt_i386::get_plt_entry_size): Call it.
511 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
512 (Output_data_plt_i386::add_eh_frame): New method to call it.
513 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
515 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
516 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
518 (Output_data_plt_i386::fill_plt_entry): New method to call it.
519 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
520 method instead of plt_entry_size.
521 (Output_data_plt_i386::plt_entry_size)
522 (Output_data_plt_i386::plt_eh_frame_fde_size)
523 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
524 (Output_data_plt_i386_standard): ... here, new class.
525 (Output_data_plt_i386_exec): New class.
526 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
527 (Output_data_plt_i386_exec::first_plt_entry): ... here.
528 (Output_data_plt_i386::exec_plt_entry): Move to ...
529 (Output_data_plt_i386_exec::plt_entry): ... here.
530 (Output_data_plt_i386_dyn): New class.
531 (Output_data_plt_i386::first_plt_entry): Move to ...
532 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
533 (Output_data_plt_i386::dyn_plt_entry): Move to ...
534 (Output_data_plt_i386_dyn::plt_entry): ... here.
535 (Target_i386::Target_i386): Take optional argument for the Target_info
537 (Target_i386::do_make_data_plt): New virtual method.
538 (Target_i386::make_data_plt): New method to call it.
539 (Target_i386::make_plt_section): Use that.
540 Call this->plt_->add_eh_frame method here.
541 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
542 rather than plt_entry_size variable.
543 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
544 (Output_data_plt_i386::address_for_local): Likewise.
545 (Output_data_plt_i386::do_write): Likewise.
546 Move guts of PLT filling to...
547 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
548 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
549 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
550 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
552 2012-05-01 Cary Coutant <ccoutant@google.com>
554 * dwarf_reader.cc (Dwarf_die::read_attributes)
555 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
556 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
557 * reduced_debug_output.cc
558 (Output_reduced_debug_info_section::get_die_end): Remove
559 DW_FORM_GNU_ref_index. Add default case.
561 2012-04-26 Mark Wielaard <mjw@redhat.com>
563 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
564 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
565 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
566 DW_AT_high_pc as offset from DW_AT_low_pc.
568 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
569 * testsuite/Makefile.in: Regenerate.
570 * testsuite/gdb_index_test_3.c: New test source file.
571 * testsuite/gdb_index_test_3.sh: New test source file.
573 2012-04-25 Ian Lance Taylor <iant@google.com>
575 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
577 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
578 as a class, not a struct.
579 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
580 (Target_arm::apply_cortex_a8_workaround): Likewise.
581 * gc.h: Declare Reloc_types as a struct, not a class.
582 * object.h: Declare Symbols_data as a struct.
583 * reloc.h: Declare Read_relocs_data as a struct.
584 * target.h: Declare Relocate_info as a struct.
586 2012-04-24 David S. Miller <davem@davemloft.net>
588 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
589 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
592 2012-04-24 Cary Coutant <ccoutant@google.com>
594 * incremental-dump.cc (find_input_containing_global): Replace
595 magic number with symbolic constant.
596 (dump_incremental_inputs): Update version number.
597 * incremental.cc (Output_section_incremental_inputs): Update version
598 number; import symbolic constants from Incremental_inputs_reader.
599 (Incremental_inputs::create_data_sections): Align relocations
600 section correctly for 64-bit targets.
601 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
602 constants; add padding.
603 (Output_section_incremental_inputs::write_header): Add assert for
605 (Output_section_incremental_inputs::write_input_files): Add assert
606 for input_entry_size.
607 (Output_section_incremental_inputs::write_info_blocks): Add padding;
608 add assert for object_info_size, input_section_entry_size,
609 global_sym_entry_size.
610 * incremental.h (Incremental_inputs_reader): Add symbolic constants
611 for data structure sizes; use them.
612 (Incremental_input_entry_reader): Import symbolic constants from
613 Incremental_inputs_reader; use them.
615 2012-04-23 David S. Miller <davem@davemloft.net>
617 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
619 (Target_sparc::Target_sparc): Initialize new fields.
620 (Target_sparc::do_make_elf_object): New function.
621 (Target_sparc::do_adjust_elf_header): New function.
623 2012-04-23 Cary Coutant <ccoutant@google.com>
625 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
626 CU range table of gdb index.
628 2012-04-20 David S. Miller <davem@davemloft.net>
630 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
633 2012-04-16 David S. Miller <davem@davemloft.net>
635 * sparc.cc (Target_sparc::got_address): New function.
636 (Sparc_relocate_functions::gdop_hix22): New function.
637 (Sparc_relocate_functions::gdop_lox10): New function.
638 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
640 (Target_sparc::Scan::local): Likewise if the global symbol is not
641 preemptible and is not IFUNC.
642 (Target_sparc::Relocate::relocate): Perform GOTDATA code
643 transformations for local and non-preemptible non-IFUNC global
646 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
647 writing out 64-bit part of ranges.
649 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
650 -fpic and -fpie respectively.
651 * Makefile.in: Regenerate.
653 * sparc.cc (class Target_sparc): Add rela_ifunc_.
654 (Target_sparc::Target_sparc): Initialize new field.
655 (Target_sparc::do_plt_section_for_global): New function.
656 (Target_sparc::do_plt_section_for_local): New function.
657 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
658 (Target_sparc::make_plt_section): New function, broken out of
659 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
660 (Target_sparc::make_plt_entry): Call make_plt_section.
661 (Target_sparc::make_local_ifunc_plt_entry): New function.
662 (Target_sparc::rela_ifunc_section): New function.
663 (Target_sparc::plt_section): Remove const.
664 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
665 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
666 and ifunc_count_ fields.
667 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
668 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
669 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
670 (Output_data_plt_sparc::rela_ifunc): New function.
671 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
672 (Output_data_plt_sparc::has_ifunc_section): New function.
673 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
674 (Output_data_plt_sparc::address_for_global): New function.
675 (Output_data_plt_sparc::address_for_local): New function.
676 (Output_data_plt_sparc::plt_index_to_offset): New function.
677 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
679 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
681 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
682 R_SPARC_JMP_IREL to switch.
683 (Target_sparc::Scan::check_non_pic): Likewise.
684 (Target_sparc::Scan::local): Handle IFUNC symbols.
685 (Target_sparc::Scan::local): Likewise.
686 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
687 and plt_address_for_local.
688 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
689 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
691 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
692 (class Output_data_reloc): Adjust calls to Output_reloc_type.
693 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
694 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
696 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
697 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
699 * sparc.cc (Target_sparc::Scan::global): Likewise.
700 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
702 2012-04-16 Cary Coutant <ccoutant@google.com>
704 * archive.cc (Library_base::should_include_member): Check for
705 --export-dynamic-symbol.
706 * options.h (class General_options): Add --export-dynamic-symbol.
707 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
708 --export-dynamic-symbol.
709 (Symbol_table::gc_mark_undef_symbols): Likewise.
710 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
712 2012-04-12 David S. Miller <davem@davemloft.net>
714 * sparc.cc (Reloc::wdisp10): New relocation method.
715 (Reloc::h34): Likewise.
716 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
717 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
719 (Target_sparc::Scan::local): Likewise.
720 (Target_sparc::Scan::global): Likewise.
721 (Target_sparc::Relocate::relocate): Likewise.
723 2012-04-09 Cary Coutant <ccoutant@google.com>
725 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
728 2012-04-06 Ian Lance Taylor <iant@google.com>
730 * timer.cc: #include <unistd.h>.
732 2012-04-06 Roland McGrath <mcgrathr@google.com>
734 * configure.in (AC_CHECK_HEADERS): Add locale.h.
735 * config.in: Regenerate.
736 * configure: Regenerate.
738 2012-04-05 Nick Clifton <nickc@redhat.com>
740 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
741 (AM_LC_MESSAGES): Add.
742 * aclocal.m4: Regenerate.
743 * config.in: Regenerate.
744 * configure: Regenerate.
746 2012-03-21 Cary Coutant <ccoutant@google.com>
748 * Makefile.am: Add gdb-index.cc, gdb-index.h.
749 * Makefile.in: Regenerate.
750 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
751 (Sized_elf_reloc_mapper::symbol_section): New function.
752 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
753 (make_elf_reloc_mapper): New function.
754 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
755 (Dwarf_abbrev_table::do_read_abbrevs): New function.
756 (Dwarf_abbrev_table::do_get_abbrev): New function.
757 (Dwarf_ranges_table::read_ranges_table): New function.
758 (Dwarf_ranges_table::read_range_list): New function.
759 (Dwarf_pubnames_table::read_section): New function.
760 (Dwarf_pubnames_table::read_header): New function.
761 (Dwarf_pubnames_table::next_name): New function.
762 (Dwarf_die::Dwarf_die): New function.
763 (Dwarf_die::read_attributes): New function.
764 (Dwarf_die::skip_attributes): New function.
765 (Dwarf_die::set_name): New function.
766 (Dwarf_die::set_linkage_name): New function.
767 (Dwarf_die::attribute): New function.
768 (Dwarf_die::string_attribute): New function.
769 (Dwarf_die::int_attribute): New function.
770 (Dwarf_die::uint_attribute): New function.
771 (Dwarf_die::ref_attribute): New function.
772 (Dwarf_die::child_offset): New function.
773 (Dwarf_die::sibling_offset): New function.
774 (Dwarf_info_reader::check_buffer): New function.
775 (Dwarf_info_reader::parse): New function.
776 (Dwarf_info_reader::do_parse): New function.
777 (Dwarf_info_reader::do_read_string_table): New function.
778 (Dwarf_info_reader::lookup_reloc): New function.
779 (Dwarf_info_reader::get_string): New function.
780 (Dwarf_info_reader::visit_compilation_unit): New function.
781 (Dwarf_info_reader::visit_type_unit): New function.
782 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
783 Sized_elf_reloc_mapper.
784 (Sized_dwarf_line_info::symbol_section): Remove function.
785 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
786 (Sized_dwarf_line_info::read_line_mappings): Remove object
787 parameter, adjust callers.
788 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
789 * dwarf_reader.h: Include <sys/types.h>.
790 (class Track_relocs): Remove forward declaration.
791 (class Elf_reloc_mapper): New class.
792 (class Sized_elf_reloc_mapper): New class.
793 (class Dwarf_abbrev_table): New class.
794 (class Dwarf_range_list): New class.
795 (class Dwarf_ranges_table): New class.
796 (class Dwarf_pubnames_table): New class.
797 (class Dwarf_die): New class.
798 (class Dwarf_info_reader): New class.
799 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
800 (Sized_dwarf_line_info::symbol_section): Remove member function.
801 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
803 * gdb-index.cc: New source file.
804 * gdb-index.h: New source file.
805 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
806 and .debug_types sections, call Layout::add_to_gdb_index.
807 (Sized_relobj_incr::do_section_name): Implement.
808 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
809 return type; Implement.
810 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
812 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
813 parameter list and return type.
814 (Sized_incr_dynobj::do_section_contents): Likewise.
815 * layout.cc: Include gdb-index.h.
816 (Layout::Layout): Initialize gdb_index_data_.
817 (Layout::init_fixed_output_section): Check for .gdb_index section.
818 (Layout::add_to_gdb_index): New function. Instantiate.
819 * layout.h: Add forward declaration for class Gdb_index.
820 (Layout::add_to_gdb_index): New member function.
821 (Layout::gdb_index_data_): New data member.
822 * main.cc: Include gdb-index.h.
823 (main): Print statistics for gdb index.
824 * object.cc (Object::section_contents): Move code into
826 (need_decompressed_section): Check for sections needed when building
828 (build_compressed_section_map): Likewise.
829 (Sized_relobj_file::do_read_symbols): Need local symbols when building
831 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
832 sections; call Layout::add_to_gdb_index.
833 (Sized_relobj_file::do_decompressed_section_contents): Call
834 do_section_contents directly.
835 * object.h (Object::do_section_contents): Adjust parameter list and
837 (Object::do_decompressed_section_contents): Call do_section_contents
839 (Sized_relobj_file::do_section_contents): Adjust parameter list and
841 * options.h (class General_options): Add --gdb-index option.
842 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
843 list and return type.
844 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
845 * reloc.h (Track_relocs::checkpoint): New function.
846 (Track_relocs::reset): New function.
848 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
850 * testsuite/Makefile.in: Regenerate.
851 * testsuite/gdb_index_test.cc: New test source file.
852 * testsuite/gdb_index_test_1.sh: New test source file.
853 * testsuite/gdb_index_test_2.sh: New test source file.
855 2012-03-19 Doug Kwan <dougkwan@google.com>
857 * arm.cc (Target_arm::do_define_standard_symbols): New method.
858 (Target_arm::do_finalize_sections): Remove code which defines
859 __exidx_start and __exidx_end. Make symbol table parameter
860 anonymous as it is not used.
861 * gold.cc (queue_middle_tasks): Call target hook to define any
862 target-specific symbols.
863 * target.h (Target::define_standard_symbols): New method.
864 (Target::do_define_standard_symbols): Same.
865 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
866 * testsuite/Makefile.in: Regenerate.
867 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
869 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
870 relocations are generated for __exidx_start and __exidx_end.
872 2012-03-16 Doug Kwan <dougkwan@google.com>
874 * testsuite/Makefile.am: Disable test initpri3b.
875 * testsuite/Makefile.in: Regenerate.
877 2012-03-15 Doug Kwan <dougkwan@google.com>
879 * arm.cc (Target_arm::got_section): Make .got section read-only
882 2012-03-15 Ian Lance Taylor <iant@google.com>
885 * layout.cc (Layout::make_output_section): Correctly mark
886 SHT_INIT_ARRAY, et. al., as relro.
888 2012-03-14 Doug Kwan <dougkwan@google.com>
890 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
891 dynamic relocations for protected symbols in shared objects.
893 2012-03-13 Ian Lance Taylor <iant@google.com>
895 * resolve.cc (Symbol_table::resolve): When merging common symbols,
896 keep the larger alignment.
898 2012-03-12 Cary Coutant <ccoutant@google.com>
900 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
901 handling of DW_LNE_define_file.
903 2012-03-12 Cary Coutant <ccoutant@google.com>
905 * reduced_debug_output.cc
906 (Output_reduced_debug_info_section::get_die_end): Add new FORM
909 2012-02-29 Cary Coutant <ccoutant@google.com>
911 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
913 2012-02-29 Cary Coutant <ccoutant@google.com>
915 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
916 Call Object::decompressed_section_contents.
917 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
919 (Sized_dwarf_line_info::buffer_start_): New data member.
920 * merge.cc (Output_merge_data::do_add_input_section): Call
921 Object::decompressed_section_contents.
922 (Output_merge_string::do_add_input_section): Likewise.
923 * object.cc (need_decompressed_section): New function.
924 (build_compressed_section_map): Decompress sections needed later.
925 (Sized_relobj_file::do_decompressed_section_contents): New function.
926 (Sized_relobj_file::do_discard_decompressed_sections): New function.
927 * object.h (Object::decompressed_section_contents): New function.
928 (Object::discard_decompressed_sections): New function.
929 (Object::do_decompressed_section_contents): New function.
930 (Object::do_discard_decompressed_sections): New function.
931 (Compressed_section_info): New type.
932 (Compressed_section_map): Include decompressed section contents.
933 (Sized_relobj_file::do_decompressed_section_contents): New function.
934 (Sized_relobj_file::do_discard_decompressed_sections): New function.
936 2012-02-16 Cary Coutant <ccoutant@google.com>
938 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
939 * testsuite/Makefile.in: Regenerate.
941 2012-02-14 Cary Coutant <ccoutant@google.com>
943 * options.cc (General_options::finalize): Disallow -pie and -static.
945 2012-02-03 Doug Kwan <dougkwan@google.com>
947 * arm.cc (Arm_relocate_functions::abs8,
948 Arm_relocate_functions::abs16): Use
949 Bits::has_signed_unsigned_overflow32.
950 (Arm_relocate_functions::thm_abs8): Correct range of
952 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
955 2012-02-02 Doug Kwan <dougkwan@google.com>
957 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
958 position independent outputs, not just shared objects.
960 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
962 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
963 * configure: Regenerated.
965 2012-01-27 Ian Lance Taylor <iant@google.com>
967 * reloc.h (Bits): New class with static functions, copied from
968 namespace utils in arm.cc.
969 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
972 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
974 * incremental.cc (write_info_blocks): Correct relocation offset.
976 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
978 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
979 (Relocate::tls_gd_to_le): Likewise.
981 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
983 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
985 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
987 * configure.ac: Check if -mcmodel=medium works.
988 * configure: Regenerated.
990 2012-01-24 Cary Coutant <ccoutant@google.com>
992 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
994 (read_unsigned_LEB_128_x): ... this new function.
995 (read_signed_LEB_128): Replaced with inline definition and ...
996 (read_signed_LEB_128_x): ... this new function.
997 * int_encoding.h (read_unsigned_LEB_128_x): New function.
998 (read_unsigned_LEB_128): Add inline definition.
999 (read_signed_LEB_128_x): New function.
1000 (read_signed_LEB_128): Add inline definition.
1001 * testsuite/Makefile.am (leb128_unittest): New unit test.
1002 * testsuite/Makefile.in: Regenerate.
1003 * testsuite/leb128_unittest.cc: New unit test.
1005 2012-01-23 Ian Lance Taylor <iant@google.com>
1008 * i386.cc (Target_i386::do_code_fill): When using a jmp
1009 instruction, pad with nop instructions.
1010 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1012 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1014 * x86_64.cc (gc_process_relocs): Add typename on types used in
1016 (scan_relocs): Likewise.
1017 (relocate_section): Likewise.
1018 (apply_relocation): Likewise.
1020 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1022 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1023 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1026 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1028 * x86_64.cc: Initial support for x32.
1030 2012-01-03 Cary Coutant <ccoutant@google.com>
1032 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1033 Use abstract base class for GOT.
1034 * gold/output.h (class Output_data_got_base): New abstract base class.
1035 (class Output_data_got): Derive from new base class, adjust ctors.
1036 (Output_data_got::reserve_slot): Make virtual; rename to
1037 do_reserve_slot; Adjust callers.
1038 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1039 pointer to abstract base class.
1040 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1042 2011-12-18 Ian Lance Taylor <iant@google.com>
1044 * object.h (Relobj::local_symbol_value): New function.
1045 (Relobj::local_plt_offset): New function.
1046 (Relobj::local_has_got_offset): New function.
1047 (Relobj::local_got_offset): New function.
1048 (Relobj::set_local_got_offset): New function.
1049 (Relobj::do_local_symbol_value): New pure virtual function.
1050 (Relobj::do_local_plt_offset): Likewise.
1051 (Relobj::do_local_has_got_offset): Likewise.
1052 (Relobj::do_local_got_offset): Likewise.
1053 (Relobj::do_set_local_got_offset): Likewise.
1054 (Sized_relobj::do_local_has_got_offset): Rename from
1055 local_has_got_offset.
1056 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1057 (Sized_relobj::do_set_local_got_offset): Rename from
1058 set_local_got_offset.
1059 (Sized_relobj_file::do_local_plt_offset): Rename from
1061 (Sized_relobj_file::do_local_symbol_value): New function.
1062 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1064 * output.cc (Output_data_got::Got_entry::write): Change object to
1065 Relobj. Use local_symbol_value.
1066 (Output_data_got::add_global_with_rel): Change rel_dyn to
1067 Output_data_reloc_generic*. Use add_global_generic.
1068 (Output_data_got::add_global_with_rela): Remove. Change all
1069 callers to use add_global_with_rel.
1070 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1071 Output_data_reloc_generic*. Use add_global_generic.
1072 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1073 callers to use add_global_pair_with_rel.
1074 (Output_data_got::add_local): Change object to Relobj*.
1075 (Output_data_got::add_local_plt): Likewise.
1076 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1077 change rel_dyn to Output_data_reloc_generic*. Use
1079 (Output_data_got::add_local_with_rela): Remove. Change all
1080 callers to use all_local_with_rel.
1081 (Output_data_got::add_local_pair_with_rel): Change object to
1082 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1083 add_output_section_generic.
1084 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1085 callers to use add_local_pair_with_rel.
1086 (Output_data_got::reserve_local): Change object to Relobj*.
1087 * output.h: (class Output_data_reloc_generic): Add pure virtual
1088 declarations for add_global_generic, add_local_generic,
1089 add_output_section_generic.
1090 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1091 functions for Output_data_reloc_generic. Update declarations for
1092 changes listed in output.cc.
1093 (class Output_data_got): Change template parameter to got_size.
1094 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1095 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1097 (Sized_relobj_incr::do_local_plt_offset): New function.
1098 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1101 2011-12-17 Cary Coutant <ccoutant@google.com>
1103 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1104 * resolve.cc (Symbol_table::resolve): Likewise.
1105 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1107 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1109 2011-12-16 Ian Lance Taylor <iant@google.com>
1111 * output.h (Output_data_reloc_generic::add): Only call
1112 add_dynamic_reloc if this is a dynamic reloc section.
1114 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1117 * target-reloc.h (apply_relocation): Replace <64, false> with
1120 2011-11-25 Nick Clifton <nickc@redhat.com>
1122 * po/it.po: New Italian translation.
1124 2011-11-17 Sterling Augustine <saugustine@google.com>
1126 * script.cc (script_include_directive): Implement.
1127 (read_script_file): New local variables name and search_path. Update
1128 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1129 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1130 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1132 2011-11-11 Sterling Augustine <saugustine@google.com>
1134 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1135 (file_or_sections_cmd): Likewise.
1137 2011-11-11 Doug Kwan <dougkwan@google.com>
1139 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1140 if --just-symbols is given.
1142 2011-11-10 Doug Kwan <dougkwan@google.com>
1145 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1146 when processing data relocs.
1147 * reloc.h (Relocate_functions::rel_unaligned): New method.
1148 (Relocate_functions::pcrel_unaligned): Ditto.
1149 (Relocate_functions::rel32_unaligned): Ditto.
1150 (Relocate_functions::pcrel32_unaligned): Ditto.
1152 2011-11-09 Doug Kwan <dougkwan@google.com>
1155 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1156 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1157 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1158 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1159 (Relocate_functions::rel_unaligned): New.
1160 (Relocate_functions::rel32_unaligned): New.
1161 * target-reloc.h (relocate_for_relocatable): Add code to handle
1162 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1163 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1164 arm_unaligned_reloc_r): New targets.
1165 * testsuite/Makefile.in: Regenerate.
1166 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1169 2011-11-02 Ian Lance Taylor <iant@google.com>
1171 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1173 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1174 * options.cc (General_options::finalize): Use library search path
1175 from configure script if specified. If not native and no sysroot,
1176 only search TOOLLIBDIR.
1177 * options.h (Search_directory::Search_directory): Change name to
1179 (General_options::add_to_library_path_with_sysroot): Change arg to
1181 * configure, Makefile.in, config.in: Rebuild.
1183 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1185 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1186 we are working around the ARM1176 Erratum.
1187 * options.h (General_options::fix_arm1176): Add option.
1188 * testsuite/Makefile.am: Add testcases, and keep current ones
1190 * testsuite/Makefile.in: Regenerate.
1191 * testsuite/arm_fix_1176.s: New file.
1192 * testsuite/arm_fix_1176.sh: Likewise.
1194 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1196 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1198 (Target_arm::may_use_blx): Remove method.
1199 (Target_arm::set_may_use_blx): Likewise.
1200 (Target_arm::may_use_v4t_interworking): New method.
1201 (Target_arm::may_use_v5t_interworking): Likewise.
1202 (Target_arm::may_use_blx_): Remove member variable.
1203 (Arm_relocate_functions::arm_branch_common): Check for v5T
1205 (Arm_relocate_functions::thumb_branch_common): Likewise.
1206 (Reloc_stub::stub_type_for_reloc): Likewise.
1207 (Target_arm::do_finalize_sections): Correct interworking checks.
1208 * testsuite/Makefile.am: Add new tests.
1209 * testsuite/Makefile.in: Regenerate.
1210 * testsuite/arm_farcall_arm_arm.s: New test.
1211 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1212 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1213 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1214 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1215 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1216 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1217 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1219 2011-10-31 Cary Coutant <ccoutant@google.com>
1222 * expression.cc (Expression::eval_with_dot): Add
1223 is_section_dot_assignment parameter.
1224 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1225 absolute and assigning to dot within a section.
1226 * script-sections.cc
1227 (Output_section_element_assignment::set_section_addresses): Pass
1228 dot_section to set_if_absolute.
1229 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1230 as is_section_dot_assignment flag to eval_with_dot.
1231 (Output_section_element_dot_assignment::set_section_addresses):
1233 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1234 parameter. Also set value if relative to dot_section; set the
1235 symbol's output_section.
1236 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1237 parameter. Adjust all callers.
1238 (Expression::eval_maybe_dot): Likewise.
1239 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1241 * testsuite/script_test_2.t: Test assignment of an absolute value
1242 to dot within an output section element.
1244 2011-10-31 Cary Coutant <ccoutant@google.com>
1246 * options.h (class General_options): Add --[no-]gnu-unique options.
1247 * symtab.cc (Symbol_table::sized_write_globals): Convert
1248 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1250 2011-10-31 Cary Coutant <ccoutant@google.com>
1253 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1254 unnecessary assertion.
1255 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1257 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1259 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1261 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1263 Change to just keep the section associated with symbol.
1264 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1265 they are externally visible and --export-dynamic is turned on.
1266 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1268 2011-10-19 Ian Lance Taylor <iant@google.com>
1271 * script-sections.cc
1272 (Output_section_element_dot_assignment::needs_output_section): New
1275 2011-10-19 Ian Lance Taylor <iant@google.com>
1278 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1279 --section-start option was seen.
1280 * options.h (General_options::any_section_start): New function.
1282 2011-10-18 David S. Miller <davem@davemloft.net>
1285 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1286 member to track relocation locations that have moved during TLS
1287 reloc optimizations.
1288 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1289 (Target_sparc::Relocate::relocate): Adjust view down by 4
1290 bytes if it matches reloc_adjust_addr_.
1291 (Target_sparc::Relocate::relocate_tls): Always move the
1292 __tls_get_addr call delay slot instruction forward 4 bytes when
1293 performing relaxation.
1295 2011-10-18 Cary Coutant <ccoutant@google.com>
1297 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1298 (Output_file::map_no_anonymous): Check for non-zero
1299 return code from posix_fallocate.
1301 2011-10-17 Cary Coutant <ccoutant@google.com>
1304 * plugin.cc (is_visible_from_outside): Check for symbols
1305 referenced from dynamic objects.
1306 * resolve.cc (Symbol_table::resolve): Don't count references
1307 from dynamic objects as references from real ELF files.
1308 * testsuite/plugin_test_2.sh: Adjust expected result.
1310 2011-10-17 Cary Coutant <ccoutant@google.com>
1312 * gold.cc: Include timer.h.
1313 (queue_middle_tasks): Stamp time.
1314 (queue_final_tasks): Likewise.
1315 * main.cc (main): Store timer in parameters. Print timers
1317 * parameters.cc (Parameters::Parameters): Initialize timer_.
1318 (Parameters::set_timer): New function.
1319 (set_parameters_timer): New function.
1320 * parameters.h (Parameters::set_timer): New function.
1321 (Parameters::timer): New function.
1322 (Parameters::timer_): New data member.
1323 (set_parameters_timer): New function.
1324 * timer.cc (Timer::stamp): New function.
1325 (Timer::get_pass_time): New function.
1326 * timer.h (Timer::stamp): New function.
1327 (Timer::get_pass_time): New function.
1328 (Timer::pass_times_): New data member.
1330 2011-10-17 Cary Coutant <ccoutant@google.com>
1332 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1333 task for members of lib groups.
1335 2011-10-17 Cary Coutant <ccoutant@google.com>
1338 * fileread.cc (File_read::find_view): Add assert.
1339 (File_read::make_view): Move bounds check (replace with assert)...
1340 (File_read::find_or_make_view): ... to here.
1342 2011-10-12 Cary Coutant <ccoutant@google.com>
1344 * output.cc (Output_file::open_base_file): Handle case where
1345 ::read returns less than requested size.
1347 2011-10-10 Cary Coutant <ccoutant@google.com>
1349 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1350 Initialize defined_count_.
1351 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1352 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1353 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1354 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1355 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1356 * incremental.h (Sized_relobj_incr::defined_count_): New data
1358 (Sized_incr_dynobj::defined_count_): New data member.
1359 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1360 Return zeroes instead of internal error.
1362 2011-10-10 Cary Coutant <ccoutant@google.com>
1365 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1366 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1367 * output.h (class Output_reloc): Add use_plt_offset flag.
1368 (Output_reloc::type_): Adjust size of bit field.
1369 (Output_reloc::use_plt_offset_): New bit field.
1370 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1371 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1372 flag. Adjust all callers.
1373 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1374 creating RELATIVE relocations.
1376 2011-10-10 Nick Clifton <nickc@redhat.com>
1378 * po/es.po: Updated Spanish translation.
1379 * po/fi.po: Updated Finnish translation.
1381 2011-10-03 Diego Novillo <dnovillo@google.com>
1383 * options.cc (parse_uint): Fix dereference of RETVAL.
1385 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1387 * layout.h (section_order_map_): New member.
1388 (get_section_order_map): New member function.
1389 * output.cc (Output_section::add_input_section): Check for patterns
1390 only when --section-ordering-file is specified.
1391 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1392 output_sections have been formed.
1393 * layout.cc (Layout_Layout): Initialize section_order_map_.
1394 * plugin.cc (update_section_order): Store order in order_map. Do not
1396 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1397 * testsuite/Makefile.in: Regenerate.
1398 * testsuite/plugin_section_order.c: New file.
1399 * testsuite/plugin_final_layout.cc: New file.
1400 * testsuite/plugin_final_layout.sh: New file.
1402 2011-09-29 Cary Coutant <ccoutant@google.com>
1404 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1406 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1407 symbols during incremental update.
1408 (Symbol_table::add_from_dynobj): Likewise.
1410 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1411 Ian Lance Taylor <iant@google.com>
1413 * symtab.cc (Symbol_table::define_special_symbol): Always
1414 canonicalize version string.
1416 2011-09-26 Cary Coutant <ccoutant@google.com>
1418 * gold.cc (queue_initial_tasks): Move option checks ...
1419 * options.cc (General_options::finalize): ... to here. Disable
1420 some options; make others fatal.
1422 2011-09-26 Cary Coutant <ccoutant@google.com>
1425 * plugin.cc (get_symbols_v2): New function.
1426 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1427 (is_referenced_from_outside): New function.
1428 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1429 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1430 (get_symbols): Pass version parameter.
1431 (get_symbols_v2): New function.
1432 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1434 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1435 (onload): Add LDPT_GET_SYMBOLS_V2.
1436 (all_symbols_read_hook): Use get_symbols_v2; check for
1437 LDPR_PREVAILING_DEF_IRONLY_EXP.
1438 * testsuite/plugin_test_3.sh: Update expected results.
1440 2011-09-23 Simon Baldwin <simonb@google.com>
1442 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1443 configuration options.
1444 * configure: Regenerate.
1445 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1446 * Makefile.in: Regenerate.
1447 * testsuite/Makefile.in: Regenerate.
1449 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1451 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1453 2011-09-19 Cary Coutant <ccoutant@google.com>
1455 * incremental.cc (can_incremental_update): Fix typo in comment.
1456 * incremental.h (can_incremental_update): Likewise.
1458 2011-09-18 Cary Coutant <ccoutant@google.com>
1460 * incremental.cc (can_incremental_update): New function.
1461 * incremental.h (can_incremental_update): New function.
1462 * layout.cc (Layout::init_fixed_output_section): Call it.
1463 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1464 * object.cc (Sized_relobj_file::do_layout): Call
1465 can_incremental_update.
1467 2011-09-13 Cary Coutant <ccoutant@google.com>
1469 * configure.ac: Check for glibc support for gnu_indirect_function
1470 support with static linking, setting automake conditional
1472 * Makefile.in: Regenerate.
1473 * configure: Regenerate.
1475 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1476 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1478 * testsuite/Makefile.in: Regenerate.
1480 2011-09-13 Cary Coutant <ccoutant@google.com>
1482 * incremental.cc (Sized_relobj_incr::do_layout): Call
1483 report_comdat_group for kept comdat sections.
1484 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1485 * testsuite/Makefile.in: Regenerate.
1486 * testsuite/incr_comdat_test_1.cc: New source file.
1487 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1488 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1489 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1491 2011-09-13 Ian Lance Taylor <iant@google.com>
1493 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1494 variable external_symbols_offset.
1496 2011-09-12 Ian Lance Taylor <iant@google.com>
1498 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1499 triggered if object has no symbols.
1501 2011-09-09 David S. Miller <davem@davemloft.net>
1503 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1504 (Output_fill_debug_line::do_write): Likewise.
1506 2011-08-29 Cary Coutant <ccoutant@google.com>
1508 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1509 casts to match formatting specs.
1510 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1512 2011-08-26 Cary Coutant <ccoutant@google.com>
1514 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1515 remaining hole size when allocating.
1516 (Layout::make_output_section): Set fill methods for debug sections.
1517 * layout.h (Free_list::Free_list_node): Move from private to
1519 (Free_list::set_min_hole_size): New function.
1520 (Free_list::begin, Free_list::end): New functions.
1521 (Free_list::min_hole_): New data member.
1522 * output.cc: Include dwarf.h.
1523 (Output_fill_debug_info::do_minimum_hole_size): New function.
1524 (Output_fill_debug_info::do_write): New function.
1525 (Output_fill_debug_line::do_minimum_hole_size): New function.
1526 (Output_fill_debug_line::do_write): New function.
1527 (Output_section::Output_section): Initialize new data member.
1528 (Output_section::set_final_data_size): Ensure patch space is larger
1529 than minimum hole size.
1530 (Output_section::do_write): Fill holes in debug sections.
1531 * output.h (Output_fill): New class.
1532 (Output_fill_debug_info): New class.
1533 (Output_fill_debug_line): New class.
1534 (Output_section::set_free_space_fill): New function.
1535 (Output_section::free_space_fill_): New data member.
1536 * testsuite/Makefile.am (incremental_test_3): Add
1537 --incremental-patch option.
1538 (incremental_test_4): Likewise.
1539 (incremental_test_5): Likewise.
1540 (incremental_test_6): Likewise.
1541 (incremental_copy_test): Likewise.
1542 (incremental_common_test_1): Likewise.
1543 * testsuite/Makefile.in: Regenerate.
1545 2011-08-26 Nick Clifton <nickc@redhat.com>
1547 * po/es.po: Updated Spanish translation.
1549 2011-08-01 Cary Coutant <ccoutant@google.com>
1551 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1552 * gold/testsuite/Makefile.in: Regenerate.
1553 * gold/testsuite/justsyms_exec.c: New source file.
1554 * gold/testsuite/justsyms_lib.c: New source file.
1556 2011-08-01 Cary Coutant <ccoutant@google.com>
1558 * layout.cc (Layout::set_segment_offsets): Don't realign text
1559 segment if -Ttext was specified.
1560 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1562 * object.h (Sized_relobj_file::e_type): New function.
1563 (Sized_relobj_file::e_type_): New data member.
1564 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1565 base address for ET_EXEC files.
1566 * target.cc (Target::do_make_elf_object_implementation): Allow
1567 ET_EXEC files with --just-symbols option.
1569 2011-07-28 Cary Coutant <ccoutant@google.com>
1571 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1572 Add thread_number parameter.
1573 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1574 * workqueue-threads.cc
1575 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1576 current thread if its thread number is greater than desired thread
1578 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1579 Add thread_number parameter.
1580 (Workqueue::should_cancel_thread): Likewise.
1581 (Workqueue::find_runnable_or_wait): Pass thread_number to
1582 should_cancel_thread.
1583 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1586 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1588 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1589 only after checking if it cannot be forced local.
1590 * symtab.h (is_externally_visible): Check if the symbol is not forced
1593 2011-07-15 Ian Lance Taylor <iant@google.com>
1595 * options.h (class General_options): Add --print-output-format.
1596 Move -EL next to -EB, for better --help output.
1597 * target-select.cc: Include <cstdio>, "options.h", and
1599 (Target_selector::do_target_bfd_name): New function.
1600 (print_output_format): New function.
1601 * target-select.h (class Target_selector): Update declarations.
1602 (Target_selector::target_bfd_name): New function.
1603 (print_output_format): Declare.
1604 * main.cc: Include "target-select.h".
1605 (main): Handle --print-output-format.
1606 * gold.cc: Include "target-select.h".
1607 (queue_initial_tasks): Handle --print-output-format when there are
1609 * parameters.cc (parameters_force_valid_target): Give a better
1610 error message if -EB/-EL does not match target.
1611 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1614 2011-07-15 Ian Lance Taylor <iant@google.com>
1616 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1617 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1618 (Output_data_plt_i386::do_write): Write address of .dynamic
1619 section to first entry in .got.plt section.
1620 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1621 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1623 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1624 section to first entry in .got.plt section.
1625 * layout.h (Layout::dynamic_section): New function.
1627 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1629 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1631 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1632 input_section_position_, and input_section_glob_.
1633 (read_layout_from_file): Call function section_ordering_specified.
1634 * layout.h (is_section_ordering_specified): New function.
1635 (section_ordering_specified): New function.
1636 (section_ordering_specified_): New boolean member.
1637 * main.cc(main): Call load_plugins after layout object is defined.
1638 * output.cc (Output_section::add_input_section): Use
1639 function section_ordering_specified to check if section ordering is
1641 * output.cc (Output_section::add_relaxed_input_section): Use
1642 function section_ordering_specified to check if section ordering is
1644 (Output_section::update_section_layout): New function.
1645 (Output_section::sort_attached_input_sections): Check if input section
1647 * output.h (Output_section::update_section_layout): New function.
1648 * plugin.cc (get_section_count): New function.
1649 (get_section_type): New function.
1650 (get_section_name): New function.
1651 (get_section_contents): New function.
1652 (update_section_order): New function.
1653 (allow_section_ordering): New function.
1654 (Plugin::load): Add the new interfaces to the transfer vector.
1655 (Plugin_manager::load_plugins): New parameter.
1656 (Plugin_manager::all_symbols_read): New parameter.
1657 (Plugin_manager::claim_file): New parameter. Save the elf object for
1659 (Plugin_manager::get_elf_object): New function.
1660 (Plugin_manager::get_view): Change to directly use the bool to check
1661 if get_view is called from claim_file_hook.
1662 * plugin.h (input_objects): New function
1663 (Plugin__manager::load_plugins): New parameter.
1664 (Plugin_manager::claim_file): New parameter.
1665 (Plugin_manager::get_elf_object): New function.
1666 (Plugin_manager::in_claim_file_handler): New function.
1667 (Plugin_manager::in_claim_file_handler_): New member.
1668 (layout): New function.
1669 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1670 handler with an extra parameter. Make the elf object before calling
1672 * testsuite/plugin_test.c (get_section_count): New function pointer.
1673 (get_section_type): New function pointer.
1674 (get_section_name): New function pointer.
1675 (get_section_contents): New function pointer.
1676 (update_section_order): New function pointer.
1677 (allow_section_ordering): New function pointer.
1678 (onload): Check if the new interfaces exist.
1680 2011-07-13 Ian Lance Taylor <iant@google.com>
1682 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1684 * x86_64.cc (Target_x86_64::got_section): Likewise.
1685 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1686 (relro_now_test_SOURCES): New variable.
1687 (relro_now_test_DEPENDENCIES): New variable.
1688 (relro_now_test_LDFLAGS): New variable.
1689 (relro_now_test_LDADD): New variable.
1690 (relro_now_test.so): New target.
1691 * testsuite/Makefile.in: Rebuild.
1693 2011-07-12 Ian Lance Taylor <iant@google.com>
1696 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1697 GLOB_DAT relocation rather than a RELATIVE relocation for a
1698 protected symbol when creating a shared library.
1699 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1700 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1701 * testsuite/protected_main_1.cc (main): Test that protected
1702 function has same address.
1704 2011-07-11 Ian Lance Taylor <iant@google.com>
1707 * options.h (class General_options): Add -Bgroup.
1708 * options.cc (General_options::finalize): If -Bgroup is set,
1709 default to --unresolved-symbols=report-all.
1710 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1711 * target-reloc.h (issue_undefined_symbol_error): Handle
1712 --unresolved-symbols=report-all.
1714 2011-07-08 Ian Lance Taylor <iant@google.com>
1717 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1718 if linker script discards key sections.
1719 (Layout::create_dynamic_symtab): Likewise.
1720 (Layout::assign_local_dynsym_offsets): Likewise.
1721 (Layout::sized_create_version_sections): Likewise.
1722 (Layout::create_interp): Likewise.
1723 (Layout::finish_dynamic_section): Likewise.
1724 (Layout::set_dynamic_symbol_size): Likewise.
1726 2011-07-08 Ian Lance Taylor <iant@google.com>
1729 * options.h (class General_options): Add --unresolved-symbols.
1730 * target-reloc.h (issue_undefined_symbol_error): Check
1731 --unresolved-symbols. Add comments.
1733 2011-07-08 Ian Lance Taylor <iant@google.com>
1735 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1736 expression more complex.
1738 2011-07-08 Ian Lance Taylor <iant@google.com>
1741 * target-reloc.h (issue_undefined_symbol_error): New inline
1742 function, broken out of relocate_section.
1743 (relocate_section): Call issue_undefined_symbol_error.
1744 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1745 there is no TLS segment if we are about to issue an undefined
1747 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1749 2011-07-08 Ian Lance Taylor <iant@google.com>
1752 * resolve.cc (Symbol_table::should_override): Add fromtype
1753 parameter. Change all callers. Give error when linking together
1754 TLS and non-TLS symbol.
1755 (Symbol_table::should_override_with_special): Add fromtype
1756 parameter. Change all callers.
1757 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1758 there is no TLS segment if we have reported some errors.
1759 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1761 2011-07-08 Ian Lance Taylor <iant@google.com>
1764 * target.h (Target::plt_address_for_global): New function.
1765 (Target::plt_address_for_local): New function.
1766 (Target::plt_section_for_global): Remove.
1767 (Target::plt_section_for_local): Remove.
1768 (Target::do_plt_address_for_global): New virtual function.
1769 (Target::do_plt_address_for_local): New virtual function.
1770 (Target::do_plt_section_for_global): Remove.
1771 (Target::do_plt_section_for_local): Remove.
1772 (Target::register_global_plt_entry): Add Symbol_table and Layout
1774 * output.cc (Output_data_got::Got_entry::write): Use
1775 plt_address_for_global and plt_address_for_local.
1776 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1777 address of output section.
1778 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1779 got_irelative_, and irelative_count_ fields. Update
1781 (Output_data_plt_i386::has_irelative_section): New function.
1782 (Output_data_plt_i386::entry_count): Add irelative_count_.
1783 (Output_data_plt_i386::set_final_data_size): Likewise.
1784 (class Target_i386): Add got_irelative_ and rel_irelative_
1785 fields. Update declarations.
1786 (Target_i386::Target_i386): Initialize new fields.
1787 (Target_i386::do_plt_address_for_global): New function replacing
1788 do_plt_section_for_global.
1789 (Target_i386::do_plt_address_for_local): New function replacing
1790 do_plt_section_for_local.
1791 (Target_i386::got_section): Create got_irelative_.
1792 (Target_i386::rel_irelative_section): New function.
1793 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1794 fields. Don't define __rel_iplt_{start,end}.
1795 (Output_data_plt_i386::add_entry): Add symtab and layout
1796 parameters. Change all callers. Use different PLT and GOT for
1798 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1799 layout parameters. Change all callers. Use different PLT and
1801 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1802 (Output_data_plt_i386::rel_irelative): New function.
1803 (Output_data_plt_i386::address_for_global): New function.
1804 (Output_data_plt_i386::address_for_local): New function.
1805 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1806 IRELATIVE GOT when changing IFUNC GOT entries.
1807 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1809 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1810 if we didn't create an IRELATIVE GOT.
1811 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1812 plt_address_for_local.
1813 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1814 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1815 got_irelative_, and irelative_count_ fields. Update
1817 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1818 Initialize new fields. Remove symtab parameter. Change all
1820 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1822 (Output_data_plt_x86_64::has_irelative_section): New function.
1823 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1824 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1825 fields. Update declarations.
1826 (Target_x86_64::Target_x86_64): Initialize new fields.
1827 (Target_x86_64::do_plt_address_for_global): New function replacing
1828 do_plt_section_for_global.
1829 (Target_x86_64::do_plt_address_for_local): New function replacing
1830 do_plt_section_for_local.
1831 (Target_x86_64::got_section): Create got_irelative_.
1832 (Target_x86_64::rela_irelative_section): New function.
1833 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1834 all callers. Don't create __rel_iplt_{start,end}.
1835 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1836 parameters. Change all callers. Use different PLT and GOT for
1838 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1839 layout parameters. Change all callers. Use different PLT and
1841 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1842 parameters. Change all callers. Use different PLT and GOT for
1844 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1845 (Output_data_plt_x86_64::rela_irelative): New function.
1846 (Output_data_plt_x86_64::address_for_global): New function.
1847 (Output_data_plt_x86_64::address_for_local): New function.
1848 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1849 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1850 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1851 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1853 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1855 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1856 symbols if we didn't create an IRELATIVE GOT.
1857 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1858 plt_address_for_local.
1859 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1860 * testsuite/ifuncvar1.c: New test file.
1861 * testsuite/ifuncvar2.c: New test file.
1862 * testsuite/ifuncvar3.c: New test file.
1863 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1864 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1865 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1866 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1867 * testsuite/Makefile.in: Rebuild.
1869 2011-07-07 Cary Coutant <ccoutant@google.com>
1871 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1872 (two_file_test_1_ndebug.o): Likewise.
1873 (two_file_test_1b_ndebug.o): Likewise.
1874 (two_file_test_2_ndebug.o): Likewise.
1875 (two_file_test_main_ndebug.o): Likewise.
1876 (incremental_test_2): Link with no-debug versions.
1878 2011-07-06 Cary Coutant <ccoutant@google.com>
1880 * gold/incremental.cc
1881 (Output_section_incremental_inputs::write_info_blocks): Check for
1882 hidden and internal symbols.
1884 2011-07-06 Cary Coutant <ccoutant@google.com>
1886 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1887 Check disposition for startup file.
1888 (Incremental_inputs::report_command_line): Ignore
1889 --incremental-startup-unchanged option.
1890 * options.cc (General_options::parse_incremental_startup_unchanged):
1892 (General_options::General_options): Initialize new data member.
1893 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1894 (General_options): Add --incremental-startup-unchanged option.
1895 (General_options::incremental_startup_disposition): New function.
1896 (General_options::incremental_startup_disposition_): New data member.
1898 2011-07-06 Cary Coutant <ccoutant@google.com>
1900 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1901 input file index to Script_info ctor.
1902 (Sized_incremental_binary::do_file_has_changed): Find the
1903 command-line argument for files named in scripts.
1904 * incremental.h (Script_info::Script_info): New ctor
1905 with input file index.
1906 (Script_info::input_file_index): New function.
1907 (Script_info::input_file_index_): New data member.
1908 (Incremental_binary::get_library): Add const.
1909 (Incremental_binary::get_script_info): Add const.
1910 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1911 * testsuite/Makefile.am (incremental_test_5): New test case.
1912 (incremental_test_6): New test case.
1913 * testsuite/Makefile.in: Regenerate.
1915 2011-07-06 Cary Coutant <ccoutant@google.com>
1917 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1918 debug output when command lines differ.
1920 2011-07-06 Cary Coutant <ccoutant@google.com>
1922 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1923 --incremental-patch option.
1924 * layout.cc (Free_list::allocate): Extend allocation beyond original
1926 (Layout::make_output_section): Mark sections that should get
1928 * options.cc (parse_percent): New function.
1929 * options.h (parse_percent): New function.
1930 (DEFINE_percent): New macro.
1931 (General_options): Add --incremental-patch option.
1932 * output.cc (Output_section::Output_section): Initialize new data
1934 (Output_section::add_input_section): Print section name when out
1936 (Output_section::add_output_section_data): Likewise.
1937 (Output_section::set_final_data_size): Add patch space when
1938 doing --incremental-full.
1939 (Output_section::do_reset_address_and_file_offset): Remove patch
1941 (Output_segment::set_section_list_addresses): Print debug output
1942 only if --incremental-update.
1943 * output.h (Output_section::set_is_patch_space_allowed): New function.
1944 (Output_section::is_patch_space_allowed_): New data member.
1945 (Output_section::patch_space_): New data member.
1946 * parameters.cc (Parameters::incremental_full): New function.
1947 * parameters.h (Parameters::incremental_full): New function
1948 * testsuite/Makefile.am (incremental_test_2): Add test for
1949 --incremental-patch option.
1950 * testsuite/Makefile.in: Regenerate.
1951 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1952 (t18): Remove function body.
1954 2011-07-05 Doug Kwan <dougkwan@google.com>
1957 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1958 Arm_Address type for relocation result.
1959 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1961 (Arm_relocate_functions::abs32): Use unaligned access.
1962 (Arm_relocate_functions::rel32): Ditto.
1963 (Arm_relocate_functions::prel31): Ditto.
1964 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1965 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1966 static data relocations.
1967 * testsuite/Makefile.in: Regnerate.
1968 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1970 2011-07-05 Ian Lance Taylor <iant@google.com>
1973 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1974 symbols if necessary.
1975 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1977 2011-07-05 Ian Lance Taylor <iant@google.com>
1980 * resolve.cc (Symbol::override_base_with_special): Simply override
1981 version with special symbol version, ignoring previous version.
1983 2011-07-05 Ian Lance Taylor <iant@google.com>
1985 * object.cc (Sized_relobj_file::include_section_group): Add
1986 information to comment about signature location.
1988 2011-07-02 Ian Lance Taylor <iant@google.com>
1991 * options.h (class General_options): Add -f and -F.
1992 * options.cc (General_options::finalize): Fatal error if -f/-F
1993 are used without -shared.
1994 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1996 2011-07-02 Ian Lance Taylor <iant@google.com>
1998 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2000 2011-07-01 Ian Lance Taylor <iant@google.com>
2004 * resolve.cc (Symbol::override_base_with_special): Don't override
2005 the version if the overriding symbol has a different name.
2006 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2007 all callers. If we give an error about an undefined version,
2008 define the base version if necessary.
2009 * dynobj.h (class Versions): Update declaration.
2010 * testsuite/weak_alias_test_5.cc: New file.
2011 * testsuite/weak_alias_test.script: New file.
2012 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2013 and versioned_alias have the right value, and call t2.
2014 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2015 weak_alias_test_5.so.
2016 (weak_alias_test_LDADD): Likewise.
2017 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2018 * testsuite/Makefile.in: Rebuild.
2020 2011-07-01 Ian Lance Taylor <iant@google.com>
2023 * options.h (class General_options): Support -z notext.
2024 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2026 (two_file_shared_nonpic.so): Likewise.
2027 (two_file_shared_mixed.so): Likewise.
2028 (two_file_shared_mixed_1.so): Likewise.
2029 (weak_undef_lib_nonpic.so): Likewise.
2030 (alt/weak_undef_lib_nonpic.so): Likewise.
2031 (tls_test_shared_nonpic.so): Likewise.
2032 * testsuite/Makefile.in: Rebuild.
2034 2011-07-01 Ian Lance Taylor <iant@google.com>
2037 * configure.ac: Test whether static linking works, setting
2038 the automake conditional HAVE_STATIC.
2039 * testsuite/Makefile.am: Disable tests using -static if
2040 HAVE_STATIC is not true.
2041 * configure, testsuite/Makefile.in: Rebuild.
2043 2011-07-01 Ian Lance Taylor <iant@google.com>
2046 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2047 Assert if we see DW_EH_PE_indirect.
2048 * target.h (Target::ehframe_datarel_base): New function.
2049 (Target::do_ehframe_datarel_base): New target function.
2050 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2051 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2054 2011-07-01 Ian Lance Taylor <iant@google.com>
2057 * options.h (class General_options): Add
2058 --ld-generated-unwind-info.
2059 * ehframe.cc (Fde::write): Add address parameter. Change all
2060 callers. If associated with PLT, fill in address and size.
2061 (Cie::set_output_offset): Only add merge mapping if there is an
2063 (Cie::write): Add address parameter. Change all callers.
2064 (Eh_frame::add_ehframe_for_plt): New function.
2065 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2066 input_offset_ fields into union u_, with new plt field.
2067 (Fde::Fde): Adjust for new union field.
2068 (Fde::Fde) [Output_data version]: New constructor.
2069 (Fde::add_mapping): Only add merge mapping if there is an object.
2070 (class Cie): Update declarations.
2071 (class Eh_frame): Declare add_ehframe_for_plt.
2072 * layout.cc (Layout::layout_eh_frame): Break out code into
2073 make_eh_frame_section, and call it.
2074 (Layout::make_eh_frame_section): New function.
2075 (Layout::add_eh_frame_for_plt): New function.
2076 * layout.h (class Layout): Update declarations.
2077 * merge.cc (Merge_map::add_mapping): Add assertion.
2078 * i386.cc: Include "dwarf.h".
2079 (class Output_data_plt_i386): Make first_plt_entry,
2080 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2081 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2082 and plt_eh_frame_fde.
2083 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2084 boundary. Call add_eh_frame_for_plt if appropriate.
2085 * x86_64.cc: Include "dwarf.h".
2086 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2087 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2088 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2089 and plt_eh_frame_fde.
2090 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2093 2011-06-29 Ian Lance Taylor <iant@google.com>
2096 * object.cc (Sized_relobj_file::layout_section): Change shdr
2097 parameter to be const.
2098 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2100 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2101 appropriate. Call layout_eh_frame_section.
2102 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2104 * object.h (class Sized_relobj_file): Update declarations.
2106 2011-06-29 Ian Lance Taylor <iant@google.com>
2109 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2111 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2113 2011-06-29 Ian Lance Taylor <iant@google.com>
2116 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2118 * layout.cc (Layout::layout_eh_frame): Likewise.
2120 2011-06-29 Ian Lance Taylor <iant@google.com>
2123 * layout.cc (Layout::symtab_section_shndx): New function.
2124 * layout.h (class Layout): Declare symtab_section_shndx.
2125 * output.cc (Output_section::write_header): Call it.
2127 2011-06-29 Ian Lance Taylor <iant@google.com>
2130 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2131 symbols which are not used in a relocation.
2133 2011-06-28 Ian Lance Taylor <iant@google.com>
2136 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2137 script create indistinguishable segments.
2138 (Layout::set_segment_offsets): Use stable_sort when sorting
2139 segments. Pass this to Compare_segments constructor.
2140 * layout.h (class Layout): Make segment_precedes non-static.
2141 (class Compare_segments): Change from struct to class. Add
2142 layout_ field. Add constructor.
2143 * script-sections.cc
2144 (Script_sections::attach_sections_using_phdrs_clause): Rename
2145 local orphan to is_orphan. Don't report failure to put empty
2146 section in segment. On attachment failure, report name of
2147 section, and attach to first PT_LOAD segment.
2149 2011-06-28 Ian Lance Taylor <iant@google.com>
2152 * target-select.cc (Target_selector::Target_selector): Add
2153 emulation parameter. Change all callers.
2154 (select_target_by_bfd_name): Rename from select_target_by_name.
2156 (select_target_by_emulation): New function.
2157 (supported_emulation_names): New function.
2158 * target-select.h (class Target_selector): Add emulation_ field.
2159 Update declarations.
2160 (Target_selector::recognize_by_bfd_name): Rename from
2161 recognize_by_name. Change all callers.
2162 (Target_selector::supported_bfd_names): Rename from
2163 supported_names. Change all callers.
2164 (Target_selector::recognize_by_emulation): New function.
2165 (Target_selector::supported_emulations): New function.
2166 (Target_selector::emulation): New function.
2167 (Target_selector::do_recognize_by_bfd_name): Rename from
2168 do_recognize_by_name. Change all callers.
2169 (Target_selector::do_supported_bfd_names): Rename from
2170 do_supported_names. Change all callers.
2171 (Target_selector::do_recognize_by_emulation): New function.
2172 (Target_selector::do_supported_emulations): New function.
2173 (select_target_by_bfd_name): Change name in declaration.
2174 (select_target_by_emulation): Declare.
2175 (supported_emulation_names): Declare.
2176 * parameters.cc (parameters_force_valid_target): Try to find
2177 target based on emulation from -m option.
2178 * options.h (class General_options): Change doc string for -m.
2179 * options.cc (help): Print emulations.
2180 (General_options::parse_V): Likewise.
2181 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2182 Add emulation parameter. Change all callers.
2184 2011-06-28 Ian Lance Taylor <iant@google.com>
2186 * target.h (class Target): Add osabi_ field.
2187 (Target::osabi): New function.
2188 (Target::set_osabi): New function.
2189 (Target::Target): Initialize osabi_.
2190 (Target::do_adjust_elf_header): Make pure virtual.
2191 (Sized_target::do_adjust_elf_header): Declare.
2192 * target.cc (Sized_target::do_adjust_elf_header): New function.
2193 (class Sized_target): Instantiate all versions.
2194 * freebsd.h (class Target_freebsd): Remove.
2195 (Target_selector_freebsd::do_recognize): Call set_osabi on
2197 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2198 (Target_selector_freebsd::set_osabi): Remove.
2199 * i386.cc (class Target_i386): Inherit from Sized_target rather
2200 than Target_freebsd.
2201 * x86_64.cc (class Target_x86_64): Likewise.
2203 2011-06-28 Ian Lance Taylor <iant@google.com>
2205 * target.h (Target::can_check_for_function_pointers): Rewrite.
2207 (Target::can_icf_inline_merge_sections): Likewise.
2208 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2209 (Target::Target_info): Add can_icf_inline_merge_sections field.
2210 (Target::do_can_check_for_function_pointers): New virtual
2212 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2213 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2214 from can_check_for_function_pointers, move in file.
2215 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2216 section_may_have_icf_unsafe_poineters, move in file.
2217 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2218 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2219 Rename from can_check_for_function_pointers, move in file.
2220 (Target_i386::can_icf_inline_merge_sections): Remove.
2221 (Target_i386::i386_info): Initialize
2222 can_icf_inline_merge_sections.
2223 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2224 Initialize can_icf_inline_merge_sections.
2225 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2226 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2227 Rename from can_check_for_function_pointers, move in file.
2228 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2229 (Target_x86_64::x86_64_info): Initialize
2230 can_icf_inline_merge_sections.
2231 * testsuite/testfile.cc (Target_test::test_target_info):
2233 * icf.cc (get_section_contents): Correct formatting.
2235 2011-06-27 Ian Lance Taylor <iant@google.com>
2237 * symtab.cc (Symbol::versioned_name): New function.
2238 (Symbol_table::add_to_final_symtab): Use versioned_name when
2240 (Symbol_table::sized_write_symbol): Likewise.
2241 * symtab.h (class Symbol): Declare versioned_name.
2242 * stringpool.h (class Stringpool_template): Add variant of add
2243 which takes a std::basic_string.
2244 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2245 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2246 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2247 (ver_test_12.o): New target.
2248 * testsuite/Makefile.in: Rebuild.
2250 2011-06-27 Doug Kwan <dougkwan@google.com>
2252 * arm.cc (Arm_relocate_functions::thm_jump8,
2253 Arm_relocate_functions::thm_jump11): Use a wider signed
2254 type to compute offset.
2255 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2257 * testsuite/Makefile.in: Regenerate.
2258 * testsuite/arm_branch_in_range.sh: Check test results of
2259 arm_thm_jump11 and arm_thm_jump8.
2260 * testsuite/arm_thm_jump11.s: New test source file.
2261 * testsuite/arm_thm_jump11.t: New linker script.
2262 * testsuite/arm_thm_jump8.s: New test source file.
2263 * testsuite/arm_thm_jump8.t: New linker script.
2265 2011-06-24 Ian Lance Taylor <iant@google.com>
2267 * layout.cc: Include "object.h".
2268 (ctors_sections_in_init_array): New static variable.
2269 (Layout::is_ctors_in_init_array): New function.
2270 (Layout::layout): Add entry to ctors_sections_in_init_array if
2272 * layout.h (class Layout): Declare is_ctors_in_init_array.
2273 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2274 is_ctors_reverse_view is set.
2275 (Sized_relobj_file::write_sections): Add layout parameter. Change
2276 all callers. Set is_ctors_reverse_view field of View_size.
2277 (Sized_relobj_file::reverse_words): New function.
2278 * object.h (Sized_relobj_file::View_size): Add
2279 is_ctors_reverse_view field.
2280 (class Sized_relobj_file): Update declarations.
2281 * testsuite/initpri3.c: New test.
2282 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2284 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2285 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2286 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2287 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2288 * testsuite/Makefile.in: Rebuild.
2290 2011-06-24 Cary Coutant <ccoutant@google.com>
2292 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2293 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2294 (debug_msg_cdebug.err): New targets.
2295 * testsuite/Makefile.in: Regenerate.
2296 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2297 Fix checks for link with shared library.
2299 2011-06-24 Doug Kwan <dougkwan@google.com>
2301 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2302 skip empty text sections.
2303 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2305 2011-06-22 Ian Lance Taylor <iant@google.com>
2308 * options.h (class General_options): Add --ctors-in-init-array.
2309 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2310 friends as SHT_PROGBITS for merging sections.
2311 (Layout::layout): Remove special handling of .init_array and
2312 friends. Don't sort if doing relocatable link. Sort for .ctors
2313 and .dtors if ctors_in_init_array.
2314 (Layout::make_output_section): Force correct section types for
2315 .init_array and friends. Don't sort if doing relocatable link,
2316 Don't sort .ctors and .dtors if ctors_in_init_array.
2317 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2318 (Layout::output_section_name): Add relobj parameter. Change all
2319 callers. Handle .ctors. and .dtors. in code rather than table.
2320 Handle .ctors and .dtors if ctors_in_init_array.
2321 (Layout::match_file_name): New function, moved from output.cc.
2322 * layout.h (class Layout): Update declarations.
2323 * output.cc: Include "layout.h".
2324 (Input_section_sort_entry::get_priority): New function.
2325 (Input_section_sort_entry::match_file_name): Just call
2326 Layout::match_file_name.
2327 (Output_section::Input_section_sort_init_fini_compare::operator()):
2328 Handle .ctors and .dtors. Sort by explicit priority rather than
2330 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2331 * testsuite/initpri2.c: New test.
2332 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2333 (check_PROGRAMS): Add initpri2.
2334 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2335 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2336 * configure, testsuite/Makefile.in: Rebuild.
2338 2011-06-19 Ian Lance Taylor <iant@google.com>
2341 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2342 .interp section to a PT_INTERP segment even if we have seen a
2343 --dynamic-linker option. Don't do it if we have seen a PHDRS
2344 clause in a linker script.
2345 (Layout::finalize): Don't create a .interp section if we've
2346 already create a PT_INTERP segment.
2347 (Layout::create_interp): Always call choose_output_section (revert
2348 patch of 2011-06-17). Don't create PT_INTERP segment.
2349 * script-sections.cc
2350 (Script_sections::create_note_and_tls_segments): Add a .interp
2351 section to a PT_INTERP segment even if we have seen a
2352 --dynamic-linker option.
2354 2011-06-18 Ian Lance Taylor <iant@google.com>
2356 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2357 merely because a non-PT_LOAD segment has a dynamic reloc.
2359 2011-06-18 Ian Lance Taylor <iant@google.com>
2361 * layout.cc (Layout::finish_dynamic_section): Don't create
2362 DT_FLAGS entry if not needed.
2364 2011-06-18 Ian Lance Taylor <iant@google.com>
2367 * layout.cc (Layout::layout_eh_frame): Correct handling of
2368 writable .eh_frame section.
2370 2011-06-17 Ian Lance Taylor <iant@google.com>
2373 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2374 symbol is redefined with the exact same object and value.
2376 2011-06-17 Ian Lance Taylor <iant@google.com>
2379 * layout.h (class Layout): Add interp_segment_ field.
2380 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2381 (Layout::attach_allocated_section_to_segment): If making shared
2382 library, put .interp section in PT_INTERP segment.
2383 (Layout::finalize): Also call create_interp if -dynamic-linker
2385 (Layout::create_interp): Assert that there is no PT_INTERP
2386 segment. If not using a SECTIONS clause, use make_output_section.
2387 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2388 * script-sections.cc
2389 (Script_sections::create_note_and_tls_segments): If making shared
2390 library, put .interp section in PT_INTERP segment.
2392 2011-06-17 Ian Lance Taylor <iant@google.com>
2394 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2395 when making a shared library.
2397 2011-06-17 Ian Lance Taylor <iant@google.com>
2399 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2400 parameter. Change all callers. Don't issue warning about PC32
2401 against locally defined symbol.
2403 2011-06-16 Ian Lance Taylor <iant@google.com>
2405 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2406 occurs in same object.
2408 2011-06-14 Alan Modra <amodra@gmail.com>
2410 * po/POTFILES.in: Regenerate.
2412 2011-06-09 Ian Lance Taylor <iant@google.com>
2414 * script-sections.cc
2415 (Orphan_output_section::set_section_addresses): For a relocatable
2416 link set address to 0.
2418 2011-06-09 Cary Coutant <ccoutant@google.com>
2421 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2422 used with --compress-debug-sections.
2423 * gold/object.cc (Sized_relobj_file::do_layout): Report
2424 uncompressed size of compressed input sections.
2426 2011-06-08 Cary Coutant <ccoutant@google.com>
2429 * testsuite/two_file_test_2_v1.cc: Change initialization of
2430 v2 to keep it in .data.
2432 2011-06-07 Cary Coutant <ccoutant@google.com>
2434 * common.cc (Symbol_table::do_allocate_commons_list): Call
2436 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2437 (Errors::fallback): New function.
2438 (gold_fallback): New function.
2439 * errors.h (Errors::fallback): New function.
2440 * gold.cc (gold_exit): Change status parameter to enum; adjust
2442 (queue_initial_tasks): Call gold_fallback.
2443 * gold.h: Include cstdlib.
2444 (Exit_status): New enum type.
2445 (gold_exit): Change status parameter to enum.
2446 (gold_fallback): New function.
2447 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2448 (Layout::create_symtab_sections): Likewise.
2449 (Layout::create_shdrs): Likewise.
2450 * main.cc (main): Adjust call to gold_exit.
2451 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2452 (Output_data_got::add_got_entry_pair): Likewise.
2453 (Output_section::add_input_section): Likewise.
2454 (Output_section::add_output_section_data): Likewise.
2455 (Output_segment::set_section_list_addresses): Likewise.
2456 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2458 2011-06-07 Cary Coutant <ccoutant@google.com>
2460 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2461 for incremental links.
2462 * output.cc (Output_segment::set_section_list_addresses): Remove
2463 FIXME and test for TLS or BSS.
2465 2011-06-07 Cary Coutant <ccoutant@google.com>
2467 * testsuite/Makefile.am: Add incremental_copy_test,
2468 incremental_common_test_1.
2469 * testsuite/Makefile.in: Regenerate.
2470 * testsuite/common_test_1_v1.c: New source file.
2471 * testsuite/common_test_1_v2.c: New source file.
2472 * testsuite/copy_test_v1.cc: New source file.
2474 2011-06-07 Cary Coutant <ccoutant@google.com>
2476 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2477 update, allocate common from bss section's free list.
2478 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2479 linker-defined symbols.
2480 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2481 Skip GOT and PLT entries that are no longer referenced.
2482 (Output_section_incremental_inputs::write_info_blocks): Mark
2483 linker-defined symbols.
2484 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2485 * output.cc (Output_section::allocate): New function.
2486 * output.h (Output_section::allocate): New function.
2487 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2488 linker-defined symbols.
2489 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2490 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2491 (Symbol::init_base_output_data): Likewise.
2492 (Symbol::init_base_output_segment): Likewise.
2493 (Symbol::init_base_constant): Likewise.
2494 (Sized_symbol::init_output_data): Likewise.
2495 (Sized_symbol::init_output_segment): Likewise.
2496 (Sized_symbol::init_constant): Likewise.
2497 (Symbol_table::do_define_in_output_data): Likewise.
2498 (Symbol_table::do_define_in_output_segment): Likewise.
2499 (Symbol_table::do_define_as_constant): Likewise.
2500 * symtab.h (Symbol::is_predefined): New function.
2501 (Symbol::init_base_output_data): Add is_predefined parameter.
2502 (Symbol::init_base_output_segment): Likewise.
2503 (Symbol::init_base_constant): Likewise.
2504 (Symbol::is_predefined_): New data member.
2505 (Sized_symbol::init_output_data): Add is_predefined parameter.
2506 (Sized_symbol::init_output_segment): Likewise.
2507 (Sized_symbol::init_constant): Likewise.
2508 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2510 2011-06-07 Cary Coutant <ccoutant@google.com>
2512 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2513 instead of emit_copy_reloc.
2514 (Copy_relocs::emit_copy_reloc): Refactor.
2515 (Copy_relocs::make_copy_reloc): New function.
2516 (Copy_relocs::add_copy_reloc): Remove.
2517 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2519 (Copy_relocs::make_copy_reloc): New function.
2520 (Copy_relocs::add_copy_reloc): Remove.
2521 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2522 unchanged input files.
2523 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2524 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2525 Reserve BSS space for COPY relocations.
2526 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2527 (Output_section_incremental_inputs::write_info_blocks): Record
2528 whether a symbol is copied from a shared object.
2529 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2530 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2531 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2532 (Incremental_input_entry_reader::get_output_symbol_index): Add
2534 (Incremental_binary::emit_copy_relocs): New function.
2535 (Incremental_binary::do_emit_copy_relocs): New function.
2536 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2538 (Sized_incremental_binary::add_copy_reloc): New function.
2539 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2540 (Sized_incremental_binary::Copy_reloc): New struct.
2541 (Sized_incremental_binary::Copy_relocs): New typedef.
2542 (Sized_incremental_binary::copy_relocs_): New data member.
2543 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2544 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2545 * target.h (Sized_target::emit_copy_reloc): New function.
2546 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2548 2011-06-02 Cary Coutant <ccoutant@google.com>
2551 * gold/archive.cc (Archive::Archive): Initialize new data member.
2552 (Archive::include_all_members): Return if archive has already been
2554 * gold/archive.h (Archive::include_all_members_): New data member.
2556 2011-06-02 Nick Clifton <nickc@redhat.com>
2558 * dynobj.h: Fix spelling mistake in comment.
2559 * output.cc: Likewise.
2561 2011-05-31 Doug Kwan <dougkwan@google.com>
2565 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2566 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2567 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2568 redundant arm_exidx_test.so.
2569 * testsuite/Makefile.in: Regenerate.
2570 (check_SCRIPTS): Add pr12826.sh
2571 (check_DATA): Add pr12826.stdout
2572 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2573 * testsuite/pr12826.sh: New file.
2574 * testsuite/pr12826_1.s: Ditto.
2575 * testsuite/pr12826_1.s: Ditto.
2577 2011-05-30 Ian Lance Taylor <iant@google.com>
2579 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2582 2011-05-29 Ian Lance Taylor <iant@google.com>
2585 * testsuite/Makefile.am: Use different file name for two_file_test
2586 temporary file for each incremental test.
2587 * testsuite/Makefile.in: Rebuild.
2589 2011-05-29 Ian Lance Taylor <iant@google.com>
2591 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2592 binary input file is empty.
2594 2011-05-27 Ian Lance Taylor <iant@google.com>
2596 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2597 (ver_test_9.so): Likewise.
2598 * testsuite/Makefile.in: Rebuild.
2600 2011-05-26 Cary Coutant <ccoutant@google.com>
2602 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2603 * incremental.cc (Incremental_inputs::report_input_section): Fix
2604 comment, indentation.
2605 (Incremental_inputs::report_comdat_group): New function.
2606 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2607 of data for incremental input file entry.
2608 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2609 group count, COMDAT group signatures.
2610 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2611 an unchanged input file.
2612 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2613 Initialize new data member.
2614 (Incremental_object_entry::add_comdat_group): New function.
2615 (Incremental_object_entry::get_comdat_group_count): New function.
2616 (Incremental_object_entry::get_comdat_signature_key): New function.
2617 (Incremental_object_entry::groups_): New data member.
2618 (Incremental_inputs::report_comdat_group): New function.
2619 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2620 data for incremental input file entry.
2621 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2622 (Incremental_input_entry_reader::get_input_section): Adjust size of
2623 data for incremental input file entry.
2624 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2625 (Incremental_input_entry_reader::get_comdat_group_signature): New
2627 * object.cc (Sized_relobj::include_section_group): Report kept
2628 COMDAT groups for incremental links.
2630 2011-05-24 David Meyer <pdox@google.com>
2632 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2633 with name parameter. Add found_name parameter.
2634 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2635 * dirsearch.h (class Dirsearch): Update declaration.
2637 2011-05-24 Ian Lance Taylor <iant@google.com>
2639 * archive.cc (Library_base::should_include_member): Pull in object
2640 from archive if it defines the entry symbol.
2641 * parameters.cc (Parameters::entry): New function.
2642 * parameters.h (class Parameters): Declare entry.
2643 * output.h (class Output_file_header): Remove entry_ field.
2644 * output.cc (Output_file_header::Output_file_header): Remove entry
2645 parameter. Change all callers.
2646 (Output_file_header::entry): Use parameters->entry.
2647 * gold.cc (queue_middle_tasks): Likewise.
2648 * plugin.cc (Plugin_hook::run): Likewise.
2650 2011-05-24 Cary Coutant <ccoutant@google.com>
2652 * gold.cc (queue_initial_tasks): Pass incremental base filename
2653 to Output_file::open_base_file; don't print error message.
2654 * incremental-dump.cc (main): Adjust call to
2655 Output_file::open_for_modification.
2656 * incremental-dump.cc (main): Likewise.
2657 * incremental.cc (Incremental_inputs::report_command_line):
2658 Ignore --incremental-base option when comparing command lines.
2659 Ignore parameter when given as separate argument.
2660 * options.h (class General_options): Add --incremental-base.
2661 * output.cc (Output_file::Output_file):
2662 (Output_file::open_base_file): Add base_name and writable parameters;
2663 read base file into new file; print error message here.
2664 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2666 * output.h (Output_file::open_for_modification): Rename to...
2667 (Output_file::open_base_file): ...this; add base_name and
2668 writable parameters; adjust all callers.
2669 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2671 * testsuite/Makefile.am (incremental_test_4): Test
2673 * testsuite/Makefile.in: Regenerate.
2675 2011-05-24 Cary Coutant <ccoutant@google.com>
2677 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2679 * testsuite/Makefile.in: Regenerate.
2680 * testsuite/two_file_test_1_v1.cc: New test source file.
2681 * testsuite/two_file_test_1b_v1.cc: New test source file.
2682 * testsuite/two_file_test_2_v1.cc: New test source file.
2684 2011-05-24 Cary Coutant <ccoutant@google.com>
2686 * dynobj.h (Dynobj::do_dynobj): New function.
2687 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2688 flag and soname for shared objects.
2689 * incremental.cc (Incremental_inputs::report_object): Make
2690 either Incremental_object_entry or Incremental_dynobj_entry; add
2691 soname to string table.
2692 (Incremental_inputs::report_input_section): Add assertion.
2693 (Output_section_incremental_inputs::set_final_data_size): Adjust
2694 type of input file entry for shared libraries; adjust size of
2695 shared library info entry.
2696 (Output_section_incremental_inputs::write_input_files): Write
2697 as_needed flag for shared libraries.
2698 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2699 of input file entry for shared libraries; write soname.
2700 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2701 soname from incremental info.
2702 * incremental.h (enum Incremental_input_flags): Add
2703 INCREMENTAL_INPUT_AS_NEEDED.
2704 (Incremental_input_entry::Incremental_input_entry): Initialize new
2706 (Incremental_input_entry::set_as_needed): New function.
2707 (Incremental_input_entry::as_needed): New function.
2708 (Incremental_input_entry::do_dynobj_entry): New function.
2709 (Incremental_input_entry::as_needed_): New data member.
2710 (Incremental_object_entry::Incremental_object_entry): Don't check
2712 (Incremental_object_entry::do_type): Likewise.
2713 (class Incremental_dynobj_entry): New class.
2714 (Incremental_input_entry_reader::as_needed): New function.
2715 (Incremental_input_entry_reader::get_soname): New function.
2716 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2717 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2718 size of shared library info entry.
2719 * layout.cc (Layout::finish_dynamic_section): Don't test for
2720 incremental link when adding DT_NEEDED entries.
2721 * object.h (Object::Object): Initialize new data member.
2722 (Object::dynobj): New function.
2723 (Object::set_as_needed): New function.
2724 (Object::as_needed): New function.
2725 (Object::do_dynobj): New function.
2726 (Object::as_needed_): New data member.
2728 2011-05-24 Cary Coutant <ccoutant@google.com>
2730 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2731 info; adjust display of GOT entries.
2732 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2733 vector of input objects; remove file_status_.
2734 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2735 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2736 got_plt reader; call target hooks to reserve GOT entries.
2737 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2738 of input file info header and GOT info entry.
2739 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2741 (Got_plt_view_info::got_descriptor): Remove.
2742 (Got_plt_view_info::sym_index): New data member.
2743 (Got_plt_view_info::input_index): New data member.
2744 (Local_got_offset_visitor::visit): Write input file index.
2745 (Global_got_offset_visitor::visit): Write 0 for input file index.
2746 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2747 with sym_index and input_index.
2748 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2749 incremental info GOT entry; replace got_descriptor with input_index.
2750 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2751 map from input file index to object.
2752 (Sized_relobj_incr::do_layout): Replace direct data member reference
2753 with accessor function.
2754 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2755 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2756 Adjust size of input file info header.
2757 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2758 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2759 (Incremental_input_entry_reader::get_input_section): Adjust size of
2760 input file info header.
2761 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2762 of incremental info GOT entry.
2763 (Incremental_got_plt_reader::get_got_desc): Remove.
2764 (Incremental_got_plt_reader::get_got_symndx): New function.
2765 (Incremental_got_plt_reader::get_got_input_index): New function.
2766 (Sized_incremental_binary::Sized_incremental_binary): Remove
2767 file_status_; add input_objects_.
2768 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2769 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2770 (Sized_incremental_binary::file_is_unchanged): Remove.
2771 (Sized_incremental_binary::set_input_object): New function.
2772 (Sized_incremental_binary::input_object): New function.
2773 (Sized_incremental_binary::file_status_): Remove.
2774 (Sized_incremental_binary::input_objects_): New data member.
2775 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2777 (Sized_relobj_incr::invalid_address): Move to base class.
2778 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2780 (Sized_relobj_incr::do_output_section_offset): Likewise.
2781 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2782 (Sized_relobj_incr::section_offsets_): Likewise.
2783 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2785 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2786 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2787 with accessor function.
2788 (Sized_relobj_file::do_layout): Likewise.
2789 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2790 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2791 (Sized_relobj_file::compute_final_local_value): Replace refs to
2792 section_offsets_ with accessor function.
2793 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2794 * object.h (Relobj::Relobj): Initialize new data members.
2795 (Relobj::add_dyn_reloc): New function.
2796 (Relobj::first_dyn_reloc): New function.
2797 (Relobj::dyn_reloc_count): New function.
2798 (Relobj::first_dyn_reloc_): New data member.
2799 (Relobj::dyn_reloc_count_): New data member.
2800 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2802 (Sized_relobj::Address): New typedef.
2803 (Sized_relobj::invalid_address): Move here from child class.
2804 (Sized_relobj::Sized_relobj): Initialize new data members.
2805 (Sized_relobj::sized_relobj): New function.
2806 (Sized_relobj::is_output_section_offset_invalid): Move here from
2808 (Sized_relobj::get_output_section_offset): Likewise.
2809 (Sized_relobj::local_has_got_offset): Likewise.
2810 (Sized_relobj::local_got_offset): Likewise.
2811 (Sized_relobj::set_local_got_offset): Likewise.
2812 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2813 (Sized_relobj::clear_got_offsets): New function.
2814 (Sized_relobj::section_offsets): Move here from child class.
2815 (Sized_relobj::do_output_section_offset): Likewise.
2816 (Sized_relobj::do_set_section_offset): Likewise.
2817 (Sized_relobj::Local_got_offsets): Likewise.
2818 (Sized_relobj::local_got_offsets_): Likewise.
2819 (Sized_relobj::section_offsets_): Likewise.
2820 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2822 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2824 (Sized_relobj_file::sized_relobj): New function
2825 (Sized_relobj_file::local_has_got_offset): Move to base class.
2826 (Sized_relobj_file::local_got_offset): Likewise.
2827 (Sized_relobj_file::set_local_got_offset): Likewise.
2828 (Sized_relobj_file::get_output_section_offset): Likewise.
2829 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2830 (Sized_relobj_file::do_output_section_offset): Likewise.
2831 (Sized_relobj_file::do_set_section_offset): Likewise.
2832 (Sized_relobj_file::Local_got_offsets): Likewise.
2833 (Sized_relobj_file::local_got_offsets_): Likewise.
2834 (Sized_relobj_file::section_offsets_): Likewise.
2835 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2837 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2838 (Output_reloc::get_symbol_index): Likewise.
2839 (Output_reloc::local_section_offset): Likewise.
2840 (Output_reloc::get_address): Likewise.
2841 (Output_reloc::symbol_value): Likewise.
2842 (Output_data_got::reserve_slot): Move to class definition.
2843 (Output_data_got::reserve_local): New function.
2844 (Output_data_got::reserve_slot_for_global): Remove.
2845 (Output_data_got::reserve_global): New function.
2846 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2847 (all constructors, two instantiations).
2848 (Output_reloc::get_relobj): New function (two instantiations).
2849 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2850 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2851 (Output_data_reloc::add_global): Adjust type of relobj.
2852 (Output_data_reloc::add_global_relative): Likewise.
2853 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2854 (Output_data_reloc::add_local): Likewise.
2855 (Output_data_reloc::add_local_relative): Likewise.
2856 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2857 (Output_data_reloc::add_local_section): Likewise.
2858 (Output_data_reloc::add_output_section): Likewise.
2859 (Output_data_reloc::add_absolute): Likewise.
2860 (Output_data_reloc::add_target_specific): Likewise.
2861 (Output_data_got::reserve_slot): Move definition here.
2862 (Output_data_got::reserve_local): New function.
2863 (Output_data_got::reserve_global): New function.
2864 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2865 section_offsets_ with accessor function.
2866 (Sized_relobj_file::write_sections): Likewise.
2867 (Sized_relobj_file::do_relocate_sections): Likewise.
2868 * target.h (Sized_target::reserve_local_got_entry): New function.
2869 (Sized_target::reserve_global_got_entry): New function.
2870 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2871 (Target_x86_64::reserve_global_got_entry): New function.
2872 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2874 2011-05-23 Cary Coutant <ccoutant@google.com>
2876 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2877 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2878 bit when checking got_type.
2879 * incremental.cc (Sized_incremental_binary::setup_readers):
2880 Store symbol table and string table locations; initialize bit vector
2881 of file status flags.
2882 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2884 (Sized_incremental_binary::do_process_got_plt): New function.
2885 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2886 (Output_section_incremental_inputs::set_final_data_size): Record
2887 file index for each input file.
2888 (Output_section_incremental_inputs::write_got_plt): Store file index
2889 instead of input entry offset for each GOT entry.
2891 (Incremental_input_entry::Incremental_input_entry): Initialize new
2893 (Incremental_input_entry::set_offset): Store file index.
2894 (Incremental_input_entry::get_file_index): New function.
2895 (Incremental_input_entry::file_index_): New data member.
2896 (Incremental_binary::process_got_plt): New function.
2897 (Incremental_binary::do_process_got_plt): New function.
2898 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2900 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2901 (Sized_incremental_binary::set_file_is_unchanged): New function.
2902 (Sized_incremental_binary::file_is_unchanged): New function.
2903 (Sized_incremental_binary::do_process_got_plt): New function.
2904 (Sized_incremental_binary::file_status_): New data member.
2905 (Sized_incremental_binary::main_symtab_loc_): New data member.
2906 (Sized_incremental_binary::main_strtab_loc_): New data member.
2907 * output.cc (Output_data_got::Got_entry::write): Add case
2909 (Output_data_got::add_global): Call add_got_entry.
2910 (Output_data_got::add_global_plt): Likewise.
2911 (Output_data_got::add_global_with_rel): Likewise.
2912 (Output_data_got::add_global_with_rela): Likewise.
2913 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2914 (Output_data_got::add_global_pair_with_rela): Likewise.
2915 (Output_data_got::add_local): Call add_got_entry.
2916 (Output_data_got::add_local_plt): Likewise.
2917 (Output_data_got::add_local_with_rel): Likewise.
2918 (Output_data_got::add_local_with_rela): Likewise.
2919 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2920 (Output_data_got::add_local_pair_with_rela): Likewise.
2921 (Output_data_got::reserve_slot): New function.
2922 (Output_data_got::reserve_slot_for_global): New function.
2923 (Output_data_got::add_got_entry): New function.
2924 (Output_data_got::add_got_entry_pair): New function.
2925 (Output_section::add_output_section_data): Edit FIXME.
2927 (Output_section_data_build::Output_section_data_build): New
2928 constructor with size parameter.
2929 (Output_data_space::Output_data_space): Likewise.
2930 (Output_data_got::Output_data_got): Initialize new data member; new
2931 constructor with size parameter.
2932 (Output_data_got::add_constant): Call add_got_entry.
2933 (Output_data_got::reserve_slot): New function.
2934 (Output_data_got::reserve_slot_for_global): New function.
2935 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2936 (Output_data_got::add_got_entry): New function.
2937 (Output_data_got::add_got_entry_pair): New function.
2938 (Output_data_got::free_list_): New data member.
2939 * target.h (Sized_target::init_got_plt_for_update): New function.
2940 (Sized_target::register_global_plt_entry): New function.
2941 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2942 Initialize new data member; call init; add constructor with PLT count.
2943 (Output_data_plt_x86_64::init): New function.
2944 (Output_data_plt_x86_64::add_relocation): New function.
2945 (Output_data_plt_x86_64::reserve_slot): New function.
2946 (Output_data_plt_x86_64::free_list_): New data member.
2947 (Target_x86_64::init_got_plt_for_update): New function.
2948 (Target_x86_64::register_global_plt_entry): New function.
2949 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2950 incremental updates.
2951 (Output_data_plt_x86_64::add_relocation): New function.
2952 * testsuite/object_unittest.cc (Object_test): Set default options.
2954 2011-05-16 Ian Lance Taylor <iant@google.com>
2956 * options.h (class General_options): Make -i a synonym for -r.
2958 2011-05-16 Ian Lance Taylor <iant@google.com>
2960 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2962 2011-05-10 Cary Coutant <ccoutant@google.com>
2964 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2967 2011-05-06 Ian Lance Taylor <iant@google.com>
2969 * layout.cc (Layout::layout): If the output section flags change,
2970 update the ordering.
2972 2011-04-25 Cary Coutant <ccoutant@google.com>
2974 * incremental-dump.cc (dump_incremental_inputs): Print local
2975 symbol info for each input file.
2977 (Output_section_incremental_inputs::set_final_data_size): Add local
2978 symbol info to input file entries in incremental info.
2979 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2980 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2981 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2982 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2984 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2985 (Sized_incr_relobj::do_relocate): Write the local symbols.
2986 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2987 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2988 Adjust size of input file header.
2989 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2990 (Incremental_inputs_reader::get_local_symbol_count): New function.
2991 (Incremental_inputs_reader::get_input_section): Adjust size of input
2993 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2994 (Sized_incr_relobj::This): New typedef.
2995 (Sized_incr_relobj::sym_size): New const data member.
2996 (Sized_incr_relobj::Local_symbol): New struct.
2997 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2998 (Sized_incr_relobj::do_local_symbol_offset): New function.
2999 (Sized_incr_relobj::local_symbol_count_): New data member.
3000 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3001 (Sized_incr_relobj::local_symbol_index_): New data member.
3002 (Sized_incr_relobj::local_symbol_offset_): New data member.
3003 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3004 (Sized_incr_relobj::local_symbols_): New data member.
3005 * object.h (Relobj::output_local_symbol_count): New function.
3006 (Relobj::local_symbol_offset): New function.
3007 (Relobj::do_output_local_symbol_count): New function.
3008 (Relobj::do_local_symbol_offset): New function.
3009 (Sized_relobj::do_output_local_symbol_count): New function.
3010 (Sized_relobj::do_local_symbol_offset): New function.
3012 2011-04-22 Vladimir Simonov <sv@sw.ru>
3014 * descriptors.cc (set_close_on_exec): New function.
3015 (Descriptors::open): Use set_close_on_exec.
3016 * output.cc (S_ISLNK): Define if not defined.
3018 2011-04-22 Cary Coutant <ccoutant@google.com>
3020 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3022 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3023 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3024 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3026 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3027 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3028 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3030 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3032 (Incremental_binary::apply_incremental_relocs): New function.
3033 (Incremental_binary::do_apply_incremental_relocs): New function.
3034 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3036 (Sized_incremental_binary::add_global_symbol): New function.
3037 (Sized_incremental_binary::global_symbol): New function.
3038 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3039 (Sized_incremental_binary::symbol_map_): New data member.
3040 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3041 * target.h (Sized_target::apply_relocation): New function.
3042 * target-reloc.h (apply_relocation): New function.
3043 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3045 2011-04-22 Doug Kwan <dougkwan@google.com>
3047 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3048 flag of a SHT_ARM_EXIDX section.
3049 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3050 * testsuite/Makefile.in: Regenerate.
3051 * testsuite/arm_exidx_test.s: New file.
3052 * testsuite/arm_exidx_test.sh: Same.
3054 2011-04-20 Cary Coutant <ccoutant@google.com>
3057 * archive.h (Incremental_archive_entry::Archive_member):
3058 Initialize arg_serial_ (second constructor).
3060 2011-04-17 Ian Lance Taylor <iant@google.com>
3062 * object.cc (Relocate_info::location): Simplify location string.
3063 * errors.cc (Errors::error_at_location): Don't print program
3065 (Errors::warning_at_location): Likewise.
3066 (Errors::undefined_symbol): Likewise.
3067 * testsuite/debug_msg.sh: Update accordingly.
3069 2011-04-14 Cary Coutant <ccoutant@google.com>
3071 * gold/layout.cc (Layout::symtab_section_offset): New function.
3072 * gold/layout.h (Layout::symtab_section_offset): New function.
3073 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3075 2011-04-12 Ian Lance Taylor <iant@google.com>
3077 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3078 with MREMAP_MAYMOVE.
3079 * output.h (class Output_file): Add map_is_allocated_ field.
3080 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3081 not available, provide stubs. If mremap is not available, #define
3083 (MREMAP_MAYMOVE): Define if not defined.
3084 (Output_file::Output_file): Initialize map_is_allocated_.
3085 (Output_file::resize): Check map_is_allocated_.
3086 (Output_file::map_anonymous): If mmap fails, use malloc.
3087 (Output_file::unmap): Don't do anything for an anonymous map.
3088 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3089 is not available, provide stubs.
3090 (File_read::View::~View): Use free rather than delete[].
3091 (File_read::make_view): Use malloc rather than new[]. If mmap
3093 (File_read::find_or_make_view): Use malloc rather than new[].
3094 * gold.h: Remove HAVE_REMAP code.
3095 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3096 exists. Rename mremap to gold_mremap. If mmap is not available
3098 * configure, config.in: Rebuild.
3100 2011-04-11 Ian Lance Taylor <iant@google.com>
3102 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3103 initialize local variable v.
3105 2011-04-11 Cary Coutant <ccoutant@google.com>
3107 * archive.cc (Archive::include_member): Adjust call to
3109 (Add_archive_symbols::run): Track argument serial numbers.
3110 (Lib_group::include_member): Likewise.
3111 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3112 * archive.h (Incremental_archive_entry::Archive_member):
3113 Initialize arg_serial_.
3114 (Archive_member::arg_serial_): New data member.
3115 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3116 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3118 (Sized_dynobj::do_for_all_local_got_entries): New function.
3119 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3121 * fileread.cc (get_mtime): New function.
3122 * fileread.h (get_mtime): New function.
3123 * gold.cc (queue_initial_tasks): Check for incremental update.
3124 (process_incremental_input): New function.
3125 (queue_middle_tasks): Don't force valid target for incremental
3127 * incremental-dump.cc (find_input_containing_global): Adjust
3128 size of symbol info entry.
3129 (dump_incremental_inputs): Dump argument serial number and
3130 in_system_directory flag; bias shndx by 1; print symbol names
3131 when dumping per-file symbol lists; use new symbol info readers.
3133 (Output_section_incremental_inputs:update_data_size): New function.
3134 (Sized_incremental_binary::setup_readers): Setup input readers
3135 for each input file; build maps for files added from libraries
3137 (Sized_incremental_binary::check_input_args): New function.
3138 (Sized_incremental_binary::do_check_inputs): Build map of argument
3139 serial numbers to input arguments.
3140 (Sized_incremental_binary::do_file_has_changed): Rename
3141 do_file_is_unchanged to this; compare file modification times.
3142 (Sized_incremental_binary::do_init_layout): New function.
3143 (Sized_incremental_binary::do_reserve_layout): New function.
3144 (Sized_incremental_binary::do_get_input_reader): Remove.
3145 (Sized_incremental_binary::get_symtab_view): New function.
3146 (Incremental_checker::can_incrementally_link_output_file): Remove.
3147 (Incremental_inputs::report_command_line): Exclude --debug options.
3148 (Incremental_inputs::report_archive_begin): Add parameter; track
3149 argument serial numbers; don't put input file entry for archive
3150 before archive members.
3151 (Incremental_inputs::report_archive_end): Put input file entry
3152 for archive after archive members.
3153 (Incremental_inputs::report_object): Add parameter; track argument
3154 serial numbers and in_system_directory flag.
3155 (Incremental_inputs::report_script): Add parameter; track argument
3157 (Output_section_incremental_inputs::set_final_data_size): Adjust
3158 size of symbol info entry; check for forwarding symbols.
3159 (Output_section_incremental_inputs::write_input_files): Write
3160 in_system_directory flag and argument serial number.
3161 (Output_section_incremental_inputs::write_info_blocks): Map section
3162 indices between incremental info and original input file; store
3163 input section index for each symbol.
3164 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3165 change operator() to visit().
3166 (class Global_got_offset_visitor): Likewise.
3167 (class Global_symbol_visitor_got_plt):
3168 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3170 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3171 (Sized_incr_relobj::do_read_symbols): New function.
3172 (Sized_incr_relobj::do_layout): New function.
3173 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3174 (Sized_incr_relobj::do_add_symbols): New function.
3175 (Sized_incr_relobj::do_should_include_member): New function.
3176 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3177 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3178 (Sized_incr_relobj::do_section_size): New function.
3179 (Sized_incr_relobj::do_section_name): New function.
3180 (Sized_incr_relobj::do_section_contents): New function.
3181 (Sized_incr_relobj::do_section_flags): New function.
3182 (Sized_incr_relobj::do_section_entsize): New function.
3183 (Sized_incr_relobj::do_section_address): New function.
3184 (Sized_incr_relobj::do_section_type): New function.
3185 (Sized_incr_relobj::do_section_link): New function.
3186 (Sized_incr_relobj::do_section_info): New function.
3187 (Sized_incr_relobj::do_section_addralign): New function.
3188 (Sized_incr_relobj::do_initialize_xindex): New function.
3189 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3190 (Sized_incr_relobj::do_read_relocs): New function.
3191 (Sized_incr_relobj::do_gc_process_relocs): New function.
3192 (Sized_incr_relobj::do_scan_relocs): New function.
3193 (Sized_incr_relobj::do_count_local_symbols): New function.
3194 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3195 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3196 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3197 (Sized_incr_relobj::do_relocate): New function.
3198 (Sized_incr_relobj::do_set_section_offset): New function.
3199 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3200 (Sized_incr_dynobj::do_read_symbols): New function.
3201 (Sized_incr_dynobj::do_layout): New function.
3202 (Sized_incr_dynobj::do_add_symbols): New function.
3203 (Sized_incr_dynobj::do_should_include_member): New function.
3204 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3205 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3206 (Sized_incr_dynobj::do_section_size): New function.
3207 (Sized_incr_dynobj::do_section_name): New function.
3208 (Sized_incr_dynobj::do_section_contents): New function.
3209 (Sized_incr_dynobj::do_section_flags): New function.
3210 (Sized_incr_dynobj::do_section_entsize): New function.
3211 (Sized_incr_dynobj::do_section_address): New function.
3212 (Sized_incr_dynobj::do_section_type): New function.
3213 (Sized_incr_dynobj::do_section_link): New function.
3214 (Sized_incr_dynobj::do_section_info): New function.
3215 (Sized_incr_dynobj::do_section_addralign): New function.
3216 (Sized_incr_dynobj::do_initialize_xindex): New function.
3217 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3218 (make_sized_incremental_object): New function.
3219 (Incremental_library::copy_unused_symbols): New function.
3220 (Incremental_library::do_for_all_unused_symbols): New function.
3221 * incremental.h (enum Incremental_input_flags): New type.
3222 (class Incremental_checker): Remove.
3223 (Incremental_input_entry::Incremental_input_entry): Add argument
3225 (Incremental_input_entry::arg_serial): New function.
3226 (Incremental_input_entry::set_is_in_system_directory): New function.
3227 (Incremental_input_entry::is_in_system_directory): New function.
3228 (Incremental_input_entry::arg_serial_): New data member.
3229 (Incremental_input_entry::is_in_system_directory_): New data member.
3230 (class Script_info): Move here from script.h.
3231 (Script_info::Script_info): Add filename parameter.
3232 (Script_info::filename): New function.
3233 (Script_info::filename_): New data member.
3234 (Incremental_script_entry::Incremental_script_entry): Add argument
3236 (Incremental_object_entry::Incremental_object_entry): Likewise.
3237 (Incremental_object_entry::add_input_section): Build list of input
3238 sections with map to original shndx.
3239 (Incremental_object_entry::get_input_section_index): New function.
3240 (Incremental_object_entry::shndx_): New data member.
3241 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3242 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3243 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3245 (Incremental_inputs::report_archive_begin): Likewise.
3246 (Incremental_inputs::report_object): Likewise.
3247 (Incremental_inputs::report_script): Likewise.
3248 (class Incremental_global_symbol_reader): New class.
3249 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3250 and store flags and input file type.
3251 (Incremental_input_entry_reader::arg_serial): New function.
3252 (Incremental_input_entry_reader::type): Extract type from flags.
3253 (Incremental_input_entry_reader::is_in_system_directory): New function.
3254 (Incremental_input_entry_reader::get_input_section_count): Call
3255 accessor function for type.
3256 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3257 function for type; adjust size of global symbol entry.
3258 (Incremental_input_entry_reader::get_global_symbol_count): Call
3259 accessor function for type.
3260 (Incremental_input_entry_reader::get_object_count): Likewise.
3261 (Incremental_input_entry_reader::get_object_offset): Likewise.
3262 (Incremental_input_entry_reader::get_member_count): Likewise.
3263 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3264 (Incremental_input_entry_reader::get_member_offset): Likewise.
3265 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3266 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3267 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3268 (Incremental_input_entry_reader::get_global_symbol_reader): New
3270 (Incremental_input_entry_reader::get_output_symbol_index): New
3272 (Incremental_input_entry_reader::type_): Remove.
3273 (Incremental_input_entry_reader::flags_): New data member.
3274 (Incremental_inputs_reader::input_file_offset): New function.
3275 (Incremental_inputs_reader::input_file_index): New function.
3276 (Incremental_inputs_reader::input_file): Call input_file_offset.
3277 (Incremental_inputs_reader::input_file_at_offset): New function.
3278 (Incremental_relocs_reader::get_r_type): Reformat.
3279 (Incremental_relocs_reader::get_r_shndx): Reformat.
3280 (Incremental_relocs_reader::get_r_offset): Reformat.
3281 (Incremental_relocs_reader::data): New function.
3282 (Incremental_binary::Incremental_binary): Initialize new data members.
3283 (Incremental_binary::check_inputs): Add cmdline parameter.
3284 (Incremental_binary::file_is_unchanged): Remove.
3285 (Input_reader::arg_serial): New function.
3286 (Input_reader::get_unused_symbol_count): New function.
3287 (Input_reader::get_unused_symbol): New function.
3288 (Input_reader::do_arg_serial): New function.
3289 (Input_reader::do_get_unused_symbol_count): New function.
3290 (Input_reader::do_get_unused_symbol): New function.
3291 (Incremental_binary::input_file_count): New function.
3292 (Incremental_binary::get_input_reader): Change signature to use
3293 index instead of filename.
3294 (Incremental_binary::file_has_changed): New function.
3295 (Incremental_binary::get_input_argument): New function.
3296 (Incremental_binary::get_library): New function.
3297 (Incremental_binary::get_script_info): New function.
3298 (Incremental_binary::init_layout): New function.
3299 (Incremental_binary::reserve_layout): New function.
3300 (Incremental_binary::output_file): New function.
3301 (Incremental_binary::do_check_inputs): New function.
3302 (Incremental_binary::do_file_is_unchanged): Remove.
3303 (Incremental_binary::do_file_has_changed): New function.
3304 (Incremental_binary::do_init_layout): New function.
3305 (Incremental_binary::do_reserve_layout): New function.
3306 (Incremental_binary::do_input_file_count): New function.
3307 (Incremental_binary::do_get_input_reader): Change signature.
3308 (Incremental_binary::input_args_map_): New data member.
3309 (Incremental_binary::library_map_): New data member.
3310 (Incremental_binary::script_map_): New data member.
3311 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3313 (Sized_incremental_binary::output_section): New function.
3314 (Sized_incremental_binary::inputs_reader): Add const.
3315 (Sized_incremental_binary::symtab_reader): Add const.
3316 (Sized_incremental_binary::relocs_reader): Add const.
3317 (Sized_incremental_binary::got_plt_reader): Add const.
3318 (Sized_incremental_binary::get_symtab_view): New function.
3319 (Sized_incremental_binary::Inputs_reader): New typedef.
3320 (Sized_incremental_binary::Input_entry_reader): New typedef.
3321 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3322 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3323 (Sized_incremental_binary::do_file_has_changed): New function.
3324 (Sized_incremental_binary::do_init_layout): New function.
3325 (Sized_incremental_binary::do_reserve_layout): New function.
3326 (Sized_input_reader::Inputs_reader): Remove.
3327 (Sized_input_reader::Input_entry_reader): Remove.
3328 (Sized_input_reader::do_arg_serial): New function.
3329 (Sized_input_reader::do_get_unused_symbol_count): New function.
3330 (Sized_input_reader::do_get_unused_symbol): New function.
3331 (Sized_incremental_binary::do_input_file_count): New function.
3332 (Sized_incremental_binary::do_get_input_reader): Change signature;
3333 use index instead of filename.
3334 (Sized_incremental_binary::section_map_): New data member.
3335 (Sized_incremental_binary::input_entry_readers_): New data member.
3336 (class Sized_incr_relobj): New class.
3337 (class Sized_incr_dynobj): New class.
3338 (make_sized_incremental_object): New function.
3339 (class Incremental_library): New class.
3340 * layout.cc (Free_list::num_lists): New static data member.
3341 (Free_list::num_nodes): New static data member.
3342 (Free_list::num_removes): New static data member.
3343 (Free_list::num_remove_visits): New static data member.
3344 (Free_list::num_allocates): New static data member.
3345 (Free_list::num_allocate_visits): New static data member.
3346 (Free_list::init): New function.
3347 (Free_list::remove): New function.
3348 (Free_list::allocate): New function.
3349 (Free_list::dump): New function.
3350 (Free_list::print_stats): New function.
3351 (Layout_task_runner::run): Resize output file for incremental updates.
3352 (Layout::Layout): Initialize new data members.
3353 (Layout::set_incremental_base): New function.
3354 (Layout::init_fixed_output_section): New function.
3355 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3356 incremental updates.
3357 (Layout::create_gold_note): Do not create gold note section for
3358 incremental updates.
3359 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3360 for incremental updates.
3361 (Layout::set_section_offsets): For incremental updates, allocate space
3363 (Layout::create_symtab_sections): Layout with offsets relative to
3364 start of section; for incremental updates, allocate space from free
3366 (Layout::create_shdrs): For incremental updates, allocate space from
3368 (Layout::finish_dynamic_section): For incremental updates, do not
3369 check --as-needed (fixed in subsequent patch).
3370 * layout.h (class Free_list): New class.
3371 (Layout::set_incremental_base): New function.
3372 (Layout::incremental_base): New function.
3373 (Layout::init_fixed_output_section): New function.
3374 (Layout::allocate): New function.
3375 (Layout::incremental_base_): New data member.
3376 (Layout::free_list_): New data member.
3377 * main.cc (main): Print Free_list statistics.
3378 * object.cc (Relobj::finalize_incremental_relocs): Add
3379 clear_counts parameter; clear counts only when clear_counts is set.
3380 (Sized_relobj::Sized_relobj): Initialize new base class.
3381 (Sized_relobj::do_layout): Don't report special sections.
3382 (Sized_relobj::do_for_all_local_got_entries): New function.
3383 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3384 symtab_off to all symbol table offsets.
3385 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3386 * object.h (class Got_offset_list): Move to top of file.
3387 (Object::Object): Allow case where input_file == NULL.
3388 (Object::~Object): Likewise.
3389 (Object::input_file): Assert that input_file != NULL.
3390 (Object::lock): Allow case where input_file == NULL.
3391 (Object::unlock): Likewise.
3392 (Object::is_locked): Likewise.
3393 (Object::token): Likewise.
3394 (Object::release): Likewise.
3395 (Object::is_incremental): New function.
3396 (Object::get_mtime): New function.
3397 (Object::for_all_local_got_entries): New function.
3398 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3399 (Object::set_is_in_system_directory): New function.
3400 (Object::is_in_system_directory): New function.
3401 (Object::do_is_incremental): New function.
3402 (Object::do_get_mtime): New function.
3403 (Object::do_for_all_local_got_entries): New function.
3404 (Object::is_in_system_directory_): New data member.
3405 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3406 (class Sized_relobj_base): New class.
3407 (class Sized_relobj): Derive from Sized_relobj_base.
3408 (class Sized_relobj::Symbols): Redeclare from base class.
3409 (class Sized_relobj::local_got_offset_list): Remove.
3410 (class Sized_relobj::Output_sections): Redeclare from base class.
3411 (class Sized_relobj::do_for_all_local_got_entries): New function.
3412 (class Sized_relobj::write_local_symbols): Add offset parameter.
3413 (class Sized_relobj::local_symbol_offset_): Update comment.
3414 (class Sized_relobj::local_dynsym_offset_): Update comment.
3415 * options.cc (Input_arguments::add_file): Remove const.
3416 * options.h (Input_file_argument::Input_file_argument):
3417 Initialize arg_serial_ (all constructors).
3418 (Input_file_argument::set_arg_serial): New function.
3419 (Input_file_argument::arg_serial): New function.
3420 (Input_file_argument::arg_serial_): New data member.
3421 (Input_arguments::Input_arguments): Initialize file_count_.
3422 (Input_arguments::add_file): Remove const.
3423 (Input_arguments::number_of_input_files): New function.
3424 (Input_arguments::file_count_): New data member.
3425 (Command_line::number_of_input_files): Call
3426 Input_arguments::number_of_input_files.
3427 * output.cc (Output_segment_headers::Output_segment_headers):
3429 (Output_section::Input_section::current_data_size): New function.
3430 (Output_section::Output_section): Initialize new data members.
3431 (Output_section::add_input_section): Don't do merge sections for
3432 an incremental link; allocate space from free list for an
3434 (Output_section::add_output_section_data): Allocate space from
3435 free list for an incremental update.
3436 (Output_section::update_data_size): New function.
3437 (Output_section::set_fixed_layout): New function.
3438 (Output_section::reserve): New function.
3439 (Output_segment::set_section_addresses): Remove const.
3440 (Output_segment::set_section_list_addresses): Remove const; allocate
3441 space from free list for an incremental update.
3442 (Output_segment::set_offset): Adjust size of RELRO segment for an
3444 * output.h (Output_data::current_data_size): Move here from
3446 (Output_data::pre_finalize_data_size): New function.
3447 (Output_data::update_data_size): New function.
3448 (Output_section_headers::update_data_size): new function.
3449 (Output_section_data_build::current_data_size): Move to Output_data.
3450 (Output_data_strtab::update_data_size): New function.
3451 (Output_section::current_data_size): Move to Output_data.
3452 (Output_section::set_fixed_layout): New function.
3453 (Output_section::has_fixed_layout): New function.
3454 (Output_section::reserve): New function.
3455 (Output_section::update_data_size): New function.
3456 (Output_section::has_fixed_layout_): New data member.
3457 (Output_section::free_list_): New data member.
3458 (Output_segment::set_section_addresses): Remove const.
3459 (Output_segment::set_section_list_addresses): Remove const.
3460 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3462 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3464 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3465 parameter when calling Add_symbols constructor; store argument
3466 serial number for members of a lib group.
3467 (Add_symbols::locks): Allow case where token == NULL.
3468 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3469 (Read_member::~Read_member): New function.
3470 (Read_member::is_runnable): New function.
3471 (Read_member::locks): New function.
3472 (Read_member::run): New function.
3473 (Check_script::~Check_script): New function.
3474 (Check_script::is_runnable): New function.
3475 (Check_script::locks): New function.
3476 (Check_script::run): New function.
3477 (Check_library::~Check_library): New function.
3478 (Check_library::is_runnable): New function.
3479 (Check_library::locks): New function.
3480 (Check_library::run): New function.
3481 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3482 (Add_symbols::library_): New data member.
3483 (class Read_member): New class.
3484 (class Check_script): New class.
3485 (class Check_library): New class.
3486 * reloc.cc (Read_relocs::is_runnable): Allow case where
3488 (Read_relocs::locks): Likewise.
3489 (Scan_relocs::locks): Likewise.
3490 (Relocate_task::locks): Likewise.
3491 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3493 (Sized_relobj::incremental_relocs_scan): Fix comment.
3494 (Sized_relobj::do_relocate): Pass output file offset to
3495 write_local_symbols.
3496 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3497 from class declaration.
3498 * script.cc (read_input_script): Allocate Script_info; pass
3499 argument serial number to report_script.
3500 * script.h (class Script_info): Move to incremental.h.
3501 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3502 * symtab.h (Symbol_table::add_from_incrobj): New function.
3503 (Symbol_table::set_file_offset): New function.
3505 2011-04-05 Cary Coutant <ccoutant@google.com>
3507 * incremental-dump.cc (dump_incremental_inputs): Change signature
3508 to take a Sized_incremental_binary; change caller. Use readers
3509 in Sized_incremental_binary.
3511 (Sized_incremental_binary::find_incremental_inputs_sections):
3512 Rename do_find_incremental_inputs_sections to this.
3513 (Sized_incremental_binary::setup_readers): New function.
3514 (Sized_incremental_binary::do_check_inputs): Check
3515 has_incremental_info_ flag; move setup code to setup_readers;
3517 (Sized_incremental_binary::do_file_is_unchanged): New function.
3518 (Sized_incremental_binary::do_get_input_reader): New function.
3519 * incremental.h (class Incremental_binary): Move to end of file.
3520 (Incremental_binary::file_is_unchanged): New function.
3521 (Incremental_binary::do_file_is_unchanged): New function.
3522 (Incremental_binary::Input_reader): New class.
3523 (Incremental_binary::get_input_reader): New function.
3524 (class Sized_incremental_binary): Move to end of file.
3525 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3526 input section reader classes.
3527 (Sized_incremental_binary::has_incremental_info): New function.
3528 (Sized_incremental_binary::inputs_reader): New function.
3529 (Sized_incremental_binary::symtab_reader): New function.
3530 (Sized_incremental_binary::relocs_reader): New function.
3531 (Sized_incremental_binary::got_plt_reader): New function.
3532 (Sized_incremental_binary::do_file_is_unchanged): New function.
3533 (Sized_incremental_binary::Sized_input_reader): New class.
3534 (Sized_incremental_binary::get_input_reader): New function.
3535 (Sized_incremental_binary::find_incremental_inputs_sections):
3536 Rename do_find_incremental_inputs_sections to this.
3537 (Sized_incremental_binary::setup_readers): New function.
3538 (Sized_incremental_binary::has_incremental_info_): New data member.
3539 (Sized_incremental_binary::inputs_reader_): New data member.
3540 (Sized_incremental_binary::symtab_reader_): New data member.
3541 (Sized_incremental_binary::relocs_reader_): New data member.
3542 (Sized_incremental_binary::got_plt_reader_): New data member.
3543 (Sized_incremental_binary::current_input_file_): New data member.
3545 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3548 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3551 2011-03-30 Cary Coutant <ccoutant@google.com>
3553 * archive.cc (Archive::include_member): Adjust call to report_object.
3554 (Add_archive_symbols::run): Add script_info to call to
3555 report_archive_begin.
3556 (Lib_group::include_member): Adjust call to report_object.
3557 (Add_lib_group_symbols::run): Adjust call to report_object.
3558 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3559 blocks. Add object count for script input files.
3560 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3561 script_info parameter; change all callers.
3562 (Incremental_inputs::report_object): Add script_info parameter;
3564 (Incremental_inputs::report_script): Store backpointer to
3565 incremental info entry.
3566 (Output_section_incremental_inputs::set_final_data_size): Record
3567 additional information for scripts.
3568 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3569 * incremental.h (Incremental_script_entry::add_object): New function.
3570 (Incremental_script_entry::get_object_count): New function.
3571 (Incremental_script_entry::get_object): New function.
3572 (Incremental_script_entry::objects_): New data member; adjust
3574 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3575 (Incremental_inputs::report_object): Add script_info parameter.
3576 (Incremental_inputs_reader::get_object_count): New function.
3577 (Incremental_inputs_reader::get_object_offset): New function.
3578 * options.cc (Input_arguments::add_file): Return reference to
3580 * options.h (Input_argument::set_script_info): New function.
3581 (Input_argument::script_info): New function.
3582 (Input_argument::script_info_): New data member; adjust all
3584 (Input_file_group::add_file): Return reference to new input argument.
3585 (Input_file_lib::add_file): Likewise.
3586 (Input_arguments::add_file): Likewise.
3587 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3588 * script.cc (Parser_closure::Parser_closure): Add script_info
3589 parameter; adjust all callers.
3590 (Parser_closure::script_info): New function.
3591 (Parser_closure::script_info_): New data member.
3592 (read_input_script): Report scripts earlier to incremental info.
3593 (script_add_file): Set script_info in Input_argument.
3594 (script_add_library): Likewise.
3595 * script.h (Script_options::Script_info): Rewrite class.
3597 2011-03-29 Cary Coutant <ccoutant@google.com>
3599 * archive.cc (Library_base::should_include_member): Move
3600 method here from class Archive.
3601 (Archive::Archive): Initialize base class.
3602 (Archive::should_include_member): Move to base class.
3603 (Archive::do_for_all_unused_symbols): New function.
3604 (Add_archive_symbols::run): Remove redundant access to
3606 (Lib_group::Lib_group): Initialize base class.
3607 (Lib_group::do_filename): New function.
3608 (Lib_group::include_member): Pass pointer to Lib_group to
3610 (Lib_group::do_for_all_unused_symbols): New function.
3611 (Add_lib_group_symbols::run): Report archive information for
3613 * archive.h (class Library_base): New base class.
3614 (class Archive): Derive from Library_base.
3615 (Archive::filename): Move to base class.
3616 (Archive::set_incremental_info): Likewise.
3617 (Archive::incremental_info): Likewise.
3618 (Archive::Should_include): Likewise.
3619 (Archive::should_include_member): Likewise.
3620 (Archive::Armap_entry): Remove.
3621 (Archive::Unused_symbol_iterator): Remove.
3622 (Archive::unused_symbols_begin): Remove.
3623 (Archive::unused_symbols_end): Remove.
3624 (Archive::do_filename): New function.
3625 (Archive::do_get_mtime): New function.
3626 (Archive::do_for_all_unused_symbols): New function.
3627 (Archive::task_): Move to base class.
3628 (Archive::incremental_info_): Likewise.
3629 (class Lib_group): Derive from Library_base.
3630 (Lib_group::do_filename): New function.
3631 (Lib_group::do_get_mtime): New function.
3632 (Lib_group::do_for_all_unused_symbols): New function.
3633 (Lib_group::task_): Move to base class.
3634 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3636 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3638 * incremental.cc (Incremental_inputs::report_archive_begin):
3639 Use Library_base; call library's get_mtime; add incremental inputs
3640 entry before members.
3641 (class Unused_symbol_visitor): New class.
3642 (Incremental_inputs::report_archive_end): Use Library_base; use
3643 visitor class to record unused symbols; don't add incremental inputs
3644 entry after members.
3645 (Incremental_inputs::report_object): Use Library_base.
3647 (Incremental_archive_entry::Incremental_archive_entry): Remove
3648 unused Archive parameter.
3649 (Incremental_inputs::report_archive_begin): Use Library_base.
3650 (Incremental_inputs::report_archive_end): Likewise.
3651 (Incremental_inputs::report_object): Likewise.
3652 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3654 * object.h (Object::for_all_global_symbols): New function.
3655 (Object::do_for_all_global_symbols): New function.
3656 (Sized_relobj::do_for_all_global_symbols): New function.
3657 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3659 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3662 2011-03-27 Ian Lance Taylor <iant@google.com>
3664 * archive.cc (Archive::interpret_header): Return -1 if something
3665 goes wrong. Change callers accordingly.
3667 2011-03-25 Cary Coutant <ccoutant@google.com>
3669 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3670 * testsuite/Makefile.in: Regenerate.
3672 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3674 * plugin.cc (get_view): New.
3675 (Plugin::load): Pass get_view to the plugin.
3676 (Plugin_manager::get_view): New.
3678 2011-03-21 Ian Lance Taylor <iant@google.com>
3680 * testsuite/final_layout.sh: Rewrite to not use dc.
3681 * testsuite/relro_test.sh: Fail if dc is not present.
3683 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3685 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3687 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3688 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3690 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3691 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3693 2011-03-14 Ian Lance Taylor <iant@google.com>
3695 * script-sections.cc (Sort_output_sections::script_compare):
3696 Rename from is_before, change return type.
3697 (Sort_output_sections::operator()): Adjust accordingly.
3699 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3702 * testsuite/odr_violation2.cc: Add comment to make all error line
3703 numbers double digits.
3704 * testsuite/debug_msg.sh: Adjust expected errors.
3706 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3708 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3709 but mark earlier ones as non-canonical
3710 (offset_to_iterator): Update search target and example
3711 (do_addr2line): Return extra lines in a vector*
3712 (format_file_lineno): Extract from do_addr2line
3713 (one_addr2line): Add vector* out-param
3714 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3715 when a lineno entry appeared last for its instruction
3716 (Dwarf_line_info): Add vector* out-param
3717 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3718 * symtab.cc (Odr_violation_compare): Include the lineno in the
3720 (linenos_from_loc): New. Combine the canonical line for an
3721 address with its other lines.
3722 (True_if_intersect): New. Helper functor to make
3723 std::set_intersection a query.
3724 (detect_odr_violations): Compare sets of lines instead of just
3725 one line for each function. This became less deterministic, but
3726 has fewer false positives.
3727 * symtab.h: Declarations.
3728 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3729 mix an optimized and non-optimized object in the same binary
3730 (odr_violation2.so): Same.
3731 * testsuite/Makefile.in: Regenerate from Makefile.am.
3732 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3733 * testsuite/debug_msg.sh: Update line numbers and add
3735 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3736 non-optimized context.
3737 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3738 isn't inlined, and use OdrDerived in an optimized context.
3739 * testsuite/odr_header1.h: Defines OdrDerived, where
3740 optimization will change the
3741 first-instruction-in-the-destructor's file and line number.
3742 * testsuite/odr_header2.h: Defines OdrBase.
3744 2011-03-09 Ian Lance Taylor <iant@google.com>
3746 * fileread.cc (File_read::clear_views): Don't delete the whole
3749 2011-03-08 Ian Lance Taylor <iant@google.com>
3752 * fileread.cc: #include <climits>.
3753 (GOLD_IOV_MAX): Define.
3754 (File_read::read_multiple): Limit number of entries by iov_max.
3755 * fileread.h (class File_read): Always set max_readv_entries to
3758 2011-03-07 Ian Lance Taylor <iant@google.com>
3761 * options.h (class General_options): Add -dy and -dn.
3763 2011-03-02 Cary Coutant <ccoutant@google.com>
3765 * testsuite/script_test_9.t: Add TLS segment.
3767 2011-03-02 Simon Baldwin <simonb@google.com>
3769 * configure.ac: Add check for gnu_indirect_function support in
3770 the toolchain building binutils.
3771 * configure: Rebuild.
3773 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3775 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3776 plugin only symbols.
3777 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3778 in plugin files as not needed in the symbol table.
3780 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3782 * output.cc (Output_section::add_input_section): Delay fill
3783 generation for section ordering.
3785 2011-02-09 Ian Lance Taylor <iant@google.com>
3788 * object.h (class Sized_relobj): Remove clear_local_symbols.
3789 * reloc.cc (Sized_relobj::do_relocate): Don't call
3790 clear_local_symbols.
3792 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3794 * plugin.cc (is_visible_from_outside): Return true for symbols
3797 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3799 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3802 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3804 * icf.h (is_section_foldable_candidate): Change type of parameter
3806 * icf.cc (Icf::find_identical_sections): Change type of local variable
3807 section_name to be std::string.
3808 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3810 2011-01-25 Ian Lance Taylor <iant@google.com>
3812 * script.cc (script_add_extern): Rewrite to use
3813 add_symbol_reference.
3815 2011-01-25 Doug Kwan <dougkwan@google.com>
3817 * icf.cc (get_section_contents): Always lock section's object.
3819 2011-01-24 Ian Lance Taylor <iant@google.com>
3821 * options.h (class General_options): Accept
3822 --no-detect-odr-violations.
3824 2011-01-24 Ian Lance Taylor <iant@google.com>
3826 * version.cc (version_string): Bump to 1.11.
3828 2011-01-24 Ian Lance Taylor <iant@google.com>
3830 * plugin.cc (class Plugin_rescan): Define new class.
3831 (Plugin_manager::claim_file): Set any_claimed_.
3832 (Plugin_manager::save_archive): New function.
3833 (Plugin_manager::save_input_group): New function.
3834 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3836 (Plugin_manager::new_undefined_symbol): New function.
3837 (Plugin_manager::rescan): New function.
3838 (Plugin_manager::rescannable_defines): New function.
3839 (Plugin_manager::add_input_file): Set any_added_.
3840 * plugin.h (class Plugin_manager): define new fields rescannable_,
3841 undefined_symbols_, any_claimed_, and any_added_. Declare
3842 Plugin_rescan as friend. Declare new functions.
3843 (Plugin_manager::Rescannable): Define type.
3844 (Plugin_manager::Rescannable_list): Define type.
3845 (Plugin_manager::Undefined_symbol_list): Define type.
3846 (Plugin_manager::Plugin_manager): Initialize new fields.
3847 * archive.cc (Archive::defines_symbol): New function.
3848 (Add_archive_symbols::run): Pass archive to plugins if any.
3849 * archive.h (class Archive): Declare defines_symbol.
3850 * readsyms.cc (Input_group::~Input_group): New function.
3851 (Finish_group::run): Pass input_group to plugins if any.
3852 * readsyms.h (class Input_group): Declare destructor.
3853 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3856 2011-01-10 Ian Lance Taylor <iant@google.com>
3858 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3860 (Layout::set_segment_offsets): Reset increase_relro before calling
3861 set_section_addresses a second time.
3863 2011-01-04 Cary Coutant <ccoutant@google.com>
3865 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3866 sections before NOBITS sections.
3868 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3870 * version.cc (print_version): Update copyright to 2011.
3872 2010-12-23 Cary Coutant <ccoutant@google.com>
3874 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3875 of OS to this->add. Add OD parameter to second form of the function.
3877 2010-12-20 Ian Lance Taylor <iant@google.com>
3879 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3880 second of two consecutive entries with same offset.
3882 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3884 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3885 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3886 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3887 to avoid unneeded links against $(LDADD).
3888 * testsuite/Makefile.in: Regenerate.
3890 2010-12-15 Ian Lance Taylor <iant@google.com>
3893 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3894 for R_X86_64_32 and R_X86_64_PC32.
3895 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3896 ver_matching_def_pic.o.
3897 (ver_matching_def_pic.o): New target.
3899 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3901 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3902 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3903 Move definition before File_read::View member definitions.
3904 (File_read::View::~View): Initialize and hold lock before
3905 updating current_mapped_bytes.
3907 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3909 * dwarf_reader.cc: Remove outdated comment.
3910 * gold-threads.cc: Fix typo in error message.
3911 * archive.cc: Fix typos in comments.
3912 * archive.h: Likewise.
3913 * arm-reloc-property.cc: Likewise.
3914 * arm-reloc-property.h: Likewise.
3915 * arm-reloc.def: Likewise.
3917 * attributes.h: Likewise.
3918 * cref.cc: Likewise.
3919 * ehframe.cc: Likewise.
3920 * fileread.h: Likewise.
3922 * i386.cc: Likewise.
3924 * incremental.h: Likewise.
3925 * int_encoding.cc: Likewise.
3926 * layout.h: Likewise.
3927 * main.cc: Likewise.
3928 * merge.h: Likewise.
3929 * object.cc: Likewise.
3930 * object.h: Likewise.
3931 * options.cc: Likewise.
3932 * readsyms.cc: Likewise.
3933 * reduced_debug_output.cc: Likewise.
3934 * reloc.cc: Likewise.
3935 * script-sections.cc: Likewise.
3936 * sparc.cc: Likewise.
3937 * symtab.h: Likewise.
3938 * target-reloc.h: Likewise.
3939 * target.cc: Likewise.
3940 * target.h: Likewise.
3941 * timer.cc: Likewise.
3942 * timer.h: Likewise.
3943 * x86_64.cc: Likewise.
3945 2010-12-09 Cary Coutant <ccoutant@google.com>
3947 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3949 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3950 parameter; change all callers.
3951 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3952 * options.h (warn_execstack): New option.
3954 2010-12-07 Doug Kwan <dougkwan@google.com>
3956 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3957 like function call relocations.
3959 2010-12-07 Ian Lance Taylor <iant@google.com>
3961 * archive.cc (Archive::get_elf_object_for_member): Permit
3962 punconfigured to be NULL.
3963 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3964 (Archive::include_member): Pass NULL to get_elf_object_for_member
3965 if we searched for the archive and this is the first included
3968 2010-12-01 Ian Lance Taylor <iant@google.com>
3970 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3971 track_relocs_type_ field.
3972 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3973 Set track_relocs_type_.
3974 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3975 contents when using RELA relocs.
3976 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3978 * reloc.cc (Track_relocs::next_addend): New function.
3979 * reloc.h (class Track_relocs): Declare next_addend.
3981 2010-12-01 Ian Lance Taylor <iant@google.com>
3983 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3986 2010-12-01 Ian Lance Taylor <iant@google.com>
3988 * README: Update compilers known to work and fail.
3990 2010-11-23 Matthias Klose <doko@ubuntu.com>
3992 * configure.in: For --enable-gold, handle value `default' instead of
3993 `both*'. Always install ld as ld.bfd, install as ld if gold is
3995 * configure: Regenerate.
3997 2010-11-18 Doug Kwan <dougkwan@google.com>
3999 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4000 and right_alignment to be zero. Store result alignment only if it is
4001 greater than existing alignment.
4003 2010-11-16 Cary Coutant <ccoutant@google.com>
4006 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4007 Check for ".zdebug_line".
4009 2010-11-16 Doug Kwan <dougkwan@google.com>
4010 Cary Coutant <ccoutant@google.com>
4012 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4013 by reference; adjust all callers.
4014 * output.cc (Output_segment::set_section_addresses): Adjust references
4015 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4017 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4018 end at page boundary.
4020 2010-11-16 Cary Coutant <ccoutant@google.com>
4023 * layout.cc (Layout::choose_output_section): Transform names of
4024 compressed sections even when using a script with a SECTIONS clause.
4025 (Layout::output_section_name): Remove code to transform
4026 compressed debug section names.
4027 * output.cc (Output_section::add_input_section): Use uncompressed
4028 section size when tracking input sections.
4030 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4032 * symtab.h (Symbol::NON_PIC_REF): Remove.
4033 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4034 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4035 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4036 (Symbol::use_plt_offset): Take a flags argument and pass it
4037 directly to needs_dynamic_reloc. Restrict check for undefined
4038 weak symbols to function calls.
4039 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4040 (Target_arm::Scan::global): Use it.
4041 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4042 (Target_arm::Relocate::relocate): Likewise.
4043 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4044 parameter with an r_type parameter. Use get_reference_flags
4046 (Target_arm::Relocate::relocate): Update accordingly.
4047 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4048 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4049 (Target_i386::Scan::global): Likewise.
4050 (Target_i386::Relocate::relocate): Likewise.
4051 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4052 parameter with an r_type parameter. Use get_reference_flags
4054 (Target_i386::Relocate::relocate): Update accordingly.
4055 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4056 (Target_powerpc::Scan::global): Use it.
4057 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4058 (Target_powerpc::Relocate::relocate): Likewise.
4059 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4060 (Target_sparc::Scan::global): Use it.
4061 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4062 (Target_sparc::Relocate::relocate): Likewise.
4063 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4064 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4065 (Target_x86_64::Scan::global): Likewise.
4066 (Target_x86_64::Relocate::relocate): Likewise.
4068 2010-11-08 Doug Kwan <dougkwan@google.com>
4069 Cary Coutant <ccoutant@google.com>
4071 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4072 (Arm_exidx_merge_section::section_contents_): New data member.
4073 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4074 (Arm_input_section::~Arm_input_section): De-allocate memory.
4075 (Arm_input_section::original_contents_): New data member.
4076 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4077 in parameters instead of calling Object::section_contents without
4079 (Arm_output_section::group_section): New parameter TASK. Pass it
4080 to callees that need locking objects.
4081 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4082 to lock EXIDX input sections. Fix a formatting issue. Call
4083 Arm_exidx_merged_section::build_contents to create merged section
4085 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4086 to lock object of stub table owner.
4087 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4088 TEXT_SIZE to initialize data member TEXT_SIZE_.
4089 (Arm_exidx_input_section::addralign): Fix typo in comment.
4090 (Arm_exidx_input_section::text_size): New method.
4091 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4092 that require locking objects. Lock objects before scanning for stubs
4093 and updating local symbols.
4094 (Arm_input_section<big_endian>::init): Copy contents of original
4096 (Arm_input_section<big_endian>::do_write): Use saved contents of
4097 original input section instead of calling Object::section_contents
4099 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4100 size without calling Object::section_size().
4101 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4102 for size. Allocate a buffer for merged EXIDX entries.
4103 (Arm_exidx_merged_section::build_contents): New method.
4104 (Arm_exidx_merged_section::do_write): Move merge section contents
4105 building code to Arm_exidx_merged_section::build_contetns. Write
4106 out contetns in buffer instead of building it on the fly.
4107 (Arm_relobj::make_exidx_input_section): Also pass text section size
4108 to Arm_exidx_input_section constructor.
4109 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4110 (Arm_dynobj::do_read_symbols): Fix memory leak.
4111 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4112 * target.h: (class Task): Add forward declaration.
4113 (Target::relax): Add new parameter TASK and pass it to
4115 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4117 2010-11-05 Cary Coutant <ccoutant@google.com>
4120 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4121 object when reading from the file.
4122 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4124 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4125 when reading section contents.
4126 (get_section_contents): Likewise.
4127 (icf::find_identical_sections): Likewise.
4128 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4129 object when reading from the file.
4130 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4131 the object when doing deferred section layout.
4133 2010-11-03 Nick Clifton <nickc@redhat.com>
4136 * script.h (class Symbol_assignment: name): New member. Returns
4137 the name of the symbol.
4138 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4139 Returns true if the given symbol name is on the list of
4140 assignments wating to be processed.
4141 * archive.cc (should_incldue_member): If the symbol is undefined,
4142 check to see if it is on the list of symbols pending assignment.
4144 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4146 * script-sections.cc (Script_sections::find_memory_region): Check
4147 for a NULL output section pointer.
4149 2010-10-29 Doug Kwan <dougkwan@google.com>
4151 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4152 Output_section::add_relaxed_input_section.
4153 * output.cc (Output_section::add_relaxed_input_section): Add new
4154 arguments LAYOUT and NAME. Set section order index.
4155 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4156 Copy section order index.
4157 * output.h (Output_section::add_relaxed_input_section): Add new
4158 arguments LAYOUT and NAME.
4160 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4162 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4163 NATIVE_OR_CROSS_LINKER.
4164 * testsuite/Makefile.in: Regenerate.
4166 2010-10-20 Doug Kwan <dougkwan@google.com>
4168 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4169 without SHF_LINK_ORDER flags.
4170 * layout.cc (Layout::choose_output_section): Do not filter
4171 SHF_LINK_ORDER flag in a relocatable link.
4173 2010-10-17 Cary Coutant <ccoutant@google.com>
4175 * output.h (Output_segment::set_section_addresses): Change function
4176 signature. Update all callers.
4177 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4179 (Output_segment::set_section_addresses): Align after last TLS
4180 section. Add padding before last relro section instead of after.
4182 2010-10-17 Doug Kwan <dougkwan@google.com>
4184 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4185 GOT output section to be writable.
4187 2010-10-14 Cary Coutant <ccoutant@google.com>
4189 * debug.h (DEBUG_INCREMENTAL): New flag.
4190 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4191 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4193 * incremental.cc (report_command_line): Ignore all forms of
4195 * layout.cc (Layout::Layout): Check parameters for incremental link
4197 * options.cc (General_options::parse_incremental): New function.
4198 (General_options::parse_no_incremental): New function.
4199 (General_options::parse_incremental_full): New function.
4200 (General_options::parse_incremental_update): New function.
4201 (General_options::incremental_mode_): New data member.
4202 (General_options::finalize): Check incremental_mode_.
4203 * options.h (General_options): Update help text for --incremental.
4204 Add --no-incremental, --incremental-full, --incremental-update.
4205 (General_options::Incremental_mode): New enum type.
4206 (General_options::incremental_mode): New function.
4207 (General_options::incremental_mode_): New data member.
4208 * parameters.cc (Parameters::incremental_mode_): New data member.
4209 (Parameters::set_options): Set incremental_mode_.
4210 (Parameters::set_incremental_full): New function.
4211 (Parameters::incremental): New function.
4212 (Parameters::incremental_update): New function.
4213 (set_parameters_incremental_full): New function.
4214 * parameters.h (Parameters::set_incremental_full): New function.
4215 (Parameters::incremental): New function.
4216 (Parameters::incremental_update): New function.
4217 (Parameters::incremental_mode_): New data member.
4218 (set_parameters_incremental_full): New function.
4219 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4220 incremental link mode.
4221 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4222 (Sized_relobj::do_relocate_sections): Likewise.
4223 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4225 * testsuite/Makefile.in: Regenerate.
4226 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4228 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4230 * script-sections.h (class Script_sections): Make
4231 Sections_elements typedef public.
4232 * script-sections.cc (class Sort_output_sections): Add elements_
4233 field. Add constructor which sets it; change all callers.
4234 (Sort_output_sections::is_before): New function.
4235 (Sort_output_sections::operator()): Call is_before.
4236 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4238 * testsuite/script_test_10.sh: New test. Test script section
4240 * testsuite/script_test_10.t: Likewise.
4241 * testsuite/script_test_10.s: Likewise.
4242 * testsuite/Makefile.am: Wrap the cross linker tests and the
4243 common tests into NATIVE_OR_CROSS_LINKER.
4244 (check_SCRIPTS): Add script_test_10.sh.
4245 (check_DATA): Add script_test_10.stdout.
4246 (script_test_10.o, script_test_10): New targets.
4247 (script_test_10.stdout): New target.
4248 * configure, testsuite/Makefile.in: Regenerate.
4250 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4252 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4253 error for the deprecated relocations.
4254 (Target_arm::Scan::global): Likewise.
4255 (Target_arm::Relocate::relocate): Likewise.
4257 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4259 * fileread.cc (Input_file::find_file): Initialize *found_name
4260 and *namep when using the fallback search for case 4.
4262 2010-10-11 Cary Coutant <ccoutant@google.com>
4264 * options.h (class General_options): Redefine -z lazy as an alias for
4265 the negation of -z now.
4267 2010-10-11 Ian Lance Taylor <iant@google.com>
4269 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4272 2010-10-06 Nick Clifton <nickc@redhat.com>
4274 * script-sections.cc(class Memory_region): Remove
4275 current_lma_offset_ field. Rename current_vma_offset_ to
4276 current_offset_. Add last_section_ field.
4277 (Memory_region::get_current_vma_address): Rename to
4278 get_current_address.
4279 (Memory_region::get_current_lma_address): Delete.
4280 (Memory_region::increment_vma_offset): Rename to
4282 (Memory_region::increment_lma_offset): Delete.
4283 (Memory_region::attributes_compatible): New method. Returns
4284 true if the provided section is compatible with the region.
4285 (Memory_region::get_last_section): New method. Returns the last
4286 section to use the region.
4287 (Memory_region::set_last_section): New method. Stores the last
4288 section to use the region.
4289 (Script_sections::block_in_region): New method. Returns true if
4290 a block of memory is contained within a region.
4291 (Script_sections::find_memory_region): New method. Locates a
4292 memory region to be used to set a VMA or LMA address.
4293 (Output_section_definition::set_section_addresses): Add code to
4294 check for addresses set by memory regions.
4295 (Output_segment::set_section_addresses): Remove memory region
4297 (Script_sections::create_segment): Add a warning if a header
4298 segment is created outside of any region.
4299 * script-sections.h (class Script_sections): Add prototypes for
4300 find_memory_region and block_in_region methods.
4301 * testsuite/memory_test.s: Use .long instead of .word.
4302 * testsuite/memory_test.t: Add some more output sections.
4303 * testsuite/memory_test.sh: Update expected output.
4305 2010-10-02 Doug Kwan <dougkwan@google.com>
4307 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4308 defintion to symtab.h
4309 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4310 declaration to defintion.
4312 2010-10-01 Nick Clifton <nickc@redhat.com>
4314 * expression.cc (eval): Replace dummy argument with NULL.
4315 (eval_maybe_dot): Check for a NULL result section pointer.
4316 (Symbol_expression::value): Likewise.
4317 (Dot_expression::value): Likewise.
4318 (BINARY_EXPRESSION): Likewise.
4319 (Max_expression::value): Likewise.
4320 (Min_expression::value): Likewise.
4321 (Absolute_expression::value): Likewise.
4322 (Addr_expression::value_from_output_section): Likewise.
4323 (Loaddddr_expression::value_from_output_section): Likewise.
4324 (Segment_start_expression::value): Likewise.
4325 * script-sections.cc
4326 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4328 (Sections_elememt_dot_assignment::set_section_addresses):
4330 (Output_data_expression::do_write_to_buffer): Likewise.
4331 (Output_section_definition::finalize_symbols): Likewise.
4332 (Output_section_definition::set_section_addresses): Likewise.
4334 2010-09-30 Doug Kwan <dougkwan@google.com>
4336 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4338 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4340 * target.h (Target::can_icf_inline_merge_sections): New virtual
4342 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4344 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4346 * icf.cc (get_section_contents): Inline merge sections only when
4349 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4351 * configure: Regenerate.
4353 2010-09-17 Ian Lance Taylor <iant@google.com>
4355 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4356 * testsuite/Makefile.am (memory_test.o): New target.
4357 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4359 * testsuite/Makefile.in: Rebuild.
4361 2010-09-17 Doug Kwan <dougkwan@google.com>
4363 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4364 defintion if relocation uses GOT entries of the symbol.
4365 * testsuite/icf_safe_test.sh: Fix test.
4366 * testsuite/icf_safe_so_test.sh: Fix test.
4368 2010-09-16 Cary Coutant <ccoutant@google.com>
4370 * script_sections.cc (class Memory_region): Remove "NULL" from
4371 vector initializations.
4373 2010-09-15 Cary Coutant <ccoutant@google.com>
4375 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4376 Resolve forwarding symbols.
4378 2010-09-15 Doug Kwan <dougkwan@google.com>
4380 * gold/testsuite/script_test_3.t: Add ARM special sections.
4381 * gold/testsuite/script_test_4.t: Same.
4382 * gold/testsuite/script_test_5.t: Same.
4383 * gold/testsuite/script_test_6.t: Same.
4384 * gold/testsuite/script_test_7.t: Same.
4385 * gold/testsuite/script_test_7.t: Same.
4386 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4388 2010-09-14 Cary Coutant <ccoutant@google.com>
4390 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4391 (Target_x86_64::Relocate::relocate_tls): Replace check for
4392 saw_tls_block_reloc_ with test for executable section.
4394 2010-09-12 Cary Coutant <ccoutant@google.com>
4396 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4397 position-independent executables to shared libraries need dynamic
4399 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4400 position-independent executables.
4401 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4402 * testsuite/Makefile.in: Regenerate.
4404 2010-09-10 Nick Clifton <nickc@redhat.com>
4407 * testsuite/memory_test.t: Discard any sections that are not
4410 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4413 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4414 "This::" to work around a bug in gcc 4.2.
4416 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4418 2010-09-09 Rafael Espindola <espindola@google.com>
4420 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4421 sections with different PF_X flags in the same segment.
4422 (Layout::find_first_load_seg): Search all segments to find the first
4424 * options.h (rosegment): New.
4426 2010-09-08 Rafael Espindola <espindola@google.com>
4428 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4430 2010-09-08 Doug Kwan <dougkwan@google.com>
4432 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4433 (Arm_relobj::do_relocate_sections): Add new parameter for output
4434 file to match the parent.
4435 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4436 of local symbols instead of input values. Update code to track
4437 changes in gold::relocate_section.
4438 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4439 (Sized_relobj::compute_final_local_value_internal): New methods.
4440 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4441 body into private version of Sized_relobj::compute_final_local_value.
4442 Call the inline method.
4443 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4444 merged symbol value if there is one.
4445 (Symbol_value::has_output_value): New method defintiion.
4446 (Sized_relobj::Compute_final_local_value_status): New enum type.
4447 (Sized_relobj::compute_final_local_value): New methods.
4448 (Sized_relobj::compute_final_local_value_internal): New methods.
4449 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4450 and arm_cortex_a8.sh.
4451 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4452 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4454 * Makefile.in: Regenerate.
4455 * testsuite/arm_bl_out_of_range.s: Update test.
4456 * testsuite/thumb_bl_out_of_range.s: Ditto.
4457 * testsuite/thumb_blx_out_of_range.s: Ditto.
4458 * testsuite/arm_branch_out_of_range.sh: New file.
4459 * testsuite/arm_cortex_a8.sh: Ditto.
4460 * testsuite/arm_cortex_a8_b.s: Ditto.
4461 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4462 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4463 * testsuite/arm_cortex_a8_bl.s: Ditto.
4464 * testsuite/arm_cortex_a8_blx.s: Ditto.
4465 * testsuite/arm_cortex_a8_local.s: Ditto.
4466 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4467 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4469 2010-09-08 Rafael Espindola <espindola@google.com>
4471 * Makefile.am (memory_test.stdout): Run readelf with -W.
4472 * Makefile.in: Regenerate.
4473 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4476 2010-09-08 Rafael Espindola <espindola@google.com>
4478 * script-sections.cc (Script_sections::add_memory_region): Convert
4479 field precision to int.
4480 * script.cc (script_set_section_region, script_set_section_region):
4481 Convert field precision to int.
4483 2010-09-08 Rafael Espindola <espindola@google.com>
4485 * arm.cc (do_finalize_sections): Create the __exidx_start and
4486 __exdix_end symbols even when the section is missing.
4488 2010-09-08 Nick Clifton <nickc@redhat.com>
4490 * README: Remove claim that MEMORY is not supported.
4491 * expression.cc (script_exp_function_origin)
4492 (script_exp_function_length): Move from here to ...
4493 * script.cc: ... here.
4494 (script_set_section_region, script_add_memory)
4495 (script_parse_memory_attr, script_include_directive): New
4497 * script-sections.cc
4498 (class Memory_region): New class.
4499 (class Output_section_definition): Add set_memory_region,
4500 set_section_vma, set_section_lma and get_section_name methods.
4501 (class Script_Sections): Add add_memory_region,
4502 find_memory_region, find_memory_region_origin,
4503 find_memory_region_length and set_memory_region methods.
4504 Have set_section_addresses method walk the list of set memory
4506 Extend the print methos to display memory regions.
4507 * script-sections.h: Add prototypes for new methods.
4508 Add enum for MEMORY region attributes.
4509 * yyscript.y: Add support for parsing MEMORY regions.
4510 * script-c.h: Add prototypes for new functions.
4511 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4512 * testsuite/Makefile.in: Regenerate.
4513 * testsuite/memory_test.sh: New script.
4514 * testsuite/memory_test.s: New assembler source file.
4515 * testsuite/memory_test.t: New linker script.
4517 2010-08-27 Doug Kwan <dougkwan@google.com>
4519 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4520 reference override an existing dynamic weak reference.
4521 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4522 * testsuite/Makefile.in: Regenerate.
4523 * testsuite/dyn_weak_ref.sh: New file.
4524 * testsuite/dyn_weak_ref_1.c: Ditto.
4525 * testsuite/dyn_weak_ref_2.c: Ditto.
4527 2010-08-27 Ian Lance Taylor <iant@google.com>
4529 * incremental.h (class Incremental_input_entry): Add virtual
4532 2010-08-27 Ian Lance Taylor <iant@google.com>
4534 * testsuite/start_lib_test_3.c: Mark t3 as used.
4536 2010-08-27 Nick Clifton <nickc@redhat.com>
4538 * options.cc (version_script): Fix small typo in previous
4541 2010-08-25 Nick Clifton <nickc@redhat.com>
4543 * archive.cc: Formatting fixes: Remove whitespace between
4544 typename and following asterisk. Remove whitespace between
4545 function name and opening parenthesis.
4546 * archive.h: Likewise.
4548 * attributes.cc: Likewise.
4549 * attributes.h: Likewise.
4550 * common.cc: Likewise.
4551 * copy-relocs.cc: Likewise.
4552 * dirsearch.h: Likewise.
4553 * dynobj.cc: Likewise.
4554 * ehframe.cc: Likewise.
4555 * ehframe.h: Likewise.
4556 * expression.cc: Likewise.
4557 * fileread.cc: Likewise.
4558 * fileread.h: Likewise.
4560 * gold-threads.cc: Likewise.
4561 * gold.cc: Likewise.
4562 * i386.cc: Likewise.
4564 * incremental-dump.cc: Likewise.
4565 * incremental.cc: Likewise.
4566 * layout.cc: Likewise.
4567 * layout.h: Likewise.
4568 * main.cc: Likewise.
4569 * merge.cc: Likewise.
4570 * merge.h: Likewise.
4571 * object.cc: Likewise.
4572 * object.h: Likewise.
4573 * options.cc: Likewise.
4574 * options.h: Likewise.
4575 * output.cc: Likewise.
4576 * output.h: Likewise.
4577 * plugin.cc: Likewise.
4578 * plugin.h: Likewise.
4579 * powerpc.cc: Likewise.
4580 * reloc.cc: Likewise.
4581 * script-c.h: Likewise.
4582 * script-sections.cc: Likewise.
4583 * script.cc: Likewise.
4584 * stringpool.cc: Likewise.
4585 * symtab.cc: Likewise.
4586 * symtab.h: Likewise.
4587 * target.cc: Likewise.
4588 * timer.cc: Likewise.
4589 * timer.h: Likewise.
4590 * version.cc: Likewise.
4591 * x86_64.cc: Likewise.
4593 2010-08-24 Nick Clifton <nickc@redhat.com>
4596 * layout.cc (segment_precedes): Sort segments by their physical
4597 addresses, if they have been set.
4599 2010-08-23 Cary Coutant <ccoutant@google.com>
4601 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4603 (Lib_group::include_member): Unlock object after deleting its
4605 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4608 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4609 Cary Coutant <ccoutant@google.com>
4611 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4612 constructor, and set_blocker.
4613 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4615 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4616 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4617 * testsuite/Makefile.am (start_lib_test): New test case.
4618 * testsuite/Makefile.in: Regenerate.
4619 * testsuite/start_lib_test_main.c: New file.
4620 * testsuite/start_lib_test_1.c: New file.
4621 * testsuite/start_lib_test_2.c: New file.
4622 * testsuite/start_lib_test_3.c: New file.
4624 2010-08-19 Ian Lance Taylor <iant@google.com>
4626 * Makefile.in: Rebuild with automake 1.11.1.
4627 * aclocal.m4: Likewise.
4628 * testsuite/Makefile.in: Likewise.
4630 2010-08-19 Ian Lance Taylor <iant@google.com>
4633 * i386.cc (class Output_data_plt_i386): Update declarations.
4634 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4635 local_ifuncs_ fields.
4636 (Target_i386::do_plt_section_for_global): New function.
4637 (Target_i386::do_plt_section_for_local): New function.
4638 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4639 parameter; change all callers. Initialize global_ifuncs_ and
4640 local_ifuncs_. If doing a static link define __rel_iplt_start and
4642 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4643 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4644 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4646 (Target_i386::make_plt_section): New function, broken out of
4647 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4648 (Target_i386::make_plt_entry): Call make_plt_section.
4649 (Target_i386::make_local_ifunc_plt_entry): New function.
4650 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4651 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4652 R_386_IRELATIVE to switch.
4653 (Target_i386::Scan::global): Likewise.
4654 (Target_i386::Relocate::relocate): Likewise.
4655 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4657 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4658 (Target_x86_64::do_plt_section_for_global): New function.
4659 (Target_x86_64::do_plt_section_for_local): New function.
4660 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4661 parameter; change all callers. If doing a static link define
4662 __rela_iplt_start and __rela_iplt_end.
4663 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4664 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4665 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4667 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4668 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4670 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4671 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4672 R_X86_64_IRELATIVE to switch.
4673 (Target_x86_64::Scan::global): Likewise.
4674 (Target_x86_64::Relocate::relocate): Likewise.
4675 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4677 * target.h (class Target): Add plt_section_for_global and
4678 plt_section_for_local functions. Add do_plt_section_for_global
4679 and do_plt_section_for_local virtual functions.
4680 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4681 clarifying comments.
4682 (Symbol::use_plt_offset): Handle IFUNC symbol.
4683 * object.cc (Sized_relobj::Sized_relobj): Initialize
4685 (Sized_relobj::local_has_plt_offset): New function.
4686 (Sized_relobj::local_plt_offset): New function.
4687 (Sized_relobj::set_local_plt_offset): New function.
4688 (Sized_relobj::do_count): Handle IFUNC symbol.
4689 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4690 a bit away from input_shndx_ field. Add set_is_func_symbol and
4691 is_ifunc_symbol functions.
4692 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4693 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4694 local_plt_offsets_ field.
4695 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4696 * output.h (class Output_section_data): Add non-const
4697 output_section function.
4698 (class Output_data_got): Update declarations.
4699 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4700 Add use_plt_offset parameter to global and local constructors.
4701 Change all callers. Change local_sym_index_ field to 31 bits.
4702 Change GSYM_CODE and CONSTANT_CODE accordingly.
4703 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4704 doing a static link don't set sh_link field.
4705 (Output_data_got::Got_entry::write): Use PLT offset if
4707 (Output_data_got::add_global_plt): New function.
4708 (Output_data_got::add_local_plt): New function.
4709 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4710 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4711 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4712 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4713 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4715 * testsuite/ifunc-sel.h: New file.
4716 * testsuite/ifuncmain1.c: New file.
4717 * testsuite/ifuncmain1vis.c: New file.
4718 * testsuite/ifuncmod1.c: New file.
4719 * testsuite/ifuncdep2.c: New file.
4720 * testsuite/ifuncmain2.c: New file.
4721 * testsuite/ifuncmain3.c: New file.
4722 * testsuite/ifuncmod3.c: New file.
4723 * testsuite/ifuncmain4.c: New file.
4724 * testsuite/ifuncmain5.c: New file.
4725 * testsuite/ifuncmod5.c: New file.
4726 * testsuite/ifuncmain6pie.c: New file.
4727 * testsuite/ifuncmod6.c: New file.
4728 * testsuite/ifuncmain7.c: New file.
4729 * configure, testsuite/Makefile.in: Rebuild.
4731 2010-08-18 Ian Lance Taylor <iant@google.com>
4734 (Output_section_incremental_inputs::write_input_files): Add cast
4735 to avoid signed/unsigned comparison warning.
4736 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4738 2010-08-12 Cary Coutant <ccoutant@google.com>
4740 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4742 2010-08-13 Ian Lance Taylor <iant@google.com>
4744 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4746 2010-08-12 Cary Coutant <ccoutant@google.com>
4747 Doug Kwan <dougkwan@google.com>
4749 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4750 defintion overrides non-weak undef, remember that the original undef
4752 * symtab.cc (Symbol_table::sized_write_global): For undef without
4753 an original weak binding, set binding to global in output.
4754 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4755 * testsuite/Makefile.in: Regenerate.
4756 * testsuite/strong_ref_weak_def.sh: New file.
4757 * testsuite/strong_ref_weak_def_1.c: Ditto.
4758 * testsuite/strong_ref_weak_def_2.c: Ditto.
4760 2010-08-12 Cary Coutant <ccoutant@google.com>
4762 * testsuite/incremental_test.sh: Rewrite.
4763 * testsuite/incremental_test_1.c: Rewrite.
4764 * testsuite/incremental_test_2.c: Rewrite.
4766 2010-08-12 Cary Coutant <ccoutant@google.com>
4768 * arm.cc (Target_arm::got_size): Add const.
4769 (Target_arm::got_entry_count): New function.
4770 (Target_arm::plt_entry_count): New function.
4771 (Target_arm::first_plt_entry_offset): New function.
4772 (Target_arm::plt_entry_size): New function.
4773 (Output_data_plt_arm::entry_count): New function.
4774 (Output_data_plt_arm::first_plt_entry_offset): New function.
4775 (Output_data_plt_arm::get_plt_entry_size): New function.
4776 * i386.cc (Target_i386::got_size): Add const.
4777 (Target_i386::got_entry_count): New function.
4778 (Target_i386::plt_entry_count): New function.
4779 (Target_i386::first_plt_entry_offset): New function.
4780 (Target_i386::plt_entry_size): New function.
4781 (Output_data_plt_i386::entry_count): New function.
4782 (Output_data_plt_i386::first_plt_entry_offset): New function.
4783 (Output_data_plt_i386::get_plt_entry_size): New function.
4784 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4785 find_incremental_inputs_sections. Dump incremental_got_plt section.
4786 * incremental.cc: Include target.h.
4787 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4788 parameter. Adjust all callers. Find incremental_got_plt section.
4789 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4791 (Output_section_incremental_inputs::set_final_data_size): Calculate
4792 size of incremental_got_plt section.
4793 (Output_section_incremental_inputs::do_write): Write the
4794 incremental_got_plt section.
4795 (Got_plt_view_info): New struct.
4796 (Local_got_offset_visitor): New class.
4797 (Global_got_offset_visitor): New class.
4798 (Global_symbol_visitor_got_plt): New class.
4799 (Output_section_incremental_inputs::write_got_plt): New function.
4800 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4801 Add parameter. Adjust all callers.
4802 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4803 (Incremental_inputs::got_plt_section): New function.
4804 (Incremental_inputs::got_plt_section_): New data member.
4805 (Incremental_got_plt_reader): New class.
4806 * layout.cc (Layout::create_incremental_info_sections): Add the
4807 incremental_got_plt section.
4808 * object.h (Got_offset_list::get_list): New function.
4809 (Got offset_list::for_all_got_offsets): New function.
4810 (Sized_relobj::local_got_offset_list): New function.
4811 * powerpc.cc (Target_powerpc::got_size): Add const.
4812 (Target_powerpc::got_entry_count): New function.
4813 (Target_powerpc::plt_entry_count): New function.
4814 (Target_powerpc::first_plt_entry_offset): New function.
4815 (Target_powerpc::plt_entry_size): New function.
4816 (Output_data_plt_powerpc::entry_count): New function.
4817 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4818 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4819 * sparc.cc (Target_sparc::got_size): Add const.
4820 (Target_sparc::got_entry_count): New function.
4821 (Target_sparc::plt_entry_count): New function.
4822 (Target_sparc::first_plt_entry_offset): New function.
4823 (Target_sparc::plt_entry_size): New function.
4824 (Output_data_plt_sparc::entry_count): New function.
4825 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4826 (Output_data_plt_sparc::get_plt_entry_size): New function.
4827 * symtab.h (Symbol::got_offset_list): New function.
4828 (Symbol_table::for_all_symbols): New function.
4829 * target.h (Sized_target::got_entry_count): New function.
4830 (Sized_target::plt_entry_count): New function.
4831 (Sized_target::plt_entry_size): New function.
4832 * x86_64.cc (Target_x86_64::got_size): Add const.
4833 (Target_x86_64::got_entry_count): New function.
4834 (Target_x86_64::plt_entry_count): New function.
4835 (Target_x86_64::first_plt_entry_offset): New function.
4836 (Target_x86_64::plt_entry_size): New function.
4837 (Output_data_plt_x86_64::entry_count): New function.
4838 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4839 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4841 2010-08-12 Cary Coutant <ccoutant@google.com>
4843 * archive.cc: Include incremental.h.
4844 (Archive::Archive): Initialize incremental_info_.
4845 (Archive::include_member): Record archive members in incremental info.
4846 (Add_archive_symbols::run): Record begin and end of an archive in
4848 (Lib_group::include_member): Record objects in incremental info.
4849 * archive.h (Incremental_archive_entry): Forward declaration.
4850 (Archive::set_incremental_info): New member function.
4851 (Archive::incremental_info): New member function.
4852 (Archive::Unused_symbol_iterator): New class.
4853 (Archive::unused_symbols_begin): New member function.
4854 (Archive::unused_symbols_end): New member function.
4855 (Archive::incremental_info_): New data member.
4856 * incremental-dump.cc (find_input_containing_global): New function.
4857 (dump_incremental_inputs): Dump new incremental info sections.
4858 * incremental.cc: Include symtab.h.
4859 (Output_section_incremental_inputs): New class.
4860 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4861 new incremental info sections.
4862 (Sized_incremental_binary::do_check_inputs): Likewise.
4863 (Incremental_inputs::report_archive): Remove.
4864 (Incremental_inputs::report_archive_begin): New function.
4865 (Incremental_inputs::report_archive_end): New function.
4866 (Incremental_inputs::report_object): New function.
4867 (Incremental_inputs::finalize_inputs): Remove.
4868 (Incremental_inputs::report_input_section): New function.
4869 (Incremental_inputs::report_script): Rewrite.
4870 (Incremental_inputs::finalize): Do nothing but finalize string table.
4871 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4872 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4873 (Incremental_inputs::create_data_sections): New function.
4874 (Incremental_inputs::relocs_entsize): New function.
4875 (Output_section_incremental_inputs::set_final_data_size): New function.
4876 (Output_section_incremental_inputs::do_write): New function.
4877 (Output_section_incremental_inputs::write_header): New function.
4878 (Output_section_incremental_inputs::write_input_files): New function.
4879 (Output_section_incremental_inputs::write_info_blocks): New function.
4880 (Output_section_incremental_inputs::write_symtab): New function.
4881 * incremental.h (Incremental_script_entry): Forward declaration.
4882 (Incremental_object_entry): Forward declaration.
4883 (Incremental_archive_entry): Forward declaration.
4884 (Incremental_inputs): Forward declaration.
4885 (Incremental_inputs_header_data): Remove.
4886 (Incremental_inputs_header): Remove.
4887 (Incremental_inputs_header_write): Remove.
4888 (Incremental_inputs_entry_data): Remove.
4889 (Incremental_inputs_entry): Remove.
4890 (Incremental_inputs_entry_write): Remove.
4891 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4892 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4893 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4894 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4896 (Incremental_input_entry): New class.
4897 (Incremental_script_entry): New class.
4898 (Incremental_object_entry): New class.
4899 (Incremental_archive_entry): New class.
4900 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4901 (Incremental_inputs::report_inputs): Remove.
4902 (Incremental_inputs::report_archive): Remove.
4903 (Incremental_inputs::report_archive_begin): New function.
4904 (Incremental_inputs::report_archive_end): New function.
4905 (Incremental_inputs::report_object): Change prototype.
4906 (Incremental_inputs::report_input_section): New function.
4907 (Incremental_inputs::report_script): Change prototype.
4908 (Incremental_inputs::get_reloc_count): New function.
4909 (Incremental_inputs::set_reloc_count): New function.
4910 (Incremental_inputs::create_data_sections): New function.
4911 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4912 (Incremental_inputs::inputs_section): New function.
4913 (Incremental_inputs::symtab_section): New function.
4914 (Incremental_inputs::relocs_section): New function.
4915 (Incremental_inputs::get_stringpool): Add const.
4916 (Incremental_inputs::command_line): Add const.
4917 (Incremental_inputs::inputs): Remove.
4918 (Incremental_inputs::command_line_key): New function.
4919 (Incremental_inputs::input_file_count): New function.
4920 (Incremental_inputs::input_files): New function.
4921 (Incremental_inputs::relocs_entsize): New function.
4922 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4923 (Incremental_inputs::finalize_inputs): Remove.
4924 (Incremental_inputs::Input_info): Remove.
4925 (Incremental_inputs::lock_): Remove.
4926 (Incremental_inputs::inputs_): Change type.
4927 (Incremental_inputs::inputs_map_): Remove.
4928 (Incremental_inputs::current_object_entry_): New data member.
4929 (Incremental_inputs::inputs_section_): New data member.
4930 (Incremental_inputs::symtab_section_): New data member.
4931 (Incremental_inputs::relocs_section_): New data member.
4932 (Incremental_inputs::reloc_count_): New data member.
4933 (Incremental_inputs_reader): New class.
4934 (Incremental_symtab_reader): New class.
4935 (Incremental_relocs_reader): New class.
4936 * layout.cc (Layout::finalize): Move finalization of incremental info
4937 and creation of incremental info sections to follow finalization of
4938 symbol table. Set offsets for postprocessing sections.
4939 (Layout::create_incremental_info_sections): Call
4940 Incremental_inputs::create_data_sections. Add incremental symtab
4941 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4942 sections to layout after input sections.
4943 * layout.h (struct Timespec): Forward declaration.
4944 (Layout::incremental_inputs): Add const.
4945 (Layout::create_incremental_info_sections): Add parameter.
4946 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4947 * object.cc: Include incremental.h.
4948 (Relobj::finalize_incremental_relocs): New function.
4949 (Sized_relobj::do_layout): Record input sections in incremental info.
4950 * object.h (Object::output_section): New function.
4951 (Object::output_section_offset): Moved from Relobj.
4952 (Object::get_incremental_reloc_base): New function.
4953 (Object::get_incremental_reloc_count): New function.
4954 (Object::do_output_section): New function.
4955 (Object::do_output_section_offset): Moved from Relobj.
4956 (Object::do_get_incremental_reloc_base): New function.
4957 (Object::do_get_incremental_reloc_count): New function.
4958 (Object::Object): Initialize new data members.
4959 (Relobj::output_section): Renamed do_output_section and moved to
4961 (Relobj::output_section_offset): Moved to Object.
4962 (Relobj::do_get_incremental_reloc_base): New function.
4963 (Relobj::do_get_incremental_reloc_count): New function.
4964 (Relobj::allocate_incremental_reloc_counts): New function.
4965 (Relobj::count_incremental_reloc): New function.
4966 (Relobj::finalize_incremental_relocs): New function.
4967 (Relobj::next_incremental_reloc_index): New function.
4968 (Relobj::reloc_counts_): New data member.
4969 (Relobj::reloc_bases_): New data member.
4970 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4971 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4972 (Sized_relobj::incremental_relocs_scan): New function.
4973 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4974 (Sized_relobj::incremental_relocs_write): New function.
4975 (Sized_relobj::incremental_relocs_write_reltype): New function.
4976 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4978 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4979 archives and object files elsewhere.
4980 (Add_symbols::run): Report object files here.
4981 (Finish_group::run): Report end of archive at end of group.
4982 * reloc.cc: Include layout.h, incremental.h.
4983 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4984 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4985 (Sized_relobj::incremental_relocs_scan): New function.
4986 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4987 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4988 (Sized_relobj::incremental_relocs_write): New function.
4989 (Sized_relobj::incremental_relocs_write_reltype): New function.
4990 * script.cc (read_input_script): Rewrite test for incremental link.
4991 Change call to Incremental_inputs::report_script.
4992 * symtab.h (Symbol_table::first_global_index): New function.
4993 (Symbol_table::output_count): New function.
4995 2010-08-12 Doug Kwan <dougkwan@google.com>
4997 * arm.cc (Target_arm::merge_object_attributes): Check command line
4998 options --no-wchar-size-warning and --no-enum-size-warning.
4999 * options.h (General_options): Add ld-compatible options
5000 --no-enum-size-warning and --no-wchar-size-warning.
5002 2010-08-04 Ian Lance Taylor <iant@google.com>
5004 * x86_64.cc (Target_x86_64::Scan::local): Use
5005 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5006 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5007 (Target_x86_64::Scan::global): Likewise.
5008 (Target_x86_64::Relocate::relocate): Likewise.
5009 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5012 2010-08-03 Cary Coutant <ccoutant@google.com>
5014 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5015 to reserve space in merged_strings vector. Keep total input size
5017 (Output_merge_string::do_print_merge_stats): Print total input size.
5018 * merge.h (Output_merge_string): Add input_size_ field.
5019 * stringpool.cc (Stringpool_template::string_length): Move
5020 implementations out of Stringpool_template class and place in
5022 * stringpool.h (string_length): Move out of Stringpool_template.
5024 2010-08-03 Ian Lance Taylor <iant@google.com>
5027 * layout.cc (relaxation_loop_body): If address of load segment is
5028 set, adjust address to include headers if possible.
5030 2010-08-03 Ian Lance Taylor <iant@google.com>
5032 * version.cc (version_string): Bump to 1.10.
5034 2010-08-03 Ian Lance Taylor <iant@google.com>
5037 * layout.h (enum Output_section_order): Define.
5038 (class Layout): Update declarations.
5039 * layout.cc (Layout::get_output_section): Add order parameter.
5040 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5041 is_first_non_relro parameters. Change all callers.
5042 (Layout::choose_output_section): Likewise.
5043 (Layout::add_output_section_data): Likewise.
5044 (Layout::make_output_section): Likewise. Set order.
5045 (Layout::default_section_order): New function.
5046 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5047 * output.cc (Output_section::Output_section): Initialize order_.
5048 Don't initialize deleted fields.
5049 (Output_segment::Output_segment): Don't initialize deleted
5051 (Output_segment::add_output_section_to_load): New function
5052 replacing add_output_section. Change all callers to call this or
5053 add_output_section_to_nonload.
5054 (Output_segment::add_output_section_to_nonload): New function.
5055 (Output_segment::remove_output_section): Rewrite.
5056 (Output_segment::add_initial_output_data): Likewise.
5057 (Output_segment::has_any_data_sections): Likewise.
5058 (Output_segment::is_first_section_relro): Likewise.
5059 (Output_segment::maximum_alignment): Likewise.
5060 (Output_segment::has_dynamic_reloc): New function replacing
5061 dynamic_reloc_count. Change all callers.
5062 (Output_segment::has_dynamic_reloc_list): New function replacing
5063 dynamic_reloc_count_list. Change all callers.
5064 (Output_segment::set_section_addresses): Rewrite.
5065 (Output_segment::set_offset): Rewrite.
5066 (Output_segment::find_first_and_last_list): Remove.
5067 (Output_segment::set_tls_offsets): Rewrite.
5068 (Output_segment::first_section_load_address): Likewise.
5069 (Output_segment::output_section_count): Likewise.
5070 (Output_segment::section_with_lowest_load_address): Likewise.
5071 (Output_segment::write_section_headers): Likewise.
5072 (Output_segment::print_sections_to_map): Likewise.
5073 * output.h (class Output_data): Remove dynamic_reloc_count_
5074 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5075 (Output_data::add_dynamic_reloc): Rewrite.
5076 (Output_data::has_dynamic_reloc): New function.
5077 (Output_data::dynamic_reloc_count): Remove.
5078 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5079 is_last_relro_, is_first_non_relro_, is_interp_,
5080 is_dynamic_linker_section_ fields. Add order and set_order
5081 functions. Remove is_relro_local, set_is_relro_local,
5082 is_last_relro, set_is_last_relro, is_first_non_relro,
5083 set_is_first_non_relro functions, is_interp, set_is_interp,
5084 is_dynamic_linker_section, and set_is_dynamic_linker_section
5086 (class Output_segment): Change Output_data_list from std::list to
5087 std:;vector. Add output_lists_ field. Remove output_data_ and
5088 output_bss_ fields. Update declarations.
5090 2010-08-02 Ian Lance Taylor <iant@google.com>
5092 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5093 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5094 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5096 2010-08-02 Ian Lance Taylor <iant@google.com>
5099 * script.cc (Script_options::Script_options): Initialize
5100 symbol_definitions_ and symbol_references_.
5101 (Script_options::add_symbol_assignment): Update
5102 symbol_definitions_ and symbol_references_.
5103 (Script_options::add_symbol_reference): New function.
5104 (script_symbol): New function.
5105 * script.h (class Script_options): Add symbol_definitions_ and
5106 symbol_references_ fields.
5107 (Script_options::referenced_const_iterator): New type.
5108 (Script_options::referenced_begin): New function.
5109 (Script_options::referenced_end): New function.
5110 (Script_options::is_referenced): New function.
5111 (Script_options::any_unreferenced): New function.
5112 * script-c.h (script_symbol): Declare.
5113 * yyscript.y (exp): Call script_symbol.
5114 * symtab.cc: Include "script.h".
5115 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5116 Change all callers. Check symbols referenced by scripts.
5117 (Symbol_table::add_undefined_symbols_from_command_line): Add
5118 layout parameter. Change all callers.
5119 (Symbol_table::do_add_undefined_symbols_from_command_line):
5120 Likewise. Break out loop body. Check symbols referenced by
5122 (Symbol_table::add_undefined_symbol_from_command_line): New
5123 function broken out of
5124 do_add_undefined_symbols_from_command_line.
5125 * symtab.h (class Symbol_table): Update declarations.
5126 * archive.cc: Include "layout.h".
5127 (Archive::should_include_member): Add layout parameter. Change
5128 all callers. Check for symbol mentioned in expression.
5129 * archive.h (class Archive): Update declaration.
5130 * object.cc (Sized_relobj::do_should_include_member): Add layout
5132 * object.h (Object::should_include_member): Add layout parameter.
5134 (Object::do_should_include_member): Add layout parameter.
5135 (class Sized_relobj): Update declaration.
5136 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5138 * dynobj.h (class Sized_dynobj): Update declaration.
5139 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5141 * plugin.h (class Sized_pluginobj): Update declaration.
5143 2010-08-02 Ian Lance Taylor <iant@google.com>
5146 * output.cc (Output_segment::set_offset): Search for the first and
5147 last sections rather than assuming that the list is in order.
5148 (Output_segment::find_first_and_last_list): New function.
5149 * output.h (class Output_segment): Update declarations.
5150 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5151 (relro_strip_test_SOURCES): New variable.
5152 (relro_strip_test_DEPENDENCIES): New variable.
5153 (relro_strip_test_LDFLAGS): New variable.
5154 (relro_strip_test_LDADD): New variable.
5155 (relro_strip_test.so): New target.
5157 2010-08-02 Ian Lance Taylor <iant@google.com>
5159 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5160 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5161 (Target_i386::got_tlsdesc_section): New function.
5162 (Target_i386::got_section): Create space for GOT entries for
5163 TLSDESC relocations.
5164 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5166 (Target_i386::Scan::global): Likewise.
5167 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5169 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5170 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5171 (Target_x86_64::got_tlsdesc_section): New function.
5172 (Target_x86_64::got_section): Create space for GOT entries for
5173 TLSDESC relocations.
5174 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5176 (Target_x86_64::Scan::global): Likewise.
5177 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5180 2010-08-02 Ian Lance Taylor <iant@google.com>
5182 * testsuite/final_layout.sh: Use dc to convert from hex to
5185 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5187 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5188 paramter to the call to gold::gc_process_relocs.
5189 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5190 paramter to the call to gold::gc_process_relocs.
5191 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5192 parameter to the call to gold::gc_process_relocs.
5193 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5194 template parameter to the call to gold::gc_process_relocs.
5195 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5196 paramter to the call to gold::gc_process_relocs.
5197 * gc.h (get_embedded_addend_size): New function.
5198 (gc_process_relocs): Save the size of the reloc for use by ICF.
5199 * icf.cc (get_section_contents): Get the addend from the text section
5200 for SHT_REL relocation sections.
5201 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5202 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5203 * int_encoding.h (read_from_pointer): New overloaded function.
5204 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5205 * testsuite/icf_sht_rel_addend_test.sh: New file.
5206 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5207 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5209 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5211 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5212 * Makefile.in: Regenerate.
5213 * testsuite/Makefile.in: Regenerate.
5215 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5217 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5218 * gold/testsuite/debug_msg.cc: Likewise.
5219 * gold/testsuite/odr_violation1.cc
5220 * gold/testsuite/odr_violation2.cc
5222 2010-07-21 Cary Coutant <ccoutant@google.com>
5224 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5225 string, and length fields.
5226 (Output_merge_string::Merged_strings_list): New type.
5227 (Output_merge_string::Merged_strings_lists): New typedef.
5228 (Output_merge_string): Replace merged_strings_ with
5229 merged_strings_lists_.
5230 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5231 Merged_strings_list per input object and section. Don't store pointer
5232 to the string. Don't store length with each merged string entry.
5233 (Output_merge_string::finalize_merged_data): Loop over list of merged
5234 strings lists. Recompute length of each merged string.
5236 2010-07-15 Cary Coutant <ccoutant@google.com>
5238 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5241 2010-07-14 Ian Lance Taylor <iant@google.com>
5243 * descriptors.cc (Descriptors::open): Report correct name in error
5246 2010-07-13 Doug Kwan <dougkwan@google.com>
5248 * arm.cc (Arm_input_section::Arm_input_section): For a
5249 SHT_ARM_EXIDX section, always keeps the input sections.
5250 (Arm_input_section::set_exidx_section_link): New method.
5251 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5252 has_errors_ to false.
5253 (Arm_exidx_input_section::has_errors,
5254 Arm_exidx_input_section::set_has_errors): New methods.
5255 (Arm_exidx_input_section::has_errors_): New data member.
5256 (Arm_relobj::get_exidx_shndx_list): New method.
5257 (Arm_output_section::append_text_sections_to_list): Do not skip
5258 section without SHF_EXECINSTR.
5259 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5261 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5262 section header. Make error messages more verbose. Check for
5263 a non-executable section linked to an EXIDX section.
5264 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5265 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5266 check that there is no deferred EXIDX section if we exit early.
5267 Instead of not making an EXIDX section in case of an error, make one
5268 and set the has_errors flag of it.
5269 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5270 in a relocatable link.
5271 (Target_arm::do_relax): Look for the EXIDX output section instead of
5272 assuming that it is called .ARM.exidx.
5273 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5274 section list. Do not check for SHF_EXECINSTR section flags but
5275 skip any input section with errors.
5276 * output.cc (Output_section::Output_section): Initialize
5277 always_keeps_input_sections_ to false.
5278 (Output_section::add_input_section): Check for
5279 always_keeps_input_sections_.
5280 * output.h (Output_section::always_keeps_input_sections,
5281 Output_section::set_always_keeps_input_sections): New methods.
5282 (Output_section::always_keeps_input_sections): New data member.
5284 2010-07-13 Rafael Espindola <espindola@google.com>
5286 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5287 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5289 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5290 Ian Lance Taylor <iant@google.com>
5292 * output.h (Output_section_lookup_maps::add_merge_section):
5293 Correct check of whether value was inserted.
5294 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5295 (Output_section_lookup_maps::add_relaxed_input_section):
5297 * arm.cc (Target_arm::got_section): Remove used local os.
5298 * i386.cc (Target_i386::got_section): Likewise.
5299 * x86_64.cc (Target_x86_64::got_section): Likewise.
5300 * sparc.cc (Target_sparc::got_section): Likewise.
5301 (Target_sparc::relocate): Remove unused local have_got_offset.
5302 * powerpc.cc (Target_powerpc::relocate): Likewise.
5304 2010-07-13 Ian Lance Taylor <iant@google.com>
5306 * compressed_output.cc (zlib_decompress): Fix signature in
5309 * archive.cc (Archive::include_member): Unlock an external member
5310 of a thin archive. Don't bother to delete an object we know is
5313 2010-07-12 Cary Coutant <ccoutant@google.com>
5315 * compressed_output.cc (zlib_decompress): New function.
5316 (get_uncompressed_size): New function.
5317 (decompress_input_section): New function.
5318 * compressed_output.h (get_uncompressed_size): New function.
5319 (decompress_input_section): New function.
5320 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5321 Handle compressed debug sections.
5322 * layout.cc (is_compressed_debug_section): New function.
5323 (Layout::output_section_name): Map compressed section names to
5325 * layout.h (is_compressed_debug_section): New function.
5326 (is_debug_info_section): Recognize compressed debug sections.
5327 * merge.cc: Include compressed_output.h.
5328 (Output_merge_data::do_add_input_section): Handle compressed
5330 (Output_merge_string::do_add_input_section): Handle compressed
5332 * object.cc: Include compressed_output.h.
5333 (Sized_relobj::Sized_relobj): Initialize new data members.
5334 (build_compressed_section_map): New function.
5335 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5336 * object.h (Object::section_is_compressed): New method.
5337 (Object::do_section_is_compressed): New method.
5338 (Sized_relobj::Compressed_section_map): New type.
5339 (Sized_relobj::do_section_is_compressed): New method.
5340 (Sized_relobj::compressed_sections_): New data member.
5341 * output.cc (Output_section::add_input_section): Handle compressed
5343 * reloc.cc: Include compressed_output.h.
5344 (Sized_relobj::write_sections): Handle compressed debug sections.
5346 2010-07-08 Cary Coutant <ccoutant@google.com>
5348 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5349 weak when resolving to a dynamic def.
5350 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5351 for weak undef/dynamic def cases. Adjust callers.
5352 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5353 undef_binding_weak_.
5354 (Symbol_table::sized_write_globals): Adjust symbol binding.
5355 (Symbol_table::sized_write_symbol): Add binding parameter.
5356 * symtab.h (Symbol::set_undef_binding): New method.
5357 (Symbol::is_undef_binding_weak): New method.
5358 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5359 (Symbol_table::should_override): Add new parameter.
5360 (Symbol_table::sized_write_symbol): Add new parameter.
5362 * testsuite/weak_undef_file1.cc: Add new test case.
5363 * testsuite/weak_undef_file2.cc: Fix header comment.
5364 * testsuite/weak_undef_test.cc: Add new test case.
5366 2010-06-29 Doug Kwan <dougkwan@google.com>
5368 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5369 Initialize USE_SYMBOL_.
5370 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5372 (Arm_reloc_property::uses_symbol_): New data member declaration.
5373 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5374 uses symbol value and symbol is undefined but not weakly undefined.
5376 2010-06-28 Rafael Espindola <espindola@google.com>
5378 * plugin.cc (Plugin::load): Use dlerror.
5380 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5382 * symtab.cc (detect_odr_violations): When reporting an ODR
5383 violation, report an object where the symbol is defined.
5385 2010-06-25 Doug Kwan <dougkwan@google.com>
5387 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5388 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5390 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5391 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5392 target hook to detect function points.
5393 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5394 * icf.h (Icf::check_section_for_function_pointers): Change type of
5395 parameter SECTION_NAME to const reference to std::string. Use
5396 target hook to determine if section may have unsafe pointers.
5397 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5400 2010-06-21 Rafael Espindola <espindola@google.com>
5402 * fileread.cc (Input_file::find_fie): New
5403 (Input_file::open): Use Input_file::find_fie.
5404 * fileread.h (Input_file::find_fie): New
5405 * plugin.cc (set_extra_library_path): New.
5406 (Plugin::load): Add set_extra_library_path to the transfer vector.
5407 (Plugin_manager::set_extra_library_path): New.
5408 (Plugin_manager::add_input_file): Use the extra search path if set.
5409 (set_extra_library_path(): New.
5410 * plugin.h (Plugin_manager): Add set_extra_library_path and
5413 2010-06-19 Cary Coutant <ccoutant@google.com>
5415 * layout.cc (gdb_sections): Add .debug_types.
5416 (lines_only_debug_sections): Likewise.
5418 2010-06-18 Rafael Espindola <espindola@google.com>
5420 * plugin.cc (add_input_file,add_input_library)
5421 (Plugin_manager::add_input_file): Make filename arguments const.
5422 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5425 2010-06-16 Doug Kwan <dougkwan@google.com>
5427 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5428 .ARM.attributes section if we have not merged any input
5429 attributes sections.
5431 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5433 * arm.cc: Allow combining objects with no EABI version
5436 2010-06-15 Rafael Espindola <espindola@google.com>
5438 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5440 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5442 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5443 (struct iovec): Correct !HAVE_READV definition.
5445 2010-06-10 Cary Coutant <ccoutant@google.com>
5447 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5448 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5450 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5453 * symtab.h (Symbol::is_placeholder): New member function.
5454 * target-reloc.h (relocate_section): Check for placeholder symbols.
5456 * testsuite/Makefile.am (plugin_test_8): New test.
5457 (plugin_test_9): New test.
5458 * testsuite/Makefile.in: Regenerate.
5460 2010-06-09 Nick Clifton <nickc@redhat.com>
5462 * yyscript.y (input_list_element): Allow strings prefixed with
5463 the '-' character. Treat these as libraries.
5464 * script.cc (script_add_library): New function. Adds a library
5465 specified by "-l<name>" found in an input script.
5466 * script-c.h: Add prototype for script_add_library.
5468 2010-06-07 Doug Kwan <dougkwan@google.com>
5470 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5471 Restrict stub-group size to be within long conditional branch
5472 range when working around cortex-A8 erratum.
5474 2010-06-07 Damien Diederen <dd@crosstwine.com>
5476 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5479 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5483 (Output_section::Input_section_sort_entry::compare_section_ordering):
5484 Change to return non-zero correctly.
5485 (Output_section::Input_section_sort_section_order_index_compare
5486 ::operator()): Change to fix ambiguity in comparisons.
5488 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5490 * gold.h (is_wildcard_string): New function.
5491 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5492 (Layout::layout_eh_frame): Ditto.
5493 (Layout::find_section_order_index): New method.
5494 (Layout::read_layout_from_file): New method.
5495 * layout.h (Layout::find_section_order_index): New method.
5496 (Layout::read_layout_from_file): New method.
5497 (Layout::input_section_position_): New private member.
5498 (Layout::input_section_glob_): New private member.
5499 * main.cc (main): Call read_layout_from_file here.
5500 * options.h (--section-ordering-file): New option.
5501 * output.cc (Output_section::input_section_order_specified_): New
5503 (Output_section::Output_section): Initialize new member.
5504 (Output_section::add_input_section): Add new parameter.
5505 Keep input sections when --section-ordering-file is used.
5506 (Output_section::set_final_data_size): Sort input sections when
5507 section ordering file is specified.
5508 (Output_section::Input_section_sort_entry): Add new parameter.
5510 (Output_section::Input_section_sort_entry::compare_section_ordering):
5512 (Output_section::Input_section_sort_compare::operator()): Change to
5513 consider section_order_index.
5514 (Output_section::Input_section_sort_init_fini_compare::operator()):
5515 Change to consider section_order_index.
5516 (Output_section::Input_section_sort_section_order_index_compare
5517 ::operator()): New method.
5518 (Output_section::sort_attached_input_sections): Change to sort
5519 according to section order when specified.
5520 (Output_section::add_input_section<32, true>): Add new parameter.
5521 (Output_section::add_input_section<64, true>): Add new parameter.
5522 (Output_section::add_input_section<32, false>): Add new parameter.
5523 (Output_section::add_input_section<64, false>): Add new parameter.
5524 * output.h (Output_section::add_input_section): Add new parameter.
5525 (Output_section::input_section_order_specified): New
5527 (Output_section::set_input_section_order_specified): New method.
5528 (Input_section::Input_section): Initialize section_order_index_.
5529 (Input_section::section_order_index): New method.
5530 (Input_section::set_section_order_index): New method.
5531 (Input_section::section_order_index_): New member.
5532 (Input_section::Input_section_sort_section_order_index_compare): New
5534 (Output_section::input_section_order_specified_): New member.
5535 * script-sections.cc (is_wildcard_string): Delete and move modified
5537 (Output_section_element_input::Output_section_element_input): Modify
5538 call to is_wildcard_string.
5539 (Output_section_element_input::Input_section_pattern
5540 ::Input_section_pattern): Ditto.
5541 (Output_section_element_input::Output_section_element_input): Ditto.
5542 * testsuite/Makefile.am (final_layout): New test case.
5543 * testsuite/Makefile.in: Regenerate.
5544 * testsuite/final_layout.cc: New file.
5545 * testsuite/final_layout.sh: New file.
5547 2010-06-01 Rafael Espindola <espindola@google.com>
5549 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5551 2010-06-01 Rafael Espindola <espindola@google.com>
5553 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5554 visibility of symbols.
5556 2010-05-27 Doug Kwan <dougkwan@google.com>
5558 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5559 from start of output section instead of address for a local symbol
5560 in a merged or relaxed section when doing a relocatable link.
5562 2010-05-26 Rafael Espindola <espindola@google.com>
5565 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5566 adding sections the garbage collector removed.
5567 * gold/testsuite/Makefile.am: Add test.
5568 * gold/testsuite/Makefile.in: Regenerate.
5569 * gold/testsuite/plugin_test_7.sh: New.
5570 * gold/testsuite/plugin_test_7_1.c: New.
5571 * gold/testsuite/plugin_test_7_2.c: New.
5573 2010-05-26 Rafael Espindola <espindola@google.com>
5575 * script-sections.cc (Output_section_definition::set_section_addresses):
5576 Check for --section-start.
5578 2010-05-26 Doug Kwan <dougkwan@google.com>
5580 * arm.cc (Arm_scan_relocatable_relocs): New class.
5581 (Target_arm::relocate_special_relocatable): New method.
5582 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5583 (Arm_relocate_functions::thumb_branch_common): Same.
5584 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5585 instead of Default_scan_relocatable_relocs.
5586 * target-reloc.h (relocate_for_relocatable): Let target handle
5587 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5588 * target.h (Sized_target::relocate_special_relocatable): New method.
5590 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5592 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5594 2010-05-23 Doug Kwan <dougkwan@google.com>
5596 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5598 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5599 with a direct branch, not a conditional branch, to a stub.
5600 * merge.cc (Output_merge_base::record_input_section): New method
5602 (Output_merge_data::do_add_input_section): Record input section if
5603 keeps-input-sections flag is set.
5604 (Output_merge_string::do_add_input_section): Ditto.
5605 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5606 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5608 (Output_merge_base::keeps_input_sections,
5609 Output_merge_base::set_keeps_input_sections,
5610 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5612 (Output_merge_base::Input_sections): New type declaration.
5613 (Output_merge_base::input_sections_begin,
5614 Output_merge_base::input_sections_end,
5615 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5616 (Output_merge_base::bool keeps_input_sections_,
5617 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5618 Output_merge_base::input_sections_): New data members.
5619 (Output_merge_data::do_set_keeps_input_sections): New method
5621 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5622 * output.cc (Output_section::Input_section::relobj): Move method
5623 defintion from class declaration to here and handle merge sections.
5624 (Output_section::Input_section::shndx): Ditto.
5625 (Output_section::Output_section): Remove initializations of removed
5626 data members and initialize new data member LOOKUP_MAPS_.
5627 (Output_section::add_input_section): Set keeps-input-sections flag
5628 for a newly created merge output section as appropriate. Adjust code
5629 to use Output_section_lookup_maps class.
5630 (Output_section::add_relaxed_input_section): Adjst code for lookup
5631 maps code refactoring.
5632 (Output_section::add_merge_input_section): Add a new parameter
5633 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5634 class. If adding input section to a newly created merge output
5635 section fails, remove the new merge section.
5636 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5637 Adjust code for use of the Output_section_lookup_maps class.
5638 (Output_section::find_merge_section): Ditto.
5639 (Output_section::build_lookup_maps): New method defintion.
5640 (Output_section::find_relaxed_input_section): Adjust code to use
5641 Output_section_lookup_maps class.
5642 (Output_section::get_input_sections): Export merge sections. Adjust
5643 code to use Output_section_lookup_maps class.
5644 (Output_section:::add_script_input_section): Adjust code to use
5645 Output_section_lookup_maps class. Update lookup maps for merge
5647 (Output_section::discard_states): Use Output_section_lookup_maps.
5648 (Output_section::restore_states): Same.
5649 * output.h (Merge_section_properties): Move class defintion out of
5651 (Output_section_lookup_maps): New class.
5652 (Output_section::Input_section::is_merge_section): New method
5654 (Output_section::Input_section::relobj): Move defintion out of class
5655 defintion. Declare method only.
5656 (Output_section::Input_section::shndx): Ditto.
5657 (Output_section::Input_section::output_merge_base): New method defintion.
5658 (Output_section::Input_section::u2_.pomb): New union field.
5659 (Output_section::Merge_section_by_properties_map,
5660 Output_section::Output_section_data_by_input_section_map,
5661 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5663 (Output_section::add_merge_input_section): Add new parameter
5664 KEEPS_INPUT_SECTIONS.
5665 (Output_section::build_lookup_maps): New method declaration.
5666 (Output_section::merge_section_map_,
5667 Output_section::merge_section_by_properties_map_,
5668 Output_section::relaxed_input_section_map_,
5669 Output_section::is_relaxed_input_section_map_valid_): Remove data
5671 (Output_section::lookup_maps_): New data member.
5673 2010-05-21 Doug Kwan <dougkwan@google.com>
5676 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5677 avoid a compilation error.
5679 2010-05-19 Rafael Espindola <espindola@google.com>
5681 * script-sections.cc (Output_section_definition::allocate_to_segment):
5682 Update the phdrs_list even when the output section is NULL.
5683 * testsuite/Makefile.am: Add test.
5684 * testsuite/Makefile.in: Regenerate.
5685 * testsuite/script_test_9.cc: New.
5686 * testsuite/script_test_9.sh: New.
5687 * testsuite/script_test_9.t: New.
5689 2010-05-19 Doug Kwan <dougkwan@google.com>
5691 * arm.cc (Arm_input_section::original_size): New method.
5692 (Arm_input_section::do_addralign): Add a cast.
5693 (Arm_input_section::do_output_offset): Remove static cast.
5694 (Arm_input_section::original_addralign,
5695 Arm_input_section::original_size_): Change type to uint32_t.
5696 (Arm_input_section::init): Add safe casts for section alignment
5698 (Arm_input_section::set_final_data_size): Do not set address and
5699 offset of stub table.
5700 (Arm_output_section::fix_exidx_coverage): Change use of of
5701 Output_section::Simple_input_section to that of
5702 Output_section::Input_section.
5703 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5704 except for the first pass.
5705 * output.cc (Output_section::get_input_sections): Change type of
5706 input_sections to std::list<Input_section>.
5707 (Output_section::add_script_input_section): Rename from
5708 Output_section::add_simple_input_section. Change type of SIS
5709 parameter from Simple_input_section to Input_section.
5710 * output.h (Output_section::Simple_input_section): Remove class.
5711 (Output_section::Input_section): Change class visibility to public.
5712 (Output_section::Input_section::addralign): Use stored alignments
5713 for special input sections if set.
5714 (Output_section::Input_section::set_addralign): New method.
5715 (Output_section::get_input_sections): Change parameter type from
5716 list of Simple_input_section to list of Input_section.
5717 (Output_section::add_script_input_section): Rename from
5718 Output_section::add_simple_input_section. Change first parameter's
5719 type from Simple_input_section to Input_section and remove the
5720 second and third parameters.
5721 * script-sections.cc (Input_section::Input_section_list): Change
5722 type to list of Output_section::Input_section/
5723 (Input_section_info::Input_section_info): Change parameter type of
5724 INPUT_SECTION to Output_section::Input_section.
5725 (Input_section_info::input_section): Change return type.
5726 (Input_section_info::input_section_): Change type to
5727 Output_section::Input_section.
5728 (Output_section_element_input::set_section_addresses): Adjust code
5729 to use Output_section::Input_section instead of
5730 Output_section::Simple_input_section. Adjust code for renaming
5731 of Output_section::add_simple_input_section.
5732 (Orphan_output_section::set_section_addresses): Ditto.
5734 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5736 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5737 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5739 2010-05-18 Rafael Espindola <espindola@google.com>
5741 * options.cc (General_options::finalize): Handle -nostdlib.
5742 * options.h (nostdlib): New option.
5743 * script.cc (script_add_search_dir): Handle -nostdlib.
5745 2010-05-12 Doug Kwan <dougkwan@google.com>
5747 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5748 attributes section only if there no attributes section after merging.
5749 (Target_arm::merge_object_attributes): Move value of
5750 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5751 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5752 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5753 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5754 and arm_attr_merge_7.stdout.
5755 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5756 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5757 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5758 arm_attr_merge_7b.o): New rules.
5759 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5761 * testsuite/Makefile.in: Regenerate.
5762 * testsuite/arm_attr_merge.sh: New file.
5763 * testsuite/arm_attr_merge_[67][ab].s: Same.
5765 2010-05-05 Nick Clifton <nickc@redhat.com>
5767 * po/es.po: Updated Spanish translation.
5769 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5771 * Makefile.am (install-exec-local): Properly install gold as
5772 default cross linker.
5773 * Makefile.in: Regenerated.
5775 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5776 Nick Clifton <nickc@redhat.com>
5778 * configure.ac (install_as_default): Define and set to false
5779 unless --enable-gold or --enable-gold=both/gold has been
5781 * configure: Regenerate.
5783 * Makefile.am (install-exec-local): Install the executable as
5784 'ld.gold'. If install_as_default is true then also install it as
5786 * Makefile.in: Regenerated.
5788 2010-04-24 Ian Lance Taylor <iant@google.com>
5790 * layout.cc (Layout::layout_reloc): In relocatable link don't
5791 combine reloc sections for grouped sections.
5793 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5795 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5796 sections that are not ordinary to icf.
5797 * icf.cc (get_section_contents): Handle relocation pointing to section
5798 with no object or shndx information.
5799 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5800 * testsuite/Makefile.in: Regenerate.
5801 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5802 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5804 2010-04-22 Ian Lance Taylor <iant@google.com>
5806 * expression.cc (Expression::Expression_eval_info): Add
5807 result_alignment_pointer field.
5808 (Expression::eval_with_dot): Add result_alignment_pointer
5809 parameter. Change all callers.
5810 (Expression::eval_maybe_dot): Likewise.
5811 (class Binary_expression): Add alignment_pointer parameter to
5812 left_value and right_value. Change all callers.
5813 (BINARY_EXPRESSION): Set result alignment.
5814 (class Trinary_expression): Add alignment_pointer parameter to
5815 arg2_value and arg3_value. Change all callers.
5816 (Trinary_cond::value): Set result alignment.
5817 (Max_expression::value, Min_expression::value): Likewise.
5818 (Align_expression::value): Likewise.
5819 * script-sections.cc (class Sections_element): Add dot_alignment
5820 parameter to set_section_addresses virtual function. Update
5822 (class Output_section_element): Likewise.
5823 (Script_sections::create_segments): Add dot_alignment parameter.
5825 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5826 (Script_sections::set_phdrs_clause_addresses): Likewise.
5827 * script-sections.h: Update declarations.
5828 * script.h: Update declarations.
5829 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5831 * testsuite/script_test_3.t: Set large alignment.
5832 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5833 segment has expected alignment.
5835 2010-04-22 Nick Clifton <nickc@redhat.com>
5837 * po/gold.pot: Updated by the Translation project.
5838 * po/vi.po: Updated Vietnamese translation.
5840 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5842 * testsuite/Makefile.am (check_PROGRAMS): Add
5843 icf_virtual_function_folding_test.
5844 * testsuite/Makefile.in: Regenerated.
5846 2010-04-15 Andrew Haley <aph@redhat.com>
5848 * options.h (merge_exidx_entries): New option.
5849 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5850 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5851 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5852 (Target_arm::merge_exidx_entries): New function.
5853 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5854 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5855 to Arm_exidx_fixup constructor.
5856 Add new arg, merge_exidx_entries.
5857 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5858 Arm_output_section::fix_exidx_coverage.
5860 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5862 * icf.cc (get_section_contents): Check for preemptible functions.
5863 Ignore addend when appropriate.
5864 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5866 (add_from_relobj): Check for section folded.
5867 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5868 * symtab.h (should_add_dynsym_entry): Add new parameter.
5869 * target-reloc.h (scan_relocs): Check for section folded.
5870 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5871 Check reloc types for function pointers in shared objects.
5872 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5874 (icf_preemptible_functions_test): New test case.
5875 (icf_string_merge_test): New test case.
5876 * testsuite.Makefile.in: Regenerate.
5877 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5878 bar_glob. Refactor code.
5879 * testsuite/icf_preemptible_functions_test.cc: New file.
5880 * testsuite/icf_preemptible_functions_test.sh: New file.
5881 * testsuite/icf_string_merge_test.cc: New file.
5882 * testsuite/icf_string_merge_test.sh: New file.
5883 * testsuite/icf_virtual_function_folding_test.cc: New file.
5884 * testsuite/icf_virtual_function_folding_test.sh: New file.
5886 2010-04-14 Doug Kwan <dougkwan@google.com>
5888 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5889 for local symbol recounting if we remove a section due to ICF.
5890 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5891 there are no regular objects in input.
5893 2010-04-13 Doug Kwan <dougkwan@google.com>
5895 * arm.cc (Arm_input_section::set_final_data_size): Compute
5896 accurate final data size instead of using current data size.
5898 2010-04-09 Doug Kwan <dougkwan@google.com>
5900 * layout.cc (Layout::choose_output_section): Handle script section
5902 (Layout::make_output_section_for_script): Add section type parameter.
5903 Handle script section types.
5904 * layout.h (Layout::make_output_section_for_script): Add section
5906 * output.cc (Output_section::Output_section): Initialize data member
5908 (Output_section::do_reset_address_and_file_offset): Do not set address
5909 to 0 if section is a NOLOAD section.
5910 * output.h (Output_section::is_noload): New method.
5911 (Output_section::set_is_noload): Ditto.
5912 (Output_section::is_noload_): New data member.
5913 * script-c.h (Script_section_type): New enum type.
5914 (struct Parser_output_section_header): Add new file section_type.
5915 * script-sections.cc (Sections_element::output_section_name): Add
5916 parameter for returning script section type.
5917 (Output_section_definition::output_section_name): Ditto.
5918 (Output_section_definition::section_type)P; New method.
5919 (Output_section_definiton::script_section_type_name): Ditto.
5920 (Output_section_definition::script_section_type_): New data member.
5921 (Output_section_definition::Output_section_definition): Initialize
5922 data member Output_section_definition::script_section_type_.
5923 (Output_section_definition::create_sections): Pass script section type
5924 to Layout::make_output_section_for_script.
5925 (Output_section_definition::output_section_name): Return script
5926 section type to caller.
5927 (Output_section_definition::set_section_address): Do not advance
5928 dot value and load address if section type is NOLOAD. Set address
5929 of NOLOAD sections regardless of section flags.
5930 (Output_section_definition::print): Print section type if it is
5931 not SCRIPT_SECTION_TYPE_NONE.
5932 (Output_section_definition::section_type): New method.
5933 (Output_section_definition::script_section_type_name): Ditto.
5934 (Script_sections::output_section_name): Add new parameter
5935 PSECTION_TYPE for returning script section type. Pass it to
5936 section elements. Handle discard sections.
5937 (Sort_output_sections::operator()): Handle NOLOAD sections.
5938 * script-sections.h (Script_sections::Section_type): New enum type.
5939 (Script_sections::output_section_name): Add a new parameter for
5940 returning script section type.
5941 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5943 * yyscript.y (union): Add new field SECTION_TYPE.
5944 (COPY, DSECT, INFO, NOLOAD): New tokens.
5945 (opt_address_and_section_type): Change type to output_section_header.
5946 (section_type): New non-terminal
5947 (section_header): Handle section type.
5948 (opt_address_and_section_type): Return section type value.
5950 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5952 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5953 * testsuite/plugin_common_test_2.c (foo): Likewise.
5955 2010-04-08 Doug Kwan <dougkwan@google.com>
5957 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5959 * output.cc (Output_section::add_merge_input_section): Simplify
5960 code and return status of Output_merge_base::add_input_section.
5961 Update merge section map only if Output_merge_base::add_input_section
5964 2010-04-07 Doug Kwan <dougkwan@google.com>
5966 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5967 if section is marked as containing instructions but has no mapping
5969 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5970 correct section index.
5971 (Arm_relobj::find_linked_text_section): Ditto.
5973 2010-04-07 Cary Coutant <ccoutant@google.com>
5975 * archive.cc (include_member): Destroy Read_symbols_data object before
5977 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5978 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5979 (Read_symbols_data::~Read_symbols_data) New destructor.
5980 (Section_relocs::Section_relocs) New constructor.
5981 (Section_relocs::~Section_relocs) New destructor.
5982 (Read_relocs_data::Read_relocs_data) New constructor.
5983 (Read_relocs_data::~Read_relocs_data) New destructor.
5984 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5985 pointers to NULL after deleting.
5987 2010-04-07 Doug Kwan <dougkwan@google.com>
5989 * arm.cc: Replace "endianity" with "endianness" in comments.
5990 (Arm_exidx_cantunwind): Ditto.
5991 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5992 (Arm_relobj::merge_flags_and_attributes): New method.
5993 (Arm_relobj::merge_flags_and_attributes_): New data member.
5994 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5995 (Arm_relobj::scan_sections_for_stubs): Ditto.
5996 (Arm_relobj::do_read_symbols): Check to see if we really want to
5997 merge processor-specific flags and attributes. Exit early if
5998 an object is empty except for section names and the undefined symbol.
5999 (Target_arm::do_finalize_sections): Move check for ELF format to
6000 Arm_relobj::do_read_symbols. Merge processor specific flags and
6001 attributes from a regular object only when we have determined that
6002 it is aapropriate. Do not create an .ARM.attributes section in
6003 output if there is no regular input object.
6004 (Target_arm::merge_processor_specific_flags): Check
6005 --warn-mismatch before printing any error.
6006 (Target_arm::merge_object_attributes): Ditto.
6007 * gold.cc (queue_middle_tasks): Handle the case in which there is
6008 no regular object in input.
6009 * options.cc (General_options::parse_EB): New method.
6010 (General_options::parse_EL): Same.
6011 (General_options::General_options): Initialize endianness_.
6012 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6014 (General_options::Endianness): New enum.
6015 (General_options::endianness): New method.
6016 (General_options::endianness_): New data member.
6017 * parameters.cc (Parameters::set_options): Check target endianness.
6018 (Parameters::set_target_once): Ditto.
6019 (Parameters::check_target_endianness): New method.
6020 (parameters_force_valid_target): If either -EL or -EB is specified,
6021 use it to define endianness of default target.
6022 * parameters.h (Parameters::check_target_endianness): New method
6024 * target.h (class Target): Change "endianity" to "endianness"
6027 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6029 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6030 * configure: Regenerate.
6031 * Makefile.in: Regenerate.
6032 * testsuite/Makefile.in: Regenerate.
6034 2010-04-06 Cary Coutant <ccoutant@google.com>
6037 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6038 prevailing definitions of common symbols.
6039 * testsuite/plugin_test_6.sh: New test case.
6040 * testsuite/plugin_common_test_1.c: New test case.
6041 * testsuite/plugin_common_test_2.c: New test case.
6042 * testsuite/Makefile.am (plugin_test_6): New test case.
6043 * testsuite/Makefile.in: Regenerate.
6045 2010-04-06 Nick Clifton <nickc@redhat.com>
6047 * po/vi.po: New Vietnamese translation.
6049 2010-03-30 Doug Kwan <dougkwan@google.com>
6051 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6053 2010-03-25 Doug Kwan <dougkwan@google.com>
6055 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6056 to avoid a conversion warning on a 32-bit host.
6058 2010-03-24 Ian Lance Taylor <iant@google.com>
6060 * testsuite/script_test_3.t: Add a TLS segment.
6061 * testsuite/Makefile.am (check_PROGRAMS): Add
6062 tls_phdrs_script_test.
6063 (tls_phdrs_script_test_SOURCES): Define.
6064 (tls_phdrs_script_test_DEPENDENCIES): Define.
6065 (tls_phdrs_script_test_LDFLAGS): Define.
6066 (tls_phdrs_script_test_LDADD): Define.
6067 * testsuite/Makefile.in: Rebuild.
6069 2010-03-23 Cary Coutant <ccoutant@google.com>
6071 * fileread.cc (find_or_make_view): Fix comment.
6073 2010-03-23 Ian Lance Taylor <iant@google.com>
6075 * script-sections.cc (class Orphan_section_placement): Define
6076 PLACE_TLS and PLACE_TLS_BSS.
6077 (Orphan_section_placement::Orphan_section_placement): Initialize
6079 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6080 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6081 (tls_script_test_SOURCES): Define.
6082 (tls_script_test_DEPENDENCIES): Define.
6083 (tls_script_test_LDFLAGS): Define.
6084 (tls_script_test_LDADD): Define.
6085 * testsuite/Makefile.in: Rebuild.
6087 2010-03-22 Doug Kwan <dougkwan@google.com>
6089 * arm.cc (Arm_relocate_functions::abs8,
6090 Arm_relocate_functions::abs16): Use correct check for overflow
6091 specified in the ARM ELF specs.
6092 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6093 target of a BLX instruction specially.
6094 (Reloc_stub::stub_type_for_reloc): Ditto.
6095 (Relocate::relocate): Use symbolic names instead of numeric relocation
6096 codes to report error.
6097 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6099 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6100 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6101 thumb2_blx_out_of_range.stdout
6102 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6103 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6104 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6105 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6106 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6107 thumb2_blx_in_range, thumb2_blx_in_range.o,
6108 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6109 thumb2_blx_out_of_range.o): New rules.
6110 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6111 thumb2_blx_in_range and thumb2_blx_out_of_range.
6112 * testsuite/Makefile.in: Regenerate.
6113 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6114 * testsuite/thumb_blx_in_range.s: New file.
6115 * testsuite/thumb_blx_out_of_range.s: New file.
6117 2010-03-22 Rafael Espindola <espindola@google.com>
6119 * archive.cc (Should_include): Move to archive.h.
6120 (should_include_member): Make it a member of Archive.
6122 (Add_lib_group_symbols): New.
6123 * archive.h: Include options.h.
6124 (Archive_member): Moved from Archive.
6125 (Should_include): Moved from archive.cc.
6127 (Add_lib_group_symbols): New.
6128 * dynobj.cc (do_should_include_member): New.
6129 * dynobj.h (do_should_include_member): New.
6130 * gold.cc (queue_initial_tasks): Update call to queue.
6131 * main.cc (main): Print lib group stats.
6132 * object.cc (do_should_include_member): New.
6133 * object.h: Include archive.h.
6134 (Object::should_include_member): New.
6135 (Object::do_should_include_member): New.
6136 (Sized_relobj::do_should_include_member): New.
6137 * options.cc (General_options::parse_start_lib): New.
6138 (General_options::parse_end_lib): New.
6139 (Input_arguments::add_file): Handle lib groups.
6140 (Input_arguments::start_group): Check we are not in a lib.
6141 (Input_arguments::start_lib): New.
6142 (Input_arguments::end_lib): New.
6143 * options.h (General_options): Add start_lib and end_lib.
6144 (Input_argument::lib_): New.
6145 (Input_argument::lib): New.
6146 (Input_argument::is_lib): New.
6147 (Input_file_lib): New.
6148 (Input_arguments::in_lib_): New.
6149 (Input_arguments::in_lib): New.
6150 (Input_arguments::start_lib): New.
6151 (Input_arguments::end_lib_): New.
6152 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6153 in unused members as preempted.
6154 (Sized_pluginobj::do_should_include_member): New.
6155 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6156 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6158 (Read_symbols::do_whole_lib_group): New.
6159 (Read_symbols::do_lib_group): New.
6160 (Read_symbols::do_read_symbols): Handle lib groups.
6161 (Read_symbols::get_name): Handle lib groups.
6162 * readsyms.h (Read_symbols): Add an archive member pointer.
6163 (Read_symbols::do_whole_lib_group): New.
6164 (Read_symbols::do_lib_group): New.
6165 (Read_symbols::member_): New.
6166 * script.cc (read_input_script): Update call to queue_soon.
6168 2010-03-19 Doug Kwan <dougkwan@google.com>
6170 * arm.cc (Stub_table::Stub_table): Initialize new data members
6171 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6172 (Stub_table::add_reloc_stub): Assign stub offset and update
6173 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6174 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6176 (Stub_table::update_data_size_and_addralign): Use
6177 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6178 instead of going over all reloc stubs.
6179 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6180 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6181 Stringpool_template::offset_ to size of Stringpool_char.
6182 (Stringpool_template::new_key_offset): Remove code to initialize
6183 Stringpool_template::offset_.
6184 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6185 Stringpool_template::offset_ to zero.
6187 2010-03-15 Doug Kwan <dougkwan@google.com>
6189 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6191 (Stringpool_template::new_key_offset): New method.
6192 (Stringpool_template::add_string): Assign offsets when adding new
6194 (Stringpool_template::set_string_offsets): Do not set string offsets
6195 when not optimizing.
6196 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6198 (Chunked_vector::clear): Clear size_.
6199 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6200 (Chunked_vector::size): Return size_.
6201 (Chunked_vector::push_back): Use size_ to find insert position.
6202 (Chunked_vector::size_): New data member.
6203 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6204 (Stringpool_template::new_key_offset): New method declaration.
6205 (Stringpool_template::offset_): New data member.
6207 2010-03-15 Rafael Espindola <espindola@google.com>
6209 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6210 Add_symbols' constructor.
6211 * readsyms.h (Add_symbols): Remove the input_group member.
6213 2010-03-10 Ian Lance Taylor <iant@google.com>
6215 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6216 target to ask whether a reference to a symbol requires a stack
6218 * target.h (Target::is_call_to_non_split): New function.
6219 (Target::do_is_call_to_non_split): Declare virtual function.
6220 * target.cc: Include "symtab.h".
6221 (Target::do_is_call_to_non_split): New function.
6222 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6224 2010-03-10 Cary Coutant <ccoutant@google.com>
6226 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6227 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6228 (File_read::open[2]): Add whole_file_view_ to list of views.
6229 (File_read::make_view): Remove test of whole_file_view_.
6230 (File_read::find_or_make_view): Create whole_file_view_ if
6232 (File_read::clear_views): Replace bool parameter with enum;
6233 adjust all callers. Don't delete views with permanent data;
6234 do delete cached views and views from archives if
6235 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6236 if clearing the corresponding view.
6237 * fileread.h (File_read::Clear_views_mode): New enum.
6238 (File_read::View::is_permanent_view): New method.
6239 (File_read::clear_views): Replace bool parameter
6240 with enum; adjust all callers.
6241 * options.h (General_options): Change keep_files_mapped option;
6242 add map_whole_files.
6243 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6245 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6248 2010-03-10 David S. Miller <davem@davemloft.net>
6250 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6252 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6254 * icf.cc (get_section_contents): Add '@' marker after processing the
6257 2010-03-08 Doug Kwan <dougkwan@google.com>
6259 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6260 due to a conversion warning.
6261 (Arm_relobj::update_output_local_symbol_count): Check for local
6262 symbol with unset output index.
6264 2010-03-05 Ian Lance Taylor <iant@google.com>
6266 * options.h (class General_options): Add --spare-dynamic-tags.
6267 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6268 --spare-dynamic-tags.
6270 2010-03-05 Ian Lance Taylor <iant@google.com>
6272 * incremental.cc: Include "libiberty.h".
6274 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6276 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6277 function, is_info_ member.
6278 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6279 (Versions::Versions): Update caller.
6280 (Versions::define_base_version): Likewise.
6281 (Versions::add_def): Likewise.
6283 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6285 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6286 (Scan::possible_function_pointer_reloc): New function.
6287 (Scan::local_reloc_may_be_function_pointer): Change to call
6288 possible_function_pointer_reloc.
6289 (Scan::global_reloc_may_be_function_pointer): Ditto.
6290 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6291 relocations in ".data.rel.ro._ZTV" section.
6292 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6293 * testsuite/icf_safe_so_test.cc: Ditto.
6294 * testsuite/icf_safe_test.cc: Ditto.
6295 * testsuite/icf_safe_test.sh: Ditto.
6297 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6298 Ian Lance Taylor <iant@google.com>
6300 * target-reloc.h (relocate_section): Check the symbol table index
6301 for -1U before setting the local symbol index.
6302 (scan_relocatable_relocs): If copying the relocation, record that
6303 the local symbol is required.
6304 * object.h (Symbol_value::is_output_symtab_index_set): New
6306 (Symbol_value::may_be_discarded_from_output_symtab): New
6308 (Symbol_value::has_output_symtab_entry): New function.
6309 (Symbol_value::needs_output_symtab_entry): Remove.
6310 (Symbol_value::output_symtab_index): Make sure the symbol index is
6312 (Symbol_value::set_output_symtab_index): Make sure the symbol
6313 index is not set. Make sure the new index is valid.
6314 (Symbol_value::set_must_have_output_symtab_entry): New function.
6315 (Symbol_value::has_output_dynsym_entry): New function.
6316 (Symbol_value::set_output_dynsym_index): Make sure the new index
6318 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6319 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6320 local symbol if permitted.
6321 (Sized_relobj::do_finalize_local_symbols): Call
6322 is_output_symtab_index_set rather than needs_output_symtab_entry.
6323 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6324 rather than needs_output_symtab_entry. Call
6325 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6326 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6327 is_output_symtab_index_set rather than needs_output_symtab_entry.
6328 * testsuite/discard_locals_relocatable_test.c: New file.
6329 * testsuite/discard_locals_test.sh: Test -r.
6330 * testsuite/Makefile.am (check_DATA): Add
6331 discard_locals_relocatable_test1.syms,
6332 discard_local_relocatable_test2.syms.
6333 (MOSTLYCLEANFILES): Likewise. Also add
6334 discard_locals_relocatable_test1.lout and
6335 discard_locals_relocatable_test2.out.
6336 (discard_locals_relocatable_test1.syms): New target.
6337 (discard_locals_relocatable_test.o): New target.
6338 (discard_locals_relocatable_test1.out): New target.
6339 (discard_locals_relocatable_test2.syms): New target.
6340 (discard_locals_relocatable_test2.out): New target.
6341 (various): Add missing ../ld-new dependencies.
6342 * testsuite/Makefile.in: Rebuild.
6344 2010-03-03 Nick Clifton <nickc@redhat.com>
6346 * po/fi.po: New Finnish translation.
6348 2010-03-01 Doug Kwan <dougkwan@google.com>
6350 * layout.cc (Layout::Layout): Force section types of .init_array*,
6351 .preinit_array* and .fini_array* sections.
6352 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6353 Fix check of return value of std::string::find.().
6354 (Output_section::Input_section_sort_compare::operator()): Remove
6355 comment about .init_array.
6356 (Output_section::Input_section_sort_init_fini_compare::operator()):
6358 (Output_section::sort_attached_input_sections): Handle .init_array
6359 and .fini_array specially.
6360 * output.h (Output_section::Inut_section_sort_compare): Update
6362 (Output_section::Input_section_sort_init_fini_compare): New struct.
6364 2010-02-26 Doug Kwan <dougkwan@google.com>
6366 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6367 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6368 * testsuite/debug_msg.sh: Avoid matching source line number for
6369 use of global variable undef_int.
6371 2010-02-26 Doug Kwan <dougkwan@google.com>
6373 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6374 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6375 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6376 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6377 * options.cc (General_options::General_options): Initialize member
6379 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6380 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6381 and rm_no_fix_v4bx.stdout
6382 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6383 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6384 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6385 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6386 and arm_no_fix_v4bx.
6387 * Makefile.in: Regenerate.
6388 * testsuite/arm_fix_v4bx.s: New file.
6389 * testsuite/arm_fix_v4bx.sh: Ditto.
6391 2010-02-24 Doug Kwan <dougkwan@google.com>
6393 * arm.cc (Target_arm::got_section): Make the .got section the first
6394 non RELRO section in the data segment.
6395 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6396 suffixes of section names.
6398 2010-02-24 Doug Kwan <dougkwan@google.com>
6400 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6401 flags and attributes merging if an input file is a binary file.
6402 * fileread.cc (Input_file::open): Record format of original file.
6403 * fileread.h (Input_file::Format): New enum type.
6404 (Input_file::Input_file): Initialize data member format_.
6405 (Input_file::format): New method definition.
6406 (Input_file::format_):: New data member.
6408 2010-02-24 Doug Kwan <dougkwan@google.com>
6410 * arm.cc (Arm_output_data_got): New class.
6411 (ARM_TCB_SIZE): New constant
6412 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6413 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6414 If user uses a script with a SECTIONS clause, issue only a warning
6415 for a misplaced EXIDX input section. Otherwise, issue an error.
6416 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6418 (Target_arm::got_mode_index_entry): Handle static linking.
6419 (Target_arm::Scan::local): Ditto.
6420 (Target_arm::Scan::global): Ditto.
6421 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6422 all incorrectly implemented relocations.
6423 (Target_arm::fix_exidx_coverage): Pass layout to
6424 Arm_output_section::fix_exidx_coverage.
6425 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6426 from ".ARM.exidx." and ".ARM.extab.".
6428 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6430 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6431 section if it does not already exist.
6432 * attributes.cc (Attributes_section_data::Attributes_section_data):
6433 Don't crash if size is zero.
6435 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6436 Ian Lance Taylor <iant@google.com>
6438 * gold.cc (queue_middle_tasks): If no input files were opened,
6440 * workqueue.h (Task_function::Task_function): Assert that there is
6443 2010-02-22 Doug Kwan <dougkwan@google.com>
6445 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6446 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6447 types to avoid warnings due to different uint64_t implementations
6450 2010-02-21 Doug Kwan <dougkwan@google.com>
6452 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6453 handling of the maximum backward branch offset.
6454 (Arm_relocate_functions::thumb_branch_common): Ditto.
6455 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6456 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6457 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6458 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6459 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6460 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6461 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6462 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6463 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6464 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6465 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6466 thumb2_bl_out_of_range.o): New rules.
6467 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6468 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6469 thumb2_bl_out_of_range
6470 * testsuite/Makefile.in: Regenerate.
6471 * testsuite/arm_bl_in_range.s: New file.
6472 * testsuite/arm_bl_out_of_range.s: Ditto.
6473 * testsuite/arm_branch_in_range.sh: Ditto.
6474 * testsuite/arm_branch_range.t: Ditto.
6475 * testsuite/thumb2_branch_range.t: Ditto.
6476 * testsuite/thumb_bl_in_range.s: Ditto.
6477 * testsuite/thumb_bl_out_of_range.s: Ditto.
6478 * testsuite/thumb_branch_range.t: Ditto.
6480 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6482 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6483 Add reloc offset information.
6484 * icf.cc (get_section_contents): Change iterators to point to the new
6485 vectors. Add reloc offset information to the contents.
6486 * icf.h (Icf::Sections_reachable_info): New typedef.
6487 (Icf::Sections_reachable_list): New typedef.
6488 (Icf::Offset_info): New typedef.
6489 (Icf::Reloc_info): New struct typedef.
6490 (Icf::Reloc_info_list): New typedef.
6491 (Icf::symbol_reloc_list): Delete method.
6492 (Icf::addend_reloc_list): Delete method.
6493 (Icf::section_reloc_list): Delete method.
6494 (Icf::reloc_info_list): New method.
6495 (Icf::reloc_info_list_): New member.
6497 2010-02-19 Doug Kwan <dougkwan@google.com>
6499 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6500 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6501 * arm.cc (Arm_relocation_functions): New forward declaration.
6502 (Target_arm::Target_arm): Initialize new data members
6503 got_mod_index_offset_ and tls_base_symbol_defined_.
6504 (Target_arm::Relocate::relocate_tls): New method.
6505 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6506 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6508 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6509 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6510 (Target_arm::got_mod_index_offset_,
6511 Target_arm::tls_base_symbol_defined_): New data members.
6512 (Target_arm::Scan::local, Target::Scan::global,
6513 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6516 2010-02-18 Doug Kwan <dougkwan@google.com>
6518 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6519 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6520 text section as a parameter becuase some broken tools may not set
6521 the link in section header.
6522 (Target_arm::has_got_section): New method.
6523 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6524 without any mapping symbol as data only. Remove warning.
6525 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6526 link in its section header, try to discover the link by inspecting the
6527 REL31 relocation at the beginning of the section.
6528 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6530 (Target_arm::Scan::global): Treat any reference to the symbol
6531 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6533 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6535 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6536 (Scan::global_reloc_may_be_function_pointer): New function.
6537 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6538 (Scan::global_reloc_may_be_function_pointer): New function.
6539 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6540 (Scan::global_reloc_may_be_function_pointer): New function.
6541 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6542 (Scan::global_reloc_may_be_function_pointer): New function.
6543 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6544 (Scan::global_reloc_may_be_function_pointer): New function.
6545 (Scan::possible_function_pointer_reloc): New function.
6546 (Target_x86_64::can_check_for_function_pointers): New function.
6547 * gc.h (gc_process_relocs): Scan relocation types to determine if
6548 function pointers were taken for targets that support it.
6549 * icf.cc (Icf::find_identical_sections): Include functions for
6550 folding in safe ICF whose pointer is not taken.
6551 * icf.h (Secn_fptr_taken_set): New typedef.
6552 (fptr_section_id_): New member.
6553 (section_has_function_pointers): New function.
6554 (set_section_has_function_pointers): New function.
6555 (check_section_for_function_pointers): New function.
6556 * options.h: Fix comment for safe ICF option.
6557 * target.h (can_check_for_function_pointers): New function.
6558 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6559 Modify icf_safe_test for X86-64.
6560 * testsuite/Makefile.in: Regenerate.
6561 * testsuite/icf_safe_so_test.cc: New file.
6562 * testsuite/icf_safe_so_test.sh: New file.
6563 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6564 (main): Change to take pointer to function kept_func_3.
6565 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6566 folding is done correctly for X86-64.
6568 2010-02-12 David S. Miller <davem@davemloft.net>
6570 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6571 is_symbolless parameter.
6572 (Output_reloc<SHT_REL>::is_symbolless): New.
6573 (Output_reloc<SHT_REL>::is_symbolless_): New.
6574 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6575 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6576 (Output_reloc<SHT_RELA>::is_symbolless): New.
6577 (Output_data_reloc::add_global): Handle is_symbolless.
6578 (Output_data_reloc::add_global_relative): Likewise.
6579 (Output_data_reloc::add_local): Likewise.
6580 (Output_data_reloc::add_local_relative): Likewise.
6581 (Output_data_reloc::add_symbolless_global_addend): New.
6582 (Output_data_reloc::add_symbolless_local_addend): New.
6583 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6585 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6586 instead of ->is_relative_
6587 (Output_reloc::write): Likewise.
6588 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6589 (Output_reloc::write_rel): Simplify.
6591 * sparc.cc (Target_sparc::Scan::local): Use
6592 ->add_symbolless_local_addend as needed.
6593 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6594 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6595 based upon relocation offset.
6597 2010-02-11 Doug Kwan <dougkwan@google.com>
6599 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6600 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6601 beginning of function.
6602 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6603 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6604 parameter is_32bit in calls to should_apply_static_reloc.
6605 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6606 (check_DATA): Add arm_abs_global.stdout.
6607 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6608 arm_abs_global.stdout): New rules.
6609 (MOSTLLYCLEANFILES): Add arm_abs_global
6610 * Makefile.in: Regenerate.
6611 * testsuite/arm_abs_global.s: New file.
6612 * testsuite/arm_abs_global.sh: Ditto.
6613 * testsuite/arm_abs_lib.s: Ditto.
6615 2010-02-11 Ian Lance Taylor <iant@google.com>
6617 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6619 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6620 Allocate_commons_task first.
6621 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6622 task, rather than symtab_lock_.
6623 (Gc_process_relocs::~Gc_process_relocs): New function.
6624 (Gc_process_relocs::is_runnable): Check this_blocker_.
6625 (Gc_process_relocs::locks): Use next_blocker_ rather than
6627 (Scan_relocs::~Scan_relocs): New function.
6628 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6630 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6632 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6633 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6634 constructor accordingly.
6635 (class Gc_process_relocs): Likewise.
6636 (class Scan_relocs): Likewise.
6637 * common.h (class Allocate_commons_task): Remove symtab_lock_
6638 field, and corresponding constructor parameter.
6639 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6641 (Allocate_commons_task::locks): Likewise.
6643 2010-02-11 Ian Lance Taylor <iant@google.com>
6645 * gold-threads.h (class Once): Define.
6646 (class Initialize_lock): Rewrite as child of Once.
6647 * gold-threads.cc (class Once_initialize): Define.
6648 (once_pointer_control): New static variable.
6649 (once_pointer, once_arg): New static variables.
6650 (c_run_once): New static function.
6651 (Once::Once, Once::run_once, Once::internal_run): New functions.
6652 (class Initialize_lock_once): Remove.
6653 (initialize_lock_control): Remove.
6654 (initialize_lock_pointer): Remove.
6655 (initialize_lock_once): Remove.
6656 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6657 (Initialize_lock::initialize): Rewrite.
6658 (Initialize_lock::do_run_once): New function.
6659 * archive.cc (Archive::interpret_header): Only clear name if it is
6661 * fileread.cc: Include "gold-threads.h"
6662 (file_counts_lock): New static variable.
6663 (file_counts_initialize_lock): Likewise.
6664 (File_read::release): Only increment counts when using --stats.
6665 Use a lock around the increment.
6666 * parameters.cc (class Set_parameters_target_once): Define.
6667 (set_parameters_target_once): New static variable.
6668 (Parameters::Parameters): Move here from parameters.h.
6669 (Parameters::set_target): Rewrite.
6670 (Parameters::set_target_once): New function.
6671 (Parameters::clear_target): Move here and rewrite.
6672 * parameters.h (class Parameters): Update declarations. Add
6673 set_parameters_target_once_ field.
6674 (Parameters::Parameters): Move to parameters.cc.
6675 (Parameters::clear_target): Likewise.
6676 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6678 (Start_group::~Start_group): New function.
6679 (Start_group::is_runnable): New function.
6680 (Start_group::locks, Start_group::run): New functions.
6681 (Finish_group::run): Change saw_undefined to size_t.
6682 * readsyms.h (class Start_group): Define.
6683 (class Finish_group): Change saw_undefined_ field to size_t.
6684 (Finish_group::Finish_group): Remove saw_undefined and
6685 this_blocker parameters. Change all callers.
6686 (Finish_group::set_saw_undefined): New function.
6687 (Finish_group::set_blocker): New function.
6688 * symtab.h (class Symbol_table): Change saw_undefined to return
6689 size_t. Change saw_undefined_ field to size_t.
6690 * target-select.cc (Set_target_once::do_run_once): New function.
6691 (Target_selector::Target_selector): Initialize set_target_once_
6692 field. Don't initialize lock_ and initialize_lock_ fields.
6693 (Target_selector::instantiate_target): Rewrite.
6694 (Target_selector::set_target): New function.
6695 * target-select.h (class Set_target_once): Define.
6696 (class Target_selector): Update declarations. Make
6697 Set_target_once a friend. Remove lock_ and initialize_lock_
6698 fields. Add set_target_once_ field.
6700 2010-02-10 Ian Lance Taylor <iant@google.com>
6702 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6704 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6705 (queue_middle_tasks): Add all blockers before queueing any tasks.
6706 (queue_final_tasks): Likewise.
6707 * token.h (Task_token::add_blockers): New function.
6708 * object.h (Input_objects::number_of_relobjs): New function.
6710 2010-02-10 Ian Lance Taylor <iant@google.com>
6712 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6713 shared, not if not position independent.
6714 * x86_64.cc (Relocate::relocate_tls): Likewise.
6715 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6716 (tls_pie_pic_test): New target.
6717 * testsuite/Makefile.in: Rebuild.
6719 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6720 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6721 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6722 * testsuite/Makefile.in: Rebuild.
6724 2010-02-09 David S. Miller <davem@davemloft.net>
6726 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6727 R_SPARC_RELATIVE using ->add_local_relative().
6728 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6730 * output.h (Output_data_dynamic::add_section_size): New method
6731 that takes two Output_data objects.
6732 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6733 entry param. Handle it in initializers.
6734 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6735 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6736 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6738 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6739 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6740 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6741 for dynrel_includes_plt.
6742 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6743 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6744 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6746 (Target_sparc::do_finalize_sections): Update to pass true for
6747 dynrel_includes_plt.
6748 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6749 output before .rela.plt
6750 (Target_powerpc::do_finalize_sections): Update to pass true for
6751 dynrel_includes_plt when 32-bit.
6753 2010-02-08 Doug Kwan <dougkwan@google.com>
6755 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6757 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6758 Arm_relobj::scan_section_for_cortex_a8_stubs,
6759 Arm_relobj::do_relocation_section): Instead of calling
6760 Output_section::output_address, use faster
6761 Arm_relobj::simple_input_section_output_address.
6763 2010-02-08 David S. Miller <davem@davemloft.net>
6765 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6766 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6767 relocation helper function.
6769 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6770 just like R_SPARC_GOT{10,13,22}.
6771 (Target_sparc::Scan::local): Likewise.
6772 (Target_sparc::Relocate:relocate): Likewise.
6774 2010-02-06 Ian Lance Taylor <iant@google.com>
6776 * configure.ac: Rewrite targetobjs duplicate removal code to use
6777 only shell constructs.
6778 * configure: Rebuild.
6780 2010-02-05 Doug Kwan <dougkwan@google.com>
6783 * arm.cc (Arm_relobj::section_is_scannable): New method.
6784 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6785 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6787 2010-02-04 Doug Kwan <dougkwan@google.com>
6790 * arm-reloc-property.cc (cstdio): Include.
6791 * configure.ac (targetobjs): Remove duplicates.
6792 * configure: Regenerate.
6793 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6794 big and little endian version for a given address size.
6796 2010-02-03 Doug Kwan <dougkwan@google.com>
6798 * arm-reloc-property.cc
6799 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6801 * arm-reloc-property.h
6802 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6803 New method definition.
6804 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6806 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6808 (GOT_PREL): Change implemented to Y.
6809 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6810 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6811 (Arm_relocate_functions::movw_abs_nc): Remove method.
6812 (Arm_relocate_functions::movt_abs): Ditto.
6813 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6814 (Arm_relocate_functions::thm_movt_abs): Ditto.
6815 (Arm_relocate_functions::movw_rel_nc): Ditto.
6816 (Arm_relocate_functions::movw_rel): Ditto.
6817 (Arm_relocate_functions::movt_rel): Ditto.
6818 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6819 (Arm_relocate_functions:thm_movw_rel): Ditto.
6820 (Arm_relocate_functions:thm_movt_rel): Ditto.
6821 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6822 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6823 New method definitions.
6824 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6825 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6826 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6827 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6828 (Target_arm::Relocate::relocate): Check for non-static or
6829 unimplemented relocation code and exit early. Change calls to
6830 Target_arm::reloc_uses_thumb_bit and
6831 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6832 instead. Refactor code to handle similar relocations to increase
6833 code sharing. Remove check for unsupported relocation code in switch
6835 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6836 relocation property table to find out size. Change error message to
6837 print out the name of a relocation code instead of the numeric value.
6838 (Target_arm::scan_reloc_for_stub): Use relocation property table
6839 instead of calling Target_arm::reloc_uses_thumb_bit().
6841 2010-02-02 Doug Kwan <dougkwan@google.com>
6843 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6844 types of relaxed input section.
6846 2010-02-02 Doug Kwan <dougkwan@google.com>
6848 * Makefile.am (HFILES): Add arm-reloc-property.h.
6850 (TARGETSOURCES): Add arm-reloc-property.cc
6851 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6852 (libgold_a_SOURCES): $(DEFFILES)
6853 * Makefile.in: Regenerate.
6854 * arm-reloc-property.cc: New file.
6855 * arm-reloc-property.h: New file.
6856 * arm-reloc.def: New file.
6857 * arm.cc: Update comments.
6858 (arm-reloc-property.h): New included header.
6859 (arm_reloc_property_table): New global variable.
6860 (Target_arm::do_select_as_default_target): New method definition.
6861 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6862 arm-reloc-property to targ_extra_obj.
6863 * parameters.cc (set_parameters_target): Call
6864 Target::select_as_default_target().
6865 * target.h (Target::select_as_default_target): New method definition.
6866 (Target::do_select_as_default_target): Same.
6868 2010-02-01 Doug Kwan <dougkwan@google.com>
6870 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6871 first_output_text_section_.
6872 (Arm_exidx_fixup::first_output_text_section): New method definition.
6873 (Arm_exidx_fixup::first_output_text_section_): New data member.
6874 (Arm_exidx_fixup::process_exidx_section): Record the first text
6875 output section seen.
6876 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6877 and entsize in output section header.
6879 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6881 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6882 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6883 (Arm_relocate_functions::thm_alu11): New Method.
6884 (Arm_relocate_functions::thm_pc8): New Method.
6885 (Arm_relocate_functions::thm_pc12): New Method.
6886 (Target_arm::Scan::local): Handle the relocations.
6887 (Target_arm::Scan::global): Likewise.
6888 (Target_arm::Relocate::relocate): Likewise.
6889 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6891 2010-01-29 Doug Kwan <dougkwan@google.com>
6893 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6894 of relocation types as ld.
6896 2010-01-29 Doug Kwan <dougkwan@google.com>
6898 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6900 (Arm_relocate_functions::thumb_branch_common): Ditto.
6901 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6902 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6903 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6904 Arm_relocate_functions::jump24): Remove.
6905 (Target_arm::Relocate::relocate): Adjust code to call
6906 Arm_relocation_functions::arm_branch_common and
6907 Arm_relocation_functions::thumb_branch_common instead of their removed
6908 wrappers. Merge switch-cases together to reduce source code size.
6910 2010-01-29 Doug Kwan <dougkwan@google.com>
6912 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6913 output_local_symbol_count_needs_update_.
6914 (Arm_relobj::output_local_symbol_count_needs_update,
6915 Arm_relobj::set_output_local_symbol_count_needs_update,
6916 Arm_relobj::update_output_local_symbol_count): New methods.
6917 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6919 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6920 of pointed function as in a R_ARM_PREL31 relocation.
6921 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6922 for output local symbol count updating.
6923 (Target_arm::do_relax): Update output local symbol counts in objects
6925 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6927 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6929 * arm.cc: Added support for the ARM relocations:
6930 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6931 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6932 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6934 (Arm_relocate_functions::movw_rel): New method.
6935 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6936 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6938 (Arm_relocate_functions::thm_movw_rel): New method.
6939 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6941 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6943 (Target_arm::Scan::global): Likewise.
6944 (Target_arm::Relocate::relocate): Likewise.
6945 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6948 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6950 * arm.cc: Added support for ARM group relocations.
6951 (Target_arm::reloc_needs_sym_origin): New method.
6952 (Arm_relocate_functions::calc_grp_kn): New method.
6953 (Arm_relocate_functions::calc_grp_residual): New method.
6954 (Arm_relocate_functions::calc_grp_gn): New method.
6955 (Arm_relocate_functions::arm_grp_alu): New Method.
6956 (Arm_relocate_functions::arm_grp_ldr): New Method.
6957 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6958 (Arm_relocate_functions::arm_grp_ldc): New Method.
6959 (Target_arm::Scan::local): Handle the ARM group relocations.
6960 (Target_arm::Scan::global): Likewise.
6961 (Target_arm::Relocate::relocate): Likewise.
6962 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6965 2010-01-26 Doug Kwan <dougkwan@google.com>
6967 * arm.cc (set): Include.
6968 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6970 (Arm_output_section::Text_section_list): New type.
6971 (Arm_output_section::append_text_sections_to_list): New method.
6972 (Arm_output_section::fix_exidx_coverage): Ditto.
6973 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6974 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6975 Relobj::set_section_offset() instead of
6976 Sized_relobj::invalidate_section_offset().
6977 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6978 parameter for section headers. Ignore relocation sections for
6979 unallocated sections and EXIDX sections.
6980 (Target_arm::fix_exidx_coverage): New method.
6981 (Target_arm::output_section_address_less_than): New type.
6982 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6983 linked text section instead of the EXIDX section.
6984 (Arm_output_section::create_stub_group): Add an assertion to check
6985 that this is not an EXIDX output section.
6986 (Arm_output_section::append_text_sections_to_list): New method.
6987 (Arm_output_section::fix_exidx_coverage): Ditto.
6988 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6989 Arm_relobj::section_needs_reloc_stub_scanning.
6990 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6992 (Target_arm::fix_exidx_coverage): New method.
6993 * object.h (Relobj::set_output_section): New method.
6994 (Sized_relobj::invalidate_section_offset): Remove method.
6995 (Sized_relobj::do_invalidate_section_offset): Remove method.
6996 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6998 2010-01-25 Doug Kwan <dougkwan@google.com>
7000 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7001 Fix warning due to signed and unsigned comparison on a 32-bit host.
7003 2010-01-22 Doug Kwan <dougkwan@google.com>
7005 * arm.cc (Target_arm::do_relax): Record an output section for section
7006 offset adjustment it contains any stub table that has changed.
7007 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7008 offsets in an output section if necessary.
7009 * output.cc (Output_section::Output_section): Initialize
7010 section_offsets_need_adjustments_.
7011 (Output_section::add_input_section_for_script): Renamed to
7012 Output_section::add_simple_input_section.
7013 (Output_section::save_states): Add a comment.
7014 (Output_section::discard_states): New method defintion.
7015 (Output_section::adjust_section_offsets): Same.
7016 * output.h (Output_section::add_input_section_for_script): Renamed to
7017 Output_section::add_simple_input_section.
7018 (Output_section::discard_states): New method declaration.
7019 (Output_section::adjust_section_offsets): Same.
7020 (Output_section::section_offsets_need_adjustment,
7021 Output_section::set_section_offsets_need_adjustment): New method
7023 (Output_section::section_offsets_need_adjustment_): New data member.
7024 * script-sections.cc
7025 (Output_section_element_input::set_section_address): Adjust code for
7026 renaming of Output_section::add_input_section_for_script.
7027 (Orphan_output_section::set_section_address): Same.
7029 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7031 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7032 Fix_v4bx enum values .
7033 * gold/options.h (General_options): New option definitions.
7034 (General_options::fix_v4bx): New method.
7035 (General_options::Fix_v4bx): New enum.
7036 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7037 (General_options::parse_fix_v4bx_interworking): New method.
7039 2010-01-22 Doug Kwan <dougkwan@google.com>
7041 * arm.cc (Arm_exidx_fixup): New class.
7043 2010-01-21 Doug Kwan <dougkwan@google.com>
7045 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7047 (Arm_exidx_section_offset_map): New type.
7049 2010-01-21 Doug Kwan <dougkwan@google.com>
7051 * arm.cc (Arm_exidx_input_section): New class.
7052 (Arm_relobj::exidx_input_section_by_link,
7053 Arm_relobj::exidx_input_section_by_shndx,
7054 Arm_relobj::make_exidx_input_section): New methods.
7055 (read_arm_attributes_section): Remove.
7056 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7057 information about them.
7058 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7061 2010-01-20 Doug Kwan <dougkwan@google.com>
7063 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7064 Input_section_specifier to Section_id.
7065 (Target_arm::new_arm_input_section: Adjust code for change of key
7067 (Target_arm::find_arm_input_section): Ditto.
7068 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7069 (Section_id): Remove.
7070 (Garbage_collection::Section_id_hash): Remove.
7071 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7072 (Section_id): Remove.
7073 (Icf::Section_id_hash): Remove.
7074 * object.h (Section_id, Const_section_id, Section_id_hash,
7075 Const_section_id_hash): New type definitions.
7076 * output.cc (Output_section::add_relaxed_input_section): Change to
7077 use Const_section_id instead of Input_section_specifier as key type.
7078 (Output_section::add_merge_input_section): Ditto.
7079 (Output_section::build_relaxation_map): Change to use Section_id
7080 instead of Input_section_specifier as key type.
7081 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7083 (Output_section::convert_input_sections_to_relaxed_sections): Change
7084 to use Const_section_id instead of Input_section_specifier as key type.
7085 (Output_section::find_merge_section): Ditto.
7086 (Output_section::find_relaxed_input_section): Ditto.
7087 * output.h (Input_section_specifier): Remove class.
7088 (Output_section::Output_section_data_by_input_section_map): Change
7089 key type to Const_section_id.
7090 (Output_section::Output_relaxed_input_section_by_input_section_map):
7092 (Output_section::Relaxation_map): Change key type to Section_id.
7094 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7096 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7097 (class Arm_v4bx_stub): New class.
7098 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7099 (Stub_factory::make_arm_v4bx_stub): New method.
7100 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7101 (Stub_table::empty): Handle v4bx stubs.
7102 (Stub_table::add_arm_v4bx_stub): New method.
7103 (Stub_table::find_arm_v4bx_stub): New method.
7104 (Arm_relocate_functions::v4bx): New method.
7105 (Target_arm::fix_v4bx): New method.
7106 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7107 (Stub_table::relocate_stubs): Likewise.
7108 (Stub_table::do_write): Likewise.
7109 (Stub_table::update_data_size_and_addralign): Likewise.
7110 (Stub_table::finalize_stubs): Likewise.
7111 (Target_arm::Scan::local): Likewise.
7112 (Target_arm::Scan::global): Likewise.
7113 (Target_arm::do_finalize_sections): Likewise.
7114 (Target_arm::Relocate::relocate): Likewise.
7115 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7117 (Target_arm::scan_reloc_for_stub): Likewise.
7118 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7120 2010-01-19 Ian Lance Taylor <iant@google.com>
7122 * output.cc (Output_section_headers::do_sized_write): Write large
7123 segment count to sh_info field.
7124 (Output_file_header::do_sized_write): For large segment count,
7125 write PN_XNUM to e_phnum field.
7127 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7129 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7130 (Arm_relocate_functions::thm_jump8): New function.
7131 (Arm_relocate_functions::thm_jump11): New function.
7132 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7134 (Target_arm::Scan::global): Likewise.
7135 (Target_arm::Relocate::relocate): Likewise.
7136 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7139 2010-01-14 Doug Kwan <dougkwan@google.com>
7141 * arm.cc (map, utility): Include headers.
7142 (Target_arm::apply_cortex_a8_workaround): New method.
7143 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7144 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7145 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7146 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7147 the --[no-]fix-cortex-a8 command line options.
7148 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7149 (Target_arm::relocate_stub): Use addend in instruction template.
7150 * options.h (DEFINE_bool): Set the user-set flag.
7151 (General_options): Add --[no-]-fix-cortex options.
7152 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7153 : Update fast look-up map after conversion.
7155 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7157 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7158 in the first pass of do_layout.
7160 2010-01-13 Doug Kwan <dougkwan@google.com>
7162 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7163 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7164 apparent compiler problem of not folding static constant integral
7165 data members of elfcpp::Elf_sizes<32>.
7167 2010-01-13 Doug Kwan <dougkwan@google.com>
7169 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7170 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7171 Arm_relobj::scan_section_for_cortex_a8_erratum,
7172 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7173 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7174 sections to scan for relocation stubs into a new method
7175 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7176 relocation and Cortex-A8 stub scanning.
7177 (Target_arm::do_relax): Force stubs to be after stubbed sections
7178 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7179 the beginning of a new relaxation pass. Update a comment.
7180 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7182 2010-01-12 Ian Lance Taylor <iant@google.com>
7184 * target-reloc.h (visibility_error): New inline function.
7185 (relocate_section): Call visibility_error.
7186 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7187 (MOSTLYCLEANFILES): Likewise.
7188 (protected_4_pic.o, protected_3.err): New targets.
7189 * testsuite/protected_4.cc: New file.
7191 2010-01-12 Doug Kwan <dougkwan@google.com>
7193 * arm.cc (Cortex_a8_reloc): New class.
7194 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7195 and cortex_a8_relocs_info_.
7196 (Target_arm::fix_cortex_a8): New method definition.
7197 (Target_arm::Cortex_a8_relocs_info): New type.
7198 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7199 New data member declarations.
7200 (Target_arm::scan_reloc_for_stub): Record information about
7201 relocations for THUMB branches that might be exempted from the
7202 Cortex-A8 workaround.
7203 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7204 at the beginning of a relaxation pass.
7206 2010-01-12 Doug Kwan <dougkwan@google.com>
7208 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7209 (Arm_relobj::Mapping_symbol_position,
7210 Arm_reloj::Mapping_symbol_position_less,
7211 Arm_relobj::Mapping_symbols_info): New types.
7212 (Target_arm::is_mapping_symbol_name): New method definition.
7213 (Arm_relobj::do_count_local_symbols): Save information about mapping
7216 2010-01-11 Doug Kwan <dougkwan@google.com>
7218 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7219 Arm_relocate_functions::thumb32_branch_upper,
7220 Arm_relocate_functions::thumb32_branch_lower,
7221 Arm_relocate_functions::thumb32_cond_branch_offset,
7222 Arm_relocate_functions::thumb32_cond_branch_upper,
7223 Arm_relocate_functions::thumb32_cond_branch_lower,
7224 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7225 branch offset encoding.
7226 (Arm_relocate_functions::thumb_branch_common): Use new branch
7227 offset encoding methods to avoid code duplication.
7228 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7229 (Stub_addend_reader::operator()): Use new branch encoding method
7230 to avoid code duplication.
7232 2010-01-11 Doug Kwan <dougkwan@google.com>
7234 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7235 (Target_arm::do_finalize_sections): Define special EXIDX section
7236 symbols only if referenced.
7237 * gc.h (Garbage_collection::add_reference): New method.
7238 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7241 2010-01-11 Ian Lance Taylor <iant@google.com>
7243 * script.cc (Version_script_info::build_expression_list_lookup):
7244 Change complaing about duplicate wildcard match from error to
7247 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7249 (Version_script_info::Version_script_info): Initialize globs_,
7250 default_version_, default_is_global_, and exact_. Don't
7251 initialize globals_ or locals_.
7252 (Version_script_info::build_lookup_tables): Build local symbols
7254 (Version_script_info::unquote): New function.
7255 (Version_script_info::add_exact_match): New function.
7256 (Version_script_info::build_expression_list_lookup): Remove lookup
7257 parameter. Add is_global parameter. Change all callers. Handle
7258 wildcard pattern specially. Unquote pattern. Call
7260 (Version_script_info::get_name_to_match): New function.
7261 (Version_script_info::get_symbol_version): New function.
7262 (Version_script_info::get_symbol_version_helper): Remove.
7263 (Version_script_info::check_unmatched_names): Call unquote.
7264 * script.h (class Version_script_info): Change get_symbol_version
7265 to be non-inline and add is_global parameter; change all callers.
7266 Rewrite symbol_is_local. Update declarations. Define struct
7267 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7268 Remove globals_ and locals_ members. Add exact_, globs_,
7269 default_version_, is_global_.
7270 (Version_script_info::Glob): Remove pattern, add expression and
7271 is_global. Update constructor. Change all callers.
7272 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7274 (Versions::symbol_section_contents): If a symbol is undefined, or
7275 defined in a dynamic object, set the version index to
7277 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7279 (Symbol_table::add_from_pluginobj): Likewise.
7280 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7282 2010-01-11 Doug Kwan <dougkwan@google.com>
7284 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7285 (incremental_dump_LDADD): Add linking option for libintl.
7286 * Makefile.in: Regenerate.
7288 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7291 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7293 * testsuite/Makefile.in: Regenerated.
7295 2010-01-10 Doug Kwan <dougkwan@google.com>
7297 * options.h (DEFINE_var): Use parentheses around argument varname__
7298 in macro body to avoid any unintended subsequent substitutions.
7300 2010-01-10 Ian Lance Taylor <iant@google.com>
7302 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7303 candidates before doing symbol resolution.
7305 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7306 ODR candidates if only one is weak.
7308 2010-01-08 Ian Lance Taylor <iant@google.com>
7310 * script.cc (Version_script_info::build_expression_list_lookup):
7311 Don't warn about ambiguous version, just record the ambiguity.
7312 (Version_script_info::get_symbol_version_helper): Give error if
7313 version is ambiguous.
7315 2010-01-08 Doug Kwan <dougkwan@google.com>
7317 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7318 prev_data_size_ and prev_addralign_. Remove initializer for
7319 deleted data member has_been_changed_.
7320 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7321 to determine if the table is empty.
7322 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7324 (Stub_table::add_reloc_stub): Define method in class definition
7325 instead of just declaring it there.
7326 (Stub_table::add_cortex_a8_stub): New method definition.
7327 (Stub_table::update_data_size_and_addralign): Ditto.
7328 (Stub_table::finalize_stubs): Ditto.
7329 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7330 (Stub_table::do_addralign_): Return address alignment in the
7331 (Stub_table::do_reset_address_and_file_offset): Define method in
7332 class definition instead of declaring it there. Set current data
7333 size to be the data size of the previous pass.
7334 (Stub_table::set_final_data_size): Use current data size as the
7336 (Stub_table::relocate_stub): Change parameter type of stub from
7337 Reloc_stub pointer to Stub pointer.
7338 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7339 (Stub_table::Cortex_a8_stub_list): New typedef.
7340 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7341 Stub_table::prev_addralign_): New data member.
7342 (Arm_relobj::Arm_relobj): Initialize data member
7343 section_has_cortex_a8_workaround_.
7344 (Arm_relobj::section_has_cortex_a8_workaround,
7345 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7347 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7349 (Target_arm::relocate_stub): Change parameter type of stub from
7350 Reloc_stub pointer to Stub pointer.
7351 (Insn_template::size, Insn_template::alignment): Handle
7352 THUMB16_SPECIAL_TYPE.
7353 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7354 Stub_table::update_data_size_and_addralign,
7355 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7357 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7358 (Stub_table::do_write): Ditto.
7359 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7361 2010-01-08 Ian Lance Taylor <iant@google.com>
7364 * symtab.h (class Symbol): Remove fields is_target_special_ and
7365 has_plt_offset_. Add field is_defined_in_discarded_section_.
7366 (Symbol::is_defined_in_discarded_section): New function.
7367 (Symbol::set_is_defined_in_discarded_section): New function.
7368 (Symbol::has_plt_offset): Rewrite.
7369 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7370 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7371 Don't initialize is_target_special_ or has_plt_offset_.
7372 Initialize is_defined_in_discarded_section_.
7373 (Symbol_table::add_from_relobj): If appropriate, set
7374 is_defined_in_discarded_section.
7375 * resolve.cc (Symbol::override_base_with_special): Don't test
7376 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7377 * target-reloc.h (relocate_section): Do special handling for
7378 symbols defined in discarded sections for global symbols as well
7381 2010-01-08 Ian Lance Taylor <iant@google.com>
7383 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7384 the SHT_SYMTAB case.
7386 2010-01-08 Ian Lance Taylor <iant@google.com>
7388 * object.cc (Sized_relobj::do_layout): Don't get confused if
7389 layout_eh_frame returns NULL.
7391 2010-01-08 Ian Lance Taylor <iant@google.com>
7394 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7395 dynamic symbol table, use the normal symbol table.
7396 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7399 2010-01-08 Ian Lance Taylor <iant@google.com>
7402 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7405 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7407 * version.cc (print_version): Change to "Copyright 2010".
7409 2010-01-08 Ian Lance Taylor <iant@google.com>
7413 * i386.cc (class Target_i386): Change return type of plt_section
7415 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7416 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7417 tls_desc_rel_ field.
7418 (Output_data_plt_i386::rel_tls_desc): New function.
7419 (Target_i386::rel_tls_desc_section): New function.
7420 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7421 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7422 R_386_TLS_DESC reloc in rel_tls_desc_section.
7423 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7424 Define struct Tlsdesc_info.
7425 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7426 (Target_x86_64::do_reloc_symbol_index): New function.
7427 (Target_x86_64::add_tlsdesc_info): New function.
7428 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7429 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7431 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7433 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7434 (Target_x86_64::rela_tlsdesc_section): New function.
7435 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7437 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7438 (Target_x86_64::do_reloc_addend): New function.
7439 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7440 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7441 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7442 (Output_reloc::type): New function.
7443 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7444 (Output_reloc::is_target_specific): New function.
7445 (Output_reloc::target_arg): New function.
7446 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7447 absolute relocs and target specific relocs.
7448 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7449 add_target_specific.
7450 (class Output_data_reloc) [SHT_RELA]: Likewise.
7451 * output.cc (Output_reloc::Output_reloc): Add four new versions
7452 for absolute relocs and target specific relocs.
7453 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7454 (Output_reloc::get_symbol_index): Likewise.
7455 (Output_reloc::local_section_offset): Check that local_sym_index_
7456 is not TARGET_CODE or 0.
7457 (Output_reloc::symbol_value): Likewise.
7458 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7460 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7461 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7463 * layout.cc (add_target_dynamic_tags): Use output section for
7464 DT_PLTRELSZ and DT_JMPREL.
7466 2010-01-07 Ian Lance Taylor <iant@google.com>
7469 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7471 (class Output_data_reloc_generic): Define.
7472 (class Output_data_reloc_base): Change base class to
7473 Output_data_reloc_generic. Change add() method to call
7474 bump_relative_reloc_count for a relative reloc. Remove
7476 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7478 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7479 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7481 * layout.h (class Layout): Update declaration.
7483 2010-01-07 Ian Lance Taylor <iant@google.com>
7485 * output.h (class Output_data): Add const version of
7486 output_section and do_output_section.
7487 (class Output_section_data): Add const version of
7489 (class Output_section): Likewise.
7490 * layout.cc (Layout::add_target_dynamic_tags): New function.
7491 * layout.h (class Layout): Update declarations.
7492 * arm.cc (Target_arm::do_finalize_sections): Use
7493 add_target_dynamic_tags.
7494 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7495 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7496 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7497 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7499 2010-01-07 Ian Lance Taylor <iant@google.com>
7502 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7505 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7506 Ian Lance Taylor <iant@google.com>
7509 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7510 Xindex::read_symtab_xindex.
7512 2010-01-07 Doug Kwan <dougkwan@google.com>
7514 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7515 (Insn_template::thumb16_bcond_insn): New method declaration.
7516 (Insn_template): Fix spelling.
7517 (Stub::thumb16_special): New method declaration.
7518 (Stub::do_write): Define virtual method which was previously pure
7520 (Stub::do_thumb16_special): New method declaration.
7521 (Stub::do_fixed_endian_write): New template member.
7522 (Reloc_stub::do_write): Remove.
7523 (Reloc_stub::do_fixed_endian_write): Remove.
7524 (Cortex_a8_stub): New class definition.
7525 (Stub_factory::make_cortex_a8_stub): New method definition.
7526 (Stub_factory::Stub_factory): Add missing static storage class
7527 qualifier for elf32_arm_stub_a8_veneer_blx.
7529 2010-01-07 Ian Lance Taylor <iant@google.com>
7532 * options.h (class General_options): Add --warn-unresolved-symbols
7533 and --error-unresolved-symbols.
7534 * errors.cc (Errors::undefined_symbol): Implement
7535 --warn-unresolved-symbols.
7537 * options.h (class General_options): Add -z text and -z textoff.
7538 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7540 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7542 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7543 (Garbage_collection::cident_sections): New function.
7544 (Garbage_collection::add_cident_section): New function.
7545 (Garbage_collection::cident_sections_): New member.
7546 (gc_process_relocs): Add references to sections whose names are C
7548 * gold.h (cident_section_start_prefix): New constant.
7549 (cident_section_stop_prefix): New constant.
7550 (is_cident): New function.
7551 * layout.cc (Layout::define_section_symbols): Replace string constants
7552 with the newly defined constants.
7553 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7555 * testsuite/Makefile.am: Add gc_orphan_section_test.
7556 * testsuite/Makefile.in: Regenerate.
7557 * testsuite/gc_orphan_section_test.cc: New file.
7558 * testsuite/gc_orphan_section_test.sh: New file.
7560 2010-01-06 Ian Lance Taylor <iant@google.com>
7563 * options.h (class General_options): Add --warn-shared-textrel.
7564 * layout.cc (Layout::finish_dynamic_section): Implement
7565 --warn-shared-textrel.
7568 * options.h (class General_options): Add --warn-multiple-gp.
7570 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7572 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7573 $(THREADSLIB) and $(LIBDL).
7574 * Makefile.in: Rebuild.
7576 2010-01-06 Ian Lance Taylor <iant@google.com>
7579 * options.cc (General_options::parse_section_start): New function.
7580 (General_options::section_start): New function.
7581 (General_options::General_options): Initialize all members.
7582 * options.h: Include <map>
7583 (class General_options): Add --section-start. Add section_starts_
7585 * layout.cc (Layout::attach_allocated_section_to_segment): If
7586 --section-start was used, set the address of the segment. Remove
7587 local sort_sections.
7588 (Layout::relaxation_loop_body): If the address of the load segment
7589 has been set by --section-start, don't use it.
7590 * output.h (Output_segment::update_flags_for_output_section): New
7592 * output.cc (Output_segment::add_output_section): Call
7593 update_flags_for_output_section.
7595 2010-01-05 Ian Lance Taylor <iant@google.com>
7598 * options.h (class General_options): Add --undefined-version.
7599 * script.cc (struct Version_expression): Add was_matched_by_symbol
7601 (Version_script_info::matched_symbol): New function.
7602 (Version_script_info::get_symbol_version_helper): Call
7604 (Version_script_info::check_unmatched_names): New function.
7605 * script.h (class Version_script_info): Update declarations.
7606 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7608 * options.h (class General_options): Use DEFINE_bool_alias for
7609 allow_multiple_definition.
7610 * resolve.cc (Symbol_table::should_override): Don't test
7611 allow_multiple_definition.
7614 * options.h (class General_options): Add --cref.
7615 * main.cc (main): Print cref table if --cref. Don't close mapfile
7616 until after printing cref table.
7617 * cref.cc: Include "symtab.h".
7618 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7619 (Cref_table_compare::operator()): New function.
7620 (Cref_inputs::gather_cref): New function.
7621 (filecol): New static const.
7622 (Cref_inputs::print_cref): New function.
7623 (Cref::print_cref): New function.
7624 * cref.h: Include <cstdio>.
7625 (class Cref): Update declarations.
7626 * mapfile.h (Mapfile::file): New function.
7627 * object.h (class Object): Define Symbols. Declare virtual
7628 do_get_global_symbols.
7629 (Object::get_global_symbols): New function.
7630 * object.cc (Input_objects::add_object): Pass object to cref_ if
7632 (Input_objects::archive_start): Likewise.
7633 (Input_objects::archive_stop): Likewise.
7634 (Input_objects::print_cref): New function.
7635 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7636 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7638 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7640 * plugin.h (class Sized_pluginobj): Update declarations.
7642 2010-01-05 Ian Lance Taylor <iant@google.com>
7644 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7645 to is_default_version. Rename insdef to insdefault.
7646 (Symbol_table::add_from_relobj): Rename def to is_default_version
7647 and local to is_forced_local.
7648 (Symbol_table::add_from_pluginobj): Likewise.
7649 (Symbol_table::add_from_dynobj): Likewise.
7650 (Symbol_table::define_special_symbol): Rename insdef to
7653 2010-01-04 Ian Lance Taylor <iant@google.com>
7656 * options.h (class General_options): Add
7657 --allow-multiple-definition and -z muldefs.
7658 * resolve.cc (Symbol_table::should_override): Don't warn about a
7659 multiple symbol definition if --allow-multiple-definition or -z
7663 * options.h (class General_options): Add --add-needed and
7664 --copy-dt-needed-entries. Tweak --as-needed help entry.
7665 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7666 error if --copy-dt-needed-entries aka --add-needed is used and
7667 would cause a change in behaviour.
7670 * options.h (class General_options): Add -G as a short version of
7671 --shared. Add no-op options -assert, -g, and -i.
7673 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7675 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7676 check for .text or .gnu.linkonce.t sections.
7677 * icf.cc (Icf::find_identical_sections): Ditto.
7678 Change the detection for mangled function name within the section
7680 * icf.h (is_section_foldable_candidate): New function.
7682 2009-12-30 Ian Lance Taylor <iant@google.com>
7685 * options.h (class General_options): Permit two dashes with
7686 --retain-symbols-file.
7688 2009-12-30 Ian Lance Taylor <iant@google.com>
7691 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7692 don't put the file header and segment headers in the text
7696 * common.cc (Sort_commons::operator()): Stabilize sort when both
7698 (Symbol_table::do_allocate_commons_list): When allocating common
7699 symbols, skip a symbol which is no longer common.
7700 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7701 an object before checking its type.
7702 * testsuite/common_test_2.c: New file.
7703 * testsuite/common_test_3.c: New file.
7704 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7705 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7706 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7707 (common_test_2_pic.o, common_test_2.so): New targets.
7708 (common_test_3_pic.o, common_test_3.so): New targets.
7709 * testsuite/Makefile.in: Rebuild.
7712 * script.cc (read_input_script): If we see a new SECTIONS clause,
7713 and we have added an input section, give an error.
7714 * layout.h (class Layout): Add have_added_input_section function.
7715 Add have_added_input_section_ field.
7716 * layout.cc (Layout::Layout): Initialize
7717 have_added_input_section_.
7718 (Layout::layout): Set have_added_input_section_.
7719 (Layout::layout_eh_frame): Likewise.
7721 2009-12-30 Ian Lance Taylor <iant@google.com>
7724 * options.h (class General_options): Add --sort-common option.
7725 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7726 * common.cc (Sort_common): Add sort_order parameter to
7727 constructor. Add sort_order_ field.
7728 (Sort_commons::operator): Check sort_order_.
7729 (Symbol_table::allocate_commons): Determine the sort order.
7730 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7732 (Symbol_table::do_allocate_commons_list): Likewise.
7734 2009-12-30 Ian Lance Taylor <iant@google.com>
7737 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7738 symbols from this object, don't change the visibility of an
7740 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7742 2009-12-30 Ian Lance Taylor <iant@google.com>
7745 * script.h (class Version_script_info): Define Language enum.
7746 Update declarations. Define Glob, Exact, and Lookup types. Add
7747 new fields globals_, locals_, and is_finalized_.
7748 * script.cc: Various formatting fixes.
7749 (class Parser_closure): Change language_stack_ from a vector of
7750 std::string to one of Version_script_info::Language. Adjust all
7752 (class Lazy_demangler): Remove.
7753 (struct Version_expression): Change language from std::string to
7754 Version_script_info::Language.
7755 (Version_script_info::Version_script_info): New function.
7756 (Version_script_info::~Version_script_info): Don't call clear.
7757 (Version_script_info::finalize): New function.
7758 (Version_script_info::build_lookup_tables): New function.
7759 (Version_script_info::build_expression_list_lookup): New
7761 (Version_script_info::get_symbol_version_helper): Rewrite to use
7763 (Version_script_info::print_expression_list): Adjust to use
7764 Version_script_info::Language.
7765 (script_push_lex_into_version_mode): Check that the version script
7766 has not been finalized.
7767 (version_script_push_lang): Change language string to
7768 Version_script_info::Language.
7769 * options.cc (Command_line::version_script): New function.
7770 * options.h (class General_options): Add finalize_dynamic_list
7771 function. Change version_script from declaration to definition.
7772 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7773 * testsuite/version_script.map: Remove duplicate def of foo.
7774 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7776 * testsuite/Makefile.in: Rebuild.
7778 2009-12-30 Ian Lance Taylor <iant@google.com>
7781 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7782 if the input symbol index is 0, make the output symbol index 0.
7784 2009-12-30 Ian Lance Taylor <iant@google.com>
7787 * options.h (class General_options): Add -x/--discard-all.
7788 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7789 --discard-all. If the local symbol needs a dynamic entry, check
7790 that before handling --discard-locals.
7792 2009-12-30 Ian Lance Taylor <iant@google.com>
7795 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7797 (Output_segment::add_output_section): Don't change the flags if
7801 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7802 GNU hash table if they need a dynamic value. Otherwise, don't add
7803 them if they are defined in a dynamic object or are forced local.
7805 2009-12-29 Ian Lance Taylor <iant@google.com>
7808 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7809 .gnu.hash table for a 32-bit target.
7812 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7813 regular and a dynamic object only needs a dynamic symbol table
7814 entry if it is externally visible.
7817 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7818 constructor. Add global_offset_table_ field.
7819 (Target_i386::got_section): Set global_offset_table_.
7820 (Target_i386::do_finalize_sections): Set global_offset_table_
7822 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7823 in constructor. Add global_offset_table_ field.
7824 (Target_x86_64::got_section): Set global_offset_table_.
7825 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7828 * layout.cc (Layout::Layout): Initialize increase_relro_.
7829 (Layout::get_output_section): Add is_relro, is_last_relro, and
7830 is_first_non_relro parameters. Change all callers.
7831 (Layout::choose_output_section): Likewise.
7832 (Layout::add_output_section_data): Likewise.
7833 (Layout::make_output_section): Likewise.
7834 (Layout::set_segment_offsets): Clear increase_relro when using a
7836 * layout.h (class Layout): Add increase_relro method. Add
7837 increase_relro_ field. Update declarations.
7838 * output.cc (Output_section::Output_section): Initialize
7839 is_last_relro_ and is_first_non_relro_.
7840 (Output_segment::add_output_section): Group relro sections is
7841 do_sort is true. Handle is_last_relro and is_first_non_relro.
7842 (Output_segment::maximum_alignment): Remove relro handling.
7843 (Output_segment::set_section_addresses): Add increase_relro
7844 parameter. Change all callers. Add initial alignment to align
7845 relro sections on separate page. Remove old relro handling.
7846 (Output_segment::set_section_list_addresses): Remove in_relro
7847 parameter. Change all callers.
7848 (Output_segment::set_offset): Add increase parameter. Change all
7849 callers. Remove old relro handling.
7850 * output.h (class Output_section): Add new methods: is_last_relro,
7851 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7852 Add is_last_relro_ and is_first_non_relro_ fields.
7853 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7854 Create separate .got.plt section. Call increase_relro.
7855 * x86_64.cc (Target_x86_64::got_section): Likewise.
7856 * testsuite/relro_script_test.t: Add .got.plt.
7859 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7860 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7861 (Layout::finalize): Call set_dynamic_symbol_size.
7862 (Layout::set_dynamic_symbol_size): New function.
7863 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7864 set_dynamic_symbol_size.
7867 * output.h (class Output_section): Add is_entsize_zero_ field.
7868 * output.cc (Output_section::Output_section): Initialize
7870 (Output_section::set_entsize): If two different entsizes are
7871 requested, force it to zero.
7872 (Output_section::add_input_section): Set flags for .debug_str
7873 before updating section flags. Set entsize.
7874 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7875 and SHF_STRING if all input sections have those flags.
7877 2009-12-29 Rafael Espindola <espindola@google.com>
7879 * main.cc (main): Fix the sys time reporting.
7880 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7883 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7885 * options.cc (General_options::parse_version): Allow -v to exit
7886 without an error if there is nothing to link.
7888 2009-12-29 Ian Lance Taylor <iant@google.com>
7890 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7891 using a version of gcc before 4.1.
7892 * configure: Rebuild.
7894 2009-12-28 Chris Demetriou <cgd@google.com>
7896 * attributes.cc (Output_attributes_section_data::do_write): Use
7897 std::vector::front rather than std::vector::data.
7899 2009-12-28 Ian Lance Taylor <iant@google.com>
7901 * symtab.h (class Symbol_table): Add enum Defined.
7902 * resolve.cc (Symbol_table::should_override): Add defined
7903 parameter. Change all callers. Test whether object is NULL
7904 before calling a method on it.
7905 (Symbol_table::report_resolve_problem): Add defined parameter.
7907 (Symbol_table::should_override_with_special): Likewise.
7908 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7909 parameter. Change all callers.
7910 (Symbol_table::do_define_in_output_data): Likewise.
7911 (Symbol_table::define_in_output_segment): Likewise.
7912 (Symbol_table::do_define_in_output_segment): Likewise.
7913 (Symbol_table::define_as_constant): Likewise.
7914 (Symbol_table::do_define_as_constant): Likewise.
7915 * script.h (class Symbol_assignment): Add is_defsym parameter to
7916 constructor; change all callers.
7917 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7918 parameter. Change all callers. Add is_defsym_ field.
7919 (class Parser_closure): Add parsing_defsym parameter to
7920 constructor; change all callers. Add parsing_defsym accessor
7921 function. Add parsing_defsym_ field.
7923 2009-12-28 Ian Lance Taylor <iant@google.com>
7925 * gold.cc (queue_middle_tasks): Fix formatting.
7926 * object.cc (Relobj::is_section_name_included): Likewise.
7928 2009-12-23 Ian Lance Taylor <iant@google.com>
7930 * i386.cc (Target_i386::do_calls_non_split): Recognize
7931 -fsplit-stack prologue for a function with a static chain.
7932 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7933 -fsplit-stack prologue when using %r11.
7935 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7937 * options.cc (General_options::parse_version): Make -v continue and do
7938 the link like GNU ld does.
7940 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7942 * Makefile.am (CCFILES): Add timer.cc.
7943 (HFILES): Add timer.h.
7944 * configure.ac: Check for sysconf and times.
7945 * main.cc: include timer.h.
7946 (main): Use Timer instead of get_run_time.
7949 * workqueue.cc: include timer.h.
7950 (Workqueue::find_and_run_task):
7951 Report user, sys and wall time.
7952 * Makefile.in: Regenerate.
7953 * config.in: Regenerate.
7954 * configure: Regenerate.
7956 2009-12-16 Doug Kwan <dougkwan@google.com>
7958 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7960 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7961 relaxed input sections.
7962 * output.cc (Output_section::find_relaxed_input_section): Change
7963 return type to Output_relaxed_input_section pointer. Adjust code
7964 for new type of relaxed_input_section_map_.
7965 * output.h (Output_section::find_relaxed_input_section): Change
7966 return type to Output_relaxed_input_section pointer.
7967 (Output_section::Output_relaxed_input_section_by_input_section_map):
7969 (Output_section::relaxed_input_section_map_): Change type to
7970 Output_section::Output_relaxed_input_section_by_input_section_map.
7971 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7974 2009-12-15 Ian Lance Taylor <iant@google.com>
7976 * layout.cc (Layout::create_shstrtab): Only write out after input
7977 sections if we are compressing debug sections.
7979 2009-12-15 Ian Lance Taylor <iant@google.com>
7981 * archive.cc (Archive::add_symbols): Only look up a symbol without
7982 a version if there is, in fact, a version.
7984 2009-12-14 Ian Lance Taylor <iant@google.com>
7986 Revert -Wshadow changes, all changes from:
7987 2009-12-11 Doug Kwan <dougkwan@google.com>
7988 2009-12-11 Nick Clifton <nickc@redhat.com>
7989 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7991 2009-12-11 Doug Kwan <dougkwan@google.com>
7993 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7995 * attributes.cc (Object_attribute::size): Ditto.
7996 (Attributes_section_data::size): Ditto.
7997 (Attributes_section_data::Attributes_section_data): Ditto.
7998 (Output_attributes_section_data::do_write): Ditto.
7999 * attributes.h (Object_attribute::set_type): Ditto.
8000 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8002 2009-12-11 Nick Clifton <nickc@redhat.com>
8004 * archive.cc: Fix shadowed variable warnings.
8006 * compressed_output.cc: Likewise.
8007 * compressed_output.h: Likewise.
8008 * configure: Likewise.
8009 * dwarf_reader.cc: Likewise.
8010 * dynobj.cc: Likewise.
8011 * dynobj.h: Likewise.
8012 * ehframe.cc: Likewise.
8013 * ehframe.h: Likewise.
8014 * errors.cc: Likewise.
8015 * expression.cc: Likewise.
8016 * fileread.cc: Likewise.
8017 * fileread.h: Likewise.
8018 * freebsd.h: Likewise.
8019 * i386.cc: Likewise.
8021 * incremental.h: Likewise.
8022 * layout.cc: Likewise.
8023 * layout.h: Likewise.
8024 * mapfile.cc: Likewise.
8025 * merge.cc: Likewise.
8026 * merge.h: Likewise.
8027 * object.cc: Likewise.
8028 * object.h: Likewise.
8029 * options.h: Likewise.
8030 * output.cc: Likewise.
8031 * output.h: Likewise.
8032 * parameters.cc: Likewise.
8033 * plugin.cc: Likewise.
8034 * powerpc.cc: Likewise.
8035 * reduced_debug_output.cc: Likewise.
8036 * reduced_debug_output.h: Likewise.
8037 * reloc.cc: Likewise.
8038 * reloc.h: Likewise.
8039 * resolve.cc: Likewise.
8040 * script-sections.cc: Likewise.
8041 * script.cc: Likewise.
8042 * script.h: Likewise.
8043 * sparc.cc: Likewise.
8044 * symtab.cc: Likewise.
8045 * symtab.h: Likewise.
8046 * target-select.cc: Likewise.
8047 * target-select.h: Likewise.
8048 * token.h: Likewise.
8049 * workqueue.cc: Likewise.
8050 * workqueue.h: Likewise.
8051 * x86_64.cc: Likewise.
8053 2009-12-10 Doug Kwan <dougkwan@google.com>
8055 * arm.cc (attributes.h): New include.
8056 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8057 (Arm_relobj::~Arm_relobj): Delete object pointed by
8058 attributes_section_data_.
8059 (Arm_relobj::attributes_section_data): New method definition.
8060 (Arm_relobj::attributes_section_data_): New data member declaration.
8061 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8062 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8063 attributes_section_data_.
8064 (Arm_dynobj::attributes_section_data): New method definition.
8065 (Arm_dynobj::attributes_section_data_): New data member declaration.
8066 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8067 initialization value of may_use_blx_ to false.
8068 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8069 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8070 object attributes to compute results instead of hard-coding.
8071 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8072 Target_arm::get_secondary_compatible_arch,
8073 Target_arm::set_secondary_compatible_arch
8074 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8075 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8076 New method declarations.
8077 (Target_arm::get_aeabi_object_attribute): New method definition.
8078 (Target_arm::attributes_section_data_): New data member declaration.
8079 (read_arm_attributes_section): New template definition.
8080 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8081 (Arm_dynobj::do_read_symbols): Ditto.
8082 (Target_arm::do_finalize_sections): Merge attributes sections from
8083 input. Check for BLX use after attributes section merging.
8084 Fix __exidx_start and __exidx_end visibility. Create an
8085 .ARM.attributes section if necessary.
8086 (Target_arm::get_secondary_compatible_arch,
8087 Target_arm::set_secondary_compatible_arch,
8088 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8089 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8090 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8091 New method definitions.
8093 2009-12-09 Ian Lance Taylor <iant@google.com>
8095 * plugin.cc (Plugin::load): Don't cast from void* to a function
8098 2009-12-09 Ian Lance Taylor <iant@google.com>
8100 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8103 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8105 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8106 Replace two_file_shared_1.so with two_file_shared_2.so.
8107 * testsuite/Makefile.in: Regenerated.
8109 2009-12-08 Doug Kwan <dougkwan@google.com>
8111 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8112 (HFILES): Add attributes.h and int_encoding.h.
8113 * Makefile.in: Regenerate.
8114 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8115 function definitions to int_encoding.cc
8116 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8117 prototypes to int_encoding.h
8118 * reduced_debug_output.cc (int_encoding.h): New include.
8119 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8120 function definitions to int_encoding.cc
8121 (insert_into_vector, read_from_pointer): Move template definitions to
8123 * attributes.cc: New file.
8124 * attributes.h: New file.
8125 * int_encoding.cc: New file.
8126 * int_encoding.h: New file.
8128 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8131 * incremental-dump.cc (dump_incremental_inputs): New.
8132 (main): Use dump_incremental_inputs.
8134 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8137 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8138 checking elfcpp::STT_FUNC.
8139 (Target_i386::Relocate::relocate): Likewise.
8140 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8142 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8143 symbols from shared libraries into normal FUNC symbols.
8145 * symtab.h (Symbol): Add is_func and use it.
8147 2009-12-05 Doug Kwan <dougkwan@google.com>
8149 * arm.cc (Target_arm::arm_info): Initialize new fields
8150 attributes_section and attributes_vendor.
8151 * i386.cc (Target_i386::i386_info): Same.
8152 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8153 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8154 fields attributes_section and attributes_vendor.
8155 * sparc.cc (Target_sparc::sparc_info): Same.
8156 * target.h (Target::attributes_section, Target::attributes_vendor,
8157 Target::is_attributes_section, Target::attribute_arg_type,
8158 Target::attributes_order): New method definitions.
8159 (Target::Target_info::attributes_section,
8160 Target::Target_info::attributes_vendor): New fields.
8161 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8162 virtual method definitions.
8163 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8164 attributes_section and attributes_vendor.
8165 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8167 2009-12-05 Doug Kwan <dougkwan@google.com>
8169 * arm.cc: Update comments about interworking and stub generation.
8170 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8171 considered as non-PIC.
8172 (Arm_relocate_functions::base_abs): Fix formatting.
8173 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8174 of function to use GOT entry address instead of offset.
8175 (Target_arm::Scan::global): Issue an error if a symbol would need a
8176 PLT does not get one because it is untyped. Remove code to create
8177 dynamic symbols for relative branches.
8178 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8179 takes unsigned integer instead of boolean.
8181 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8183 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8184 (two_file_test_LDADD): Likewise.
8185 (common_test_1_LDADD): Likewise.
8186 (exception_test_LDADD) Likewise.
8187 (weak_test_LDADD): Likewise.
8188 (many_sections_test_LDADD): Likewise.
8189 (initpri1_LDADD): Likewise.
8190 (script_test_1_LDADD): Likewise.
8191 (script_test_2_LDADD): Likewise.
8192 (justsyms_LDADD): Likewise.
8193 (binary_test_LDADD): Likewise.
8194 (large_LDADD): Likewise.
8195 * testsuite/Makefile.in: Regenerated.
8197 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8199 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8200 (Symbol_table::override_with_special): Likewise.
8201 (Symbol_table::add_from_object): Likewise.
8203 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8205 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8206 Don't set the data_offset twice.
8208 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8210 * testsuite/Makefile.in: Regenerate.
8212 2009-12-03 Doug Kwan <dougkwan@google.com>
8214 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8215 (Target_arm::do_finalize_sections): Add parameter for symbol table
8216 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8217 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8218 parameter for symbol table pointer.
8219 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8220 an additional parameter for a pointer to symbol table.
8221 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8222 parameter for a symbol table pointer.
8223 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8224 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8226 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8227 parameter for a symbol table pointer.
8229 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8231 * incremental.cc (Incremental_inputs_header)
8232 (Incremental_inputs_header_write, Incremental_inputs_entry)
8233 (Incremental_inputs_entry_write): Move ...
8234 * incremental.h (Incremental_inputs_header)
8235 (Incremental_inputs_header_write, Incremental_inputs_entry)
8236 (Incremental_inputs_entry_write): here.
8238 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8240 * incremental.cc (make_sized_incremental_binary): Set the target.
8241 Error if it is incompatible.
8242 * output.h (Output_file): Add filename method.
8244 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8246 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8247 from the get_* methods.
8249 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8251 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8252 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8253 Write 0 for the data_offset of scripts.
8255 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8257 * testsuite/Makefile.am: Add the incremental_test.sh test.
8258 * testsuite/incremental_test.sh: New.
8259 * testsuite/incremental_test_1.c: New.
8260 * testsuite/incremental_test_2.c: New.
8262 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8264 * incremental-dump.cc (main): Fix typos.
8266 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8269 * incremental-dump.cc (main): Use llu to print 64 bit values.
8271 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8272 H.J. Lu <hongjiu.lu@intel.com>
8274 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8276 (incremental_dump_LDADD): Likewise.
8277 * Makefile.in: Regenerated.
8279 2009-11-25 Doug Kwan <dougkwan@google.com>
8283 2009-11-25 Doug Kwan <dougkwan@google.com>
8285 * arm.cc (Target_arm::Target_arm): Move method definition
8286 outside of class definition. Add code to handle
8287 --target1-rel, --target1-abs and --target2= options.
8288 (Target_arm::get_reloc_reloc_type): Change method to be
8289 non-static and const.
8290 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8291 New data member declaration.
8292 (Target_arm::Scan::local, Target_arm::Scan::global,
8293 Target_arm::Relocate::relocate,
8294 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8295 Adjust call to Target_arm::get_real_reloc_type.
8296 (Target_arm::get_real_reloc_type): Use command line options
8297 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8298 * options.h (--target1-rel, --target1-abs, --target2): New
8301 2009-11-25 Doug Kwan <dougkwan@google.com>
8303 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8304 class definition. Add code to handle --target1-rel, --target1-abs
8305 and --target2= options.
8306 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8308 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8310 (Target_arm::Scan::local, Target_arm::Scan::global,
8311 Target_arm::Relocate::relocate,
8312 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8313 call to Target_arm::get_real_reloc_type.
8314 (Target_arm::get_real_reloc_type): Use command line options to
8315 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8316 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8319 2009-11-25 Doug Kwan <dougkwan@google.com>
8321 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8322 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8323 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8325 (Arm_relocate_functions::thm_call): Replace body with a call to
8326 Arm_relocate_functions::thumb_branch_common.
8327 (Arm_relocate_functions::thm_jump24,
8328 Arm_relocate_functions::thm_xpc22): New method definitions.
8329 (Arm_relocate_functions::thumb_branch_common): New method definition.
8330 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8332 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8333 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8335 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8337 * Makefile.am: Build incremental-dump
8338 * Makefile.in: Regenerate.
8339 * incremental-dump.cc: New.
8340 * incremental.cc (Incremental_inputs_header_data,
8341 Incremental_inputs_entry_data): Move to incremental.h
8342 * incremental.h: (Incremental_inputs_header_data,
8343 Incremental_inputs_entry_data): Move from incremental.cc
8345 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8347 * incremental.cc (Incremental_inputs_header,
8348 Incremental_inputs_header_write, Incremental_inputs_entry,
8349 Incremental_inputs_entry_write): Add a typedef with the data type.
8351 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8353 * incremental.cc (Incremental_inputs_header,
8354 Incremental_inputs_header_write, Incremental_inputs_entry,
8355 Incremental_inputs_entry_write): Update comment about which
8356 type has the filed descriptions.
8358 2009-11-15 Doug Kwan <dougkwan@google.com>
8360 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8361 (Arm_relocate_functions::arm_branch_common): Change method defintion
8362 in class definition to a method declaration and update list of formal
8364 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8365 Arm_relocation_functions::jump24): Adjust call to
8366 Arm_relocate_functions::arm_branch_common. Update list of formal
8368 (Arm_relocate_functions::xpc25): New method definition.
8369 (Arm_relocate_functions::arm_branch_common): Move method defintion
8370 out from class definition. Use stubs for mode-switching and extending
8372 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8373 specially. Change code to enable use of stubs in ARM branches.
8375 2009-11-10 Doug Kwan <dougkwan@google.com>
8377 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8378 in method declaration.
8379 (Target_arm::relocate_stub): New method declaration.
8380 (Target_arm::default_target): Change to return a pointer instead of
8382 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8383 Target_arm::default_target.
8384 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8386 (Target_arm::relocate_section): Adjust view.
8387 (Target_arm::relocate_stub): New method definition.
8389 2009-11-10 Doug Kwan <dougkwan@google.com>
8391 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8393 * incremental.cc (open_incremental_binary): Initialized local
8394 variables to avoid warnings.
8395 * object.cc (make_elf_object): Ditto.
8396 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8399 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8402 * testsuite/plugin_test.c: Include "config.h".
8404 2009-11-09 Doug Kwan <dougkwan@google.com>
8406 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8407 (arm_symbol_value): Remove.
8408 (Arm_relocate_functions::arm_branch_common,
8409 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8410 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8411 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8412 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8413 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8414 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8415 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8416 Arm_relocate_functions::thm_mobw_abs_nc,
8417 Arm_relocate_functions::thm_mov_abs,
8418 Arm_relocate_functions::movw_prel_nc,
8419 Arm_relocate_functions::thm_movt_abs,
8420 Arm_relocate_functions::movt_prel,
8421 Arm_relocate_functions::thm_movw_prel_nc,
8422 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8423 (Target_arm::Relocate::relocate): Only decompose address into two
8424 parts if relocation type uses the thumb-bit and pass the actual
8425 bit instead of a flag indicating that the thumb-bit is used. Adjust
8426 calls to methods in Arm_relocate_functions for this change.
8428 2009-11-08 Ian Lance Taylor <iant@google.com>
8431 * reloc.cc: Instantiate
8432 Sized_relobj::initialize_input_to_output_maps and
8433 Sized_relobj:free_input_to_output_maps.
8435 2009-11-06 Ian Lance Taylor <iant@google.com>
8438 * defstd.cc (in_segment): Set only_if_ref true for "end".
8440 2009-11-06 Doug Kwan <dougkwan@google.com>
8442 * arm.cc (class Reloc_stub): Correct a comment.
8443 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8444 (Target_arm::scan_section_for_stubs): New method declaration.
8445 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8446 Change methods from private to protected.
8447 (Target_arm::do_may_relax): New method definition.
8448 (Target_arm::do_relax, Target_arm::group_sections,
8449 Target_arm::scan_reloc_for_stub,
8450 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8451 (Target_arm::arm_input_section_map_): New data member declaration.
8452 (Target_arm::scan_reloc_for_stub,
8453 Target_arm::scan_reloc_section_for_stubs,
8454 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8455 Target_arm::do_relax): New method definitions.
8457 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8459 * configure.ac: Check for (struct stat)::st_mtim
8460 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8461 * config.in: Regenerate.
8462 * configure: Regenerate.
8464 2009-11-05 Ian Lance Taylor <iant@google.com>
8467 * output.cc (Output_segment::add_output_section): Add missing
8470 2009-11-04 Ian Lance Taylor <iant@google.com>
8473 * object.h (class Object): Add is_needed and set_is_needed
8474 methods. Add is_needed_ field. Make bool fields into bitfields.
8475 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8476 defined in a dynamic object and referenced by a regular object,
8477 set is_needed for the dynamic object.
8478 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8479 if the file is marked with as_needed and it is not needed.
8481 2009-11-04 Ian Lance Taylor <iant@google.com>
8484 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8485 tags if data is discarded by linker script.
8486 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8487 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8488 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8489 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8491 2009-11-04 Ian Lance Taylor <iant@google.com>
8493 * layout.cc (Layout::get_output_section): Add is_interp and
8494 is_dynamic_linker_section parameters. Change all callers.
8495 (Layout::choose_output_section): Likewise.
8496 (Layout::make_output_section): Likewise.
8497 (Layout::add_output_section_data): Add is_dynamic_linker_section
8498 parameter. Change all callers.
8499 * layout.h (class Layout): Update declarations.
8500 * output.h (class Output_section): Add is_interp, set_is_interp,
8501 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8502 Add is_interp_, is_dynamic_linker_section_ fields. Change
8503 generate_code_fills_at_write_ to a bitfield.
8504 * output.cc (Output_section::Output_sections): Initialize new
8506 (Output_segment::add_output_section): Add do_sort parameter.
8509 2009-11-03 Ian Lance Taylor <iant@google.com>
8512 * options.h (class General_options): Add --warn-common.
8513 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8514 merging two common symbols.
8515 (Symbol_table::should_override): Handle --warn-common when merging
8516 a common symbol with a defined symbol. Use report_resolve_problem
8517 for multiple definitions.
8518 (Symbol_table::report_resolve_problem): New function.
8519 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8521 2009-11-03 Doug Kwan <dougkwan@google.com>
8523 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8525 (Target_arm::stub_factory): New method definition.
8526 (Target_arm::new_arm_input_section,
8527 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8528 Target_arm::reloc_uses_thumb_bit): New method declarations.
8529 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8530 New type definitions.
8531 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8532 member declarations.
8533 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8534 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8535 New method definitions.
8537 2009-11-03 Ian Lance Taylor <iant@google.com>
8539 * options.h (class General_options): Add --warn_constructors.
8541 2009-11-03 Ian Lance Taylor <iant@google.com>
8544 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8545 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8547 2009-11-03 Ian Lance Taylor <iant@google.com>
8550 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8551 --msgid-bugs-address.
8552 (install-pdf): New target.
8553 (install-data_yes): Look up one directory to find mkinstalldirs.
8555 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8557 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8560 2009-10-30 Doug Kwan <dougkwan@google.com>
8562 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8564 2009-10-30 Doug Kwan <dougkwan@google.com>
8566 * arm.cc (Stub_addend_reader): New struct template definition
8567 and partial specializations.
8568 (Stub_addend_reader::operator()): New method definition for a
8569 partially specialized template.
8571 2009-10-30 Doug Kwan <dougkwan@google.com>
8573 * arm.cc (Arm_relobj::processor_specific_flags): New method
8575 (Arm_relobj::do_read_symbols): New method declaration.
8576 (Arm_relobj::processor_specific_flags_): New data member declaration.
8577 (Arm_dynobj): New class definition.
8578 (Target_arm::do_finalize_sections): Add input_objects parameter.
8579 (Target_arm::do_adjust_elf_header): New method declaration.
8580 (Target_arm::are_eabi_versions_compatible,
8581 (Target_arm::merge_processor_specific_flags): New method declaration.
8582 (Target_arm::do_make_elf_object): New overloaded method definitions
8584 (Arm_relobj::do_read_symbols): New method definition.
8585 (Arm_dynobj::do_read_symbols): Ditto.
8586 (Target_arm::do_finalize_sections): Add input_objects parameters.
8587 Merge processor-specific flags from all input objects.
8588 (Target_arm::are_eabi_versions_compatible,
8589 Target_arm::merge_processor_specific_flags,
8590 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8591 New method definitions.
8592 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8593 Input_objects pointer type parameter.
8594 * layout.cc (Layout::finalize): Pass input objects to target's.
8595 finalize_sections function.
8596 * output.cc (Output_file_header::do_sized_write): Set ELF file
8597 header's processor-specific flags.
8598 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8599 Input_objects pointer type parameter.
8600 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8601 * target.h (Input_objects): New forward class declaration.
8602 (Target::processor_specific_flags,
8603 Target::are_processor_specific_flags_sect): New method definitions.
8604 (Target::finalize_sections): Add input_objects parameter.
8605 (Target::Target): Initialize processor_specific_flags_ and
8606 are_processor_specific_flags_set_.
8607 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8609 (Target::set_processor_specific_flags): New method definition.
8610 (Target::processor_specific_flags_,
8611 Target::are_processor_specific_flags_set_): New data member
8613 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8614 Input_objects pointer type parameter.
8616 2009-10-30 Doug Kwan <dougkwan@google.com>
8618 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8620 2009-10-28 Ian Lance Taylor <iant@google.com>
8622 * object.h (class Relobj): Drop options parameter from
8623 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8624 do_scan_relocs, do_relocate. Change all callers.
8625 (class Sized_relobj): Drop options parameters from
8626 do_gc_process_relocs, do_scan_relocs, do_relocate,
8627 do_relocate_sections, relocate_sections, emit_relocs_scan,
8628 emit_relocs_scan_reltype. Change all callers.
8629 (struct Relocate_info): Remove options field and all references to
8631 * reloc.h (class Read_relocs): Remove options constructor
8632 parameter and options_ field. Change all callers.
8633 (class Gc_process_relocs, class Scan_relocs): Likewise.
8634 (class Relocate_task): Likewise.
8635 * target-reloc.h (scan_relocs): Remove options parameter. Change
8637 (scan_relocatable_relocs): Likewise.
8638 * target.h (class Sized_target): Remove options parameter from
8639 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8641 * gc.h (gc_process_relocs): Remove options parameter. Change all
8643 * arm.cc: Update functions to remove options parameters.
8644 * i386.cc: Likewise.
8645 * powerpc.cc: Likewise.
8646 * sparc.cc: Likewise.
8647 * x86_64.cc: Likewise.
8648 * testsuite/testfile.cc: Likewise.
8650 2009-10-28 Doug Kwan <dougkwan@google.com>
8652 * arm.cc (Arm_relobj): New class definition.
8653 (Arm_relobj::scan_sections_for_stubs,
8654 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8655 New method definitions.
8657 2009-10-28 Cary Coutant <ccoutant@google.com>
8659 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8660 (Plugin::cleanup_done_): New member.
8661 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8662 (Plugin_manager::cleanup_done_): Remove.
8663 (Plugin_manager::add_input_file): Edit error message.
8664 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8665 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8667 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8669 * fileread.cc: (File_read::View::~View): Use the new
8670 data_ownership_ filed.
8671 (File_read::~File_read): Dispose the new whole_file_view_.
8672 (File_read::open): Mmap the whole file if needed.
8673 (File_read::open): Use whole_file_view_ instead of contents_.
8674 (File_read::find_view): Use whole_file_view_ if applicable.
8675 (File_read::do_read): Use whole_file_view_ instead of contents_.
8676 (File_read::make_view): Use whole_file_view_ instead of contents_,
8677 update File_read::View::View call.
8678 (File_read::find_or_make_view): Update File_read::View::View
8680 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8682 (File_read::View::Data_ownership): New enum.
8683 (File_read::View::View): Replace bool mapped_ with Data_ownership
8685 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8686 (File_read::View::data_ownership_): New field.
8687 (File_read::contents_): Remove (replaced by whole_file_view_).
8688 (File_read::whole_file_view_): New field.
8689 * options.h (class General_options): Add --keep-files-mapped.
8691 2009-10-27 Cary Coutant <ccoutant@google.com>
8693 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8694 * testsuite/Makefile.am (plugin_test_5): New test case.
8695 * testsuite/Makefile.in: Regenerate.
8697 2009-10-25 Doug Kwan <dougkwan@google.com>
8699 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8700 from private to protected to allow access by child class.
8701 (Sized_relobj::do_relocate_sections): New method declaration.
8702 (Sized_relobj::relocate_sections): Virtualize.
8703 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8704 Sized_relobj::relocate_sections. Instantiate template explicitly
8705 for different target sizes and endianity.
8707 2009-10-24 Doug Kwan <dougkwan@google.com>
8709 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8710 (Arm_input_section::as_arm_input_section): New method.
8711 (Arm_output_section): New class definition.
8712 (Arm_output_section::create_stub_group,
8713 Arm_output_section::group_sections): New method definitions.
8715 2009-10-22 Doug Kwan <dougkwan@google.com>
8717 * arm.cc (Arm_input_section): New class definition.
8718 (Arm_input_section::init, Arm_input_section:do_write,
8719 Arm_input_section::set_final_data_size,
8720 Arm_input_section::do_reset_address_and_file_offset): New method
8723 2009-10-21 Doug Kwan <dougkwan@google.com>
8725 * arm.cc (Stub_table, Arm_input_section): New forward class
8727 (Stub_table): New class defintion.
8728 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8729 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8730 New method definition.
8732 2009-10-21 Doug Kwan <dougkwan@google.com>
8734 * arm.cc: Update copyright comments.
8735 (Target_arm): New forward class template declaration.
8736 (Arm_address): New type.
8737 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8738 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8739 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8741 (Insn_template): Same.
8742 (DEF_STUBS): New macro.
8743 (Stub_type): New enum type.
8744 (Stub_template): New class definition.
8747 (Stub_factory): Same.
8748 (Target_arm::Target_arm): Initialize may_use_blx_ and
8749 should_force_pic_veneer_.
8750 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8751 Target_arm::should_force_pic_veneer,
8752 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8753 Target_arm::using_thumb_only, Target_arm:;default_target): New
8755 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8756 New data member declarations.
8757 (Insn_template::size, Insn_template::alignment): New method defintions.
8758 (Stub_template::Stub_template): New method definition.
8759 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8760 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8761 (Stub_factory::Stub_factory): New method definition.
8762 * gold.h (string_hash): New template.
8763 * output.h (Input_section_specifier::hash_value): Use
8765 (Input_section_specifier::string_hash): Remove.
8766 * stringpool.cc (Stringpool_template::string_hash): Use
8769 2009-10-20 Doug Kwan <dougkwan@google.com>
8771 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8772 symbols of relaxed input sections.
8773 * output.h (Output_section::find_relaxed_input_section): Make
8776 2009-10-16 Doug Kwan <dougkwan@google.com>
8778 * dynobj.cc (Versions::Versions): Initialize version_script_.
8779 Only insert base version symbol definition for a shared object
8780 if version script defines any version versions.
8781 (Versions::define_base_version): New method definition.
8782 (Versions::add_def): Check that base version is not needed.
8783 (Versions::add_need): Define base version lazily.
8784 * dynobj.h (Versions::define_base_version): New method declaration.
8785 (Versions::needs_base_version_): New data member declaration.
8786 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8787 (check_DATA): Add no_version_test.stdout.
8788 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8790 * testsuite/Makefile.in: Regenerate.
8791 * testsuite/no_version_test.c: New file.
8792 * testsuite/no_version_test.sh: Ditto.
8794 2009-10-16 Doug Kwan <dougkwan@google.com>
8796 * expression.cc (class Segment_start_expression): New class definition.
8797 (Segment_start_expression::value): New method definition.
8798 (script_exp_function_segment_start): Return a new
8799 Segment_start_expression.
8800 * gold/script-c.h (script_saw_segment_start_expression): New function
8802 * script-sections.cc (Script_sections::Script_sections): Initialize
8803 SAW_SEGMENT_START_EXPRESSION_ to false.
8804 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8805 and -Tbbs options to specify section addresses if given in
8806 command line and no SEGMENT_START expression is seen in a script.
8807 * script-sections.h (Script_sections::saw_segment_start_expression,
8808 Script_sections::set_saw_segment_start_expression): New method
8810 (Script_sections::saw_segment_start_expression_): New data member
8812 * script.cc (script_saw_segment_start_expression): New function.
8813 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8814 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8815 script_test_7.sh and script_test_8.sh.
8816 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8817 script_test_8.stdout.
8818 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8819 (script_test_6, script_test_6.stdout, script_test_7,
8820 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8821 * Makefile.in: Regenerate.
8822 * testsuite/script_test_6.sh: New file.
8823 * testsuite/script_test_6.t: Same.
8824 * testsuite/script_test_7.sh: Same.
8825 * testsuite/script_test_7.t: Same.
8826 * testsuite/script_test_8.sh: Same.
8828 2009-10-16 Doug Kwan <dougkwan@google.com>
8830 * output.cc (Output_segment::set_section_list_address): Cast
8831 expressions to unsigned long long type to avoid format warnings.
8833 2009-10-15 Ian Lance Taylor <iant@google.com>
8835 * script.cc (Script_options::add_symbol_assignment): Always add a
8836 dot assignment to script_sections_.
8837 * script-sections.cc (Script_sections::add_dot_assignment):
8838 Initialize if necessary.
8840 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8841 program headers with no load segment if there is a linker script.
8843 * layout.cc (Layout::set_segment_offsets): Align the file offset
8844 to the segment aligment for -N or -n with no load segment.
8845 * output.cc (Output_segment::add_output_section): Don't crash if
8846 the first section is a TLS section.
8847 (Output_segment::set_section_list_addresses): Print an error
8848 message if the address moves backward in a linker script.
8849 * script-sections.cc
8850 (Output_section_element_input::set_section_addresses): Don't
8851 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8852 (Orphan_output_section::set_section_addresses): Likewise.
8854 2009-10-15 Doug Kwan <dougkwan@google.com>
8856 * layout.cc (Layout::finish_dynamic_section): Generate tags
8857 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8858 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8859 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8861 2009-10-14 Ian Lance Taylor <iant@google.com>
8863 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8865 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8866 data_shdr fields of relinfo.
8867 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8868 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8869 R_386_TLS_LDO_32, adjust based on section flags.
8870 (Target_i386::Relocate::fix_up_ldo): Remove.
8872 2009-10-13 Ian Lance Taylor <iant@google.com>
8874 Add support for -pie.
8875 * options.h (class General_options): Add -pie and
8877 (General_options::output_is_position_independent): Test -pie.
8878 (General_options::output_is_executable): Return true if not shared
8879 and not relocatable.
8880 (General_options::output_is_pie): Remove.
8881 * options.cc (General_options::finalize): Reject incompatible uses
8883 * gold.cc (queue_middle_tasks): A -pie link is not static.
8884 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8885 * symtab.cc (Symbol::final_value_is_known): Return false if
8886 output_is_position_independent.
8887 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8888 output_is_position_independent.
8889 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8890 output_is_position_independent.
8891 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8892 output_is_position_independent.
8893 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8895 (basic_pie_test.o, basic_pie_test): New targets.
8896 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8897 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8898 (two_file_pie_test): New target.
8899 * testsuite/Makefile.in: Rebuild.
8900 * README: Remove note saying that -pie is not supported.
8902 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8904 * options.h (class General_options): Add -init and -fini.
8905 * layout.cc (Layout::finish_dynamic_section): Emit
8906 given init and fini functions.
8908 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8910 * gc.h (gc_process_relocs): Check if icf is enabled using new
8912 * gold.cc (queue_initial_tasks): Likewise.
8913 (queue_middle_tasks): Likewise.
8914 * object.cc (do_layout): Likewise.
8915 * symtab.cc (is_section_folded): Likewise.
8916 * main.cc (main): Likewise.
8917 * reloc.cc (Read_relocs::run): Likewise.
8918 (Sized_relobj::do_scan_relocs): Likewise.
8919 * icf.cc (is_function_ctor_or_dtor): New function.
8920 (Icf::find_identical_sections): Check if function is ctor or dtor when
8922 * options.h (General_options::icf): Change option to be an enum.
8923 (Icf_status): New enum.
8924 (icf_enabled): New method.
8925 (icf_safe_folding): New method.
8926 (set_icf_status): New method.
8927 (icf_status_): New variable.
8928 * (options.cc) (General_options::finalize): Set icf_status_.
8929 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8930 icf_test and icf_keep_unique_test to use the --icf enum flag.
8931 * testsuite/icf_safe_test.sh: New file.
8932 * testsuite/icf_safe_test.cc: New file.
8934 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8936 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8937 includes to gc.h and icf.h.
8938 * arm.cc: Include gc.h.
8939 * gold.cc: Likewise.
8940 * i386.cc: Likewise.
8941 * powerpc.cc: Likewise.
8942 * sparc.cc: Likewise.
8943 * x86_64.cc: Likewise.
8944 * gc.h: Include icf.h.
8946 2009-10-11 Ian Lance Taylor <iant@google.com>
8948 * plugin.cc: Include "gold.h" before other header files.
8950 2009-10-10 Chris Demetriou <cgd@google.com>
8952 * options.h (Input_file_argument::Input_file_type): New enum.
8953 (Input_file_argument::is_lib_): Replace with...
8954 (Input_file_argument::type_): New member.
8955 (Input_file_argument::Input_file_argument): Take Input_file_type
8956 'type' rather than boolean 'is_lib' as second argument.
8957 (Input_file_argument::is_lib): Use type_.
8958 (Input_file_argument::is_searched_file): New function.
8959 (Input_file_argument::may_need_search): Handle is_searched_file.
8960 * options.cc (General_options::parse_library): Support -l:filename.
8961 (General_options::parse_just_symbols): Update for Input_file_argument
8963 (Command_line::process): Likewise.
8964 * archive.cc (Archive::get_file_and_offset): Likewise.
8965 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8966 * script.cc (read_script_file, script_add_file): Likewise.
8967 * fileread.cc (Input_file::Input_file): Likewise.
8968 (Input_file::will_search_for): Handle is_searched_file.
8969 (Input_file::open): Likewise.
8970 * readsyms.cc (Read_symbols::get_name): Likewise.
8971 * testsuite/Makefile.am (searched_file_test): New test.
8972 * testsuite/Makefile.in: Regenerate.
8973 * testsuite/searched_file_test.cc: New file.
8974 * testsuite/searched_file_test_lib.cc: New file.
8976 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8977 Ian Lance Taylor <iant@google.com>
8979 * descriptor.cc: Include <cstdio> and "binary-io.h".
8980 (Descriptors::open): Open the files in binary mode always.
8981 * script.cc (Lex::get_token): Treat \r as whitespace.
8983 2009-10-09 Ian Lance Taylor <iant@google.com>
8985 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8987 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8988 Ian Lance Taylor <iant@google.com>
8990 * configure.ac: Check for readv function also.
8991 * fileread.cc (readv): Define if not HAVE_READV.
8992 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8994 * config.in: Regenerate.
8995 * configure: Regenerate.
8997 2009-10-09 Doug Kwan <dougkwan@google.com>
8999 * layout.cc (Layout::make_output_section): Call target hook to make
9000 ordinary output section.
9001 (Layout::finalize): Adjust parameter list of call the
9002 Target::may_relax().
9003 * layout.h (class Layout::section_list): New method.
9004 * merge.h (Output_merge_base::entsize): Change visibility to public.
9005 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9007 (Output_merge_string::do_is_string): New method.
9008 * object.cc (Sized_relobj::do_setup): renamed from
9009 Sized_relobj::set_up.
9010 * object.h (Sized_relobj::adjust_shndx,
9011 Sized_relobj::initializ_input_to_output_maps,
9012 Sized_relobj::free_input_to_output_maps): Change visibilities to
9014 (Sized_relobj::setup): Virtualize.
9015 (Sized_relobj::do_setup): New method declaration.
9016 (Sized_relobj::invalidate_section_offset,
9017 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9018 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9019 * options.cc (parse_int): New function.
9020 * options.h (parse_int): New declaration.
9021 (DEFINE_int): New macro.
9022 (stub_group_size): New option.
9023 * output.cc (Output_section::Output_section): Initialize memebers
9024 merge_section_map_, merge_section_by_properties_map_,
9025 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9026 (Output_section::add_input_section): Handled deferred code-fill
9027 generation and remove an old comment.
9028 (Output_section::add_relaxed_input_section): New method definition.
9029 (Output_section::add_merge_input_section): Use merge section by
9030 properties map to speed to search. Update merge section maps
9032 (Output_section::build_relaxation_map): New method definition.
9033 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9035 (Output_section::relax_input_section): Renamed to
9036 Output_section::convert_input_sections_to_relaxed_sections and change
9037 interface to take a vector of pointers to relaxed sections.
9038 (Output_section::find_merge_section,
9039 Output_section::find_relaxed_input_section): New method definitions.
9040 (Output_section::is_input_address_mapped,
9041 Output_section::output_offset, Output_section::output_address):
9042 Use output section data maps to speed up searching.
9043 (Output_section::find_starting_output_address): Add comments.
9044 (Output_section::do_write,
9045 Output_section::write_to_postprocessing_buffer): Do code-fill
9046 generation as appropriate.
9047 (Output_section::get_input_sections): Invalidate relaxed input section
9049 (Output_section::restore_states): Adjust type of checkpoint .
9050 Invalidate relaxed input section map.
9051 * output.h (Output_merge_base): New class declaration.
9052 (Input_section_specifier): New class defintion.
9053 (class Output_relaxed_input_section) Change base class to
9054 Output_section_data_build.
9055 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9056 base class initializer.
9057 (Output_section::add_relaxed_input_section): New method declaration.
9058 (Output_section::Input_section): Change visibility to protected.
9059 (Output_section::Input_section::relobj,
9060 Output_section::Input_section::shndx): Handle relaxed input sections.
9061 Output_section::input_sections) Change visibility to protected. Also
9062 define overload to return a non-const pointer.
9063 (Output_section::Merge_section_properties): New class defintion.
9064 (Output_section::Merge_section_by_properties_map,
9065 Output_section::Output_section_data_by_input_section_map,
9066 Output_section::Relaxation_map): New types.
9067 (Output_section::relax_input_section): Rename method to
9068 Output_section::convert_input_sections_to_relaxed_sections and change
9069 interface to take a vector of relaxed section pointers.
9070 (Output_section::find_merge_section,
9071 Output_section::find_relaxed_input_section,
9072 Output_section::build_relaxation_map,
9073 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9074 New method declarations.
9075 (Output_section::merge_section_map_
9076 Output_section::merge_section_by_properties_map_,
9077 Output_section::relaxed_input_section_map_,
9078 Output_section::is_relaxed_input_section_map_valid_,
9079 Output_section::generate_code_fills_at_write_): New data members.
9080 * script-sections.cc
9081 (Output_section_element_input::set_section_addresses): Call
9082 current_data_size and addralign methods of relaxed input sections.
9083 (Orphan_output_section::set_section_addresses): Call current_data_size
9084 and addralign methods of relaxed input sections.
9085 * symtab.cc (Symbol_table::compute_final_value): Extract template
9086 from the body of Symbol_table::sized_finalize_symbol.
9087 (Symbol_table::sized_finalized_symbol): Call
9088 Symbol_table::compute_final_value.
9089 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9090 (Symbol_table::compute_final_value): New templated method declaration.
9091 * target.cc (Target::do_make_output_section): New method defintion.
9092 * target.h (Target::make_output_section): New method declaration.
9093 (Target::relax): Add more parameters for input objects, symbol table
9094 and layout. Adjust call to do_relax.
9095 (Target::do_make_output_section): New method declaration.
9096 (Target::do_relax): Add parameters for input objects, symbol table
9099 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9101 * pread.c: Include stdio.h.
9103 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9105 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9108 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9110 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9111 Change read_shndx type to unsigned int.
9112 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9114 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9115 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9116 Change read_shndx type to unsigned int.
9117 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9119 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9120 * layout.cc (Layout::create_symtab_sections): Cast the result of
9121 local_symcount * symsize to off_t in the gold_assert.
9123 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9125 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9126 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9128 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9129 (Arm_relocate_functions::thm_abs5): New function.
9130 (Arm_relocate_functions::abs12): New function.
9131 (Arm_relocate_functions::abs16): New function.
9132 (Arm_relocate_functions::base_abs): New function.
9133 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9134 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9135 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9137 (Scan::global): Likewise.
9138 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9139 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9140 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9141 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9144 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9146 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9147 (Arm_relocate_functions::movt_prel): New function.
9148 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9149 (Arm_relocate_functions::thm_movt_prel): New function.
9150 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9151 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9152 (Scan::global, Relocate::relocate): Likewise.
9153 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9155 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9157 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9158 Incremental_checker.
9159 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9161 (class Incremental_inputs_header): New class.
9162 (Incremental_inputs_header_writer): Edit comment.
9163 (Incremental_inputs_entry): New class.
9164 (Incremental_inputs_entry_writer): Edit comment.
9165 (Sized_incremental_binary::do_find_incremental_inputs_section):
9166 Add *strtab_shndx parameter, fill it.
9167 (Sized_incremental_binary::do_check_inputs): New method.
9168 (Incremental_checker::can_incrementally_link_output_file): Use
9169 Sized_incremental_binary::check_inputs.
9170 (Incremental_inputs::report_command_line): Save command line in
9173 (Incremental_binary::find_incremental_inputs_section): New
9175 (Incremental_binary::do_find_incremental_inputs_section): Add
9176 strtab_shndx parameter.
9177 (Incremental_binary::do_check_inputs): New pure virtual method.
9178 (Sized_incremental_binary::do_check_inputs): Declare.
9179 (Incremental_checker::Incremental_checker): Add incremental_inputs
9180 parameter, use it to initialize incremental_inputs_.
9181 (Incremental_checker::incremental_inputs_): New field.
9182 (Incremental_checker::command_line): New method.
9183 (Incremental_checker::inputs): New method.
9184 (Incremental_checker::command_line_): New field.
9186 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9188 * incremental.cc: Include <cstdarg> and "target-select.h".
9189 (vexplain_no_incremental): New function.
9190 (explain_no_incremental): New function.
9191 (Incremental_binary::error): New method.
9192 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9194 (make_sized_incremental_binary): New function.
9195 (open_incremental_binary): New function.
9196 (can_incrementally_link_file): Add checks if output is ELF and has
9198 * incremental.h: Include "elfcpp_file.h" and "output.h".
9199 (Incremental_binary): New class.
9200 (Sized_incremental_binary): New class.
9201 (open_incremental_binary): Declare.
9202 * object.cc (is_elf_object): Use
9203 elfcpp::Elf_recognizer::is_elf_file.
9204 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9205 * output.h (Output_file::filesize): New method.
9207 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9209 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9211 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9212 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9214 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9216 (Arm_relocate_functions::movw_abs_nc): New function.
9217 (Arm_relocate_functions::movt_abs): New function.
9218 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9219 (Arm_relocate_functions::thm_movt_abs): New function.
9220 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9221 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9222 (Scan::global): Likewise.
9223 (Relocate::relocate): Likewise.
9224 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9226 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9228 * arm.cc (Arm_relocate_functions::got_prel) New function.
9229 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9230 (Relocate::relocate): Likewise.
9231 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9233 2009-10-06 Ian Lance Taylor <iant@google.com>
9235 * options.h (class General_options): Define
9236 split_stack_adjust_size parameter.
9237 * object.h (class Object): Add uses_split_stack_ and
9238 has_no_split_stack_ fields. Add uses_split_stack and
9239 has_no_split_stack accessor functions. Declare
9240 handle_split_stack_section.
9241 (class Reloc_symbol_changes): Define.
9242 (class Sized_relobj): Define Function_offsets. Declare
9243 split_stack_adjust, split_stack_adjust_reltype, and
9245 * object.cc (Object::handle_split_stack_section): New function.
9246 (Sized_relobj::do_layout): Call handle_split_stack_section.
9247 * dynobj.cc (Sized_dynobj::do_layout): Call
9248 handle_split_stack_section.
9249 * reloc.cc (Sized_relobj::relocate_sections): Call
9250 split_stack_adjust for executable sections in split_stack
9251 objects. Pass reloc_map to relocate_section.
9252 (Sized_relobj::split_stack_adjust): New function.
9253 (Sized_relobj::split_stack_adjust_reltype): New function.
9254 (Sized_relobj::find_functions): New function.
9255 * target-reloc.h: Include "object.h".
9256 (relocate_section): Add reloc_symbol_changes parameter. Change
9258 * target.h (class Target): Add calls_non_split method. Declare
9259 do_calls_non_split virtual method. Declare match_view and
9261 * target.cc: Include "elfcpp.h".
9262 (Target::do_calls_non_split): New function.
9263 (Target::match_view): New function.
9264 (Target::set_view_to_nop): New function.
9265 * gold.cc (queue_middle_tasks): Give an error if mixing
9266 split-stack and non-split-stack objects with -r.
9267 * i386.cc (Target_i386::relocate_section): Add
9268 reloc_symbol_changes parameter.
9269 (Target_i386::do_calls_non_split): New function.
9270 * x86_64.cc (Target_x86_64::relocate_section): Add
9271 reloc_symbol_changes parameter.
9272 (Target_x86_64::do_calls_non_split): New function.
9273 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9275 * powerpc.cc (Target_powerpc::relocate_section): Add
9276 reloc_symbol_changes parameter.
9277 * sparc.cc (Target_sparc::relocate_section): Add
9278 reloc_symbol_changes parameter.
9279 * configure.ac: Call AM_CONDITIONAL for the default target.
9280 * configure: Rebuild.
9281 * testsuite/Makefile.am (TEST_AS): New variable.
9282 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9283 (check_DATA): Add split_i386 and split_x86_64 files.
9284 (SPLIT_DEFSYMS): Define.
9285 (split_i386_[1234n].o): New targets.
9286 (split_i386_[124]): New targets.
9287 (split_i386_[1234r].stdout): New targets.
9288 (split_x86_64_[1234n].o): New targets.
9289 (split_x86_64_[124]): New targets.
9290 (split_x86_64_[1234r].stdout): New targets.
9291 (MOSTLYCLEANFILES): Add new executables.
9292 * testsuite/split_i386.sh: New file.
9293 * testsuite/split_x86_64.sh: New file.
9294 * testsuite/split_i386_1.s: New file.
9295 * testsuite/split_i386_2.s: New file.
9296 * testsuite/split_i386_3.s: New file.
9297 * testsuite/split_i386_4.s: New file.
9298 * testsuite/split_i386_n.s: New file.
9299 * testsuite/split_x86_64_1.s: New file.
9300 * testsuite/split_x86_64_2.s: New file.
9301 * testsuite/split_x86_64_3.s: New file.
9302 * testsuite/split_x86_64_4.s: New file.
9303 * testsuite/split_x86_64_n.s: New file.
9304 * testsuite/testfile.cc (Target_test): Update relocation_section
9306 * testsuite/Makefile.in: Rebuild.
9308 2009-10-06 Ian Lance Taylor <iant@google.com>
9310 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9311 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9312 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9313 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9314 the address on ldo_addrs_.
9315 (Target_i386::Relocate::fix_up_ldo): New function.
9317 2009-10-06 Rafael Espindola <espindola@google.com>
9319 * plugin.cc (add_input_library): New.
9320 (Plugin::load): Add add_input_library to tv.
9321 (Plugin_manager::add_input_file): Add the is_lib argument.
9322 (add_input_file): Update call to Plugin_manager::add_input_file.
9323 (add_input_library): New.
9324 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9326 2009-09-30 Doug Kwan <dougkwan@google.com>
9328 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9329 symbol and call Symbol::may_need_copy_reloc to determine if
9330 a copy reloc is needed.
9331 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9332 nocopyreloc is given in command line.
9333 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9334 given in command line.
9335 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9336 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9337 of the removed Target_i386::may_need_copy_reloc.
9338 * options.h (copyreloc): New option with default value false.
9339 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9340 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9341 instead of the removed Target_powerpc::may_need_copy_reloc.
9342 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9343 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9344 instead of the removed Target_sparc::may_need_copy_reloc.
9345 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9346 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9347 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9348 instead of the removed Target_x86_64::may_need_copy_reloc.
9350 2009-09-30 Ian Lance Taylor <iant@google.com>
9352 * object.h (class Object): Remove target_ field, and target,
9353 sized_target, and set_target methods.
9354 (Object::sized_target): Remove.
9355 (class Sized_relobj): Update declarations. Remove sized_target.
9356 * object.cc (Sized_relobj::setup): Remove target parameter.
9358 (Input_objects::add_object): Don't do anything with the target.
9359 (make_elf_sized_object): Add punconfigured parameter. Change all
9360 callers. Set or test parameter target.
9361 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9363 * parameters.cc (Parameters::set_target): Change parameter type to
9365 (Parameters::default_target): Remove.
9366 (set_parameters_target): Change parameter type to be non-const.
9367 (parameters_force_valid_target): New function.
9368 (parameters_clear_target): New function.
9369 * parameters.h (class Parameters): Update declarations. Remove
9370 default_target method. Add sized_target and clear_target
9371 methods. Change target_ to be non-const.
9372 (set_parameters_target): Update declaration.
9373 (parameters_force_valid_target): Declare.
9374 (parameters_clear_target): Declare.
9375 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9376 as NULL if we aren't searching.
9377 (Add_symbols::run): Don't check for compatible target.
9378 * fileread.cc (Input_file::open_binary): Call
9379 parameters_force_valid_target.
9380 * gold.cc (queue_middle_tasks): Likewise.
9381 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9382 set_target on object.
9383 * dynobj.h (class Sized_dynobj): Update declarations.
9384 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9385 make_elf_object returns NULL.
9386 (Archive::include_member): Don't check whether object target is
9388 * output.cc (Output_section::add_input_section): Get target from
9390 (Output_section::relax_input_section): Likewise.
9391 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9393 (Sized_relobj::do_scan_relocs): Likewise.
9394 (Sized_relobj::relocate_sections): Likewise.
9395 * resolve.cc (Symbol_table::resolve): Likewise.
9396 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9397 parameter. Change all callers.
9398 (Symbol_table::add_from_object): Get target from parameters.
9399 (Symbol_table::add_from_relobj): Don't check object target.
9400 (Symbol_table::add_from_dynobj): Likewise.
9401 (Symbol_table::define_special_symbol): Get target from
9403 * symtab.h (class Symbol_table): Update declaration.
9404 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9405 parameter. Change all callers. Clear parameter target.
9406 (Binary_test): Test target here.
9407 * testsuite/object_unittest.cc (gold_testsuite): Remove
9408 target_test_pointer parameter. Change all callers.
9409 (Object_test): Test target here.
9411 2009-09-26 Ian Lance Taylor <iant@google.com>
9413 * testsuite/initpri1.c: Don't try to use constructor priorities if
9414 compiling with gcc before 4.3.
9416 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9418 * testsuite/retain_symbols_file_test.sh (check_present): Change
9419 output file name to retain_symbols_file_test.stdout.
9420 (check_absent): Likewise.
9422 2009-09-18 Craig Silverstein <csilvers@google.com>
9424 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9425 * options.cc: Include <cerrno> and <fstream>.
9426 (General_options::finalize): Parse -retain-symbols-file tag.
9427 * options.h: New flag.
9428 (General_options): New method should_retain_symbol, new
9429 variable symbols_to_retain.
9430 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9431 should_retain_symbol map.
9432 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9433 * testsuite/Makefile.in: Regenerate.
9434 * testsuite/retain_symbols_file_test.sh: New file.
9436 2009-09-18 Nick Clifton <nickc@redhat.com>
9438 * po/es.po: Updated Spanish translation.
9440 2009-09-17 Doug Kwan <dougkwan@google.com>
9442 * debug.h (DEBUG_RELAXATION): New constant.
9443 (DEBUG_ALL): Add DEBUG_RELAXATION.
9444 (debug_string_to_enum): Add relaxation debug option.
9446 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9447 Layout::Relaxation_debug_check::read_sections,
9448 Layout::Relaxation_debug_check::read_sections): New method definitions.
9449 (Layout::Layout): Initialize data members
9450 record_output_section_data_from_scrips_,
9451 script_output_section_data_list_ and relaxation_debug_check_.
9452 (Layout::save_segments, Layout::restore_segments,
9453 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9454 Layout::relaxation_loop_body): New method definitions.
9455 (Layout::finalize): Support relaxation. Move section layout code to
9456 Layout::relaxation_loop_body.
9457 (Layout::set_asection_address_from_script): Move code for orphan
9458 section placement out.
9459 (Layout::place_orphan_sections_in_script): New method definition.
9460 * layout.h (Output_segment_headers, Output_file_header):
9461 New forward class declarations.
9462 (Layout::~Layout): Define.
9463 (Layout::new_output_section_data_from_script): New method definition.
9464 (Layout::place_orphan_sections_in_script): New method declaration.
9465 (Layout::Segment_states): New type declaration.
9466 (Layout::save_segments, Layout::restore_segments,
9467 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9468 Layout::relaxation_loop_body): New method declarations.
9469 (Layout::Output_section_data_list): New type declaration.
9470 (Layout::Relaxation_debug_check): New class definition.
9471 (Layout::record_output_section_data_from_script_,
9472 Layout::script_output_section_data_list_, Layout::segment_states_,
9473 Layout::relaxation_debug_check_): New data members.
9474 * output.cc: (Output_section_headers::do_size): New method definition.
9475 (Output_section_headers::Output_section_headers): Move size
9476 computation to Output_section_headers::do_size.
9477 (Output_segment_headers::do_size): New method definition.
9478 (Output_file_header::Output_file_header): Move size computation to
9479 Output_file_header::do_size and call it.
9480 (Output_file_header::do_size): New method definition.
9481 (Output_data_group::Output_data_group): Adjust call to
9482 Output_section_data.
9483 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9484 (Output_symtab_xindex::do_write): Add array bound check.
9485 (Output_section::Input_section::print_to_mapfile): Handle
9486 RELAXED_INPUT_SECTION_CODE.
9487 (Output_section::Output_section): Initialize data member checkpoint_.
9488 (Output_section::~Output_section): Delete checkpoint object pointed
9490 (Output_section::add_input_section): Always add an Input_section if
9492 (Output_section::add_merge_input_section): Add assert.
9493 (Output_section::relax_input_section): New method definition.
9494 (Output_section::set_final_data_size): Set load address to zero for
9495 an unallocated section.
9496 (Output_section::do_address_and_file_offset_have_reset_values):
9497 New method definition.
9498 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9499 Handle relaxed input section.
9500 (Output_section::sort_attached_input_sections): Checkpoint input
9501 section list lazily.
9502 (Output_section::get_input_sections): Change type of input_sections to
9503 list of Simple_input_section pointers. Checkpoint input section list
9504 lazily. Also handle relaxed input sections.
9505 (Output_section::add_input_section_for_script): Take a reference to
9506 a Simple_input_section object instead of Relobj pointer and section
9507 index as parameter. Handle relaxed input sections.
9508 (Output_section::save_states, Output_section::restore_states): New
9510 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9511 (Output_data::is_data_size_fixed): New method definition.
9512 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9514 (Output_data::address_and_file_offset_have_reset_values): New method
9516 (Output_data::do_address_and_file_offset_have_reset_values): New method
9518 (Output_data::set_data_size): Check that data size is not fixed.
9519 (Output_data::fix_data_size): New method definition.
9520 (Output_data::is_data_size_fixed_): New data member.
9521 (Output_section_headers::set_final_data_size): New method definition.
9522 (Output_section_headers::do_size): New method declaration.
9523 (Output_segment_headers::set_final_data_size): New method definition.
9524 (Output_segment_headers::do_size): New method declaration.
9525 (Output_file_header::set_final_data_size)::New method definition.
9526 (Output_file_header::do_size)::New method declaration.
9527 (Output_section_data::Output_section_data): Add new parameter
9528 is_data_size_fixed and use it to fix data size.
9529 (Output_data_const::Output_data_const): Adjust call to base class
9530 constructor and fix data size.
9531 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9532 base class constructor and fix data size.
9533 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9534 base class constructor and fix data size.
9535 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9536 class constructor and fix data size.
9537 (Output_data_group::set_final_data_size): New method definition.
9538 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9539 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9540 class constructor and fix data size.
9541 (Output_relaxed_input_section): New class definition.
9542 (Output_section::Simple_input_section): New class definition.
9543 (Output_section::get_input_sections): Adjust parameter list.
9544 (Output_section::add_input_section_for_script): Same.
9545 (Output_section::save_states, Output_section::restore_states,
9546 Output_section::do_address_and_file_offset_have_reset_values,
9547 (Output_section::Input_section::Input_section): Handle
9548 RELAXED_INPUT_SECTION_CODE. Add new overload for
9549 Output_relaxed_input_section.
9550 (Output_section::Input_section::is_input_section,
9551 Output_section::Input_section::set_output_section): Handle relaxed
9553 (Output_section::Input_section::is_relaxed_input_section,
9554 Output_section::Input_section::output_section_data,
9555 Output_section::Input_section::relaxed_input_section): New method
9557 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9559 (Output_section::Input_section::u1_): Update comments.
9560 (Output_section::Input_section::u2_): Add new union member poris.
9561 (Output_section::Checkpoint_output_section): New classs definition.
9562 (Output_section::relax_input_section): New method declaration.
9563 (Output_section::checkpoint_): New data member.
9564 (Output_segment): Update comments.
9565 (Output_segment::Output_segment): Un-privatize copy constructor.
9566 (Output_segment::operator=): Un-privatize.
9567 * script-sections.cc (Output_section_element::Input_section_list):
9568 Change element type to Output_section::Simple_input_section.
9569 (Output_section_element_dot_assignment::set_section_addresses):
9570 Register output section data for relaxation clean up.
9571 (Output_data_exression::Output_data_expression): Adjust call to base
9572 constructor to fix data size.
9573 (Output_section_element_data::set_section_addresses): Register
9574 Output_data_expression object for relaxation clean up.
9575 (struct Input_section_info): Replace Relobj pointer and section index
9576 pair with Output_section::Simple_input_section and Convert struct to a
9578 (Input_section_sorter::operator()): Adjust access to
9579 Input_section_info data member to use accessors.
9580 (Output_section_element_input::set_section_addresses): Use layout
9581 parameter. Adjust code to use Output_section::Simple_input_section
9582 and Input_secction_info classes. Register filler for relaxation
9584 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9585 and section index pair with Output_section::Simple_input_section
9586 class. Adjust code accordingly.
9587 (Phdrs_element::release_segment): New method definition.
9588 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9590 (Script_sections::release_segments): New method definition.
9591 * gold/script-sections.h (Script_sections::release_segments): New
9593 * gold/target.h (Target::may_relax, Target::relax,
9594 Target::do_may_relax, Target::do_relax): New method definitions.
9596 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9598 * arm.cc (has_signed_unsigned_overflow): New function.
9599 (Arm_relocate_functions::abs8): New function.
9600 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9601 (Target_arm::Scan::global): Likewise.
9602 (Target_arm::relocate::relocate): Likewise.
9603 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9606 2009-09-16 Cary Coutant <ccoutant@google.com>
9608 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9609 * testsuite/Makefile.in: Regenerate.
9611 2009-09-11 Nick Clifton <nickc@redhat.com>
9613 * po/gold.pot: Updated by the Translation project.
9615 2009-09-08 Cary Coutant <ccoutant@google.com>
9617 * output.cc (Output_file::open): Add execute permission to empty file.
9618 * testsuite/Makefile.am (permission_test): New test.
9619 * testsuite/Makefile.in: Regenerate.
9621 2009-09-02 Ian Lance Taylor <iant@google.com>
9623 * output.cc (Output_file::resize): Call map_no_anonymous rather
9626 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9628 * gold.cc: Include "incremental.h".
9629 (queue_initial_tasks): Call Incremental_checker methods.
9630 * incremental.cc: Include "output.h".
9631 (Incremental_checker::can_incrementally_link_output_file): New
9633 * incremental.h (Incremental_checker): New class.
9635 * output.cc (Output_file::open_for_modification): New method.
9636 (Output_file::map_anonymous): Changed return type to bool. Record
9638 (Output_file::map_no_anonymous): New method, broken out of map.
9639 (Output_file::map): Use map_no_anonymous and map_anonymous.
9640 * output.h (class Output_file): Update declarations.
9642 2009-08-24 Cary Coutant <ccoutant@google.com>
9644 * options.h (Command_line::Pre_options): New class.
9645 (Command_line::pre_options): New member.
9646 * options.cc (gold::options::ready_to_register): New variable.
9647 (One_option::register_option): Do nothing if not registering options.
9648 Assert if same short option registered twice.
9649 (General_options::General_options): Turn off option registration when
9651 (Command_line::Pre_options::Pre_options): New constructor.
9653 2009-08-24 Cary Coutant <ccoutant@google.com>
9655 * options.h (General_options::no_keep_memory): Remove incorrect
9658 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9660 * Makefile.am (am__skiplex, am__skipyacc): New.
9661 * Makefile.in: Regenerate.
9663 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9665 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9666 (INCLUDES): ... this.
9667 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9668 (AM_CPPFLAGS): Renamed from ...
9669 (INCLUDE): ... this.
9670 * Makefile.in, testsuite/Makefile.in: Regenerate.
9672 * Makefile.in: Regenerate.
9673 * aclocal.m4: Likewise.
9674 * config.in: Likewise.
9675 * configure: Likewise.
9676 * testsuite/Makefile.in: Likewise.
9678 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9679 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9680 * Makefile.in: Regenerate.
9681 * testsuite/Makefile.in: Regenerate.
9683 2009-08-19 Cary Coutant <ccoutant@google.com>
9685 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9686 symbols in shared libraries overridden by hidden or internal symbols
9687 in the main program.
9689 2009-08-19 Chris Demetriou <cgd@google.com>
9691 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9692 checking source file names in error messages.
9694 2009-08-18 Doug Kwan <dougkwan@google.com>
9696 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9697 an elcpp::Ehdr as parameter. Adjust call to set_target.
9698 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9699 an elfcpp::Ehdr as parameter.
9700 * object.cc (Object::set_target): Remove the version that looks up
9701 a target and sets it.
9702 (Sized_relobj::setup): Take a Target object instead of
9703 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9704 (make_elf_sized_object): Find target and ask target to
9706 * object.h: (Object::set_target): Remove the version that looks up
9707 a target and sets it.
9708 (Sized_relobj::setup): Take a Target object instead of
9709 an elfcpp:Ehdr as parameter.
9710 * target.cc: Include dynobj.h.
9711 (Target::do_make_elf_object_implementation): New.
9712 (Target::do_make_elf_object): New.
9713 * target.h (Target::make_elf_object): New template declaration.
9714 (Target::do_make_elf_object): New method declarations.
9715 (Target::do_make_elf_object_implementation): New template declaration.
9717 2009-08-14 Ian Lance Taylor <iant@google.com>
9719 * gold.h (FUNCTION_NAME): Define.
9720 (gold_unreachable): Use FUNCTION_NAME.
9722 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9724 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9725 symbol in the --keep-unique list is not found.
9727 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9729 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9730 been maked as --keep-unique.
9731 (Icf::unfold_section): New function.
9732 * icf.h (Icf::unfold_section): New function.
9733 * options.h (General_options::keep_unique): New option.
9734 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9735 * testsuite/Makefile.in: Regenerate.
9736 * testsuite/icf_keep_unique_test.sh: New file.
9737 * testsuite/icf_keep_unique_test.cc: New file.
9739 2009-08-12 Cary Coutant <ccoutant@google.com>
9742 * resolve.cc (Symbol_table::resolve): Check for references from
9743 dynamic objects to hidden and internal symbols.
9744 * testsuite/Makefile.am (hidden_test.sh): New test.
9745 * testsuite/Makefile.in: Regenerate.
9746 * testsuite/hidden_test.sh: New script.
9747 * testsuite/hidden_test_1.c: New test source.
9748 * testsuite/hidden_test_main.c: New test source.
9750 2009-08-11 Doug Kwan <dougkwan@google.com>
9752 * arm.cc: Update comments.
9753 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9754 segment to locate the .ARM.exidx section if present.
9756 2009-08-09 Doug Kwan <dougkwan@google.com>
9758 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9761 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9762 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9765 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9767 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9768 valid tls_segment only for non-debug-section relocations.
9769 * testsuite/Makefile.am: Add gc_tls_test.
9770 * testsuite/Makefile.in: Regenerate.
9771 * testsuite/gc_tls_test.cc: New file.
9772 * testsuite/gc_tls_test.sh: New file.
9774 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9778 * Makefile.am (CCFILES): Add icf.cc.
9780 * Makefile.in: Regenerate.
9781 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9782 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9783 section, symbol and addend information for the relocs.
9784 * gold.cc (queue_middle_tasks): Call identical code folding.
9785 * gold.h: Add defines for multimap.
9786 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9787 to the call of finalize_local_symbols.
9788 * main.cc (main): Create object of class Icf.
9789 * object.cc (Sized_relobj::do_layout): Allow this function to be
9790 called twice during icf.
9791 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9792 to sections marked as identical by icf.
9793 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9795 (Sized_relobj::do_section_entsize): New function.
9796 * object.h (Object::section_entsize): New function.
9797 (Object::do_section_entsize): New pure virtual function.
9798 (Relobj::finalize_local_symbols): Add new parameter.
9799 (Relobj::do_section_entsize): New function.
9800 * options.h (General_options::icf): New option.
9801 (General_options::icf_iterations): New option.
9802 (General_options::print_icf_sections): New option.
9803 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9804 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9805 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9807 * symtab.cc (Symbol_table::is_section_folded): New function.
9808 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9809 to sections marked as identical by icf.
9810 * symtab.h (Symbol_table::set_icf): New function.
9811 (Symbol_table::icf): New function.
9812 (Symbol_table::is_section_folded): New function.
9813 (Symbol_table::icf_): New data member.
9814 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9815 * testsuite/Makefile.am: Add commands to build icf_test.
9816 * testsuite/Makefile.in: Regenerate.
9817 * testsuite/icf_test.sh: New file.
9818 * testsuite/icf_test.cc: New file.
9820 2009-07-24 Chris Demetriou <cgd@google.com>
9822 * layout.cc (is_compressible_debug_section): Fix incorrect
9823 comment about compressed section names.
9825 2009-07-20 Ian Lance Taylor <ian@airs.com>
9828 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9830 2009-07-16 Ian Lance Taylor <iant@google.com>
9833 * layout.h: #include <map>.
9834 (class Kept_section): Change from struct to class. Add accessors
9835 and setters. Add section size to Comdat_group mapping. Change
9836 Comdat_group to std::map. Add is_comdat_ field. Add
9837 linkonce_size field in union.
9838 (class Layout): Update declaration of find_or_add_kept_section.
9839 Don't declare find_kept_object.
9840 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9841 parameter. Add object, shndx, is_comdat, and is_group_name
9842 parameters. Change all callers. Adjust for new Kept_section.
9843 (Layout::find_kept_object): Remove.
9844 * object.cc (Sized_relobj::include_section_group): Update use of
9845 Kept_section. Rename secnum to shndx. Only record
9846 Kept_comdat_section if sections are the same size.
9847 (Sized_relobj::include_linkonce_section): Update use of
9848 Kept_section. Only record Kept_comdat_section if sections are the
9849 same size. Set size of linkonce section.
9850 (Sized_relobj::map_to_kept_section): Update call to
9851 get_kept_comdat_section.
9852 * object.h (class Sized_relobj): Rename fields in
9853 Kept_comdat_section to drop trailing underscores; change object
9854 field to Relobj*. Change Kept_comdat_section_table to store
9855 struct rather than pointer.
9856 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9857 Add kept_object and kept_shndx parameters. Change all callers.
9858 (Sized_relobj::get_kept_comdat_section): Change return type to
9859 bool. Add kept_object and kept_shndx parameters. Change all
9861 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9862 Layout::find_or_add_kept_section.
9864 2009-07-09 Ian Lance Taylor <iant@google.com>
9866 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9867 Reserve space in the hash table.
9869 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9871 * fileread.cc (File_read::get_mtime): New method.
9872 * fileread.h (Timespec): New structure.
9873 (File_read::get_mtime): New method.
9874 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9875 Renamed from timestamp_nsec.
9876 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9878 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9880 (Incremental_inputs::report_archive): Save mtime; style fix.
9881 (Incremental_inputs::report_obejct): Save mtime; style fix.
9882 (Incremental_inputs::report_script): Save mtime; style fix.
9883 (Incremental_inputs::finalize_inputs): Style fix.
9884 (Incremental_inputs::finalize): Style fix.
9885 (Incremental_inputs::create_input_section_data): Store inputs
9887 * incremental.h (Incremental_inputs::report_script): Add mtime
9889 (Incremental_inputs::Input_info::Input_info): Intialize only one
9891 (Incremental_inputs::Input_info::archive): Move to nameless
9893 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9894 (Incremental_inputs::Input_info::script): Move to nameless union.
9895 (Incremental_inputs::mtime): New field.
9896 * script.cc (read_input_script): Pass file mtime to
9898 * script.h (Script_info::inputs): Style fix.
9900 2009-07-01 Ian Lance Taylor <ian@airs.com>
9902 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9905 2009-06-24 Ian Lance Taylor <iant@google.com>
9908 * layout.cc (Layout::choose_output_section): If we find an
9909 existing section, update the flags.
9910 (Layout::create_notes): New function, broken out of
9912 (Layout::finalize): Don't create note sections.
9913 (Layout::create_note): Don't crash if linker script discards
9915 (Layout::create_gold_note): Likewise.
9916 (Layout::create_build_id): Likewise. Don't set
9917 after_input_sections on the section.
9918 (Layout::create_executable_stack_info): Remove target parameter.
9920 * layout.h (class Layout): Declare create_notes. Update
9921 declaration of create_executable_stack_info.
9922 * gold.cc (queue_middle_tasks): Call create_notes.
9923 * output.cc (Output_section::update_flags_for_input_section): Move
9924 here from output.h. If SHF_ALLOC flag is newly set, mark address
9926 * output.h (Output_data::mark_address_invalid): New function.
9927 (class Output_section): Only declare, not define,
9928 update_flags_for_input_section. Remove set_flags.
9930 2009-06-24 Ian Lance Taylor <iant@google.com>
9932 * script-sections.cc (Output_section_definition::
9933 set_section_addresses): Rename shadowing local load_address to
9936 2009-06-24 Ian Lance Taylor <iant@google.com>
9939 * reloc.cc (relocate_sections): Skip empty relocation sections.
9941 2009-06-23 Ian Lance Taylor <iant@google.com>
9944 * layout.cc (Layout::create_note): Use choose_output_section
9945 rather than make_output_section.
9947 2009-06-23 Ian Lance Taylor <iant@google.com>
9950 * options.cc (General_options::parse_V): Set printed_version_.
9951 (General_options::General_options): Initialize printed_version_.
9952 * options.h (class General_options): Add printed_version_ field.
9953 * gold.cc (queue_initial_tasks): If there are no input files,
9954 don't give a fatal error if we printed the version information.
9955 (queue_middle_tasks): If using -r with a shared object, give a
9956 fatal error rather than an ordinary error.
9958 2009-06-23 Ian Lance Taylor <iant@google.com>
9961 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9962 (Layout::make_output_section): Set have_stabstr_section_ if we see
9963 a .stab*str section.
9964 (Layout::finalize): Call link_stabs_sections.
9965 (Layout::link_stabs_sections): New file.
9966 * layout.h (class Layout): Add have_stabstr_section_ field.
9967 Declare link_stabs_sections.
9969 2009-06-23 Doug Kwan <dougkwan@google.com>
9971 * Makefile.am (libgold_a_LIBADD): New.
9972 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9973 * Makefile.in: Regenerate.
9974 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9975 * configure: Regenerate.
9976 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9977 * fileread.cc: Include sys/state.h
9978 * gold.h: Declare memmem and strndup if found missing.
9979 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9981 2009-06-23 Ian Lance Taylor <iant@google.com>
9983 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9984 * configure: Rebuild.
9986 2009-06-23 Ian Lance Taylor <iant@google.com>
9989 * object.cc (Object::section_contents): Don't try to get a view if
9990 the section has length zero.
9991 (Object::handle_gnu_warning_section): If the section is empty, use
9992 the name of the section as the warning.
9994 2009-06-23 Ian Lance Taylor <iant@google.com>
9997 * stringpool.h (class Stringpool_template): Add optimize_ field.
9998 (Stringpool_template::set_optimize): New function.
9999 * stringpool.cc (Stringpool_template::Stringpool_template):
10000 Initialize optimize_ field.
10001 (Stringpool_template::set_string_offsets): Test local optimize
10002 fild rather than parameter.
10003 * layout.cc (Layout::Layout): Call set_optimize on the section
10006 2009-06-22 Ian Lance Taylor <iant@google.com>
10009 * yyscript.y: Parse TARGET.
10010 * script.cc (script_set_target): New function.
10011 * script-c.h (script_set_target): Declare.
10012 * options.cc (General_options::string_to_object_format): Rename
10013 from string_to_object_format in anonymous namespace. Change
10015 * options.h (class General_options): Declare
10016 string_to_object_format.
10018 2009-06-22 Ian Lance Taylor <iant@google.com>
10020 * script-sections.cc (Script_sections::create_segments): Don't put
10021 program headers in a PT_LOAD segment if -n or -N.
10023 2009-06-22 Ian Lance Taylor <iant@google.com>
10026 * options.h (class General_options): Add -z lazy and -z now. Sort
10027 -z options into alphabetical order.
10028 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10030 2009-06-21 Ian Lance Taylor <iant@google.com>
10032 * layout.cc (Layout::make_output_section): Call
10033 Target::new_output_section.
10034 (Layout::attach_allocated_section_to_segment): Put large section
10035 sections in a separate load segment with the large segment flag
10037 (Layout::segment_precedes): Sort large data segments after other
10039 (align_file_offset): New static function.
10040 (Layout::set_segment_offsets): Use align_file_offset.
10041 * output.h (class Output_section): Add is_small_section_ and
10042 is_large_section_ fields.
10043 (Output_section::is_small_section): New function.
10044 (Output_section::set_is_small_section): New function.
10045 (Output_section::is_large_section): New function.
10046 (Output_section::set_is_large_section): New function.
10047 (Output_section::is_large_data_section): New function.
10048 (class Output_segment): Add is_large_data_segment_ field.
10049 (Output_segment::is_large_data_segment): New function.
10050 (Output_segment::set_is_large_data_segment): New function.
10051 * output.cc (Output_section::Output_section): Initialize new
10053 (Output_segment::Output_segment): Likewise.
10054 (Output_segment::add_output_section): Add assertion that large
10055 data sections always go in large data segments. Force small data
10056 sections to the end of the list of data sections. Force small BSS
10057 sections to the start of the list of BSS sections. For large BSS
10058 sections to the end of the list of BSS sections.
10059 * symtab.h (class Symbol): Declare is_common_shndx.
10060 (Symbol::is_defined): Check Symbol::is_common_shndx.
10061 (Symbol::is_common): Likewise.
10062 (class Symbol_table): Define enum Commons_section_type. Update
10063 declarations. Add small_commons_ and large_commons_ fields.
10064 * symtab.cc (Symbol::is_common_shndx): New function.
10065 (Symbol_table::Symbol_table): Initialize new fields.
10066 (Symbol_table::add_from_object): Put small and large common
10067 symbols in the right list.
10068 (Symbol_table::sized_finalized_symbol): Check
10069 Symbol::is_common_shndx.
10070 (Symbol_table::sized_write_globals): Likewise.
10071 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10072 common symbol lists. Don't call do_allocate_commons_list if the
10074 (Symbol_table::do_allocate_commons_list): Remove is_tls
10075 parameter. Add comons_section_type parameter. Change all
10076 callers. Handle small and large common symbols.
10077 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10078 Symbol::is_common_shndx.
10079 * resolve.cc (symbol_to_bits): Likewise.
10080 * target.h (Target::small_common_shndx): New function.
10081 (Target::small_common_section_flags): New function.
10082 (Target::large_common_shndx): New function.
10083 (Target::large_common_section_flags): New function.
10084 (Target::new_output_section): New function.
10085 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10086 small_common_section_flags, and large_common_section_flags
10088 (Target::do_new_output_section): New virtual function.
10089 * arm.cc (Target_arm::arm_info): Initialize new fields.
10090 * i386.cc (Target_i386::i386_info): Likewise.
10091 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10093 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10094 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10095 (Target_x86_64::do_new_output_section): New function.
10096 * configure.ac: Define conditional MCMODEL_MEDIUM.
10097 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10098 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10099 (large_LDFLAGS): Define.
10100 * testsuite/large.c: New file.
10101 * testsuite/testfile.cc (Target_test::test_target_info):
10102 Initialize new fields.
10103 * configure, testsuite/Makefile.in: Rebuild.
10105 2009-06-05 Doug Kwan <dougkwan@google.com>
10107 * Makefile.am (CCFILES): Add target.cc.
10108 * Makefile.in: Regenerate.
10109 * i386.cc (class Target_i386): Define new virtual method to
10110 override do_is_local_label_name in parent.
10111 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10112 local symbols if --discard-locals or -X is given.
10113 * options.h (class General_options): Declare new options
10114 '--discard-locals' and '-X' for discarding locals.
10115 * target.h (class Target): Define new methods is_local_label_name.
10116 Declare new virtual method do_is_local_label_name.
10117 * target.cc: New file.
10118 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10119 (check_SCRIPTS): Add discard_locals_test.sh.
10120 (check_DATA): Add discard_local_tests.syms.
10121 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10122 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10123 * testsuite/Makefile.in: Regenerate.
10124 * testsuite/discard_locals_test.c: New file.
10125 * testsuite/discard_locals_test.sh: Same.
10127 2009-06-05 Doug Kwan <dougkwan@google.com>
10129 * object.cc (Sized_relobj::Sized_relobj): Initialize
10130 discarded_eh_frame_shndx_ to -1U.
10131 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10133 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10134 a discarded .eh_frame section.
10135 (Sized_relobj::do_finalize_local_symbols): Ditto.
10136 * object.h (class Sized_relobj): Declare new member
10137 discarded_eh_frame_shndx_.
10138 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10139 (local_labels_test.o, local_labels_test): New rules.
10140 * testsuite/Makefile.in: Regenerate.
10142 2009-06-04 Doug Kwan <dougkwan@google.com>
10144 * layout.cc (Layout::section_name_mapping): Add mapping for
10145 special ARM sections.
10147 2009-06-03 Doug Kwan <dougkwan@google.com>
10149 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10150 (utils::has_overflow): Same.
10152 2009-06-03 Ian Lance Taylor <iant@google.com>
10154 * layout.cc (Layout::section_name_mapping): New array, replacing
10155 Layout::linkonce_mapping.
10156 (Layout::section_name_mapping_count): New variable, replacing
10157 Layout::linkonce_mapping_count.
10158 (Layout::linkonce_output_name): Remove.
10159 (Layout::output_section_name): Rewrite.
10160 * layout.h (class Layout): Rename Linkonce_mapping to
10161 Section_name_mapping, linkonce_mapping to section_name_mapping,
10162 linkonce_mapping_count to section_name_mapping_count. Don't
10163 declare linkonce_output_name.
10165 2009-06-03 Doug Kwan <dougkwan@google.com>
10167 * gold/arm.cc (namespace utils): New.
10168 (Target_arm::reloc_is_non_pic): Define new method.
10169 (class Arm_relocate_functions): New.
10170 (Target_arm::Relocate::relocate): Handle relocation types used by
10173 2009-06-03 Ian Lance Taylor <iant@google.com>
10175 * arm.cc (Target_arm::scan::global): Use || instead of |.
10177 2009-06-02 Doug Kwan <dougkwan@google.com>
10179 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10180 issued_non_pic_error_.
10181 (class Target_arm::Scan): Declare new method check_non_pic.
10182 Define new method symbol_needs_plt_entry.
10183 Declare new data member issued_non_pic_error_.
10184 (class Target_arm::Relocate): Declare new method
10185 should_apply_static_reloc.
10186 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10187 (Target_arm::Scan::check_non_pic): Define new method.
10188 (Target_arm::Scan::local): Handle a small subset of reloc types used
10190 (Target_arm::Scan::local): Same.
10191 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10193 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10195 * incremental.cc (Incremental_inputs::report_command_line): Filter
10196 out --incremental-* options.
10198 2009-05-29 Doug Kwan <dougkwan@google.com>
10200 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10202 (class Target_arm): Update comment.
10203 (Target_arm::Target_arm): Initialize new data members GOT_,
10204 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10205 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10206 and Target_arm::rel_dyn_section.
10207 Declare new_enum Target_arm::Got_type.
10208 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10210 Update commments for member do_dynsym_value.
10211 (Target_arm::got_size, Target_arm::plt_section,
10212 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10213 new methods inside class defintion.
10214 (Target_arm::got_section): Define new method.
10215 (Target_arm::rel_dyn_section): Same.
10216 (Output_data_plt_arm): New template class.
10217 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10218 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10219 (Output_data_plt_arm::add_entry): Same.
10220 (Output_data_plt_arm::first_plt_entry): Define new
10221 static data member for PLT instruction template.
10222 (Output_data_plt_arm::plt_entry): Same.
10223 (Output_data_plt_arm::do_write): Define new method.
10224 (Target_arm::make_plt_entry): Same.
10225 (Target_arm::do_finalize_sections): Same.
10226 (Target_arm::do_dynsym_value): Same.
10228 2009-05-28 Doug Kwan <dougkwan@google.com>
10230 * Makefile.am (TARGETSOURCES): Add arm.cc.
10231 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10232 * Makefile.in: Regenerate.
10233 * arm.cc: New file.
10234 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10236 2009-05-26 Doug Kwan <dougkwan@google.com>
10238 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10239 (General_options::check_excluded_libs): Strip off directories in
10240 archive name before matching like GNU ld does.
10241 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10242 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10243 (exclude_libs_test_LDFLAGS): Add linker option
10244 -Wl,--exclude-libs,libexclude_libs_test_3
10245 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10246 an explicit archive without using -l.
10247 (alt/libexclude_libs_test_3.a): New make rule.
10248 * testsuite/Makefile.in: Regenerate.
10249 * testsuite/exclude_libs_test.c : Declare lib3_default().
10251 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10252 * exclude_libs_test_3.c: New file.
10254 2009-05-26 Nick Clifton <nickc@redhat.com>
10256 * po/id.po: New Indonesian translation.
10257 * po/gold.pot: Updated template file.
10259 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10261 * testsuite/Makefile.am: Add -ffunction-sections to compile
10262 gc_comdat_test files. Add -Wl,--gc-sections to build
10264 * testsuite/Makefile.in: Regenerate.
10265 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10267 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10269 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10270 kept comdat section was garbage collected.
10271 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10272 * testsuite/Makefile.in: Regenerate.
10273 * testsuite/gc_comdat_test.sh: New file.
10274 * testsuite/gc_comdat_test_1.cc: New file.
10275 * testsuite/gc_comdat_test_2.cc: New file.
10277 2009-05-19 Doug Kwan <dougkwan@google.com>
10279 * archive.cc (Archive::Archive): Move constructor from archive.h
10280 to here. Initialize no_export_.
10281 (Archive::get_elf_object_for_member): Set no_export flag of object.
10282 * archive.h (Archive::Archive): Move constructor body to
10284 (Archive::no_export): New method.
10285 (Archive::no_export_): New field.
10286 * object.h (Object::Object): Initialize no_export_ to false.
10287 (Object::no_export, Object::set_no_export): New methods.
10288 (Object::no_export_): New field.
10289 * options.cc (General_options::parse_exclude_libs): New method.
10290 (General_options::check_excluded_libs) Same.
10291 * options.h (exclude_libs): New option.
10292 (General_options::check_excluded_libs): New method declaration.
10293 (General_options::excluded_libs_): New field.
10294 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10295 default or protected visibility if an object has no-export flag set.
10296 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10297 (check_SCRIPTS): Add exclude_libs_test.sh.
10298 (check_DATA): Add exclude_libs_test.syms.
10299 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10300 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10301 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10302 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10303 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10304 libexclude_libs_test_2.a): New rules.
10305 * testsuite/Makefile.in: Regenerate.
10306 * testsuite/exclude_libs_test.c: New file.
10307 * testsuite/exclude_libs_test.sh: Ditto.
10308 * testsuite/exclude_libs_test_1.c: Ditto.
10309 * testsuite/exclude_libs_test_2.c: Ditto.
10311 2009-05-15 Ian Lance Taylor <iant@google.com>
10313 * configure.ac: Check for declarations for cases where libiberty.h
10314 checks HAVE_DECL_xxx.
10315 * configure, config.in: Rebuild.
10317 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10319 * gold.h (Incremental_argument_list): Remove (invalid) forward
10321 * incremental.cc (Incremental_inputs::report_achive): New method.
10322 (Incremental_inputs::report_object): New method.
10323 (Incremental_inputs::report_script): New method.
10324 (Incremental_inputs::finalize_inputs): New method.
10325 (Incremental_inputs::finalize): Call finalize_inputs().
10326 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10327 Create inputs entries.
10328 * incremental.h (Incremental_input_type): New enum.
10329 (Incremental_inputs::Incremental_input): Initialize new fields.
10330 (Incremental_inputs::report_inputs): New method.
10331 (Incremental_inputs::report_achive): New method.
10332 (Incremental_inputs::report_object): New method.
10333 (Incremental_inputs::report_script): New method.
10334 (Incremental_inputs::finalize_inputs): New method.
10335 (Incremental_inputs::Input_info): New struct.
10336 (Incremental_inputs::Input_info_map): New typedef.
10337 (Incremental_inputs::lock_): New field.
10338 (Incremental_inputs::Inputs_): New field.
10339 (Incremental_inputs::Inputs_map): New field.
10340 * main.cc (main): Call Incremental_input::report_inputs.
10341 * options.h (Input_argument_list): Typedef moved from
10343 (Input_file_group::Files): Remove, use ::Input_argument_list.
10344 (Input_file_group::Input_argument_list): Remove, use
10345 ::Input_argument_list.
10346 * plugin.cc (Plugin_manager::add_input_file): Add error in
10348 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10350 * script.cc (read_input_script): Call
10351 Incremental_input::report_script.
10352 * script.h (Script_info): New class.
10354 2009-04-27 Ian Lance Taylor <iant@google.com>
10356 * x86_64.cc (do_adjust_output_section): Set entsize to
10359 2009-04-23 Elliott Hughes <enh@google.com>
10361 * output.cc (Output_file::close): After short writes, continue
10362 writing from the correct offset in the buffer being written.
10364 2009-04-23 Chris Demetriou <cgd@google.com>
10366 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10367 * configure: Regenerate.
10368 * config.in: Regenerate.
10369 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10370 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10372 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10374 * incremental.cc (Incremental_inputs_header_data): Renamed from
10375 Incremental_input_header_data.
10376 (Incremental_inputs_header_data::data_size): New field.
10377 (Incremental_inputs_header_data::put_input_file_count): Renamed
10378 from input_file_count.
10379 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10380 from command_line_offset.
10381 (Incremental_inputs_header_data::put_reserved): Renamed from
10383 (Incremental_inputs_entry_data): Renamed from
10384 Incremental_input_entry_data.
10385 (Incremental_inputs_entry_data::data_size): New field.
10386 (Incremental_inputs::report_command_line): New method.
10387 (Incremental_inputs::finalize): New method.
10388 (Incremental_inputs::create_incremental_inputs_data): New method.
10389 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10390 * incremental.h: New file.
10391 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10392 (Layout::finalize): Create incremental inputs section in
10393 incremental builds.
10394 (Layout::create_incremental_info_sections): New method.
10395 * layout.h (Layout::incremental_inputs): New method.
10396 (Layout::create_incremental_info_sections): New method.
10397 (Layout::incremental_inputs_): New field.
10398 * main.cc (main): Notify Incremental_input of the command line.
10400 2009-04-01 Ian Lance Taylor <iant@google.com>
10401 Mikolaj Zalewski <mikolajz@google.com>
10403 * gold.h (reserve_unordered_map): Define, three versions, one for
10404 each version of Unordered_map.
10405 * layout.cc (Layout::Layout): Remove options parameter. Add
10406 number_of_input_files parameter. Don't initialize options_.
10407 Initialize number_of_input_files_ and resized_signatures_. Move
10408 sections_are_attached_.
10409 (Layout::layout_group): Reserve space for group_signatures_.
10410 (Layout::find_or_add_kept_section): Change name parameter to be a
10411 reference. Resize signatures_ map when it gets large enough.
10412 (Layout::layout_eh_frame): Use parameters->options() instead of
10414 (Layout::make_output_section): Likewise.
10415 (Layout::attach_allocated_section_to_segment): Likewise.
10416 (Layout::finalize, Layout::create_executable_stack): Likewise.
10417 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10418 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10419 * layout.h (class Layout): Update declarations. Remove options_
10420 field. Add number_of_input_files_ and resized_signatures_
10421 fields. Move sections_are_attached_ field.
10422 * main.cc (main): Pass number of input files to Layout
10423 constructor. Don't pass options.
10425 2009-03-30 Ian Lance Taylor <iant@google.com>
10427 * ffsll.c (ffsll): Correct implementation.
10429 2009-03-27 Ian Lance Taylor <iant@google.com>
10431 * ffsll.c: New file.
10432 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10433 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10434 * ftruncate.c (ftruncate): Declare before definition.
10435 * mremap.c (mremap): Likewise.
10436 * pread.c (pread): Likewise.
10437 * configure, Makefile.in, config.in: Rebuild.
10439 * mremap.c: New file.
10440 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10441 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10442 (mremap): Declare if HAVE_MREMAP is not defined.
10443 * configure, Makefile.in, config.in: Rebuild.
10445 2009-03-27 Cary Coutant <ccoutant@google.com>
10447 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10448 position independent.
10449 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10450 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10452 2009-03-24 Cary Coutant <ccoutant@google.com>
10454 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10456 (needs_dynamic_reloc): Likewise.
10458 2009-03-24 Ian Lance Taylor <iant@google.com>
10460 * yyscript.y (file_cmd): Recognize EXTERN.
10461 (extern_name_list, extern_name_list_body): New nonterminals.
10462 * script.cc (script_add_extern): Define.
10463 * script-c.h (script_add_extern): Declare.
10465 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10467 * object.cc (is_elf_object): Define.
10468 * object.h (is_elf_object): Declare.
10469 * archive.cc (Archive::get_elf_object_for_member): Call
10471 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10473 2009-03-24 Elliott Hughes <enh@google.com>
10475 * output.cc (Output_file::map_anonymous): Define.
10476 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10477 try an anonymous one. Report the size if the mmap fails.
10478 * output.h (class Output_file): Declare map_anonymous.
10480 2009-03-24 Ian Lance Taylor <iant@google.com>
10482 * target-select.cc (instantiate_target): Don't acquire the lock if
10483 the instantiated_target_ field has already been set.
10485 2009-03-23 Ian Lance Taylor <iant@google.com>
10487 * gold-threads.h (class Initialize_lock): Define.
10488 * gold-threads.cc (class Initialize_lock_once): Define.
10489 (initialize_lock_control): New static variable.
10490 (initialize_lock_pointer): New static variable.
10491 (initialize_lock_once): New static function.
10492 (Initialize_lock::Initialize_lock): Define.
10493 (Initialize_lock::initialize): Define.
10494 * target-select.h: Include "gold-threads.h".
10495 (class Target_selector): Add lock_ and initialize_lock_ fields.
10496 Don't define instantiate_target, just declare it.
10497 * target-select.cc (Target_selector::Target_selector): Initialize
10499 (Target_selector::instantiate_target): Define.
10500 * descriptors.h: Include "gold-threads.h".
10501 (class Descriptors): Add initialize_lock_ field.
10502 * descriptors.cc (Descriptors::Descriptors): Initialize new
10504 (Descriptors::open): Use initialize_lock_ field
10505 * errors.h (class Errors): Add initialize_lock_ field.
10506 * errors.cc (Errors::Errors): Initialize new field.
10507 (Errors::initialize_lock): Use initialize_lock_ field.
10508 * powerpc.cc (class Target_selector_powerpc): Remove
10509 instantiated_target_ field. In do_recognize call
10510 instantiate_target rather than do_instantiate_target. In
10511 do_instantiate_target just allocate a new target.
10512 * sparc.cc (class Target_selector_sparc): Likewise.
10514 * freebsd.h: New file.
10515 * i386.cc: Include "freebsd.h".
10516 (Target_i386): Derive from Target_freebsd rather than
10518 (Target_selector_i386): Derive from Target_selector_freebsd rather
10519 than Target_selector.
10520 * x86_64.cc: Include "freebsd.h".
10521 (Target_x86_64): Derive from Target_freebsd rather than
10523 (Target_selector_x86_64): Derive from Target_selector_freebsd
10524 rather than Target_selector.
10525 * target.h (class Target): Add adjust_elf_header and
10526 do_adjust_elf_header.
10527 * output.cc (Output_file_header:: do_sized_write): Call target
10528 adjust_elf_header routine.
10529 * configure.tgt: Set targ_osabi.
10530 * configure.ac: Define GOLD_DEFAULT_OSABI.
10531 * parameters.cc (Parameters::default_target): Pass
10532 GOLD_DEFAULT_OSABI to select_target.
10533 * target-select.h (class Target_selector): Make instantiate_target
10534 protected rather than private.
10535 * Makefile.am (HFILES): Add freebsd.h.
10536 * configure, Makefile.in, config.in: Rebuild.
10538 * merge.cc (do_add_input_section): Correct pend value. Change
10539 message about last entry not being null terminated from error to
10542 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10544 * incremental.cc: New file.
10545 * Makefile.am (CCFILES): Add incremental.cc.
10546 * Makefile.in: Rebuild.
10548 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10550 * layout.cc (Layout::output_section_name): Preserve names
10551 of '.note.' sections.
10553 2009-03-19 Ian Lance Taylor <iant@google.com>
10555 * descriptors.cc (Descriptors::open): Check that the options are
10556 valid before using them.
10558 2009-03-18 Ian Lance Taylor <iant@google.com>
10560 * script-sections.h: Include <list>.
10561 (class Script_sections): Change Sections_elements from std::vector
10562 to std::list. Typedef public Elements_iterator. Add
10563 orphan_section_placement_, data_segment_align_start_, and
10564 saw_data_segment_align_ fields. Remove data_segment_align_index_
10566 * script-sections.cc (class Orphan_section_placement): New class.
10567 (class Sections_element): Add virtual functions is_relro and
10568 orphan_section_init. Remove virtual function place_orphan_here.
10569 (class Output_section_definition): Add is_relro and
10570 orphan_section_init. Remove place_orphan_here.
10571 (class Orphan_output_section): Likewise.
10572 (Script_sections::Script_sections): Update for field changes.
10573 (Script_sections::data_segment_align): Set saw_data_segment_align_
10574 and data_segment_align_start_, not data_segment_align_index.
10575 (Script_sections::data_segment_relro_end): Check
10576 saw_data_segment_align_. Use data_segment_align_start_ rather
10577 than data_segment_align_index_.
10578 (Script_sections::place_orphan): Rewrite to use
10579 Orphan_section_placement.
10581 2009-03-17 Ian Lance Taylor <iant@google.com>
10583 * archive.cc (Archive::add_symbols): Check for a version attached
10584 to the symbol name in the archive map.
10585 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10586 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10587 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10588 (ver_test_11.a): New target.
10589 * testsuite/Makefile.in: Rebuild.
10591 * configure.ac: Check for chsize and posix_fallocate. Replace
10593 * ftruncate.c: New file, from gnulib.
10594 * output.cc (posix_fallocate): Define dummy version if not
10595 HAVE_POSIX_FALLOCATE.
10596 (Output_file::map): Call posix_fallocate rather than lseek and
10598 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10599 * configure, Makefile.in, config.in: Rebuild.
10601 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10603 * layout.h (Layout::create_note): Add section_name parameter.
10604 * layout.cc (Layout::create_note): Likewise.
10605 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10607 2009-03-17 Ian Lance Taylor <iant@google.com>
10609 * descriptors.cc: Include "options.h".
10610 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10611 (Descriptors::open): Always use O_CLOEXEC when opening a new
10612 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10613 then set FD_CLOEXEC.
10615 * sparc.cc (class Target_sparc): Add has_got_section.
10616 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10617 make sure we have a GOT section.
10619 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10620 (Target_sparc::Scan::local): Likewise.
10621 (Target_sparc::Scan::global): Likewise.
10622 (Target_sparc::Relocate::relocate): Likewise.
10623 (Target_sparc::Relocate::relocate_tls): Likewise.
10625 * symtab.cc (Symbol_table::define_default_version): New function,
10626 broken out of add_from_object.
10627 (Symbol_table::add_from_object): Call define_default_version.
10628 (Symbol_table::define_special_symbol): Add resolve_oldsym
10629 parameter. Change all callers. If the version for a symbol comes
10630 from a version script, resolve it with the symbol with the same
10631 name with no version. Also add the symbol without a version if
10633 (do_define_in_output_data): If resolving with oldsym, don't delete
10635 (do_define_in_output_segment): Likewise.
10636 (do_define_as_constant): Likewise.
10637 * symtab.h (class Symbol_table): Update declarations.
10639 2009-03-13 Ian Lance Taylor <iant@google.com>
10641 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10642 (Read_symbols::requeue): New function.
10643 (Read_symbols::do_read_symbols): If make_elf_object fails because
10644 the target type is not configured, and the file was searched for,
10645 issue a warning and retry with the next directory.
10646 (Add_symbols::run): If the file has an incompatible format, and
10647 it was searched for, requeue the Read_symbols task. On error,
10648 release the object.
10649 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10650 dirindex parameter to constructor. Change all callers. Declare
10651 incompatible_warning and requeue.
10652 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10653 input_argument_ and input_group_ fields. Add them to
10654 constructor. Change all callers.
10655 (class Read_script): Add dirindex_ field. Add it to constructor.
10656 Change all callers.
10657 * archive.cc (Archive::setup): Remove input_objects parameter.
10658 Change all callers.
10659 (Archive::get_file_and_offset): Likewise.
10660 (Archive::read_all_symbols): Likewise.
10661 (Archive::read_symbols): Likewise.
10662 (Archive::get_elf_object_for_member): Remove input_objects
10663 parameter. Add punconfigured parameter. Change all callers.
10664 (Archive::add_symbols): Change return type to bool. Check return
10665 value of include_member.
10666 (Archive::include_all_members): Likewise.
10667 (Archive::include_member): Change return type to bool. Return
10668 false if first included object has incompatible target. Set
10669 included_member_ field.
10670 (Add_archive_symbols::run): If add_symbols returns false, requeue
10672 * archive.h (class Archive): Add included_member_ field.
10673 Initialize it in constructor. Add input_file and searched_for
10674 methods. Update declarations.
10675 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10676 input_argument_ fields. Add them to constructor. Change all
10678 * script.cc: Include "target-select.h".
10679 (class Parser_closure): Add skip_on_incompatible_target_ and
10680 found_incompatible_target_ fields. Add
10681 skip_on_incompatible_target parameter to constructor. Change all
10682 callers. Add methods skip_on_incompatible_target,
10683 clear_skip_on_incompatible_target, found_incompatible_target, and
10684 set_found_incompatible_target.
10685 (read_input_script): Add dirindex parameter. Change all callers.
10686 If parser finds an incompatible target, requeue Read_symbols
10688 (script_set_symbol): Clear skip_on_incompatible_target in
10690 (script_add_assertion, script_parse_option): Likewise.
10691 (script_start_sections, script_add_phdr): Likewise.
10692 (script_check_output_format): New function.
10693 * script.h (read_input_script): Update declaration.
10694 * script-c.h (script_check_output_format): Declare.
10695 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10696 (ignore_cmd): Remove OUTPUT_FORMAT.
10697 * fileread.cc (Input_file::Input_file): Add explicit this.
10698 (Input_file::will_search_for): New function.
10699 (Input_file::open): Add pindex parameter. Change all callers.
10700 * fileread.h (class Input_file): Add input_file_argument method.
10701 Declare will_search_for. Update declarations.
10702 * object.cc (make_elf_object): Add punconfigured parameter.
10703 Change all callers.
10704 * object.h (class Object): Make input_file public. Add
10705 searched_for method.
10706 (make_elf_object): Update declaration.
10707 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10709 * dirsearch.h (class Dirsearch): Update declaration.
10710 * options.h (class General_options): Add --warn-search-mismatch.
10711 * parameters.cc (Parameters::is_compatible_target): New function.
10712 * parameters.h (class Parameters): Declare is_compatible_target.
10713 * workqueue.cc (Workqueue::add_blocker): New function.
10714 * workqueue.h (class Workqueue): Declare add_blocker.
10716 * fileread.cc (Input_file::open): Remove options parameter.
10717 Change all callers.
10718 (Input_file::open_binary): Likewise.
10719 * script.cc (read_input_script): Likewise.
10720 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10721 options parameter from constructor. Change all callers.
10722 (class Read_script): Likewise.
10723 * fileread.h (class Input_file): Update declarations.
10724 * script.h (read_input_script): Update declaration.
10726 2009-03-10 Nick Clifton <nickc@redhat.com>
10728 * po/es.po: New Spanish translation.
10730 2009-03-06 Cary Coutant <ccoutant@google.com>
10732 * options.cc (parse_short_option): Keep dash_z from registering itself.
10734 2009-03-03 Ian Lance Taylor <iant@google.com>
10737 * target-reloc.h (relocate_section): Pass output_section to
10739 * i386.cc (Target_i386::should_apply_static_reloc): Add
10740 output_section parameter. Change all callers.
10741 (Target_i386::Relocate::relocate): Add output_section parameter.
10742 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10743 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10744 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10745 * testsuite/two_file_shared.sh: New script.
10746 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10747 (check_DATA): Add two_file_shared.dbg.
10748 (two_file_shared.dbg): New target.
10749 * testsuite/Makefile.in: Rebuild.
10751 2009-03-01 Ian Lance Taylor <iant@google.com>
10753 * configure.ac: Check for byteswap.h.
10754 * configure: Rebuild.
10755 * config.in: Rebuild.
10757 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10759 * layout.cc (Layout::find_or_add_kept_section): New function.
10760 (Layout::add_comdat): Removed.
10761 * layout.h (struct Kept_section): Move out of class Layout.
10762 Remove trailing underscores from field names. Add group_sections
10763 field. Rename group_ field to is_group. Change all uses.
10764 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10765 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10766 comdat_groups_ field.
10767 (Sized_relobj::include_section_group): Use
10768 find_or_add_kept_section and Kept_section::group_sections.
10769 (Sized_relobj::include_linkonce_section): Likewise.
10770 * object.cc (class Sized_relobj): Don't define Comdat_group or
10771 Comdat_group_table. Remove find_comdat_group and
10772 add_comdat_group. Remove comdat_groups_ field.
10773 * plugin.cc (include_comdat_group): Use
10774 Layout::find_or_add_kept_section.
10776 2009-02-28 Ian Lance Taylor <iant@google.com>
10778 * README: --gc-sections and map files are now supported. Document
10779 some build requirements.
10782 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10783 relocatable link set the value of the section symbol to zero.
10784 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10785 relocatable link don't include the section address in the local
10788 2009-02-27 Ian Lance Taylor <iant@google.com>
10791 * options.h (class Search_directory): Add is_system_directory.
10792 (class General_options): Declare is_in_system_directory.
10793 * options.cc (get_relative_sysroot): Make static.
10794 (get_default_sysroot): Make static.
10795 (General_optoins::is_in_system_directory): New function.
10796 * fileread.cc (Input_file::is_in_system_directory): New function.
10797 * fileread.h (class Input_file): Declare is_in_system_directory.
10798 * object.h (class Object): Add is_in_system_directory.
10799 (class Input_objects): Remove system_library_directory_ field.
10800 * object.cc (Input_objects::add_object): Don't set
10801 system_library_directory_.
10802 (input_objects::found_in_system_library_directory): Remove.
10803 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10804 parameter. Change all callers.
10805 (Symbol_table::sized_write_globals): Likewise.
10806 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10807 Call Object::is_in_system_directory.
10808 * symtab.h (class Symbol_table): Update declarations.
10811 * descriptors.h (Open_descriptor): Add is_on_stack field.
10812 * descriptors.cc (Descriptors::open): If the descriptor is on the
10813 top of the stack, remove it. Initialize is_on_stack field.
10814 (Descriptors::release): Only add pod to stack if it is not on the
10816 (Descriptors::close_some_descriptor): Clear stack_next and
10817 is_on_stack fields.
10820 * output.cc (Output_section::find_starting_output_address): Rename
10821 from starting_output_address; add PADDR parameter; change return
10823 * output.h (class Output_section): Declare
10824 find_starting_output_address instead of starting_output_address.
10825 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10826 section symbol for which we can't find a merge section.
10829 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10830 hidden or internal, force the symbol to be local.
10831 * resolve.cc (Symbol::override_visibility): Define.
10832 (Symbol::override_base): Use override_visibility.
10833 (Symbol_table::resolve): Likewise.
10834 (Symbol::override_base_with_special): Likewise.
10835 (Symbol_table::override_with_special): If the visibility is hidden
10836 or internal, force the symbol to be local.
10837 * symtab.h (class Symbol): Add set_visibility and
10838 override_visibility.
10839 * testsuite/ver_test_1.sh: New file.
10840 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10841 (check_DATA): Add ver_test_1.syms.
10842 (ver_test_1.syms): New target.
10843 * testsuite/Makefile.in: Rebuild.
10845 2009-02-25 Cary Coutant <ccoutant@google.com>
10847 * layout.cc (Layout::choose_output_section): Don't rename sections
10848 when using a linker script that has a SECTIONS clause.
10849 * Makefile.in: Regenerate.
10851 * testsuite/Makefile.am (script_test_5.sh): New test case.
10852 * testsuite/Makefile.in: Regenerate.
10853 * testsuite/script_test_5.cc: New file.
10854 * testsuite/script_test_5.sh: New file.
10855 * testsuite/script_test_5.t: New file.
10857 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10859 * archive.cc (Archive::include_member): Update calls to add_symbols.
10860 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10861 the Layout argument.
10862 * dynobj.h (do_add_symbols): Add the Layout argument.
10863 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10865 * object.h (Object::add_symbols): Add the Layout argument.
10866 (Object::do_add_symbols): Add the Layout argument.
10867 (Sized_relobj::do_add_symbols): Add the Layout argument.
10868 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10869 Unify the two versions.
10870 (Add_plugin_symbols): Remove.
10871 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10872 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10873 (Add_plugin_symbols): Remove.
10874 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10875 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10876 (Add_symbols::run): Make it work with Pulginobj.
10878 2009-02-06 Ian Lance Taylor <iant@google.com>
10880 * object.cc (Sized_relobj::do_layout): Make info message start
10881 with lower case letter.
10883 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10885 * binary.cc: Fix file comment.
10887 * options.h (enum Incremental_disposition): Define.
10888 (class General_options): Add new options: --incremental,
10889 --incremental_changed, --incremental_unchanged,
10890 --incremental_unknown. Add incremental_disposition_ and
10891 implicit_incremental_ fields.
10892 (General_options::incremental_disposition): New function.
10893 (class Position_dependent_options): Add incremental_disposition
10895 (Position_dependent_options::copy_from_options): Set incremental
10897 * options.cc (General_options::parse_incremental_changed): New
10899 (General_options::parse_incremental_unchanged): New function.
10900 (General_options::parse_incremental_unknown): New function.
10901 (General_options::General_options): Initialize new fields
10902 incremental_disposition_ and implicit_incremental_.
10903 (General_options::finalize): Check for uasge of --incremental-*
10904 without --incremental.
10906 2009-02-06 Chris Demetriou <cgd@google.com>
10908 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10909 pointer and to report location as the file name associated with
10911 (gold_undefined_symbol_at_location): New function to replace the
10912 old gold_undefined_symbol functionality.
10913 * target-reloc.h (relocate_section): Update to use
10914 gold_undefined_symbol_at_location.
10915 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10916 Call gold_undefined_symbol function rather than gold_error.
10917 * errors.h (Errors::undefined_symbol): Take location as a
10918 string, rather than calculating it from a relocation.
10919 * errors.cc (Errors::fatal): Print "fatal error:" before the
10921 (Errors::error, Errors::error_at_location): Print "error: "
10922 before the formatted message.
10923 (Errors::undefined_symbol): Take location as a string, rather
10924 than calculating it from a relocation.
10925 (gold_undefined_symbol_at_location): New function akin to
10926 old gold_undefined_symbol, calculates location from relocation.
10927 (gold_undefined_symbol): Change to take only a Symbol pointer
10928 and to report location as the file name associated with the symbol.
10929 * testsuite/debug_msg.sh: Update for changed error messages.
10930 * testsuite/undef_symbol.sh: Likewise.
10932 2009-02-04 Duncan Sands <baldrick@free.fr>
10935 * reduced_debug_output.h
10936 (Output_reduced_debug_abbrev_section::failed): Use format for
10938 (Output_reduced_debug_info_section::faild): Likewise.
10940 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10942 * script.cc (Lazy_demangler): New class.
10943 (Version_script_info::get_symbol_version_helper): Demangle a
10946 2009-01-29 Cary Coutant <ccoutant@google.com>
10948 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10950 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10952 2009-01-28 Ian Lance Taylor <iant@google.com>
10954 * version.cc (version_string): Bump to 1.9.
10956 * gold.h: Include <cstring> and <stdint.h>.
10957 * version.cc: Include <cstdio>.
10958 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10960 * reduced_debug_output.cc (insert_into_vector): Rename from
10961 Insert_into_vector; change all callers. Use Swap_unaligned to
10962 avoid aliasing issue; remove union since it is unnecessary.
10964 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10966 * Makefile.am (CCFILES): Add gc.cc.
10967 (HFILES): Add gc.h.
10968 * Makefile.in: Regenerate.
10969 * gold.cc (Gc_runner): New class.
10970 (queue_initial_tasks): Call garbage collection related tasks
10971 when corresponding options are invoked.
10972 (queue_middle_gc_tasks): New function.
10973 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10974 processed early before laying out sections during garbage collection.
10975 * gold.h (queue_middle_gc_tasks): New function.
10976 (is_prefix_of): Move from "layout.cc".
10977 * i386.cc (Target_i386::gc_process_relocs): New function.
10978 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10979 * main.cc (main): Create object of class "Garbage_collection".
10980 * object.cc (Relobj::copy_symbols_data): New function.
10981 (Relobj::is_section_name_included): New function.
10982 (Sized_relobj::do_layout): Allow this function to be called twice
10983 during garbage collection and defer layout of section during the
10985 * object.h (Relobj::get_symbols_data): New function.
10986 (Relobj::is_section_name_included): New function.
10987 (Relobj::copy_symbols_data): New function.
10988 (Relobj::set_symbols_data): New function.
10989 (Relobj::get_relocs_data): New function.
10990 (Relobj::set_relocs_data): New function.
10991 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10992 (Relobj::gc_process_relocs): New function.
10993 (Relobj::do_gc_process_relocs): New pure virtual function.
10994 (Relobj::sd_): New data member.
10995 (Sized_relobj::is_output_section_offset_invalid): New function.
10996 (Sized_relobj::do_gc_process_relocs): New function.
10997 * options.h (General_options::gc_sections): Modify to not be a no-op.
10998 (General_options::print_gc_sections): New option.
10999 * plugin.cc (Plugin_finish::run): Remove function call to
11000 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11001 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11002 * reloc.cc (Read_relocs::run): Add task to process relocs and
11003 determine unreferenced sections when doing garbage collection.
11004 (Gc_process_relocs): New class.
11005 (Sized_relobj::do_gc_process_relocs): New function.
11006 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11007 sections that are garbage collected.
11008 * reloc.h (Gc_process_relocs): New class.
11009 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11010 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11011 symbols whose corresponding sections are garbage collected.
11012 (Symbol_table::Symbol_table): Add new parameter for the garbage
11014 (Symbol_table::gc_mark_undef_symbols): New function.
11015 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11016 (Symbol_table::gc_mark_dyn_syms): New function.
11017 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11019 (Symbol_table::add_from_object): Likewise.
11020 (Symbol_table::add_from_relobj): When building shared objects, do not
11021 treat externally visible symbols as garbage.
11022 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11023 table information for static and relocatable links.
11024 * symtab.h (Symbol_table::set_gc): New function.
11025 (Symbol_table::gc): New function.
11026 (Symbol_table::gc_mark_undef_symbols): New function.
11027 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11028 (Symbol_table::gc_mark_dyn_syms): New function.
11029 (Symbol_table::gc_): New data member.
11030 * target.h (Sized_target::gc_process_relocs): New pure virtual
11032 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11033 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11035 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11037 * options.h (General_options::gc_sections): Define as a no-op for now.
11038 (General_options::no_keep_memory): Ditto.
11039 (General_options::Bshareable): Define.
11040 * options.cc (General_options::finalize): Honor -Bshareable.
11042 2009-01-20 Andreas Schwab <schwab@suse.de>
11044 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11045 read the value in the contents, since we don't use it. Use the
11046 template endianness when writing.
11047 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11049 2009-01-19 Andreas Schwab <schwab@suse.de>
11051 * configure.tgt (powerpc64-*): Fix targ_obj.
11053 2009-01-15 Ian Lance Taylor <iant@google.com>
11055 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11056 local symbols when stripping all symbols.
11058 2009-01-14 Cary Coutant <ccoutant@google.com>
11060 * output.cc (Output_reloc): Add explicit instantiations.
11062 2009-01-14 Cary Coutant <ccoutant@google.com>
11064 * archive.cc (Archive::get_elf_object_for_member): Remove call
11065 to File_read::claim_for_plugin.
11066 * descriptors.cc (Descriptors::open): Remove reference to
11068 (Descriptors::claim_for_plugin): Remove.
11069 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11070 (Descriptors::is_claimed): Remove.
11071 (claim_descriptor_for_plugin): Remove.
11072 * fileread.cc (File_read::claim_for_plugin): Remove.
11073 * fileread.h (File_read::claim_for_plugin): Remove.
11074 (File_read::descriptor): Reopen descriptor if necessary.
11075 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11076 (Plugin_manager::all_symbols_read): Add task parameter. Change
11078 (Plugin_manager::get_input_file): New function.
11079 (Plugin_manager::release_input_file): New function.
11080 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11081 corresponding data member.
11082 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11083 and pass to base constructor. Change all callers.
11084 (get_input_file, release_input_file): New functions.
11085 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11086 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11087 (Plugin_manager::all_symbols_read): Add task parameter.
11088 (Plugin_manager::get_input_file): New function.
11089 (Plugin_manager::release_input_file): New function.
11090 (Plugin_manager::task_): New data member.
11091 (Pluginobj::Pluginobj): Add filesize parameter.
11092 (Pluginobj::filename): New function.
11093 (Pluginobj::descriptor): New function.
11094 (Pluginobj::filesize): New function.
11095 (Pluginobj::filesize_): New data member.
11096 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11097 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11098 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11100 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11101 with archive libraries.
11102 * testsuite/Makefile.in: Regenerate.
11103 * testsuite/plugin_test.c (struct sym_info): New type.
11104 (get_input_file, release_input_file): New static variables.
11105 (onload): Capture new transfer vector entries.
11106 (claim_file_hook): Stop reading at end of file according to filesize.
11107 Factor out parsing of readelf output into separate function.
11108 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11109 APIs and get the source file name from the symbol table. Convert
11110 source file name to corresponding object file name. Print info
11111 message when adding new input files.
11112 (parse_readelf_line): New function.
11113 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11114 * testsuite/plugin_test_2.sh: Likewise.
11115 * testsuite/plugin_test_3.sh: Likewise.
11116 * testsuite/plugin_test_4.sh: New test case.
11118 2009-01-07 Ian Lance Taylor <iant@google.com>
11120 * version.cc (version_string): Bump to 1.8.
11122 2008-12-23 Cary Coutant <ccoutant@google.com>
11124 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11125 * plugin.cc (Plugin_manager::finish): Rename as
11126 layout_deferred_objects. Move cleanup to separate function.
11127 (Plugin_manager::cleanup): New function.
11128 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11130 * plugin.h (Plugin_manager::finish): Rename as
11131 layout_deferred_objects.
11132 (Plugin_manager::cleanup): New function.
11133 (Plugin_manager::cleanup_done): New field.
11135 2008-12-23 Cary Coutant <ccoutant@google.com>
11137 * plugin.cc (is_visible_from_outside): New function.
11138 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11139 so we don't return "IR only" status for exported symbols or -r links.
11141 * testsuite/Makefile.am (plugin_test_3): New test case.
11142 * testsuite/Makefile.in: Regenerate.
11143 * testsuite/plugin_test_3.sh: New file.
11145 2008-12-22 Cary Coutant <ccoutant@google.com>
11147 * object.cc (Sized_relobj::layout_section): New function.
11148 (Sized_relobj::do_layout): Defer layout of input sections until after
11149 plugin has provided replacement files.
11150 (Sized_relobj::do_layout_deferred_sections): New function.
11151 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11152 (Relobj::layout_deferred_sections): New function.
11153 (Relobj::do_layout_deferred_sections): New function.
11154 (Sized_relobj::do_layout_deferred_sections): New function.
11155 (Sized_relobj::layout_section): New function.
11156 (Sized_relobj::Deferred_layout): New structure.
11157 (Sized_relobj::deferred_layout_): New field.
11158 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11159 Change all callers. Layout deferred sections.
11160 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11162 (Plugin_hook::run): Move code from do_plugin_hook inline.
11163 (Plugin_hook::do_plugin_hook): Remove.
11164 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11165 (Plugin_manager::finish): Renamed, was cleanup.
11166 (Plugin_manager::should_defer_layout): New function.
11167 (Plugin_manager::add_deferred_layout_object): New function.
11168 (Plugin_manager::Deferred_layout_list): New type.
11169 (Plugin_manager::deferred_layout_objects_): New field.
11170 (Plugin_hook::do_plugin_hook): Remove.
11172 2008-12-17 Ian Lance Taylor <iant@google.com>
11174 * options.h (class General_options): Add --no case for
11177 2008-12-16 Cary Coutant <ccoutant@google.com>
11179 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11181 (Plugin_manager::claim_file): Create plugin object even if
11182 plugin did not call the add_symbols callback.
11183 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11184 asking for more symbols than were added.
11185 * testsuite/Makefile.am (plugin_test_1): Add test case with
11187 (empty.syms): New target.
11188 * testsuite/Makefile.in: Regenerate.
11189 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11190 message. Don't call add_symbols if no globals.
11191 (all_symbols_read_hook): Don't provide replacement for empty
11194 2008-12-12 Ian Lance Taylor <iant@google.com>
11196 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11197 r_type == 0 for a local symbol with r_sym == 0.
11198 (scan_relocatable_relocs): Pass r_sym to
11199 local_non_section_strategy.
11200 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11203 * configure.ac: Update test for TLS descriptors: they are
11204 supported as of glibc 2.9.
11205 * configure: Rebuild.
11207 2008-12-11 Ian Lance Taylor <iant@google.com>
11210 * target-reloc.h (Default_scan_relocatable_relocs): For each
11211 function, map r_type == 0 to RELOC_DISCARD.
11213 2008-12-10 Cary Coutant <ccoutant@google.com>
11215 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11216 object to override a kept COMDAT group from a plugin object.
11218 2008-12-09 Ian Lance Taylor <iant@google.com>
11221 * yyscript.y (file_cmd): Handle INPUT.
11223 * testsuite/initpri1.c: Change all declarations to be full
11224 prototypes by adding void, to avoid compiler warnings.
11226 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11228 * options.cc (General_options::parse_plugin_opt): New.
11229 (General_options::add_plugin): The argument now is just the filename.
11230 (General_options::add_plugin_option): New.
11231 * options.h (plugin_opt): New.
11232 (add_plugin): Change argument name.
11233 (add_plugin_option): New.
11234 * plugin.cc (Plugin::load): Don't parse the plugin option.
11235 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11236 (Plugin::add_option): New.
11237 (Plugin::args_): Change type.
11238 (Plugin::filename_): New.
11239 (Plugin_manager::add_plugin_option): New.
11240 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11241 * testsuite/Makefile.in: Regenerate.
11243 2008-12-05 Cary Coutant <ccoutant@google.com>
11245 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11246 Handle --strip-lto-sections option.
11247 * options.h (strip_lto_sections): New option.
11249 2008-12-01 Cary Coutant <ccoutant@google.com>
11251 * plugin.cc (ld_plugin_message): Change format parameter to const.
11252 Fix mismatch between new[] and delete.
11254 2008-11-14 Cary Coutant <ccoutant@google.com>
11256 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11259 2008-11-05 Craig Silverstein <csilvers@google.com>
11261 * options.cc (General_options::parse_dynamic_list): New function.
11262 * options.h (General_options): New flags dynamic_list,
11263 dynamic_list_data, dynamic_list_cpp_new, and
11264 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11265 (General_options::in_dynamic_list): New function.
11266 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11267 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11268 (Lex::can_continue_name): Likewise.
11270 (read_script_file): New parameter script_options.
11271 (read_dynamic_list): New function.
11272 (Script_options::define_dynamic_list): New function.
11273 (dynamic_list_keyword_parsecodes): New variable.
11274 (dynamic_list_keywords): New variable.
11275 * script.h (Script_options::define_dynamic_list): New function
11277 (read_dynamic_list): New function prototype.
11278 * symtab.cc (strprefix): New macro.
11279 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11280 dynamic_list_data, dynamic_list_cpp_new, and
11281 dynamic_list_cpp_typeinfo.
11282 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11283 (dynamic_list_expr): New rule.
11284 (dynamic_list_nodes): Likewise.
11285 (dynamic_list_node): Likewise.
11286 * testsuite/Makefile.am (dynamic_list): New test.
11287 * testsuite/Makefile.in: Regenerated.
11288 * testsuite/dynamic_list.t: New file.
11289 * testsuite/dynamic_list.sh: New file.
11291 2008-11-05 Craig Silverstein <csilvers@google.com>
11293 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11294 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11295 (t11_last): Likewise.
11296 * testsuite/ver_test_6.c (main): Likewise.
11298 2008-10-07 Cary Coutant <ccoutant@google.com>
11300 * options.c (General_options::finalize): Add check for -static and
11302 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11305 2008-10-02 Cary Coutant <ccoutant@google.com>
11307 * plugin.cc (make_sized_plugin_object): Fix conditional
11308 compilation to work when not all targets are enabled.
11310 2008-09-29 Cary Coutant <ccoutant@google.com>
11312 * archive.cc (Archive::get_file_and_offset): Use filename instead
11313 of name to get library path.
11314 (Archive::include_member): Unlock external member of a thin archive.
11316 * testsuite/Makefile.am (TEST_AR): New variable.
11317 (thin_archive_test_1): New test.
11318 (thin_archive_test_2): New test.
11319 * testsuite/Makefile.in: Regenerate.
11320 * testsuite/thin_archive_main.cc: New file.
11321 * testsuite/thin_archive_test_1.cc: New file.
11322 * testsuite/thin_archive_test_2.cc: New file.
11323 * testsuite/thin_archive_test_3.cc: New file.
11324 * testsuite/thin_archive_test_4.cc: New file.
11326 2008-09-29 Cary Coutant <ccoutant@google.com>
11328 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11329 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11331 (Sized_relobj::do_finalize_local_symbols): Likewise.
11332 (Sized_relobj::map_to_kept_section): Likewise.
11333 * object.h (Sized_relobj::invalid_address): New constant.
11334 (Sized_relobj::do_output_section_offset): Check for invalid_address
11336 * output.cc (Output_reloc::local_section_offset): Use constant
11337 invalid_address instead of -1U.
11338 (Output_reloc::get_address): Likewise.
11339 (Output_section::output_address): Change -1U to -1ULL.
11340 * output.h (Output_reloc::invalid_address): New constant.
11341 * reloc.cc (Sized_relobj::write_sections): Use constant
11342 invalid_address instead of -1U.
11343 (Sized_relobj::relocate_sections): Likewise.
11344 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11345 values for merge sections.
11346 * target-reloc.h (relocate_for_relocatable): Use constant
11347 invalid_address instead of -1U.
11349 2008-09-19 Cary Coutant <ccoutant@google.com>
11351 Add plugin functionality for link-time optimization (LTO).
11352 * configure.ac (plugins): Add --enable-plugins option.
11353 * configure: Regenerate.
11354 * config.in: Regenerate.
11355 * Makefile.am (LIBDL): New variable.
11356 (CCFILES): Add plugin.cc.
11357 (HFILES): Add plugin.h.
11358 (ldadd_var): Add LIBDL.
11359 * Makefile.in: Regenerate.
11361 * archive.cc: Include "plugin.h".
11362 (Archive::setup): Don't preread archive symbols when using a plugin.
11363 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11364 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11366 (Archive::include_member): Add symbols from plugin objects.
11367 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11368 * descriptors.cc (Descriptors::open): Check for file descriptors
11369 abandoned by plugins.
11370 (Descriptors::claim_for_plugin): New function.
11371 * descriptors.h (Descriptors::claim_for_plugin): New function.
11372 (Open_descriptor::is_claimed): New field.
11373 (claim_descriptor_for_plugin): New function.
11374 * fileread.cc (File_read::claim_for_plugin): New function.
11375 * fileread.h (File_read::claim_for_plugin): New function.
11376 (File_read::descriptor): New function.
11377 * gold.cc: Include "plugin.h".
11378 (queue_initial_tasks): Add task to call plugin hooks for generating
11380 * main.cc: Include "plugin.h".
11381 (main): Load plugin libraries.
11382 * object.h (Pluginobj): Declare.
11383 (Object::pluginobj): New function.
11384 (Object::do_pluginobj): New function.
11385 (Object::set_target): New function.
11386 * options.cc: Include "plugin.h".
11387 (General_options::parse_plugin): New function.
11388 (General_options::General_options): Initialize plugins_ field.
11389 (General_options::add_plugin): New function.
11390 * options.h (Plugin_manager): Declare.
11391 (General_options): Add --plugin option.
11392 (General_options::has_plugins): New function.
11393 (General_options::plugins): New function.
11394 (General_options::add_plugin): New function.
11395 (General_options::plugins_): New field.
11396 * plugin.cc: New file.
11397 * plugin.h: New file.
11398 * readsyms.cc: Include "plugin.h".
11399 (Read_symbols::do_read_symbols): Check for archive before checking
11400 for ELF file. Call plugin hooks to claim files.
11401 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11402 from a real object file; force override when processing replacement
11404 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11405 (Symbol::init_base_object): Likewise.
11406 (Symbol::init_base_output_data): Likewise.
11407 (Symbol::init_base_output_segment): Likewise.
11408 (Symbol::init_base_constant): Likewise.
11409 (Symbol::init_base_undefined): Likewise.
11410 (Symbol::output_section): Assert that object is not a plugin.
11411 (Symbol_table::add_from_pluginobj): New function.
11412 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11414 (Symbol_table::sized_write_globals): Likewise.
11415 (Symbol_table::add_from_pluginobj): Instantiate template.
11416 * symtab.h (Sized_pluginobj): Declare.
11417 (Symbol::in_real_elf): New function.
11418 (Symbol::set_in_real_elf): New function.
11419 (Symbol::in_real_elf_): New field.
11420 (Symbol_table::add_from_pluginobj): New function.
11422 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11423 (LIBDL): New variable.
11424 (LDADD): Add LIBDL.
11425 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11426 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11427 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11428 (MOSTLYCLEANFILES): Likewise.
11429 * testsuite/Makefile.in: Regenerate.
11430 * testsuite/plugin_test.c: New file.
11431 * testsuite/plugin_test_1.sh: New file.
11432 * testsuite/plugin_test_2.sh: New file.
11434 2008-09-16 Ian Lance Taylor <iant@google.com>
11436 * target-reloc.h (relocate_section): Check whether a symbol is
11437 defined by the ABI before reporting an undefined symbol error.
11438 * target.h (Target::is_defined_by_abi): Make parameter const.
11439 (Target::do_is_defined_by_abi): Likewise.
11440 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11441 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11442 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11443 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11444 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11445 * testsuite/Makefile.in: Rebuild.
11447 * fileread.cc (make_view): Add casts to avoid warning.
11449 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11451 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11452 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11454 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11456 * options.h (General_options::output_is_executable): New.
11457 (General_options::output_is_pie): New.
11458 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11459 for shared libraries.
11460 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11462 2008-09-11 Chris Demetriou <cgd@google.com>
11464 * options.h (origin): New -z option.
11465 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11466 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11469 2008-09-05 Cary Coutant <ccoutant@google.com>
11471 * fileread.cc (File_read::make_view): Add check for attempt to map
11472 beyond end of file.
11474 2008-09-05 Cary Coutant <ccoutant@google.com>
11476 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11477 explicit instantiations.
11479 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11482 * options.cc (General_options::finalize): Allow undefined symbols
11483 in shlibs if linking -shared.
11486 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11487 symbols as not needing a dynsym entry.
11489 2008-08-20 Craig Silverstein <csilvers@google.com>
11491 * fileread.cc (File_read::open): Do not lock the file unless it
11492 was successfully opened.
11494 2008-08-14 Cary Coutant <ccoutant@google.com>
11496 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11497 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11498 * testsuite/tls_test.cc (struct int128): 128-bit struct
11499 for testing TLS relocs with non-zero addend.
11500 (v12): New TLS variable.
11502 (t_last): Add check for v12.
11503 * testsuite/tls_test.h (t12): New function.
11504 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11506 2008-08-13 Ian Lance Taylor <iant@google.com>
11508 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11509 set tls_segment_ or relro_segment_.
11510 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11512 * output.h (Output_section::clear_is_relro): New function.
11513 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11514 sections specially even when output_data_ is empty.
11515 (Output_segment::maximum_alignment): When first section is relro,
11516 only force alignment for PT_LOAD segments.
11517 * script.cc (script_data_segment_align): New function.
11518 (script_data_segment_relro_end): New function.
11519 * script-c.h (script_data_segment_align): Declare.
11520 (script_data_segment_relro_end): Declare.
11521 * script-sections.h (class Script_sections): Declare
11522 data_segment_align and data_segment_relro_end. Add fields
11523 segment_align_index_ and saw_relro_end_.
11524 * script-sections.cc (class Sections_element): Add set_is_relro
11525 virtual function. Add new bool* parameter to place_orphan_here.
11526 Add get_output_section virtual function.
11527 (class Output_section_definition): Add set_is_relro. Add new
11528 bool* parameter to place_orphan_here. Add get_output_section.
11529 Add is_relro_ field.
11530 (Output_section_definition::Output_section_definition): Initialize
11531 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11532 and is_relro_ fields.
11533 (Output_section_definition::place_orphan_here): Add is_relro
11535 (Output_section_definition::set_section_addresses): Set relro for
11537 (Output_section_definition::alternate_constraint): Likewise.
11538 (class Orphan_output_section): Add new bool* parameter to
11539 place_orphan_here. Add get_output_section.
11540 (Orphan_output_section::place_orphan_here): Add is_relro
11542 (Script_sections::Script_sections): Initialize
11543 data_segment_align_index_ and saw_relro_end_.
11544 (Script_sections::data_segment_align): New function.
11545 (Script_sections::data_segment_relro_end): New function.
11546 (Script_sections::place_orphan): Set or clear is_relro.
11547 (Script_sections::set_section_addresses): Force alignment of first
11549 * yyscript.y (exp): Call script_data_segment_align and
11550 script_data_segment_relro_end.
11551 * testsuite/relro_script_test.t: New file.
11552 * testsuite/relro_test.cc (using_script): Declare.
11553 (t1, t2): Test using_script.
11554 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11555 (relro_script_test_SOURCES): Define.
11556 (relro_script_test_DEPENDENCIES): Define.
11557 (relro_script_test_LDFLAGS): Define.
11558 (relro_script_test_LDADD): Define.
11559 (relro_script_test.so): New target.
11560 * testsuite/Makefile.in: Rebuild.
11562 2008-08-06 Cary Coutant <ccoutant@google.com>
11564 * archive.cc (Archive::total_archives, Archive::total_members)
11565 (Archive::total_members_loaded): New variables.
11566 (Archive::setup): Add parameter. Add option to preread
11568 (Archive::read_armap): Add counter.
11569 (Archive::get_file_and_offset): New function.
11570 (Archive::get_elf_object_for_member): New function.
11571 (Archive::read_all_symbols): New function.
11572 (Archive::read_symbols): New function.
11573 (Archive::add_symbols): Add counters.
11574 (Archive::include_all_members): Use armap to find members if it's
11576 (Archive::include_member): Skip reading symbols if already read.
11577 Factored code into Archive::get_file_and_offset and
11578 Archive::get_elf_object_for_member. Changed call to
11579 Mapfile::report_include_archive_member.
11580 (Archive::print_stats): New function.
11581 * archive.h: Declare Object and Read_symbols_data classes.
11582 (Archive::Archive): Add initializers for new members.
11583 (Archive::setup): Add parameter.
11584 (Archive::print_stats): New function.
11585 (Archive::total_archives, Archive::total_members)
11586 (Archive::total_members_loaded): New variables.
11587 (Archive::get_file_and_offset): New function.
11588 (Archive::get_elf_object_for_member): New function.
11589 (Archive::read_all_symbols): New function.
11590 (Archive::read_symbols): New function.
11591 (Archive::Archive_member): New class.
11592 (Archive::members_): New member.
11593 (Archive::num_members_): New member.
11594 * main.cc: Include archive.h.
11595 (main): Call Archive::print_stats.
11596 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11597 archive parameter; member_name is now the fully-decorated name.
11598 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11599 * options.h: (General_options): Add --preread-archive-symbols option.
11600 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11603 2008-08-04 Ian Lance Taylor <iant@google.com>
11605 * symtab.h (Symbol::use_plt_offset): New function.
11606 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11607 * powerpc.cc (Relocate::relocate): Likewise.
11608 * sparc.cc (Relocate::relocate): Likewise.
11609 * x86_64.cc (Relocate::relocate): Likewise.
11610 * testsuite/weak_plt.sh: New test.
11611 * testsuite/weak_plt_main.cc: New test.
11612 * testsuite/weak_plt_shared.cc: New test.
11613 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11614 (check_PROGRAMS): Add weak_plt.
11615 (check_DATA): Add weak_plt_shared.so.
11616 (weak_plt_main_pic.o, weak_plt): New targets.
11617 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11618 * testsuite/Makefile.in: Rebuild.
11620 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11622 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11623 * testsuite/Makefile.in: Rebuild.
11625 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11627 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11628 * Makefile.in: Regenerate.
11629 * po/POTFILES.in: Regenerate.
11631 2008-07-29 Ian Lance Taylor <iant@google.com>
11633 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11634 symbols before other symbols.
11635 * testsuite/script_test_2.cc (test_addr): Declare.
11636 (test_addr_alias): Declare.
11637 (main): Check that test_addr and test_addr_alias have the right
11639 * testsuite/script_test_2.t: Define test_addr_alias and
11642 2008-07-24 Ian Lance Taylor <iant@google.com>
11645 * descriptors.cc: New file.
11646 * descriptors.h: New file.
11647 * gold-threads.h (class Hold_optional_lock): New class.
11648 * fileread.cc: Include "descriptors.h".
11649 (File_read::~File_read): Release descriptor rather than closing
11651 (File_read::open) [file]: Call open_descriptor rather than open.
11652 Set is_descriptor_opened_.
11653 (File_read::open) [memory]: Assert that descriptor is not open.
11654 (File_read::reopen_descriptor): New function.
11655 (File_read::release): Release descriptor.
11656 (File_read::do_read): Make non-const. Reopen descriptor.
11657 (File_read::read): Make non-const.
11658 (File_read::make_view): Reopen descriptor.
11659 (File_read::do_readv): Likewise.
11660 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11661 Update declarations.
11662 * layout.cc: Include "descriptors.h".
11663 (Layout::create_build_id): Use open_descriptor rather than open.
11664 * output.cc: Include "descriptors.h".
11665 (Output_file::open): Use open_descriptor rather than open.
11666 * archive.cc (Archive::const_iterator): Change Archive to be
11668 (Archive::begin, Archive::end): Make non-const.
11669 (Archive::count_members): Likewise.
11670 * archive.h (class Archive): Update declarations.
11671 * object.h (Object::read): Make non-const.
11672 * Makefile.am (CCFILES): Add descriptors.cc.
11673 (HFILES): Add descriptors.h.
11674 * Makefile.in: Rebuild.
11677 * gold.h: Always include <clocale>. Add Solaris workarounds
11678 following code in binutils/sysdep.h.
11681 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11682 this->eh_frame_hdr_ is NULL before using it.
11684 * dynobj.cc (Versions::Versions): Update comment.
11686 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11687 the base version name.
11689 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11690 array size plus one.
11691 (Stringpool_template::set_string_offsets): Subtract one from key
11692 before using it as an array index.
11693 (Stringpool_template::get_offset_with_length): Likewise.
11694 (Stringpool_template::write_to_buffer): Likewise.
11695 * stringpool.h (Stringpool_template::get_offset_from_key):
11698 2008-07-23 Ian Lance Taylor <iant@google.com>
11701 * object.h (Merged_symbol_value::value): Do our best to handle a
11705 * script.cc (Version_script_info::get_versions): Don't add empty
11706 version tag to return value.
11707 (Version_script_info::get_symbol_version_helper): Change return
11708 type to bool. Add pversion parameter. Change all callers.
11709 (script_register_vers_node): Don't require a non-NULL tag.
11710 * script.h (class Version_script_info): Update declarations.
11711 (Version_script_info::get_symbol_version): Change return type to
11712 bool. Add version parameter. Change all callers.
11713 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11714 handling. Handle an empty version from a version script.
11715 (Symbol_table::define_special_symbol): Likewise.
11716 * testsuite/ver_test_10.script: New file.
11717 * testsuite/ver_test_10.sh: New file.
11718 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11719 (check_DATA): Add ver_test_10.syms.
11720 (ver_test_10.syms, ver_test_10.so): New target.
11721 * testsuite/Makefile.in: Rebuild.
11723 2008-07-23 Simon Baldwin <simonb@google.com>
11725 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11726 to zero for undefined symbols from dynamic libraries.
11728 2008-07-23 Ian Lance Taylor <iant@google.com>
11730 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11731 Change all callers.
11732 * symtab.h (class Symbol_table): Update declaration.
11733 * testsuite/ver_test_9.cc: New file.
11734 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11735 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11736 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11737 (ver_test_9.so, ver_test_9.o): New targets.
11738 * testsuite/Makefile.in: Rebuild.
11740 2008-07-22 Ian Lance Taylor <iant@google.com>
11742 * options.h (class General_options): Define --check-sections.
11743 * layout.cc (Layout::set_segment_offsets): Handle
11746 * options.h (class General_options): Define -n/--nmagic and
11748 * options.cc (General_options::finalize): For -n/--nmagic or
11749 -N/--omagic, set -static.
11750 * layout.cc (Layout::attach_allocated_section_to_segment): If
11751 -N/--omagic, don't put read-only and read-write sections in
11752 different segments.
11753 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11754 finding a read-only segment.
11755 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11756 don't set the minimum segment alignment to the common page size,
11757 and don't set the file offset to the address modulo the page size.
11758 * script-sections.cc (Script_sections::create_segments): If
11759 -n/--omagic, don't put read-only and read-write sections in
11760 different segments.
11762 * cref.cc: New file.
11763 * cref.h: New file.
11764 * options.h (class General_options): Add --print-symbol-counts.
11765 * main.cc (main): Issue defined symbol report if requested.
11766 * archive.cc (Archive::interpret_header): Make into a const member
11768 (Archive::add_symbols): Call Input_objects::archive_start and
11770 (Archive::const_iterator): Define new class.
11771 (Archive::begin, Archive::end): New functions.
11772 (Archive::include_all_members): Rewrite to use iterator.
11773 (Archive::count_members): New function.
11774 * archive.h (class Archive): Update declarations.
11775 (Archive::filename): New function.
11776 * object.cc: Include "cref.h".
11777 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11778 (Sized_relobj::do_get_global_symbol_counts): New function.
11779 (Input_objects::add_object): Add object to cross-referencer.
11780 (Input_objects::archive_start): New function.
11781 (Input_objects::archive_stop): New function.
11782 (Input_objects::print_symbol_counts): New function.
11783 * object.h: Declare Cref and Archive.
11784 (Object::get_global_symbol_counts): New function.
11785 (Object::do_get_global_symbol_counts): New pure virtual function.
11786 (class Sized_relobj): Add defined_count_ field. Update
11788 (class Input_objects): Add cref_ field. Update constructor.
11789 Update declarations.
11790 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11792 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11794 (Sized_dynobj::do_get_global_symbol_counts): New function.
11795 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11796 defined_count_. Update declarations. Define Symbols typedef.
11797 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11798 parameter. Change all callers.
11799 (Symbol_table::add_from_dynobj): Add sympointers and defined
11800 parameters. Change all callers.
11801 * symtab.h (class Symbol_table): Update declarations.
11802 * Makefile.am (CCFILES): Add cref.cc.
11803 (HFILES): Add cref.h.
11804 * Makefile.in: Rebuild.
11806 2008-07-22 Simon Baldwin <simonb@google.com>
11808 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11809 to zero when writing undefined symbols.
11811 2008-07-22 Ian Lance Taylor <iant@google.com>
11813 * output.cc (Output_section::add_input_section): Don't try to
11814 merge empty merge sections.
11816 2008-07-21 Craig Silverstein <csilvers@google.com>
11818 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11819 Include symbol version in error message.
11821 2008-07-20 Chris Demetriou <cgd@google.com>
11823 * configure.ac (gold_cv_c_random_seed): New configured variable.
11824 (RANDOM_SEED_CFLAGS): New substituted variable.
11825 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11826 * configure: Rebuild.
11827 * Makefile.in: Likewise.
11828 * testsuite/Makefile.in: Likewise.
11830 2008-07-18 Ian Lance Taylor <iant@google.com>
11832 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11833 where we see NAME/NULL and NAME/VERSION as separate symbols.
11834 * testsuite/ver_test_main.cc (main): Call t4.
11835 (t4, t4_2a): Define.
11836 * testsuite/ver_test_2.cc (t4_2): Define.
11837 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11838 * testsuite/ver_test_4.cc (t4_2a): Define.
11839 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11840 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11842 2008-07-17 Ian Lance Taylor <iant@google.com>
11844 * dynobj.cc (Versions::add_def): If we give an error about a
11845 missing version, go ahead and create the version anyhow.
11847 2008-07-10 Ian Lance Taylor <iant@google.com>
11849 Handle output sections with more than 0x7fffffff bytes.
11850 * object.h (class Relobj): Change map_to_output_ to
11851 output_sections_, and just keep a section pointer. Change all
11852 uses. Move comdat group support to Sized_relobj.
11853 (Relobj::is_section_specially_mapped): Remove.
11854 (Relobj::output_section): Remove poff parameter. Change all
11856 (Relobj::output_section_offset): New function.
11857 (Relobj::set_section_offset): Rewrite.
11858 (Relobj::map_to_output): Remove.
11859 (Relobj::output_sections): New function.
11860 (Relobj::do_output_section_offset): New pure virtual function.
11861 (Relobj::do_set_section_offset): Likewise.
11862 (class Sized_relobj): Add section_offsets_ field. Add comdat
11863 group support from Relobj. Update declarations.
11864 (Sized_relobj::get_output_section_offset): New function.
11865 (Sized_relobj::do_output_section_offset): New function.
11866 (Sized_relobj::do_set_section_offset): New function.
11867 * object.cc (Relobj::output_section_address): Remove.
11868 (Sized_relobj::Sized_relobj): Initialize new fields.
11869 (Sized_relobj::include_section_group): Cast find_kept_object to
11871 (Sized_relobj::include_linkonce_section): Likewise.
11872 (Sized_relobj::do_layout): Use separate arrays for output section
11874 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11876 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11877 output_sections and section_offsets.
11878 (Sized_relobj::write_local_symbols): Likewise.
11879 (map_to_kept_section): Compute output address directly.
11880 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11881 output_sections and section_offsets.
11882 (Sized_relobj::write_sections): Likewise.
11883 (Sized_relobj::relocate_sections): Likewise.
11884 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11885 * output.h (class Output_reloc): Update declarations. Change
11886 u2_.relobj to Sized_relobj*.
11887 (class Output_data_reloc): Change add functions to use
11889 * output.cc (Output_reloc::Output_reloc): Change relobj to
11891 (Output_reloc::local_section_offset): Change return type to
11892 Elf_Addr. Use get_output_section_offset.
11893 (Output_reloc::get_address): Likewise.
11894 (Output_section::is_input_address_mapped): Don't call
11895 is_section_specially_mapped.
11896 (Output_section::output_offset): Likewise.
11897 (Output_section::output_address): Likewise.
11898 (Output_section::starting_output_address): Likewise.
11899 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11900 parameter to Sized_relobj*.
11901 (Copy_relocs::need_copy_reloc): Likewise.
11902 (Copy_relocs::save): Likewise.
11903 * copy-relocs.h (class Copy_relocs): Update declarations.
11904 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11905 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11906 * target-reloc.h (relocate_for_relocatable): Change
11907 offset_in_output_section type to Elf_Addr. Change code that uses
11909 * layout.cc (Layout::layout): Always set *off.
11910 * mapfile.cc (Mapfile::print_input_section): Use
11911 output_section_offset.
11912 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11914 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11915 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11916 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11918 2008-07-03 Ian Lance Taylor <iant@google.com>
11920 * layout.cc (Layout::include_section): Do not discard unrecognized
11921 SHT_STRTAB sections.
11923 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11925 * script.cc (Lex::can_continue_name): Make '?' allowable in
11926 version-script names.
11927 * testsuite/version_script.map: Change glob pattern to use '?'
11929 2008-06-30 Manish Singh <yosh@gimp.org>
11932 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11935 2008-06-30 Ian Lance Taylor <iant@google.com>
11939 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11940 versions]: Don't try to read the value in the contents, since we
11941 don't use it. Use the template endianness when writing.
11943 2008-06-25 Cary Coutant <ccoutant@google.com>
11945 * fileread.cc (File_read::make_view): Assert on zero-length view.
11946 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11947 symbol table when there are no symbols to read.
11949 2008-06-23 Craig Silverstein <csilvers@google.com>
11951 * version.cc (version_string): Bump to 1.7
11953 2008-06-18 Craig Silverstein <csilvers@google.com>
11955 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11956 constant 0xFFFF to type Valtype.
11957 (Powerpc_relocate_functions::rel16_ha): Likewise.
11959 2008-06-17 Ian Lance Taylor <iant@google.com>
11961 * output.h (Output_section::Input_section): Initialize p2align_ to
11962 zero for Output_section_data constructors.
11963 (Output_section::Input_section::addralign): If not an input
11964 section, return the alignment of the Output_section_data.
11965 * testsuite/copy_test.cc: New file.
11966 * testsuite/copy_test_1.cc: New file.
11967 * testsuite/copy_test_2.cc: New file.
11968 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11969 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11970 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11971 (copy_test_1_pic.o, copy_test_1.so): New targets.
11972 (copy_test_2_pic.o, copy_test_2.so): New targets.
11973 * testsuite/Makefile.in: Rebuild.
11975 * script-sections.cc (Script_sections::place_orphan): Initialize
11976 local variable exact.
11978 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11980 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11982 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11983 David S. Miller <davem@davemloft.net>
11985 * powerpc.cc: New file.
11986 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11987 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11988 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11989 * Makefile.in: Rebuild.
11991 2008-06-09 Ian Lance Taylor <iant@google.com>
11993 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11995 (throwing, orig_terminate): New static variables.
11996 (terminate_handler): New static function.
11997 (t2): Set terminate handler.
11999 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12002 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12005 2008-05-30 Cary Coutant <ccoutant@google.com>
12007 * archive.cc (Archive::include_all_members) Correct to step
12008 over symbol table and extended name table in thin archives.
12010 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12013 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12016 2008-05-28 Caleb Howe <cshowe@google.com>
12018 * reduced_debug_output.cc: New file.
12019 * reduced_debug_output.h: New file.
12020 * options.h (class General_options): Add --strip-debug-non-line.
12021 * options.cc (General_options::finalize): Add strip_debug_non_line
12022 to the strip heirarchy.
12023 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12025 * layout.cc: Include "reduced_debug_output.h".
12026 (Layout::Layout): Initialize new fields.
12027 (line_only_debug_sections): New static array.
12028 (is_lines_only_debug_sections): New static inline function.
12029 (Layout::include_section): Handle --strip-debug-non-line.
12030 (Layout::make_output_section): If --strip-debug-non-line, build
12031 new output sections for .debug_abbrev and .debug_info.
12032 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12033 gold. Warn about possible overflow.
12034 (read_signed_LEB_128): Likewise.
12035 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12036 (read_signed_LEB_128): Declare.
12037 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12038 (HFILES): Add reduced_debug_output.h.
12039 * Makefile.in: Rebuild.
12041 2008-05-21 Ian Lance Taylor <iant@google.com>
12043 * mapfile.cc: New file.
12044 * mapfile.h: New file.
12045 * options.h (class General_options): Add -M/--print-map and -Map.
12046 * options.cc (General_options::finalize): Make -M equivalent to
12048 * main.cc: Include <cstdio> and "mapfile.h".
12049 (main): Open mapfile if requested.
12050 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12051 constructor. Change caller.
12052 (queue_initial_tasks): Add mapfile parameter. Change caller.
12053 (queue_middle_tasks): Likewise.
12054 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12056 * archive.cc: Include "mapfile.h".
12057 (Archive::add_symbols): Add mapfile parameter. Change all
12058 callers. Pass mapfile, symbol, and reason to include_member.
12059 (Archive::include_all_members): Add mapfile parameter. Change all
12061 (Archive::include_member): Add mapfile, sym, and why parameters.
12062 Change all callers. Report inclusion to map file.
12063 * archive.h: Include "fileread.h".
12064 (class Archive): Update declarations.
12065 (Archive::file): New const method.
12066 (class Add_archive_symbols): Add mapfile_ field. Update
12067 constructor. Change all callers.
12068 * readsyms.h (class Read_symbols): Likewise.
12069 (class Finish_group): Likewise.
12070 (class Read_script): Likewise.
12071 * common.cc: Include "mapfile.h".
12072 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12074 (Symbol_table::do_allocate_commons): Likewise.
12075 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12076 symbol allocation to mapfile.
12077 * common.h (class Allocate_commons_task): Add mapfile_ field.
12078 Update constructor. Change all callers.
12079 * symtab.h (class Symbol_table): Update declarations.
12080 * layout.cc: Include "mapfile.h".
12081 (Layout_task_runner::run): Print information to mapfile.
12082 (Layout::create_gold_note): Change Output_data_fixed_space to
12083 Output_data_zero_fill.
12084 (Layout::create_build_id): Likewise.
12085 (Layout::print_to_mapfile): New function.
12086 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12087 constructor. Change caller.
12088 (class Layout): Declare print_to_mapfile.
12089 * output.cc (Output_section::Input_section::print_to_mapfile): New
12091 (Output_section::add_input_section): If producing a map, always
12092 add to input_sections_ list.
12093 (Output_section::do_print_to_mapfile): New function.
12094 (Output_segment::print_sections_to_mapfile): New function.
12095 (Output_segment::print_section_list_to_mapfile): New function.
12096 * output.h: Include "mapfile.h".
12097 (Output_data::print_to_mapfile): New function.
12098 (Output_data::do_print_to_mapfile): New virtual function.
12099 (Output_segment_headers::do_print_to_mapfile): New function.
12100 (Output_file_header::do_print_to_mapfile): New function.
12101 (Output_data_const::do_print_to_mapfile): New function.
12102 (class Output_data_const_buffer): Add map_name_ field. Update
12103 constructor. Change all callers. Add do_print_to_mapfile
12105 (class Output_data_fixed_space): Likewise.
12106 (class Output_data_space): Likewise.
12107 (class Output_data_zero_fill): New class.
12108 (Output_data_strtab::do_print_to_mapfile): New function.
12109 (Output_data_reloc_base::do_print_to_mapfile): New function.
12110 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12111 (Output_data_group::do_print_to_mapfile): New function.
12112 (Output_data_got::do_print_to_mapfile): New function.
12113 (Output_data_dynamic::do_print_to_mapfile): New function.
12114 (Output_symtab_xindex::do_print_to_mapfile): New function.
12115 (class Output_section): Declare do_print_to_mapflie. Declare
12116 print_to_mapfile in Input_section.
12117 (class Output_segment): Declare new functions.
12118 * object.h (Sized_relobj::symbol_count): New function.
12119 * script-sections.cc
12120 (Output_section_element_dot_assignment::set_section_addresses):
12121 Change Output_data_fixed_space to Output_data_zero_fill.
12122 (Output_data_expression::do_print_to_mapfile): New function.
12123 * script.cc (read_input_script): Add mapfile parameter. Change
12125 * script.h (read_input_script): Update declaration.
12126 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12127 (Eh_frame::do_print_to_mapfile): New function.
12128 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12129 (Output_merge_string::do_print_to_mapfile): New function.
12130 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12132 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12134 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12136 * Makefile.am (CCFILES): Add mapfile.cc.
12137 (HFILES): Add mapfile.h.
12138 * Makefile.in: Rebuild.
12140 2008-05-19 Ian Lance Taylor <iant@google.com>
12142 * options.h (class General_options): Add -z relro.
12143 * layout.cc (Layout::Layout): Initialize relro_segment_.
12144 (Layout::add_output_section_data): Return the output section.
12145 (Layout::make_output_section): Rcognize relro sections and mark
12146 them appropriately.
12147 (Layout::attach_allocated_section_to_segment): Put relro sections
12148 in a PT_GNU_RELRO segment.
12149 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12151 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12153 (Layout::linkonce_mapping): Map d.rel.ro.local to
12154 .data.rel.ro.local.
12155 (Layout::output_section_name): Us .data.rel.ro.local for any
12156 section which begins with that.
12157 * layout.h (class Layout): Update add_output_section_data
12158 declaration. Add relro_segment_ field.
12159 * output.cc (Output_section::Output_section): Initialize is_relro_
12160 and is_relro_local_ fields.
12161 (Output_segment::add_output_section): Group relro sections.
12162 (Output_segment::is_first_section_relro): New function.
12163 (Output_segment::maximum_alignment): If there is a relro section,
12164 align the segment to the common page size.
12165 (Output_segment::set_section_addresses): Track whether we are
12166 looking at relro sections. If the last section is a relro
12167 section, align to the common page size.
12168 (Output_segment::set_section_list_addresses): Add in_relro
12169 parameter. Change all callers. Align to the page size when
12170 moving from relro to non-relro section.
12171 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12173 * output.h (class Output_section): Add is_relro_ and
12174 is_relro_local_ fields.
12175 (Output_section::is_relro): New function.
12176 (Output_section::set_is_relro): New function.
12177 (Output_section::is_relro_local): New function.
12178 (Output_section::set_is_relro_local): New function.
12179 (class Output_segment): Update declarations.
12180 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12181 * sparc.cc (Target_sparc::got_section): Likewise.
12182 * x86_64.cc (Target_x86_64::got_section): Likewise.
12183 * testsuite/relro_test_main.cc: New file.
12184 * testsuite/relro_test.cc: New file.
12185 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12186 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12187 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12188 (relro_test.so, relro_test_pic.o): New targets.
12189 * testsuite/Makefile.in: Rebuild.
12191 2008-05-16 Ian Lance Taylor <iant@google.com>
12193 * output.cc (Output_segment::add_output_section): Remove front
12195 * output.h (class Output_segment): Remove
12196 add_initial_output_section and overloaded add_output_section.
12197 Update declaration of remaining add_output_section.
12198 * layout.cc (Layout::create_interp): Call add_output_section
12199 rather than add_initial_output_section.
12200 (Layout::finish_dynamic_section): Likewise.
12202 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12203 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12204 know the dynamic type.
12205 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12206 field. Initialize it in constructor.
12207 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12208 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12209 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12212 * output.cc (Output_reloc::get_address): Change return type to
12214 * output.h (class Output_reloc): Update get_address declaration.
12215 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12216 for section addresses.
12218 2008-05-09 Ian Lance Taylor <iant@google.com>
12221 * gold.cc (gold_nomem): Use return value of write.
12223 2008-05-08 Ian Lance Taylor <iant@google.com>
12225 * symtab.c (Symbol::init_base_output_data): Add version
12226 parameter. Change all callers.
12227 (Symbol::init_base_output_segment): Likewise.
12228 (Symbol::init_base_constant): Likewise.
12229 (Symbol::init_base_undefined): Likewise.
12230 (Sized_symbol::init_output_data): Likewise.
12231 (Sized_symbol::init_output_segment): Likewise.
12232 (Sized_symbol::init_constant): Likewise.
12233 (Sized_symbol::init_undefined): Likewise.
12234 (Symbol_table::do_define_in_output_data): If the new symbol has a
12235 version, mark it as the default.
12236 (Symbol_table::do_define_in_output_segment): Likewise.
12237 (Symbol_table::do_define_as_constant): Likewise.
12238 * symtab.h (class Symbol): Update declarations.
12239 (class Sized_symbol): Likewise.
12240 * resolve.cc (Symbol::override_version): New function.
12241 (Symbol::override_base): Call override_version.
12242 (Symbol::override_base_with_special): Likewise.
12243 * testsuite/ver_script_8.script: New file.
12244 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12245 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12246 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12247 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12249 2008-05-06 Ian Lance Taylor <iant@google.com>
12252 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12254 (class General_options): Remove existing --undefined, and add
12255 --no-undefined instead. Add new --undefined as synonym for -u.
12256 * archive.cc (Archive::add_symbols): Check whether symbol was
12258 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12259 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12260 all uses. Add IS_UNDEFINED. Update declarations to split
12261 different versions of init_base. Declare init_base_undefined.
12262 (Symbol::is_defined): Handle IS_UNDEFINED.
12263 (Symbol::is_undefined): Likewise.
12264 (Symbol::is_weak_undefined): Call is_undefined.
12265 (Symbol::is_absolute): Handle IS_CONSTANT.
12266 (class Sized_symbol): Update declarations to split different
12267 versions of init. Declare init_undefined.
12268 (class Symbol_table): Declare new functions.
12269 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12270 Change all callers.
12271 (Symbol::init_base_output_data): Likewise.
12272 (Symbol::init_base_output_segment): Likewise.
12273 (Symbol::init_base_constant): Likewise.
12274 (Symbol::init_base_undefined): New function.
12275 (Sized_symbol::init_object): Rename from init. Change all
12277 (Sized_symbol::init_output_data): Likewise.
12278 (Sized_symbol::init_output_segment): Likewise.
12279 (Sized_symbol::init_constant): Likewise.
12280 (Sized_symbol::init_undefined): New function.
12281 (Symbol_table::add_undefined_symbols_from_command_line): New
12283 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12285 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12286 (Symbol::output_section): Likewise.
12287 (Symbol::set_output_section): Likewise.
12288 (Symbol_table::sized_finalize_symbol): Likewise.
12289 (Symbol_table::sized_write_globals): Likewise.
12290 * resolve.cc (Symbol_table::should_override): Likewise.
12291 (Symbol::override_base_with_special): Likewise.
12293 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12294 symbol, change it to have default visibility.
12295 * testsuite/protected_1.cc: New file.
12296 * testsuite/protected_2.cc: New file.
12297 * testsuite/protected_3.cc: New file.
12298 * testsuite/protected_main_1.cc: New file.
12299 * testsuite/protected_main_2.cc: New file.
12300 * testsuite/protected_main_3.cc: New file.
12301 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12302 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12303 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12304 (protected_1.so): New target.
12305 (protected_1_pic.o, protected_2_pic.o): New targets.
12306 (protected_3_pic.o): New target.
12307 (check_PROGRAMS): Add protected_2.
12308 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12309 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12310 * testsuite/Makefile.in: Rebuild.
12312 * options.h (DEFINE_var): Add set_user_set_##varname__.
12313 (DEFINE_bool_alias): New macro.
12314 (class General_options): Define -Bstatic using DEFINE_bool_alias
12315 rather than DEFINE_special. Add --undefined as an alias for -z
12317 * options.cc (General_options::parse_Bstatic): Remove.
12319 * options.h (class General_options): Add --fatal-warnings.
12320 * main.cc (main): Implement --fatal-warnings.
12321 * errors.h (Errors::warning_count): New function.
12323 * options.h (class General_options): Add -Bsymbolic-functions.
12324 * symtab.h (Symbol::is_preemptible): Check for
12325 -Bsymbolic-functions.
12327 2008-05-05 Ian Lance Taylor <iant@google.com>
12329 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12330 as noVARNAME rather than no-VARNAME.
12331 (class General_options): Add option -z combreloc.
12332 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12334 (Output_reloc::sort_before) [SHT_REL]: New function.
12335 (Output_reloc::sort_before) [SHT_RELA]: New function.
12336 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12337 Sort_relocs_comparison.
12338 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12339 parameter. Change all callers.
12340 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12341 sort_relocs parameter. Change all callers.
12342 * output.cc (Output_reloc::get_address): New function, broken out
12344 (Output_reloc::write_rel): Call it.
12345 (Output_reloc::compare): New function.
12346 (Output_data_reloc_base::do_write): Optionally sort relocs.
12348 * configure.ac: If targ_extra_obj is set, link it in.
12349 * configure.tgt: Initialize all variables.
12350 (x86_64*): Set targ_extra_obj and targ_extra_size.
12351 * configure: Rebuild.
12353 * object.cc (Sized_relobj::include_section_group): Adjust section
12354 indexes read from group data. Build vector to pass to
12356 * layout.cc (Layout::layout_group): Add flags and shndxes
12357 parameters. Remove contents parameter. Change caller. Update
12358 explicit instantiations.
12359 * layout.h (class Layout): Update layout_group declaration.
12360 * output.cc (Output_data_group::Output_data_group): Add flags and
12361 input_shndxes parameters. Remove contents parameter. Change
12363 (Output_data_group::do_write): Change input_sections_ to
12365 * output.h (class Output_data_group): Update constructor
12366 declaration. Rename input_sections_ to input_shndxes_.
12367 * testsuite/many_sections_test.cc: Add template.
12369 2008-04-30 Cary Coutant <ccoutant@google.com>
12371 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12373 * layout.cc (Layout::include_section): Refactored check for debug
12375 (Layout::add_comdat): Add new parameters. Change type
12376 of signature parameter. Add object and shndx to signatures table.
12377 (Layout::find_kept_object): New function.
12378 * layout.h: Include <cstring>.
12379 (Layout::is_debug_info_section): New function.
12380 (Layout::add_comdat): Add new parameters.
12381 (Layout::find_kept_object): New function.
12382 (Layout::Kept_section): New struct.
12383 (Layout::Signatures): Change type of map range.
12384 * object.cc (Relobj::output_section_address): New function.
12385 (Sized_relobj::include_section_group): Add new parameters. Change
12386 calls to Layout::add_comdat. Change to build table of kept comdat
12387 groups and table mapping discarded sections to kept sections.
12388 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12389 (Sized_relobj::do_layout): Change calls to include_section_group and
12390 include_linkonce_section.
12391 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12392 value to zero when section is discarded.
12393 (Sized_relobj::map_to_kept_section): New function.
12394 * object.h (Relobj::output_section_address): New function.
12395 (Relobj::Comdat_group): New type.
12396 (Relobj::find_comdat_group): New function.
12397 (Relobj::Comdat_group_table): New type.
12398 (Relobj::Kept_comdat_section): New type.
12399 (Relobj::Kept_comdat_section_table): New type.
12400 (Relobj::add_comdat_group): New function.
12401 (Relobj::set_kept_comdat_section): New function.
12402 (Relobj::get_kept_comdat_section): New function.
12403 (Relobj::comdat_groups_): New field.
12404 (Relobj::kept_comdat_sections_): New field.
12405 (Symbol_value::input_value): Update comment.
12406 (Sized_relobj::map_to_kept_section) New function.
12407 (Sized_relobj::include_linkonce_section): Add new parameter.
12408 * target-reloc.h (Comdat_behavior): New type.
12409 (get_comdat_behavior): New function.
12410 (relocate_section): Add code to map a discarded section to the
12411 corresponding kept section when applying a relocation.
12413 2008-04-30 Craig Silverstein <csilvers@google.com>
12415 * dwarf_reader.cc (next_generation_count): New static var.
12416 (Addr2line_cache_entry): New struct.
12417 (addr2line_cache): New static var.
12418 (Dwarf_line_info::one_addr2line): Added caching.
12419 (Dwarf_line_info::clear_addr2line_cache): New function.
12420 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12421 cache-size parameter.
12422 (Dwarf_line_info::one_addr2line_cache): New function.
12423 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12424 new cache-size argument to one_addr2line(), and clear cache.
12426 2008-04-28 Cary Coutant <ccoutant@google.com>
12428 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12429 R_386_PC8 relocations.
12431 2008-04-23 Ian Lance Taylor <iant@google.com>
12433 * object.cc (Sized_relobj::include_section_group): Check for
12434 invalid section group.
12436 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12439 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12440 than read for file header.
12441 * archive.cc (Archive::include_member): Likewise.
12443 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12445 * aclocal.m4: Regenerate.
12446 * configure: Regenerate.
12448 2008-04-19 Ian Lance Taylor <iant@google.com>
12450 * version.cc (version_string): Bump to 1.6.
12452 * testsuite/Makefile.am (many_sections_r_test): New target.
12453 (many_sections_r_test_SOURCES): Remove.
12454 (many_sections_r_test_DEPENDENCIES): Remove.
12455 (many_sections_r_test_LDFLAGS): Remove.
12456 (many_sections_r_test_LDADD): Remove.
12458 * object.cc (Sized_relobj::do_add_symbols): Always pass
12459 local_symbol_count_ to add_from_relobj.
12461 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12462 every thousand variables.
12463 * testsuite/Makefile.in: Rebuild.
12465 * object.cc (Xindex::initialize_symtab_xindex): New function.
12466 (Xindex::read_symtab_xindex): New function.
12467 (Xindex::sym_xindex_to_shndx): New function.
12468 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12470 (Sized_relobj::do_initialize_xindex): New function.
12471 (Sized_relobj::do_read_symbols): Adjust section links.
12472 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12473 parameter. Change all callers.
12474 (Sized_relobj::include_section_group): Adjust section links and
12475 symbol section indexes.
12476 (Sized_relobj::do_layout): Adjust section links.
12477 (Sized_relobj::do_count_local_symbols): Adjust section links and
12478 symbol section indexes.
12479 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12480 ordinary and special symbols.
12481 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12482 dynsym_xindex parameters. Change all callers. Adjust section
12483 links. Use SHN_XINDEX when needed.
12484 (Sized_relobj::get_symbol_location_info): Adjust section links.
12485 Don't get fooled by special symbols.
12486 * object.h (class Xindex): Define.
12487 (class Object): Add xindex_ parameter. Declare virtual functoin
12488 do_initialize_xindex.
12489 (Object::adjust_sym_shndx): New function.
12490 (Object::set_xindex): New protected function.
12491 (class Symbol_value): Add is_ordinary_shndx_ field.
12492 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12493 (Symbol_value::value): Assert ordinary section.
12494 (Symbol_value::initialize_input_to_output_map): Likewise.
12495 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12496 Change all callers.
12497 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12499 (class Sized_relobj): Update declarations.
12500 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12501 parameter. Change all callers.
12502 (Sized_relobj::adjust_shndx): New function.
12503 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12505 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12506 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12507 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12508 (Sized_dynobj::read_dynsym_section): Adjust section links.
12509 (Sized_dynobj::read_dynamic): Likewise.
12510 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12512 (Sized_dynobj::do_initialize_xindex): New function.
12513 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12514 do_initialize_xindex.
12515 (Sized_dynobj::adjust_shndx): New function.
12516 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12517 dynsym_xindex_ fields.
12518 (Layout::finalize): Add a call to set_section_indexes before
12519 creating the symtab sections.
12520 (Layout::set_section_indexes): Don't do anything if the section
12521 already has a section index.
12522 (Layout::create_symtab_sections): Add shnum parameter. Change
12523 caller. Create .symtab_shndx section if needed.
12524 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12526 (Layout::allocated_output_section_count): New function.
12527 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12529 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12530 fields. Update declarations.
12531 (Layout::symtab_xindex): New function.
12532 (Layout::dynsym_xindex): New function.
12533 (class Write_symbols_task): Add layout_ field.
12534 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12536 * output.cc (Output_section_headers::Output_section_headers): Add
12537 shstrtab_section parameter. Change all callers.
12538 (Output_section_headers::do_sized_write): Store overflow values
12539 for section count and section string table section index in
12540 section header zero.
12541 (Output_file_header::do_sized_write): Check for overflow of
12542 section count and section string table section index.
12543 (Output_symtab_xindex::do_write): New function.
12544 (Output_symtab_xindex::endian_do_write): New function.
12545 * output.h (class Output_section_headers): Add shstrtab_section_.
12546 Update declarations.
12547 (class Output_symtab_xindex): Define.
12548 (Output_section::has_out_shndx): New function.
12549 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12551 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12552 Change all callers.
12553 (Sized_symbol::init): Likewise.
12554 (Symbol::output_section): Check for ordinary symbol.
12555 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12556 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12558 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12559 Change all callers. Simplify handling of symbols from sections
12560 not included in the link.
12561 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12563 (Weak_alias_sorter::operator()): Assert that symbols are
12565 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12567 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12568 parameters. Change all callers.
12569 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12570 symbol distinction. Use SHN_XINDEX when needed.
12571 (Symbol_table::write_section_symbol): Add symtab_xindex
12572 parameter. Change all callers.
12573 (Symbol_table::sized_write_section_symbol): Likewise. Use
12574 SHN_XINDEX when needed.
12575 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12577 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12578 (Symbol::is_defined): Check is_ordinary.
12579 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12580 (Symbol::is_absolute, Symbol::is_common): Likewise.
12581 (class Sized_symbol): Update declarations.
12582 (class Symbol_table): Update declarations.
12583 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12584 parameters. Change all callers.
12585 (Sized_symbol::override): Likewise.
12586 (Symbol_table::override): Likewise.
12587 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12588 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12589 is_ordinary, and orig_st_shndx parameters. Change all callers.
12590 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12591 to be in an ordinary section.
12592 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12593 object and is_ordinary parameters. Change all callers.
12594 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12595 Change all callers. Don't add undefined or non-ordinary symbols
12597 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12598 Change all callers.
12599 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12601 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12602 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12603 (Sized_relobj::relocate_sections): Likewise.
12604 * target-reloc.h (scan_relocs): Adjust section symbol index.
12605 (scan_relocatable_relocs): Likewise.
12606 * i386.cc (Scan::local): Check for ordinary symbols.
12607 * sparc.cc (Scan::local): Likewise.
12608 * x86_64.cc (Scan::local): Likewise.
12609 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12610 to symbol_section_and_value.
12611 * testsuite/many_sections_test.cc: New file.
12612 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12613 (check_PROGRAMS): Add many_sections_test.
12614 (many_sections_test_SOURCES): Define.
12615 (many_sections_test_DEPENDENCIES): Define.
12616 (many_sections_test_LDFLAGS): Define.
12617 (BUILT_SOURCES): Add many_sections_define.h.
12618 (many_sections_define.h): New target.
12619 (BUILT_SOURCES): Add many_sections_check.h.
12620 (many_sections_check.h): New target.
12621 (check_PROGRAMS): Add many_sections_r_test.
12622 (many_sections_r_test_SOURCES): Define.
12623 (many_sections_r_test_DEPENDENCIES): Define.
12624 (many_sections_r_test_LDFLAGS): Define.
12625 (many_sections_r_test_LDADD): Define.
12626 (many_sections_r_test.o): New target.
12627 * testsuite/Makefile.in: Rebuild.
12629 2008-04-17 Cary Coutant <ccoutant@google.com>
12631 * errors.cc (Errors::info): New function.
12632 (gold_info): New function.
12633 * errors.h (Errors::info): New function.
12634 * gold.h (gold_info): New function.
12635 * object.cc (Input_objects::add_object): Print trace output.
12636 * options.cc (options::parse_set): New function.
12637 (General_options::parse_wrap): Deleted.
12638 (General_options::General_options): Deleted initializer.
12639 * options.h (options::String_set): New typedef.
12640 (options::parse_set): New function.
12641 (DEFINE_set): New macro.
12642 (General_options::wrap): Changed to use DEFINE_set. Changed
12643 callers of any_wrap_symbols and is_wrap_symbol.
12644 (General_options::trace, General_options::trace_symbol):
12646 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12647 (General_options::wrap_symbols_): Deleted.
12648 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12650 2008-04-17 David S. Miller <davem@davemloft.net>
12652 * options.cc (General_options::parse_V): New function.
12653 * options.h: Add entries for -V and -Qy.
12655 2008-04-17 Ian Lance Taylor <iant@google.com>
12657 * common.cc (Symbol_table::allocate_commons): Remove options
12658 parameter. Change caller.
12659 (Symbol_table::do_allocate_commons): Remove options parameter.
12660 Change caller. Just call do_allocate_commons_list twice.
12661 (Symbol_table::do_allocate_commons_list): New function, broken out
12662 of do_allocate_commons.
12663 * common.h (class Allocate_commons_task): Remove options_ field.
12664 Update constructor.
12665 * symtab.cc (Symbol_table::Symbol_table): Initialize
12667 (Symbol_table::add_from_object): Put TLS common symbols on
12669 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12670 which are IN_OUTPUT_DATA.
12671 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12672 allocate_commons and do_allocate_commons declarations. Declare
12673 do_allocate_commons_list.
12674 * gold.cc (queue_middle_tasks): Update creation of
12675 Allocate_commons_task to not pass options.
12676 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12677 (TLS_TEST_C_FLAGS): New variable.
12678 (tls_test_c_pic.o): New target.
12679 (tls_test_shared.so): Link in tls_test_c_pic.o.
12680 (tls_test_c_pic_ie.o): New target.
12681 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12682 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12683 (tls_test_c.o): New target.
12684 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12685 (tls_pic_test_LDADD): Likewise.
12686 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12687 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12688 (tls_test_c_gnu2.o): New target.
12689 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12691 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12692 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12693 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12694 * testsuite/tls_test.cc: Include "config.h".
12695 (t_last): Call t11_last.
12696 * testsuite/tls_test.h (t11, t11_last): Declare.
12697 * testsuite/tls_test_c.c: New file.
12698 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12699 * configure.ac: Check for OpenMP support.
12700 * configure, config.in, Makefile.in: Rebuild.
12701 * testsuite/Makefile.in: Rebuild.
12703 2008-04-16 Cary Coutant <ccoutant@google.com>
12705 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12706 (Target_i386::tls_base_symbol_defined_): New field.
12707 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12708 (Target_i386::Scan::global): Likewise.
12709 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12710 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12711 (Target_x86_64::tls_base_symbol_defined_): New field.
12712 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12713 (Target_x86_64::Scan::global): Likewise.
12715 2008-04-16 Cary Coutant <ccoutant@google.com>
12717 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12718 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12719 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12720 building shared libraries.
12721 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12722 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12723 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12724 * testsuite/Makefile.in: Rebuild.
12725 * testsuite/weak_undef.h: New file.
12726 * testsuite/weak_undef_file1.cc: Add extra test cases.
12727 * testsuite/weak_undef_file2.cc: Likewise.
12728 * testsuite/weak_undef_test.cc: Likewise.
12730 2008-04-16 David S. Miller <davem@davemloft.net>
12732 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12733 Add issued_non_pic_error_ field. Declare check_non_pic.
12734 (Target_sparc::Scan::check_non_pic): New function.
12735 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12736 (Target_sparc::Scan::global): Likewise.
12738 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12739 * configure: Rebuild.
12741 * options.h (DEFINE_enable): New macro.
12742 (new_dtags): New enable option.
12743 (initfirst, interpose, loadfltr, nodefaultlib,
12744 nodelete, nodlopen, nodump): New -z options.
12745 * layout.cc (Layout:finish_dynamic_section): If new
12746 dtags enabled, emit DT_RUNPATH. Also, emit a
12747 DT_FLAGS_1 containing any specified -z flags.
12749 2008-04-16 Ian Lance Taylor <iant@google.com>
12751 * copy-relocs.cc: New file.
12752 * copy-relocs.h: New file.
12753 * reloc.cc: Remove Copy_relocs code.
12754 * reloc.h: Likewise.
12755 * reloc-types.h (struct Reloc_types) [both versions]: Add
12756 get_reloc_addend_noerror.
12757 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12758 variants of add_global which take an addend which must be zero.
12759 * i386.cc: Include "copy-relocs.h".
12760 (class Target_i386): Change type of copy_relocs_ to variable,
12761 update initializer.
12762 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12763 Change all callers.
12764 (Target_i386::do_finalize_sections): Change handling of
12766 * sparc.cc: Include "copy-relocs.h".
12767 (class Target_sparc): Change type of copy_relocs_ to variable,
12768 update initializer.
12769 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12770 Change all callers.
12771 (Target_sparc::do_finalize_sections): Change handling of
12773 * x86_64.cc: Include "copy-relocs.h".
12774 (class Target_x86_64): Change type of copy_relocs_ to variable,
12775 update initializer.
12776 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12777 class. Change all callers.
12778 (Target_x86_64::do_finalize_sections): Change handling of
12780 * Makefile.am (CCFILES): Add copy-relocs.cc.
12781 (HFILES): Add copy-relocs.h.
12783 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12785 * testsuite/script_test_4.sh: Permit leading zeroes.
12787 2008-04-15 Ian Lance Taylor <iant@google.com>
12789 * script-sections.cc (Script_sections::create_segments): Use
12790 header_size_adjustment even when there is enough room for the
12792 * testsuite/script_test_4.sh: New file.
12793 * testsuite/script_test_4.t: New file.
12794 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12795 (check_DATA): Add script_test_4.stdout.
12796 (MOSTLYCLEANFILES): Likewise.
12797 (script_test_4): New target.
12798 (script_test_4.stdout): New target.
12799 * testsuite/Makefile.in: Rebuild.
12801 * sparc.cc: Add definitions for Output_data_plt_sparc class
12804 2008-04-14 David S. Miller <davem@davemloft.net>
12806 * sparc.cc: New file.
12807 * Makefile.am (TARGETSOURCES): Add sparc.cc
12808 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12809 * configure.tgt: Document targ_extra_size and
12810 targ_extra_big_endian. Add entries for sparc-* and
12812 * configure.ac: Handle targ_extra_size and
12813 targ_extra_big_endian.
12814 * Makefile.in: Rebuild.
12815 * configure: Likewise.
12816 * po/POTFILES.in: Likewise.
12817 * po/gold.pot: Likewise.
12819 2008-04-14 Ian Lance Taylor <iant@google.com>
12821 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12822 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12823 in the name/type/flags to section mapping. Don't call
12824 allocate_output_section.
12825 (Layout::choose_output_section): Change parameter from adjust_name
12826 to is_input_section. Don't permit input sections after sections
12827 are attached to segments. Don't call allocate_output_section.
12828 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12829 not write_enable_output_section.
12830 (Layout::make_output_section): Don't push to
12831 unattached_section_list_ nor call attach_to_segment. Call
12832 attach_section_to_segment if sections are attached.
12833 (Layout::attach_sections_to_segments): New function.
12834 (Layout::attach_section_to_segment): New function.
12835 (Layout::attach_allocated_section_to_segment): Rename from
12836 attach_to_segment. Remove flags parameter.
12837 (Layout::allocate_output_section): Remove function.
12838 (Layout::write_enable_output_section): Remove function.
12839 * layout.h (class Layout): Update for above changes. Add new
12840 field sections_are_attached_.
12841 * output.h (Output_section::update_flags_for_input_section): New
12843 * output.cc (Output_section::add_input_section): Call
12844 update_flags_for_input_section.
12845 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12847 2008-04-11 Cary Coutant <ccoutant@google.com>
12849 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12850 thought unnecessary.
12851 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12853 2008-04-11 Ian Lance Taylor <iant@google.com>
12855 * output.h (class Output_section_data): Remove inline definition
12857 * output.cc (Output_section_data::set_addralign): New function.
12859 2008-04-11 Cary Coutant <ccoutant@google.com>
12861 Add support for TLS descriptors for i386 and x86_64.
12862 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12863 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12864 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12866 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12867 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12868 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12870 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12871 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12872 Fix problem with initial-exec relocations.
12873 (Target_i386::Relocate::relocate_tls): Likewise.
12874 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12876 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12877 support for section-plus-offset dynamic table entries.
12878 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12879 (Output_data_dynamic::Dynamic_entry): Add support for
12880 section-plus-offset dynamic table entries.
12881 (Output_data_dynamic::Classification): Likewise.
12882 (Output_data_dynamic::classification_): Renamed offset_.
12883 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12884 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12885 (Target_x86_64::make_plt_section): New function.
12886 (Target_x86_64::reserve_tlsdesc_entries): New function.
12887 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12888 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12889 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12890 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12891 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12892 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12893 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12894 add extra PLT entry for TLS descriptors.
12895 (Output_data_plt_x86_64::got_): New field.
12896 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12897 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12899 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12901 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12902 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12903 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12904 R_386_TLS_DESC_CALL relocations.
12905 (Target_x86_64::Scan::global): Likewise.
12906 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12907 for TLS descriptors.
12908 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12909 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12910 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12911 GD-to-IE relaxation.
12912 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12913 and TLS_DESCRIPTORS.
12914 * Makefile.in: Rebuild.
12915 * configure: Rebuild.
12916 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12917 (tls_test_shared2.so): New target.
12918 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12919 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12920 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12921 (tls_shared_gd_to_ie_test_LDADD): New variable.
12922 (tls_shared_gnu2_gd_to_ie_test): New target.
12923 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12925 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12926 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12927 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12928 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12929 (tls_shared_gnu2_test): New target.
12930 (tls_test_gnu2_shared.so): New target.
12931 (tls_shared_gnu2_test_SOURCES): New variable.
12932 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12933 (tls_shared_gnu2_test_LDFLAGS): New variable.
12934 (tls_shared_gnu2_test_LDADD): New variable.
12935 * testsuite/Makefile.in: Rebuild.
12936 * testsuite/Makefile.
12938 2008-04-11 Ian Lance Taylor <iant@google.com>
12940 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12942 * testsuite/Makefile.in: Rebuild.
12944 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12946 * testsuite/script_test_2.cc (main): Adjust test.
12948 2008-04-11 David S. Miller <davem@davemloft.net>
12949 Ian Lance Taylor <iant@google.com>
12951 * options.h (General_options): Add entries for '-Y' and
12953 * options.cc (General_options:finalize): If -Y was used, add those
12954 entries to the library path instead of the default "/lib" and
12957 2008-04-11 David S. Miller <davem@davemloft.net>
12959 * testsuite/justsyms.t: Start at 0x100.
12960 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12961 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12963 * testsuite/script_test_2.cc: Adjust string and section length
12966 2008-04-09 Ian Lance Taylor <iant@google.com>
12969 * script-sections.cc (Sections_element::allocate_to_segment): Add
12971 (Output_section_definition::allocate_to_segment): Likewise.
12972 (Orphan_output_section::allocate_to_segment): Likewise.
12973 (Script_sections::attach_sections_using_phdrs_clause): Don't
12974 propagate non-PT_LOAD segments to orphan sections.
12975 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12976 readelf rather than objdump.
12977 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12978 .interp section and PT_INTERP segment are the same size.
12979 * testsuite/Makefile.in: Rebuild.
12981 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12982 aliases for symbols defined in the same object.
12983 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12984 (weak_alias_test_SOURCES): New variable.
12985 (weak_alias_test_DEPENDENCIES): New variable.
12986 (weak_alias_test_LDFLAGS): New variable.
12987 (weak_alias_test_LDADD): New variable.
12988 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12989 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12990 (weak_alias_test_3.o): New target.
12991 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12992 * testsuite/weak_alias_test_main.cc: New file.
12993 * testsuite/weak_alias_test_1.cc: New file.
12994 * testsuite/weak_alias_test_2.cc: New file.
12995 * testsuite/weak_alias_test_3.cc: New file.
12997 2008-04-08 Ian Lance Taylor <iant@google.com>
12999 * options.h (class General_options): Add --noinhibit-exec option.
13000 * main.cc (main): Check --noinhibit-exec.
13002 * options.h (class General_options): Define --wrap as a special
13003 option. Add wrap_symbols_ field.
13004 (General_options::any_wrap_symbols): New function.
13005 (General_options::is_wrap_symbol): New function.
13006 * options.cc (General_options::parse_wrap): New function.
13007 (General_options::General_options): Initialize wrap_symbols_.
13008 * symtab.cc (Symbol_table::wrap_symbol): New function.
13009 (Symbol_table::add_from_object): Handle --wrap.
13010 * symtab.h (class Symbol_table): Declare wrap_symbol.
13011 * target.h (Target::wrap_char): New function.
13012 (Target::Target_info): Add wrap_char field.
13013 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13014 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13015 * testsuite/testfile.cc (Target_test::test_target_info):
13018 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13021 * layout.h (class Layout): Add added_eh_frame_data_ field.
13022 * layout.cc (Layout::Layout): Initialize new field.
13023 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13024 output section until we find a section we merged successfully.
13025 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13026 that the size be non-zero.
13028 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13031 2008-04-08 Craig Silverstein <csilvers@google.com>
13033 * configure.ac: Export new conditional variable HAVE_ZLIB.
13034 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13036 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13037 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13039 2008-04-07 Ian Lance Taylor <iant@google.com>
13041 * version.cc (version_string): Set to "1.5".
13043 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13044 Add issued_non_pic_error_ field. Declare check_non_pic.
13045 (Target_x86_64::Scan::check_non_pic): New function.
13046 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13047 (Target_x86_64::Scan::global): Likewise.
13049 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13050 addend parameter. Change caller. Handle merge sections.
13051 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13052 Address to Addend. Don't add in the result of
13053 local_section_offset, pass down the addend and use the returned
13055 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13056 Update declarations of local_section_offset and symbol_value.
13057 * testsuite/two_file_test_1.cc (t18): New function.
13058 * testsuite/two_file_test_2.cc (f18): New function.
13059 * testsuite/two_file_test_main.cc (main): Call t18.
13060 * testsuite/two_file_test.h (t18, f18): Declare.
13062 * configure.ac: Don't test for objdump, c++filt, or readelf.
13063 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13065 (TEST_READELF): New variable.
13066 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13067 (check_PROGRAMS): Add two_file_strip_test.
13068 (two_file_strip_test): New target.
13069 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13070 (two_file_same_shared_strip_test_SOURCES): New variable.
13071 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13072 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13073 (two_file_same_shared_strip_test_LDADD): New variable.
13074 (two_file_shared_strip.so): New target.
13075 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13076 (ver_test_5.syms, ver_test_7.syms): Likewise.
13077 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13078 (strip_test_3.stdout): Use TEST_OBJDUMP.
13079 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13081 2008-04-04 Cary Coutant <ccoutant@google.com>
13083 * symtab.h (Symbol::is_weak_undefined): New function.
13084 (Symbol::is_strong_undefined): New function.
13085 (Symbol::is_absolute): New function.
13086 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13087 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13089 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13090 (weak_undef_test): New target.
13091 * testsuite/Makefile.in: Rebuild.
13092 * testsuite/weak_undef_file1.cc: New file.
13093 * testsuite/weak_undef_file2.cc: New file.
13094 * testsuite/weak_undef_test.cc: New file.
13096 2008-04-03 Craig Silverstein <csilvers@google.com>
13098 * compressed_output.h (class Output_compressed_section): Use
13100 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13102 (zlib_compressed_suffix): Removed.
13103 (Output_compressed_section::set_final_data_size): Use unsigned
13105 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13106 Fix linker invocation.
13107 (flagstest_o_specialfile_and_compress_debug_sections):
13109 * testsuite/Makefile.in: Regenerated.
13111 2008-04-02 David S. Miller <davem@davemloft.net>
13113 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13114 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13116 2008-04-02 Craig Silverstein <csilvers@google.com>
13120 2008-04-02 Ian Lance Taylor <iant@google.com>
13122 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13123 parameters. Update for new key type to views_. Change all
13125 (File_read::read): Adjust for byteshift in returned view.
13126 (File_read::add_view): New function, broken out of
13127 find_and_make_view.
13128 (File_read::make_view): New function, broken out of
13129 find_and_make_view.
13130 (File_read::find_or_make_view): Add offset and aligned
13131 parameters. Rewrite accordingly. Change all callers.
13132 (File_read::get_view): Add offset and aligned parameters. Adjust
13133 for byteshift in return value.
13134 (File_read::get_lasting_view): Likewise.
13135 * fileread.h (class File_read): Update declarations.
13136 (class File_read::View): Add byteshift_ field. Add byteshift to
13137 constructor. Add byteshift method.
13138 * archive.h (Archive::clear_uncached_views): New function.
13139 (Archive::get_view): Add aligned parameter. Change all callers.
13140 * object.h (Object::get_view): Add aligned parameter. Change all
13142 (Object::get_lasting_view): Likewise.
13144 * fileread.cc (File_read::release): Don't call clear_views if
13145 there are multiple objects.
13146 * fileread.h (File_read::clear_uncached_views): New function.
13147 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13150 2008-03-31 Cary Coutant <ccoutant@google.com>
13152 Add thin archive support.
13153 * archive.cc (Archive::armagt): New const.
13154 (Archive::setup): Remove task parameter and calls to unlock.
13155 (Archive::unlock_nested_archives): New function.
13156 (Archive::read_header): Add nested_off parameter. Change
13158 (Archive::interpret_header): Likewise.
13159 (Archive::include_all_members): Change to handle thin
13161 (Archive::include_member): Likewise.
13162 * archive.h (Archive::Archive): Add new parameters and
13164 (Archive::armagt): New const.
13165 (Archive::setup): Remove task parameter.
13166 (Archive::unlock_nested_archives): New function.
13167 (Archive::read_header): Add nested_off parameter.
13168 (Archive::interpret_header): Likewise.
13169 (Archive::Nested_archive_table): New typedef.
13170 (Archive::is_thin_archive_): New field.
13171 (Archive::nested_archives_): New field.
13172 (Archive::options_): New field.
13173 (Archive::dirpath_): New field.
13174 (Archive::task_): New field.
13175 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13176 for thin archives. Pass additional parameters to
13177 Archive::Archive. Unlock the archive file after calling
13180 2008-03-29 Ian Lance Taylor <iant@google.com>
13182 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13183 version symbol to be local.
13184 * testsuite/ver_test_4.sh: New file.
13185 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13186 (check_DATA): Add ver_test_4.syms.
13187 (ver_test_4.syms): New target.
13188 * testsuite/Makefile.in: Rebuild.
13191 (Output_section::Input_section_sort_entry::has_priority): New
13193 (Output_section::Input_section_sort_entry::match_file_name): New
13195 (Output_section::Input_section_sort_entry::match_section_name):
13197 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13199 (Output_section::Input_section_sort_entry::match_section_file):
13201 (Output_section::Input_section_sort_compare::operator()): Rewrite
13202 using new Input_section_sort_entry functions. Sort crtbegin and
13203 crtend first. Sort sections with no priority before sections with
13205 * testsuite/initpri1.c (d3): Check j != 4.
13206 (cd5): New constructor/destructor function.
13207 (main): Check j != 2.
13209 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13210 new symbol when resolving, don't call set_is_default.
13211 * testsuite/ver_test_7.cc: New file.
13212 * testsuite/ver_test_7.sh: New file.
13213 * testsuite/Makefile.am (ver_test_7.so): New target.
13214 (ver_test_7.o): New target.
13215 (check_SCRIPTS): Add ver_test_7.sh.
13216 (check_DATA): Add ver_test_7.syms.
13217 (ver_test_7.syms): New target.
13219 2008-03-28 Ian Lance Taylor <iant@google.com>
13221 * layout.cc (Layout::layout): If we see an input section with a
13222 name that needs sorting, set the must_sort flag for the output
13224 (Layout::make_output_section): If the name of the output section
13225 indicates that it might require sorting, set the may_sort flag.
13226 * output.h (Output_section::may_sort_attached_input_sections): New
13228 (Output_section::set_may_sort_attached_input_sections): New
13230 (Output_section::must_sort_attached_input_sections): New
13232 (Output_section::set_must_sort_attached_input_sections): New
13234 (class Output_section): Declare Input_section_sort_entry. Define
13235 Input_section_sort_compare. Declare
13236 sort_attached_input_sections. Add new fields:
13237 may_sort_attached_input_sections_,
13238 must_sort_attached_input_sections_,
13239 attached_input_sections_are_sorted_.
13240 * output.cc (Output_section::Output_section): Initialize new
13242 (Output_section::add_input_section): Add an entry to
13243 input_sections_ if may_sort or must_sort are true.
13244 (Output_section::set_final_data_size): Call
13245 sort_attached_input_sections if necessary.
13246 (Output_section::Input_section_sort_entry): Define new class.
13247 (Output_section::Input_section_sort_compare::operator()): New
13249 (Output_section::sort_attached_input_sections): New function.
13250 * configure.ac: Check whether the compiler supports constructor
13251 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13252 * testsuite/initpri1.c: New file.
13253 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13254 CONSTRUCTOR_PRIORITY.
13255 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13256 (initpri1_LDFLAGS): New variable.
13257 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13259 2008-03-27 Ian Lance Taylor <iant@google.com>
13261 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13262 * testsuite/common_test_1.c: New file.
13263 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13264 (common_test_1_SOURCES): New variable.
13265 (common_test_1_DEPENDENCIES): New variable.
13266 (common_test_1_LDFLAGS): New variable.
13268 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13269 and commons_ correctly when NAME/VERSION does not override
13271 * testsuite/ver_test_6.c: New file.
13272 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13273 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13274 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13276 2008-03-26 Ian Lance Taylor <iant@google.com>
13278 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13279 of an undefined symbol from a version script.
13280 * testsuite/Makefile.am (ver_test_5.so): New target.
13281 (ver_test_5.o): New target.
13282 (check_SCRIPTS): Add ver_test_5.sh.
13283 (check_DATA): Add ver_test_5.syms.
13284 (ver_test_5.syms): New target.
13285 * testsuite/ver_test_5.cc: New file.
13286 * testsuite/ver_test_5.script: New file.
13287 * testsuite/ver_test_5.sh: New file.
13288 * Makefile.in, testsuite/Makefile.in: Rebuild.
13291 Fix problems building gold with gcc 4.3.0.
13292 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13293 (gold_error_at_location, gold_warning_at_location): Use it.
13294 * configure.ac: Check whether we can compile and use a template
13295 function with a printf attribute.
13296 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13297 when jumping over bytes.
13298 * object.cc: Instantiate Object::read_section_data.
13299 * debug.h: Include <cstring>
13300 * dwarf_reader.cc: Include <algorithm>
13301 * main.cc: Include <cstring>.
13302 * options.cc: Include <cstring>.
13303 * output.cc: Include <cstring>.
13304 * script.cc: Include <cstring>.
13305 * script.h: Include <string>.
13306 * symtab.cc: Include <cstring> and <algorithm>.
13307 * target-select.cc: Include <cstring>.
13308 * version.cc: Include <string>.
13309 * testsuite/testmain.cc: Include <cstdlib>.
13310 * configure, config.in: Rebuild.
13312 2008-03-25 Ian Lance Taylor <iant@google.com>
13314 * options.cc: Include "../bfd/bfdver.h".
13315 (options::help): Print bug reporting address.
13317 * version.cc (print_version): Adjust output for current value of
13318 BFD_VERSION_STRING.
13322 * options.cc (options::help): Print list of supported targets.
13323 * target-select.h: Include <vector>.
13324 (class Target_selector): Make machine_, size_, and is_big_endian_
13325 fields const. Add bfd_name_ and instantiated_target_ fields.
13326 (Target_selector::Target_selector): Add bfd_name parameter.
13327 (Target_selector::recognize): Make non-virtual, call
13329 (Target_selector::recognize_by_name): Make non-virtual, call
13330 do_recognize_by_name.
13331 (Target_selector::supported_names): New function.
13332 (Target_selector::bfd_name): New function.
13333 (Target_selector::do_instantiate_target): New pure virtual
13335 (Target_selector::do_recognize): New virtual function.
13336 (Target_selector::do_recognize_by_name): New virtual function.
13337 (Target_selector::instantiate_target): New private function.
13338 (supported_target_names): Declare.
13339 * target-select.cc (Target_selector::Target_selector): Update for
13340 new parameter and fields.
13341 (select_target_by_name): Check that the name matches before
13342 calling recognize_by_name.
13343 (supported_target_names): New function.
13344 * i386.cc (class Target_selector_i386): Update Target_selector
13345 constructor call. Remove recognize and recognize_by_name. Add
13346 do_instantiate_target.
13347 * x86_64.cc (class Target_selector_x86_64): Likewise.
13348 * testsuite/testfile.cc (class Target_selector_test): Update for
13349 changes to Target_selector.
13351 * README: Rewrite, with some notes on unsupported features.
13353 2008-03-24 Cary Coutant <ccoutant@google.com>
13355 * i386.cc (Target_i386::Got_type): New enum declaration.
13356 (Target_i386::Scan::local): Updated callers of Output_data_got
13358 (Target_i386::Scan::global): Likewise.
13359 (Target_i386::Relocate::relocate): Likewise.
13360 (Target_i386::Relocate::relocate_tls): Likewise.
13361 * object.h (Got_offset_list): New class.
13362 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13363 (Sized_relobj::local_got_offset): Likewise.
13364 (Sized_relobj::set_local_got_offset): Likewise.
13365 (Sized_relobj::local_has_tls_got_offset): Removed.
13366 (Sized_relobj::local_tls_got_offset): Removed.
13367 (Sized_relobj::set_local_tls_got_offset): Removed.
13368 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13369 * output.cc (Output_data_got::add_global): Added got_type parameter.
13370 (Output_data_got::add_global_with_rel): Likewise.
13371 (Output_data_got::add_global_with_rela): Likewise.
13372 (Output_data_got::add_global_pair_with_rel): New function.
13373 (Output_data_got::add_global_pair_with_rela): New function.
13374 (Output_data_got::add_local): Added got_type parameter.
13375 (Output_data_got::add_local_with_rel): Likewise.
13376 (Output_data_got::add_local_with_rela): Likewise.
13377 (Output_data_got::add_local_pair_with_rel): New function.
13378 (Output_data_got::add_local_pair_with_rela): New function.
13379 (Output_data_got::add_global_tls): Removed.
13380 (Output_data_got::add_global_tls_with_rel): Removed.
13381 (Output_data_got::add_global_tls_with_rela): Removed.
13382 (Output_data_got::add_local_tls): Removed.
13383 (Output_data_got::add_local_tls_with_rel): Removed.
13384 (Output_data_got::add_local_tls_with_rela): Removed.
13385 * output.h (Output_data_got::add_global): Added got_type parameter.
13386 (Output_data_got::add_global_with_rel): Likewise.
13387 (Output_data_got::add_global_with_rela): Likewise.
13388 (Output_data_got::add_global_pair_with_rel): New function.
13389 (Output_data_got::add_global_pair_with_rela): New function.
13390 (Output_data_got::add_local): Added got_type parameter.
13391 (Output_data_got::add_local_with_rel): Likewise.
13392 (Output_data_got::add_local_with_rela): Likewise.
13393 (Output_data_got::add_local_pair_with_rel): New function.
13394 (Output_data_got::add_local_pair_with_rela): New function.
13395 (Output_data_got::add_global_tls): Removed.
13396 (Output_data_got::add_global_tls_with_rel): Removed.
13397 (Output_data_got::add_global_tls_with_rela): Removed.
13398 (Output_data_got::add_local_tls): Removed.
13399 (Output_data_got::add_local_tls_with_rel): Removed.
13400 (Output_data_got::add_local_tls_with_rela): Removed.
13401 * resolve.cc (Symbol::override_base_with_special): Removed
13402 reference to has_got_offset_ field.
13403 * symtab.cc (Symbol::init_fields): Replaced initialization
13404 of got_offset_ with got_offsets_. Removed initialization
13406 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13407 (Symbol::got_offset): Likewise.
13408 (Symbol::set_got_offset): Likewise.
13409 (Symbol::has_tls_got_offset): Removed.
13410 (Symbol::tls_got_offset): Removed.
13411 (Symbol::set_tls_got_offset): Removed.
13412 (Symbol::got_offset_): Removed.
13413 (Symbol::tls_mod_got_offset_): Removed.
13414 (Symbol::tls_pair_got_offset_): Removed.
13415 (Symbol::got_offsets_): New field.
13416 (Symbol::has_got_offset): Removed.
13417 (Symbol::has_tls_mod_got_offset): Removed.
13418 (Symbol::has_tls_pair_got_offset): Removed.
13419 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13420 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13422 (Target_x86_64::Scan::global): Likewise.
13423 (Target_x86_64::Relocate::relocate): Likewise.
13424 (Target_x86_64::Relocate::relocate_tls): Likewise.
13426 2008-03-25 Ben Elliston <bje@au.ibm.com>
13428 * yyscript.y: Fix spelling error in comment.
13430 2008-03-24 Ian Lance Taylor <iant@google.com>
13432 * options.h (class General_options): Define build_id option.
13433 * layout.h (class Layout): Declare write_build_id, create_note,
13434 create_build_id. Add build_id_note_ member.
13435 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13436 "libiberty.h", "md5.h", "sha1.h".
13437 (Layout::Layout): Initialize eh_frame_data_,
13438 eh_frame_hdr_section_, and build_id_note_.
13439 (Layout::finalize): Call create_build_id.
13440 (Layout::create_note): New function, broken out of
13441 Layout::create_gold_note.
13442 (Layout::create_gold_note): Call create_note.
13443 (Layout::create_build_id): New function.
13444 (Layout::write_build_id): New function.
13445 (Close_task_runner::run): Call write_build_id.
13447 * x86_64.cc: Correct license to GPLv3.
13449 2008-03-23 Ian Lance Taylor <iant@google.com>
13451 * options.cc: Include "demangle.h".
13452 (parse_optional_string): New function.
13453 (parse_long_option): Handle takes_optional_argument.
13454 (parse_short_option): Update dash_z initializer. Handle
13455 takes_optional_argument.
13456 (General_options::General_options): Initialize do_demangle_.
13457 (General_options::finalize): Set do_demangle_. Handle demangling
13459 * options.h (parse_optional_string): Declare.
13460 (struct One_option): Add optional_arg field. Update constructor.
13461 Update call constructor calls. Add takes_optional_argument
13463 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13464 (DEFINE_optional_string): Define.
13465 (General_options::demangle): Change from DEFINE_bool to
13466 DEFINE_optional_string.
13467 (General_options::no_demangle): New function.
13468 (General_options::do_demangle): New function.
13469 (General_options::set_do_demangle): New function.
13470 (General_options::execstack_status_): Move definition to end of
13472 (General_options::static_): Likewise.
13473 (General_options::do_demangle_): New field.
13474 * object.cc (big_endian>::get_symbol_location_info): Call
13475 Options::do_demangle, not Options::demangle.
13476 * symtab.cc (demangle): Likewise.
13478 2008-03-22 Ian Lance Taylor <iant@google.com>
13480 * gold.h: Include <cstddef> and <sys/types.h>
13481 * options.h: Include <cstring>.
13483 2008-03-21 Ian Lance Taylor <iant@google.com>
13485 * Added source code to GNU binutils.