1 2012-08-24 Sriraman Tallam <tmsriram@google.com>
3 * gold.cc (queue_middle_tasks): Call layout again when unique
4 segments for sections is desired.
5 * layout.cc (Layout::Layout): Initialize new members.
6 (Layout::get_output_section_flags): New function.
7 (Layout::choose_output_section): Call get_output_section_flags.
8 (Layout::layout): Make output section for mapping to a unique segment.
9 (Layout::insert_section_segment_map): New function.
10 (Layout::attach_allocated_section_to_segment): Make unique segment for
11 output sections marked so.
12 (Layout::segment_precedes): Check for unique segments when sorting.
13 * layout.h (Layout::Unique_segment_info): New struct.
14 (Layout::Section_segment_map): New typedef.
15 (Layout::insert_section_segment_map): New function.
16 (Layout::get_output_section_flags): New function.
17 (Layout::is_unique_segment_for_sections_specified): New function.
18 (Layout::set_unique_segment_for_sections_specified): New function.
19 (Layout::unique_segment_for_sections_specified_): New member.
20 (Layout::section_segment_map_): New member.
21 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
22 Rename is_gc_pass_one to is_pass_one.
23 Rename is_gc_pass_two to is_pass_two.
24 Rename is_gc_or_icf to is_two_pass.
25 Check for which pass based on whether symbols data is present.
26 Make it two pass when unique segments for sections is desired.
27 * output.cc (Output_section::Output_section): Initialize new
29 * output.h (Output_section::is_unique_segment): New function.
30 (Output_section::set_is_unique_segment): New function.
31 (Output_section::is_unique_segment_): New member.
32 (Output_section::extra_segment_flags): New function.
33 (Output_section::set_extra_segment_flags): New function.
34 (Output_section::extra_segment_flags_): New member.
35 (Output_section::segment_alignment): New function.
36 (Output_section::set_segment_alignment): New function.
37 (Output_section::segment_alignment_): New member.
38 (Output_segment::Output_segment): Initialize is_unique_segment_.
39 (Output_segment::is_unique_segment): New function.
40 (Output_segment::set_is_unique_segment): New function.
41 (Output_segment::is_unique_segment_): New member.
42 * plugin.cc (allow_unique_segment_for_sections): New function.
43 (unique_segment_for_sections): New function.
44 (Plugin::load): Add new functions to transfer vector.
45 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
46 * Makefile.in: Regenerate.
47 * testsuite/plugin_final_layout.sh: Check if unique segment
49 * testsuite/plugin_section_order.c (onload): Check if new interfaces
51 (allow_unique_segment_for_sections): New global.
52 (unique_segment_for_sections): New global.
53 (claim_file_hook): Call allow_unique_segment_for_sections.
54 (all_symbols_read_hook): Call unique_segment_for_sections.
57 2012-08-22 Cary Coutant <ccoutant@google.com>
59 * layout.cc (Layout::include_section): Don't assert on GROUP
60 sections with --emit-relocs.
62 2012-08-21 Cary Coutant <ccoutant@google.com>
64 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
65 if --export-dynamic-symbol names an undef symbol.
67 2012-08-18 Alan Modra <amodra@gmail.com>
69 * powerpc.cc: Formatting and white space.
70 (Powerpc_relobj): Rename got2_section_ to special_.
71 Add opd_ent_shndx_ and opd_ent_off_ vectors.
72 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
73 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
74 (Target_powerpc): Add Address typedef and invalid_address. Use
76 (Target_powerpc::is_branch_reloc): New function.
77 (Powerpc_relocate_functions): Add Address typedef, use throughout.
78 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
79 for dst_mask, value and addend.
80 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
81 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
82 (Output_data_glink::do_write): Correct toc base. Don't try to use
83 uint16_t for 24-bit offset. Use get_output_section_offset and
85 (Target_powerpc::Scan::local): Handle more relocs.
86 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
87 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
88 Plug in toc restoring insn after plt calls. Translate branches
89 to function descriptor symbols to corresponding entry point.
90 (Target_powerpc::relocate_for_relocatable): Check return from
91 get_output_section_offset.
92 * symtab.h: Comment typo.
94 2012-08-14 Ian Lance Taylor <iant@google.com>
96 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
97 unsupported_relocal_local to call unsupported_reloc_global.
99 2012-08-14 Nick Clifton <nickc@redhat.com>
102 * script-sections.cc (Sections_element::output_section_name): Add
103 keep return parameter.
104 (Output_section_element::match_name): Add keep return parameter.
105 Return the value of the keep_ member.
106 * script-sections.h (class Output_section): Update
107 output_section_name prototype.
108 * layout.cc (Layout::keep_input_section): New public member
110 (Layout::choose_output_section): Pass keep parameter to
112 * layout.h (class Layout): Add keep_input_section.
113 * object.cc (Sized_relobj_file::do_layout): Check for kept input
115 * testsuite/Makefile.am: Add a test.
116 * testsuite/Makefile.in: Regenerate.
117 * testsuite/pr14265.c: Source file for the test.
118 * testsuite/pr14265.t: Linker script for the test.
119 * testsuite/pr14265.sh: Shell script for the test.
121 2012-08-14 Alan Modra <amodra@gmail.com>
123 * target.h (Target::output_section_name): New function.
124 (Target::do_output_section_name): New function.
125 * layout.cc (Layout::choose_output_section): Call the above.
126 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
128 2012-08-14 Alan Modra <amodra@gmail.com>
130 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
131 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
132 for replace_constant call.
133 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
134 (Output_data_glink::do_print_to_mapfile): New function.
135 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
136 (Target_powerpc::Relocate::relocate): Likewise.
138 2012-08-14 Alan Modra <amodra@gmail.com>
140 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
141 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
142 (Output_data_glink::add_entry,find_entry): Remove shndx param.
143 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
144 all references to shndx_. Handle special case for R_PPC_PLTREL24
146 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
147 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
148 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
150 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
151 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
153 2012-08-12 Alan Modra <amodra@gmail.com>
155 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
156 (glink insn constants): Use uint32_t.
157 (Output_data_glink::add_entry): Use insert, not [] operator.
159 2012-08-11 Alan Modra <amodra@gmail.com>
161 * object.h (Sized_relobj_file::find_shdr): New function.
162 (Sized_relobj_file::find_special_sections): New function.
163 * object.cc (Sized_relobj_file::find_shdr): New function.
164 (Sized_relobj_file::find_eh_frame): Use find_shdr.
165 (Sized_relobj_file::find_special_sections): New function, split out..
166 (Sized_relobj_file::do_read_symbols): ..from here.
167 * output.h (Output_data_got::replace_constant): New function.
168 (Output_data_got::num_entries): New function.
169 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
170 (Output_data_got::got_offset): Protected rather than private.
171 (Output_data_got::replace_got_entry): New function.
172 * output.cc (Output_data_got::replace_got_entry): New function.
173 * powerpc.cc (class Powerpc_relobj): New.
174 (class Powerpc_relocate_functions): Delete all psymval variants or
175 convert to value,addend type. Delete pcrela, pcrela_unaligned.
176 Implement _ha functions using corresponding _hi function.
177 (Powerpc_relobj::find_special_sections): New function.
178 (Target_powerpc::do_make_elf_object): New function.
179 (class Output_data_got_powerpc): New.
180 (class Output_data_glink): New.
181 (class Powerpc_scan_relocatable_reloc): New.
182 Many more changes througout file.
184 2012-08-09 Nick Clifton <nickc@redhat.com>
186 * po/vi.po: Updated Vietnamese translation.
188 2012-08-07 Ian Lance Taylor <iant@google.com>
190 * layout.cc (Layout::add_target_dynamic_tags): If
191 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
194 2012-07-30 Nick Clifton <nickc@redhat.com>
196 * po/gold.pot: Updated template.
197 * po/es.po: Updated Spanish translation.
199 2012-07-18 Cary Coutant <ccoutant@google.com>
202 * configure.ac: Add check for -gpubnames support.
203 * configure: Regenerate.
204 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
205 support; force -gno-pubnames.
206 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
208 (gdb_index_test_4): New test.
209 * testsuite/Makefile.in: Regenerate.
210 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
211 * testsuite/gdb_index_test_2.sh: Likewise.
212 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
213 * testsuite/gdb_index_test_4.sh: New script.
214 * testsuite/gdb_index_test_comm.sh: New script with common code;
215 don't look for space after colon.
217 2012-07-16 Sriraman Tallam <tmsriram@google.com>
219 * gold.cc (queue_middle_tasks): Update function order only after
220 deferred objects due to plugins are processed.
222 2012-07-11 Ian Lance Taylor <iant@google.com>
224 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
225 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
226 (Target_arm::scan_reloc_for_stub): Likewise.
227 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
228 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
229 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
230 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
231 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
233 2012-07-10 Dodji Seketeli <dodji@redhat.com>
234 Ian Lance Taylor <iant@google.com>
237 * configure.ac: Test whether std::tr1::hash<off_t> works.
238 * gold.h: Add a specialization for std::tr1::hash<off_t> if
240 * output.h (class Output_fill): Add virtual destructor.
241 * configure, config.in: Rebuild.
243 2012-06-22 Roland McGrath <mcgrathr@google.com>
245 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
247 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
249 * plugin.cc (Plugin::load): Handle position independent executables.
251 2012-06-06 Cary Coutant <ccoutant@google.com>
253 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
255 (lines_only_debug_sections): Likewise.
256 (gdb_fast_lookup_sections): New static array.
257 (is_gdb_debug_section): Rename formal parameter.
258 (is_lines_only_debug_section): Likewise.
259 (is_gdb_fast_lookup_section): New function.
260 (Layout::include_section): Check for ".zdebug_" prefix; pass
261 section name suffix to is_gdb_debug_section, et al.; check for
262 fast-lookup sections when building .gdb_index.
263 * options.h (--strip-debug-gdb): Update GDB version number.
265 2012-06-06 Cary Coutant <ccoutant@google.com>
267 * configure.ac: Add check for fallocate.
268 * configure: Regenerate.
269 * config.in: Regenerate.
271 * options.h (class General_options): Add --mmap-output-file and
272 --posix-fallocate options.
273 * output.cc: (posix_fallocate): Remove; replace with...
274 (gold_fallocate): New function.
275 (Output_file::map_no_anonymous): Call gold_fallocate.
276 (Output_file::map): Check --mmap-output-file option.
278 2012-06-05 Jing Yu <jingyu@google.com>
280 * gold.h (textdomain): Add do {} to empty while(0).
281 (bindtextdomain): Likewise.
283 2012-06-04 Cary Coutant <ccoutant@google.com>
285 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
288 2012-05-25 Sriraman Tallam <tmsriram@google.com>
290 * symtab.cc (Symbol_table::define_special_symbol):
291 Initialize *poldsym to prevent uninitialized variable errors.
293 2012-05-23 Cary Coutant <ccoutant@google.com>
295 * layout.cc (Layout::section_name_mapping): Add rules to handle
296 exact match on .data.rel.ro.local or .data.rel.ro.
297 (Layout::output_section_name): Check for exact matches.
299 2012-05-23 Cary Coutant <ccoutant@google.com>
301 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
304 2012-05-22 Cary Coutant <ccoutant@google.com>
306 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
307 object before exporting symbol.
309 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
311 * testsuite/tls_test.cc: Include "config.h" first.
312 * testsuite/tls_test_c.c: Likewise.
314 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
315 Nick Clifton <nickc@redhat.com>
318 * configure.in: Add check that sysdep.h has been included before
319 any system header files.
320 * configure: Regenerate.
321 * config.in: Regenerate.
323 2012-05-14 Cary Coutant <ccoutant@google.com>
325 * layout.cc (Layout::make_output_section): Mark .tdata section
327 * testsuite/relro_test.cc: Add a TLS variable.
329 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
332 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
333 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
336 2012-05-08 Cary Coutant <ccoutant@google.com>
338 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
339 (lines_only_debug_sections): Likewise.
341 2012-05-02 Roland McGrath <mcgrathr@google.com>
345 * Makefile.am (CCFILES, HFILES): Add them.
346 * Makefile.in: Regenerate.
347 * i386.cc (Output_data_plt_i386_nacl): New class.
348 (Output_data_plt_i386_nacl_exec): New class.
349 (Output_data_plt_i386_nacl_dyn): New class.
350 (Target_i386_nacl): New class.
351 (Target_selector_i386_nacl): New class.
352 (target_selector_i386): Use it instead of Target_selector_i386.
353 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
354 (Target_x86_64_nacl): New class.
355 (Target_selector_x86_64_nacl): New class.
356 (target_selector_x86_64, target_selector_x32): Use it instead of
357 Target_selector_x86_64.
358 * arm.cc (Output_data_plt_arm_nacl): New class.
359 (Target_arm_nacl): New class.
360 (Target_selector_arm_nacl): New class.
361 (target_selector_arm, target_selector_armbe): Use it instead of
364 * target-select.cc (select_target): Take new Input_file* and off_t
365 arguments, pass them on to recognize method of selector.
366 * object.cc (make_elf_sized_object): Update caller.
367 * parameters.cc (parameters_force_valid_target): Likewise.
368 * incremental.cc (make_sized_incremental_binary): Likewise.
369 * target-select.h: Update decl.
370 (Target_selector::recognize): Take new Input_file* argument,
371 pass it on to do_recognize.
372 (Target_selector::do_recognize): Take new Input_file* argument.
373 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
374 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
375 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
376 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
378 * target.h (Target::Target_info): New members isolate_execinstr
380 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
381 * arm.cc (Target_arm::arm_info): Update initializer.
382 * i386.cc (Target_i386::i386_info): Likewise.
383 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
384 * sparc.cc (Target_sparc::sparc_info): Likewise.
385 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
386 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
387 * layout.cc (Layout::attach_allocated_section_to_segment):
388 Take new const Target* argument. If target->isolate_execinstr(), act
390 (Layout::find_first_load_seg): Take new const Target* argument;
391 if target->isolate_execinstr(), reject PF_X segments.
392 (Layout::relaxation_loop_body): Update caller.
393 (Layout::set_segment_offsets): If target->isolate_execinstr(),
394 reset file offset to zero when we hit LOAD_SEG, and then do a second
395 loop over the segments before LOAD_SEG to reassign offsets after
396 addresses have been determined. Handle target->rosegment_gap().
397 (Layout::attach_section_to_segment): Take new const Target* argument;
398 pass it to attach_allocated_section_to_segment.
399 (Layout::make_output_section): Update caller.
400 (Layout::attach_sections_to_segments): Take new const Target* argument;
401 pass it to attach_section_to_segment.
402 * gold.cc (queue_middle_tasks): Update caller.
403 * layout.h (Layout): Update method decls with new arguments.
405 * arm.cc (Target_arm::Target_arm): Take optional argument for the
406 Target_info pointer to use.
407 (Target_arm::do_make_data_plt): New virtual method.
408 (Target_arm::make_data_plt): New method that calls it.
409 (Target_arm::make_plt_entry): Use it.
410 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
411 for the section alignment.
412 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
414 (Output_data_plt_arm::first_plt_entry_offset): Call it.
415 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
417 (Output_data_plt_arm::get_plt_entry_size): Call it.
418 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
419 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
420 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
422 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
423 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
424 method instead of sizeof(plt_entry).
425 (Output_data_plt_arm::add_entry): Likewise.
426 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
427 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
429 (Target_arm::plt_entry_size): Likewise.
430 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
432 (Output_data_plt_arm_standard): ... here, new class.
433 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
434 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
435 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
437 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
438 Take additional argument for the PLT entry size.
439 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
440 Use get_plt_entry_size method rather than plt_entry_size variable.
441 (Output_data_plt_x86_64::reserve_slot): Likewise.
442 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
443 (Output_data_plt_x86_64::add_entry): Likewise.
444 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
445 (Output_data_plt_x86_64::address_for_global): Likewise.
446 (Output_data_plt_x86_64::address_for_local): Likewise.
447 (Output_data_plt_x86_64::set_final_data_size): Likewise.
448 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
449 Make method non-static.
450 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
452 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
453 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
454 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
455 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
457 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
458 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
460 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
461 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
463 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
464 (Output_data_plt_x86_64::plt_entry_size)
465 (Output_data_plt_x86_64::first_plt_entry)
466 (Output_data_plt_x86_64::plt_entry)
467 (Output_data_plt_x86_64::tlsdesc_plt_entry)
468 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
469 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
470 (Output_data_plt_x86_64_standard): ... here, new class.
471 (Target_x86_64::Target_x86_64): Take optional argument for the
472 Target_info pointer to use.
473 (Target_x86_64::do_make_data_plt): New virtual method.
474 (Target_x86_64::make_data_plt): New method to call it.
475 (Target_x86_64::init_got_plt_for_update): Use that.
476 Call this->plt_->add_eh_frame method here.
477 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
478 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
479 rather than static method.
480 (Target_x86_64::plt_entry_size): Likewise.
481 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
482 rather than plt_entry_size variable. Move guts of PLT filling to...
483 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
484 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
485 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
487 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
488 additional argument for the section alignment.
489 Don't do add_eh_frame_for_plt here.
490 (Output_data_plt_i386::first_plt_entry_offset): Make the method
491 non-static. Use get_plt_entry_size method rather than plt_entry_size
493 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
495 (Output_data_plt_i386::get_plt_entry_size): Call it.
496 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
497 (Output_data_plt_i386::add_eh_frame): New method to call it.
498 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
500 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
501 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
503 (Output_data_plt_i386::fill_plt_entry): New method to call it.
504 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
505 method instead of plt_entry_size.
506 (Output_data_plt_i386::plt_entry_size)
507 (Output_data_plt_i386::plt_eh_frame_fde_size)
508 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
509 (Output_data_plt_i386_standard): ... here, new class.
510 (Output_data_plt_i386_exec): New class.
511 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
512 (Output_data_plt_i386_exec::first_plt_entry): ... here.
513 (Output_data_plt_i386::exec_plt_entry): Move to ...
514 (Output_data_plt_i386_exec::plt_entry): ... here.
515 (Output_data_plt_i386_dyn): New class.
516 (Output_data_plt_i386::first_plt_entry): Move to ...
517 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
518 (Output_data_plt_i386::dyn_plt_entry): Move to ...
519 (Output_data_plt_i386_dyn::plt_entry): ... here.
520 (Target_i386::Target_i386): Take optional argument for the Target_info
522 (Target_i386::do_make_data_plt): New virtual method.
523 (Target_i386::make_data_plt): New method to call it.
524 (Target_i386::make_plt_section): Use that.
525 Call this->plt_->add_eh_frame method here.
526 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
527 rather than plt_entry_size variable.
528 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
529 (Output_data_plt_i386::address_for_local): Likewise.
530 (Output_data_plt_i386::do_write): Likewise.
531 Move guts of PLT filling to...
532 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
533 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
534 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
535 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
537 2012-05-01 Cary Coutant <ccoutant@google.com>
539 * dwarf_reader.cc (Dwarf_die::read_attributes)
540 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
541 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
542 * reduced_debug_output.cc
543 (Output_reduced_debug_info_section::get_die_end): Remove
544 DW_FORM_GNU_ref_index. Add default case.
546 2012-04-26 Mark Wielaard <mjw@redhat.com>
548 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
549 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
550 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
551 DW_AT_high_pc as offset from DW_AT_low_pc.
553 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
554 * testsuite/Makefile.in: Regenerate.
555 * testsuite/gdb_index_test_3.c: New test source file.
556 * testsuite/gdb_index_test_3.sh: New test source file.
558 2012-04-25 Ian Lance Taylor <iant@google.com>
560 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
562 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
563 as a class, not a struct.
564 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
565 (Target_arm::apply_cortex_a8_workaround): Likewise.
566 * gc.h: Declare Reloc_types as a struct, not a class.
567 * object.h: Declare Symbols_data as a struct.
568 * reloc.h: Declare Read_relocs_data as a struct.
569 * target.h: Declare Relocate_info as a struct.
571 2012-04-24 David S. Miller <davem@davemloft.net>
573 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
574 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
577 2012-04-24 Cary Coutant <ccoutant@google.com>
579 * incremental-dump.cc (find_input_containing_global): Replace
580 magic number with symbolic constant.
581 (dump_incremental_inputs): Update version number.
582 * incremental.cc (Output_section_incremental_inputs): Update version
583 number; import symbolic constants from Incremental_inputs_reader.
584 (Incremental_inputs::create_data_sections): Align relocations
585 section correctly for 64-bit targets.
586 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
587 constants; add padding.
588 (Output_section_incremental_inputs::write_header): Add assert for
590 (Output_section_incremental_inputs::write_input_files): Add assert
591 for input_entry_size.
592 (Output_section_incremental_inputs::write_info_blocks): Add padding;
593 add assert for object_info_size, input_section_entry_size,
594 global_sym_entry_size.
595 * incremental.h (Incremental_inputs_reader): Add symbolic constants
596 for data structure sizes; use them.
597 (Incremental_input_entry_reader): Import symbolic constants from
598 Incremental_inputs_reader; use them.
600 2012-04-23 David S. Miller <davem@davemloft.net>
602 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
604 (Target_sparc::Target_sparc): Initialize new fields.
605 (Target_sparc::do_make_elf_object): New function.
606 (Target_sparc::do_adjust_elf_header): New function.
608 2012-04-23 Cary Coutant <ccoutant@google.com>
610 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
611 CU range table of gdb index.
613 2012-04-20 David S. Miller <davem@davemloft.net>
615 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
618 2012-04-16 David S. Miller <davem@davemloft.net>
620 * sparc.cc (Target_sparc::got_address): New function.
621 (Sparc_relocate_functions::gdop_hix22): New function.
622 (Sparc_relocate_functions::gdop_lox10): New function.
623 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
625 (Target_sparc::Scan::local): Likewise if the global symbol is not
626 preemptible and is not IFUNC.
627 (Target_sparc::Relocate::relocate): Perform GOTDATA code
628 transformations for local and non-preemptible non-IFUNC global
631 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
632 writing out 64-bit part of ranges.
634 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
635 -fpic and -fpie respectively.
636 * Makefile.in: Regenerate.
638 * sparc.cc (class Target_sparc): Add rela_ifunc_.
639 (Target_sparc::Target_sparc): Initialize new field.
640 (Target_sparc::do_plt_section_for_global): New function.
641 (Target_sparc::do_plt_section_for_local): New function.
642 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
643 (Target_sparc::make_plt_section): New function, broken out of
644 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
645 (Target_sparc::make_plt_entry): Call make_plt_section.
646 (Target_sparc::make_local_ifunc_plt_entry): New function.
647 (Target_sparc::rela_ifunc_section): New function.
648 (Target_sparc::plt_section): Remove const.
649 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
650 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
651 and ifunc_count_ fields.
652 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
653 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
654 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
655 (Output_data_plt_sparc::rela_ifunc): New function.
656 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
657 (Output_data_plt_sparc::has_ifunc_section): New function.
658 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
659 (Output_data_plt_sparc::address_for_global): New function.
660 (Output_data_plt_sparc::address_for_local): New function.
661 (Output_data_plt_sparc::plt_index_to_offset): New function.
662 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
664 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
666 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
667 R_SPARC_JMP_IREL to switch.
668 (Target_sparc::Scan::check_non_pic): Likewise.
669 (Target_sparc::Scan::local): Handle IFUNC symbols.
670 (Target_sparc::Scan::local): Likewise.
671 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
672 and plt_address_for_local.
673 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
674 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
676 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
677 (class Output_data_reloc): Adjust calls to Output_reloc_type.
678 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
679 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
681 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
682 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
684 * sparc.cc (Target_sparc::Scan::global): Likewise.
685 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
687 2012-04-16 Cary Coutant <ccoutant@google.com>
689 * archive.cc (Library_base::should_include_member): Check for
690 --export-dynamic-symbol.
691 * options.h (class General_options): Add --export-dynamic-symbol.
692 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
693 --export-dynamic-symbol.
694 (Symbol_table::gc_mark_undef_symbols): Likewise.
695 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
697 2012-04-12 David S. Miller <davem@davemloft.net>
699 * sparc.cc (Reloc::wdisp10): New relocation method.
700 (Reloc::h34): Likewise.
701 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
702 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
704 (Target_sparc::Scan::local): Likewise.
705 (Target_sparc::Scan::global): Likewise.
706 (Target_sparc::Relocate::relocate): Likewise.
708 2012-04-09 Cary Coutant <ccoutant@google.com>
710 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
713 2012-04-06 Ian Lance Taylor <iant@google.com>
715 * timer.cc: #include <unistd.h>.
717 2012-04-06 Roland McGrath <mcgrathr@google.com>
719 * configure.in (AC_CHECK_HEADERS): Add locale.h.
720 * config.in: Regenerate.
721 * configure: Regenerate.
723 2012-04-05 Nick Clifton <nickc@redhat.com>
725 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
726 (AM_LC_MESSAGES): Add.
727 * aclocal.m4: Regenerate.
728 * config.in: Regenerate.
729 * configure: Regenerate.
731 2012-03-21 Cary Coutant <ccoutant@google.com>
733 * Makefile.am: Add gdb-index.cc, gdb-index.h.
734 * Makefile.in: Regenerate.
735 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
736 (Sized_elf_reloc_mapper::symbol_section): New function.
737 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
738 (make_elf_reloc_mapper): New function.
739 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
740 (Dwarf_abbrev_table::do_read_abbrevs): New function.
741 (Dwarf_abbrev_table::do_get_abbrev): New function.
742 (Dwarf_ranges_table::read_ranges_table): New function.
743 (Dwarf_ranges_table::read_range_list): New function.
744 (Dwarf_pubnames_table::read_section): New function.
745 (Dwarf_pubnames_table::read_header): New function.
746 (Dwarf_pubnames_table::next_name): New function.
747 (Dwarf_die::Dwarf_die): New function.
748 (Dwarf_die::read_attributes): New function.
749 (Dwarf_die::skip_attributes): New function.
750 (Dwarf_die::set_name): New function.
751 (Dwarf_die::set_linkage_name): New function.
752 (Dwarf_die::attribute): New function.
753 (Dwarf_die::string_attribute): New function.
754 (Dwarf_die::int_attribute): New function.
755 (Dwarf_die::uint_attribute): New function.
756 (Dwarf_die::ref_attribute): New function.
757 (Dwarf_die::child_offset): New function.
758 (Dwarf_die::sibling_offset): New function.
759 (Dwarf_info_reader::check_buffer): New function.
760 (Dwarf_info_reader::parse): New function.
761 (Dwarf_info_reader::do_parse): New function.
762 (Dwarf_info_reader::do_read_string_table): New function.
763 (Dwarf_info_reader::lookup_reloc): New function.
764 (Dwarf_info_reader::get_string): New function.
765 (Dwarf_info_reader::visit_compilation_unit): New function.
766 (Dwarf_info_reader::visit_type_unit): New function.
767 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
768 Sized_elf_reloc_mapper.
769 (Sized_dwarf_line_info::symbol_section): Remove function.
770 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
771 (Sized_dwarf_line_info::read_line_mappings): Remove object
772 parameter, adjust callers.
773 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
774 * dwarf_reader.h: Include <sys/types.h>.
775 (class Track_relocs): Remove forward declaration.
776 (class Elf_reloc_mapper): New class.
777 (class Sized_elf_reloc_mapper): New class.
778 (class Dwarf_abbrev_table): New class.
779 (class Dwarf_range_list): New class.
780 (class Dwarf_ranges_table): New class.
781 (class Dwarf_pubnames_table): New class.
782 (class Dwarf_die): New class.
783 (class Dwarf_info_reader): New class.
784 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
785 (Sized_dwarf_line_info::symbol_section): Remove member function.
786 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
788 * gdb-index.cc: New source file.
789 * gdb-index.h: New source file.
790 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
791 and .debug_types sections, call Layout::add_to_gdb_index.
792 (Sized_relobj_incr::do_section_name): Implement.
793 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
794 return type; Implement.
795 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
797 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
798 parameter list and return type.
799 (Sized_incr_dynobj::do_section_contents): Likewise.
800 * layout.cc: Include gdb-index.h.
801 (Layout::Layout): Initialize gdb_index_data_.
802 (Layout::init_fixed_output_section): Check for .gdb_index section.
803 (Layout::add_to_gdb_index): New function. Instantiate.
804 * layout.h: Add forward declaration for class Gdb_index.
805 (Layout::add_to_gdb_index): New member function.
806 (Layout::gdb_index_data_): New data member.
807 * main.cc: Include gdb-index.h.
808 (main): Print statistics for gdb index.
809 * object.cc (Object::section_contents): Move code into
811 (need_decompressed_section): Check for sections needed when building
813 (build_compressed_section_map): Likewise.
814 (Sized_relobj_file::do_read_symbols): Need local symbols when building
816 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
817 sections; call Layout::add_to_gdb_index.
818 (Sized_relobj_file::do_decompressed_section_contents): Call
819 do_section_contents directly.
820 * object.h (Object::do_section_contents): Adjust parameter list and
822 (Object::do_decompressed_section_contents): Call do_section_contents
824 (Sized_relobj_file::do_section_contents): Adjust parameter list and
826 * options.h (class General_options): Add --gdb-index option.
827 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
828 list and return type.
829 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
830 * reloc.h (Track_relocs::checkpoint): New function.
831 (Track_relocs::reset): New function.
833 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
835 * testsuite/Makefile.in: Regenerate.
836 * testsuite/gdb_index_test.cc: New test source file.
837 * testsuite/gdb_index_test_1.sh: New test source file.
838 * testsuite/gdb_index_test_2.sh: New test source file.
840 2012-03-19 Doug Kwan <dougkwan@google.com>
842 * arm.cc (Target_arm::do_define_standard_symbols): New method.
843 (Target_arm::do_finalize_sections): Remove code which defines
844 __exidx_start and __exidx_end. Make symbol table parameter
845 anonymous as it is not used.
846 * gold.cc (queue_middle_tasks): Call target hook to define any
847 target-specific symbols.
848 * target.h (Target::define_standard_symbols): New method.
849 (Target::do_define_standard_symbols): Same.
850 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
851 * testsuite/Makefile.in: Regenerate.
852 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
854 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
855 relocations are generated for __exidx_start and __exidx_end.
857 2012-03-16 Doug Kwan <dougkwan@google.com>
859 * testsuite/Makefile.am: Disable test initpri3b.
860 * testsuite/Makefile.in: Regenerate.
862 2012-03-15 Doug Kwan <dougkwan@google.com>
864 * arm.cc (Target_arm::got_section): Make .got section read-only
867 2012-03-15 Ian Lance Taylor <iant@google.com>
870 * layout.cc (Layout::make_output_section): Correctly mark
871 SHT_INIT_ARRAY, et. al., as relro.
873 2012-03-14 Doug Kwan <dougkwan@google.com>
875 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
876 dynamic relocations for protected symbols in shared objects.
878 2012-03-13 Ian Lance Taylor <iant@google.com>
880 * resolve.cc (Symbol_table::resolve): When merging common symbols,
881 keep the larger alignment.
883 2012-03-12 Cary Coutant <ccoutant@google.com>
885 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
886 handling of DW_LNE_define_file.
888 2012-03-12 Cary Coutant <ccoutant@google.com>
890 * reduced_debug_output.cc
891 (Output_reduced_debug_info_section::get_die_end): Add new FORM
894 2012-02-29 Cary Coutant <ccoutant@google.com>
896 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
898 2012-02-29 Cary Coutant <ccoutant@google.com>
900 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
901 Call Object::decompressed_section_contents.
902 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
904 (Sized_dwarf_line_info::buffer_start_): New data member.
905 * merge.cc (Output_merge_data::do_add_input_section): Call
906 Object::decompressed_section_contents.
907 (Output_merge_string::do_add_input_section): Likewise.
908 * object.cc (need_decompressed_section): New function.
909 (build_compressed_section_map): Decompress sections needed later.
910 (Sized_relobj_file::do_decompressed_section_contents): New function.
911 (Sized_relobj_file::do_discard_decompressed_sections): New function.
912 * object.h (Object::decompressed_section_contents): New function.
913 (Object::discard_decompressed_sections): New function.
914 (Object::do_decompressed_section_contents): New function.
915 (Object::do_discard_decompressed_sections): New function.
916 (Compressed_section_info): New type.
917 (Compressed_section_map): Include decompressed section contents.
918 (Sized_relobj_file::do_decompressed_section_contents): New function.
919 (Sized_relobj_file::do_discard_decompressed_sections): New function.
921 2012-02-16 Cary Coutant <ccoutant@google.com>
923 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
924 * testsuite/Makefile.in: Regenerate.
926 2012-02-14 Cary Coutant <ccoutant@google.com>
928 * options.cc (General_options::finalize): Disallow -pie and -static.
930 2012-02-03 Doug Kwan <dougkwan@google.com>
932 * arm.cc (Arm_relocate_functions::abs8,
933 Arm_relocate_functions::abs16): Use
934 Bits::has_signed_unsigned_overflow32.
935 (Arm_relocate_functions::thm_abs8): Correct range of
937 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
940 2012-02-02 Doug Kwan <dougkwan@google.com>
942 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
943 position independent outputs, not just shared objects.
945 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
947 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
948 * configure: Regenerated.
950 2012-01-27 Ian Lance Taylor <iant@google.com>
952 * reloc.h (Bits): New class with static functions, copied from
953 namespace utils in arm.cc.
954 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
957 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
959 * incremental.cc (write_info_blocks): Correct relocation offset.
961 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
963 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
964 (Relocate::tls_gd_to_le): Likewise.
966 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
968 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
970 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
972 * configure.ac: Check if -mcmodel=medium works.
973 * configure: Regenerated.
975 2012-01-24 Cary Coutant <ccoutant@google.com>
977 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
979 (read_unsigned_LEB_128_x): ... this new function.
980 (read_signed_LEB_128): Replaced with inline definition and ...
981 (read_signed_LEB_128_x): ... this new function.
982 * int_encoding.h (read_unsigned_LEB_128_x): New function.
983 (read_unsigned_LEB_128): Add inline definition.
984 (read_signed_LEB_128_x): New function.
985 (read_signed_LEB_128): Add inline definition.
986 * testsuite/Makefile.am (leb128_unittest): New unit test.
987 * testsuite/Makefile.in: Regenerate.
988 * testsuite/leb128_unittest.cc: New unit test.
990 2012-01-23 Ian Lance Taylor <iant@google.com>
993 * i386.cc (Target_i386::do_code_fill): When using a jmp
994 instruction, pad with nop instructions.
995 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
997 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
999 * x86_64.cc (gc_process_relocs): Add typename on types used in
1001 (scan_relocs): Likewise.
1002 (relocate_section): Likewise.
1003 (apply_relocation): Likewise.
1005 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1007 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1008 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1011 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1013 * x86_64.cc: Initial support for x32.
1015 2012-01-03 Cary Coutant <ccoutant@google.com>
1017 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1018 Use abstract base class for GOT.
1019 * gold/output.h (class Output_data_got_base): New abstract base class.
1020 (class Output_data_got): Derive from new base class, adjust ctors.
1021 (Output_data_got::reserve_slot): Make virtual; rename to
1022 do_reserve_slot; Adjust callers.
1023 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1024 pointer to abstract base class.
1025 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1027 2011-12-18 Ian Lance Taylor <iant@google.com>
1029 * object.h (Relobj::local_symbol_value): New function.
1030 (Relobj::local_plt_offset): New function.
1031 (Relobj::local_has_got_offset): New function.
1032 (Relobj::local_got_offset): New function.
1033 (Relobj::set_local_got_offset): New function.
1034 (Relobj::do_local_symbol_value): New pure virtual function.
1035 (Relobj::do_local_plt_offset): Likewise.
1036 (Relobj::do_local_has_got_offset): Likewise.
1037 (Relobj::do_local_got_offset): Likewise.
1038 (Relobj::do_set_local_got_offset): Likewise.
1039 (Sized_relobj::do_local_has_got_offset): Rename from
1040 local_has_got_offset.
1041 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1042 (Sized_relobj::do_set_local_got_offset): Rename from
1043 set_local_got_offset.
1044 (Sized_relobj_file::do_local_plt_offset): Rename from
1046 (Sized_relobj_file::do_local_symbol_value): New function.
1047 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1049 * output.cc (Output_data_got::Got_entry::write): Change object to
1050 Relobj. Use local_symbol_value.
1051 (Output_data_got::add_global_with_rel): Change rel_dyn to
1052 Output_data_reloc_generic*. Use add_global_generic.
1053 (Output_data_got::add_global_with_rela): Remove. Change all
1054 callers to use add_global_with_rel.
1055 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1056 Output_data_reloc_generic*. Use add_global_generic.
1057 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1058 callers to use add_global_pair_with_rel.
1059 (Output_data_got::add_local): Change object to Relobj*.
1060 (Output_data_got::add_local_plt): Likewise.
1061 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1062 change rel_dyn to Output_data_reloc_generic*. Use
1064 (Output_data_got::add_local_with_rela): Remove. Change all
1065 callers to use all_local_with_rel.
1066 (Output_data_got::add_local_pair_with_rel): Change object to
1067 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1068 add_output_section_generic.
1069 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1070 callers to use add_local_pair_with_rel.
1071 (Output_data_got::reserve_local): Change object to Relobj*.
1072 * output.h: (class Output_data_reloc_generic): Add pure virtual
1073 declarations for add_global_generic, add_local_generic,
1074 add_output_section_generic.
1075 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1076 functions for Output_data_reloc_generic. Update declarations for
1077 changes listed in output.cc.
1078 (class Output_data_got): Change template parameter to got_size.
1079 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1080 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1082 (Sized_relobj_incr::do_local_plt_offset): New function.
1083 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1086 2011-12-17 Cary Coutant <ccoutant@google.com>
1088 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1089 * resolve.cc (Symbol_table::resolve): Likewise.
1090 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1092 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1094 2011-12-16 Ian Lance Taylor <iant@google.com>
1096 * output.h (Output_data_reloc_generic::add): Only call
1097 add_dynamic_reloc if this is a dynamic reloc section.
1099 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1102 * target-reloc.h (apply_relocation): Replace <64, false> with
1105 2011-11-25 Nick Clifton <nickc@redhat.com>
1107 * po/it.po: New Italian translation.
1109 2011-11-17 Sterling Augustine <saugustine@google.com>
1111 * script.cc (script_include_directive): Implement.
1112 (read_script_file): New local variables name and search_path. Update
1113 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1114 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1115 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1117 2011-11-11 Sterling Augustine <saugustine@google.com>
1119 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1120 (file_or_sections_cmd): Likewise.
1122 2011-11-11 Doug Kwan <dougkwan@google.com>
1124 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1125 if --just-symbols is given.
1127 2011-11-10 Doug Kwan <dougkwan@google.com>
1130 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1131 when processing data relocs.
1132 * reloc.h (Relocate_functions::rel_unaligned): New method.
1133 (Relocate_functions::pcrel_unaligned): Ditto.
1134 (Relocate_functions::rel32_unaligned): Ditto.
1135 (Relocate_functions::pcrel32_unaligned): Ditto.
1137 2011-11-09 Doug Kwan <dougkwan@google.com>
1140 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1141 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1142 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1143 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1144 (Relocate_functions::rel_unaligned): New.
1145 (Relocate_functions::rel32_unaligned): New.
1146 * target-reloc.h (relocate_for_relocatable): Add code to handle
1147 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1148 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1149 arm_unaligned_reloc_r): New targets.
1150 * testsuite/Makefile.in: Regenerate.
1151 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1154 2011-11-02 Ian Lance Taylor <iant@google.com>
1156 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1158 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1159 * options.cc (General_options::finalize): Use library search path
1160 from configure script if specified. If not native and no sysroot,
1161 only search TOOLLIBDIR.
1162 * options.h (Search_directory::Search_directory): Change name to
1164 (General_options::add_to_library_path_with_sysroot): Change arg to
1166 * configure, Makefile.in, config.in: Rebuild.
1168 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1170 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1171 we are working around the ARM1176 Erratum.
1172 * options.h (General_options::fix_arm1176): Add option.
1173 * testsuite/Makefile.am: Add testcases, and keep current ones
1175 * testsuite/Makefile.in: Regenerate.
1176 * testsuite/arm_fix_1176.s: New file.
1177 * testsuite/arm_fix_1176.sh: Likewise.
1179 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1181 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1183 (Target_arm::may_use_blx): Remove method.
1184 (Target_arm::set_may_use_blx): Likewise.
1185 (Target_arm::may_use_v4t_interworking): New method.
1186 (Target_arm::may_use_v5t_interworking): Likewise.
1187 (Target_arm::may_use_blx_): Remove member variable.
1188 (Arm_relocate_functions::arm_branch_common): Check for v5T
1190 (Arm_relocate_functions::thumb_branch_common): Likewise.
1191 (Reloc_stub::stub_type_for_reloc): Likewise.
1192 (Target_arm::do_finalize_sections): Correct interworking checks.
1193 * testsuite/Makefile.am: Add new tests.
1194 * testsuite/Makefile.in: Regenerate.
1195 * testsuite/arm_farcall_arm_arm.s: New test.
1196 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1197 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1198 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1199 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1200 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1201 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1202 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1204 2011-10-31 Cary Coutant <ccoutant@google.com>
1207 * expression.cc (Expression::eval_with_dot): Add
1208 is_section_dot_assignment parameter.
1209 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1210 absolute and assigning to dot within a section.
1211 * script-sections.cc
1212 (Output_section_element_assignment::set_section_addresses): Pass
1213 dot_section to set_if_absolute.
1214 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1215 as is_section_dot_assignment flag to eval_with_dot.
1216 (Output_section_element_dot_assignment::set_section_addresses):
1218 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1219 parameter. Also set value if relative to dot_section; set the
1220 symbol's output_section.
1221 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1222 parameter. Adjust all callers.
1223 (Expression::eval_maybe_dot): Likewise.
1224 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1226 * testsuite/script_test_2.t: Test assignment of an absolute value
1227 to dot within an output section element.
1229 2011-10-31 Cary Coutant <ccoutant@google.com>
1231 * options.h (class General_options): Add --[no-]gnu-unique options.
1232 * symtab.cc (Symbol_table::sized_write_globals): Convert
1233 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1235 2011-10-31 Cary Coutant <ccoutant@google.com>
1238 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1239 unnecessary assertion.
1240 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1242 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1244 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1246 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1248 Change to just keep the section associated with symbol.
1249 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1250 they are externally visible and --export-dynamic is turned on.
1251 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1253 2011-10-19 Ian Lance Taylor <iant@google.com>
1256 * script-sections.cc
1257 (Output_section_element_dot_assignment::needs_output_section): New
1260 2011-10-19 Ian Lance Taylor <iant@google.com>
1263 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1264 --section-start option was seen.
1265 * options.h (General_options::any_section_start): New function.
1267 2011-10-18 David S. Miller <davem@davemloft.net>
1270 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1271 member to track relocation locations that have moved during TLS
1272 reloc optimizations.
1273 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1274 (Target_sparc::Relocate::relocate): Adjust view down by 4
1275 bytes if it matches reloc_adjust_addr_.
1276 (Target_sparc::Relocate::relocate_tls): Always move the
1277 __tls_get_addr call delay slot instruction forward 4 bytes when
1278 performing relaxation.
1280 2011-10-18 Cary Coutant <ccoutant@google.com>
1282 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1283 (Output_file::map_no_anonymous): Check for non-zero
1284 return code from posix_fallocate.
1286 2011-10-17 Cary Coutant <ccoutant@google.com>
1289 * plugin.cc (is_visible_from_outside): Check for symbols
1290 referenced from dynamic objects.
1291 * resolve.cc (Symbol_table::resolve): Don't count references
1292 from dynamic objects as references from real ELF files.
1293 * testsuite/plugin_test_2.sh: Adjust expected result.
1295 2011-10-17 Cary Coutant <ccoutant@google.com>
1297 * gold.cc: Include timer.h.
1298 (queue_middle_tasks): Stamp time.
1299 (queue_final_tasks): Likewise.
1300 * main.cc (main): Store timer in parameters. Print timers
1302 * parameters.cc (Parameters::Parameters): Initialize timer_.
1303 (Parameters::set_timer): New function.
1304 (set_parameters_timer): New function.
1305 * parameters.h (Parameters::set_timer): New function.
1306 (Parameters::timer): New function.
1307 (Parameters::timer_): New data member.
1308 (set_parameters_timer): New function.
1309 * timer.cc (Timer::stamp): New function.
1310 (Timer::get_pass_time): New function.
1311 * timer.h (Timer::stamp): New function.
1312 (Timer::get_pass_time): New function.
1313 (Timer::pass_times_): New data member.
1315 2011-10-17 Cary Coutant <ccoutant@google.com>
1317 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1318 task for members of lib groups.
1320 2011-10-17 Cary Coutant <ccoutant@google.com>
1323 * fileread.cc (File_read::find_view): Add assert.
1324 (File_read::make_view): Move bounds check (replace with assert)...
1325 (File_read::find_or_make_view): ... to here.
1327 2011-10-12 Cary Coutant <ccoutant@google.com>
1329 * output.cc (Output_file::open_base_file): Handle case where
1330 ::read returns less than requested size.
1332 2011-10-10 Cary Coutant <ccoutant@google.com>
1334 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1335 Initialize defined_count_.
1336 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1337 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1338 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1339 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1340 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1341 * incremental.h (Sized_relobj_incr::defined_count_): New data
1343 (Sized_incr_dynobj::defined_count_): New data member.
1344 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1345 Return zeroes instead of internal error.
1347 2011-10-10 Cary Coutant <ccoutant@google.com>
1350 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1351 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1352 * output.h (class Output_reloc): Add use_plt_offset flag.
1353 (Output_reloc::type_): Adjust size of bit field.
1354 (Output_reloc::use_plt_offset_): New bit field.
1355 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1356 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1357 flag. Adjust all callers.
1358 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1359 creating RELATIVE relocations.
1361 2011-10-10 Nick Clifton <nickc@redhat.com>
1363 * po/es.po: Updated Spanish translation.
1364 * po/fi.po: Updated Finnish translation.
1366 2011-10-03 Diego Novillo <dnovillo@google.com>
1368 * options.cc (parse_uint): Fix dereference of RETVAL.
1370 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1372 * layout.h (section_order_map_): New member.
1373 (get_section_order_map): New member function.
1374 * output.cc (Output_section::add_input_section): Check for patterns
1375 only when --section-ordering-file is specified.
1376 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1377 output_sections have been formed.
1378 * layout.cc (Layout_Layout): Initialize section_order_map_.
1379 * plugin.cc (update_section_order): Store order in order_map. Do not
1381 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1382 * testsuite/Makefile.in: Regenerate.
1383 * testsuite/plugin_section_order.c: New file.
1384 * testsuite/plugin_final_layout.cc: New file.
1385 * testsuite/plugin_final_layout.sh: New file.
1387 2011-09-29 Cary Coutant <ccoutant@google.com>
1389 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1391 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1392 symbols during incremental update.
1393 (Symbol_table::add_from_dynobj): Likewise.
1395 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1396 Ian Lance Taylor <iant@google.com>
1398 * symtab.cc (Symbol_table::define_special_symbol): Always
1399 canonicalize version string.
1401 2011-09-26 Cary Coutant <ccoutant@google.com>
1403 * gold.cc (queue_initial_tasks): Move option checks ...
1404 * options.cc (General_options::finalize): ... to here. Disable
1405 some options; make others fatal.
1407 2011-09-26 Cary Coutant <ccoutant@google.com>
1410 * plugin.cc (get_symbols_v2): New function.
1411 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1412 (is_referenced_from_outside): New function.
1413 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1414 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1415 (get_symbols): Pass version parameter.
1416 (get_symbols_v2): New function.
1417 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1419 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1420 (onload): Add LDPT_GET_SYMBOLS_V2.
1421 (all_symbols_read_hook): Use get_symbols_v2; check for
1422 LDPR_PREVAILING_DEF_IRONLY_EXP.
1423 * testsuite/plugin_test_3.sh: Update expected results.
1425 2011-09-23 Simon Baldwin <simonb@google.com>
1427 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1428 configuration options.
1429 * configure: Regenerate.
1430 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1431 * Makefile.in: Regenerate.
1432 * testsuite/Makefile.in: Regenerate.
1434 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1436 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1438 2011-09-19 Cary Coutant <ccoutant@google.com>
1440 * incremental.cc (can_incremental_update): Fix typo in comment.
1441 * incremental.h (can_incremental_update): Likewise.
1443 2011-09-18 Cary Coutant <ccoutant@google.com>
1445 * incremental.cc (can_incremental_update): New function.
1446 * incremental.h (can_incremental_update): New function.
1447 * layout.cc (Layout::init_fixed_output_section): Call it.
1448 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1449 * object.cc (Sized_relobj_file::do_layout): Call
1450 can_incremental_update.
1452 2011-09-13 Cary Coutant <ccoutant@google.com>
1454 * configure.ac: Check for glibc support for gnu_indirect_function
1455 support with static linking, setting automake conditional
1457 * Makefile.in: Regenerate.
1458 * configure: Regenerate.
1460 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1461 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1463 * testsuite/Makefile.in: Regenerate.
1465 2011-09-13 Cary Coutant <ccoutant@google.com>
1467 * incremental.cc (Sized_relobj_incr::do_layout): Call
1468 report_comdat_group for kept comdat sections.
1469 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1470 * testsuite/Makefile.in: Regenerate.
1471 * testsuite/incr_comdat_test_1.cc: New source file.
1472 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1473 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1474 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1476 2011-09-13 Ian Lance Taylor <iant@google.com>
1478 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1479 variable external_symbols_offset.
1481 2011-09-12 Ian Lance Taylor <iant@google.com>
1483 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1484 triggered if object has no symbols.
1486 2011-09-09 David S. Miller <davem@davemloft.net>
1488 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1489 (Output_fill_debug_line::do_write): Likewise.
1491 2011-08-29 Cary Coutant <ccoutant@google.com>
1493 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1494 casts to match formatting specs.
1495 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1497 2011-08-26 Cary Coutant <ccoutant@google.com>
1499 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1500 remaining hole size when allocating.
1501 (Layout::make_output_section): Set fill methods for debug sections.
1502 * layout.h (Free_list::Free_list_node): Move from private to
1504 (Free_list::set_min_hole_size): New function.
1505 (Free_list::begin, Free_list::end): New functions.
1506 (Free_list::min_hole_): New data member.
1507 * output.cc: Include dwarf.h.
1508 (Output_fill_debug_info::do_minimum_hole_size): New function.
1509 (Output_fill_debug_info::do_write): New function.
1510 (Output_fill_debug_line::do_minimum_hole_size): New function.
1511 (Output_fill_debug_line::do_write): New function.
1512 (Output_section::Output_section): Initialize new data member.
1513 (Output_section::set_final_data_size): Ensure patch space is larger
1514 than minimum hole size.
1515 (Output_section::do_write): Fill holes in debug sections.
1516 * output.h (Output_fill): New class.
1517 (Output_fill_debug_info): New class.
1518 (Output_fill_debug_line): New class.
1519 (Output_section::set_free_space_fill): New function.
1520 (Output_section::free_space_fill_): New data member.
1521 * testsuite/Makefile.am (incremental_test_3): Add
1522 --incremental-patch option.
1523 (incremental_test_4): Likewise.
1524 (incremental_test_5): Likewise.
1525 (incremental_test_6): Likewise.
1526 (incremental_copy_test): Likewise.
1527 (incremental_common_test_1): Likewise.
1528 * testsuite/Makefile.in: Regenerate.
1530 2011-08-26 Nick Clifton <nickc@redhat.com>
1532 * po/es.po: Updated Spanish translation.
1534 2011-08-01 Cary Coutant <ccoutant@google.com>
1536 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1537 * gold/testsuite/Makefile.in: Regenerate.
1538 * gold/testsuite/justsyms_exec.c: New source file.
1539 * gold/testsuite/justsyms_lib.c: New source file.
1541 2011-08-01 Cary Coutant <ccoutant@google.com>
1543 * layout.cc (Layout::set_segment_offsets): Don't realign text
1544 segment if -Ttext was specified.
1545 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1547 * object.h (Sized_relobj_file::e_type): New function.
1548 (Sized_relobj_file::e_type_): New data member.
1549 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1550 base address for ET_EXEC files.
1551 * target.cc (Target::do_make_elf_object_implementation): Allow
1552 ET_EXEC files with --just-symbols option.
1554 2011-07-28 Cary Coutant <ccoutant@google.com>
1556 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1557 Add thread_number parameter.
1558 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1559 * workqueue-threads.cc
1560 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1561 current thread if its thread number is greater than desired thread
1563 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1564 Add thread_number parameter.
1565 (Workqueue::should_cancel_thread): Likewise.
1566 (Workqueue::find_runnable_or_wait): Pass thread_number to
1567 should_cancel_thread.
1568 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1571 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1573 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1574 only after checking if it cannot be forced local.
1575 * symtab.h (is_externally_visible): Check if the symbol is not forced
1578 2011-07-15 Ian Lance Taylor <iant@google.com>
1580 * options.h (class General_options): Add --print-output-format.
1581 Move -EL next to -EB, for better --help output.
1582 * target-select.cc: Include <cstdio>, "options.h", and
1584 (Target_selector::do_target_bfd_name): New function.
1585 (print_output_format): New function.
1586 * target-select.h (class Target_selector): Update declarations.
1587 (Target_selector::target_bfd_name): New function.
1588 (print_output_format): Declare.
1589 * main.cc: Include "target-select.h".
1590 (main): Handle --print-output-format.
1591 * gold.cc: Include "target-select.h".
1592 (queue_initial_tasks): Handle --print-output-format when there are
1594 * parameters.cc (parameters_force_valid_target): Give a better
1595 error message if -EB/-EL does not match target.
1596 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1599 2011-07-15 Ian Lance Taylor <iant@google.com>
1601 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1602 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1603 (Output_data_plt_i386::do_write): Write address of .dynamic
1604 section to first entry in .got.plt section.
1605 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1606 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1608 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1609 section to first entry in .got.plt section.
1610 * layout.h (Layout::dynamic_section): New function.
1612 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1614 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1616 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1617 input_section_position_, and input_section_glob_.
1618 (read_layout_from_file): Call function section_ordering_specified.
1619 * layout.h (is_section_ordering_specified): New function.
1620 (section_ordering_specified): New function.
1621 (section_ordering_specified_): New boolean member.
1622 * main.cc(main): Call load_plugins after layout object is defined.
1623 * output.cc (Output_section::add_input_section): Use
1624 function section_ordering_specified to check if section ordering is
1626 * output.cc (Output_section::add_relaxed_input_section): Use
1627 function section_ordering_specified to check if section ordering is
1629 (Output_section::update_section_layout): New function.
1630 (Output_section::sort_attached_input_sections): Check if input section
1632 * output.h (Output_section::update_section_layout): New function.
1633 * plugin.cc (get_section_count): New function.
1634 (get_section_type): New function.
1635 (get_section_name): New function.
1636 (get_section_contents): New function.
1637 (update_section_order): New function.
1638 (allow_section_ordering): New function.
1639 (Plugin::load): Add the new interfaces to the transfer vector.
1640 (Plugin_manager::load_plugins): New parameter.
1641 (Plugin_manager::all_symbols_read): New parameter.
1642 (Plugin_manager::claim_file): New parameter. Save the elf object for
1644 (Plugin_manager::get_elf_object): New function.
1645 (Plugin_manager::get_view): Change to directly use the bool to check
1646 if get_view is called from claim_file_hook.
1647 * plugin.h (input_objects): New function
1648 (Plugin__manager::load_plugins): New parameter.
1649 (Plugin_manager::claim_file): New parameter.
1650 (Plugin_manager::get_elf_object): New function.
1651 (Plugin_manager::in_claim_file_handler): New function.
1652 (Plugin_manager::in_claim_file_handler_): New member.
1653 (layout): New function.
1654 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1655 handler with an extra parameter. Make the elf object before calling
1657 * testsuite/plugin_test.c (get_section_count): New function pointer.
1658 (get_section_type): New function pointer.
1659 (get_section_name): New function pointer.
1660 (get_section_contents): New function pointer.
1661 (update_section_order): New function pointer.
1662 (allow_section_ordering): New function pointer.
1663 (onload): Check if the new interfaces exist.
1665 2011-07-13 Ian Lance Taylor <iant@google.com>
1667 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1669 * x86_64.cc (Target_x86_64::got_section): Likewise.
1670 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1671 (relro_now_test_SOURCES): New variable.
1672 (relro_now_test_DEPENDENCIES): New variable.
1673 (relro_now_test_LDFLAGS): New variable.
1674 (relro_now_test_LDADD): New variable.
1675 (relro_now_test.so): New target.
1676 * testsuite/Makefile.in: Rebuild.
1678 2011-07-12 Ian Lance Taylor <iant@google.com>
1681 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1682 GLOB_DAT relocation rather than a RELATIVE relocation for a
1683 protected symbol when creating a shared library.
1684 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1685 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1686 * testsuite/protected_main_1.cc (main): Test that protected
1687 function has same address.
1689 2011-07-11 Ian Lance Taylor <iant@google.com>
1692 * options.h (class General_options): Add -Bgroup.
1693 * options.cc (General_options::finalize): If -Bgroup is set,
1694 default to --unresolved-symbols=report-all.
1695 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1696 * target-reloc.h (issue_undefined_symbol_error): Handle
1697 --unresolved-symbols=report-all.
1699 2011-07-08 Ian Lance Taylor <iant@google.com>
1702 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1703 if linker script discards key sections.
1704 (Layout::create_dynamic_symtab): Likewise.
1705 (Layout::assign_local_dynsym_offsets): Likewise.
1706 (Layout::sized_create_version_sections): Likewise.
1707 (Layout::create_interp): Likewise.
1708 (Layout::finish_dynamic_section): Likewise.
1709 (Layout::set_dynamic_symbol_size): Likewise.
1711 2011-07-08 Ian Lance Taylor <iant@google.com>
1714 * options.h (class General_options): Add --unresolved-symbols.
1715 * target-reloc.h (issue_undefined_symbol_error): Check
1716 --unresolved-symbols. Add comments.
1718 2011-07-08 Ian Lance Taylor <iant@google.com>
1720 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1721 expression more complex.
1723 2011-07-08 Ian Lance Taylor <iant@google.com>
1726 * target-reloc.h (issue_undefined_symbol_error): New inline
1727 function, broken out of relocate_section.
1728 (relocate_section): Call issue_undefined_symbol_error.
1729 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1730 there is no TLS segment if we are about to issue an undefined
1732 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1734 2011-07-08 Ian Lance Taylor <iant@google.com>
1737 * resolve.cc (Symbol_table::should_override): Add fromtype
1738 parameter. Change all callers. Give error when linking together
1739 TLS and non-TLS symbol.
1740 (Symbol_table::should_override_with_special): Add fromtype
1741 parameter. Change all callers.
1742 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1743 there is no TLS segment if we have reported some errors.
1744 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1746 2011-07-08 Ian Lance Taylor <iant@google.com>
1749 * target.h (Target::plt_address_for_global): New function.
1750 (Target::plt_address_for_local): New function.
1751 (Target::plt_section_for_global): Remove.
1752 (Target::plt_section_for_local): Remove.
1753 (Target::do_plt_address_for_global): New virtual function.
1754 (Target::do_plt_address_for_local): New virtual function.
1755 (Target::do_plt_section_for_global): Remove.
1756 (Target::do_plt_section_for_local): Remove.
1757 (Target::register_global_plt_entry): Add Symbol_table and Layout
1759 * output.cc (Output_data_got::Got_entry::write): Use
1760 plt_address_for_global and plt_address_for_local.
1761 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1762 address of output section.
1763 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1764 got_irelative_, and irelative_count_ fields. Update
1766 (Output_data_plt_i386::has_irelative_section): New function.
1767 (Output_data_plt_i386::entry_count): Add irelative_count_.
1768 (Output_data_plt_i386::set_final_data_size): Likewise.
1769 (class Target_i386): Add got_irelative_ and rel_irelative_
1770 fields. Update declarations.
1771 (Target_i386::Target_i386): Initialize new fields.
1772 (Target_i386::do_plt_address_for_global): New function replacing
1773 do_plt_section_for_global.
1774 (Target_i386::do_plt_address_for_local): New function replacing
1775 do_plt_section_for_local.
1776 (Target_i386::got_section): Create got_irelative_.
1777 (Target_i386::rel_irelative_section): New function.
1778 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1779 fields. Don't define __rel_iplt_{start,end}.
1780 (Output_data_plt_i386::add_entry): Add symtab and layout
1781 parameters. Change all callers. Use different PLT and GOT for
1783 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1784 layout parameters. Change all callers. Use different PLT and
1786 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1787 (Output_data_plt_i386::rel_irelative): New function.
1788 (Output_data_plt_i386::address_for_global): New function.
1789 (Output_data_plt_i386::address_for_local): New function.
1790 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1791 IRELATIVE GOT when changing IFUNC GOT entries.
1792 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1794 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1795 if we didn't create an IRELATIVE GOT.
1796 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1797 plt_address_for_local.
1798 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1799 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1800 got_irelative_, and irelative_count_ fields. Update
1802 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1803 Initialize new fields. Remove symtab parameter. Change all
1805 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1807 (Output_data_plt_x86_64::has_irelative_section): New function.
1808 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1809 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1810 fields. Update declarations.
1811 (Target_x86_64::Target_x86_64): Initialize new fields.
1812 (Target_x86_64::do_plt_address_for_global): New function replacing
1813 do_plt_section_for_global.
1814 (Target_x86_64::do_plt_address_for_local): New function replacing
1815 do_plt_section_for_local.
1816 (Target_x86_64::got_section): Create got_irelative_.
1817 (Target_x86_64::rela_irelative_section): New function.
1818 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1819 all callers. Don't create __rel_iplt_{start,end}.
1820 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1821 parameters. Change all callers. Use different PLT and GOT for
1823 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1824 layout parameters. Change all callers. Use different PLT and
1826 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1827 parameters. Change all callers. Use different PLT and GOT for
1829 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1830 (Output_data_plt_x86_64::rela_irelative): New function.
1831 (Output_data_plt_x86_64::address_for_global): New function.
1832 (Output_data_plt_x86_64::address_for_local): New function.
1833 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1834 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1835 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1836 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1838 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1840 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1841 symbols if we didn't create an IRELATIVE GOT.
1842 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1843 plt_address_for_local.
1844 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1845 * testsuite/ifuncvar1.c: New test file.
1846 * testsuite/ifuncvar2.c: New test file.
1847 * testsuite/ifuncvar3.c: New test file.
1848 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1849 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1850 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1851 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1852 * testsuite/Makefile.in: Rebuild.
1854 2011-07-07 Cary Coutant <ccoutant@google.com>
1856 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1857 (two_file_test_1_ndebug.o): Likewise.
1858 (two_file_test_1b_ndebug.o): Likewise.
1859 (two_file_test_2_ndebug.o): Likewise.
1860 (two_file_test_main_ndebug.o): Likewise.
1861 (incremental_test_2): Link with no-debug versions.
1863 2011-07-06 Cary Coutant <ccoutant@google.com>
1865 * gold/incremental.cc
1866 (Output_section_incremental_inputs::write_info_blocks): Check for
1867 hidden and internal symbols.
1869 2011-07-06 Cary Coutant <ccoutant@google.com>
1871 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1872 Check disposition for startup file.
1873 (Incremental_inputs::report_command_line): Ignore
1874 --incremental-startup-unchanged option.
1875 * options.cc (General_options::parse_incremental_startup_unchanged):
1877 (General_options::General_options): Initialize new data member.
1878 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1879 (General_options): Add --incremental-startup-unchanged option.
1880 (General_options::incremental_startup_disposition): New function.
1881 (General_options::incremental_startup_disposition_): New data member.
1883 2011-07-06 Cary Coutant <ccoutant@google.com>
1885 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1886 input file index to Script_info ctor.
1887 (Sized_incremental_binary::do_file_has_changed): Find the
1888 command-line argument for files named in scripts.
1889 * incremental.h (Script_info::Script_info): New ctor
1890 with input file index.
1891 (Script_info::input_file_index): New function.
1892 (Script_info::input_file_index_): New data member.
1893 (Incremental_binary::get_library): Add const.
1894 (Incremental_binary::get_script_info): Add const.
1895 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1896 * testsuite/Makefile.am (incremental_test_5): New test case.
1897 (incremental_test_6): New test case.
1898 * testsuite/Makefile.in: Regenerate.
1900 2011-07-06 Cary Coutant <ccoutant@google.com>
1902 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1903 debug output when command lines differ.
1905 2011-07-06 Cary Coutant <ccoutant@google.com>
1907 * incremental.cc (Incremental_inputs::report_command_line): Ignore
1908 --incremental-patch option.
1909 * layout.cc (Free_list::allocate): Extend allocation beyond original
1911 (Layout::make_output_section): Mark sections that should get
1913 * options.cc (parse_percent): New function.
1914 * options.h (parse_percent): New function.
1915 (DEFINE_percent): New macro.
1916 (General_options): Add --incremental-patch option.
1917 * output.cc (Output_section::Output_section): Initialize new data
1919 (Output_section::add_input_section): Print section name when out
1921 (Output_section::add_output_section_data): Likewise.
1922 (Output_section::set_final_data_size): Add patch space when
1923 doing --incremental-full.
1924 (Output_section::do_reset_address_and_file_offset): Remove patch
1926 (Output_segment::set_section_list_addresses): Print debug output
1927 only if --incremental-update.
1928 * output.h (Output_section::set_is_patch_space_allowed): New function.
1929 (Output_section::is_patch_space_allowed_): New data member.
1930 (Output_section::patch_space_): New data member.
1931 * parameters.cc (Parameters::incremental_full): New function.
1932 * parameters.h (Parameters::incremental_full): New function
1933 * testsuite/Makefile.am (incremental_test_2): Add test for
1934 --incremental-patch option.
1935 * testsuite/Makefile.in: Regenerate.
1936 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1937 (t18): Remove function body.
1939 2011-07-05 Doug Kwan <dougkwan@google.com>
1942 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1943 Arm_Address type for relocation result.
1944 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
1946 (Arm_relocate_functions::abs32): Use unaligned access.
1947 (Arm_relocate_functions::rel32): Ditto.
1948 (Arm_relocate_functions::prel31): Ditto.
1949 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1950 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1951 static data relocations.
1952 * testsuite/Makefile.in: Regnerate.
1953 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1955 2011-07-05 Ian Lance Taylor <iant@google.com>
1958 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1959 symbols if necessary.
1960 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1962 2011-07-05 Ian Lance Taylor <iant@google.com>
1965 * resolve.cc (Symbol::override_base_with_special): Simply override
1966 version with special symbol version, ignoring previous version.
1968 2011-07-05 Ian Lance Taylor <iant@google.com>
1970 * object.cc (Sized_relobj_file::include_section_group): Add
1971 information to comment about signature location.
1973 2011-07-02 Ian Lance Taylor <iant@google.com>
1976 * options.h (class General_options): Add -f and -F.
1977 * options.cc (General_options::finalize): Fatal error if -f/-F
1978 are used without -shared.
1979 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1981 2011-07-02 Ian Lance Taylor <iant@google.com>
1983 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1985 2011-07-01 Ian Lance Taylor <iant@google.com>
1989 * resolve.cc (Symbol::override_base_with_special): Don't override
1990 the version if the overriding symbol has a different name.
1991 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
1992 all callers. If we give an error about an undefined version,
1993 define the base version if necessary.
1994 * dynobj.h (class Versions): Update declaration.
1995 * testsuite/weak_alias_test_5.cc: New file.
1996 * testsuite/weak_alias_test.script: New file.
1997 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1998 and versioned_alias have the right value, and call t2.
1999 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2000 weak_alias_test_5.so.
2001 (weak_alias_test_LDADD): Likewise.
2002 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2003 * testsuite/Makefile.in: Rebuild.
2005 2011-07-01 Ian Lance Taylor <iant@google.com>
2008 * options.h (class General_options): Support -z notext.
2009 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2011 (two_file_shared_nonpic.so): Likewise.
2012 (two_file_shared_mixed.so): Likewise.
2013 (two_file_shared_mixed_1.so): Likewise.
2014 (weak_undef_lib_nonpic.so): Likewise.
2015 (alt/weak_undef_lib_nonpic.so): Likewise.
2016 (tls_test_shared_nonpic.so): Likewise.
2017 * testsuite/Makefile.in: Rebuild.
2019 2011-07-01 Ian Lance Taylor <iant@google.com>
2022 * configure.ac: Test whether static linking works, setting
2023 the automake conditional HAVE_STATIC.
2024 * testsuite/Makefile.am: Disable tests using -static if
2025 HAVE_STATIC is not true.
2026 * configure, testsuite/Makefile.in: Rebuild.
2028 2011-07-01 Ian Lance Taylor <iant@google.com>
2031 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2032 Assert if we see DW_EH_PE_indirect.
2033 * target.h (Target::ehframe_datarel_base): New function.
2034 (Target::do_ehframe_datarel_base): New target function.
2035 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2036 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2039 2011-07-01 Ian Lance Taylor <iant@google.com>
2042 * options.h (class General_options): Add
2043 --ld-generated-unwind-info.
2044 * ehframe.cc (Fde::write): Add address parameter. Change all
2045 callers. If associated with PLT, fill in address and size.
2046 (Cie::set_output_offset): Only add merge mapping if there is an
2048 (Cie::write): Add address parameter. Change all callers.
2049 (Eh_frame::add_ehframe_for_plt): New function.
2050 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2051 input_offset_ fields into union u_, with new plt field.
2052 (Fde::Fde): Adjust for new union field.
2053 (Fde::Fde) [Output_data version]: New constructor.
2054 (Fde::add_mapping): Only add merge mapping if there is an object.
2055 (class Cie): Update declarations.
2056 (class Eh_frame): Declare add_ehframe_for_plt.
2057 * layout.cc (Layout::layout_eh_frame): Break out code into
2058 make_eh_frame_section, and call it.
2059 (Layout::make_eh_frame_section): New function.
2060 (Layout::add_eh_frame_for_plt): New function.
2061 * layout.h (class Layout): Update declarations.
2062 * merge.cc (Merge_map::add_mapping): Add assertion.
2063 * i386.cc: Include "dwarf.h".
2064 (class Output_data_plt_i386): Make first_plt_entry,
2065 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2066 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2067 and plt_eh_frame_fde.
2068 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2069 boundary. Call add_eh_frame_for_plt if appropriate.
2070 * x86_64.cc: Include "dwarf.h".
2071 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2072 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2073 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2074 and plt_eh_frame_fde.
2075 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2078 2011-06-29 Ian Lance Taylor <iant@google.com>
2081 * object.cc (Sized_relobj_file::layout_section): Change shdr
2082 parameter to be const.
2083 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2085 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2086 appropriate. Call layout_eh_frame_section.
2087 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2089 * object.h (class Sized_relobj_file): Update declarations.
2091 2011-06-29 Ian Lance Taylor <iant@google.com>
2094 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2096 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2098 2011-06-29 Ian Lance Taylor <iant@google.com>
2101 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2103 * layout.cc (Layout::layout_eh_frame): Likewise.
2105 2011-06-29 Ian Lance Taylor <iant@google.com>
2108 * layout.cc (Layout::symtab_section_shndx): New function.
2109 * layout.h (class Layout): Declare symtab_section_shndx.
2110 * output.cc (Output_section::write_header): Call it.
2112 2011-06-29 Ian Lance Taylor <iant@google.com>
2115 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2116 symbols which are not used in a relocation.
2118 2011-06-28 Ian Lance Taylor <iant@google.com>
2121 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2122 script create indistinguishable segments.
2123 (Layout::set_segment_offsets): Use stable_sort when sorting
2124 segments. Pass this to Compare_segments constructor.
2125 * layout.h (class Layout): Make segment_precedes non-static.
2126 (class Compare_segments): Change from struct to class. Add
2127 layout_ field. Add constructor.
2128 * script-sections.cc
2129 (Script_sections::attach_sections_using_phdrs_clause): Rename
2130 local orphan to is_orphan. Don't report failure to put empty
2131 section in segment. On attachment failure, report name of
2132 section, and attach to first PT_LOAD segment.
2134 2011-06-28 Ian Lance Taylor <iant@google.com>
2137 * target-select.cc (Target_selector::Target_selector): Add
2138 emulation parameter. Change all callers.
2139 (select_target_by_bfd_name): Rename from select_target_by_name.
2141 (select_target_by_emulation): New function.
2142 (supported_emulation_names): New function.
2143 * target-select.h (class Target_selector): Add emulation_ field.
2144 Update declarations.
2145 (Target_selector::recognize_by_bfd_name): Rename from
2146 recognize_by_name. Change all callers.
2147 (Target_selector::supported_bfd_names): Rename from
2148 supported_names. Change all callers.
2149 (Target_selector::recognize_by_emulation): New function.
2150 (Target_selector::supported_emulations): New function.
2151 (Target_selector::emulation): New function.
2152 (Target_selector::do_recognize_by_bfd_name): Rename from
2153 do_recognize_by_name. Change all callers.
2154 (Target_selector::do_supported_bfd_names): Rename from
2155 do_supported_names. Change all callers.
2156 (Target_selector::do_recognize_by_emulation): New function.
2157 (Target_selector::do_supported_emulations): New function.
2158 (select_target_by_bfd_name): Change name in declaration.
2159 (select_target_by_emulation): Declare.
2160 (supported_emulation_names): Declare.
2161 * parameters.cc (parameters_force_valid_target): Try to find
2162 target based on emulation from -m option.
2163 * options.h (class General_options): Change doc string for -m.
2164 * options.cc (help): Print emulations.
2165 (General_options::parse_V): Likewise.
2166 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2167 Add emulation parameter. Change all callers.
2169 2011-06-28 Ian Lance Taylor <iant@google.com>
2171 * target.h (class Target): Add osabi_ field.
2172 (Target::osabi): New function.
2173 (Target::set_osabi): New function.
2174 (Target::Target): Initialize osabi_.
2175 (Target::do_adjust_elf_header): Make pure virtual.
2176 (Sized_target::do_adjust_elf_header): Declare.
2177 * target.cc (Sized_target::do_adjust_elf_header): New function.
2178 (class Sized_target): Instantiate all versions.
2179 * freebsd.h (class Target_freebsd): Remove.
2180 (Target_selector_freebsd::do_recognize): Call set_osabi on
2182 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2183 (Target_selector_freebsd::set_osabi): Remove.
2184 * i386.cc (class Target_i386): Inherit from Sized_target rather
2185 than Target_freebsd.
2186 * x86_64.cc (class Target_x86_64): Likewise.
2188 2011-06-28 Ian Lance Taylor <iant@google.com>
2190 * target.h (Target::can_check_for_function_pointers): Rewrite.
2192 (Target::can_icf_inline_merge_sections): Likewise.
2193 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2194 (Target::Target_info): Add can_icf_inline_merge_sections field.
2195 (Target::do_can_check_for_function_pointers): New virtual
2197 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2198 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2199 from can_check_for_function_pointers, move in file.
2200 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2201 section_may_have_icf_unsafe_poineters, move in file.
2202 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2203 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2204 Rename from can_check_for_function_pointers, move in file.
2205 (Target_i386::can_icf_inline_merge_sections): Remove.
2206 (Target_i386::i386_info): Initialize
2207 can_icf_inline_merge_sections.
2208 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2209 Initialize can_icf_inline_merge_sections.
2210 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2211 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2212 Rename from can_check_for_function_pointers, move in file.
2213 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2214 (Target_x86_64::x86_64_info): Initialize
2215 can_icf_inline_merge_sections.
2216 * testsuite/testfile.cc (Target_test::test_target_info):
2218 * icf.cc (get_section_contents): Correct formatting.
2220 2011-06-27 Ian Lance Taylor <iant@google.com>
2222 * symtab.cc (Symbol::versioned_name): New function.
2223 (Symbol_table::add_to_final_symtab): Use versioned_name when
2225 (Symbol_table::sized_write_symbol): Likewise.
2226 * symtab.h (class Symbol): Declare versioned_name.
2227 * stringpool.h (class Stringpool_template): Add variant of add
2228 which takes a std::basic_string.
2229 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2230 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2231 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2232 (ver_test_12.o): New target.
2233 * testsuite/Makefile.in: Rebuild.
2235 2011-06-27 Doug Kwan <dougkwan@google.com>
2237 * arm.cc (Arm_relocate_functions::thm_jump8,
2238 Arm_relocate_functions::thm_jump11): Use a wider signed
2239 type to compute offset.
2240 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2242 * testsuite/Makefile.in: Regenerate.
2243 * testsuite/arm_branch_in_range.sh: Check test results of
2244 arm_thm_jump11 and arm_thm_jump8.
2245 * testsuite/arm_thm_jump11.s: New test source file.
2246 * testsuite/arm_thm_jump11.t: New linker script.
2247 * testsuite/arm_thm_jump8.s: New test source file.
2248 * testsuite/arm_thm_jump8.t: New linker script.
2250 2011-06-24 Ian Lance Taylor <iant@google.com>
2252 * layout.cc: Include "object.h".
2253 (ctors_sections_in_init_array): New static variable.
2254 (Layout::is_ctors_in_init_array): New function.
2255 (Layout::layout): Add entry to ctors_sections_in_init_array if
2257 * layout.h (class Layout): Declare is_ctors_in_init_array.
2258 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2259 is_ctors_reverse_view is set.
2260 (Sized_relobj_file::write_sections): Add layout parameter. Change
2261 all callers. Set is_ctors_reverse_view field of View_size.
2262 (Sized_relobj_file::reverse_words): New function.
2263 * object.h (Sized_relobj_file::View_size): Add
2264 is_ctors_reverse_view field.
2265 (class Sized_relobj_file): Update declarations.
2266 * testsuite/initpri3.c: New test.
2267 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2269 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2270 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2271 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2272 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2273 * testsuite/Makefile.in: Rebuild.
2275 2011-06-24 Cary Coutant <ccoutant@google.com>
2277 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2278 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2279 (debug_msg_cdebug.err): New targets.
2280 * testsuite/Makefile.in: Regenerate.
2281 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2282 Fix checks for link with shared library.
2284 2011-06-24 Doug Kwan <dougkwan@google.com>
2286 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2287 skip empty text sections.
2288 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2290 2011-06-22 Ian Lance Taylor <iant@google.com>
2293 * options.h (class General_options): Add --ctors-in-init-array.
2294 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2295 friends as SHT_PROGBITS for merging sections.
2296 (Layout::layout): Remove special handling of .init_array and
2297 friends. Don't sort if doing relocatable link. Sort for .ctors
2298 and .dtors if ctors_in_init_array.
2299 (Layout::make_output_section): Force correct section types for
2300 .init_array and friends. Don't sort if doing relocatable link,
2301 Don't sort .ctors and .dtors if ctors_in_init_array.
2302 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2303 (Layout::output_section_name): Add relobj parameter. Change all
2304 callers. Handle .ctors. and .dtors. in code rather than table.
2305 Handle .ctors and .dtors if ctors_in_init_array.
2306 (Layout::match_file_name): New function, moved from output.cc.
2307 * layout.h (class Layout): Update declarations.
2308 * output.cc: Include "layout.h".
2309 (Input_section_sort_entry::get_priority): New function.
2310 (Input_section_sort_entry::match_file_name): Just call
2311 Layout::match_file_name.
2312 (Output_section::Input_section_sort_init_fini_compare::operator()):
2313 Handle .ctors and .dtors. Sort by explicit priority rather than
2315 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2316 * testsuite/initpri2.c: New test.
2317 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2318 (check_PROGRAMS): Add initpri2.
2319 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2320 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2321 * configure, testsuite/Makefile.in: Rebuild.
2323 2011-06-19 Ian Lance Taylor <iant@google.com>
2326 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2327 .interp section to a PT_INTERP segment even if we have seen a
2328 --dynamic-linker option. Don't do it if we have seen a PHDRS
2329 clause in a linker script.
2330 (Layout::finalize): Don't create a .interp section if we've
2331 already create a PT_INTERP segment.
2332 (Layout::create_interp): Always call choose_output_section (revert
2333 patch of 2011-06-17). Don't create PT_INTERP segment.
2334 * script-sections.cc
2335 (Script_sections::create_note_and_tls_segments): Add a .interp
2336 section to a PT_INTERP segment even if we have seen a
2337 --dynamic-linker option.
2339 2011-06-18 Ian Lance Taylor <iant@google.com>
2341 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2342 merely because a non-PT_LOAD segment has a dynamic reloc.
2344 2011-06-18 Ian Lance Taylor <iant@google.com>
2346 * layout.cc (Layout::finish_dynamic_section): Don't create
2347 DT_FLAGS entry if not needed.
2349 2011-06-18 Ian Lance Taylor <iant@google.com>
2352 * layout.cc (Layout::layout_eh_frame): Correct handling of
2353 writable .eh_frame section.
2355 2011-06-17 Ian Lance Taylor <iant@google.com>
2358 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2359 symbol is redefined with the exact same object and value.
2361 2011-06-17 Ian Lance Taylor <iant@google.com>
2364 * layout.h (class Layout): Add interp_segment_ field.
2365 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2366 (Layout::attach_allocated_section_to_segment): If making shared
2367 library, put .interp section in PT_INTERP segment.
2368 (Layout::finalize): Also call create_interp if -dynamic-linker
2370 (Layout::create_interp): Assert that there is no PT_INTERP
2371 segment. If not using a SECTIONS clause, use make_output_section.
2372 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2373 * script-sections.cc
2374 (Script_sections::create_note_and_tls_segments): If making shared
2375 library, put .interp section in PT_INTERP segment.
2377 2011-06-17 Ian Lance Taylor <iant@google.com>
2379 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2380 when making a shared library.
2382 2011-06-17 Ian Lance Taylor <iant@google.com>
2384 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2385 parameter. Change all callers. Don't issue warning about PC32
2386 against locally defined symbol.
2388 2011-06-16 Ian Lance Taylor <iant@google.com>
2390 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2391 occurs in same object.
2393 2011-06-14 Alan Modra <amodra@gmail.com>
2395 * po/POTFILES.in: Regenerate.
2397 2011-06-09 Ian Lance Taylor <iant@google.com>
2399 * script-sections.cc
2400 (Orphan_output_section::set_section_addresses): For a relocatable
2401 link set address to 0.
2403 2011-06-09 Cary Coutant <ccoutant@google.com>
2406 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2407 used with --compress-debug-sections.
2408 * gold/object.cc (Sized_relobj_file::do_layout): Report
2409 uncompressed size of compressed input sections.
2411 2011-06-08 Cary Coutant <ccoutant@google.com>
2414 * testsuite/two_file_test_2_v1.cc: Change initialization of
2415 v2 to keep it in .data.
2417 2011-06-07 Cary Coutant <ccoutant@google.com>
2419 * common.cc (Symbol_table::do_allocate_commons_list): Call
2421 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2422 (Errors::fallback): New function.
2423 (gold_fallback): New function.
2424 * errors.h (Errors::fallback): New function.
2425 * gold.cc (gold_exit): Change status parameter to enum; adjust
2427 (queue_initial_tasks): Call gold_fallback.
2428 * gold.h: Include cstdlib.
2429 (Exit_status): New enum type.
2430 (gold_exit): Change status parameter to enum.
2431 (gold_fallback): New function.
2432 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2433 (Layout::create_symtab_sections): Likewise.
2434 (Layout::create_shdrs): Likewise.
2435 * main.cc (main): Adjust call to gold_exit.
2436 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2437 (Output_data_got::add_got_entry_pair): Likewise.
2438 (Output_section::add_input_section): Likewise.
2439 (Output_section::add_output_section_data): Likewise.
2440 (Output_segment::set_section_list_addresses): Likewise.
2441 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2443 2011-06-07 Cary Coutant <ccoutant@google.com>
2445 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2446 for incremental links.
2447 * output.cc (Output_segment::set_section_list_addresses): Remove
2448 FIXME and test for TLS or BSS.
2450 2011-06-07 Cary Coutant <ccoutant@google.com>
2452 * testsuite/Makefile.am: Add incremental_copy_test,
2453 incremental_common_test_1.
2454 * testsuite/Makefile.in: Regenerate.
2455 * testsuite/common_test_1_v1.c: New source file.
2456 * testsuite/common_test_1_v2.c: New source file.
2457 * testsuite/copy_test_v1.cc: New source file.
2459 2011-06-07 Cary Coutant <ccoutant@google.com>
2461 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2462 update, allocate common from bss section's free list.
2463 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2464 linker-defined symbols.
2465 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2466 Skip GOT and PLT entries that are no longer referenced.
2467 (Output_section_incremental_inputs::write_info_blocks): Mark
2468 linker-defined symbols.
2469 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2470 * output.cc (Output_section::allocate): New function.
2471 * output.h (Output_section::allocate): New function.
2472 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2473 linker-defined symbols.
2474 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2475 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2476 (Symbol::init_base_output_data): Likewise.
2477 (Symbol::init_base_output_segment): Likewise.
2478 (Symbol::init_base_constant): Likewise.
2479 (Sized_symbol::init_output_data): Likewise.
2480 (Sized_symbol::init_output_segment): Likewise.
2481 (Sized_symbol::init_constant): Likewise.
2482 (Symbol_table::do_define_in_output_data): Likewise.
2483 (Symbol_table::do_define_in_output_segment): Likewise.
2484 (Symbol_table::do_define_as_constant): Likewise.
2485 * symtab.h (Symbol::is_predefined): New function.
2486 (Symbol::init_base_output_data): Add is_predefined parameter.
2487 (Symbol::init_base_output_segment): Likewise.
2488 (Symbol::init_base_constant): Likewise.
2489 (Symbol::is_predefined_): New data member.
2490 (Sized_symbol::init_output_data): Add is_predefined parameter.
2491 (Sized_symbol::init_output_segment): Likewise.
2492 (Sized_symbol::init_constant): Likewise.
2493 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2495 2011-06-07 Cary Coutant <ccoutant@google.com>
2497 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2498 instead of emit_copy_reloc.
2499 (Copy_relocs::emit_copy_reloc): Refactor.
2500 (Copy_relocs::make_copy_reloc): New function.
2501 (Copy_relocs::add_copy_reloc): Remove.
2502 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2504 (Copy_relocs::make_copy_reloc): New function.
2505 (Copy_relocs::add_copy_reloc): Remove.
2506 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2507 unchanged input files.
2508 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2509 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2510 Reserve BSS space for COPY relocations.
2511 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2512 (Output_section_incremental_inputs::write_info_blocks): Record
2513 whether a symbol is copied from a shared object.
2514 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2515 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2516 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2517 (Incremental_input_entry_reader::get_output_symbol_index): Add
2519 (Incremental_binary::emit_copy_relocs): New function.
2520 (Incremental_binary::do_emit_copy_relocs): New function.
2521 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2523 (Sized_incremental_binary::add_copy_reloc): New function.
2524 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2525 (Sized_incremental_binary::Copy_reloc): New struct.
2526 (Sized_incremental_binary::Copy_relocs): New typedef.
2527 (Sized_incremental_binary::copy_relocs_): New data member.
2528 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2529 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2530 * target.h (Sized_target::emit_copy_reloc): New function.
2531 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2533 2011-06-02 Cary Coutant <ccoutant@google.com>
2536 * gold/archive.cc (Archive::Archive): Initialize new data member.
2537 (Archive::include_all_members): Return if archive has already been
2539 * gold/archive.h (Archive::include_all_members_): New data member.
2541 2011-06-02 Nick Clifton <nickc@redhat.com>
2543 * dynobj.h: Fix spelling mistake in comment.
2544 * output.cc: Likewise.
2546 2011-05-31 Doug Kwan <dougkwan@google.com>
2550 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2551 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2552 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2553 redundant arm_exidx_test.so.
2554 * testsuite/Makefile.in: Regenerate.
2555 (check_SCRIPTS): Add pr12826.sh
2556 (check_DATA): Add pr12826.stdout
2557 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2558 * testsuite/pr12826.sh: New file.
2559 * testsuite/pr12826_1.s: Ditto.
2560 * testsuite/pr12826_1.s: Ditto.
2562 2011-05-30 Ian Lance Taylor <iant@google.com>
2564 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2567 2011-05-29 Ian Lance Taylor <iant@google.com>
2570 * testsuite/Makefile.am: Use different file name for two_file_test
2571 temporary file for each incremental test.
2572 * testsuite/Makefile.in: Rebuild.
2574 2011-05-29 Ian Lance Taylor <iant@google.com>
2576 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2577 binary input file is empty.
2579 2011-05-27 Ian Lance Taylor <iant@google.com>
2581 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2582 (ver_test_9.so): Likewise.
2583 * testsuite/Makefile.in: Rebuild.
2585 2011-05-26 Cary Coutant <ccoutant@google.com>
2587 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2588 * incremental.cc (Incremental_inputs::report_input_section): Fix
2589 comment, indentation.
2590 (Incremental_inputs::report_comdat_group): New function.
2591 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2592 of data for incremental input file entry.
2593 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2594 group count, COMDAT group signatures.
2595 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2596 an unchanged input file.
2597 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2598 Initialize new data member.
2599 (Incremental_object_entry::add_comdat_group): New function.
2600 (Incremental_object_entry::get_comdat_group_count): New function.
2601 (Incremental_object_entry::get_comdat_signature_key): New function.
2602 (Incremental_object_entry::groups_): New data member.
2603 (Incremental_inputs::report_comdat_group): New function.
2604 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2605 data for incremental input file entry.
2606 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2607 (Incremental_input_entry_reader::get_input_section): Adjust size of
2608 data for incremental input file entry.
2609 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2610 (Incremental_input_entry_reader::get_comdat_group_signature): New
2612 * object.cc (Sized_relobj::include_section_group): Report kept
2613 COMDAT groups for incremental links.
2615 2011-05-24 David Meyer <pdox@google.com>
2617 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2618 with name parameter. Add found_name parameter.
2619 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2620 * dirsearch.h (class Dirsearch): Update declaration.
2622 2011-05-24 Ian Lance Taylor <iant@google.com>
2624 * archive.cc (Library_base::should_include_member): Pull in object
2625 from archive if it defines the entry symbol.
2626 * parameters.cc (Parameters::entry): New function.
2627 * parameters.h (class Parameters): Declare entry.
2628 * output.h (class Output_file_header): Remove entry_ field.
2629 * output.cc (Output_file_header::Output_file_header): Remove entry
2630 parameter. Change all callers.
2631 (Output_file_header::entry): Use parameters->entry.
2632 * gold.cc (queue_middle_tasks): Likewise.
2633 * plugin.cc (Plugin_hook::run): Likewise.
2635 2011-05-24 Cary Coutant <ccoutant@google.com>
2637 * gold.cc (queue_initial_tasks): Pass incremental base filename
2638 to Output_file::open_base_file; don't print error message.
2639 * incremental-dump.cc (main): Adjust call to
2640 Output_file::open_for_modification.
2641 * incremental-dump.cc (main): Likewise.
2642 * incremental.cc (Incremental_inputs::report_command_line):
2643 Ignore --incremental-base option when comparing command lines.
2644 Ignore parameter when given as separate argument.
2645 * options.h (class General_options): Add --incremental-base.
2646 * output.cc (Output_file::Output_file):
2647 (Output_file::open_base_file): Add base_name and writable parameters;
2648 read base file into new file; print error message here.
2649 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2651 * output.h (Output_file::open_for_modification): Rename to...
2652 (Output_file::open_base_file): ...this; add base_name and
2653 writable parameters; adjust all callers.
2654 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2656 * testsuite/Makefile.am (incremental_test_4): Test
2658 * testsuite/Makefile.in: Regenerate.
2660 2011-05-24 Cary Coutant <ccoutant@google.com>
2662 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2664 * testsuite/Makefile.in: Regenerate.
2665 * testsuite/two_file_test_1_v1.cc: New test source file.
2666 * testsuite/two_file_test_1b_v1.cc: New test source file.
2667 * testsuite/two_file_test_2_v1.cc: New test source file.
2669 2011-05-24 Cary Coutant <ccoutant@google.com>
2671 * dynobj.h (Dynobj::do_dynobj): New function.
2672 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2673 flag and soname for shared objects.
2674 * incremental.cc (Incremental_inputs::report_object): Make
2675 either Incremental_object_entry or Incremental_dynobj_entry; add
2676 soname to string table.
2677 (Incremental_inputs::report_input_section): Add assertion.
2678 (Output_section_incremental_inputs::set_final_data_size): Adjust
2679 type of input file entry for shared libraries; adjust size of
2680 shared library info entry.
2681 (Output_section_incremental_inputs::write_input_files): Write
2682 as_needed flag for shared libraries.
2683 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2684 of input file entry for shared libraries; write soname.
2685 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2686 soname from incremental info.
2687 * incremental.h (enum Incremental_input_flags): Add
2688 INCREMENTAL_INPUT_AS_NEEDED.
2689 (Incremental_input_entry::Incremental_input_entry): Initialize new
2691 (Incremental_input_entry::set_as_needed): New function.
2692 (Incremental_input_entry::as_needed): New function.
2693 (Incremental_input_entry::do_dynobj_entry): New function.
2694 (Incremental_input_entry::as_needed_): New data member.
2695 (Incremental_object_entry::Incremental_object_entry): Don't check
2697 (Incremental_object_entry::do_type): Likewise.
2698 (class Incremental_dynobj_entry): New class.
2699 (Incremental_input_entry_reader::as_needed): New function.
2700 (Incremental_input_entry_reader::get_soname): New function.
2701 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2702 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2703 size of shared library info entry.
2704 * layout.cc (Layout::finish_dynamic_section): Don't test for
2705 incremental link when adding DT_NEEDED entries.
2706 * object.h (Object::Object): Initialize new data member.
2707 (Object::dynobj): New function.
2708 (Object::set_as_needed): New function.
2709 (Object::as_needed): New function.
2710 (Object::do_dynobj): New function.
2711 (Object::as_needed_): New data member.
2713 2011-05-24 Cary Coutant <ccoutant@google.com>
2715 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2716 info; adjust display of GOT entries.
2717 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2718 vector of input objects; remove file_status_.
2719 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2720 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2721 got_plt reader; call target hooks to reserve GOT entries.
2722 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2723 of input file info header and GOT info entry.
2724 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2726 (Got_plt_view_info::got_descriptor): Remove.
2727 (Got_plt_view_info::sym_index): New data member.
2728 (Got_plt_view_info::input_index): New data member.
2729 (Local_got_offset_visitor::visit): Write input file index.
2730 (Global_got_offset_visitor::visit): Write 0 for input file index.
2731 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2732 with sym_index and input_index.
2733 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2734 incremental info GOT entry; replace got_descriptor with input_index.
2735 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2736 map from input file index to object.
2737 (Sized_relobj_incr::do_layout): Replace direct data member reference
2738 with accessor function.
2739 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2740 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2741 Adjust size of input file info header.
2742 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2743 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2744 (Incremental_input_entry_reader::get_input_section): Adjust size of
2745 input file info header.
2746 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2747 of incremental info GOT entry.
2748 (Incremental_got_plt_reader::get_got_desc): Remove.
2749 (Incremental_got_plt_reader::get_got_symndx): New function.
2750 (Incremental_got_plt_reader::get_got_input_index): New function.
2751 (Sized_incremental_binary::Sized_incremental_binary): Remove
2752 file_status_; add input_objects_.
2753 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2754 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2755 (Sized_incremental_binary::file_is_unchanged): Remove.
2756 (Sized_incremental_binary::set_input_object): New function.
2757 (Sized_incremental_binary::input_object): New function.
2758 (Sized_incremental_binary::file_status_): Remove.
2759 (Sized_incremental_binary::input_objects_): New data member.
2760 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2762 (Sized_relobj_incr::invalid_address): Move to base class.
2763 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2765 (Sized_relobj_incr::do_output_section_offset): Likewise.
2766 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2767 (Sized_relobj_incr::section_offsets_): Likewise.
2768 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2770 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2771 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2772 with accessor function.
2773 (Sized_relobj_file::do_layout): Likewise.
2774 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2775 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2776 (Sized_relobj_file::compute_final_local_value): Replace refs to
2777 section_offsets_ with accessor function.
2778 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2779 * object.h (Relobj::Relobj): Initialize new data members.
2780 (Relobj::add_dyn_reloc): New function.
2781 (Relobj::first_dyn_reloc): New function.
2782 (Relobj::dyn_reloc_count): New function.
2783 (Relobj::first_dyn_reloc_): New data member.
2784 (Relobj::dyn_reloc_count_): New data member.
2785 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2787 (Sized_relobj::Address): New typedef.
2788 (Sized_relobj::invalid_address): Move here from child class.
2789 (Sized_relobj::Sized_relobj): Initialize new data members.
2790 (Sized_relobj::sized_relobj): New function.
2791 (Sized_relobj::is_output_section_offset_invalid): Move here from
2793 (Sized_relobj::get_output_section_offset): Likewise.
2794 (Sized_relobj::local_has_got_offset): Likewise.
2795 (Sized_relobj::local_got_offset): Likewise.
2796 (Sized_relobj::set_local_got_offset): Likewise.
2797 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2798 (Sized_relobj::clear_got_offsets): New function.
2799 (Sized_relobj::section_offsets): Move here from child class.
2800 (Sized_relobj::do_output_section_offset): Likewise.
2801 (Sized_relobj::do_set_section_offset): Likewise.
2802 (Sized_relobj::Local_got_offsets): Likewise.
2803 (Sized_relobj::local_got_offsets_): Likewise.
2804 (Sized_relobj::section_offsets_): Likewise.
2805 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2807 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2809 (Sized_relobj_file::sized_relobj): New function
2810 (Sized_relobj_file::local_has_got_offset): Move to base class.
2811 (Sized_relobj_file::local_got_offset): Likewise.
2812 (Sized_relobj_file::set_local_got_offset): Likewise.
2813 (Sized_relobj_file::get_output_section_offset): Likewise.
2814 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2815 (Sized_relobj_file::do_output_section_offset): Likewise.
2816 (Sized_relobj_file::do_set_section_offset): Likewise.
2817 (Sized_relobj_file::Local_got_offsets): Likewise.
2818 (Sized_relobj_file::local_got_offsets_): Likewise.
2819 (Sized_relobj_file::section_offsets_): Likewise.
2820 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2822 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2823 (Output_reloc::get_symbol_index): Likewise.
2824 (Output_reloc::local_section_offset): Likewise.
2825 (Output_reloc::get_address): Likewise.
2826 (Output_reloc::symbol_value): Likewise.
2827 (Output_data_got::reserve_slot): Move to class definition.
2828 (Output_data_got::reserve_local): New function.
2829 (Output_data_got::reserve_slot_for_global): Remove.
2830 (Output_data_got::reserve_global): New function.
2831 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2832 (all constructors, two instantiations).
2833 (Output_reloc::get_relobj): New function (two instantiations).
2834 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2835 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2836 (Output_data_reloc::add_global): Adjust type of relobj.
2837 (Output_data_reloc::add_global_relative): Likewise.
2838 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2839 (Output_data_reloc::add_local): Likewise.
2840 (Output_data_reloc::add_local_relative): Likewise.
2841 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2842 (Output_data_reloc::add_local_section): Likewise.
2843 (Output_data_reloc::add_output_section): Likewise.
2844 (Output_data_reloc::add_absolute): Likewise.
2845 (Output_data_reloc::add_target_specific): Likewise.
2846 (Output_data_got::reserve_slot): Move definition here.
2847 (Output_data_got::reserve_local): New function.
2848 (Output_data_got::reserve_global): New function.
2849 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2850 section_offsets_ with accessor function.
2851 (Sized_relobj_file::write_sections): Likewise.
2852 (Sized_relobj_file::do_relocate_sections): Likewise.
2853 * target.h (Sized_target::reserve_local_got_entry): New function.
2854 (Sized_target::reserve_global_got_entry): New function.
2855 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2856 (Target_x86_64::reserve_global_got_entry): New function.
2857 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2859 2011-05-23 Cary Coutant <ccoutant@google.com>
2861 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2862 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2863 bit when checking got_type.
2864 * incremental.cc (Sized_incremental_binary::setup_readers):
2865 Store symbol table and string table locations; initialize bit vector
2866 of file status flags.
2867 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2869 (Sized_incremental_binary::do_process_got_plt): New function.
2870 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2871 (Output_section_incremental_inputs::set_final_data_size): Record
2872 file index for each input file.
2873 (Output_section_incremental_inputs::write_got_plt): Store file index
2874 instead of input entry offset for each GOT entry.
2876 (Incremental_input_entry::Incremental_input_entry): Initialize new
2878 (Incremental_input_entry::set_offset): Store file index.
2879 (Incremental_input_entry::get_file_index): New function.
2880 (Incremental_input_entry::file_index_): New data member.
2881 (Incremental_binary::process_got_plt): New function.
2882 (Incremental_binary::do_process_got_plt): New function.
2883 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2885 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2886 (Sized_incremental_binary::set_file_is_unchanged): New function.
2887 (Sized_incremental_binary::file_is_unchanged): New function.
2888 (Sized_incremental_binary::do_process_got_plt): New function.
2889 (Sized_incremental_binary::file_status_): New data member.
2890 (Sized_incremental_binary::main_symtab_loc_): New data member.
2891 (Sized_incremental_binary::main_strtab_loc_): New data member.
2892 * output.cc (Output_data_got::Got_entry::write): Add case
2894 (Output_data_got::add_global): Call add_got_entry.
2895 (Output_data_got::add_global_plt): Likewise.
2896 (Output_data_got::add_global_with_rel): Likewise.
2897 (Output_data_got::add_global_with_rela): Likewise.
2898 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2899 (Output_data_got::add_global_pair_with_rela): Likewise.
2900 (Output_data_got::add_local): Call add_got_entry.
2901 (Output_data_got::add_local_plt): Likewise.
2902 (Output_data_got::add_local_with_rel): Likewise.
2903 (Output_data_got::add_local_with_rela): Likewise.
2904 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2905 (Output_data_got::add_local_pair_with_rela): Likewise.
2906 (Output_data_got::reserve_slot): New function.
2907 (Output_data_got::reserve_slot_for_global): New function.
2908 (Output_data_got::add_got_entry): New function.
2909 (Output_data_got::add_got_entry_pair): New function.
2910 (Output_section::add_output_section_data): Edit FIXME.
2912 (Output_section_data_build::Output_section_data_build): New
2913 constructor with size parameter.
2914 (Output_data_space::Output_data_space): Likewise.
2915 (Output_data_got::Output_data_got): Initialize new data member; new
2916 constructor with size parameter.
2917 (Output_data_got::add_constant): Call add_got_entry.
2918 (Output_data_got::reserve_slot): New function.
2919 (Output_data_got::reserve_slot_for_global): New function.
2920 (class Output_data_got::Got_entry): Add RESERVED_CODE.
2921 (Output_data_got::add_got_entry): New function.
2922 (Output_data_got::add_got_entry_pair): New function.
2923 (Output_data_got::free_list_): New data member.
2924 * target.h (Sized_target::init_got_plt_for_update): New function.
2925 (Sized_target::register_global_plt_entry): New function.
2926 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2927 Initialize new data member; call init; add constructor with PLT count.
2928 (Output_data_plt_x86_64::init): New function.
2929 (Output_data_plt_x86_64::add_relocation): New function.
2930 (Output_data_plt_x86_64::reserve_slot): New function.
2931 (Output_data_plt_x86_64::free_list_): New data member.
2932 (Target_x86_64::init_got_plt_for_update): New function.
2933 (Target_x86_64::register_global_plt_entry): New function.
2934 (Output_data_plt_x86_64::add_entry): Allocate from free list for
2935 incremental updates.
2936 (Output_data_plt_x86_64::add_relocation): New function.
2937 * testsuite/object_unittest.cc (Object_test): Set default options.
2939 2011-05-16 Ian Lance Taylor <iant@google.com>
2941 * options.h (class General_options): Make -i a synonym for -r.
2943 2011-05-16 Ian Lance Taylor <iant@google.com>
2945 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2947 2011-05-10 Cary Coutant <ccoutant@google.com>
2949 * object.cc (Sized_relobj::do_count_local_symbols): Check for
2952 2011-05-06 Ian Lance Taylor <iant@google.com>
2954 * layout.cc (Layout::layout): If the output section flags change,
2955 update the ordering.
2957 2011-04-25 Cary Coutant <ccoutant@google.com>
2959 * incremental-dump.cc (dump_incremental_inputs): Print local
2960 symbol info for each input file.
2962 (Output_section_incremental_inputs::set_final_data_size): Add local
2963 symbol info to input file entries in incremental info.
2964 (Output_section_incremental_inputs::write_info_blocks): Likewise.
2965 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2966 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2967 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2969 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2970 (Sized_incr_relobj::do_relocate): Write the local symbols.
2971 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2972 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2973 Adjust size of input file header.
2974 (Incremental_inputs_reader::get_local_symbol_offset): New function.
2975 (Incremental_inputs_reader::get_local_symbol_count): New function.
2976 (Incremental_inputs_reader::get_input_section): Adjust size of input
2978 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2979 (Sized_incr_relobj::This): New typedef.
2980 (Sized_incr_relobj::sym_size): New const data member.
2981 (Sized_incr_relobj::Local_symbol): New struct.
2982 (Sized_incr_relobj::do_output_local_symbol_count): New function.
2983 (Sized_incr_relobj::do_local_symbol_offset): New function.
2984 (Sized_incr_relobj::local_symbol_count_): New data member.
2985 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2986 (Sized_incr_relobj::local_symbol_index_): New data member.
2987 (Sized_incr_relobj::local_symbol_offset_): New data member.
2988 (Sized_incr_relobj::local_dynsym_offset_): New data member.
2989 (Sized_incr_relobj::local_symbols_): New data member.
2990 * object.h (Relobj::output_local_symbol_count): New function.
2991 (Relobj::local_symbol_offset): New function.
2992 (Relobj::do_output_local_symbol_count): New function.
2993 (Relobj::do_local_symbol_offset): New function.
2994 (Sized_relobj::do_output_local_symbol_count): New function.
2995 (Sized_relobj::do_local_symbol_offset): New function.
2997 2011-04-22 Vladimir Simonov <sv@sw.ru>
2999 * descriptors.cc (set_close_on_exec): New function.
3000 (Descriptors::open): Use set_close_on_exec.
3001 * output.cc (S_ISLNK): Define if not defined.
3003 2011-04-22 Cary Coutant <ccoutant@google.com>
3005 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3007 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3008 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3009 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3011 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3012 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3013 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3015 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3017 (Incremental_binary::apply_incremental_relocs): New function.
3018 (Incremental_binary::do_apply_incremental_relocs): New function.
3019 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3021 (Sized_incremental_binary::add_global_symbol): New function.
3022 (Sized_incremental_binary::global_symbol): New function.
3023 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3024 (Sized_incremental_binary::symbol_map_): New data member.
3025 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3026 * target.h (Sized_target::apply_relocation): New function.
3027 * target-reloc.h (apply_relocation): New function.
3028 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3030 2011-04-22 Doug Kwan <dougkwan@google.com>
3032 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3033 flag of a SHT_ARM_EXIDX section.
3034 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3035 * testsuite/Makefile.in: Regenerate.
3036 * testsuite/arm_exidx_test.s: New file.
3037 * testsuite/arm_exidx_test.sh: Same.
3039 2011-04-20 Cary Coutant <ccoutant@google.com>
3042 * archive.h (Incremental_archive_entry::Archive_member):
3043 Initialize arg_serial_ (second constructor).
3045 2011-04-17 Ian Lance Taylor <iant@google.com>
3047 * object.cc (Relocate_info::location): Simplify location string.
3048 * errors.cc (Errors::error_at_location): Don't print program
3050 (Errors::warning_at_location): Likewise.
3051 (Errors::undefined_symbol): Likewise.
3052 * testsuite/debug_msg.sh: Update accordingly.
3054 2011-04-14 Cary Coutant <ccoutant@google.com>
3056 * gold/layout.cc (Layout::symtab_section_offset): New function.
3057 * gold/layout.h (Layout::symtab_section_offset): New function.
3058 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3060 2011-04-12 Ian Lance Taylor <iant@google.com>
3062 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3063 with MREMAP_MAYMOVE.
3064 * output.h (class Output_file): Add map_is_allocated_ field.
3065 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3066 not available, provide stubs. If mremap is not available, #define
3068 (MREMAP_MAYMOVE): Define if not defined.
3069 (Output_file::Output_file): Initialize map_is_allocated_.
3070 (Output_file::resize): Check map_is_allocated_.
3071 (Output_file::map_anonymous): If mmap fails, use malloc.
3072 (Output_file::unmap): Don't do anything for an anonymous map.
3073 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3074 is not available, provide stubs.
3075 (File_read::View::~View): Use free rather than delete[].
3076 (File_read::make_view): Use malloc rather than new[]. If mmap
3078 (File_read::find_or_make_view): Use malloc rather than new[].
3079 * gold.h: Remove HAVE_REMAP code.
3080 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3081 exists. Rename mremap to gold_mremap. If mmap is not available
3083 * configure, config.in: Rebuild.
3085 2011-04-11 Ian Lance Taylor <iant@google.com>
3087 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3088 initialize local variable v.
3090 2011-04-11 Cary Coutant <ccoutant@google.com>
3092 * archive.cc (Archive::include_member): Adjust call to
3094 (Add_archive_symbols::run): Track argument serial numbers.
3095 (Lib_group::include_member): Likewise.
3096 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3097 * archive.h (Incremental_archive_entry::Archive_member):
3098 Initialize arg_serial_.
3099 (Archive_member::arg_serial_): New data member.
3100 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3101 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3103 (Sized_dynobj::do_for_all_local_got_entries): New function.
3104 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3106 * fileread.cc (get_mtime): New function.
3107 * fileread.h (get_mtime): New function.
3108 * gold.cc (queue_initial_tasks): Check for incremental update.
3109 (process_incremental_input): New function.
3110 (queue_middle_tasks): Don't force valid target for incremental
3112 * incremental-dump.cc (find_input_containing_global): Adjust
3113 size of symbol info entry.
3114 (dump_incremental_inputs): Dump argument serial number and
3115 in_system_directory flag; bias shndx by 1; print symbol names
3116 when dumping per-file symbol lists; use new symbol info readers.
3118 (Output_section_incremental_inputs:update_data_size): New function.
3119 (Sized_incremental_binary::setup_readers): Setup input readers
3120 for each input file; build maps for files added from libraries
3122 (Sized_incremental_binary::check_input_args): New function.
3123 (Sized_incremental_binary::do_check_inputs): Build map of argument
3124 serial numbers to input arguments.
3125 (Sized_incremental_binary::do_file_has_changed): Rename
3126 do_file_is_unchanged to this; compare file modification times.
3127 (Sized_incremental_binary::do_init_layout): New function.
3128 (Sized_incremental_binary::do_reserve_layout): New function.
3129 (Sized_incremental_binary::do_get_input_reader): Remove.
3130 (Sized_incremental_binary::get_symtab_view): New function.
3131 (Incremental_checker::can_incrementally_link_output_file): Remove.
3132 (Incremental_inputs::report_command_line): Exclude --debug options.
3133 (Incremental_inputs::report_archive_begin): Add parameter; track
3134 argument serial numbers; don't put input file entry for archive
3135 before archive members.
3136 (Incremental_inputs::report_archive_end): Put input file entry
3137 for archive after archive members.
3138 (Incremental_inputs::report_object): Add parameter; track argument
3139 serial numbers and in_system_directory flag.
3140 (Incremental_inputs::report_script): Add parameter; track argument
3142 (Output_section_incremental_inputs::set_final_data_size): Adjust
3143 size of symbol info entry; check for forwarding symbols.
3144 (Output_section_incremental_inputs::write_input_files): Write
3145 in_system_directory flag and argument serial number.
3146 (Output_section_incremental_inputs::write_info_blocks): Map section
3147 indices between incremental info and original input file; store
3148 input section index for each symbol.
3149 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3150 change operator() to visit().
3151 (class Global_got_offset_visitor): Likewise.
3152 (class Global_symbol_visitor_got_plt):
3153 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3155 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3156 (Sized_incr_relobj::do_read_symbols): New function.
3157 (Sized_incr_relobj::do_layout): New function.
3158 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3159 (Sized_incr_relobj::do_add_symbols): New function.
3160 (Sized_incr_relobj::do_should_include_member): New function.
3161 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3162 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3163 (Sized_incr_relobj::do_section_size): New function.
3164 (Sized_incr_relobj::do_section_name): New function.
3165 (Sized_incr_relobj::do_section_contents): New function.
3166 (Sized_incr_relobj::do_section_flags): New function.
3167 (Sized_incr_relobj::do_section_entsize): New function.
3168 (Sized_incr_relobj::do_section_address): New function.
3169 (Sized_incr_relobj::do_section_type): New function.
3170 (Sized_incr_relobj::do_section_link): New function.
3171 (Sized_incr_relobj::do_section_info): New function.
3172 (Sized_incr_relobj::do_section_addralign): New function.
3173 (Sized_incr_relobj::do_initialize_xindex): New function.
3174 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3175 (Sized_incr_relobj::do_read_relocs): New function.
3176 (Sized_incr_relobj::do_gc_process_relocs): New function.
3177 (Sized_incr_relobj::do_scan_relocs): New function.
3178 (Sized_incr_relobj::do_count_local_symbols): New function.
3179 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3180 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3181 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3182 (Sized_incr_relobj::do_relocate): New function.
3183 (Sized_incr_relobj::do_set_section_offset): New function.
3184 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3185 (Sized_incr_dynobj::do_read_symbols): New function.
3186 (Sized_incr_dynobj::do_layout): New function.
3187 (Sized_incr_dynobj::do_add_symbols): New function.
3188 (Sized_incr_dynobj::do_should_include_member): New function.
3189 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3190 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3191 (Sized_incr_dynobj::do_section_size): New function.
3192 (Sized_incr_dynobj::do_section_name): New function.
3193 (Sized_incr_dynobj::do_section_contents): New function.
3194 (Sized_incr_dynobj::do_section_flags): New function.
3195 (Sized_incr_dynobj::do_section_entsize): New function.
3196 (Sized_incr_dynobj::do_section_address): New function.
3197 (Sized_incr_dynobj::do_section_type): New function.
3198 (Sized_incr_dynobj::do_section_link): New function.
3199 (Sized_incr_dynobj::do_section_info): New function.
3200 (Sized_incr_dynobj::do_section_addralign): New function.
3201 (Sized_incr_dynobj::do_initialize_xindex): New function.
3202 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3203 (make_sized_incremental_object): New function.
3204 (Incremental_library::copy_unused_symbols): New function.
3205 (Incremental_library::do_for_all_unused_symbols): New function.
3206 * incremental.h (enum Incremental_input_flags): New type.
3207 (class Incremental_checker): Remove.
3208 (Incremental_input_entry::Incremental_input_entry): Add argument
3210 (Incremental_input_entry::arg_serial): New function.
3211 (Incremental_input_entry::set_is_in_system_directory): New function.
3212 (Incremental_input_entry::is_in_system_directory): New function.
3213 (Incremental_input_entry::arg_serial_): New data member.
3214 (Incremental_input_entry::is_in_system_directory_): New data member.
3215 (class Script_info): Move here from script.h.
3216 (Script_info::Script_info): Add filename parameter.
3217 (Script_info::filename): New function.
3218 (Script_info::filename_): New data member.
3219 (Incremental_script_entry::Incremental_script_entry): Add argument
3221 (Incremental_object_entry::Incremental_object_entry): Likewise.
3222 (Incremental_object_entry::add_input_section): Build list of input
3223 sections with map to original shndx.
3224 (Incremental_object_entry::get_input_section_index): New function.
3225 (Incremental_object_entry::shndx_): New data member.
3226 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3227 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3228 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3230 (Incremental_inputs::report_archive_begin): Likewise.
3231 (Incremental_inputs::report_object): Likewise.
3232 (Incremental_inputs::report_script): Likewise.
3233 (class Incremental_global_symbol_reader): New class.
3234 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3235 and store flags and input file type.
3236 (Incremental_input_entry_reader::arg_serial): New function.
3237 (Incremental_input_entry_reader::type): Extract type from flags.
3238 (Incremental_input_entry_reader::is_in_system_directory): New function.
3239 (Incremental_input_entry_reader::get_input_section_count): Call
3240 accessor function for type.
3241 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3242 function for type; adjust size of global symbol entry.
3243 (Incremental_input_entry_reader::get_global_symbol_count): Call
3244 accessor function for type.
3245 (Incremental_input_entry_reader::get_object_count): Likewise.
3246 (Incremental_input_entry_reader::get_object_offset): Likewise.
3247 (Incremental_input_entry_reader::get_member_count): Likewise.
3248 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3249 (Incremental_input_entry_reader::get_member_offset): Likewise.
3250 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3251 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3252 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3253 (Incremental_input_entry_reader::get_global_symbol_reader): New
3255 (Incremental_input_entry_reader::get_output_symbol_index): New
3257 (Incremental_input_entry_reader::type_): Remove.
3258 (Incremental_input_entry_reader::flags_): New data member.
3259 (Incremental_inputs_reader::input_file_offset): New function.
3260 (Incremental_inputs_reader::input_file_index): New function.
3261 (Incremental_inputs_reader::input_file): Call input_file_offset.
3262 (Incremental_inputs_reader::input_file_at_offset): New function.
3263 (Incremental_relocs_reader::get_r_type): Reformat.
3264 (Incremental_relocs_reader::get_r_shndx): Reformat.
3265 (Incremental_relocs_reader::get_r_offset): Reformat.
3266 (Incremental_relocs_reader::data): New function.
3267 (Incremental_binary::Incremental_binary): Initialize new data members.
3268 (Incremental_binary::check_inputs): Add cmdline parameter.
3269 (Incremental_binary::file_is_unchanged): Remove.
3270 (Input_reader::arg_serial): New function.
3271 (Input_reader::get_unused_symbol_count): New function.
3272 (Input_reader::get_unused_symbol): New function.
3273 (Input_reader::do_arg_serial): New function.
3274 (Input_reader::do_get_unused_symbol_count): New function.
3275 (Input_reader::do_get_unused_symbol): New function.
3276 (Incremental_binary::input_file_count): New function.
3277 (Incremental_binary::get_input_reader): Change signature to use
3278 index instead of filename.
3279 (Incremental_binary::file_has_changed): New function.
3280 (Incremental_binary::get_input_argument): New function.
3281 (Incremental_binary::get_library): New function.
3282 (Incremental_binary::get_script_info): New function.
3283 (Incremental_binary::init_layout): New function.
3284 (Incremental_binary::reserve_layout): New function.
3285 (Incremental_binary::output_file): New function.
3286 (Incremental_binary::do_check_inputs): New function.
3287 (Incremental_binary::do_file_is_unchanged): Remove.
3288 (Incremental_binary::do_file_has_changed): New function.
3289 (Incremental_binary::do_init_layout): New function.
3290 (Incremental_binary::do_reserve_layout): New function.
3291 (Incremental_binary::do_input_file_count): New function.
3292 (Incremental_binary::do_get_input_reader): Change signature.
3293 (Incremental_binary::input_args_map_): New data member.
3294 (Incremental_binary::library_map_): New data member.
3295 (Incremental_binary::script_map_): New data member.
3296 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3298 (Sized_incremental_binary::output_section): New function.
3299 (Sized_incremental_binary::inputs_reader): Add const.
3300 (Sized_incremental_binary::symtab_reader): Add const.
3301 (Sized_incremental_binary::relocs_reader): Add const.
3302 (Sized_incremental_binary::got_plt_reader): Add const.
3303 (Sized_incremental_binary::get_symtab_view): New function.
3304 (Sized_incremental_binary::Inputs_reader): New typedef.
3305 (Sized_incremental_binary::Input_entry_reader): New typedef.
3306 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3307 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3308 (Sized_incremental_binary::do_file_has_changed): New function.
3309 (Sized_incremental_binary::do_init_layout): New function.
3310 (Sized_incremental_binary::do_reserve_layout): New function.
3311 (Sized_input_reader::Inputs_reader): Remove.
3312 (Sized_input_reader::Input_entry_reader): Remove.
3313 (Sized_input_reader::do_arg_serial): New function.
3314 (Sized_input_reader::do_get_unused_symbol_count): New function.
3315 (Sized_input_reader::do_get_unused_symbol): New function.
3316 (Sized_incremental_binary::do_input_file_count): New function.
3317 (Sized_incremental_binary::do_get_input_reader): Change signature;
3318 use index instead of filename.
3319 (Sized_incremental_binary::section_map_): New data member.
3320 (Sized_incremental_binary::input_entry_readers_): New data member.
3321 (class Sized_incr_relobj): New class.
3322 (class Sized_incr_dynobj): New class.
3323 (make_sized_incremental_object): New function.
3324 (class Incremental_library): New class.
3325 * layout.cc (Free_list::num_lists): New static data member.
3326 (Free_list::num_nodes): New static data member.
3327 (Free_list::num_removes): New static data member.
3328 (Free_list::num_remove_visits): New static data member.
3329 (Free_list::num_allocates): New static data member.
3330 (Free_list::num_allocate_visits): New static data member.
3331 (Free_list::init): New function.
3332 (Free_list::remove): New function.
3333 (Free_list::allocate): New function.
3334 (Free_list::dump): New function.
3335 (Free_list::print_stats): New function.
3336 (Layout_task_runner::run): Resize output file for incremental updates.
3337 (Layout::Layout): Initialize new data members.
3338 (Layout::set_incremental_base): New function.
3339 (Layout::init_fixed_output_section): New function.
3340 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3341 incremental updates.
3342 (Layout::create_gold_note): Do not create gold note section for
3343 incremental updates.
3344 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3345 for incremental updates.
3346 (Layout::set_section_offsets): For incremental updates, allocate space
3348 (Layout::create_symtab_sections): Layout with offsets relative to
3349 start of section; for incremental updates, allocate space from free
3351 (Layout::create_shdrs): For incremental updates, allocate space from
3353 (Layout::finish_dynamic_section): For incremental updates, do not
3354 check --as-needed (fixed in subsequent patch).
3355 * layout.h (class Free_list): New class.
3356 (Layout::set_incremental_base): New function.
3357 (Layout::incremental_base): New function.
3358 (Layout::init_fixed_output_section): New function.
3359 (Layout::allocate): New function.
3360 (Layout::incremental_base_): New data member.
3361 (Layout::free_list_): New data member.
3362 * main.cc (main): Print Free_list statistics.
3363 * object.cc (Relobj::finalize_incremental_relocs): Add
3364 clear_counts parameter; clear counts only when clear_counts is set.
3365 (Sized_relobj::Sized_relobj): Initialize new base class.
3366 (Sized_relobj::do_layout): Don't report special sections.
3367 (Sized_relobj::do_for_all_local_got_entries): New function.
3368 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3369 symtab_off to all symbol table offsets.
3370 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3371 * object.h (class Got_offset_list): Move to top of file.
3372 (Object::Object): Allow case where input_file == NULL.
3373 (Object::~Object): Likewise.
3374 (Object::input_file): Assert that input_file != NULL.
3375 (Object::lock): Allow case where input_file == NULL.
3376 (Object::unlock): Likewise.
3377 (Object::is_locked): Likewise.
3378 (Object::token): Likewise.
3379 (Object::release): Likewise.
3380 (Object::is_incremental): New function.
3381 (Object::get_mtime): New function.
3382 (Object::for_all_local_got_entries): New function.
3383 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3384 (Object::set_is_in_system_directory): New function.
3385 (Object::is_in_system_directory): New function.
3386 (Object::do_is_incremental): New function.
3387 (Object::do_get_mtime): New function.
3388 (Object::do_for_all_local_got_entries): New function.
3389 (Object::is_in_system_directory_): New data member.
3390 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3391 (class Sized_relobj_base): New class.
3392 (class Sized_relobj): Derive from Sized_relobj_base.
3393 (class Sized_relobj::Symbols): Redeclare from base class.
3394 (class Sized_relobj::local_got_offset_list): Remove.
3395 (class Sized_relobj::Output_sections): Redeclare from base class.
3396 (class Sized_relobj::do_for_all_local_got_entries): New function.
3397 (class Sized_relobj::write_local_symbols): Add offset parameter.
3398 (class Sized_relobj::local_symbol_offset_): Update comment.
3399 (class Sized_relobj::local_dynsym_offset_): Update comment.
3400 * options.cc (Input_arguments::add_file): Remove const.
3401 * options.h (Input_file_argument::Input_file_argument):
3402 Initialize arg_serial_ (all constructors).
3403 (Input_file_argument::set_arg_serial): New function.
3404 (Input_file_argument::arg_serial): New function.
3405 (Input_file_argument::arg_serial_): New data member.
3406 (Input_arguments::Input_arguments): Initialize file_count_.
3407 (Input_arguments::add_file): Remove const.
3408 (Input_arguments::number_of_input_files): New function.
3409 (Input_arguments::file_count_): New data member.
3410 (Command_line::number_of_input_files): Call
3411 Input_arguments::number_of_input_files.
3412 * output.cc (Output_segment_headers::Output_segment_headers):
3414 (Output_section::Input_section::current_data_size): New function.
3415 (Output_section::Output_section): Initialize new data members.
3416 (Output_section::add_input_section): Don't do merge sections for
3417 an incremental link; allocate space from free list for an
3419 (Output_section::add_output_section_data): Allocate space from
3420 free list for an incremental update.
3421 (Output_section::update_data_size): New function.
3422 (Output_section::set_fixed_layout): New function.
3423 (Output_section::reserve): New function.
3424 (Output_segment::set_section_addresses): Remove const.
3425 (Output_segment::set_section_list_addresses): Remove const; allocate
3426 space from free list for an incremental update.
3427 (Output_segment::set_offset): Adjust size of RELRO segment for an
3429 * output.h (Output_data::current_data_size): Move here from
3431 (Output_data::pre_finalize_data_size): New function.
3432 (Output_data::update_data_size): New function.
3433 (Output_section_headers::update_data_size): new function.
3434 (Output_section_data_build::current_data_size): Move to Output_data.
3435 (Output_data_strtab::update_data_size): New function.
3436 (Output_section::current_data_size): Move to Output_data.
3437 (Output_section::set_fixed_layout): New function.
3438 (Output_section::has_fixed_layout): New function.
3439 (Output_section::reserve): New function.
3440 (Output_section::update_data_size): New function.
3441 (Output_section::has_fixed_layout_): New data member.
3442 (Output_section::free_list_): New data member.
3443 (Output_segment::set_section_addresses): Remove const.
3444 (Output_segment::set_section_list_addresses): Remove const.
3445 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3447 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3449 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3450 parameter when calling Add_symbols constructor; store argument
3451 serial number for members of a lib group.
3452 (Add_symbols::locks): Allow case where token == NULL.
3453 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3454 (Read_member::~Read_member): New function.
3455 (Read_member::is_runnable): New function.
3456 (Read_member::locks): New function.
3457 (Read_member::run): New function.
3458 (Check_script::~Check_script): New function.
3459 (Check_script::is_runnable): New function.
3460 (Check_script::locks): New function.
3461 (Check_script::run): New function.
3462 (Check_library::~Check_library): New function.
3463 (Check_library::is_runnable): New function.
3464 (Check_library::locks): New function.
3465 (Check_library::run): New function.
3466 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3467 (Add_symbols::library_): New data member.
3468 (class Read_member): New class.
3469 (class Check_script): New class.
3470 (class Check_library): New class.
3471 * reloc.cc (Read_relocs::is_runnable): Allow case where
3473 (Read_relocs::locks): Likewise.
3474 (Scan_relocs::locks): Likewise.
3475 (Relocate_task::locks): Likewise.
3476 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3478 (Sized_relobj::incremental_relocs_scan): Fix comment.
3479 (Sized_relobj::do_relocate): Pass output file offset to
3480 write_local_symbols.
3481 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3482 from class declaration.
3483 * script.cc (read_input_script): Allocate Script_info; pass
3484 argument serial number to report_script.
3485 * script.h (class Script_info): Move to incremental.h.
3486 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3487 * symtab.h (Symbol_table::add_from_incrobj): New function.
3488 (Symbol_table::set_file_offset): New function.
3490 2011-04-05 Cary Coutant <ccoutant@google.com>
3492 * incremental-dump.cc (dump_incremental_inputs): Change signature
3493 to take a Sized_incremental_binary; change caller. Use readers
3494 in Sized_incremental_binary.
3496 (Sized_incremental_binary::find_incremental_inputs_sections):
3497 Rename do_find_incremental_inputs_sections to this.
3498 (Sized_incremental_binary::setup_readers): New function.
3499 (Sized_incremental_binary::do_check_inputs): Check
3500 has_incremental_info_ flag; move setup code to setup_readers;
3502 (Sized_incremental_binary::do_file_is_unchanged): New function.
3503 (Sized_incremental_binary::do_get_input_reader): New function.
3504 * incremental.h (class Incremental_binary): Move to end of file.
3505 (Incremental_binary::file_is_unchanged): New function.
3506 (Incremental_binary::do_file_is_unchanged): New function.
3507 (Incremental_binary::Input_reader): New class.
3508 (Incremental_binary::get_input_reader): New function.
3509 (class Sized_incremental_binary): Move to end of file.
3510 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3511 input section reader classes.
3512 (Sized_incremental_binary::has_incremental_info): New function.
3513 (Sized_incremental_binary::inputs_reader): New function.
3514 (Sized_incremental_binary::symtab_reader): New function.
3515 (Sized_incremental_binary::relocs_reader): New function.
3516 (Sized_incremental_binary::got_plt_reader): New function.
3517 (Sized_incremental_binary::do_file_is_unchanged): New function.
3518 (Sized_incremental_binary::Sized_input_reader): New class.
3519 (Sized_incremental_binary::get_input_reader): New function.
3520 (Sized_incremental_binary::find_incremental_inputs_sections):
3521 Rename do_find_incremental_inputs_sections to this.
3522 (Sized_incremental_binary::setup_readers): New function.
3523 (Sized_incremental_binary::has_incremental_info_): New data member.
3524 (Sized_incremental_binary::inputs_reader_): New data member.
3525 (Sized_incremental_binary::symtab_reader_): New data member.
3526 (Sized_incremental_binary::relocs_reader_): New data member.
3527 (Sized_incremental_binary::got_plt_reader_): New data member.
3528 (Sized_incremental_binary::current_input_file_): New data member.
3530 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3533 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3536 2011-03-30 Cary Coutant <ccoutant@google.com>
3538 * archive.cc (Archive::include_member): Adjust call to report_object.
3539 (Add_archive_symbols::run): Add script_info to call to
3540 report_archive_begin.
3541 (Lib_group::include_member): Adjust call to report_object.
3542 (Add_lib_group_symbols::run): Adjust call to report_object.
3543 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3544 blocks. Add object count for script input files.
3545 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3546 script_info parameter; change all callers.
3547 (Incremental_inputs::report_object): Add script_info parameter;
3549 (Incremental_inputs::report_script): Store backpointer to
3550 incremental info entry.
3551 (Output_section_incremental_inputs::set_final_data_size): Record
3552 additional information for scripts.
3553 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3554 * incremental.h (Incremental_script_entry::add_object): New function.
3555 (Incremental_script_entry::get_object_count): New function.
3556 (Incremental_script_entry::get_object): New function.
3557 (Incremental_script_entry::objects_): New data member; adjust
3559 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3560 (Incremental_inputs::report_object): Add script_info parameter.
3561 (Incremental_inputs_reader::get_object_count): New function.
3562 (Incremental_inputs_reader::get_object_offset): New function.
3563 * options.cc (Input_arguments::add_file): Return reference to
3565 * options.h (Input_argument::set_script_info): New function.
3566 (Input_argument::script_info): New function.
3567 (Input_argument::script_info_): New data member; adjust all
3569 (Input_file_group::add_file): Return reference to new input argument.
3570 (Input_file_lib::add_file): Likewise.
3571 (Input_arguments::add_file): Likewise.
3572 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3573 * script.cc (Parser_closure::Parser_closure): Add script_info
3574 parameter; adjust all callers.
3575 (Parser_closure::script_info): New function.
3576 (Parser_closure::script_info_): New data member.
3577 (read_input_script): Report scripts earlier to incremental info.
3578 (script_add_file): Set script_info in Input_argument.
3579 (script_add_library): Likewise.
3580 * script.h (Script_options::Script_info): Rewrite class.
3582 2011-03-29 Cary Coutant <ccoutant@google.com>
3584 * archive.cc (Library_base::should_include_member): Move
3585 method here from class Archive.
3586 (Archive::Archive): Initialize base class.
3587 (Archive::should_include_member): Move to base class.
3588 (Archive::do_for_all_unused_symbols): New function.
3589 (Add_archive_symbols::run): Remove redundant access to
3591 (Lib_group::Lib_group): Initialize base class.
3592 (Lib_group::do_filename): New function.
3593 (Lib_group::include_member): Pass pointer to Lib_group to
3595 (Lib_group::do_for_all_unused_symbols): New function.
3596 (Add_lib_group_symbols::run): Report archive information for
3598 * archive.h (class Library_base): New base class.
3599 (class Archive): Derive from Library_base.
3600 (Archive::filename): Move to base class.
3601 (Archive::set_incremental_info): Likewise.
3602 (Archive::incremental_info): Likewise.
3603 (Archive::Should_include): Likewise.
3604 (Archive::should_include_member): Likewise.
3605 (Archive::Armap_entry): Remove.
3606 (Archive::Unused_symbol_iterator): Remove.
3607 (Archive::unused_symbols_begin): Remove.
3608 (Archive::unused_symbols_end): Remove.
3609 (Archive::do_filename): New function.
3610 (Archive::do_get_mtime): New function.
3611 (Archive::do_for_all_unused_symbols): New function.
3612 (Archive::task_): Move to base class.
3613 (Archive::incremental_info_): Likewise.
3614 (class Lib_group): Derive from Library_base.
3615 (Lib_group::do_filename): New function.
3616 (Lib_group::do_get_mtime): New function.
3617 (Lib_group::do_for_all_unused_symbols): New function.
3618 (Lib_group::task_): Move to base class.
3619 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3621 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3623 * incremental.cc (Incremental_inputs::report_archive_begin):
3624 Use Library_base; call library's get_mtime; add incremental inputs
3625 entry before members.
3626 (class Unused_symbol_visitor): New class.
3627 (Incremental_inputs::report_archive_end): Use Library_base; use
3628 visitor class to record unused symbols; don't add incremental inputs
3629 entry after members.
3630 (Incremental_inputs::report_object): Use Library_base.
3632 (Incremental_archive_entry::Incremental_archive_entry): Remove
3633 unused Archive parameter.
3634 (Incremental_inputs::report_archive_begin): Use Library_base.
3635 (Incremental_inputs::report_archive_end): Likewise.
3636 (Incremental_inputs::report_object): Likewise.
3637 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3639 * object.h (Object::for_all_global_symbols): New function.
3640 (Object::do_for_all_global_symbols): New function.
3641 (Sized_relobj::do_for_all_global_symbols): New function.
3642 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3644 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3647 2011-03-27 Ian Lance Taylor <iant@google.com>
3649 * archive.cc (Archive::interpret_header): Return -1 if something
3650 goes wrong. Change callers accordingly.
3652 2011-03-25 Cary Coutant <ccoutant@google.com>
3654 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3655 * testsuite/Makefile.in: Regenerate.
3657 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3659 * plugin.cc (get_view): New.
3660 (Plugin::load): Pass get_view to the plugin.
3661 (Plugin_manager::get_view): New.
3663 2011-03-21 Ian Lance Taylor <iant@google.com>
3665 * testsuite/final_layout.sh: Rewrite to not use dc.
3666 * testsuite/relro_test.sh: Fail if dc is not present.
3668 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3670 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3672 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3673 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3675 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3676 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3678 2011-03-14 Ian Lance Taylor <iant@google.com>
3680 * script-sections.cc (Sort_output_sections::script_compare):
3681 Rename from is_before, change return type.
3682 (Sort_output_sections::operator()): Adjust accordingly.
3684 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3687 * testsuite/odr_violation2.cc: Add comment to make all error line
3688 numbers double digits.
3689 * testsuite/debug_msg.sh: Adjust expected errors.
3691 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3693 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3694 but mark earlier ones as non-canonical
3695 (offset_to_iterator): Update search target and example
3696 (do_addr2line): Return extra lines in a vector*
3697 (format_file_lineno): Extract from do_addr2line
3698 (one_addr2line): Add vector* out-param
3699 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3700 when a lineno entry appeared last for its instruction
3701 (Dwarf_line_info): Add vector* out-param
3702 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3703 * symtab.cc (Odr_violation_compare): Include the lineno in the
3705 (linenos_from_loc): New. Combine the canonical line for an
3706 address with its other lines.
3707 (True_if_intersect): New. Helper functor to make
3708 std::set_intersection a query.
3709 (detect_odr_violations): Compare sets of lines instead of just
3710 one line for each function. This became less deterministic, but
3711 has fewer false positives.
3712 * symtab.h: Declarations.
3713 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3714 mix an optimized and non-optimized object in the same binary
3715 (odr_violation2.so): Same.
3716 * testsuite/Makefile.in: Regenerate from Makefile.am.
3717 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3718 * testsuite/debug_msg.sh: Update line numbers and add
3720 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3721 non-optimized context.
3722 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3723 isn't inlined, and use OdrDerived in an optimized context.
3724 * testsuite/odr_header1.h: Defines OdrDerived, where
3725 optimization will change the
3726 first-instruction-in-the-destructor's file and line number.
3727 * testsuite/odr_header2.h: Defines OdrBase.
3729 2011-03-09 Ian Lance Taylor <iant@google.com>
3731 * fileread.cc (File_read::clear_views): Don't delete the whole
3734 2011-03-08 Ian Lance Taylor <iant@google.com>
3737 * fileread.cc: #include <climits>.
3738 (GOLD_IOV_MAX): Define.
3739 (File_read::read_multiple): Limit number of entries by iov_max.
3740 * fileread.h (class File_read): Always set max_readv_entries to
3743 2011-03-07 Ian Lance Taylor <iant@google.com>
3746 * options.h (class General_options): Add -dy and -dn.
3748 2011-03-02 Cary Coutant <ccoutant@google.com>
3750 * testsuite/script_test_9.t: Add TLS segment.
3752 2011-03-02 Simon Baldwin <simonb@google.com>
3754 * configure.ac: Add check for gnu_indirect_function support in
3755 the toolchain building binutils.
3756 * configure: Rebuild.
3758 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3760 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3761 plugin only symbols.
3762 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3763 in plugin files as not needed in the symbol table.
3765 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3767 * output.cc (Output_section::add_input_section): Delay fill
3768 generation for section ordering.
3770 2011-02-09 Ian Lance Taylor <iant@google.com>
3773 * object.h (class Sized_relobj): Remove clear_local_symbols.
3774 * reloc.cc (Sized_relobj::do_relocate): Don't call
3775 clear_local_symbols.
3777 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3779 * plugin.cc (is_visible_from_outside): Return true for symbols
3782 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3784 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3787 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3789 * icf.h (is_section_foldable_candidate): Change type of parameter
3791 * icf.cc (Icf::find_identical_sections): Change type of local variable
3792 section_name to be std::string.
3793 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3795 2011-01-25 Ian Lance Taylor <iant@google.com>
3797 * script.cc (script_add_extern): Rewrite to use
3798 add_symbol_reference.
3800 2011-01-25 Doug Kwan <dougkwan@google.com>
3802 * icf.cc (get_section_contents): Always lock section's object.
3804 2011-01-24 Ian Lance Taylor <iant@google.com>
3806 * options.h (class General_options): Accept
3807 --no-detect-odr-violations.
3809 2011-01-24 Ian Lance Taylor <iant@google.com>
3811 * version.cc (version_string): Bump to 1.11.
3813 2011-01-24 Ian Lance Taylor <iant@google.com>
3815 * plugin.cc (class Plugin_rescan): Define new class.
3816 (Plugin_manager::claim_file): Set any_claimed_.
3817 (Plugin_manager::save_archive): New function.
3818 (Plugin_manager::save_input_group): New function.
3819 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3821 (Plugin_manager::new_undefined_symbol): New function.
3822 (Plugin_manager::rescan): New function.
3823 (Plugin_manager::rescannable_defines): New function.
3824 (Plugin_manager::add_input_file): Set any_added_.
3825 * plugin.h (class Plugin_manager): define new fields rescannable_,
3826 undefined_symbols_, any_claimed_, and any_added_. Declare
3827 Plugin_rescan as friend. Declare new functions.
3828 (Plugin_manager::Rescannable): Define type.
3829 (Plugin_manager::Rescannable_list): Define type.
3830 (Plugin_manager::Undefined_symbol_list): Define type.
3831 (Plugin_manager::Plugin_manager): Initialize new fields.
3832 * archive.cc (Archive::defines_symbol): New function.
3833 (Add_archive_symbols::run): Pass archive to plugins if any.
3834 * archive.h (class Archive): Declare defines_symbol.
3835 * readsyms.cc (Input_group::~Input_group): New function.
3836 (Finish_group::run): Pass input_group to plugins if any.
3837 * readsyms.h (class Input_group): Declare destructor.
3838 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3841 2011-01-10 Ian Lance Taylor <iant@google.com>
3843 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3845 (Layout::set_segment_offsets): Reset increase_relro before calling
3846 set_section_addresses a second time.
3848 2011-01-04 Cary Coutant <ccoutant@google.com>
3850 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3851 sections before NOBITS sections.
3853 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3855 * version.cc (print_version): Update copyright to 2011.
3857 2010-12-23 Cary Coutant <ccoutant@google.com>
3859 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3860 of OS to this->add. Add OD parameter to second form of the function.
3862 2010-12-20 Ian Lance Taylor <iant@google.com>
3864 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3865 second of two consecutive entries with same offset.
3867 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3869 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3870 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3871 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3872 to avoid unneeded links against $(LDADD).
3873 * testsuite/Makefile.in: Regenerate.
3875 2010-12-15 Ian Lance Taylor <iant@google.com>
3878 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3879 for R_X86_64_32 and R_X86_64_PC32.
3880 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3881 ver_matching_def_pic.o.
3882 (ver_matching_def_pic.o): New target.
3884 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3886 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3887 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3888 Move definition before File_read::View member definitions.
3889 (File_read::View::~View): Initialize and hold lock before
3890 updating current_mapped_bytes.
3892 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3894 * dwarf_reader.cc: Remove outdated comment.
3895 * gold-threads.cc: Fix typo in error message.
3896 * archive.cc: Fix typos in comments.
3897 * archive.h: Likewise.
3898 * arm-reloc-property.cc: Likewise.
3899 * arm-reloc-property.h: Likewise.
3900 * arm-reloc.def: Likewise.
3902 * attributes.h: Likewise.
3903 * cref.cc: Likewise.
3904 * ehframe.cc: Likewise.
3905 * fileread.h: Likewise.
3907 * i386.cc: Likewise.
3909 * incremental.h: Likewise.
3910 * int_encoding.cc: Likewise.
3911 * layout.h: Likewise.
3912 * main.cc: Likewise.
3913 * merge.h: Likewise.
3914 * object.cc: Likewise.
3915 * object.h: Likewise.
3916 * options.cc: Likewise.
3917 * readsyms.cc: Likewise.
3918 * reduced_debug_output.cc: Likewise.
3919 * reloc.cc: Likewise.
3920 * script-sections.cc: Likewise.
3921 * sparc.cc: Likewise.
3922 * symtab.h: Likewise.
3923 * target-reloc.h: Likewise.
3924 * target.cc: Likewise.
3925 * target.h: Likewise.
3926 * timer.cc: Likewise.
3927 * timer.h: Likewise.
3928 * x86_64.cc: Likewise.
3930 2010-12-09 Cary Coutant <ccoutant@google.com>
3932 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3934 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3935 parameter; change all callers.
3936 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3937 * options.h (warn_execstack): New option.
3939 2010-12-07 Doug Kwan <dougkwan@google.com>
3941 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3942 like function call relocations.
3944 2010-12-07 Ian Lance Taylor <iant@google.com>
3946 * archive.cc (Archive::get_elf_object_for_member): Permit
3947 punconfigured to be NULL.
3948 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3949 (Archive::include_member): Pass NULL to get_elf_object_for_member
3950 if we searched for the archive and this is the first included
3953 2010-12-01 Ian Lance Taylor <iant@google.com>
3955 * dwarf_reader.h (class Sized_dwarf_line_info): Add
3956 track_relocs_type_ field.
3957 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3958 Set track_relocs_type_.
3959 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3960 contents when using RELA relocs.
3961 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3963 * reloc.cc (Track_relocs::next_addend): New function.
3964 * reloc.h (class Track_relocs): Declare next_addend.
3966 2010-12-01 Ian Lance Taylor <iant@google.com>
3968 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3971 2010-12-01 Ian Lance Taylor <iant@google.com>
3973 * README: Update compilers known to work and fail.
3975 2010-11-23 Matthias Klose <doko@ubuntu.com>
3977 * configure.in: For --enable-gold, handle value `default' instead of
3978 `both*'. Always install ld as ld.bfd, install as ld if gold is
3980 * configure: Regenerate.
3982 2010-11-18 Doug Kwan <dougkwan@google.com>
3984 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3985 and right_alignment to be zero. Store result alignment only if it is
3986 greater than existing alignment.
3988 2010-11-16 Cary Coutant <ccoutant@google.com>
3991 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3992 Check for ".zdebug_line".
3994 2010-11-16 Doug Kwan <dougkwan@google.com>
3995 Cary Coutant <ccoutant@google.com>
3997 * output.h (Output_segment::set_section_addresses): Pass increase_relro
3998 by reference; adjust all callers.
3999 * output.cc (Output_segment::set_section_addresses): Adjust references
4000 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4002 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4003 end at page boundary.
4005 2010-11-16 Cary Coutant <ccoutant@google.com>
4008 * layout.cc (Layout::choose_output_section): Transform names of
4009 compressed sections even when using a script with a SECTIONS clause.
4010 (Layout::output_section_name): Remove code to transform
4011 compressed debug section names.
4012 * output.cc (Output_section::add_input_section): Use uncompressed
4013 section size when tracking input sections.
4015 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4017 * symtab.h (Symbol::NON_PIC_REF): Remove.
4018 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4019 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4020 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4021 (Symbol::use_plt_offset): Take a flags argument and pass it
4022 directly to needs_dynamic_reloc. Restrict check for undefined
4023 weak symbols to function calls.
4024 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4025 (Target_arm::Scan::global): Use it.
4026 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4027 (Target_arm::Relocate::relocate): Likewise.
4028 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4029 parameter with an r_type parameter. Use get_reference_flags
4031 (Target_arm::Relocate::relocate): Update accordingly.
4032 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4033 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4034 (Target_i386::Scan::global): Likewise.
4035 (Target_i386::Relocate::relocate): Likewise.
4036 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4037 parameter with an r_type parameter. Use get_reference_flags
4039 (Target_i386::Relocate::relocate): Update accordingly.
4040 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4041 (Target_powerpc::Scan::global): Use it.
4042 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4043 (Target_powerpc::Relocate::relocate): Likewise.
4044 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4045 (Target_sparc::Scan::global): Use it.
4046 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4047 (Target_sparc::Relocate::relocate): Likewise.
4048 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4049 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4050 (Target_x86_64::Scan::global): Likewise.
4051 (Target_x86_64::Relocate::relocate): Likewise.
4053 2010-11-08 Doug Kwan <dougkwan@google.com>
4054 Cary Coutant <ccoutant@google.com>
4056 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4057 (Arm_exidx_merge_section::section_contents_): New data member.
4058 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4059 (Arm_input_section::~Arm_input_section): De-allocate memory.
4060 (Arm_input_section::original_contents_): New data member.
4061 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4062 in parameters instead of calling Object::section_contents without
4064 (Arm_output_section::group_section): New parameter TASK. Pass it
4065 to callees that need locking objects.
4066 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4067 to lock EXIDX input sections. Fix a formatting issue. Call
4068 Arm_exidx_merged_section::build_contents to create merged section
4070 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4071 to lock object of stub table owner.
4072 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4073 TEXT_SIZE to initialize data member TEXT_SIZE_.
4074 (Arm_exidx_input_section::addralign): Fix typo in comment.
4075 (Arm_exidx_input_section::text_size): New method.
4076 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4077 that require locking objects. Lock objects before scanning for stubs
4078 and updating local symbols.
4079 (Arm_input_section<big_endian>::init): Copy contents of original
4081 (Arm_input_section<big_endian>::do_write): Use saved contents of
4082 original input section instead of calling Object::section_contents
4084 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4085 size without calling Object::section_size().
4086 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4087 for size. Allocate a buffer for merged EXIDX entries.
4088 (Arm_exidx_merged_section::build_contents): New method.
4089 (Arm_exidx_merged_section::do_write): Move merge section contents
4090 building code to Arm_exidx_merged_section::build_contetns. Write
4091 out contetns in buffer instead of building it on the fly.
4092 (Arm_relobj::make_exidx_input_section): Also pass text section size
4093 to Arm_exidx_input_section constructor.
4094 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4095 (Arm_dynobj::do_read_symbols): Fix memory leak.
4096 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4097 * target.h: (class Task): Add forward declaration.
4098 (Target::relax): Add new parameter TASK and pass it to
4100 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4102 2010-11-05 Cary Coutant <ccoutant@google.com>
4105 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4106 object when reading from the file.
4107 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4109 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4110 when reading section contents.
4111 (get_section_contents): Likewise.
4112 (icf::find_identical_sections): Likewise.
4113 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4114 object when reading from the file.
4115 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4116 the object when doing deferred section layout.
4118 2010-11-03 Nick Clifton <nickc@redhat.com>
4121 * script.h (class Symbol_assignment: name): New member. Returns
4122 the name of the symbol.
4123 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4124 Returns true if the given symbol name is on the list of
4125 assignments wating to be processed.
4126 * archive.cc (should_incldue_member): If the symbol is undefined,
4127 check to see if it is on the list of symbols pending assignment.
4129 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4131 * script-sections.cc (Script_sections::find_memory_region): Check
4132 for a NULL output section pointer.
4134 2010-10-29 Doug Kwan <dougkwan@google.com>
4136 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4137 Output_section::add_relaxed_input_section.
4138 * output.cc (Output_section::add_relaxed_input_section): Add new
4139 arguments LAYOUT and NAME. Set section order index.
4140 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4141 Copy section order index.
4142 * output.h (Output_section::add_relaxed_input_section): Add new
4143 arguments LAYOUT and NAME.
4145 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4147 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4148 NATIVE_OR_CROSS_LINKER.
4149 * testsuite/Makefile.in: Regenerate.
4151 2010-10-20 Doug Kwan <dougkwan@google.com>
4153 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4154 without SHF_LINK_ORDER flags.
4155 * layout.cc (Layout::choose_output_section): Do not filter
4156 SHF_LINK_ORDER flag in a relocatable link.
4158 2010-10-17 Cary Coutant <ccoutant@google.com>
4160 * output.h (Output_segment::set_section_addresses): Change function
4161 signature. Update all callers.
4162 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4164 (Output_segment::set_section_addresses): Align after last TLS
4165 section. Add padding before last relro section instead of after.
4167 2010-10-17 Doug Kwan <dougkwan@google.com>
4169 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4170 GOT output section to be writable.
4172 2010-10-14 Cary Coutant <ccoutant@google.com>
4174 * debug.h (DEBUG_INCREMENTAL): New flag.
4175 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4176 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4178 * incremental.cc (report_command_line): Ignore all forms of
4180 * layout.cc (Layout::Layout): Check parameters for incremental link
4182 * options.cc (General_options::parse_incremental): New function.
4183 (General_options::parse_no_incremental): New function.
4184 (General_options::parse_incremental_full): New function.
4185 (General_options::parse_incremental_update): New function.
4186 (General_options::incremental_mode_): New data member.
4187 (General_options::finalize): Check incremental_mode_.
4188 * options.h (General_options): Update help text for --incremental.
4189 Add --no-incremental, --incremental-full, --incremental-update.
4190 (General_options::Incremental_mode): New enum type.
4191 (General_options::incremental_mode): New function.
4192 (General_options::incremental_mode_): New data member.
4193 * parameters.cc (Parameters::incremental_mode_): New data member.
4194 (Parameters::set_options): Set incremental_mode_.
4195 (Parameters::set_incremental_full): New function.
4196 (Parameters::incremental): New function.
4197 (Parameters::incremental_update): New function.
4198 (set_parameters_incremental_full): New function.
4199 * parameters.h (Parameters::set_incremental_full): New function.
4200 (Parameters::incremental): New function.
4201 (Parameters::incremental_update): New function.
4202 (Parameters::incremental_mode_): New data member.
4203 (set_parameters_incremental_full): New function.
4204 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4205 incremental link mode.
4206 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4207 (Sized_relobj::do_relocate_sections): Likewise.
4208 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4210 * testsuite/Makefile.in: Regenerate.
4211 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4213 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4215 * script-sections.h (class Script_sections): Make
4216 Sections_elements typedef public.
4217 * script-sections.cc (class Sort_output_sections): Add elements_
4218 field. Add constructor which sets it; change all callers.
4219 (Sort_output_sections::is_before): New function.
4220 (Sort_output_sections::operator()): Call is_before.
4221 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4223 * testsuite/script_test_10.sh: New test. Test script section
4225 * testsuite/script_test_10.t: Likewise.
4226 * testsuite/script_test_10.s: Likewise.
4227 * testsuite/Makefile.am: Wrap the cross linker tests and the
4228 common tests into NATIVE_OR_CROSS_LINKER.
4229 (check_SCRIPTS): Add script_test_10.sh.
4230 (check_DATA): Add script_test_10.stdout.
4231 (script_test_10.o, script_test_10): New targets.
4232 (script_test_10.stdout): New target.
4233 * configure, testsuite/Makefile.in: Regenerate.
4235 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4237 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4238 error for the deprecated relocations.
4239 (Target_arm::Scan::global): Likewise.
4240 (Target_arm::Relocate::relocate): Likewise.
4242 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4244 * fileread.cc (Input_file::find_file): Initialize *found_name
4245 and *namep when using the fallback search for case 4.
4247 2010-10-11 Cary Coutant <ccoutant@google.com>
4249 * options.h (class General_options): Redefine -z lazy as an alias for
4250 the negation of -z now.
4252 2010-10-11 Ian Lance Taylor <iant@google.com>
4254 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4257 2010-10-06 Nick Clifton <nickc@redhat.com>
4259 * script-sections.cc(class Memory_region): Remove
4260 current_lma_offset_ field. Rename current_vma_offset_ to
4261 current_offset_. Add last_section_ field.
4262 (Memory_region::get_current_vma_address): Rename to
4263 get_current_address.
4264 (Memory_region::get_current_lma_address): Delete.
4265 (Memory_region::increment_vma_offset): Rename to
4267 (Memory_region::increment_lma_offset): Delete.
4268 (Memory_region::attributes_compatible): New method. Returns
4269 true if the provided section is compatible with the region.
4270 (Memory_region::get_last_section): New method. Returns the last
4271 section to use the region.
4272 (Memory_region::set_last_section): New method. Stores the last
4273 section to use the region.
4274 (Script_sections::block_in_region): New method. Returns true if
4275 a block of memory is contained within a region.
4276 (Script_sections::find_memory_region): New method. Locates a
4277 memory region to be used to set a VMA or LMA address.
4278 (Output_section_definition::set_section_addresses): Add code to
4279 check for addresses set by memory regions.
4280 (Output_segment::set_section_addresses): Remove memory region
4282 (Script_sections::create_segment): Add a warning if a header
4283 segment is created outside of any region.
4284 * script-sections.h (class Script_sections): Add prototypes for
4285 find_memory_region and block_in_region methods.
4286 * testsuite/memory_test.s: Use .long instead of .word.
4287 * testsuite/memory_test.t: Add some more output sections.
4288 * testsuite/memory_test.sh: Update expected output.
4290 2010-10-02 Doug Kwan <dougkwan@google.com>
4292 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4293 defintion to symtab.h
4294 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4295 declaration to defintion.
4297 2010-10-01 Nick Clifton <nickc@redhat.com>
4299 * expression.cc (eval): Replace dummy argument with NULL.
4300 (eval_maybe_dot): Check for a NULL result section pointer.
4301 (Symbol_expression::value): Likewise.
4302 (Dot_expression::value): Likewise.
4303 (BINARY_EXPRESSION): Likewise.
4304 (Max_expression::value): Likewise.
4305 (Min_expression::value): Likewise.
4306 (Absolute_expression::value): Likewise.
4307 (Addr_expression::value_from_output_section): Likewise.
4308 (Loaddddr_expression::value_from_output_section): Likewise.
4309 (Segment_start_expression::value): Likewise.
4310 * script-sections.cc
4311 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4313 (Sections_elememt_dot_assignment::set_section_addresses):
4315 (Output_data_expression::do_write_to_buffer): Likewise.
4316 (Output_section_definition::finalize_symbols): Likewise.
4317 (Output_section_definition::set_section_addresses): Likewise.
4319 2010-09-30 Doug Kwan <dougkwan@google.com>
4321 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4323 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4325 * target.h (Target::can_icf_inline_merge_sections): New virtual
4327 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4329 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4331 * icf.cc (get_section_contents): Inline merge sections only when
4334 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4336 * configure: Regenerate.
4338 2010-09-17 Ian Lance Taylor <iant@google.com>
4340 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4341 * testsuite/Makefile.am (memory_test.o): New target.
4342 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4344 * testsuite/Makefile.in: Rebuild.
4346 2010-09-17 Doug Kwan <dougkwan@google.com>
4348 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4349 defintion if relocation uses GOT entries of the symbol.
4350 * testsuite/icf_safe_test.sh: Fix test.
4351 * testsuite/icf_safe_so_test.sh: Fix test.
4353 2010-09-16 Cary Coutant <ccoutant@google.com>
4355 * script_sections.cc (class Memory_region): Remove "NULL" from
4356 vector initializations.
4358 2010-09-15 Cary Coutant <ccoutant@google.com>
4360 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4361 Resolve forwarding symbols.
4363 2010-09-15 Doug Kwan <dougkwan@google.com>
4365 * gold/testsuite/script_test_3.t: Add ARM special sections.
4366 * gold/testsuite/script_test_4.t: Same.
4367 * gold/testsuite/script_test_5.t: Same.
4368 * gold/testsuite/script_test_6.t: Same.
4369 * gold/testsuite/script_test_7.t: Same.
4370 * gold/testsuite/script_test_7.t: Same.
4371 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4373 2010-09-14 Cary Coutant <ccoutant@google.com>
4375 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4376 (Target_x86_64::Relocate::relocate_tls): Replace check for
4377 saw_tls_block_reloc_ with test for executable section.
4379 2010-09-12 Cary Coutant <ccoutant@google.com>
4381 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4382 position-independent executables to shared libraries need dynamic
4384 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4385 position-independent executables.
4386 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4387 * testsuite/Makefile.in: Regenerate.
4389 2010-09-10 Nick Clifton <nickc@redhat.com>
4392 * testsuite/memory_test.t: Discard any sections that are not
4395 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4398 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4399 "This::" to work around a bug in gcc 4.2.
4401 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4403 2010-09-09 Rafael Espindola <espindola@google.com>
4405 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4406 sections with different PF_X flags in the same segment.
4407 (Layout::find_first_load_seg): Search all segments to find the first
4409 * options.h (rosegment): New.
4411 2010-09-08 Rafael Espindola <espindola@google.com>
4413 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4415 2010-09-08 Doug Kwan <dougkwan@google.com>
4417 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4418 (Arm_relobj::do_relocate_sections): Add new parameter for output
4419 file to match the parent.
4420 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4421 of local symbols instead of input values. Update code to track
4422 changes in gold::relocate_section.
4423 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4424 (Sized_relobj::compute_final_local_value_internal): New methods.
4425 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4426 body into private version of Sized_relobj::compute_final_local_value.
4427 Call the inline method.
4428 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4429 merged symbol value if there is one.
4430 (Symbol_value::has_output_value): New method defintiion.
4431 (Sized_relobj::Compute_final_local_value_status): New enum type.
4432 (Sized_relobj::compute_final_local_value): New methods.
4433 (Sized_relobj::compute_final_local_value_internal): New methods.
4434 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4435 and arm_cortex_a8.sh.
4436 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4437 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4439 * Makefile.in: Regenerate.
4440 * testsuite/arm_bl_out_of_range.s: Update test.
4441 * testsuite/thumb_bl_out_of_range.s: Ditto.
4442 * testsuite/thumb_blx_out_of_range.s: Ditto.
4443 * testsuite/arm_branch_out_of_range.sh: New file.
4444 * testsuite/arm_cortex_a8.sh: Ditto.
4445 * testsuite/arm_cortex_a8_b.s: Ditto.
4446 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4447 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4448 * testsuite/arm_cortex_a8_bl.s: Ditto.
4449 * testsuite/arm_cortex_a8_blx.s: Ditto.
4450 * testsuite/arm_cortex_a8_local.s: Ditto.
4451 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4452 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4454 2010-09-08 Rafael Espindola <espindola@google.com>
4456 * Makefile.am (memory_test.stdout): Run readelf with -W.
4457 * Makefile.in: Regenerate.
4458 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4461 2010-09-08 Rafael Espindola <espindola@google.com>
4463 * script-sections.cc (Script_sections::add_memory_region): Convert
4464 field precision to int.
4465 * script.cc (script_set_section_region, script_set_section_region):
4466 Convert field precision to int.
4468 2010-09-08 Rafael Espindola <espindola@google.com>
4470 * arm.cc (do_finalize_sections): Create the __exidx_start and
4471 __exdix_end symbols even when the section is missing.
4473 2010-09-08 Nick Clifton <nickc@redhat.com>
4475 * README: Remove claim that MEMORY is not supported.
4476 * expression.cc (script_exp_function_origin)
4477 (script_exp_function_length): Move from here to ...
4478 * script.cc: ... here.
4479 (script_set_section_region, script_add_memory)
4480 (script_parse_memory_attr, script_include_directive): New
4482 * script-sections.cc
4483 (class Memory_region): New class.
4484 (class Output_section_definition): Add set_memory_region,
4485 set_section_vma, set_section_lma and get_section_name methods.
4486 (class Script_Sections): Add add_memory_region,
4487 find_memory_region, find_memory_region_origin,
4488 find_memory_region_length and set_memory_region methods.
4489 Have set_section_addresses method walk the list of set memory
4491 Extend the print methos to display memory regions.
4492 * script-sections.h: Add prototypes for new methods.
4493 Add enum for MEMORY region attributes.
4494 * yyscript.y: Add support for parsing MEMORY regions.
4495 * script-c.h: Add prototypes for new functions.
4496 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4497 * testsuite/Makefile.in: Regenerate.
4498 * testsuite/memory_test.sh: New script.
4499 * testsuite/memory_test.s: New assembler source file.
4500 * testsuite/memory_test.t: New linker script.
4502 2010-08-27 Doug Kwan <dougkwan@google.com>
4504 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4505 reference override an existing dynamic weak reference.
4506 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4507 * testsuite/Makefile.in: Regenerate.
4508 * testsuite/dyn_weak_ref.sh: New file.
4509 * testsuite/dyn_weak_ref_1.c: Ditto.
4510 * testsuite/dyn_weak_ref_2.c: Ditto.
4512 2010-08-27 Ian Lance Taylor <iant@google.com>
4514 * incremental.h (class Incremental_input_entry): Add virtual
4517 2010-08-27 Ian Lance Taylor <iant@google.com>
4519 * testsuite/start_lib_test_3.c: Mark t3 as used.
4521 2010-08-27 Nick Clifton <nickc@redhat.com>
4523 * options.cc (version_script): Fix small typo in previous
4526 2010-08-25 Nick Clifton <nickc@redhat.com>
4528 * archive.cc: Formatting fixes: Remove whitespace between
4529 typename and following asterisk. Remove whitespace between
4530 function name and opening parenthesis.
4531 * archive.h: Likewise.
4533 * attributes.cc: Likewise.
4534 * attributes.h: Likewise.
4535 * common.cc: Likewise.
4536 * copy-relocs.cc: Likewise.
4537 * dirsearch.h: Likewise.
4538 * dynobj.cc: Likewise.
4539 * ehframe.cc: Likewise.
4540 * ehframe.h: Likewise.
4541 * expression.cc: Likewise.
4542 * fileread.cc: Likewise.
4543 * fileread.h: Likewise.
4545 * gold-threads.cc: Likewise.
4546 * gold.cc: Likewise.
4547 * i386.cc: Likewise.
4549 * incremental-dump.cc: Likewise.
4550 * incremental.cc: Likewise.
4551 * layout.cc: Likewise.
4552 * layout.h: Likewise.
4553 * main.cc: Likewise.
4554 * merge.cc: Likewise.
4555 * merge.h: Likewise.
4556 * object.cc: Likewise.
4557 * object.h: Likewise.
4558 * options.cc: Likewise.
4559 * options.h: Likewise.
4560 * output.cc: Likewise.
4561 * output.h: Likewise.
4562 * plugin.cc: Likewise.
4563 * plugin.h: Likewise.
4564 * powerpc.cc: Likewise.
4565 * reloc.cc: Likewise.
4566 * script-c.h: Likewise.
4567 * script-sections.cc: Likewise.
4568 * script.cc: Likewise.
4569 * stringpool.cc: Likewise.
4570 * symtab.cc: Likewise.
4571 * symtab.h: Likewise.
4572 * target.cc: Likewise.
4573 * timer.cc: Likewise.
4574 * timer.h: Likewise.
4575 * version.cc: Likewise.
4576 * x86_64.cc: Likewise.
4578 2010-08-24 Nick Clifton <nickc@redhat.com>
4581 * layout.cc (segment_precedes): Sort segments by their physical
4582 addresses, if they have been set.
4584 2010-08-23 Cary Coutant <ccoutant@google.com>
4586 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4588 (Lib_group::include_member): Unlock object after deleting its
4590 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4593 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4594 Cary Coutant <ccoutant@google.com>
4596 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4597 constructor, and set_blocker.
4598 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4600 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4601 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4602 * testsuite/Makefile.am (start_lib_test): New test case.
4603 * testsuite/Makefile.in: Regenerate.
4604 * testsuite/start_lib_test_main.c: New file.
4605 * testsuite/start_lib_test_1.c: New file.
4606 * testsuite/start_lib_test_2.c: New file.
4607 * testsuite/start_lib_test_3.c: New file.
4609 2010-08-19 Ian Lance Taylor <iant@google.com>
4611 * Makefile.in: Rebuild with automake 1.11.1.
4612 * aclocal.m4: Likewise.
4613 * testsuite/Makefile.in: Likewise.
4615 2010-08-19 Ian Lance Taylor <iant@google.com>
4618 * i386.cc (class Output_data_plt_i386): Update declarations.
4619 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4620 local_ifuncs_ fields.
4621 (Target_i386::do_plt_section_for_global): New function.
4622 (Target_i386::do_plt_section_for_local): New function.
4623 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4624 parameter; change all callers. Initialize global_ifuncs_ and
4625 local_ifuncs_. If doing a static link define __rel_iplt_start and
4627 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4628 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4629 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4631 (Target_i386::make_plt_section): New function, broken out of
4632 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4633 (Target_i386::make_plt_entry): Call make_plt_section.
4634 (Target_i386::make_local_ifunc_plt_entry): New function.
4635 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4636 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4637 R_386_IRELATIVE to switch.
4638 (Target_i386::Scan::global): Likewise.
4639 (Target_i386::Relocate::relocate): Likewise.
4640 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4642 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4643 (Target_x86_64::do_plt_section_for_global): New function.
4644 (Target_x86_64::do_plt_section_for_local): New function.
4645 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4646 parameter; change all callers. If doing a static link define
4647 __rela_iplt_start and __rela_iplt_end.
4648 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4649 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4650 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4652 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4653 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4655 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4656 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4657 R_X86_64_IRELATIVE to switch.
4658 (Target_x86_64::Scan::global): Likewise.
4659 (Target_x86_64::Relocate::relocate): Likewise.
4660 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4662 * target.h (class Target): Add plt_section_for_global and
4663 plt_section_for_local functions. Add do_plt_section_for_global
4664 and do_plt_section_for_local virtual functions.
4665 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4666 clarifying comments.
4667 (Symbol::use_plt_offset): Handle IFUNC symbol.
4668 * object.cc (Sized_relobj::Sized_relobj): Initialize
4670 (Sized_relobj::local_has_plt_offset): New function.
4671 (Sized_relobj::local_plt_offset): New function.
4672 (Sized_relobj::set_local_plt_offset): New function.
4673 (Sized_relobj::do_count): Handle IFUNC symbol.
4674 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4675 a bit away from input_shndx_ field. Add set_is_func_symbol and
4676 is_ifunc_symbol functions.
4677 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4678 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4679 local_plt_offsets_ field.
4680 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4681 * output.h (class Output_section_data): Add non-const
4682 output_section function.
4683 (class Output_data_got): Update declarations.
4684 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4685 Add use_plt_offset parameter to global and local constructors.
4686 Change all callers. Change local_sym_index_ field to 31 bits.
4687 Change GSYM_CODE and CONSTANT_CODE accordingly.
4688 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4689 doing a static link don't set sh_link field.
4690 (Output_data_got::Got_entry::write): Use PLT offset if
4692 (Output_data_got::add_global_plt): New function.
4693 (Output_data_got::add_local_plt): New function.
4694 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4695 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4696 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4697 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4698 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4700 * testsuite/ifunc-sel.h: New file.
4701 * testsuite/ifuncmain1.c: New file.
4702 * testsuite/ifuncmain1vis.c: New file.
4703 * testsuite/ifuncmod1.c: New file.
4704 * testsuite/ifuncdep2.c: New file.
4705 * testsuite/ifuncmain2.c: New file.
4706 * testsuite/ifuncmain3.c: New file.
4707 * testsuite/ifuncmod3.c: New file.
4708 * testsuite/ifuncmain4.c: New file.
4709 * testsuite/ifuncmain5.c: New file.
4710 * testsuite/ifuncmod5.c: New file.
4711 * testsuite/ifuncmain6pie.c: New file.
4712 * testsuite/ifuncmod6.c: New file.
4713 * testsuite/ifuncmain7.c: New file.
4714 * configure, testsuite/Makefile.in: Rebuild.
4716 2010-08-18 Ian Lance Taylor <iant@google.com>
4719 (Output_section_incremental_inputs::write_input_files): Add cast
4720 to avoid signed/unsigned comparison warning.
4721 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4723 2010-08-12 Cary Coutant <ccoutant@google.com>
4725 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4727 2010-08-13 Ian Lance Taylor <iant@google.com>
4729 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4731 2010-08-12 Cary Coutant <ccoutant@google.com>
4732 Doug Kwan <dougkwan@google.com>
4734 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4735 defintion overrides non-weak undef, remember that the original undef
4737 * symtab.cc (Symbol_table::sized_write_global): For undef without
4738 an original weak binding, set binding to global in output.
4739 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4740 * testsuite/Makefile.in: Regenerate.
4741 * testsuite/strong_ref_weak_def.sh: New file.
4742 * testsuite/strong_ref_weak_def_1.c: Ditto.
4743 * testsuite/strong_ref_weak_def_2.c: Ditto.
4745 2010-08-12 Cary Coutant <ccoutant@google.com>
4747 * testsuite/incremental_test.sh: Rewrite.
4748 * testsuite/incremental_test_1.c: Rewrite.
4749 * testsuite/incremental_test_2.c: Rewrite.
4751 2010-08-12 Cary Coutant <ccoutant@google.com>
4753 * arm.cc (Target_arm::got_size): Add const.
4754 (Target_arm::got_entry_count): New function.
4755 (Target_arm::plt_entry_count): New function.
4756 (Target_arm::first_plt_entry_offset): New function.
4757 (Target_arm::plt_entry_size): New function.
4758 (Output_data_plt_arm::entry_count): New function.
4759 (Output_data_plt_arm::first_plt_entry_offset): New function.
4760 (Output_data_plt_arm::get_plt_entry_size): New function.
4761 * i386.cc (Target_i386::got_size): Add const.
4762 (Target_i386::got_entry_count): New function.
4763 (Target_i386::plt_entry_count): New function.
4764 (Target_i386::first_plt_entry_offset): New function.
4765 (Target_i386::plt_entry_size): New function.
4766 (Output_data_plt_i386::entry_count): New function.
4767 (Output_data_plt_i386::first_plt_entry_offset): New function.
4768 (Output_data_plt_i386::get_plt_entry_size): New function.
4769 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4770 find_incremental_inputs_sections. Dump incremental_got_plt section.
4771 * incremental.cc: Include target.h.
4772 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4773 parameter. Adjust all callers. Find incremental_got_plt section.
4774 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4776 (Output_section_incremental_inputs::set_final_data_size): Calculate
4777 size of incremental_got_plt section.
4778 (Output_section_incremental_inputs::do_write): Write the
4779 incremental_got_plt section.
4780 (Got_plt_view_info): New struct.
4781 (Local_got_offset_visitor): New class.
4782 (Global_got_offset_visitor): New class.
4783 (Global_symbol_visitor_got_plt): New class.
4784 (Output_section_incremental_inputs::write_got_plt): New function.
4785 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4786 Add parameter. Adjust all callers.
4787 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4788 (Incremental_inputs::got_plt_section): New function.
4789 (Incremental_inputs::got_plt_section_): New data member.
4790 (Incremental_got_plt_reader): New class.
4791 * layout.cc (Layout::create_incremental_info_sections): Add the
4792 incremental_got_plt section.
4793 * object.h (Got_offset_list::get_list): New function.
4794 (Got offset_list::for_all_got_offsets): New function.
4795 (Sized_relobj::local_got_offset_list): New function.
4796 * powerpc.cc (Target_powerpc::got_size): Add const.
4797 (Target_powerpc::got_entry_count): New function.
4798 (Target_powerpc::plt_entry_count): New function.
4799 (Target_powerpc::first_plt_entry_offset): New function.
4800 (Target_powerpc::plt_entry_size): New function.
4801 (Output_data_plt_powerpc::entry_count): New function.
4802 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4803 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4804 * sparc.cc (Target_sparc::got_size): Add const.
4805 (Target_sparc::got_entry_count): New function.
4806 (Target_sparc::plt_entry_count): New function.
4807 (Target_sparc::first_plt_entry_offset): New function.
4808 (Target_sparc::plt_entry_size): New function.
4809 (Output_data_plt_sparc::entry_count): New function.
4810 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4811 (Output_data_plt_sparc::get_plt_entry_size): New function.
4812 * symtab.h (Symbol::got_offset_list): New function.
4813 (Symbol_table::for_all_symbols): New function.
4814 * target.h (Sized_target::got_entry_count): New function.
4815 (Sized_target::plt_entry_count): New function.
4816 (Sized_target::plt_entry_size): New function.
4817 * x86_64.cc (Target_x86_64::got_size): Add const.
4818 (Target_x86_64::got_entry_count): New function.
4819 (Target_x86_64::plt_entry_count): New function.
4820 (Target_x86_64::first_plt_entry_offset): New function.
4821 (Target_x86_64::plt_entry_size): New function.
4822 (Output_data_plt_x86_64::entry_count): New function.
4823 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4824 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4826 2010-08-12 Cary Coutant <ccoutant@google.com>
4828 * archive.cc: Include incremental.h.
4829 (Archive::Archive): Initialize incremental_info_.
4830 (Archive::include_member): Record archive members in incremental info.
4831 (Add_archive_symbols::run): Record begin and end of an archive in
4833 (Lib_group::include_member): Record objects in incremental info.
4834 * archive.h (Incremental_archive_entry): Forward declaration.
4835 (Archive::set_incremental_info): New member function.
4836 (Archive::incremental_info): New member function.
4837 (Archive::Unused_symbol_iterator): New class.
4838 (Archive::unused_symbols_begin): New member function.
4839 (Archive::unused_symbols_end): New member function.
4840 (Archive::incremental_info_): New data member.
4841 * incremental-dump.cc (find_input_containing_global): New function.
4842 (dump_incremental_inputs): Dump new incremental info sections.
4843 * incremental.cc: Include symtab.h.
4844 (Output_section_incremental_inputs): New class.
4845 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4846 new incremental info sections.
4847 (Sized_incremental_binary::do_check_inputs): Likewise.
4848 (Incremental_inputs::report_archive): Remove.
4849 (Incremental_inputs::report_archive_begin): New function.
4850 (Incremental_inputs::report_archive_end): New function.
4851 (Incremental_inputs::report_object): New function.
4852 (Incremental_inputs::finalize_inputs): Remove.
4853 (Incremental_inputs::report_input_section): New function.
4854 (Incremental_inputs::report_script): Rewrite.
4855 (Incremental_inputs::finalize): Do nothing but finalize string table.
4856 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4857 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4858 (Incremental_inputs::create_data_sections): New function.
4859 (Incremental_inputs::relocs_entsize): New function.
4860 (Output_section_incremental_inputs::set_final_data_size): New function.
4861 (Output_section_incremental_inputs::do_write): New function.
4862 (Output_section_incremental_inputs::write_header): New function.
4863 (Output_section_incremental_inputs::write_input_files): New function.
4864 (Output_section_incremental_inputs::write_info_blocks): New function.
4865 (Output_section_incremental_inputs::write_symtab): New function.
4866 * incremental.h (Incremental_script_entry): Forward declaration.
4867 (Incremental_object_entry): Forward declaration.
4868 (Incremental_archive_entry): Forward declaration.
4869 (Incremental_inputs): Forward declaration.
4870 (Incremental_inputs_header_data): Remove.
4871 (Incremental_inputs_header): Remove.
4872 (Incremental_inputs_header_write): Remove.
4873 (Incremental_inputs_entry_data): Remove.
4874 (Incremental_inputs_entry): Remove.
4875 (Incremental_inputs_entry_write): Remove.
4876 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4877 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4878 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4879 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4881 (Incremental_input_entry): New class.
4882 (Incremental_script_entry): New class.
4883 (Incremental_object_entry): New class.
4884 (Incremental_archive_entry): New class.
4885 (Incremental_inputs::Incremental_inputs): Initialize new data members.
4886 (Incremental_inputs::report_inputs): Remove.
4887 (Incremental_inputs::report_archive): Remove.
4888 (Incremental_inputs::report_archive_begin): New function.
4889 (Incremental_inputs::report_archive_end): New function.
4890 (Incremental_inputs::report_object): Change prototype.
4891 (Incremental_inputs::report_input_section): New function.
4892 (Incremental_inputs::report_script): Change prototype.
4893 (Incremental_inputs::get_reloc_count): New function.
4894 (Incremental_inputs::set_reloc_count): New function.
4895 (Incremental_inputs::create_data_sections): New function.
4896 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4897 (Incremental_inputs::inputs_section): New function.
4898 (Incremental_inputs::symtab_section): New function.
4899 (Incremental_inputs::relocs_section): New function.
4900 (Incremental_inputs::get_stringpool): Add const.
4901 (Incremental_inputs::command_line): Add const.
4902 (Incremental_inputs::inputs): Remove.
4903 (Incremental_inputs::command_line_key): New function.
4904 (Incremental_inputs::input_file_count): New function.
4905 (Incremental_inputs::input_files): New function.
4906 (Incremental_inputs::relocs_entsize): New function.
4907 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4908 (Incremental_inputs::finalize_inputs): Remove.
4909 (Incremental_inputs::Input_info): Remove.
4910 (Incremental_inputs::lock_): Remove.
4911 (Incremental_inputs::inputs_): Change type.
4912 (Incremental_inputs::inputs_map_): Remove.
4913 (Incremental_inputs::current_object_entry_): New data member.
4914 (Incremental_inputs::inputs_section_): New data member.
4915 (Incremental_inputs::symtab_section_): New data member.
4916 (Incremental_inputs::relocs_section_): New data member.
4917 (Incremental_inputs::reloc_count_): New data member.
4918 (Incremental_inputs_reader): New class.
4919 (Incremental_symtab_reader): New class.
4920 (Incremental_relocs_reader): New class.
4921 * layout.cc (Layout::finalize): Move finalization of incremental info
4922 and creation of incremental info sections to follow finalization of
4923 symbol table. Set offsets for postprocessing sections.
4924 (Layout::create_incremental_info_sections): Call
4925 Incremental_inputs::create_data_sections. Add incremental symtab
4926 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
4927 sections to layout after input sections.
4928 * layout.h (struct Timespec): Forward declaration.
4929 (Layout::incremental_inputs): Add const.
4930 (Layout::create_incremental_info_sections): Add parameter.
4931 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4932 * object.cc: Include incremental.h.
4933 (Relobj::finalize_incremental_relocs): New function.
4934 (Sized_relobj::do_layout): Record input sections in incremental info.
4935 * object.h (Object::output_section): New function.
4936 (Object::output_section_offset): Moved from Relobj.
4937 (Object::get_incremental_reloc_base): New function.
4938 (Object::get_incremental_reloc_count): New function.
4939 (Object::do_output_section): New function.
4940 (Object::do_output_section_offset): Moved from Relobj.
4941 (Object::do_get_incremental_reloc_base): New function.
4942 (Object::do_get_incremental_reloc_count): New function.
4943 (Object::Object): Initialize new data members.
4944 (Relobj::output_section): Renamed do_output_section and moved to
4946 (Relobj::output_section_offset): Moved to Object.
4947 (Relobj::do_get_incremental_reloc_base): New function.
4948 (Relobj::do_get_incremental_reloc_count): New function.
4949 (Relobj::allocate_incremental_reloc_counts): New function.
4950 (Relobj::count_incremental_reloc): New function.
4951 (Relobj::finalize_incremental_relocs): New function.
4952 (Relobj::next_incremental_reloc_index): New function.
4953 (Relobj::reloc_counts_): New data member.
4954 (Relobj::reloc_bases_): New data member.
4955 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
4956 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
4957 (Sized_relobj::incremental_relocs_scan): New function.
4958 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4959 (Sized_relobj::incremental_relocs_write): New function.
4960 (Sized_relobj::incremental_relocs_write_reltype): New function.
4961 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4963 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4964 archives and object files elsewhere.
4965 (Add_symbols::run): Report object files here.
4966 (Finish_group::run): Report end of archive at end of group.
4967 * reloc.cc: Include layout.h, incremental.h.
4968 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4969 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4970 (Sized_relobj::incremental_relocs_scan): New function.
4971 (Sized_relobj::incremental_relocs_scan_reltype): New function.
4972 (Sized_relobj::do_relocate_sections): Write incremental relocations.
4973 (Sized_relobj::incremental_relocs_write): New function.
4974 (Sized_relobj::incremental_relocs_write_reltype): New function.
4975 * script.cc (read_input_script): Rewrite test for incremental link.
4976 Change call to Incremental_inputs::report_script.
4977 * symtab.h (Symbol_table::first_global_index): New function.
4978 (Symbol_table::output_count): New function.
4980 2010-08-12 Doug Kwan <dougkwan@google.com>
4982 * arm.cc (Target_arm::merge_object_attributes): Check command line
4983 options --no-wchar-size-warning and --no-enum-size-warning.
4984 * options.h (General_options): Add ld-compatible options
4985 --no-enum-size-warning and --no-wchar-size-warning.
4987 2010-08-04 Ian Lance Taylor <iant@google.com>
4989 * x86_64.cc (Target_x86_64::Scan::local): Use
4990 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4991 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4992 (Target_x86_64::Scan::global): Likewise.
4993 (Target_x86_64::Relocate::relocate): Likewise.
4994 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4997 2010-08-03 Cary Coutant <ccoutant@google.com>
4999 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5000 to reserve space in merged_strings vector. Keep total input size
5002 (Output_merge_string::do_print_merge_stats): Print total input size.
5003 * merge.h (Output_merge_string): Add input_size_ field.
5004 * stringpool.cc (Stringpool_template::string_length): Move
5005 implementations out of Stringpool_template class and place in
5007 * stringpool.h (string_length): Move out of Stringpool_template.
5009 2010-08-03 Ian Lance Taylor <iant@google.com>
5012 * layout.cc (relaxation_loop_body): If address of load segment is
5013 set, adjust address to include headers if possible.
5015 2010-08-03 Ian Lance Taylor <iant@google.com>
5017 * version.cc (version_string): Bump to 1.10.
5019 2010-08-03 Ian Lance Taylor <iant@google.com>
5022 * layout.h (enum Output_section_order): Define.
5023 (class Layout): Update declarations.
5024 * layout.cc (Layout::get_output_section): Add order parameter.
5025 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5026 is_first_non_relro parameters. Change all callers.
5027 (Layout::choose_output_section): Likewise.
5028 (Layout::add_output_section_data): Likewise.
5029 (Layout::make_output_section): Likewise. Set order.
5030 (Layout::default_section_order): New function.
5031 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5032 * output.cc (Output_section::Output_section): Initialize order_.
5033 Don't initialize deleted fields.
5034 (Output_segment::Output_segment): Don't initialize deleted
5036 (Output_segment::add_output_section_to_load): New function
5037 replacing add_output_section. Change all callers to call this or
5038 add_output_section_to_nonload.
5039 (Output_segment::add_output_section_to_nonload): New function.
5040 (Output_segment::remove_output_section): Rewrite.
5041 (Output_segment::add_initial_output_data): Likewise.
5042 (Output_segment::has_any_data_sections): Likewise.
5043 (Output_segment::is_first_section_relro): Likewise.
5044 (Output_segment::maximum_alignment): Likewise.
5045 (Output_segment::has_dynamic_reloc): New function replacing
5046 dynamic_reloc_count. Change all callers.
5047 (Output_segment::has_dynamic_reloc_list): New function replacing
5048 dynamic_reloc_count_list. Change all callers.
5049 (Output_segment::set_section_addresses): Rewrite.
5050 (Output_segment::set_offset): Rewrite.
5051 (Output_segment::find_first_and_last_list): Remove.
5052 (Output_segment::set_tls_offsets): Rewrite.
5053 (Output_segment::first_section_load_address): Likewise.
5054 (Output_segment::output_section_count): Likewise.
5055 (Output_segment::section_with_lowest_load_address): Likewise.
5056 (Output_segment::write_section_headers): Likewise.
5057 (Output_segment::print_sections_to_map): Likewise.
5058 * output.h (class Output_data): Remove dynamic_reloc_count_
5059 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5060 (Output_data::add_dynamic_reloc): Rewrite.
5061 (Output_data::has_dynamic_reloc): New function.
5062 (Output_data::dynamic_reloc_count): Remove.
5063 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5064 is_last_relro_, is_first_non_relro_, is_interp_,
5065 is_dynamic_linker_section_ fields. Add order and set_order
5066 functions. Remove is_relro_local, set_is_relro_local,
5067 is_last_relro, set_is_last_relro, is_first_non_relro,
5068 set_is_first_non_relro functions, is_interp, set_is_interp,
5069 is_dynamic_linker_section, and set_is_dynamic_linker_section
5071 (class Output_segment): Change Output_data_list from std::list to
5072 std:;vector. Add output_lists_ field. Remove output_data_ and
5073 output_bss_ fields. Update declarations.
5075 2010-08-02 Ian Lance Taylor <iant@google.com>
5077 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5078 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5079 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5081 2010-08-02 Ian Lance Taylor <iant@google.com>
5084 * script.cc (Script_options::Script_options): Initialize
5085 symbol_definitions_ and symbol_references_.
5086 (Script_options::add_symbol_assignment): Update
5087 symbol_definitions_ and symbol_references_.
5088 (Script_options::add_symbol_reference): New function.
5089 (script_symbol): New function.
5090 * script.h (class Script_options): Add symbol_definitions_ and
5091 symbol_references_ fields.
5092 (Script_options::referenced_const_iterator): New type.
5093 (Script_options::referenced_begin): New function.
5094 (Script_options::referenced_end): New function.
5095 (Script_options::is_referenced): New function.
5096 (Script_options::any_unreferenced): New function.
5097 * script-c.h (script_symbol): Declare.
5098 * yyscript.y (exp): Call script_symbol.
5099 * symtab.cc: Include "script.h".
5100 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5101 Change all callers. Check symbols referenced by scripts.
5102 (Symbol_table::add_undefined_symbols_from_command_line): Add
5103 layout parameter. Change all callers.
5104 (Symbol_table::do_add_undefined_symbols_from_command_line):
5105 Likewise. Break out loop body. Check symbols referenced by
5107 (Symbol_table::add_undefined_symbol_from_command_line): New
5108 function broken out of
5109 do_add_undefined_symbols_from_command_line.
5110 * symtab.h (class Symbol_table): Update declarations.
5111 * archive.cc: Include "layout.h".
5112 (Archive::should_include_member): Add layout parameter. Change
5113 all callers. Check for symbol mentioned in expression.
5114 * archive.h (class Archive): Update declaration.
5115 * object.cc (Sized_relobj::do_should_include_member): Add layout
5117 * object.h (Object::should_include_member): Add layout parameter.
5119 (Object::do_should_include_member): Add layout parameter.
5120 (class Sized_relobj): Update declaration.
5121 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5123 * dynobj.h (class Sized_dynobj): Update declaration.
5124 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5126 * plugin.h (class Sized_pluginobj): Update declaration.
5128 2010-08-02 Ian Lance Taylor <iant@google.com>
5131 * output.cc (Output_segment::set_offset): Search for the first and
5132 last sections rather than assuming that the list is in order.
5133 (Output_segment::find_first_and_last_list): New function.
5134 * output.h (class Output_segment): Update declarations.
5135 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5136 (relro_strip_test_SOURCES): New variable.
5137 (relro_strip_test_DEPENDENCIES): New variable.
5138 (relro_strip_test_LDFLAGS): New variable.
5139 (relro_strip_test_LDADD): New variable.
5140 (relro_strip_test.so): New target.
5142 2010-08-02 Ian Lance Taylor <iant@google.com>
5144 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5145 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5146 (Target_i386::got_tlsdesc_section): New function.
5147 (Target_i386::got_section): Create space for GOT entries for
5148 TLSDESC relocations.
5149 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5151 (Target_i386::Scan::global): Likewise.
5152 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5154 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5155 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5156 (Target_x86_64::got_tlsdesc_section): New function.
5157 (Target_x86_64::got_section): Create space for GOT entries for
5158 TLSDESC relocations.
5159 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5161 (Target_x86_64::Scan::global): Likewise.
5162 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5165 2010-08-02 Ian Lance Taylor <iant@google.com>
5167 * testsuite/final_layout.sh: Use dc to convert from hex to
5170 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5172 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5173 paramter to the call to gold::gc_process_relocs.
5174 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5175 paramter to the call to gold::gc_process_relocs.
5176 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5177 parameter to the call to gold::gc_process_relocs.
5178 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5179 template parameter to the call to gold::gc_process_relocs.
5180 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5181 paramter to the call to gold::gc_process_relocs.
5182 * gc.h (get_embedded_addend_size): New function.
5183 (gc_process_relocs): Save the size of the reloc for use by ICF.
5184 * icf.cc (get_section_contents): Get the addend from the text section
5185 for SHT_REL relocation sections.
5186 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5187 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5188 * int_encoding.h (read_from_pointer): New overloaded function.
5189 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5190 * testsuite/icf_sht_rel_addend_test.sh: New file.
5191 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5192 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5194 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5196 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5197 * Makefile.in: Regenerate.
5198 * testsuite/Makefile.in: Regenerate.
5200 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5202 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5203 * gold/testsuite/debug_msg.cc: Likewise.
5204 * gold/testsuite/odr_violation1.cc
5205 * gold/testsuite/odr_violation2.cc
5207 2010-07-21 Cary Coutant <ccoutant@google.com>
5209 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5210 string, and length fields.
5211 (Output_merge_string::Merged_strings_list): New type.
5212 (Output_merge_string::Merged_strings_lists): New typedef.
5213 (Output_merge_string): Replace merged_strings_ with
5214 merged_strings_lists_.
5215 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5216 Merged_strings_list per input object and section. Don't store pointer
5217 to the string. Don't store length with each merged string entry.
5218 (Output_merge_string::finalize_merged_data): Loop over list of merged
5219 strings lists. Recompute length of each merged string.
5221 2010-07-15 Cary Coutant <ccoutant@google.com>
5223 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5226 2010-07-14 Ian Lance Taylor <iant@google.com>
5228 * descriptors.cc (Descriptors::open): Report correct name in error
5231 2010-07-13 Doug Kwan <dougkwan@google.com>
5233 * arm.cc (Arm_input_section::Arm_input_section): For a
5234 SHT_ARM_EXIDX section, always keeps the input sections.
5235 (Arm_input_section::set_exidx_section_link): New method.
5236 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5237 has_errors_ to false.
5238 (Arm_exidx_input_section::has_errors,
5239 Arm_exidx_input_section::set_has_errors): New methods.
5240 (Arm_exidx_input_section::has_errors_): New data member.
5241 (Arm_relobj::get_exidx_shndx_list): New method.
5242 (Arm_output_section::append_text_sections_to_list): Do not skip
5243 section without SHF_EXECINSTR.
5244 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5246 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5247 section header. Make error messages more verbose. Check for
5248 a non-executable section linked to an EXIDX section.
5249 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5250 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5251 check that there is no deferred EXIDX section if we exit early.
5252 Instead of not making an EXIDX section in case of an error, make one
5253 and set the has_errors flag of it.
5254 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5255 in a relocatable link.
5256 (Target_arm::do_relax): Look for the EXIDX output section instead of
5257 assuming that it is called .ARM.exidx.
5258 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5259 section list. Do not check for SHF_EXECINSTR section flags but
5260 skip any input section with errors.
5261 * output.cc (Output_section::Output_section): Initialize
5262 always_keeps_input_sections_ to false.
5263 (Output_section::add_input_section): Check for
5264 always_keeps_input_sections_.
5265 * output.h (Output_section::always_keeps_input_sections,
5266 Output_section::set_always_keeps_input_sections): New methods.
5267 (Output_section::always_keeps_input_sections): New data member.
5269 2010-07-13 Rafael Espindola <espindola@google.com>
5271 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5272 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5274 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5275 Ian Lance Taylor <iant@google.com>
5277 * output.h (Output_section_lookup_maps::add_merge_section):
5278 Correct check of whether value was inserted.
5279 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5280 (Output_section_lookup_maps::add_relaxed_input_section):
5282 * arm.cc (Target_arm::got_section): Remove used local os.
5283 * i386.cc (Target_i386::got_section): Likewise.
5284 * x86_64.cc (Target_x86_64::got_section): Likewise.
5285 * sparc.cc (Target_sparc::got_section): Likewise.
5286 (Target_sparc::relocate): Remove unused local have_got_offset.
5287 * powerpc.cc (Target_powerpc::relocate): Likewise.
5289 2010-07-13 Ian Lance Taylor <iant@google.com>
5291 * compressed_output.cc (zlib_decompress): Fix signature in
5294 * archive.cc (Archive::include_member): Unlock an external member
5295 of a thin archive. Don't bother to delete an object we know is
5298 2010-07-12 Cary Coutant <ccoutant@google.com>
5300 * compressed_output.cc (zlib_decompress): New function.
5301 (get_uncompressed_size): New function.
5302 (decompress_input_section): New function.
5303 * compressed_output.h (get_uncompressed_size): New function.
5304 (decompress_input_section): New function.
5305 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5306 Handle compressed debug sections.
5307 * layout.cc (is_compressed_debug_section): New function.
5308 (Layout::output_section_name): Map compressed section names to
5310 * layout.h (is_compressed_debug_section): New function.
5311 (is_debug_info_section): Recognize compressed debug sections.
5312 * merge.cc: Include compressed_output.h.
5313 (Output_merge_data::do_add_input_section): Handle compressed
5315 (Output_merge_string::do_add_input_section): Handle compressed
5317 * object.cc: Include compressed_output.h.
5318 (Sized_relobj::Sized_relobj): Initialize new data members.
5319 (build_compressed_section_map): New function.
5320 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5321 * object.h (Object::section_is_compressed): New method.
5322 (Object::do_section_is_compressed): New method.
5323 (Sized_relobj::Compressed_section_map): New type.
5324 (Sized_relobj::do_section_is_compressed): New method.
5325 (Sized_relobj::compressed_sections_): New data member.
5326 * output.cc (Output_section::add_input_section): Handle compressed
5328 * reloc.cc: Include compressed_output.h.
5329 (Sized_relobj::write_sections): Handle compressed debug sections.
5331 2010-07-08 Cary Coutant <ccoutant@google.com>
5333 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5334 weak when resolving to a dynamic def.
5335 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5336 for weak undef/dynamic def cases. Adjust callers.
5337 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5338 undef_binding_weak_.
5339 (Symbol_table::sized_write_globals): Adjust symbol binding.
5340 (Symbol_table::sized_write_symbol): Add binding parameter.
5341 * symtab.h (Symbol::set_undef_binding): New method.
5342 (Symbol::is_undef_binding_weak): New method.
5343 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5344 (Symbol_table::should_override): Add new parameter.
5345 (Symbol_table::sized_write_symbol): Add new parameter.
5347 * testsuite/weak_undef_file1.cc: Add new test case.
5348 * testsuite/weak_undef_file2.cc: Fix header comment.
5349 * testsuite/weak_undef_test.cc: Add new test case.
5351 2010-06-29 Doug Kwan <dougkwan@google.com>
5353 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5354 Initialize USE_SYMBOL_.
5355 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5357 (Arm_reloc_property::uses_symbol_): New data member declaration.
5358 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5359 uses symbol value and symbol is undefined but not weakly undefined.
5361 2010-06-28 Rafael Espindola <espindola@google.com>
5363 * plugin.cc (Plugin::load): Use dlerror.
5365 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5367 * symtab.cc (detect_odr_violations): When reporting an ODR
5368 violation, report an object where the symbol is defined.
5370 2010-06-25 Doug Kwan <dougkwan@google.com>
5372 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5373 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5375 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5376 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5377 target hook to detect function points.
5378 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5379 * icf.h (Icf::check_section_for_function_pointers): Change type of
5380 parameter SECTION_NAME to const reference to std::string. Use
5381 target hook to determine if section may have unsafe pointers.
5382 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5385 2010-06-21 Rafael Espindola <espindola@google.com>
5387 * fileread.cc (Input_file::find_fie): New
5388 (Input_file::open): Use Input_file::find_fie.
5389 * fileread.h (Input_file::find_fie): New
5390 * plugin.cc (set_extra_library_path): New.
5391 (Plugin::load): Add set_extra_library_path to the transfer vector.
5392 (Plugin_manager::set_extra_library_path): New.
5393 (Plugin_manager::add_input_file): Use the extra search path if set.
5394 (set_extra_library_path(): New.
5395 * plugin.h (Plugin_manager): Add set_extra_library_path and
5398 2010-06-19 Cary Coutant <ccoutant@google.com>
5400 * layout.cc (gdb_sections): Add .debug_types.
5401 (lines_only_debug_sections): Likewise.
5403 2010-06-18 Rafael Espindola <espindola@google.com>
5405 * plugin.cc (add_input_file,add_input_library)
5406 (Plugin_manager::add_input_file): Make filename arguments const.
5407 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5410 2010-06-16 Doug Kwan <dougkwan@google.com>
5412 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5413 .ARM.attributes section if we have not merged any input
5414 attributes sections.
5416 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5418 * arm.cc: Allow combining objects with no EABI version
5421 2010-06-15 Rafael Espindola <espindola@google.com>
5423 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5425 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5427 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5428 (struct iovec): Correct !HAVE_READV definition.
5430 2010-06-10 Cary Coutant <ccoutant@google.com>
5432 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5433 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5435 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5438 * symtab.h (Symbol::is_placeholder): New member function.
5439 * target-reloc.h (relocate_section): Check for placeholder symbols.
5441 * testsuite/Makefile.am (plugin_test_8): New test.
5442 (plugin_test_9): New test.
5443 * testsuite/Makefile.in: Regenerate.
5445 2010-06-09 Nick Clifton <nickc@redhat.com>
5447 * yyscript.y (input_list_element): Allow strings prefixed with
5448 the '-' character. Treat these as libraries.
5449 * script.cc (script_add_library): New function. Adds a library
5450 specified by "-l<name>" found in an input script.
5451 * script-c.h: Add prototype for script_add_library.
5453 2010-06-07 Doug Kwan <dougkwan@google.com>
5455 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5456 Restrict stub-group size to be within long conditional branch
5457 range when working around cortex-A8 erratum.
5459 2010-06-07 Damien Diederen <dd@crosstwine.com>
5461 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5464 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5468 (Output_section::Input_section_sort_entry::compare_section_ordering):
5469 Change to return non-zero correctly.
5470 (Output_section::Input_section_sort_section_order_index_compare
5471 ::operator()): Change to fix ambiguity in comparisons.
5473 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5475 * gold.h (is_wildcard_string): New function.
5476 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5477 (Layout::layout_eh_frame): Ditto.
5478 (Layout::find_section_order_index): New method.
5479 (Layout::read_layout_from_file): New method.
5480 * layout.h (Layout::find_section_order_index): New method.
5481 (Layout::read_layout_from_file): New method.
5482 (Layout::input_section_position_): New private member.
5483 (Layout::input_section_glob_): New private member.
5484 * main.cc (main): Call read_layout_from_file here.
5485 * options.h (--section-ordering-file): New option.
5486 * output.cc (Output_section::input_section_order_specified_): New
5488 (Output_section::Output_section): Initialize new member.
5489 (Output_section::add_input_section): Add new parameter.
5490 Keep input sections when --section-ordering-file is used.
5491 (Output_section::set_final_data_size): Sort input sections when
5492 section ordering file is specified.
5493 (Output_section::Input_section_sort_entry): Add new parameter.
5495 (Output_section::Input_section_sort_entry::compare_section_ordering):
5497 (Output_section::Input_section_sort_compare::operator()): Change to
5498 consider section_order_index.
5499 (Output_section::Input_section_sort_init_fini_compare::operator()):
5500 Change to consider section_order_index.
5501 (Output_section::Input_section_sort_section_order_index_compare
5502 ::operator()): New method.
5503 (Output_section::sort_attached_input_sections): Change to sort
5504 according to section order when specified.
5505 (Output_section::add_input_section<32, true>): Add new parameter.
5506 (Output_section::add_input_section<64, true>): Add new parameter.
5507 (Output_section::add_input_section<32, false>): Add new parameter.
5508 (Output_section::add_input_section<64, false>): Add new parameter.
5509 * output.h (Output_section::add_input_section): Add new parameter.
5510 (Output_section::input_section_order_specified): New
5512 (Output_section::set_input_section_order_specified): New method.
5513 (Input_section::Input_section): Initialize section_order_index_.
5514 (Input_section::section_order_index): New method.
5515 (Input_section::set_section_order_index): New method.
5516 (Input_section::section_order_index_): New member.
5517 (Input_section::Input_section_sort_section_order_index_compare): New
5519 (Output_section::input_section_order_specified_): New member.
5520 * script-sections.cc (is_wildcard_string): Delete and move modified
5522 (Output_section_element_input::Output_section_element_input): Modify
5523 call to is_wildcard_string.
5524 (Output_section_element_input::Input_section_pattern
5525 ::Input_section_pattern): Ditto.
5526 (Output_section_element_input::Output_section_element_input): Ditto.
5527 * testsuite/Makefile.am (final_layout): New test case.
5528 * testsuite/Makefile.in: Regenerate.
5529 * testsuite/final_layout.cc: New file.
5530 * testsuite/final_layout.sh: New file.
5532 2010-06-01 Rafael Espindola <espindola@google.com>
5534 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5536 2010-06-01 Rafael Espindola <espindola@google.com>
5538 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5539 visibility of symbols.
5541 2010-05-27 Doug Kwan <dougkwan@google.com>
5543 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5544 from start of output section instead of address for a local symbol
5545 in a merged or relaxed section when doing a relocatable link.
5547 2010-05-26 Rafael Espindola <espindola@google.com>
5550 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5551 adding sections the garbage collector removed.
5552 * gold/testsuite/Makefile.am: Add test.
5553 * gold/testsuite/Makefile.in: Regenerate.
5554 * gold/testsuite/plugin_test_7.sh: New.
5555 * gold/testsuite/plugin_test_7_1.c: New.
5556 * gold/testsuite/plugin_test_7_2.c: New.
5558 2010-05-26 Rafael Espindola <espindola@google.com>
5560 * script-sections.cc (Output_section_definition::set_section_addresses):
5561 Check for --section-start.
5563 2010-05-26 Doug Kwan <dougkwan@google.com>
5565 * arm.cc (Arm_scan_relocatable_relocs): New class.
5566 (Target_arm::relocate_special_relocatable): New method.
5567 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5568 (Arm_relocate_functions::thumb_branch_common): Same.
5569 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5570 instead of Default_scan_relocatable_relocs.
5571 * target-reloc.h (relocate_for_relocatable): Let target handle
5572 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5573 * target.h (Sized_target::relocate_special_relocatable): New method.
5575 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5577 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5579 2010-05-23 Doug Kwan <dougkwan@google.com>
5581 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5583 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5584 with a direct branch, not a conditional branch, to a stub.
5585 * merge.cc (Output_merge_base::record_input_section): New method
5587 (Output_merge_data::do_add_input_section): Record input section if
5588 keeps-input-sections flag is set.
5589 (Output_merge_string::do_add_input_section): Ditto.
5590 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5591 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5593 (Output_merge_base::keeps_input_sections,
5594 Output_merge_base::set_keeps_input_sections,
5595 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5597 (Output_merge_base::Input_sections): New type declaration.
5598 (Output_merge_base::input_sections_begin,
5599 Output_merge_base::input_sections_end,
5600 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5601 (Output_merge_base::bool keeps_input_sections_,
5602 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5603 Output_merge_base::input_sections_): New data members.
5604 (Output_merge_data::do_set_keeps_input_sections): New method
5606 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5607 * output.cc (Output_section::Input_section::relobj): Move method
5608 defintion from class declaration to here and handle merge sections.
5609 (Output_section::Input_section::shndx): Ditto.
5610 (Output_section::Output_section): Remove initializations of removed
5611 data members and initialize new data member LOOKUP_MAPS_.
5612 (Output_section::add_input_section): Set keeps-input-sections flag
5613 for a newly created merge output section as appropriate. Adjust code
5614 to use Output_section_lookup_maps class.
5615 (Output_section::add_relaxed_input_section): Adjst code for lookup
5616 maps code refactoring.
5617 (Output_section::add_merge_input_section): Add a new parameter
5618 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5619 class. If adding input section to a newly created merge output
5620 section fails, remove the new merge section.
5621 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5622 Adjust code for use of the Output_section_lookup_maps class.
5623 (Output_section::find_merge_section): Ditto.
5624 (Output_section::build_lookup_maps): New method defintion.
5625 (Output_section::find_relaxed_input_section): Adjust code to use
5626 Output_section_lookup_maps class.
5627 (Output_section::get_input_sections): Export merge sections. Adjust
5628 code to use Output_section_lookup_maps class.
5629 (Output_section:::add_script_input_section): Adjust code to use
5630 Output_section_lookup_maps class. Update lookup maps for merge
5632 (Output_section::discard_states): Use Output_section_lookup_maps.
5633 (Output_section::restore_states): Same.
5634 * output.h (Merge_section_properties): Move class defintion out of
5636 (Output_section_lookup_maps): New class.
5637 (Output_section::Input_section::is_merge_section): New method
5639 (Output_section::Input_section::relobj): Move defintion out of class
5640 defintion. Declare method only.
5641 (Output_section::Input_section::shndx): Ditto.
5642 (Output_section::Input_section::output_merge_base): New method defintion.
5643 (Output_section::Input_section::u2_.pomb): New union field.
5644 (Output_section::Merge_section_by_properties_map,
5645 Output_section::Output_section_data_by_input_section_map,
5646 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5648 (Output_section::add_merge_input_section): Add new parameter
5649 KEEPS_INPUT_SECTIONS.
5650 (Output_section::build_lookup_maps): New method declaration.
5651 (Output_section::merge_section_map_,
5652 Output_section::merge_section_by_properties_map_,
5653 Output_section::relaxed_input_section_map_,
5654 Output_section::is_relaxed_input_section_map_valid_): Remove data
5656 (Output_section::lookup_maps_): New data member.
5658 2010-05-21 Doug Kwan <dougkwan@google.com>
5661 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5662 avoid a compilation error.
5664 2010-05-19 Rafael Espindola <espindola@google.com>
5666 * script-sections.cc (Output_section_definition::allocate_to_segment):
5667 Update the phdrs_list even when the output section is NULL.
5668 * testsuite/Makefile.am: Add test.
5669 * testsuite/Makefile.in: Regenerate.
5670 * testsuite/script_test_9.cc: New.
5671 * testsuite/script_test_9.sh: New.
5672 * testsuite/script_test_9.t: New.
5674 2010-05-19 Doug Kwan <dougkwan@google.com>
5676 * arm.cc (Arm_input_section::original_size): New method.
5677 (Arm_input_section::do_addralign): Add a cast.
5678 (Arm_input_section::do_output_offset): Remove static cast.
5679 (Arm_input_section::original_addralign,
5680 Arm_input_section::original_size_): Change type to uint32_t.
5681 (Arm_input_section::init): Add safe casts for section alignment
5683 (Arm_input_section::set_final_data_size): Do not set address and
5684 offset of stub table.
5685 (Arm_output_section::fix_exidx_coverage): Change use of of
5686 Output_section::Simple_input_section to that of
5687 Output_section::Input_section.
5688 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5689 except for the first pass.
5690 * output.cc (Output_section::get_input_sections): Change type of
5691 input_sections to std::list<Input_section>.
5692 (Output_section::add_script_input_section): Rename from
5693 Output_section::add_simple_input_section. Change type of SIS
5694 parameter from Simple_input_section to Input_section.
5695 * output.h (Output_section::Simple_input_section): Remove class.
5696 (Output_section::Input_section): Change class visibility to public.
5697 (Output_section::Input_section::addralign): Use stored alignments
5698 for special input sections if set.
5699 (Output_section::Input_section::set_addralign): New method.
5700 (Output_section::get_input_sections): Change parameter type from
5701 list of Simple_input_section to list of Input_section.
5702 (Output_section::add_script_input_section): Rename from
5703 Output_section::add_simple_input_section. Change first parameter's
5704 type from Simple_input_section to Input_section and remove the
5705 second and third parameters.
5706 * script-sections.cc (Input_section::Input_section_list): Change
5707 type to list of Output_section::Input_section/
5708 (Input_section_info::Input_section_info): Change parameter type of
5709 INPUT_SECTION to Output_section::Input_section.
5710 (Input_section_info::input_section): Change return type.
5711 (Input_section_info::input_section_): Change type to
5712 Output_section::Input_section.
5713 (Output_section_element_input::set_section_addresses): Adjust code
5714 to use Output_section::Input_section instead of
5715 Output_section::Simple_input_section. Adjust code for renaming
5716 of Output_section::add_simple_input_section.
5717 (Orphan_output_section::set_section_addresses): Ditto.
5719 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5721 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5722 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5724 2010-05-18 Rafael Espindola <espindola@google.com>
5726 * options.cc (General_options::finalize): Handle -nostdlib.
5727 * options.h (nostdlib): New option.
5728 * script.cc (script_add_search_dir): Handle -nostdlib.
5730 2010-05-12 Doug Kwan <dougkwan@google.com>
5732 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5733 attributes section only if there no attributes section after merging.
5734 (Target_arm::merge_object_attributes): Move value of
5735 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5736 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5737 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5738 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5739 and arm_attr_merge_7.stdout.
5740 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5741 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5742 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5743 arm_attr_merge_7b.o): New rules.
5744 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5746 * testsuite/Makefile.in: Regenerate.
5747 * testsuite/arm_attr_merge.sh: New file.
5748 * testsuite/arm_attr_merge_[67][ab].s: Same.
5750 2010-05-05 Nick Clifton <nickc@redhat.com>
5752 * po/es.po: Updated Spanish translation.
5754 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5756 * Makefile.am (install-exec-local): Properly install gold as
5757 default cross linker.
5758 * Makefile.in: Regenerated.
5760 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5761 Nick Clifton <nickc@redhat.com>
5763 * configure.ac (install_as_default): Define and set to false
5764 unless --enable-gold or --enable-gold=both/gold has been
5766 * configure: Regenerate.
5768 * Makefile.am (install-exec-local): Install the executable as
5769 'ld.gold'. If install_as_default is true then also install it as
5771 * Makefile.in: Regenerated.
5773 2010-04-24 Ian Lance Taylor <iant@google.com>
5775 * layout.cc (Layout::layout_reloc): In relocatable link don't
5776 combine reloc sections for grouped sections.
5778 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5780 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5781 sections that are not ordinary to icf.
5782 * icf.cc (get_section_contents): Handle relocation pointing to section
5783 with no object or shndx information.
5784 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5785 * testsuite/Makefile.in: Regenerate.
5786 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5787 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5789 2010-04-22 Ian Lance Taylor <iant@google.com>
5791 * expression.cc (Expression::Expression_eval_info): Add
5792 result_alignment_pointer field.
5793 (Expression::eval_with_dot): Add result_alignment_pointer
5794 parameter. Change all callers.
5795 (Expression::eval_maybe_dot): Likewise.
5796 (class Binary_expression): Add alignment_pointer parameter to
5797 left_value and right_value. Change all callers.
5798 (BINARY_EXPRESSION): Set result alignment.
5799 (class Trinary_expression): Add alignment_pointer parameter to
5800 arg2_value and arg3_value. Change all callers.
5801 (Trinary_cond::value): Set result alignment.
5802 (Max_expression::value, Min_expression::value): Likewise.
5803 (Align_expression::value): Likewise.
5804 * script-sections.cc (class Sections_element): Add dot_alignment
5805 parameter to set_section_addresses virtual function. Update
5807 (class Output_section_element): Likewise.
5808 (Script_sections::create_segments): Add dot_alignment parameter.
5810 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5811 (Script_sections::set_phdrs_clause_addresses): Likewise.
5812 * script-sections.h: Update declarations.
5813 * script.h: Update declarations.
5814 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5816 * testsuite/script_test_3.t: Set large alignment.
5817 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5818 segment has expected alignment.
5820 2010-04-22 Nick Clifton <nickc@redhat.com>
5822 * po/gold.pot: Updated by the Translation project.
5823 * po/vi.po: Updated Vietnamese translation.
5825 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5827 * testsuite/Makefile.am (check_PROGRAMS): Add
5828 icf_virtual_function_folding_test.
5829 * testsuite/Makefile.in: Regenerated.
5831 2010-04-15 Andrew Haley <aph@redhat.com>
5833 * options.h (merge_exidx_entries): New option.
5834 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5835 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5836 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5837 (Target_arm::merge_exidx_entries): New function.
5838 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5839 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5840 to Arm_exidx_fixup constructor.
5841 Add new arg, merge_exidx_entries.
5842 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5843 Arm_output_section::fix_exidx_coverage.
5845 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5847 * icf.cc (get_section_contents): Check for preemptible functions.
5848 Ignore addend when appropriate.
5849 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5851 (add_from_relobj): Check for section folded.
5852 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5853 * symtab.h (should_add_dynsym_entry): Add new parameter.
5854 * target-reloc.h (scan_relocs): Check for section folded.
5855 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5856 Check reloc types for function pointers in shared objects.
5857 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5859 (icf_preemptible_functions_test): New test case.
5860 (icf_string_merge_test): New test case.
5861 * testsuite.Makefile.in: Regenerate.
5862 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5863 bar_glob. Refactor code.
5864 * testsuite/icf_preemptible_functions_test.cc: New file.
5865 * testsuite/icf_preemptible_functions_test.sh: New file.
5866 * testsuite/icf_string_merge_test.cc: New file.
5867 * testsuite/icf_string_merge_test.sh: New file.
5868 * testsuite/icf_virtual_function_folding_test.cc: New file.
5869 * testsuite/icf_virtual_function_folding_test.sh: New file.
5871 2010-04-14 Doug Kwan <dougkwan@google.com>
5873 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5874 for local symbol recounting if we remove a section due to ICF.
5875 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5876 there are no regular objects in input.
5878 2010-04-13 Doug Kwan <dougkwan@google.com>
5880 * arm.cc (Arm_input_section::set_final_data_size): Compute
5881 accurate final data size instead of using current data size.
5883 2010-04-09 Doug Kwan <dougkwan@google.com>
5885 * layout.cc (Layout::choose_output_section): Handle script section
5887 (Layout::make_output_section_for_script): Add section type parameter.
5888 Handle script section types.
5889 * layout.h (Layout::make_output_section_for_script): Add section
5891 * output.cc (Output_section::Output_section): Initialize data member
5893 (Output_section::do_reset_address_and_file_offset): Do not set address
5894 to 0 if section is a NOLOAD section.
5895 * output.h (Output_section::is_noload): New method.
5896 (Output_section::set_is_noload): Ditto.
5897 (Output_section::is_noload_): New data member.
5898 * script-c.h (Script_section_type): New enum type.
5899 (struct Parser_output_section_header): Add new file section_type.
5900 * script-sections.cc (Sections_element::output_section_name): Add
5901 parameter for returning script section type.
5902 (Output_section_definition::output_section_name): Ditto.
5903 (Output_section_definition::section_type)P; New method.
5904 (Output_section_definiton::script_section_type_name): Ditto.
5905 (Output_section_definition::script_section_type_): New data member.
5906 (Output_section_definition::Output_section_definition): Initialize
5907 data member Output_section_definition::script_section_type_.
5908 (Output_section_definition::create_sections): Pass script section type
5909 to Layout::make_output_section_for_script.
5910 (Output_section_definition::output_section_name): Return script
5911 section type to caller.
5912 (Output_section_definition::set_section_address): Do not advance
5913 dot value and load address if section type is NOLOAD. Set address
5914 of NOLOAD sections regardless of section flags.
5915 (Output_section_definition::print): Print section type if it is
5916 not SCRIPT_SECTION_TYPE_NONE.
5917 (Output_section_definition::section_type): New method.
5918 (Output_section_definition::script_section_type_name): Ditto.
5919 (Script_sections::output_section_name): Add new parameter
5920 PSECTION_TYPE for returning script section type. Pass it to
5921 section elements. Handle discard sections.
5922 (Sort_output_sections::operator()): Handle NOLOAD sections.
5923 * script-sections.h (Script_sections::Section_type): New enum type.
5924 (Script_sections::output_section_name): Add a new parameter for
5925 returning script section type.
5926 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5928 * yyscript.y (union): Add new field SECTION_TYPE.
5929 (COPY, DSECT, INFO, NOLOAD): New tokens.
5930 (opt_address_and_section_type): Change type to output_section_header.
5931 (section_type): New non-terminal
5932 (section_header): Handle section type.
5933 (opt_address_and_section_type): Return section type value.
5935 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
5937 * testsuite/plugin_common_test_1.c (foo): Add prototype.
5938 * testsuite/plugin_common_test_2.c (foo): Likewise.
5940 2010-04-08 Doug Kwan <dougkwan@google.com>
5942 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5944 * output.cc (Output_section::add_merge_input_section): Simplify
5945 code and return status of Output_merge_base::add_input_section.
5946 Update merge section map only if Output_merge_base::add_input_section
5949 2010-04-07 Doug Kwan <dougkwan@google.com>
5951 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5952 if section is marked as containing instructions but has no mapping
5954 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5955 correct section index.
5956 (Arm_relobj::find_linked_text_section): Ditto.
5958 2010-04-07 Cary Coutant <ccoutant@google.com>
5960 * archive.cc (include_member): Destroy Read_symbols_data object before
5962 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5963 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5964 (Read_symbols_data::~Read_symbols_data) New destructor.
5965 (Section_relocs::Section_relocs) New constructor.
5966 (Section_relocs::~Section_relocs) New destructor.
5967 (Read_relocs_data::Read_relocs_data) New constructor.
5968 (Read_relocs_data::~Read_relocs_data) New destructor.
5969 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5970 pointers to NULL after deleting.
5972 2010-04-07 Doug Kwan <dougkwan@google.com>
5974 * arm.cc: Replace "endianity" with "endianness" in comments.
5975 (Arm_exidx_cantunwind): Ditto.
5976 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5977 (Arm_relobj::merge_flags_and_attributes): New method.
5978 (Arm_relobj::merge_flags_and_attributes_): New data member.
5979 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5980 (Arm_relobj::scan_sections_for_stubs): Ditto.
5981 (Arm_relobj::do_read_symbols): Check to see if we really want to
5982 merge processor-specific flags and attributes. Exit early if
5983 an object is empty except for section names and the undefined symbol.
5984 (Target_arm::do_finalize_sections): Move check for ELF format to
5985 Arm_relobj::do_read_symbols. Merge processor specific flags and
5986 attributes from a regular object only when we have determined that
5987 it is aapropriate. Do not create an .ARM.attributes section in
5988 output if there is no regular input object.
5989 (Target_arm::merge_processor_specific_flags): Check
5990 --warn-mismatch before printing any error.
5991 (Target_arm::merge_object_attributes): Ditto.
5992 * gold.cc (queue_middle_tasks): Handle the case in which there is
5993 no regular object in input.
5994 * options.cc (General_options::parse_EB): New method.
5995 (General_options::parse_EL): Same.
5996 (General_options::General_options): Initialize endianness_.
5997 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5999 (General_options::Endianness): New enum.
6000 (General_options::endianness): New method.
6001 (General_options::endianness_): New data member.
6002 * parameters.cc (Parameters::set_options): Check target endianness.
6003 (Parameters::set_target_once): Ditto.
6004 (Parameters::check_target_endianness): New method.
6005 (parameters_force_valid_target): If either -EL or -EB is specified,
6006 use it to define endianness of default target.
6007 * parameters.h (Parameters::check_target_endianness): New method
6009 * target.h (class Target): Change "endianity" to "endianness"
6012 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6014 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6015 * configure: Regenerate.
6016 * Makefile.in: Regenerate.
6017 * testsuite/Makefile.in: Regenerate.
6019 2010-04-06 Cary Coutant <ccoutant@google.com>
6022 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6023 prevailing definitions of common symbols.
6024 * testsuite/plugin_test_6.sh: New test case.
6025 * testsuite/plugin_common_test_1.c: New test case.
6026 * testsuite/plugin_common_test_2.c: New test case.
6027 * testsuite/Makefile.am (plugin_test_6): New test case.
6028 * testsuite/Makefile.in: Regenerate.
6030 2010-04-06 Nick Clifton <nickc@redhat.com>
6032 * po/vi.po: New Vietnamese translation.
6034 2010-03-30 Doug Kwan <dougkwan@google.com>
6036 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6038 2010-03-25 Doug Kwan <dougkwan@google.com>
6040 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6041 to avoid a conversion warning on a 32-bit host.
6043 2010-03-24 Ian Lance Taylor <iant@google.com>
6045 * testsuite/script_test_3.t: Add a TLS segment.
6046 * testsuite/Makefile.am (check_PROGRAMS): Add
6047 tls_phdrs_script_test.
6048 (tls_phdrs_script_test_SOURCES): Define.
6049 (tls_phdrs_script_test_DEPENDENCIES): Define.
6050 (tls_phdrs_script_test_LDFLAGS): Define.
6051 (tls_phdrs_script_test_LDADD): Define.
6052 * testsuite/Makefile.in: Rebuild.
6054 2010-03-23 Cary Coutant <ccoutant@google.com>
6056 * fileread.cc (find_or_make_view): Fix comment.
6058 2010-03-23 Ian Lance Taylor <iant@google.com>
6060 * script-sections.cc (class Orphan_section_placement): Define
6061 PLACE_TLS and PLACE_TLS_BSS.
6062 (Orphan_section_placement::Orphan_section_placement): Initialize
6064 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6065 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6066 (tls_script_test_SOURCES): Define.
6067 (tls_script_test_DEPENDENCIES): Define.
6068 (tls_script_test_LDFLAGS): Define.
6069 (tls_script_test_LDADD): Define.
6070 * testsuite/Makefile.in: Rebuild.
6072 2010-03-22 Doug Kwan <dougkwan@google.com>
6074 * arm.cc (Arm_relocate_functions::abs8,
6075 Arm_relocate_functions::abs16): Use correct check for overflow
6076 specified in the ARM ELF specs.
6077 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6078 target of a BLX instruction specially.
6079 (Reloc_stub::stub_type_for_reloc): Ditto.
6080 (Relocate::relocate): Use symbolic names instead of numeric relocation
6081 codes to report error.
6082 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6084 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6085 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6086 thumb2_blx_out_of_range.stdout
6087 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6088 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6089 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6090 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6091 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6092 thumb2_blx_in_range, thumb2_blx_in_range.o,
6093 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6094 thumb2_blx_out_of_range.o): New rules.
6095 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6096 thumb2_blx_in_range and thumb2_blx_out_of_range.
6097 * testsuite/Makefile.in: Regenerate.
6098 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6099 * testsuite/thumb_blx_in_range.s: New file.
6100 * testsuite/thumb_blx_out_of_range.s: New file.
6102 2010-03-22 Rafael Espindola <espindola@google.com>
6104 * archive.cc (Should_include): Move to archive.h.
6105 (should_include_member): Make it a member of Archive.
6107 (Add_lib_group_symbols): New.
6108 * archive.h: Include options.h.
6109 (Archive_member): Moved from Archive.
6110 (Should_include): Moved from archive.cc.
6112 (Add_lib_group_symbols): New.
6113 * dynobj.cc (do_should_include_member): New.
6114 * dynobj.h (do_should_include_member): New.
6115 * gold.cc (queue_initial_tasks): Update call to queue.
6116 * main.cc (main): Print lib group stats.
6117 * object.cc (do_should_include_member): New.
6118 * object.h: Include archive.h.
6119 (Object::should_include_member): New.
6120 (Object::do_should_include_member): New.
6121 (Sized_relobj::do_should_include_member): New.
6122 * options.cc (General_options::parse_start_lib): New.
6123 (General_options::parse_end_lib): New.
6124 (Input_arguments::add_file): Handle lib groups.
6125 (Input_arguments::start_group): Check we are not in a lib.
6126 (Input_arguments::start_lib): New.
6127 (Input_arguments::end_lib): New.
6128 * options.h (General_options): Add start_lib and end_lib.
6129 (Input_argument::lib_): New.
6130 (Input_argument::lib): New.
6131 (Input_argument::is_lib): New.
6132 (Input_file_lib): New.
6133 (Input_arguments::in_lib_): New.
6134 (Input_arguments::in_lib): New.
6135 (Input_arguments::start_lib): New.
6136 (Input_arguments::end_lib_): New.
6137 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6138 in unused members as preempted.
6139 (Sized_pluginobj::do_should_include_member): New.
6140 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6141 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6143 (Read_symbols::do_whole_lib_group): New.
6144 (Read_symbols::do_lib_group): New.
6145 (Read_symbols::do_read_symbols): Handle lib groups.
6146 (Read_symbols::get_name): Handle lib groups.
6147 * readsyms.h (Read_symbols): Add an archive member pointer.
6148 (Read_symbols::do_whole_lib_group): New.
6149 (Read_symbols::do_lib_group): New.
6150 (Read_symbols::member_): New.
6151 * script.cc (read_input_script): Update call to queue_soon.
6153 2010-03-19 Doug Kwan <dougkwan@google.com>
6155 * arm.cc (Stub_table::Stub_table): Initialize new data members
6156 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6157 (Stub_table::add_reloc_stub): Assign stub offset and update
6158 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6159 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6161 (Stub_table::update_data_size_and_addralign): Use
6162 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6163 instead of going over all reloc stubs.
6164 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6165 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6166 Stringpool_template::offset_ to size of Stringpool_char.
6167 (Stringpool_template::new_key_offset): Remove code to initialize
6168 Stringpool_template::offset_.
6169 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6170 Stringpool_template::offset_ to zero.
6172 2010-03-15 Doug Kwan <dougkwan@google.com>
6174 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6176 (Stringpool_template::new_key_offset): New method.
6177 (Stringpool_template::add_string): Assign offsets when adding new
6179 (Stringpool_template::set_string_offsets): Do not set string offsets
6180 when not optimizing.
6181 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6183 (Chunked_vector::clear): Clear size_.
6184 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6185 (Chunked_vector::size): Return size_.
6186 (Chunked_vector::push_back): Use size_ to find insert position.
6187 (Chunked_vector::size_): New data member.
6188 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6189 (Stringpool_template::new_key_offset): New method declaration.
6190 (Stringpool_template::offset_): New data member.
6192 2010-03-15 Rafael Espindola <espindola@google.com>
6194 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6195 Add_symbols' constructor.
6196 * readsyms.h (Add_symbols): Remove the input_group member.
6198 2010-03-10 Ian Lance Taylor <iant@google.com>
6200 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6201 target to ask whether a reference to a symbol requires a stack
6203 * target.h (Target::is_call_to_non_split): New function.
6204 (Target::do_is_call_to_non_split): Declare virtual function.
6205 * target.cc: Include "symtab.h".
6206 (Target::do_is_call_to_non_split): New function.
6207 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6209 2010-03-10 Cary Coutant <ccoutant@google.com>
6211 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6212 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6213 (File_read::open[2]): Add whole_file_view_ to list of views.
6214 (File_read::make_view): Remove test of whole_file_view_.
6215 (File_read::find_or_make_view): Create whole_file_view_ if
6217 (File_read::clear_views): Replace bool parameter with enum;
6218 adjust all callers. Don't delete views with permanent data;
6219 do delete cached views and views from archives if
6220 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6221 if clearing the corresponding view.
6222 * fileread.h (File_read::Clear_views_mode): New enum.
6223 (File_read::View::is_permanent_view): New method.
6224 (File_read::clear_views): Replace bool parameter
6225 with enum; adjust all callers.
6226 * options.h (General_options): Change keep_files_mapped option;
6227 add map_whole_files.
6228 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6230 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6233 2010-03-10 David S. Miller <davem@davemloft.net>
6235 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6237 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6239 * icf.cc (get_section_contents): Add '@' marker after processing the
6242 2010-03-08 Doug Kwan <dougkwan@google.com>
6244 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6245 due to a conversion warning.
6246 (Arm_relobj::update_output_local_symbol_count): Check for local
6247 symbol with unset output index.
6249 2010-03-05 Ian Lance Taylor <iant@google.com>
6251 * options.h (class General_options): Add --spare-dynamic-tags.
6252 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6253 --spare-dynamic-tags.
6255 2010-03-05 Ian Lance Taylor <iant@google.com>
6257 * incremental.cc: Include "libiberty.h".
6259 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6261 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6262 function, is_info_ member.
6263 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6264 (Versions::Versions): Update caller.
6265 (Versions::define_base_version): Likewise.
6266 (Versions::add_def): Likewise.
6268 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6270 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6271 (Scan::possible_function_pointer_reloc): New function.
6272 (Scan::local_reloc_may_be_function_pointer): Change to call
6273 possible_function_pointer_reloc.
6274 (Scan::global_reloc_may_be_function_pointer): Ditto.
6275 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6276 relocations in ".data.rel.ro._ZTV" section.
6277 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6278 * testsuite/icf_safe_so_test.cc: Ditto.
6279 * testsuite/icf_safe_test.cc: Ditto.
6280 * testsuite/icf_safe_test.sh: Ditto.
6282 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6283 Ian Lance Taylor <iant@google.com>
6285 * target-reloc.h (relocate_section): Check the symbol table index
6286 for -1U before setting the local symbol index.
6287 (scan_relocatable_relocs): If copying the relocation, record that
6288 the local symbol is required.
6289 * object.h (Symbol_value::is_output_symtab_index_set): New
6291 (Symbol_value::may_be_discarded_from_output_symtab): New
6293 (Symbol_value::has_output_symtab_entry): New function.
6294 (Symbol_value::needs_output_symtab_entry): Remove.
6295 (Symbol_value::output_symtab_index): Make sure the symbol index is
6297 (Symbol_value::set_output_symtab_index): Make sure the symbol
6298 index is not set. Make sure the new index is valid.
6299 (Symbol_value::set_must_have_output_symtab_entry): New function.
6300 (Symbol_value::has_output_dynsym_entry): New function.
6301 (Symbol_value::set_output_dynsym_index): Make sure the new index
6303 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6304 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6305 local symbol if permitted.
6306 (Sized_relobj::do_finalize_local_symbols): Call
6307 is_output_symtab_index_set rather than needs_output_symtab_entry.
6308 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6309 rather than needs_output_symtab_entry. Call
6310 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6311 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6312 is_output_symtab_index_set rather than needs_output_symtab_entry.
6313 * testsuite/discard_locals_relocatable_test.c: New file.
6314 * testsuite/discard_locals_test.sh: Test -r.
6315 * testsuite/Makefile.am (check_DATA): Add
6316 discard_locals_relocatable_test1.syms,
6317 discard_local_relocatable_test2.syms.
6318 (MOSTLYCLEANFILES): Likewise. Also add
6319 discard_locals_relocatable_test1.lout and
6320 discard_locals_relocatable_test2.out.
6321 (discard_locals_relocatable_test1.syms): New target.
6322 (discard_locals_relocatable_test.o): New target.
6323 (discard_locals_relocatable_test1.out): New target.
6324 (discard_locals_relocatable_test2.syms): New target.
6325 (discard_locals_relocatable_test2.out): New target.
6326 (various): Add missing ../ld-new dependencies.
6327 * testsuite/Makefile.in: Rebuild.
6329 2010-03-03 Nick Clifton <nickc@redhat.com>
6331 * po/fi.po: New Finnish translation.
6333 2010-03-01 Doug Kwan <dougkwan@google.com>
6335 * layout.cc (Layout::Layout): Force section types of .init_array*,
6336 .preinit_array* and .fini_array* sections.
6337 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6338 Fix check of return value of std::string::find.().
6339 (Output_section::Input_section_sort_compare::operator()): Remove
6340 comment about .init_array.
6341 (Output_section::Input_section_sort_init_fini_compare::operator()):
6343 (Output_section::sort_attached_input_sections): Handle .init_array
6344 and .fini_array specially.
6345 * output.h (Output_section::Inut_section_sort_compare): Update
6347 (Output_section::Input_section_sort_init_fini_compare): New struct.
6349 2010-02-26 Doug Kwan <dougkwan@google.com>
6351 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6352 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6353 * testsuite/debug_msg.sh: Avoid matching source line number for
6354 use of global variable undef_int.
6356 2010-02-26 Doug Kwan <dougkwan@google.com>
6358 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6359 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6360 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6361 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6362 * options.cc (General_options::General_options): Initialize member
6364 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6365 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6366 and rm_no_fix_v4bx.stdout
6367 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6368 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6369 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6370 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6371 and arm_no_fix_v4bx.
6372 * Makefile.in: Regenerate.
6373 * testsuite/arm_fix_v4bx.s: New file.
6374 * testsuite/arm_fix_v4bx.sh: Ditto.
6376 2010-02-24 Doug Kwan <dougkwan@google.com>
6378 * arm.cc (Target_arm::got_section): Make the .got section the first
6379 non RELRO section in the data segment.
6380 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6381 suffixes of section names.
6383 2010-02-24 Doug Kwan <dougkwan@google.com>
6385 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6386 flags and attributes merging if an input file is a binary file.
6387 * fileread.cc (Input_file::open): Record format of original file.
6388 * fileread.h (Input_file::Format): New enum type.
6389 (Input_file::Input_file): Initialize data member format_.
6390 (Input_file::format): New method definition.
6391 (Input_file::format_):: New data member.
6393 2010-02-24 Doug Kwan <dougkwan@google.com>
6395 * arm.cc (Arm_output_data_got): New class.
6396 (ARM_TCB_SIZE): New constant
6397 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6398 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6399 If user uses a script with a SECTIONS clause, issue only a warning
6400 for a misplaced EXIDX input section. Otherwise, issue an error.
6401 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6403 (Target_arm::got_mode_index_entry): Handle static linking.
6404 (Target_arm::Scan::local): Ditto.
6405 (Target_arm::Scan::global): Ditto.
6406 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6407 all incorrectly implemented relocations.
6408 (Target_arm::fix_exidx_coverage): Pass layout to
6409 Arm_output_section::fix_exidx_coverage.
6410 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6411 from ".ARM.exidx." and ".ARM.extab.".
6413 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6415 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6416 section if it does not already exist.
6417 * attributes.cc (Attributes_section_data::Attributes_section_data):
6418 Don't crash if size is zero.
6420 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6421 Ian Lance Taylor <iant@google.com>
6423 * gold.cc (queue_middle_tasks): If no input files were opened,
6425 * workqueue.h (Task_function::Task_function): Assert that there is
6428 2010-02-22 Doug Kwan <dougkwan@google.com>
6430 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6431 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6432 types to avoid warnings due to different uint64_t implementations
6435 2010-02-21 Doug Kwan <dougkwan@google.com>
6437 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6438 handling of the maximum backward branch offset.
6439 (Arm_relocate_functions::thumb_branch_common): Ditto.
6440 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6441 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6442 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6443 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6444 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6445 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6446 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6447 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6448 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6449 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6450 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6451 thumb2_bl_out_of_range.o): New rules.
6452 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6453 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6454 thumb2_bl_out_of_range
6455 * testsuite/Makefile.in: Regenerate.
6456 * testsuite/arm_bl_in_range.s: New file.
6457 * testsuite/arm_bl_out_of_range.s: Ditto.
6458 * testsuite/arm_branch_in_range.sh: Ditto.
6459 * testsuite/arm_branch_range.t: Ditto.
6460 * testsuite/thumb2_branch_range.t: Ditto.
6461 * testsuite/thumb_bl_in_range.s: Ditto.
6462 * testsuite/thumb_bl_out_of_range.s: Ditto.
6463 * testsuite/thumb_branch_range.t: Ditto.
6465 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6467 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6468 Add reloc offset information.
6469 * icf.cc (get_section_contents): Change iterators to point to the new
6470 vectors. Add reloc offset information to the contents.
6471 * icf.h (Icf::Sections_reachable_info): New typedef.
6472 (Icf::Sections_reachable_list): New typedef.
6473 (Icf::Offset_info): New typedef.
6474 (Icf::Reloc_info): New struct typedef.
6475 (Icf::Reloc_info_list): New typedef.
6476 (Icf::symbol_reloc_list): Delete method.
6477 (Icf::addend_reloc_list): Delete method.
6478 (Icf::section_reloc_list): Delete method.
6479 (Icf::reloc_info_list): New method.
6480 (Icf::reloc_info_list_): New member.
6482 2010-02-19 Doug Kwan <dougkwan@google.com>
6484 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6485 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6486 * arm.cc (Arm_relocation_functions): New forward declaration.
6487 (Target_arm::Target_arm): Initialize new data members
6488 got_mod_index_offset_ and tls_base_symbol_defined_.
6489 (Target_arm::Relocate::relocate_tls): New method.
6490 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6491 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6493 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6494 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6495 (Target_arm::got_mod_index_offset_,
6496 Target_arm::tls_base_symbol_defined_): New data members.
6497 (Target_arm::Scan::local, Target::Scan::global,
6498 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6501 2010-02-18 Doug Kwan <dougkwan@google.com>
6503 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6504 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6505 text section as a parameter becuase some broken tools may not set
6506 the link in section header.
6507 (Target_arm::has_got_section): New method.
6508 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6509 without any mapping symbol as data only. Remove warning.
6510 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6511 link in its section header, try to discover the link by inspecting the
6512 REL31 relocation at the beginning of the section.
6513 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6515 (Target_arm::Scan::global): Treat any reference to the symbol
6516 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6518 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6520 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6521 (Scan::global_reloc_may_be_function_pointer): New function.
6522 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6523 (Scan::global_reloc_may_be_function_pointer): New function.
6524 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6525 (Scan::global_reloc_may_be_function_pointer): New function.
6526 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6527 (Scan::global_reloc_may_be_function_pointer): New function.
6528 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6529 (Scan::global_reloc_may_be_function_pointer): New function.
6530 (Scan::possible_function_pointer_reloc): New function.
6531 (Target_x86_64::can_check_for_function_pointers): New function.
6532 * gc.h (gc_process_relocs): Scan relocation types to determine if
6533 function pointers were taken for targets that support it.
6534 * icf.cc (Icf::find_identical_sections): Include functions for
6535 folding in safe ICF whose pointer is not taken.
6536 * icf.h (Secn_fptr_taken_set): New typedef.
6537 (fptr_section_id_): New member.
6538 (section_has_function_pointers): New function.
6539 (set_section_has_function_pointers): New function.
6540 (check_section_for_function_pointers): New function.
6541 * options.h: Fix comment for safe ICF option.
6542 * target.h (can_check_for_function_pointers): New function.
6543 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6544 Modify icf_safe_test for X86-64.
6545 * testsuite/Makefile.in: Regenerate.
6546 * testsuite/icf_safe_so_test.cc: New file.
6547 * testsuite/icf_safe_so_test.sh: New file.
6548 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6549 (main): Change to take pointer to function kept_func_3.
6550 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6551 folding is done correctly for X86-64.
6553 2010-02-12 David S. Miller <davem@davemloft.net>
6555 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6556 is_symbolless parameter.
6557 (Output_reloc<SHT_REL>::is_symbolless): New.
6558 (Output_reloc<SHT_REL>::is_symbolless_): New.
6559 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6560 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6561 (Output_reloc<SHT_RELA>::is_symbolless): New.
6562 (Output_data_reloc::add_global): Handle is_symbolless.
6563 (Output_data_reloc::add_global_relative): Likewise.
6564 (Output_data_reloc::add_local): Likewise.
6565 (Output_data_reloc::add_local_relative): Likewise.
6566 (Output_data_reloc::add_symbolless_global_addend): New.
6567 (Output_data_reloc::add_symbolless_local_addend): New.
6568 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6570 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6571 instead of ->is_relative_
6572 (Output_reloc::write): Likewise.
6573 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6574 (Output_reloc::write_rel): Simplify.
6576 * sparc.cc (Target_sparc::Scan::local): Use
6577 ->add_symbolless_local_addend as needed.
6578 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6579 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6580 based upon relocation offset.
6582 2010-02-11 Doug Kwan <dougkwan@google.com>
6584 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6585 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6586 beginning of function.
6587 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6588 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6589 parameter is_32bit in calls to should_apply_static_reloc.
6590 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6591 (check_DATA): Add arm_abs_global.stdout.
6592 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6593 arm_abs_global.stdout): New rules.
6594 (MOSTLLYCLEANFILES): Add arm_abs_global
6595 * Makefile.in: Regenerate.
6596 * testsuite/arm_abs_global.s: New file.
6597 * testsuite/arm_abs_global.sh: Ditto.
6598 * testsuite/arm_abs_lib.s: Ditto.
6600 2010-02-11 Ian Lance Taylor <iant@google.com>
6602 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6604 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6605 Allocate_commons_task first.
6606 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6607 task, rather than symtab_lock_.
6608 (Gc_process_relocs::~Gc_process_relocs): New function.
6609 (Gc_process_relocs::is_runnable): Check this_blocker_.
6610 (Gc_process_relocs::locks): Use next_blocker_ rather than
6612 (Scan_relocs::~Scan_relocs): New function.
6613 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6615 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6617 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6618 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6619 constructor accordingly.
6620 (class Gc_process_relocs): Likewise.
6621 (class Scan_relocs): Likewise.
6622 * common.h (class Allocate_commons_task): Remove symtab_lock_
6623 field, and corresponding constructor parameter.
6624 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6626 (Allocate_commons_task::locks): Likewise.
6628 2010-02-11 Ian Lance Taylor <iant@google.com>
6630 * gold-threads.h (class Once): Define.
6631 (class Initialize_lock): Rewrite as child of Once.
6632 * gold-threads.cc (class Once_initialize): Define.
6633 (once_pointer_control): New static variable.
6634 (once_pointer, once_arg): New static variables.
6635 (c_run_once): New static function.
6636 (Once::Once, Once::run_once, Once::internal_run): New functions.
6637 (class Initialize_lock_once): Remove.
6638 (initialize_lock_control): Remove.
6639 (initialize_lock_pointer): Remove.
6640 (initialize_lock_once): Remove.
6641 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6642 (Initialize_lock::initialize): Rewrite.
6643 (Initialize_lock::do_run_once): New function.
6644 * archive.cc (Archive::interpret_header): Only clear name if it is
6646 * fileread.cc: Include "gold-threads.h"
6647 (file_counts_lock): New static variable.
6648 (file_counts_initialize_lock): Likewise.
6649 (File_read::release): Only increment counts when using --stats.
6650 Use a lock around the increment.
6651 * parameters.cc (class Set_parameters_target_once): Define.
6652 (set_parameters_target_once): New static variable.
6653 (Parameters::Parameters): Move here from parameters.h.
6654 (Parameters::set_target): Rewrite.
6655 (Parameters::set_target_once): New function.
6656 (Parameters::clear_target): Move here and rewrite.
6657 * parameters.h (class Parameters): Update declarations. Add
6658 set_parameters_target_once_ field.
6659 (Parameters::Parameters): Move to parameters.cc.
6660 (Parameters::clear_target): Likewise.
6661 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6663 (Start_group::~Start_group): New function.
6664 (Start_group::is_runnable): New function.
6665 (Start_group::locks, Start_group::run): New functions.
6666 (Finish_group::run): Change saw_undefined to size_t.
6667 * readsyms.h (class Start_group): Define.
6668 (class Finish_group): Change saw_undefined_ field to size_t.
6669 (Finish_group::Finish_group): Remove saw_undefined and
6670 this_blocker parameters. Change all callers.
6671 (Finish_group::set_saw_undefined): New function.
6672 (Finish_group::set_blocker): New function.
6673 * symtab.h (class Symbol_table): Change saw_undefined to return
6674 size_t. Change saw_undefined_ field to size_t.
6675 * target-select.cc (Set_target_once::do_run_once): New function.
6676 (Target_selector::Target_selector): Initialize set_target_once_
6677 field. Don't initialize lock_ and initialize_lock_ fields.
6678 (Target_selector::instantiate_target): Rewrite.
6679 (Target_selector::set_target): New function.
6680 * target-select.h (class Set_target_once): Define.
6681 (class Target_selector): Update declarations. Make
6682 Set_target_once a friend. Remove lock_ and initialize_lock_
6683 fields. Add set_target_once_ field.
6685 2010-02-10 Ian Lance Taylor <iant@google.com>
6687 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6689 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6690 (queue_middle_tasks): Add all blockers before queueing any tasks.
6691 (queue_final_tasks): Likewise.
6692 * token.h (Task_token::add_blockers): New function.
6693 * object.h (Input_objects::number_of_relobjs): New function.
6695 2010-02-10 Ian Lance Taylor <iant@google.com>
6697 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6698 shared, not if not position independent.
6699 * x86_64.cc (Relocate::relocate_tls): Likewise.
6700 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6701 (tls_pie_pic_test): New target.
6702 * testsuite/Makefile.in: Rebuild.
6704 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6705 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6706 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6707 * testsuite/Makefile.in: Rebuild.
6709 2010-02-09 David S. Miller <davem@davemloft.net>
6711 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6712 R_SPARC_RELATIVE using ->add_local_relative().
6713 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6715 * output.h (Output_data_dynamic::add_section_size): New method
6716 that takes two Output_data objects.
6717 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6718 entry param. Handle it in initializers.
6719 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6720 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6721 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6723 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6724 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6725 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6726 for dynrel_includes_plt.
6727 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6728 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6729 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6731 (Target_sparc::do_finalize_sections): Update to pass true for
6732 dynrel_includes_plt.
6733 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6734 output before .rela.plt
6735 (Target_powerpc::do_finalize_sections): Update to pass true for
6736 dynrel_includes_plt when 32-bit.
6738 2010-02-08 Doug Kwan <dougkwan@google.com>
6740 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6742 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6743 Arm_relobj::scan_section_for_cortex_a8_stubs,
6744 Arm_relobj::do_relocation_section): Instead of calling
6745 Output_section::output_address, use faster
6746 Arm_relobj::simple_input_section_output_address.
6748 2010-02-08 David S. Miller <davem@davemloft.net>
6750 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6751 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6752 relocation helper function.
6754 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6755 just like R_SPARC_GOT{10,13,22}.
6756 (Target_sparc::Scan::local): Likewise.
6757 (Target_sparc::Relocate:relocate): Likewise.
6759 2010-02-06 Ian Lance Taylor <iant@google.com>
6761 * configure.ac: Rewrite targetobjs duplicate removal code to use
6762 only shell constructs.
6763 * configure: Rebuild.
6765 2010-02-05 Doug Kwan <dougkwan@google.com>
6768 * arm.cc (Arm_relobj::section_is_scannable): New method.
6769 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6770 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6772 2010-02-04 Doug Kwan <dougkwan@google.com>
6775 * arm-reloc-property.cc (cstdio): Include.
6776 * configure.ac (targetobjs): Remove duplicates.
6777 * configure: Regenerate.
6778 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6779 big and little endian version for a given address size.
6781 2010-02-03 Doug Kwan <dougkwan@google.com>
6783 * arm-reloc-property.cc
6784 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6786 * arm-reloc-property.h
6787 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6788 New method definition.
6789 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6791 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6793 (GOT_PREL): Change implemented to Y.
6794 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6795 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6796 (Arm_relocate_functions::movw_abs_nc): Remove method.
6797 (Arm_relocate_functions::movt_abs): Ditto.
6798 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6799 (Arm_relocate_functions::thm_movt_abs): Ditto.
6800 (Arm_relocate_functions::movw_rel_nc): Ditto.
6801 (Arm_relocate_functions::movw_rel): Ditto.
6802 (Arm_relocate_functions::movt_rel): Ditto.
6803 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6804 (Arm_relocate_functions:thm_movw_rel): Ditto.
6805 (Arm_relocate_functions:thm_movt_rel): Ditto.
6806 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6807 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6808 New method definitions.
6809 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6810 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6811 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6812 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6813 (Target_arm::Relocate::relocate): Check for non-static or
6814 unimplemented relocation code and exit early. Change calls to
6815 Target_arm::reloc_uses_thumb_bit and
6816 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6817 instead. Refactor code to handle similar relocations to increase
6818 code sharing. Remove check for unsupported relocation code in switch
6820 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6821 relocation property table to find out size. Change error message to
6822 print out the name of a relocation code instead of the numeric value.
6823 (Target_arm::scan_reloc_for_stub): Use relocation property table
6824 instead of calling Target_arm::reloc_uses_thumb_bit().
6826 2010-02-02 Doug Kwan <dougkwan@google.com>
6828 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6829 types of relaxed input section.
6831 2010-02-02 Doug Kwan <dougkwan@google.com>
6833 * Makefile.am (HFILES): Add arm-reloc-property.h.
6835 (TARGETSOURCES): Add arm-reloc-property.cc
6836 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6837 (libgold_a_SOURCES): $(DEFFILES)
6838 * Makefile.in: Regenerate.
6839 * arm-reloc-property.cc: New file.
6840 * arm-reloc-property.h: New file.
6841 * arm-reloc.def: New file.
6842 * arm.cc: Update comments.
6843 (arm-reloc-property.h): New included header.
6844 (arm_reloc_property_table): New global variable.
6845 (Target_arm::do_select_as_default_target): New method definition.
6846 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6847 arm-reloc-property to targ_extra_obj.
6848 * parameters.cc (set_parameters_target): Call
6849 Target::select_as_default_target().
6850 * target.h (Target::select_as_default_target): New method definition.
6851 (Target::do_select_as_default_target): Same.
6853 2010-02-01 Doug Kwan <dougkwan@google.com>
6855 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6856 first_output_text_section_.
6857 (Arm_exidx_fixup::first_output_text_section): New method definition.
6858 (Arm_exidx_fixup::first_output_text_section_): New data member.
6859 (Arm_exidx_fixup::process_exidx_section): Record the first text
6860 output section seen.
6861 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6862 and entsize in output section header.
6864 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6866 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6867 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6868 (Arm_relocate_functions::thm_alu11): New Method.
6869 (Arm_relocate_functions::thm_pc8): New Method.
6870 (Arm_relocate_functions::thm_pc12): New Method.
6871 (Target_arm::Scan::local): Handle the relocations.
6872 (Target_arm::Scan::global): Likewise.
6873 (Target_arm::Relocate::relocate): Likewise.
6874 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6876 2010-01-29 Doug Kwan <dougkwan@google.com>
6878 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6879 of relocation types as ld.
6881 2010-01-29 Doug Kwan <dougkwan@google.com>
6883 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6885 (Arm_relocate_functions::thumb_branch_common): Ditto.
6886 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6887 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6888 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6889 Arm_relocate_functions::jump24): Remove.
6890 (Target_arm::Relocate::relocate): Adjust code to call
6891 Arm_relocation_functions::arm_branch_common and
6892 Arm_relocation_functions::thumb_branch_common instead of their removed
6893 wrappers. Merge switch-cases together to reduce source code size.
6895 2010-01-29 Doug Kwan <dougkwan@google.com>
6897 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6898 output_local_symbol_count_needs_update_.
6899 (Arm_relobj::output_local_symbol_count_needs_update,
6900 Arm_relobj::set_output_local_symbol_count_needs_update,
6901 Arm_relobj::update_output_local_symbol_count): New methods.
6902 (Arm_relobj::output_local_symbol_count_needs_update_): New data
6904 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6905 of pointed function as in a R_ARM_PREL31 relocation.
6906 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6907 for output local symbol count updating.
6908 (Target_arm::do_relax): Update output local symbol counts in objects
6910 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6912 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6914 * arm.cc: Added support for the ARM relocations:
6915 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6916 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6917 (Arm_relocate_functions::movw_rel_nc): Renamed (was
6919 (Arm_relocate_functions::movw_rel): New method.
6920 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6921 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6923 (Arm_relocate_functions::thm_movw_rel): New method.
6924 (Arm_relocate_functions::thm_movt_rel): Renamed (was
6926 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6928 (Target_arm::Scan::global): Likewise.
6929 (Target_arm::Relocate::relocate): Likewise.
6930 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6933 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6935 * arm.cc: Added support for ARM group relocations.
6936 (Target_arm::reloc_needs_sym_origin): New method.
6937 (Arm_relocate_functions::calc_grp_kn): New method.
6938 (Arm_relocate_functions::calc_grp_residual): New method.
6939 (Arm_relocate_functions::calc_grp_gn): New method.
6940 (Arm_relocate_functions::arm_grp_alu): New Method.
6941 (Arm_relocate_functions::arm_grp_ldr): New Method.
6942 (Arm_relocate_functions::arm_grp_ldrs): New Method.
6943 (Arm_relocate_functions::arm_grp_ldc): New Method.
6944 (Target_arm::Scan::local): Handle the ARM group relocations.
6945 (Target_arm::Scan::global): Likewise.
6946 (Target_arm::Relocate::relocate): Likewise.
6947 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6950 2010-01-26 Doug Kwan <dougkwan@google.com>
6952 * arm.cc (set): Include.
6953 (class Arm_exidx_fixup): Change type of last_input_section_ to const
6955 (Arm_output_section::Text_section_list): New type.
6956 (Arm_output_section::append_text_sections_to_list): New method.
6957 (Arm_output_section::fix_exidx_coverage): Ditto.
6958 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6959 (Arm_relobj::convert_input_section_to_relaxed_section): Use
6960 Relobj::set_section_offset() instead of
6961 Sized_relobj::invalidate_section_offset().
6962 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6963 parameter for section headers. Ignore relocation sections for
6964 unallocated sections and EXIDX sections.
6965 (Target_arm::fix_exidx_coverage): New method.
6966 (Target_arm::output_section_address_less_than): New type.
6967 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6968 linked text section instead of the EXIDX section.
6969 (Arm_output_section::create_stub_group): Add an assertion to check
6970 that this is not an EXIDX output section.
6971 (Arm_output_section::append_text_sections_to_list): New method.
6972 (Arm_output_section::fix_exidx_coverage): Ditto.
6973 (Arm_relobj::scan_sections_for_stubs): Adjust call to
6974 Arm_relobj::section_needs_reloc_stub_scanning.
6975 (Target_arm::do_relax): Fix EXIDX output section coverage in the
6977 (Target_arm::fix_exidx_coverage): New method.
6978 * object.h (Relobj::set_output_section): New method.
6979 (Sized_relobj::invalidate_section_offset): Remove method.
6980 (Sized_relobj::do_invalidate_section_offset): Remove method.
6981 (Sized_relobj::do_set_section_offset): Handle offset value -1.
6983 2010-01-25 Doug Kwan <dougkwan@google.com>
6985 * arm.cc (Arm_exidx_merged_section::do_output_offset):
6986 Fix warning due to signed and unsigned comparison on a 32-bit host.
6988 2010-01-22 Doug Kwan <dougkwan@google.com>
6990 * arm.cc (Target_arm::do_relax): Record an output section for section
6991 offset adjustment it contains any stub table that has changed.
6992 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6993 offsets in an output section if necessary.
6994 * output.cc (Output_section::Output_section): Initialize
6995 section_offsets_need_adjustments_.
6996 (Output_section::add_input_section_for_script): Renamed to
6997 Output_section::add_simple_input_section.
6998 (Output_section::save_states): Add a comment.
6999 (Output_section::discard_states): New method defintion.
7000 (Output_section::adjust_section_offsets): Same.
7001 * output.h (Output_section::add_input_section_for_script): Renamed to
7002 Output_section::add_simple_input_section.
7003 (Output_section::discard_states): New method declaration.
7004 (Output_section::adjust_section_offsets): Same.
7005 (Output_section::section_offsets_need_adjustment,
7006 Output_section::set_section_offsets_need_adjustment): New method
7008 (Output_section::section_offsets_need_adjustment_): New data member.
7009 * script-sections.cc
7010 (Output_section_element_input::set_section_address): Adjust code for
7011 renaming of Output_section::add_input_section_for_script.
7012 (Orphan_output_section::set_section_address): Same.
7014 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7016 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7017 Fix_v4bx enum values .
7018 * gold/options.h (General_options): New option definitions.
7019 (General_options::fix_v4bx): New method.
7020 (General_options::Fix_v4bx): New enum.
7021 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7022 (General_options::parse_fix_v4bx_interworking): New method.
7024 2010-01-22 Doug Kwan <dougkwan@google.com>
7026 * arm.cc (Arm_exidx_fixup): New class.
7028 2010-01-21 Doug Kwan <dougkwan@google.com>
7030 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7032 (Arm_exidx_section_offset_map): New type.
7034 2010-01-21 Doug Kwan <dougkwan@google.com>
7036 * arm.cc (Arm_exidx_input_section): New class.
7037 (Arm_relobj::exidx_input_section_by_link,
7038 Arm_relobj::exidx_input_section_by_shndx,
7039 Arm_relobj::make_exidx_input_section): New methods.
7040 (read_arm_attributes_section): Remove.
7041 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7042 information about them.
7043 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7046 2010-01-20 Doug Kwan <dougkwan@google.com>
7048 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7049 Input_section_specifier to Section_id.
7050 (Target_arm::new_arm_input_section: Adjust code for change of key
7052 (Target_arm::find_arm_input_section): Ditto.
7053 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7054 (Section_id): Remove.
7055 (Garbage_collection::Section_id_hash): Remove.
7056 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7057 (Section_id): Remove.
7058 (Icf::Section_id_hash): Remove.
7059 * object.h (Section_id, Const_section_id, Section_id_hash,
7060 Const_section_id_hash): New type definitions.
7061 * output.cc (Output_section::add_relaxed_input_section): Change to
7062 use Const_section_id instead of Input_section_specifier as key type.
7063 (Output_section::add_merge_input_section): Ditto.
7064 (Output_section::build_relaxation_map): Change to use Section_id
7065 instead of Input_section_specifier as key type.
7066 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7068 (Output_section::convert_input_sections_to_relaxed_sections): Change
7069 to use Const_section_id instead of Input_section_specifier as key type.
7070 (Output_section::find_merge_section): Ditto.
7071 (Output_section::find_relaxed_input_section): Ditto.
7072 * output.h (Input_section_specifier): Remove class.
7073 (Output_section::Output_section_data_by_input_section_map): Change
7074 key type to Const_section_id.
7075 (Output_section::Output_relaxed_input_section_by_input_section_map):
7077 (Output_section::Relaxation_map): Change key type to Section_id.
7079 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7081 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7082 (class Arm_v4bx_stub): New class.
7083 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7084 (Stub_factory::make_arm_v4bx_stub): New method.
7085 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7086 (Stub_table::empty): Handle v4bx stubs.
7087 (Stub_table::add_arm_v4bx_stub): New method.
7088 (Stub_table::find_arm_v4bx_stub): New method.
7089 (Arm_relocate_functions::v4bx): New method.
7090 (Target_arm::fix_v4bx): New method.
7091 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7092 (Stub_table::relocate_stubs): Likewise.
7093 (Stub_table::do_write): Likewise.
7094 (Stub_table::update_data_size_and_addralign): Likewise.
7095 (Stub_table::finalize_stubs): Likewise.
7096 (Target_arm::Scan::local): Likewise.
7097 (Target_arm::Scan::global): Likewise.
7098 (Target_arm::do_finalize_sections): Likewise.
7099 (Target_arm::Relocate::relocate): Likewise.
7100 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7102 (Target_arm::scan_reloc_for_stub): Likewise.
7103 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7105 2010-01-19 Ian Lance Taylor <iant@google.com>
7107 * output.cc (Output_section_headers::do_sized_write): Write large
7108 segment count to sh_info field.
7109 (Output_file_header::do_sized_write): For large segment count,
7110 write PN_XNUM to e_phnum field.
7112 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7114 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7115 (Arm_relocate_functions::thm_jump8): New function.
7116 (Arm_relocate_functions::thm_jump11): New function.
7117 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7119 (Target_arm::Scan::global): Likewise.
7120 (Target_arm::Relocate::relocate): Likewise.
7121 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7124 2010-01-14 Doug Kwan <dougkwan@google.com>
7126 * arm.cc (map, utility): Include headers.
7127 (Target_arm::apply_cortex_a8_workaround): New method.
7128 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7129 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7130 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7131 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7132 the --[no-]fix-cortex-a8 command line options.
7133 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7134 (Target_arm::relocate_stub): Use addend in instruction template.
7135 * options.h (DEFINE_bool): Set the user-set flag.
7136 (General_options): Add --[no-]-fix-cortex options.
7137 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7138 : Update fast look-up map after conversion.
7140 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7142 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7143 in the first pass of do_layout.
7145 2010-01-13 Doug Kwan <dougkwan@google.com>
7147 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7148 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7149 apparent compiler problem of not folding static constant integral
7150 data members of elfcpp::Elf_sizes<32>.
7152 2010-01-13 Doug Kwan <dougkwan@google.com>
7154 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7155 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7156 Arm_relobj::scan_section_for_cortex_a8_erratum,
7157 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7158 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7159 sections to scan for relocation stubs into a new method
7160 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7161 relocation and Cortex-A8 stub scanning.
7162 (Target_arm::do_relax): Force stubs to be after stubbed sections
7163 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7164 the beginning of a new relaxation pass. Update a comment.
7165 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7167 2010-01-12 Ian Lance Taylor <iant@google.com>
7169 * target-reloc.h (visibility_error): New inline function.
7170 (relocate_section): Call visibility_error.
7171 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7172 (MOSTLYCLEANFILES): Likewise.
7173 (protected_4_pic.o, protected_3.err): New targets.
7174 * testsuite/protected_4.cc: New file.
7176 2010-01-12 Doug Kwan <dougkwan@google.com>
7178 * arm.cc (Cortex_a8_reloc): New class.
7179 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7180 and cortex_a8_relocs_info_.
7181 (Target_arm::fix_cortex_a8): New method definition.
7182 (Target_arm::Cortex_a8_relocs_info): New type.
7183 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7184 New data member declarations.
7185 (Target_arm::scan_reloc_for_stub): Record information about
7186 relocations for THUMB branches that might be exempted from the
7187 Cortex-A8 workaround.
7188 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7189 at the beginning of a relaxation pass.
7191 2010-01-12 Doug Kwan <dougkwan@google.com>
7193 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7194 (Arm_relobj::Mapping_symbol_position,
7195 Arm_reloj::Mapping_symbol_position_less,
7196 Arm_relobj::Mapping_symbols_info): New types.
7197 (Target_arm::is_mapping_symbol_name): New method definition.
7198 (Arm_relobj::do_count_local_symbols): Save information about mapping
7201 2010-01-11 Doug Kwan <dougkwan@google.com>
7203 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7204 Arm_relocate_functions::thumb32_branch_upper,
7205 Arm_relocate_functions::thumb32_branch_lower,
7206 Arm_relocate_functions::thumb32_cond_branch_offset,
7207 Arm_relocate_functions::thumb32_cond_branch_upper,
7208 Arm_relocate_functions::thumb32_cond_branch_lower,
7209 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7210 branch offset encoding.
7211 (Arm_relocate_functions::thumb_branch_common): Use new branch
7212 offset encoding methods to avoid code duplication.
7213 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7214 (Stub_addend_reader::operator()): Use new branch encoding method
7215 to avoid code duplication.
7217 2010-01-11 Doug Kwan <dougkwan@google.com>
7219 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7220 (Target_arm::do_finalize_sections): Define special EXIDX section
7221 symbols only if referenced.
7222 * gc.h (Garbage_collection::add_reference): New method.
7223 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7226 2010-01-11 Ian Lance Taylor <iant@google.com>
7228 * script.cc (Version_script_info::build_expression_list_lookup):
7229 Change complaing about duplicate wildcard match from error to
7232 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7234 (Version_script_info::Version_script_info): Initialize globs_,
7235 default_version_, default_is_global_, and exact_. Don't
7236 initialize globals_ or locals_.
7237 (Version_script_info::build_lookup_tables): Build local symbols
7239 (Version_script_info::unquote): New function.
7240 (Version_script_info::add_exact_match): New function.
7241 (Version_script_info::build_expression_list_lookup): Remove lookup
7242 parameter. Add is_global parameter. Change all callers. Handle
7243 wildcard pattern specially. Unquote pattern. Call
7245 (Version_script_info::get_name_to_match): New function.
7246 (Version_script_info::get_symbol_version): New function.
7247 (Version_script_info::get_symbol_version_helper): Remove.
7248 (Version_script_info::check_unmatched_names): Call unquote.
7249 * script.h (class Version_script_info): Change get_symbol_version
7250 to be non-inline and add is_global parameter; change all callers.
7251 Rewrite symbol_is_local. Update declarations. Define struct
7252 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7253 Remove globals_ and locals_ members. Add exact_, globs_,
7254 default_version_, is_global_.
7255 (Version_script_info::Glob): Remove pattern, add expression and
7256 is_global. Update constructor. Change all callers.
7257 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7259 (Versions::symbol_section_contents): If a symbol is undefined, or
7260 defined in a dynamic object, set the version index to
7262 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7264 (Symbol_table::add_from_pluginobj): Likewise.
7265 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7267 2010-01-11 Doug Kwan <dougkwan@google.com>
7269 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7270 (incremental_dump_LDADD): Add linking option for libintl.
7271 * Makefile.in: Regenerate.
7273 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7276 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7278 * testsuite/Makefile.in: Regenerated.
7280 2010-01-10 Doug Kwan <dougkwan@google.com>
7282 * options.h (DEFINE_var): Use parentheses around argument varname__
7283 in macro body to avoid any unintended subsequent substitutions.
7285 2010-01-10 Ian Lance Taylor <iant@google.com>
7287 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7288 candidates before doing symbol resolution.
7290 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7291 ODR candidates if only one is weak.
7293 2010-01-08 Ian Lance Taylor <iant@google.com>
7295 * script.cc (Version_script_info::build_expression_list_lookup):
7296 Don't warn about ambiguous version, just record the ambiguity.
7297 (Version_script_info::get_symbol_version_helper): Give error if
7298 version is ambiguous.
7300 2010-01-08 Doug Kwan <dougkwan@google.com>
7302 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7303 prev_data_size_ and prev_addralign_. Remove initializer for
7304 deleted data member has_been_changed_.
7305 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7306 to determine if the table is empty.
7307 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7309 (Stub_table::add_reloc_stub): Define method in class definition
7310 instead of just declaring it there.
7311 (Stub_table::add_cortex_a8_stub): New method definition.
7312 (Stub_table::update_data_size_and_addralign): Ditto.
7313 (Stub_table::finalize_stubs): Ditto.
7314 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7315 (Stub_table::do_addralign_): Return address alignment in the
7316 (Stub_table::do_reset_address_and_file_offset): Define method in
7317 class definition instead of declaring it there. Set current data
7318 size to be the data size of the previous pass.
7319 (Stub_table::set_final_data_size): Use current data size as the
7321 (Stub_table::relocate_stub): Change parameter type of stub from
7322 Reloc_stub pointer to Stub pointer.
7323 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7324 (Stub_table::Cortex_a8_stub_list): New typedef.
7325 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7326 Stub_table::prev_addralign_): New data member.
7327 (Arm_relobj::Arm_relobj): Initialize data member
7328 section_has_cortex_a8_workaround_.
7329 (Arm_relobj::section_has_cortex_a8_workaround,
7330 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7332 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7334 (Target_arm::relocate_stub): Change parameter type of stub from
7335 Reloc_stub pointer to Stub pointer.
7336 (Insn_template::size, Insn_template::alignment): Handle
7337 THUMB16_SPECIAL_TYPE.
7338 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7339 Stub_table::update_data_size_and_addralign,
7340 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7342 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7343 (Stub_table::do_write): Ditto.
7344 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7346 2010-01-08 Ian Lance Taylor <iant@google.com>
7349 * symtab.h (class Symbol): Remove fields is_target_special_ and
7350 has_plt_offset_. Add field is_defined_in_discarded_section_.
7351 (Symbol::is_defined_in_discarded_section): New function.
7352 (Symbol::set_is_defined_in_discarded_section): New function.
7353 (Symbol::has_plt_offset): Rewrite.
7354 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7355 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7356 Don't initialize is_target_special_ or has_plt_offset_.
7357 Initialize is_defined_in_discarded_section_.
7358 (Symbol_table::add_from_relobj): If appropriate, set
7359 is_defined_in_discarded_section.
7360 * resolve.cc (Symbol::override_base_with_special): Don't test
7361 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7362 * target-reloc.h (relocate_section): Do special handling for
7363 symbols defined in discarded sections for global symbols as well
7366 2010-01-08 Ian Lance Taylor <iant@google.com>
7368 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7369 the SHT_SYMTAB case.
7371 2010-01-08 Ian Lance Taylor <iant@google.com>
7373 * object.cc (Sized_relobj::do_layout): Don't get confused if
7374 layout_eh_frame returns NULL.
7376 2010-01-08 Ian Lance Taylor <iant@google.com>
7379 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7380 dynamic symbol table, use the normal symbol table.
7381 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7384 2010-01-08 Ian Lance Taylor <iant@google.com>
7387 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7390 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7392 * version.cc (print_version): Change to "Copyright 2010".
7394 2010-01-08 Ian Lance Taylor <iant@google.com>
7398 * i386.cc (class Target_i386): Change return type of plt_section
7400 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7401 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7402 tls_desc_rel_ field.
7403 (Output_data_plt_i386::rel_tls_desc): New function.
7404 (Target_i386::rel_tls_desc_section): New function.
7405 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7406 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7407 R_386_TLS_DESC reloc in rel_tls_desc_section.
7408 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7409 Define struct Tlsdesc_info.
7410 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7411 (Target_x86_64::do_reloc_symbol_index): New function.
7412 (Target_x86_64::add_tlsdesc_info): New function.
7413 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7414 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7416 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7418 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7419 (Target_x86_64::rela_tlsdesc_section): New function.
7420 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7422 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7423 (Target_x86_64::do_reloc_addend): New function.
7424 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7425 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7426 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7427 (Output_reloc::type): New function.
7428 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7429 (Output_reloc::is_target_specific): New function.
7430 (Output_reloc::target_arg): New function.
7431 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7432 absolute relocs and target specific relocs.
7433 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7434 add_target_specific.
7435 (class Output_data_reloc) [SHT_RELA]: Likewise.
7436 * output.cc (Output_reloc::Output_reloc): Add four new versions
7437 for absolute relocs and target specific relocs.
7438 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7439 (Output_reloc::get_symbol_index): Likewise.
7440 (Output_reloc::local_section_offset): Check that local_sym_index_
7441 is not TARGET_CODE or 0.
7442 (Output_reloc::symbol_value): Likewise.
7443 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7445 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7446 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7448 * layout.cc (add_target_dynamic_tags): Use output section for
7449 DT_PLTRELSZ and DT_JMPREL.
7451 2010-01-07 Ian Lance Taylor <iant@google.com>
7454 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7456 (class Output_data_reloc_generic): Define.
7457 (class Output_data_reloc_base): Change base class to
7458 Output_data_reloc_generic. Change add() method to call
7459 bump_relative_reloc_count for a relative reloc. Remove
7461 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7463 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7464 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7466 * layout.h (class Layout): Update declaration.
7468 2010-01-07 Ian Lance Taylor <iant@google.com>
7470 * output.h (class Output_data): Add const version of
7471 output_section and do_output_section.
7472 (class Output_section_data): Add const version of
7474 (class Output_section): Likewise.
7475 * layout.cc (Layout::add_target_dynamic_tags): New function.
7476 * layout.h (class Layout): Update declarations.
7477 * arm.cc (Target_arm::do_finalize_sections): Use
7478 add_target_dynamic_tags.
7479 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7480 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7481 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7482 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7484 2010-01-07 Ian Lance Taylor <iant@google.com>
7487 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7490 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7491 Ian Lance Taylor <iant@google.com>
7494 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7495 Xindex::read_symtab_xindex.
7497 2010-01-07 Doug Kwan <dougkwan@google.com>
7499 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7500 (Insn_template::thumb16_bcond_insn): New method declaration.
7501 (Insn_template): Fix spelling.
7502 (Stub::thumb16_special): New method declaration.
7503 (Stub::do_write): Define virtual method which was previously pure
7505 (Stub::do_thumb16_special): New method declaration.
7506 (Stub::do_fixed_endian_write): New template member.
7507 (Reloc_stub::do_write): Remove.
7508 (Reloc_stub::do_fixed_endian_write): Remove.
7509 (Cortex_a8_stub): New class definition.
7510 (Stub_factory::make_cortex_a8_stub): New method definition.
7511 (Stub_factory::Stub_factory): Add missing static storage class
7512 qualifier for elf32_arm_stub_a8_veneer_blx.
7514 2010-01-07 Ian Lance Taylor <iant@google.com>
7517 * options.h (class General_options): Add --warn-unresolved-symbols
7518 and --error-unresolved-symbols.
7519 * errors.cc (Errors::undefined_symbol): Implement
7520 --warn-unresolved-symbols.
7522 * options.h (class General_options): Add -z text and -z textoff.
7523 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7525 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7527 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7528 (Garbage_collection::cident_sections): New function.
7529 (Garbage_collection::add_cident_section): New function.
7530 (Garbage_collection::cident_sections_): New member.
7531 (gc_process_relocs): Add references to sections whose names are C
7533 * gold.h (cident_section_start_prefix): New constant.
7534 (cident_section_stop_prefix): New constant.
7535 (is_cident): New function.
7536 * layout.cc (Layout::define_section_symbols): Replace string constants
7537 with the newly defined constants.
7538 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7540 * testsuite/Makefile.am: Add gc_orphan_section_test.
7541 * testsuite/Makefile.in: Regenerate.
7542 * testsuite/gc_orphan_section_test.cc: New file.
7543 * testsuite/gc_orphan_section_test.sh: New file.
7545 2010-01-06 Ian Lance Taylor <iant@google.com>
7548 * options.h (class General_options): Add --warn-shared-textrel.
7549 * layout.cc (Layout::finish_dynamic_section): Implement
7550 --warn-shared-textrel.
7553 * options.h (class General_options): Add --warn-multiple-gp.
7555 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7557 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7558 $(THREADSLIB) and $(LIBDL).
7559 * Makefile.in: Rebuild.
7561 2010-01-06 Ian Lance Taylor <iant@google.com>
7564 * options.cc (General_options::parse_section_start): New function.
7565 (General_options::section_start): New function.
7566 (General_options::General_options): Initialize all members.
7567 * options.h: Include <map>
7568 (class General_options): Add --section-start. Add section_starts_
7570 * layout.cc (Layout::attach_allocated_section_to_segment): If
7571 --section-start was used, set the address of the segment. Remove
7572 local sort_sections.
7573 (Layout::relaxation_loop_body): If the address of the load segment
7574 has been set by --section-start, don't use it.
7575 * output.h (Output_segment::update_flags_for_output_section): New
7577 * output.cc (Output_segment::add_output_section): Call
7578 update_flags_for_output_section.
7580 2010-01-05 Ian Lance Taylor <iant@google.com>
7583 * options.h (class General_options): Add --undefined-version.
7584 * script.cc (struct Version_expression): Add was_matched_by_symbol
7586 (Version_script_info::matched_symbol): New function.
7587 (Version_script_info::get_symbol_version_helper): Call
7589 (Version_script_info::check_unmatched_names): New function.
7590 * script.h (class Version_script_info): Update declarations.
7591 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7593 * options.h (class General_options): Use DEFINE_bool_alias for
7594 allow_multiple_definition.
7595 * resolve.cc (Symbol_table::should_override): Don't test
7596 allow_multiple_definition.
7599 * options.h (class General_options): Add --cref.
7600 * main.cc (main): Print cref table if --cref. Don't close mapfile
7601 until after printing cref table.
7602 * cref.cc: Include "symtab.h".
7603 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7604 (Cref_table_compare::operator()): New function.
7605 (Cref_inputs::gather_cref): New function.
7606 (filecol): New static const.
7607 (Cref_inputs::print_cref): New function.
7608 (Cref::print_cref): New function.
7609 * cref.h: Include <cstdio>.
7610 (class Cref): Update declarations.
7611 * mapfile.h (Mapfile::file): New function.
7612 * object.h (class Object): Define Symbols. Declare virtual
7613 do_get_global_symbols.
7614 (Object::get_global_symbols): New function.
7615 * object.cc (Input_objects::add_object): Pass object to cref_ if
7617 (Input_objects::archive_start): Likewise.
7618 (Input_objects::archive_stop): Likewise.
7619 (Input_objects::print_cref): New function.
7620 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7621 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7623 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7625 * plugin.h (class Sized_pluginobj): Update declarations.
7627 2010-01-05 Ian Lance Taylor <iant@google.com>
7629 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7630 to is_default_version. Rename insdef to insdefault.
7631 (Symbol_table::add_from_relobj): Rename def to is_default_version
7632 and local to is_forced_local.
7633 (Symbol_table::add_from_pluginobj): Likewise.
7634 (Symbol_table::add_from_dynobj): Likewise.
7635 (Symbol_table::define_special_symbol): Rename insdef to
7638 2010-01-04 Ian Lance Taylor <iant@google.com>
7641 * options.h (class General_options): Add
7642 --allow-multiple-definition and -z muldefs.
7643 * resolve.cc (Symbol_table::should_override): Don't warn about a
7644 multiple symbol definition if --allow-multiple-definition or -z
7648 * options.h (class General_options): Add --add-needed and
7649 --copy-dt-needed-entries. Tweak --as-needed help entry.
7650 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7651 error if --copy-dt-needed-entries aka --add-needed is used and
7652 would cause a change in behaviour.
7655 * options.h (class General_options): Add -G as a short version of
7656 --shared. Add no-op options -assert, -g, and -i.
7658 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7660 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7661 check for .text or .gnu.linkonce.t sections.
7662 * icf.cc (Icf::find_identical_sections): Ditto.
7663 Change the detection for mangled function name within the section
7665 * icf.h (is_section_foldable_candidate): New function.
7667 2009-12-30 Ian Lance Taylor <iant@google.com>
7670 * options.h (class General_options): Permit two dashes with
7671 --retain-symbols-file.
7673 2009-12-30 Ian Lance Taylor <iant@google.com>
7676 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7677 don't put the file header and segment headers in the text
7681 * common.cc (Sort_commons::operator()): Stabilize sort when both
7683 (Symbol_table::do_allocate_commons_list): When allocating common
7684 symbols, skip a symbol which is no longer common.
7685 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7686 an object before checking its type.
7687 * testsuite/common_test_2.c: New file.
7688 * testsuite/common_test_3.c: New file.
7689 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7690 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7691 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7692 (common_test_2_pic.o, common_test_2.so): New targets.
7693 (common_test_3_pic.o, common_test_3.so): New targets.
7694 * testsuite/Makefile.in: Rebuild.
7697 * script.cc (read_input_script): If we see a new SECTIONS clause,
7698 and we have added an input section, give an error.
7699 * layout.h (class Layout): Add have_added_input_section function.
7700 Add have_added_input_section_ field.
7701 * layout.cc (Layout::Layout): Initialize
7702 have_added_input_section_.
7703 (Layout::layout): Set have_added_input_section_.
7704 (Layout::layout_eh_frame): Likewise.
7706 2009-12-30 Ian Lance Taylor <iant@google.com>
7709 * options.h (class General_options): Add --sort-common option.
7710 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7711 * common.cc (Sort_common): Add sort_order parameter to
7712 constructor. Add sort_order_ field.
7713 (Sort_commons::operator): Check sort_order_.
7714 (Symbol_table::allocate_commons): Determine the sort order.
7715 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7717 (Symbol_table::do_allocate_commons_list): Likewise.
7719 2009-12-30 Ian Lance Taylor <iant@google.com>
7722 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7723 symbols from this object, don't change the visibility of an
7725 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7727 2009-12-30 Ian Lance Taylor <iant@google.com>
7730 * script.h (class Version_script_info): Define Language enum.
7731 Update declarations. Define Glob, Exact, and Lookup types. Add
7732 new fields globals_, locals_, and is_finalized_.
7733 * script.cc: Various formatting fixes.
7734 (class Parser_closure): Change language_stack_ from a vector of
7735 std::string to one of Version_script_info::Language. Adjust all
7737 (class Lazy_demangler): Remove.
7738 (struct Version_expression): Change language from std::string to
7739 Version_script_info::Language.
7740 (Version_script_info::Version_script_info): New function.
7741 (Version_script_info::~Version_script_info): Don't call clear.
7742 (Version_script_info::finalize): New function.
7743 (Version_script_info::build_lookup_tables): New function.
7744 (Version_script_info::build_expression_list_lookup): New
7746 (Version_script_info::get_symbol_version_helper): Rewrite to use
7748 (Version_script_info::print_expression_list): Adjust to use
7749 Version_script_info::Language.
7750 (script_push_lex_into_version_mode): Check that the version script
7751 has not been finalized.
7752 (version_script_push_lang): Change language string to
7753 Version_script_info::Language.
7754 * options.cc (Command_line::version_script): New function.
7755 * options.h (class General_options): Add finalize_dynamic_list
7756 function. Change version_script from declaration to definition.
7757 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7758 * testsuite/version_script.map: Remove duplicate def of foo.
7759 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7761 * testsuite/Makefile.in: Rebuild.
7763 2009-12-30 Ian Lance Taylor <iant@google.com>
7766 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7767 if the input symbol index is 0, make the output symbol index 0.
7769 2009-12-30 Ian Lance Taylor <iant@google.com>
7772 * options.h (class General_options): Add -x/--discard-all.
7773 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7774 --discard-all. If the local symbol needs a dynamic entry, check
7775 that before handling --discard-locals.
7777 2009-12-30 Ian Lance Taylor <iant@google.com>
7780 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7782 (Output_segment::add_output_section): Don't change the flags if
7786 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7787 GNU hash table if they need a dynamic value. Otherwise, don't add
7788 them if they are defined in a dynamic object or are forced local.
7790 2009-12-29 Ian Lance Taylor <iant@google.com>
7793 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7794 .gnu.hash table for a 32-bit target.
7797 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7798 regular and a dynamic object only needs a dynamic symbol table
7799 entry if it is externally visible.
7802 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7803 constructor. Add global_offset_table_ field.
7804 (Target_i386::got_section): Set global_offset_table_.
7805 (Target_i386::do_finalize_sections): Set global_offset_table_
7807 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7808 in constructor. Add global_offset_table_ field.
7809 (Target_x86_64::got_section): Set global_offset_table_.
7810 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7813 * layout.cc (Layout::Layout): Initialize increase_relro_.
7814 (Layout::get_output_section): Add is_relro, is_last_relro, and
7815 is_first_non_relro parameters. Change all callers.
7816 (Layout::choose_output_section): Likewise.
7817 (Layout::add_output_section_data): Likewise.
7818 (Layout::make_output_section): Likewise.
7819 (Layout::set_segment_offsets): Clear increase_relro when using a
7821 * layout.h (class Layout): Add increase_relro method. Add
7822 increase_relro_ field. Update declarations.
7823 * output.cc (Output_section::Output_section): Initialize
7824 is_last_relro_ and is_first_non_relro_.
7825 (Output_segment::add_output_section): Group relro sections is
7826 do_sort is true. Handle is_last_relro and is_first_non_relro.
7827 (Output_segment::maximum_alignment): Remove relro handling.
7828 (Output_segment::set_section_addresses): Add increase_relro
7829 parameter. Change all callers. Add initial alignment to align
7830 relro sections on separate page. Remove old relro handling.
7831 (Output_segment::set_section_list_addresses): Remove in_relro
7832 parameter. Change all callers.
7833 (Output_segment::set_offset): Add increase parameter. Change all
7834 callers. Remove old relro handling.
7835 * output.h (class Output_section): Add new methods: is_last_relro,
7836 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7837 Add is_last_relro_ and is_first_non_relro_ fields.
7838 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7839 Create separate .got.plt section. Call increase_relro.
7840 * x86_64.cc (Target_x86_64::got_section): Likewise.
7841 * testsuite/relro_script_test.t: Add .got.plt.
7844 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7845 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7846 (Layout::finalize): Call set_dynamic_symbol_size.
7847 (Layout::set_dynamic_symbol_size): New function.
7848 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7849 set_dynamic_symbol_size.
7852 * output.h (class Output_section): Add is_entsize_zero_ field.
7853 * output.cc (Output_section::Output_section): Initialize
7855 (Output_section::set_entsize): If two different entsizes are
7856 requested, force it to zero.
7857 (Output_section::add_input_section): Set flags for .debug_str
7858 before updating section flags. Set entsize.
7859 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7860 and SHF_STRING if all input sections have those flags.
7862 2009-12-29 Rafael Espindola <espindola@google.com>
7864 * main.cc (main): Fix the sys time reporting.
7865 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7868 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7870 * options.cc (General_options::parse_version): Allow -v to exit
7871 without an error if there is nothing to link.
7873 2009-12-29 Ian Lance Taylor <iant@google.com>
7875 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7876 using a version of gcc before 4.1.
7877 * configure: Rebuild.
7879 2009-12-28 Chris Demetriou <cgd@google.com>
7881 * attributes.cc (Output_attributes_section_data::do_write): Use
7882 std::vector::front rather than std::vector::data.
7884 2009-12-28 Ian Lance Taylor <iant@google.com>
7886 * symtab.h (class Symbol_table): Add enum Defined.
7887 * resolve.cc (Symbol_table::should_override): Add defined
7888 parameter. Change all callers. Test whether object is NULL
7889 before calling a method on it.
7890 (Symbol_table::report_resolve_problem): Add defined parameter.
7892 (Symbol_table::should_override_with_special): Likewise.
7893 * symtab.cc (Symbol_table::define_in_output_data): Add defined
7894 parameter. Change all callers.
7895 (Symbol_table::do_define_in_output_data): Likewise.
7896 (Symbol_table::define_in_output_segment): Likewise.
7897 (Symbol_table::do_define_in_output_segment): Likewise.
7898 (Symbol_table::define_as_constant): Likewise.
7899 (Symbol_table::do_define_as_constant): Likewise.
7900 * script.h (class Symbol_assignment): Add is_defsym parameter to
7901 constructor; change all callers.
7902 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7903 parameter. Change all callers. Add is_defsym_ field.
7904 (class Parser_closure): Add parsing_defsym parameter to
7905 constructor; change all callers. Add parsing_defsym accessor
7906 function. Add parsing_defsym_ field.
7908 2009-12-28 Ian Lance Taylor <iant@google.com>
7910 * gold.cc (queue_middle_tasks): Fix formatting.
7911 * object.cc (Relobj::is_section_name_included): Likewise.
7913 2009-12-23 Ian Lance Taylor <iant@google.com>
7915 * i386.cc (Target_i386::do_calls_non_split): Recognize
7916 -fsplit-stack prologue for a function with a static chain.
7917 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7918 -fsplit-stack prologue when using %r11.
7920 2009-12-21 Sriraman Tallam <tmsriram@google.com>
7922 * options.cc (General_options::parse_version): Make -v continue and do
7923 the link like GNU ld does.
7925 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
7927 * Makefile.am (CCFILES): Add timer.cc.
7928 (HFILES): Add timer.h.
7929 * configure.ac: Check for sysconf and times.
7930 * main.cc: include timer.h.
7931 (main): Use Timer instead of get_run_time.
7934 * workqueue.cc: include timer.h.
7935 (Workqueue::find_and_run_task):
7936 Report user, sys and wall time.
7937 * Makefile.in: Regenerate.
7938 * config.in: Regenerate.
7939 * configure: Regenerate.
7941 2009-12-16 Doug Kwan <dougkwan@google.com>
7943 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7945 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7946 relaxed input sections.
7947 * output.cc (Output_section::find_relaxed_input_section): Change
7948 return type to Output_relaxed_input_section pointer. Adjust code
7949 for new type of relaxed_input_section_map_.
7950 * output.h (Output_section::find_relaxed_input_section): Change
7951 return type to Output_relaxed_input_section pointer.
7952 (Output_section::Output_relaxed_input_section_by_input_section_map):
7954 (Output_section::relaxed_input_section_map_): Change type to
7955 Output_section::Output_relaxed_input_section_by_input_section_map.
7956 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7959 2009-12-15 Ian Lance Taylor <iant@google.com>
7961 * layout.cc (Layout::create_shstrtab): Only write out after input
7962 sections if we are compressing debug sections.
7964 2009-12-15 Ian Lance Taylor <iant@google.com>
7966 * archive.cc (Archive::add_symbols): Only look up a symbol without
7967 a version if there is, in fact, a version.
7969 2009-12-14 Ian Lance Taylor <iant@google.com>
7971 Revert -Wshadow changes, all changes from:
7972 2009-12-11 Doug Kwan <dougkwan@google.com>
7973 2009-12-11 Nick Clifton <nickc@redhat.com>
7974 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7976 2009-12-11 Doug Kwan <dougkwan@google.com>
7978 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7980 * attributes.cc (Object_attribute::size): Ditto.
7981 (Attributes_section_data::size): Ditto.
7982 (Attributes_section_data::Attributes_section_data): Ditto.
7983 (Output_attributes_section_data::do_write): Ditto.
7984 * attributes.h (Object_attribute::set_type): Ditto.
7985 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7987 2009-12-11 Nick Clifton <nickc@redhat.com>
7989 * archive.cc: Fix shadowed variable warnings.
7991 * compressed_output.cc: Likewise.
7992 * compressed_output.h: Likewise.
7993 * configure: Likewise.
7994 * dwarf_reader.cc: Likewise.
7995 * dynobj.cc: Likewise.
7996 * dynobj.h: Likewise.
7997 * ehframe.cc: Likewise.
7998 * ehframe.h: Likewise.
7999 * errors.cc: Likewise.
8000 * expression.cc: Likewise.
8001 * fileread.cc: Likewise.
8002 * fileread.h: Likewise.
8003 * freebsd.h: Likewise.
8004 * i386.cc: Likewise.
8006 * incremental.h: Likewise.
8007 * layout.cc: Likewise.
8008 * layout.h: Likewise.
8009 * mapfile.cc: Likewise.
8010 * merge.cc: Likewise.
8011 * merge.h: Likewise.
8012 * object.cc: Likewise.
8013 * object.h: Likewise.
8014 * options.h: Likewise.
8015 * output.cc: Likewise.
8016 * output.h: Likewise.
8017 * parameters.cc: Likewise.
8018 * plugin.cc: Likewise.
8019 * powerpc.cc: Likewise.
8020 * reduced_debug_output.cc: Likewise.
8021 * reduced_debug_output.h: Likewise.
8022 * reloc.cc: Likewise.
8023 * reloc.h: Likewise.
8024 * resolve.cc: Likewise.
8025 * script-sections.cc: Likewise.
8026 * script.cc: Likewise.
8027 * script.h: Likewise.
8028 * sparc.cc: Likewise.
8029 * symtab.cc: Likewise.
8030 * symtab.h: Likewise.
8031 * target-select.cc: Likewise.
8032 * target-select.h: Likewise.
8033 * token.h: Likewise.
8034 * workqueue.cc: Likewise.
8035 * workqueue.h: Likewise.
8036 * x86_64.cc: Likewise.
8038 2009-12-10 Doug Kwan <dougkwan@google.com>
8040 * arm.cc (attributes.h): New include.
8041 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8042 (Arm_relobj::~Arm_relobj): Delete object pointed by
8043 attributes_section_data_.
8044 (Arm_relobj::attributes_section_data): New method definition.
8045 (Arm_relobj::attributes_section_data_): New data member declaration.
8046 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8047 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8048 attributes_section_data_.
8049 (Arm_dynobj::attributes_section_data): New method definition.
8050 (Arm_dynobj::attributes_section_data_): New data member declaration.
8051 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8052 initialization value of may_use_blx_ to false.
8053 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8054 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8055 object attributes to compute results instead of hard-coding.
8056 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8057 Target_arm::get_secondary_compatible_arch,
8058 Target_arm::set_secondary_compatible_arch
8059 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8060 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8061 New method declarations.
8062 (Target_arm::get_aeabi_object_attribute): New method definition.
8063 (Target_arm::attributes_section_data_): New data member declaration.
8064 (read_arm_attributes_section): New template definition.
8065 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8066 (Arm_dynobj::do_read_symbols): Ditto.
8067 (Target_arm::do_finalize_sections): Merge attributes sections from
8068 input. Check for BLX use after attributes section merging.
8069 Fix __exidx_start and __exidx_end visibility. Create an
8070 .ARM.attributes section if necessary.
8071 (Target_arm::get_secondary_compatible_arch,
8072 Target_arm::set_secondary_compatible_arch,
8073 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8074 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8075 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8076 New method definitions.
8078 2009-12-09 Ian Lance Taylor <iant@google.com>
8080 * plugin.cc (Plugin::load): Don't cast from void* to a function
8083 2009-12-09 Ian Lance Taylor <iant@google.com>
8085 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8088 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8090 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8091 Replace two_file_shared_1.so with two_file_shared_2.so.
8092 * testsuite/Makefile.in: Regenerated.
8094 2009-12-08 Doug Kwan <dougkwan@google.com>
8096 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8097 (HFILES): Add attributes.h and int_encoding.h.
8098 * Makefile.in: Regenerate.
8099 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8100 function definitions to int_encoding.cc
8101 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8102 prototypes to int_encoding.h
8103 * reduced_debug_output.cc (int_encoding.h): New include.
8104 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8105 function definitions to int_encoding.cc
8106 (insert_into_vector, read_from_pointer): Move template definitions to
8108 * attributes.cc: New file.
8109 * attributes.h: New file.
8110 * int_encoding.cc: New file.
8111 * int_encoding.h: New file.
8113 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8116 * incremental-dump.cc (dump_incremental_inputs): New.
8117 (main): Use dump_incremental_inputs.
8119 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8122 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8123 checking elfcpp::STT_FUNC.
8124 (Target_i386::Relocate::relocate): Likewise.
8125 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8127 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8128 symbols from shared libraries into normal FUNC symbols.
8130 * symtab.h (Symbol): Add is_func and use it.
8132 2009-12-05 Doug Kwan <dougkwan@google.com>
8134 * arm.cc (Target_arm::arm_info): Initialize new fields
8135 attributes_section and attributes_vendor.
8136 * i386.cc (Target_i386::i386_info): Same.
8137 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8138 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8139 fields attributes_section and attributes_vendor.
8140 * sparc.cc (Target_sparc::sparc_info): Same.
8141 * target.h (Target::attributes_section, Target::attributes_vendor,
8142 Target::is_attributes_section, Target::attribute_arg_type,
8143 Target::attributes_order): New method definitions.
8144 (Target::Target_info::attributes_section,
8145 Target::Target_info::attributes_vendor): New fields.
8146 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8147 virtual method definitions.
8148 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8149 attributes_section and attributes_vendor.
8150 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8152 2009-12-05 Doug Kwan <dougkwan@google.com>
8154 * arm.cc: Update comments about interworking and stub generation.
8155 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8156 considered as non-PIC.
8157 (Arm_relocate_functions::base_abs): Fix formatting.
8158 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8159 of function to use GOT entry address instead of offset.
8160 (Target_arm::Scan::global): Issue an error if a symbol would need a
8161 PLT does not get one because it is untyped. Remove code to create
8162 dynamic symbols for relative branches.
8163 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8164 takes unsigned integer instead of boolean.
8166 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8168 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8169 (two_file_test_LDADD): Likewise.
8170 (common_test_1_LDADD): Likewise.
8171 (exception_test_LDADD) Likewise.
8172 (weak_test_LDADD): Likewise.
8173 (many_sections_test_LDADD): Likewise.
8174 (initpri1_LDADD): Likewise.
8175 (script_test_1_LDADD): Likewise.
8176 (script_test_2_LDADD): Likewise.
8177 (justsyms_LDADD): Likewise.
8178 (binary_test_LDADD): Likewise.
8179 (large_LDADD): Likewise.
8180 * testsuite/Makefile.in: Regenerated.
8182 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8184 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8185 (Symbol_table::override_with_special): Likewise.
8186 (Symbol_table::add_from_object): Likewise.
8188 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8190 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8191 Don't set the data_offset twice.
8193 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8195 * testsuite/Makefile.in: Regenerate.
8197 2009-12-03 Doug Kwan <dougkwan@google.com>
8199 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8200 (Target_arm::do_finalize_sections): Add parameter for symbol table
8201 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8202 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8203 parameter for symbol table pointer.
8204 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8205 an additional parameter for a pointer to symbol table.
8206 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8207 parameter for a symbol table pointer.
8208 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8209 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8211 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8212 parameter for a symbol table pointer.
8214 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8216 * incremental.cc (Incremental_inputs_header)
8217 (Incremental_inputs_header_write, Incremental_inputs_entry)
8218 (Incremental_inputs_entry_write): Move ...
8219 * incremental.h (Incremental_inputs_header)
8220 (Incremental_inputs_header_write, Incremental_inputs_entry)
8221 (Incremental_inputs_entry_write): here.
8223 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8225 * incremental.cc (make_sized_incremental_binary): Set the target.
8226 Error if it is incompatible.
8227 * output.h (Output_file): Add filename method.
8229 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8231 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8232 from the get_* methods.
8234 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8236 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8237 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8238 Write 0 for the data_offset of scripts.
8240 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8242 * testsuite/Makefile.am: Add the incremental_test.sh test.
8243 * testsuite/incremental_test.sh: New.
8244 * testsuite/incremental_test_1.c: New.
8245 * testsuite/incremental_test_2.c: New.
8247 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8249 * incremental-dump.cc (main): Fix typos.
8251 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8254 * incremental-dump.cc (main): Use llu to print 64 bit values.
8256 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8257 H.J. Lu <hongjiu.lu@intel.com>
8259 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8261 (incremental_dump_LDADD): Likewise.
8262 * Makefile.in: Regenerated.
8264 2009-11-25 Doug Kwan <dougkwan@google.com>
8268 2009-11-25 Doug Kwan <dougkwan@google.com>
8270 * arm.cc (Target_arm::Target_arm): Move method definition
8271 outside of class definition. Add code to handle
8272 --target1-rel, --target1-abs and --target2= options.
8273 (Target_arm::get_reloc_reloc_type): Change method to be
8274 non-static and const.
8275 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8276 New data member declaration.
8277 (Target_arm::Scan::local, Target_arm::Scan::global,
8278 Target_arm::Relocate::relocate,
8279 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8280 Adjust call to Target_arm::get_real_reloc_type.
8281 (Target_arm::get_real_reloc_type): Use command line options
8282 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8283 * options.h (--target1-rel, --target1-abs, --target2): New
8286 2009-11-25 Doug Kwan <dougkwan@google.com>
8288 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8289 class definition. Add code to handle --target1-rel, --target1-abs
8290 and --target2= options.
8291 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8293 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8295 (Target_arm::Scan::local, Target_arm::Scan::global,
8296 Target_arm::Relocate::relocate,
8297 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8298 call to Target_arm::get_real_reloc_type.
8299 (Target_arm::get_real_reloc_type): Use command line options to
8300 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8301 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8304 2009-11-25 Doug Kwan <dougkwan@google.com>
8306 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8307 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8308 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8310 (Arm_relocate_functions::thm_call): Replace body with a call to
8311 Arm_relocate_functions::thumb_branch_common.
8312 (Arm_relocate_functions::thm_jump24,
8313 Arm_relocate_functions::thm_xpc22): New method definitions.
8314 (Arm_relocate_functions::thumb_branch_common): New method definition.
8315 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8317 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8318 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8320 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8322 * Makefile.am: Build incremental-dump
8323 * Makefile.in: Regenerate.
8324 * incremental-dump.cc: New.
8325 * incremental.cc (Incremental_inputs_header_data,
8326 Incremental_inputs_entry_data): Move to incremental.h
8327 * incremental.h: (Incremental_inputs_header_data,
8328 Incremental_inputs_entry_data): Move from incremental.cc
8330 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8332 * incremental.cc (Incremental_inputs_header,
8333 Incremental_inputs_header_write, Incremental_inputs_entry,
8334 Incremental_inputs_entry_write): Add a typedef with the data type.
8336 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8338 * incremental.cc (Incremental_inputs_header,
8339 Incremental_inputs_header_write, Incremental_inputs_entry,
8340 Incremental_inputs_entry_write): Update comment about which
8341 type has the filed descriptions.
8343 2009-11-15 Doug Kwan <dougkwan@google.com>
8345 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8346 (Arm_relocate_functions::arm_branch_common): Change method defintion
8347 in class definition to a method declaration and update list of formal
8349 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8350 Arm_relocation_functions::jump24): Adjust call to
8351 Arm_relocate_functions::arm_branch_common. Update list of formal
8353 (Arm_relocate_functions::xpc25): New method definition.
8354 (Arm_relocate_functions::arm_branch_common): Move method defintion
8355 out from class definition. Use stubs for mode-switching and extending
8357 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8358 specially. Change code to enable use of stubs in ARM branches.
8360 2009-11-10 Doug Kwan <dougkwan@google.com>
8362 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8363 in method declaration.
8364 (Target_arm::relocate_stub): New method declaration.
8365 (Target_arm::default_target): Change to return a pointer instead of
8367 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8368 Target_arm::default_target.
8369 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8371 (Target_arm::relocate_section): Adjust view.
8372 (Target_arm::relocate_stub): New method definition.
8374 2009-11-10 Doug Kwan <dougkwan@google.com>
8376 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8378 * incremental.cc (open_incremental_binary): Initialized local
8379 variables to avoid warnings.
8380 * object.cc (make_elf_object): Ditto.
8381 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8384 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8387 * testsuite/plugin_test.c: Include "config.h".
8389 2009-11-09 Doug Kwan <dougkwan@google.com>
8391 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8392 (arm_symbol_value): Remove.
8393 (Arm_relocate_functions::arm_branch_common,
8394 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8395 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8396 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8397 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8398 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8399 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8400 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8401 Arm_relocate_functions::thm_mobw_abs_nc,
8402 Arm_relocate_functions::thm_mov_abs,
8403 Arm_relocate_functions::movw_prel_nc,
8404 Arm_relocate_functions::thm_movt_abs,
8405 Arm_relocate_functions::movt_prel,
8406 Arm_relocate_functions::thm_movw_prel_nc,
8407 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8408 (Target_arm::Relocate::relocate): Only decompose address into two
8409 parts if relocation type uses the thumb-bit and pass the actual
8410 bit instead of a flag indicating that the thumb-bit is used. Adjust
8411 calls to methods in Arm_relocate_functions for this change.
8413 2009-11-08 Ian Lance Taylor <iant@google.com>
8416 * reloc.cc: Instantiate
8417 Sized_relobj::initialize_input_to_output_maps and
8418 Sized_relobj:free_input_to_output_maps.
8420 2009-11-06 Ian Lance Taylor <iant@google.com>
8423 * defstd.cc (in_segment): Set only_if_ref true for "end".
8425 2009-11-06 Doug Kwan <dougkwan@google.com>
8427 * arm.cc (class Reloc_stub): Correct a comment.
8428 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8429 (Target_arm::scan_section_for_stubs): New method declaration.
8430 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8431 Change methods from private to protected.
8432 (Target_arm::do_may_relax): New method definition.
8433 (Target_arm::do_relax, Target_arm::group_sections,
8434 Target_arm::scan_reloc_for_stub,
8435 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8436 (Target_arm::arm_input_section_map_): New data member declaration.
8437 (Target_arm::scan_reloc_for_stub,
8438 Target_arm::scan_reloc_section_for_stubs,
8439 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8440 Target_arm::do_relax): New method definitions.
8442 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8444 * configure.ac: Check for (struct stat)::st_mtim
8445 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8446 * config.in: Regenerate.
8447 * configure: Regenerate.
8449 2009-11-05 Ian Lance Taylor <iant@google.com>
8452 * output.cc (Output_segment::add_output_section): Add missing
8455 2009-11-04 Ian Lance Taylor <iant@google.com>
8458 * object.h (class Object): Add is_needed and set_is_needed
8459 methods. Add is_needed_ field. Make bool fields into bitfields.
8460 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8461 defined in a dynamic object and referenced by a regular object,
8462 set is_needed for the dynamic object.
8463 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8464 if the file is marked with as_needed and it is not needed.
8466 2009-11-04 Ian Lance Taylor <iant@google.com>
8469 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8470 tags if data is discarded by linker script.
8471 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8472 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8473 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8474 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8476 2009-11-04 Ian Lance Taylor <iant@google.com>
8478 * layout.cc (Layout::get_output_section): Add is_interp and
8479 is_dynamic_linker_section parameters. Change all callers.
8480 (Layout::choose_output_section): Likewise.
8481 (Layout::make_output_section): Likewise.
8482 (Layout::add_output_section_data): Add is_dynamic_linker_section
8483 parameter. Change all callers.
8484 * layout.h (class Layout): Update declarations.
8485 * output.h (class Output_section): Add is_interp, set_is_interp,
8486 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8487 Add is_interp_, is_dynamic_linker_section_ fields. Change
8488 generate_code_fills_at_write_ to a bitfield.
8489 * output.cc (Output_section::Output_sections): Initialize new
8491 (Output_segment::add_output_section): Add do_sort parameter.
8494 2009-11-03 Ian Lance Taylor <iant@google.com>
8497 * options.h (class General_options): Add --warn-common.
8498 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8499 merging two common symbols.
8500 (Symbol_table::should_override): Handle --warn-common when merging
8501 a common symbol with a defined symbol. Use report_resolve_problem
8502 for multiple definitions.
8503 (Symbol_table::report_resolve_problem): New function.
8504 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8506 2009-11-03 Doug Kwan <dougkwan@google.com>
8508 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8510 (Target_arm::stub_factory): New method definition.
8511 (Target_arm::new_arm_input_section,
8512 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8513 Target_arm::reloc_uses_thumb_bit): New method declarations.
8514 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8515 New type definitions.
8516 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8517 member declarations.
8518 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8519 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8520 New method definitions.
8522 2009-11-03 Ian Lance Taylor <iant@google.com>
8524 * options.h (class General_options): Add --warn_constructors.
8526 2009-11-03 Ian Lance Taylor <iant@google.com>
8529 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8530 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8532 2009-11-03 Ian Lance Taylor <iant@google.com>
8535 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8536 --msgid-bugs-address.
8537 (install-pdf): New target.
8538 (install-data_yes): Look up one directory to find mkinstalldirs.
8540 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8542 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8545 2009-10-30 Doug Kwan <dougkwan@google.com>
8547 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8549 2009-10-30 Doug Kwan <dougkwan@google.com>
8551 * arm.cc (Stub_addend_reader): New struct template definition
8552 and partial specializations.
8553 (Stub_addend_reader::operator()): New method definition for a
8554 partially specialized template.
8556 2009-10-30 Doug Kwan <dougkwan@google.com>
8558 * arm.cc (Arm_relobj::processor_specific_flags): New method
8560 (Arm_relobj::do_read_symbols): New method declaration.
8561 (Arm_relobj::processor_specific_flags_): New data member declaration.
8562 (Arm_dynobj): New class definition.
8563 (Target_arm::do_finalize_sections): Add input_objects parameter.
8564 (Target_arm::do_adjust_elf_header): New method declaration.
8565 (Target_arm::are_eabi_versions_compatible,
8566 (Target_arm::merge_processor_specific_flags): New method declaration.
8567 (Target_arm::do_make_elf_object): New overloaded method definitions
8569 (Arm_relobj::do_read_symbols): New method definition.
8570 (Arm_dynobj::do_read_symbols): Ditto.
8571 (Target_arm::do_finalize_sections): Add input_objects parameters.
8572 Merge processor-specific flags from all input objects.
8573 (Target_arm::are_eabi_versions_compatible,
8574 Target_arm::merge_processor_specific_flags,
8575 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8576 New method definitions.
8577 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8578 Input_objects pointer type parameter.
8579 * layout.cc (Layout::finalize): Pass input objects to target's.
8580 finalize_sections function.
8581 * output.cc (Output_file_header::do_sized_write): Set ELF file
8582 header's processor-specific flags.
8583 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8584 Input_objects pointer type parameter.
8585 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8586 * target.h (Input_objects): New forward class declaration.
8587 (Target::processor_specific_flags,
8588 Target::are_processor_specific_flags_sect): New method definitions.
8589 (Target::finalize_sections): Add input_objects parameter.
8590 (Target::Target): Initialize processor_specific_flags_ and
8591 are_processor_specific_flags_set_.
8592 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8594 (Target::set_processor_specific_flags): New method definition.
8595 (Target::processor_specific_flags_,
8596 Target::are_processor_specific_flags_set_): New data member
8598 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8599 Input_objects pointer type parameter.
8601 2009-10-30 Doug Kwan <dougkwan@google.com>
8603 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8605 2009-10-28 Ian Lance Taylor <iant@google.com>
8607 * object.h (class Relobj): Drop options parameter from
8608 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8609 do_scan_relocs, do_relocate. Change all callers.
8610 (class Sized_relobj): Drop options parameters from
8611 do_gc_process_relocs, do_scan_relocs, do_relocate,
8612 do_relocate_sections, relocate_sections, emit_relocs_scan,
8613 emit_relocs_scan_reltype. Change all callers.
8614 (struct Relocate_info): Remove options field and all references to
8616 * reloc.h (class Read_relocs): Remove options constructor
8617 parameter and options_ field. Change all callers.
8618 (class Gc_process_relocs, class Scan_relocs): Likewise.
8619 (class Relocate_task): Likewise.
8620 * target-reloc.h (scan_relocs): Remove options parameter. Change
8622 (scan_relocatable_relocs): Likewise.
8623 * target.h (class Sized_target): Remove options parameter from
8624 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8626 * gc.h (gc_process_relocs): Remove options parameter. Change all
8628 * arm.cc: Update functions to remove options parameters.
8629 * i386.cc: Likewise.
8630 * powerpc.cc: Likewise.
8631 * sparc.cc: Likewise.
8632 * x86_64.cc: Likewise.
8633 * testsuite/testfile.cc: Likewise.
8635 2009-10-28 Doug Kwan <dougkwan@google.com>
8637 * arm.cc (Arm_relobj): New class definition.
8638 (Arm_relobj::scan_sections_for_stubs,
8639 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8640 New method definitions.
8642 2009-10-28 Cary Coutant <ccoutant@google.com>
8644 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8645 (Plugin::cleanup_done_): New member.
8646 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8647 (Plugin_manager::cleanup_done_): Remove.
8648 (Plugin_manager::add_input_file): Edit error message.
8649 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8650 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8652 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8654 * fileread.cc: (File_read::View::~View): Use the new
8655 data_ownership_ filed.
8656 (File_read::~File_read): Dispose the new whole_file_view_.
8657 (File_read::open): Mmap the whole file if needed.
8658 (File_read::open): Use whole_file_view_ instead of contents_.
8659 (File_read::find_view): Use whole_file_view_ if applicable.
8660 (File_read::do_read): Use whole_file_view_ instead of contents_.
8661 (File_read::make_view): Use whole_file_view_ instead of contents_,
8662 update File_read::View::View call.
8663 (File_read::find_or_make_view): Update File_read::View::View
8665 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8667 (File_read::View::Data_ownership): New enum.
8668 (File_read::View::View): Replace bool mapped_ with Data_ownership
8670 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8671 (File_read::View::data_ownership_): New field.
8672 (File_read::contents_): Remove (replaced by whole_file_view_).
8673 (File_read::whole_file_view_): New field.
8674 * options.h (class General_options): Add --keep-files-mapped.
8676 2009-10-27 Cary Coutant <ccoutant@google.com>
8678 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8679 * testsuite/Makefile.am (plugin_test_5): New test case.
8680 * testsuite/Makefile.in: Regenerate.
8682 2009-10-25 Doug Kwan <dougkwan@google.com>
8684 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8685 from private to protected to allow access by child class.
8686 (Sized_relobj::do_relocate_sections): New method declaration.
8687 (Sized_relobj::relocate_sections): Virtualize.
8688 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8689 Sized_relobj::relocate_sections. Instantiate template explicitly
8690 for different target sizes and endianity.
8692 2009-10-24 Doug Kwan <dougkwan@google.com>
8694 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8695 (Arm_input_section::as_arm_input_section): New method.
8696 (Arm_output_section): New class definition.
8697 (Arm_output_section::create_stub_group,
8698 Arm_output_section::group_sections): New method definitions.
8700 2009-10-22 Doug Kwan <dougkwan@google.com>
8702 * arm.cc (Arm_input_section): New class definition.
8703 (Arm_input_section::init, Arm_input_section:do_write,
8704 Arm_input_section::set_final_data_size,
8705 Arm_input_section::do_reset_address_and_file_offset): New method
8708 2009-10-21 Doug Kwan <dougkwan@google.com>
8710 * arm.cc (Stub_table, Arm_input_section): New forward class
8712 (Stub_table): New class defintion.
8713 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8714 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8715 New method definition.
8717 2009-10-21 Doug Kwan <dougkwan@google.com>
8719 * arm.cc: Update copyright comments.
8720 (Target_arm): New forward class template declaration.
8721 (Arm_address): New type.
8722 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8723 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8724 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8726 (Insn_template): Same.
8727 (DEF_STUBS): New macro.
8728 (Stub_type): New enum type.
8729 (Stub_template): New class definition.
8732 (Stub_factory): Same.
8733 (Target_arm::Target_arm): Initialize may_use_blx_ and
8734 should_force_pic_veneer_.
8735 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8736 Target_arm::should_force_pic_veneer,
8737 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8738 Target_arm::using_thumb_only, Target_arm:;default_target): New
8740 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8741 New data member declarations.
8742 (Insn_template::size, Insn_template::alignment): New method defintions.
8743 (Stub_template::Stub_template): New method definition.
8744 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8745 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8746 (Stub_factory::Stub_factory): New method definition.
8747 * gold.h (string_hash): New template.
8748 * output.h (Input_section_specifier::hash_value): Use
8750 (Input_section_specifier::string_hash): Remove.
8751 * stringpool.cc (Stringpool_template::string_hash): Use
8754 2009-10-20 Doug Kwan <dougkwan@google.com>
8756 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8757 symbols of relaxed input sections.
8758 * output.h (Output_section::find_relaxed_input_section): Make
8761 2009-10-16 Doug Kwan <dougkwan@google.com>
8763 * dynobj.cc (Versions::Versions): Initialize version_script_.
8764 Only insert base version symbol definition for a shared object
8765 if version script defines any version versions.
8766 (Versions::define_base_version): New method definition.
8767 (Versions::add_def): Check that base version is not needed.
8768 (Versions::add_need): Define base version lazily.
8769 * dynobj.h (Versions::define_base_version): New method declaration.
8770 (Versions::needs_base_version_): New data member declaration.
8771 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8772 (check_DATA): Add no_version_test.stdout.
8773 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8775 * testsuite/Makefile.in: Regenerate.
8776 * testsuite/no_version_test.c: New file.
8777 * testsuite/no_version_test.sh: Ditto.
8779 2009-10-16 Doug Kwan <dougkwan@google.com>
8781 * expression.cc (class Segment_start_expression): New class definition.
8782 (Segment_start_expression::value): New method definition.
8783 (script_exp_function_segment_start): Return a new
8784 Segment_start_expression.
8785 * gold/script-c.h (script_saw_segment_start_expression): New function
8787 * script-sections.cc (Script_sections::Script_sections): Initialize
8788 SAW_SEGMENT_START_EXPRESSION_ to false.
8789 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8790 and -Tbbs options to specify section addresses if given in
8791 command line and no SEGMENT_START expression is seen in a script.
8792 * script-sections.h (Script_sections::saw_segment_start_expression,
8793 Script_sections::set_saw_segment_start_expression): New method
8795 (Script_sections::saw_segment_start_expression_): New data member
8797 * script.cc (script_saw_segment_start_expression): New function.
8798 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8799 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8800 script_test_7.sh and script_test_8.sh.
8801 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8802 script_test_8.stdout.
8803 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8804 (script_test_6, script_test_6.stdout, script_test_7,
8805 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8806 * Makefile.in: Regenerate.
8807 * testsuite/script_test_6.sh: New file.
8808 * testsuite/script_test_6.t: Same.
8809 * testsuite/script_test_7.sh: Same.
8810 * testsuite/script_test_7.t: Same.
8811 * testsuite/script_test_8.sh: Same.
8813 2009-10-16 Doug Kwan <dougkwan@google.com>
8815 * output.cc (Output_segment::set_section_list_address): Cast
8816 expressions to unsigned long long type to avoid format warnings.
8818 2009-10-15 Ian Lance Taylor <iant@google.com>
8820 * script.cc (Script_options::add_symbol_assignment): Always add a
8821 dot assignment to script_sections_.
8822 * script-sections.cc (Script_sections::add_dot_assignment):
8823 Initialize if necessary.
8825 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8826 program headers with no load segment if there is a linker script.
8828 * layout.cc (Layout::set_segment_offsets): Align the file offset
8829 to the segment aligment for -N or -n with no load segment.
8830 * output.cc (Output_segment::add_output_section): Don't crash if
8831 the first section is a TLS section.
8832 (Output_segment::set_section_list_addresses): Print an error
8833 message if the address moves backward in a linker script.
8834 * script-sections.cc
8835 (Output_section_element_input::set_section_addresses): Don't
8836 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8837 (Orphan_output_section::set_section_addresses): Likewise.
8839 2009-10-15 Doug Kwan <dougkwan@google.com>
8841 * layout.cc (Layout::finish_dynamic_section): Generate tags
8842 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8843 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8844 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8846 2009-10-14 Ian Lance Taylor <iant@google.com>
8848 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8850 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8851 data_shdr fields of relinfo.
8852 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8853 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8854 R_386_TLS_LDO_32, adjust based on section flags.
8855 (Target_i386::Relocate::fix_up_ldo): Remove.
8857 2009-10-13 Ian Lance Taylor <iant@google.com>
8859 Add support for -pie.
8860 * options.h (class General_options): Add -pie and
8862 (General_options::output_is_position_independent): Test -pie.
8863 (General_options::output_is_executable): Return true if not shared
8864 and not relocatable.
8865 (General_options::output_is_pie): Remove.
8866 * options.cc (General_options::finalize): Reject incompatible uses
8868 * gold.cc (queue_middle_tasks): A -pie link is not static.
8869 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8870 * symtab.cc (Symbol::final_value_is_known): Return false if
8871 output_is_position_independent.
8872 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8873 output_is_position_independent.
8874 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8875 output_is_position_independent.
8876 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8877 output_is_position_independent.
8878 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8880 (basic_pie_test.o, basic_pie_test): New targets.
8881 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8882 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8883 (two_file_pie_test): New target.
8884 * testsuite/Makefile.in: Rebuild.
8885 * README: Remove note saying that -pie is not supported.
8887 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
8889 * options.h (class General_options): Add -init and -fini.
8890 * layout.cc (Layout::finish_dynamic_section): Emit
8891 given init and fini functions.
8893 2009-10-13 Sriraman Tallam <tmsriram@google.com>
8895 * gc.h (gc_process_relocs): Check if icf is enabled using new
8897 * gold.cc (queue_initial_tasks): Likewise.
8898 (queue_middle_tasks): Likewise.
8899 * object.cc (do_layout): Likewise.
8900 * symtab.cc (is_section_folded): Likewise.
8901 * main.cc (main): Likewise.
8902 * reloc.cc (Read_relocs::run): Likewise.
8903 (Sized_relobj::do_scan_relocs): Likewise.
8904 * icf.cc (is_function_ctor_or_dtor): New function.
8905 (Icf::find_identical_sections): Check if function is ctor or dtor when
8907 * options.h (General_options::icf): Change option to be an enum.
8908 (Icf_status): New enum.
8909 (icf_enabled): New method.
8910 (icf_safe_folding): New method.
8911 (set_icf_status): New method.
8912 (icf_status_): New variable.
8913 * (options.cc) (General_options::finalize): Set icf_status_.
8914 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8915 icf_test and icf_keep_unique_test to use the --icf enum flag.
8916 * testsuite/icf_safe_test.sh: New file.
8917 * testsuite/icf_safe_test.cc: New file.
8919 2009-10-12 Sriraman Tallam <tmsriram@google.com>
8921 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8922 includes to gc.h and icf.h.
8923 * arm.cc: Include gc.h.
8924 * gold.cc: Likewise.
8925 * i386.cc: Likewise.
8926 * powerpc.cc: Likewise.
8927 * sparc.cc: Likewise.
8928 * x86_64.cc: Likewise.
8929 * gc.h: Include icf.h.
8931 2009-10-11 Ian Lance Taylor <iant@google.com>
8933 * plugin.cc: Include "gold.h" before other header files.
8935 2009-10-10 Chris Demetriou <cgd@google.com>
8937 * options.h (Input_file_argument::Input_file_type): New enum.
8938 (Input_file_argument::is_lib_): Replace with...
8939 (Input_file_argument::type_): New member.
8940 (Input_file_argument::Input_file_argument): Take Input_file_type
8941 'type' rather than boolean 'is_lib' as second argument.
8942 (Input_file_argument::is_lib): Use type_.
8943 (Input_file_argument::is_searched_file): New function.
8944 (Input_file_argument::may_need_search): Handle is_searched_file.
8945 * options.cc (General_options::parse_library): Support -l:filename.
8946 (General_options::parse_just_symbols): Update for Input_file_argument
8948 (Command_line::process): Likewise.
8949 * archive.cc (Archive::get_file_and_offset): Likewise.
8950 * plugin.cc (Plugin_manager::release_input_file): Likewise.
8951 * script.cc (read_script_file, script_add_file): Likewise.
8952 * fileread.cc (Input_file::Input_file): Likewise.
8953 (Input_file::will_search_for): Handle is_searched_file.
8954 (Input_file::open): Likewise.
8955 * readsyms.cc (Read_symbols::get_name): Likewise.
8956 * testsuite/Makefile.am (searched_file_test): New test.
8957 * testsuite/Makefile.in: Regenerate.
8958 * testsuite/searched_file_test.cc: New file.
8959 * testsuite/searched_file_test_lib.cc: New file.
8961 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8962 Ian Lance Taylor <iant@google.com>
8964 * descriptor.cc: Include <cstdio> and "binary-io.h".
8965 (Descriptors::open): Open the files in binary mode always.
8966 * script.cc (Lex::get_token): Treat \r as whitespace.
8968 2009-10-09 Ian Lance Taylor <iant@google.com>
8970 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8972 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
8973 Ian Lance Taylor <iant@google.com>
8975 * configure.ac: Check for readv function also.
8976 * fileread.cc (readv): Define if not HAVE_READV.
8977 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8979 * config.in: Regenerate.
8980 * configure: Regenerate.
8982 2009-10-09 Doug Kwan <dougkwan@google.com>
8984 * layout.cc (Layout::make_output_section): Call target hook to make
8985 ordinary output section.
8986 (Layout::finalize): Adjust parameter list of call the
8987 Target::may_relax().
8988 * layout.h (class Layout::section_list): New method.
8989 * merge.h (Output_merge_base::entsize): Change visibility to public.
8990 (Output_merge_base::is_string, Output_merge_base::do_is_string):
8992 (Output_merge_string::do_is_string): New method.
8993 * object.cc (Sized_relobj::do_setup): renamed from
8994 Sized_relobj::set_up.
8995 * object.h (Sized_relobj::adjust_shndx,
8996 Sized_relobj::initializ_input_to_output_maps,
8997 Sized_relobj::free_input_to_output_maps): Change visibilities to
8999 (Sized_relobj::setup): Virtualize.
9000 (Sized_relobj::do_setup): New method declaration.
9001 (Sized_relobj::invalidate_section_offset,
9002 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9003 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9004 * options.cc (parse_int): New function.
9005 * options.h (parse_int): New declaration.
9006 (DEFINE_int): New macro.
9007 (stub_group_size): New option.
9008 * output.cc (Output_section::Output_section): Initialize memebers
9009 merge_section_map_, merge_section_by_properties_map_,
9010 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9011 (Output_section::add_input_section): Handled deferred code-fill
9012 generation and remove an old comment.
9013 (Output_section::add_relaxed_input_section): New method definition.
9014 (Output_section::add_merge_input_section): Use merge section by
9015 properties map to speed to search. Update merge section maps
9017 (Output_section::build_relaxation_map): New method definition.
9018 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9020 (Output_section::relax_input_section): Renamed to
9021 Output_section::convert_input_sections_to_relaxed_sections and change
9022 interface to take a vector of pointers to relaxed sections.
9023 (Output_section::find_merge_section,
9024 Output_section::find_relaxed_input_section): New method definitions.
9025 (Output_section::is_input_address_mapped,
9026 Output_section::output_offset, Output_section::output_address):
9027 Use output section data maps to speed up searching.
9028 (Output_section::find_starting_output_address): Add comments.
9029 (Output_section::do_write,
9030 Output_section::write_to_postprocessing_buffer): Do code-fill
9031 generation as appropriate.
9032 (Output_section::get_input_sections): Invalidate relaxed input section
9034 (Output_section::restore_states): Adjust type of checkpoint .
9035 Invalidate relaxed input section map.
9036 * output.h (Output_merge_base): New class declaration.
9037 (Input_section_specifier): New class defintion.
9038 (class Output_relaxed_input_section) Change base class to
9039 Output_section_data_build.
9040 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9041 base class initializer.
9042 (Output_section::add_relaxed_input_section): New method declaration.
9043 (Output_section::Input_section): Change visibility to protected.
9044 (Output_section::Input_section::relobj,
9045 Output_section::Input_section::shndx): Handle relaxed input sections.
9046 Output_section::input_sections) Change visibility to protected. Also
9047 define overload to return a non-const pointer.
9048 (Output_section::Merge_section_properties): New class defintion.
9049 (Output_section::Merge_section_by_properties_map,
9050 Output_section::Output_section_data_by_input_section_map,
9051 Output_section::Relaxation_map): New types.
9052 (Output_section::relax_input_section): Rename method to
9053 Output_section::convert_input_sections_to_relaxed_sections and change
9054 interface to take a vector of relaxed section pointers.
9055 (Output_section::find_merge_section,
9056 Output_section::find_relaxed_input_section,
9057 Output_section::build_relaxation_map,
9058 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9059 New method declarations.
9060 (Output_section::merge_section_map_
9061 Output_section::merge_section_by_properties_map_,
9062 Output_section::relaxed_input_section_map_,
9063 Output_section::is_relaxed_input_section_map_valid_,
9064 Output_section::generate_code_fills_at_write_): New data members.
9065 * script-sections.cc
9066 (Output_section_element_input::set_section_addresses): Call
9067 current_data_size and addralign methods of relaxed input sections.
9068 (Orphan_output_section::set_section_addresses): Call current_data_size
9069 and addralign methods of relaxed input sections.
9070 * symtab.cc (Symbol_table::compute_final_value): Extract template
9071 from the body of Symbol_table::sized_finalize_symbol.
9072 (Symbol_table::sized_finalized_symbol): Call
9073 Symbol_table::compute_final_value.
9074 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9075 (Symbol_table::compute_final_value): New templated method declaration.
9076 * target.cc (Target::do_make_output_section): New method defintion.
9077 * target.h (Target::make_output_section): New method declaration.
9078 (Target::relax): Add more parameters for input objects, symbol table
9079 and layout. Adjust call to do_relax.
9080 (Target::do_make_output_section): New method declaration.
9081 (Target::do_relax): Add parameters for input objects, symbol table
9084 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9086 * pread.c: Include stdio.h.
9088 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9090 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9093 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9095 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9096 Change read_shndx type to unsigned int.
9097 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9099 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9100 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9101 Change read_shndx type to unsigned int.
9102 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9104 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9105 * layout.cc (Layout::create_symtab_sections): Cast the result of
9106 local_symcount * symsize to off_t in the gold_assert.
9108 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9110 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9111 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9113 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9114 (Arm_relocate_functions::thm_abs5): New function.
9115 (Arm_relocate_functions::abs12): New function.
9116 (Arm_relocate_functions::abs16): New function.
9117 (Arm_relocate_functions::base_abs): New function.
9118 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9119 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9120 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9122 (Scan::global): Likewise.
9123 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9124 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9125 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9126 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9129 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9131 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9132 (Arm_relocate_functions::movt_prel): New function.
9133 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9134 (Arm_relocate_functions::thm_movt_prel): New function.
9135 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9136 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9137 (Scan::global, Relocate::relocate): Likewise.
9138 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9140 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9142 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9143 Incremental_checker.
9144 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9146 (class Incremental_inputs_header): New class.
9147 (Incremental_inputs_header_writer): Edit comment.
9148 (Incremental_inputs_entry): New class.
9149 (Incremental_inputs_entry_writer): Edit comment.
9150 (Sized_incremental_binary::do_find_incremental_inputs_section):
9151 Add *strtab_shndx parameter, fill it.
9152 (Sized_incremental_binary::do_check_inputs): New method.
9153 (Incremental_checker::can_incrementally_link_output_file): Use
9154 Sized_incremental_binary::check_inputs.
9155 (Incremental_inputs::report_command_line): Save command line in
9158 (Incremental_binary::find_incremental_inputs_section): New
9160 (Incremental_binary::do_find_incremental_inputs_section): Add
9161 strtab_shndx parameter.
9162 (Incremental_binary::do_check_inputs): New pure virtual method.
9163 (Sized_incremental_binary::do_check_inputs): Declare.
9164 (Incremental_checker::Incremental_checker): Add incremental_inputs
9165 parameter, use it to initialize incremental_inputs_.
9166 (Incremental_checker::incremental_inputs_): New field.
9167 (Incremental_checker::command_line): New method.
9168 (Incremental_checker::inputs): New method.
9169 (Incremental_checker::command_line_): New field.
9171 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9173 * incremental.cc: Include <cstdarg> and "target-select.h".
9174 (vexplain_no_incremental): New function.
9175 (explain_no_incremental): New function.
9176 (Incremental_binary::error): New method.
9177 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9179 (make_sized_incremental_binary): New function.
9180 (open_incremental_binary): New function.
9181 (can_incrementally_link_file): Add checks if output is ELF and has
9183 * incremental.h: Include "elfcpp_file.h" and "output.h".
9184 (Incremental_binary): New class.
9185 (Sized_incremental_binary): New class.
9186 (open_incremental_binary): Declare.
9187 * object.cc (is_elf_object): Use
9188 elfcpp::Elf_recognizer::is_elf_file.
9189 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9190 * output.h (Output_file::filesize): New method.
9192 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9194 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9196 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9197 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9199 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9201 (Arm_relocate_functions::movw_abs_nc): New function.
9202 (Arm_relocate_functions::movt_abs): New function.
9203 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9204 (Arm_relocate_functions::thm_movt_abs): New function.
9205 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9206 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9207 (Scan::global): Likewise.
9208 (Relocate::relocate): Likewise.
9209 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9211 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9213 * arm.cc (Arm_relocate_functions::got_prel) New function.
9214 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9215 (Relocate::relocate): Likewise.
9216 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9218 2009-10-06 Ian Lance Taylor <iant@google.com>
9220 * options.h (class General_options): Define
9221 split_stack_adjust_size parameter.
9222 * object.h (class Object): Add uses_split_stack_ and
9223 has_no_split_stack_ fields. Add uses_split_stack and
9224 has_no_split_stack accessor functions. Declare
9225 handle_split_stack_section.
9226 (class Reloc_symbol_changes): Define.
9227 (class Sized_relobj): Define Function_offsets. Declare
9228 split_stack_adjust, split_stack_adjust_reltype, and
9230 * object.cc (Object::handle_split_stack_section): New function.
9231 (Sized_relobj::do_layout): Call handle_split_stack_section.
9232 * dynobj.cc (Sized_dynobj::do_layout): Call
9233 handle_split_stack_section.
9234 * reloc.cc (Sized_relobj::relocate_sections): Call
9235 split_stack_adjust for executable sections in split_stack
9236 objects. Pass reloc_map to relocate_section.
9237 (Sized_relobj::split_stack_adjust): New function.
9238 (Sized_relobj::split_stack_adjust_reltype): New function.
9239 (Sized_relobj::find_functions): New function.
9240 * target-reloc.h: Include "object.h".
9241 (relocate_section): Add reloc_symbol_changes parameter. Change
9243 * target.h (class Target): Add calls_non_split method. Declare
9244 do_calls_non_split virtual method. Declare match_view and
9246 * target.cc: Include "elfcpp.h".
9247 (Target::do_calls_non_split): New function.
9248 (Target::match_view): New function.
9249 (Target::set_view_to_nop): New function.
9250 * gold.cc (queue_middle_tasks): Give an error if mixing
9251 split-stack and non-split-stack objects with -r.
9252 * i386.cc (Target_i386::relocate_section): Add
9253 reloc_symbol_changes parameter.
9254 (Target_i386::do_calls_non_split): New function.
9255 * x86_64.cc (Target_x86_64::relocate_section): Add
9256 reloc_symbol_changes parameter.
9257 (Target_x86_64::do_calls_non_split): New function.
9258 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9260 * powerpc.cc (Target_powerpc::relocate_section): Add
9261 reloc_symbol_changes parameter.
9262 * sparc.cc (Target_sparc::relocate_section): Add
9263 reloc_symbol_changes parameter.
9264 * configure.ac: Call AM_CONDITIONAL for the default target.
9265 * configure: Rebuild.
9266 * testsuite/Makefile.am (TEST_AS): New variable.
9267 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9268 (check_DATA): Add split_i386 and split_x86_64 files.
9269 (SPLIT_DEFSYMS): Define.
9270 (split_i386_[1234n].o): New targets.
9271 (split_i386_[124]): New targets.
9272 (split_i386_[1234r].stdout): New targets.
9273 (split_x86_64_[1234n].o): New targets.
9274 (split_x86_64_[124]): New targets.
9275 (split_x86_64_[1234r].stdout): New targets.
9276 (MOSTLYCLEANFILES): Add new executables.
9277 * testsuite/split_i386.sh: New file.
9278 * testsuite/split_x86_64.sh: New file.
9279 * testsuite/split_i386_1.s: New file.
9280 * testsuite/split_i386_2.s: New file.
9281 * testsuite/split_i386_3.s: New file.
9282 * testsuite/split_i386_4.s: New file.
9283 * testsuite/split_i386_n.s: New file.
9284 * testsuite/split_x86_64_1.s: New file.
9285 * testsuite/split_x86_64_2.s: New file.
9286 * testsuite/split_x86_64_3.s: New file.
9287 * testsuite/split_x86_64_4.s: New file.
9288 * testsuite/split_x86_64_n.s: New file.
9289 * testsuite/testfile.cc (Target_test): Update relocation_section
9291 * testsuite/Makefile.in: Rebuild.
9293 2009-10-06 Ian Lance Taylor <iant@google.com>
9295 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9296 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9297 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9298 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9299 the address on ldo_addrs_.
9300 (Target_i386::Relocate::fix_up_ldo): New function.
9302 2009-10-06 Rafael Espindola <espindola@google.com>
9304 * plugin.cc (add_input_library): New.
9305 (Plugin::load): Add add_input_library to tv.
9306 (Plugin_manager::add_input_file): Add the is_lib argument.
9307 (add_input_file): Update call to Plugin_manager::add_input_file.
9308 (add_input_library): New.
9309 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9311 2009-09-30 Doug Kwan <dougkwan@google.com>
9313 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9314 symbol and call Symbol::may_need_copy_reloc to determine if
9315 a copy reloc is needed.
9316 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9317 nocopyreloc is given in command line.
9318 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9319 given in command line.
9320 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9321 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9322 of the removed Target_i386::may_need_copy_reloc.
9323 * options.h (copyreloc): New option with default value false.
9324 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9325 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9326 instead of the removed Target_powerpc::may_need_copy_reloc.
9327 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9328 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9329 instead of the removed Target_sparc::may_need_copy_reloc.
9330 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9331 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9332 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9333 instead of the removed Target_x86_64::may_need_copy_reloc.
9335 2009-09-30 Ian Lance Taylor <iant@google.com>
9337 * object.h (class Object): Remove target_ field, and target,
9338 sized_target, and set_target methods.
9339 (Object::sized_target): Remove.
9340 (class Sized_relobj): Update declarations. Remove sized_target.
9341 * object.cc (Sized_relobj::setup): Remove target parameter.
9343 (Input_objects::add_object): Don't do anything with the target.
9344 (make_elf_sized_object): Add punconfigured parameter. Change all
9345 callers. Set or test parameter target.
9346 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9348 * parameters.cc (Parameters::set_target): Change parameter type to
9350 (Parameters::default_target): Remove.
9351 (set_parameters_target): Change parameter type to be non-const.
9352 (parameters_force_valid_target): New function.
9353 (parameters_clear_target): New function.
9354 * parameters.h (class Parameters): Update declarations. Remove
9355 default_target method. Add sized_target and clear_target
9356 methods. Change target_ to be non-const.
9357 (set_parameters_target): Update declaration.
9358 (parameters_force_valid_target): Declare.
9359 (parameters_clear_target): Declare.
9360 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9361 as NULL if we aren't searching.
9362 (Add_symbols::run): Don't check for compatible target.
9363 * fileread.cc (Input_file::open_binary): Call
9364 parameters_force_valid_target.
9365 * gold.cc (queue_middle_tasks): Likewise.
9366 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9367 set_target on object.
9368 * dynobj.h (class Sized_dynobj): Update declarations.
9369 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9370 make_elf_object returns NULL.
9371 (Archive::include_member): Don't check whether object target is
9373 * output.cc (Output_section::add_input_section): Get target from
9375 (Output_section::relax_input_section): Likewise.
9376 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9378 (Sized_relobj::do_scan_relocs): Likewise.
9379 (Sized_relobj::relocate_sections): Likewise.
9380 * resolve.cc (Symbol_table::resolve): Likewise.
9381 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9382 parameter. Change all callers.
9383 (Symbol_table::add_from_object): Get target from parameters.
9384 (Symbol_table::add_from_relobj): Don't check object target.
9385 (Symbol_table::add_from_dynobj): Likewise.
9386 (Symbol_table::define_special_symbol): Get target from
9388 * symtab.h (class Symbol_table): Update declaration.
9389 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9390 parameter. Change all callers. Clear parameter target.
9391 (Binary_test): Test target here.
9392 * testsuite/object_unittest.cc (gold_testsuite): Remove
9393 target_test_pointer parameter. Change all callers.
9394 (Object_test): Test target here.
9396 2009-09-26 Ian Lance Taylor <iant@google.com>
9398 * testsuite/initpri1.c: Don't try to use constructor priorities if
9399 compiling with gcc before 4.3.
9401 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9403 * testsuite/retain_symbols_file_test.sh (check_present): Change
9404 output file name to retain_symbols_file_test.stdout.
9405 (check_absent): Likewise.
9407 2009-09-18 Craig Silverstein <csilvers@google.com>
9409 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9410 * options.cc: Include <cerrno> and <fstream>.
9411 (General_options::finalize): Parse -retain-symbols-file tag.
9412 * options.h: New flag.
9413 (General_options): New method should_retain_symbol, new
9414 variable symbols_to_retain.
9415 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9416 should_retain_symbol map.
9417 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9418 * testsuite/Makefile.in: Regenerate.
9419 * testsuite/retain_symbols_file_test.sh: New file.
9421 2009-09-18 Nick Clifton <nickc@redhat.com>
9423 * po/es.po: Updated Spanish translation.
9425 2009-09-17 Doug Kwan <dougkwan@google.com>
9427 * debug.h (DEBUG_RELAXATION): New constant.
9428 (DEBUG_ALL): Add DEBUG_RELAXATION.
9429 (debug_string_to_enum): Add relaxation debug option.
9431 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9432 Layout::Relaxation_debug_check::read_sections,
9433 Layout::Relaxation_debug_check::read_sections): New method definitions.
9434 (Layout::Layout): Initialize data members
9435 record_output_section_data_from_scrips_,
9436 script_output_section_data_list_ and relaxation_debug_check_.
9437 (Layout::save_segments, Layout::restore_segments,
9438 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9439 Layout::relaxation_loop_body): New method definitions.
9440 (Layout::finalize): Support relaxation. Move section layout code to
9441 Layout::relaxation_loop_body.
9442 (Layout::set_asection_address_from_script): Move code for orphan
9443 section placement out.
9444 (Layout::place_orphan_sections_in_script): New method definition.
9445 * layout.h (Output_segment_headers, Output_file_header):
9446 New forward class declarations.
9447 (Layout::~Layout): Define.
9448 (Layout::new_output_section_data_from_script): New method definition.
9449 (Layout::place_orphan_sections_in_script): New method declaration.
9450 (Layout::Segment_states): New type declaration.
9451 (Layout::save_segments, Layout::restore_segments,
9452 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9453 Layout::relaxation_loop_body): New method declarations.
9454 (Layout::Output_section_data_list): New type declaration.
9455 (Layout::Relaxation_debug_check): New class definition.
9456 (Layout::record_output_section_data_from_script_,
9457 Layout::script_output_section_data_list_, Layout::segment_states_,
9458 Layout::relaxation_debug_check_): New data members.
9459 * output.cc: (Output_section_headers::do_size): New method definition.
9460 (Output_section_headers::Output_section_headers): Move size
9461 computation to Output_section_headers::do_size.
9462 (Output_segment_headers::do_size): New method definition.
9463 (Output_file_header::Output_file_header): Move size computation to
9464 Output_file_header::do_size and call it.
9465 (Output_file_header::do_size): New method definition.
9466 (Output_data_group::Output_data_group): Adjust call to
9467 Output_section_data.
9468 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9469 (Output_symtab_xindex::do_write): Add array bound check.
9470 (Output_section::Input_section::print_to_mapfile): Handle
9471 RELAXED_INPUT_SECTION_CODE.
9472 (Output_section::Output_section): Initialize data member checkpoint_.
9473 (Output_section::~Output_section): Delete checkpoint object pointed
9475 (Output_section::add_input_section): Always add an Input_section if
9477 (Output_section::add_merge_input_section): Add assert.
9478 (Output_section::relax_input_section): New method definition.
9479 (Output_section::set_final_data_size): Set load address to zero for
9480 an unallocated section.
9481 (Output_section::do_address_and_file_offset_have_reset_values):
9482 New method definition.
9483 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9484 Handle relaxed input section.
9485 (Output_section::sort_attached_input_sections): Checkpoint input
9486 section list lazily.
9487 (Output_section::get_input_sections): Change type of input_sections to
9488 list of Simple_input_section pointers. Checkpoint input section list
9489 lazily. Also handle relaxed input sections.
9490 (Output_section::add_input_section_for_script): Take a reference to
9491 a Simple_input_section object instead of Relobj pointer and section
9492 index as parameter. Handle relaxed input sections.
9493 (Output_section::save_states, Output_section::restore_states): New
9495 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9496 (Output_data::is_data_size_fixed): New method definition.
9497 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9499 (Output_data::address_and_file_offset_have_reset_values): New method
9501 (Output_data::do_address_and_file_offset_have_reset_values): New method
9503 (Output_data::set_data_size): Check that data size is not fixed.
9504 (Output_data::fix_data_size): New method definition.
9505 (Output_data::is_data_size_fixed_): New data member.
9506 (Output_section_headers::set_final_data_size): New method definition.
9507 (Output_section_headers::do_size): New method declaration.
9508 (Output_segment_headers::set_final_data_size): New method definition.
9509 (Output_segment_headers::do_size): New method declaration.
9510 (Output_file_header::set_final_data_size)::New method definition.
9511 (Output_file_header::do_size)::New method declaration.
9512 (Output_section_data::Output_section_data): Add new parameter
9513 is_data_size_fixed and use it to fix data size.
9514 (Output_data_const::Output_data_const): Adjust call to base class
9515 constructor and fix data size.
9516 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9517 base class constructor and fix data size.
9518 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9519 base class constructor and fix data size.
9520 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9521 class constructor and fix data size.
9522 (Output_data_group::set_final_data_size): New method definition.
9523 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9524 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9525 class constructor and fix data size.
9526 (Output_relaxed_input_section): New class definition.
9527 (Output_section::Simple_input_section): New class definition.
9528 (Output_section::get_input_sections): Adjust parameter list.
9529 (Output_section::add_input_section_for_script): Same.
9530 (Output_section::save_states, Output_section::restore_states,
9531 Output_section::do_address_and_file_offset_have_reset_values,
9532 (Output_section::Input_section::Input_section): Handle
9533 RELAXED_INPUT_SECTION_CODE. Add new overload for
9534 Output_relaxed_input_section.
9535 (Output_section::Input_section::is_input_section,
9536 Output_section::Input_section::set_output_section): Handle relaxed
9538 (Output_section::Input_section::is_relaxed_input_section,
9539 Output_section::Input_section::output_section_data,
9540 Output_section::Input_section::relaxed_input_section): New method
9542 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9544 (Output_section::Input_section::u1_): Update comments.
9545 (Output_section::Input_section::u2_): Add new union member poris.
9546 (Output_section::Checkpoint_output_section): New classs definition.
9547 (Output_section::relax_input_section): New method declaration.
9548 (Output_section::checkpoint_): New data member.
9549 (Output_segment): Update comments.
9550 (Output_segment::Output_segment): Un-privatize copy constructor.
9551 (Output_segment::operator=): Un-privatize.
9552 * script-sections.cc (Output_section_element::Input_section_list):
9553 Change element type to Output_section::Simple_input_section.
9554 (Output_section_element_dot_assignment::set_section_addresses):
9555 Register output section data for relaxation clean up.
9556 (Output_data_exression::Output_data_expression): Adjust call to base
9557 constructor to fix data size.
9558 (Output_section_element_data::set_section_addresses): Register
9559 Output_data_expression object for relaxation clean up.
9560 (struct Input_section_info): Replace Relobj pointer and section index
9561 pair with Output_section::Simple_input_section and Convert struct to a
9563 (Input_section_sorter::operator()): Adjust access to
9564 Input_section_info data member to use accessors.
9565 (Output_section_element_input::set_section_addresses): Use layout
9566 parameter. Adjust code to use Output_section::Simple_input_section
9567 and Input_secction_info classes. Register filler for relaxation
9569 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9570 and section index pair with Output_section::Simple_input_section
9571 class. Adjust code accordingly.
9572 (Phdrs_element::release_segment): New method definition.
9573 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9575 (Script_sections::release_segments): New method definition.
9576 * gold/script-sections.h (Script_sections::release_segments): New
9578 * gold/target.h (Target::may_relax, Target::relax,
9579 Target::do_may_relax, Target::do_relax): New method definitions.
9581 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9583 * arm.cc (has_signed_unsigned_overflow): New function.
9584 (Arm_relocate_functions::abs8): New function.
9585 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9586 (Target_arm::Scan::global): Likewise.
9587 (Target_arm::relocate::relocate): Likewise.
9588 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9591 2009-09-16 Cary Coutant <ccoutant@google.com>
9593 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9594 * testsuite/Makefile.in: Regenerate.
9596 2009-09-11 Nick Clifton <nickc@redhat.com>
9598 * po/gold.pot: Updated by the Translation project.
9600 2009-09-08 Cary Coutant <ccoutant@google.com>
9602 * output.cc (Output_file::open): Add execute permission to empty file.
9603 * testsuite/Makefile.am (permission_test): New test.
9604 * testsuite/Makefile.in: Regenerate.
9606 2009-09-02 Ian Lance Taylor <iant@google.com>
9608 * output.cc (Output_file::resize): Call map_no_anonymous rather
9611 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9613 * gold.cc: Include "incremental.h".
9614 (queue_initial_tasks): Call Incremental_checker methods.
9615 * incremental.cc: Include "output.h".
9616 (Incremental_checker::can_incrementally_link_output_file): New
9618 * incremental.h (Incremental_checker): New class.
9620 * output.cc (Output_file::open_for_modification): New method.
9621 (Output_file::map_anonymous): Changed return type to bool. Record
9623 (Output_file::map_no_anonymous): New method, broken out of map.
9624 (Output_file::map): Use map_no_anonymous and map_anonymous.
9625 * output.h (class Output_file): Update declarations.
9627 2009-08-24 Cary Coutant <ccoutant@google.com>
9629 * options.h (Command_line::Pre_options): New class.
9630 (Command_line::pre_options): New member.
9631 * options.cc (gold::options::ready_to_register): New variable.
9632 (One_option::register_option): Do nothing if not registering options.
9633 Assert if same short option registered twice.
9634 (General_options::General_options): Turn off option registration when
9636 (Command_line::Pre_options::Pre_options): New constructor.
9638 2009-08-24 Cary Coutant <ccoutant@google.com>
9640 * options.h (General_options::no_keep_memory): Remove incorrect
9643 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9645 * Makefile.am (am__skiplex, am__skipyacc): New.
9646 * Makefile.in: Regenerate.
9648 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9650 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9651 (INCLUDES): ... this.
9652 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9653 (AM_CPPFLAGS): Renamed from ...
9654 (INCLUDE): ... this.
9655 * Makefile.in, testsuite/Makefile.in: Regenerate.
9657 * Makefile.in: Regenerate.
9658 * aclocal.m4: Likewise.
9659 * config.in: Likewise.
9660 * configure: Likewise.
9661 * testsuite/Makefile.in: Likewise.
9663 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9664 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9665 * Makefile.in: Regenerate.
9666 * testsuite/Makefile.in: Regenerate.
9668 2009-08-19 Cary Coutant <ccoutant@google.com>
9670 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9671 symbols in shared libraries overridden by hidden or internal symbols
9672 in the main program.
9674 2009-08-19 Chris Demetriou <cgd@google.com>
9676 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9677 checking source file names in error messages.
9679 2009-08-18 Doug Kwan <dougkwan@google.com>
9681 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9682 an elcpp::Ehdr as parameter. Adjust call to set_target.
9683 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9684 an elfcpp::Ehdr as parameter.
9685 * object.cc (Object::set_target): Remove the version that looks up
9686 a target and sets it.
9687 (Sized_relobj::setup): Take a Target object instead of
9688 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9689 (make_elf_sized_object): Find target and ask target to
9691 * object.h: (Object::set_target): Remove the version that looks up
9692 a target and sets it.
9693 (Sized_relobj::setup): Take a Target object instead of
9694 an elfcpp:Ehdr as parameter.
9695 * target.cc: Include dynobj.h.
9696 (Target::do_make_elf_object_implementation): New.
9697 (Target::do_make_elf_object): New.
9698 * target.h (Target::make_elf_object): New template declaration.
9699 (Target::do_make_elf_object): New method declarations.
9700 (Target::do_make_elf_object_implementation): New template declaration.
9702 2009-08-14 Ian Lance Taylor <iant@google.com>
9704 * gold.h (FUNCTION_NAME): Define.
9705 (gold_unreachable): Use FUNCTION_NAME.
9707 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9709 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9710 symbol in the --keep-unique list is not found.
9712 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9714 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9715 been maked as --keep-unique.
9716 (Icf::unfold_section): New function.
9717 * icf.h (Icf::unfold_section): New function.
9718 * options.h (General_options::keep_unique): New option.
9719 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9720 * testsuite/Makefile.in: Regenerate.
9721 * testsuite/icf_keep_unique_test.sh: New file.
9722 * testsuite/icf_keep_unique_test.cc: New file.
9724 2009-08-12 Cary Coutant <ccoutant@google.com>
9727 * resolve.cc (Symbol_table::resolve): Check for references from
9728 dynamic objects to hidden and internal symbols.
9729 * testsuite/Makefile.am (hidden_test.sh): New test.
9730 * testsuite/Makefile.in: Regenerate.
9731 * testsuite/hidden_test.sh: New script.
9732 * testsuite/hidden_test_1.c: New test source.
9733 * testsuite/hidden_test_main.c: New test source.
9735 2009-08-11 Doug Kwan <dougkwan@google.com>
9737 * arm.cc: Update comments.
9738 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9739 segment to locate the .ARM.exidx section if present.
9741 2009-08-09 Doug Kwan <dougkwan@google.com>
9743 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9746 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9747 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9750 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9752 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9753 valid tls_segment only for non-debug-section relocations.
9754 * testsuite/Makefile.am: Add gc_tls_test.
9755 * testsuite/Makefile.in: Regenerate.
9756 * testsuite/gc_tls_test.cc: New file.
9757 * testsuite/gc_tls_test.sh: New file.
9759 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9763 * Makefile.am (CCFILES): Add icf.cc.
9765 * Makefile.in: Regenerate.
9766 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9767 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9768 section, symbol and addend information for the relocs.
9769 * gold.cc (queue_middle_tasks): Call identical code folding.
9770 * gold.h: Add defines for multimap.
9771 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9772 to the call of finalize_local_symbols.
9773 * main.cc (main): Create object of class Icf.
9774 * object.cc (Sized_relobj::do_layout): Allow this function to be
9775 called twice during icf.
9776 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9777 to sections marked as identical by icf.
9778 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9780 (Sized_relobj::do_section_entsize): New function.
9781 * object.h (Object::section_entsize): New function.
9782 (Object::do_section_entsize): New pure virtual function.
9783 (Relobj::finalize_local_symbols): Add new parameter.
9784 (Relobj::do_section_entsize): New function.
9785 * options.h (General_options::icf): New option.
9786 (General_options::icf_iterations): New option.
9787 (General_options::print_icf_sections): New option.
9788 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9789 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9790 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9792 * symtab.cc (Symbol_table::is_section_folded): New function.
9793 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9794 to sections marked as identical by icf.
9795 * symtab.h (Symbol_table::set_icf): New function.
9796 (Symbol_table::icf): New function.
9797 (Symbol_table::is_section_folded): New function.
9798 (Symbol_table::icf_): New data member.
9799 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9800 * testsuite/Makefile.am: Add commands to build icf_test.
9801 * testsuite/Makefile.in: Regenerate.
9802 * testsuite/icf_test.sh: New file.
9803 * testsuite/icf_test.cc: New file.
9805 2009-07-24 Chris Demetriou <cgd@google.com>
9807 * layout.cc (is_compressible_debug_section): Fix incorrect
9808 comment about compressed section names.
9810 2009-07-20 Ian Lance Taylor <ian@airs.com>
9813 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9815 2009-07-16 Ian Lance Taylor <iant@google.com>
9818 * layout.h: #include <map>.
9819 (class Kept_section): Change from struct to class. Add accessors
9820 and setters. Add section size to Comdat_group mapping. Change
9821 Comdat_group to std::map. Add is_comdat_ field. Add
9822 linkonce_size field in union.
9823 (class Layout): Update declaration of find_or_add_kept_section.
9824 Don't declare find_kept_object.
9825 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9826 parameter. Add object, shndx, is_comdat, and is_group_name
9827 parameters. Change all callers. Adjust for new Kept_section.
9828 (Layout::find_kept_object): Remove.
9829 * object.cc (Sized_relobj::include_section_group): Update use of
9830 Kept_section. Rename secnum to shndx. Only record
9831 Kept_comdat_section if sections are the same size.
9832 (Sized_relobj::include_linkonce_section): Update use of
9833 Kept_section. Only record Kept_comdat_section if sections are the
9834 same size. Set size of linkonce section.
9835 (Sized_relobj::map_to_kept_section): Update call to
9836 get_kept_comdat_section.
9837 * object.h (class Sized_relobj): Rename fields in
9838 Kept_comdat_section to drop trailing underscores; change object
9839 field to Relobj*. Change Kept_comdat_section_table to store
9840 struct rather than pointer.
9841 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9842 Add kept_object and kept_shndx parameters. Change all callers.
9843 (Sized_relobj::get_kept_comdat_section): Change return type to
9844 bool. Add kept_object and kept_shndx parameters. Change all
9846 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9847 Layout::find_or_add_kept_section.
9849 2009-07-09 Ian Lance Taylor <iant@google.com>
9851 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9852 Reserve space in the hash table.
9854 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9856 * fileread.cc (File_read::get_mtime): New method.
9857 * fileread.h (Timespec): New structure.
9858 (File_read::get_mtime): New method.
9859 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9860 Renamed from timestamp_nsec.
9861 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9863 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9865 (Incremental_inputs::report_archive): Save mtime; style fix.
9866 (Incremental_inputs::report_obejct): Save mtime; style fix.
9867 (Incremental_inputs::report_script): Save mtime; style fix.
9868 (Incremental_inputs::finalize_inputs): Style fix.
9869 (Incremental_inputs::finalize): Style fix.
9870 (Incremental_inputs::create_input_section_data): Store inputs
9872 * incremental.h (Incremental_inputs::report_script): Add mtime
9874 (Incremental_inputs::Input_info::Input_info): Intialize only one
9876 (Incremental_inputs::Input_info::archive): Move to nameless
9878 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9879 (Incremental_inputs::Input_info::script): Move to nameless union.
9880 (Incremental_inputs::mtime): New field.
9881 * script.cc (read_input_script): Pass file mtime to
9883 * script.h (Script_info::inputs): Style fix.
9885 2009-07-01 Ian Lance Taylor <ian@airs.com>
9887 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9890 2009-06-24 Ian Lance Taylor <iant@google.com>
9893 * layout.cc (Layout::choose_output_section): If we find an
9894 existing section, update the flags.
9895 (Layout::create_notes): New function, broken out of
9897 (Layout::finalize): Don't create note sections.
9898 (Layout::create_note): Don't crash if linker script discards
9900 (Layout::create_gold_note): Likewise.
9901 (Layout::create_build_id): Likewise. Don't set
9902 after_input_sections on the section.
9903 (Layout::create_executable_stack_info): Remove target parameter.
9905 * layout.h (class Layout): Declare create_notes. Update
9906 declaration of create_executable_stack_info.
9907 * gold.cc (queue_middle_tasks): Call create_notes.
9908 * output.cc (Output_section::update_flags_for_input_section): Move
9909 here from output.h. If SHF_ALLOC flag is newly set, mark address
9911 * output.h (Output_data::mark_address_invalid): New function.
9912 (class Output_section): Only declare, not define,
9913 update_flags_for_input_section. Remove set_flags.
9915 2009-06-24 Ian Lance Taylor <iant@google.com>
9917 * script-sections.cc (Output_section_definition::
9918 set_section_addresses): Rename shadowing local load_address to
9921 2009-06-24 Ian Lance Taylor <iant@google.com>
9924 * reloc.cc (relocate_sections): Skip empty relocation sections.
9926 2009-06-23 Ian Lance Taylor <iant@google.com>
9929 * layout.cc (Layout::create_note): Use choose_output_section
9930 rather than make_output_section.
9932 2009-06-23 Ian Lance Taylor <iant@google.com>
9935 * options.cc (General_options::parse_V): Set printed_version_.
9936 (General_options::General_options): Initialize printed_version_.
9937 * options.h (class General_options): Add printed_version_ field.
9938 * gold.cc (queue_initial_tasks): If there are no input files,
9939 don't give a fatal error if we printed the version information.
9940 (queue_middle_tasks): If using -r with a shared object, give a
9941 fatal error rather than an ordinary error.
9943 2009-06-23 Ian Lance Taylor <iant@google.com>
9946 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9947 (Layout::make_output_section): Set have_stabstr_section_ if we see
9948 a .stab*str section.
9949 (Layout::finalize): Call link_stabs_sections.
9950 (Layout::link_stabs_sections): New file.
9951 * layout.h (class Layout): Add have_stabstr_section_ field.
9952 Declare link_stabs_sections.
9954 2009-06-23 Doug Kwan <dougkwan@google.com>
9956 * Makefile.am (libgold_a_LIBADD): New.
9957 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9958 * Makefile.in: Regenerate.
9959 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9960 * configure: Regenerate.
9961 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9962 * fileread.cc: Include sys/state.h
9963 * gold.h: Declare memmem and strndup if found missing.
9964 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9966 2009-06-23 Ian Lance Taylor <iant@google.com>
9968 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9969 * configure: Rebuild.
9971 2009-06-23 Ian Lance Taylor <iant@google.com>
9974 * object.cc (Object::section_contents): Don't try to get a view if
9975 the section has length zero.
9976 (Object::handle_gnu_warning_section): If the section is empty, use
9977 the name of the section as the warning.
9979 2009-06-23 Ian Lance Taylor <iant@google.com>
9982 * stringpool.h (class Stringpool_template): Add optimize_ field.
9983 (Stringpool_template::set_optimize): New function.
9984 * stringpool.cc (Stringpool_template::Stringpool_template):
9985 Initialize optimize_ field.
9986 (Stringpool_template::set_string_offsets): Test local optimize
9987 fild rather than parameter.
9988 * layout.cc (Layout::Layout): Call set_optimize on the section
9991 2009-06-22 Ian Lance Taylor <iant@google.com>
9994 * yyscript.y: Parse TARGET.
9995 * script.cc (script_set_target): New function.
9996 * script-c.h (script_set_target): Declare.
9997 * options.cc (General_options::string_to_object_format): Rename
9998 from string_to_object_format in anonymous namespace. Change
10000 * options.h (class General_options): Declare
10001 string_to_object_format.
10003 2009-06-22 Ian Lance Taylor <iant@google.com>
10005 * script-sections.cc (Script_sections::create_segments): Don't put
10006 program headers in a PT_LOAD segment if -n or -N.
10008 2009-06-22 Ian Lance Taylor <iant@google.com>
10011 * options.h (class General_options): Add -z lazy and -z now. Sort
10012 -z options into alphabetical order.
10013 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10015 2009-06-21 Ian Lance Taylor <iant@google.com>
10017 * layout.cc (Layout::make_output_section): Call
10018 Target::new_output_section.
10019 (Layout::attach_allocated_section_to_segment): Put large section
10020 sections in a separate load segment with the large segment flag
10022 (Layout::segment_precedes): Sort large data segments after other
10024 (align_file_offset): New static function.
10025 (Layout::set_segment_offsets): Use align_file_offset.
10026 * output.h (class Output_section): Add is_small_section_ and
10027 is_large_section_ fields.
10028 (Output_section::is_small_section): New function.
10029 (Output_section::set_is_small_section): New function.
10030 (Output_section::is_large_section): New function.
10031 (Output_section::set_is_large_section): New function.
10032 (Output_section::is_large_data_section): New function.
10033 (class Output_segment): Add is_large_data_segment_ field.
10034 (Output_segment::is_large_data_segment): New function.
10035 (Output_segment::set_is_large_data_segment): New function.
10036 * output.cc (Output_section::Output_section): Initialize new
10038 (Output_segment::Output_segment): Likewise.
10039 (Output_segment::add_output_section): Add assertion that large
10040 data sections always go in large data segments. Force small data
10041 sections to the end of the list of data sections. Force small BSS
10042 sections to the start of the list of BSS sections. For large BSS
10043 sections to the end of the list of BSS sections.
10044 * symtab.h (class Symbol): Declare is_common_shndx.
10045 (Symbol::is_defined): Check Symbol::is_common_shndx.
10046 (Symbol::is_common): Likewise.
10047 (class Symbol_table): Define enum Commons_section_type. Update
10048 declarations. Add small_commons_ and large_commons_ fields.
10049 * symtab.cc (Symbol::is_common_shndx): New function.
10050 (Symbol_table::Symbol_table): Initialize new fields.
10051 (Symbol_table::add_from_object): Put small and large common
10052 symbols in the right list.
10053 (Symbol_table::sized_finalized_symbol): Check
10054 Symbol::is_common_shndx.
10055 (Symbol_table::sized_write_globals): Likewise.
10056 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10057 common symbol lists. Don't call do_allocate_commons_list if the
10059 (Symbol_table::do_allocate_commons_list): Remove is_tls
10060 parameter. Add comons_section_type parameter. Change all
10061 callers. Handle small and large common symbols.
10062 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10063 Symbol::is_common_shndx.
10064 * resolve.cc (symbol_to_bits): Likewise.
10065 * target.h (Target::small_common_shndx): New function.
10066 (Target::small_common_section_flags): New function.
10067 (Target::large_common_shndx): New function.
10068 (Target::large_common_section_flags): New function.
10069 (Target::new_output_section): New function.
10070 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10071 small_common_section_flags, and large_common_section_flags
10073 (Target::do_new_output_section): New virtual function.
10074 * arm.cc (Target_arm::arm_info): Initialize new fields.
10075 * i386.cc (Target_i386::i386_info): Likewise.
10076 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10078 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10079 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10080 (Target_x86_64::do_new_output_section): New function.
10081 * configure.ac: Define conditional MCMODEL_MEDIUM.
10082 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10083 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10084 (large_LDFLAGS): Define.
10085 * testsuite/large.c: New file.
10086 * testsuite/testfile.cc (Target_test::test_target_info):
10087 Initialize new fields.
10088 * configure, testsuite/Makefile.in: Rebuild.
10090 2009-06-05 Doug Kwan <dougkwan@google.com>
10092 * Makefile.am (CCFILES): Add target.cc.
10093 * Makefile.in: Regenerate.
10094 * i386.cc (class Target_i386): Define new virtual method to
10095 override do_is_local_label_name in parent.
10096 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10097 local symbols if --discard-locals or -X is given.
10098 * options.h (class General_options): Declare new options
10099 '--discard-locals' and '-X' for discarding locals.
10100 * target.h (class Target): Define new methods is_local_label_name.
10101 Declare new virtual method do_is_local_label_name.
10102 * target.cc: New file.
10103 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10104 (check_SCRIPTS): Add discard_locals_test.sh.
10105 (check_DATA): Add discard_local_tests.syms.
10106 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10107 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10108 * testsuite/Makefile.in: Regenerate.
10109 * testsuite/discard_locals_test.c: New file.
10110 * testsuite/discard_locals_test.sh: Same.
10112 2009-06-05 Doug Kwan <dougkwan@google.com>
10114 * object.cc (Sized_relobj::Sized_relobj): Initialize
10115 discarded_eh_frame_shndx_ to -1U.
10116 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10118 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10119 a discarded .eh_frame section.
10120 (Sized_relobj::do_finalize_local_symbols): Ditto.
10121 * object.h (class Sized_relobj): Declare new member
10122 discarded_eh_frame_shndx_.
10123 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10124 (local_labels_test.o, local_labels_test): New rules.
10125 * testsuite/Makefile.in: Regenerate.
10127 2009-06-04 Doug Kwan <dougkwan@google.com>
10129 * layout.cc (Layout::section_name_mapping): Add mapping for
10130 special ARM sections.
10132 2009-06-03 Doug Kwan <dougkwan@google.com>
10134 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10135 (utils::has_overflow): Same.
10137 2009-06-03 Ian Lance Taylor <iant@google.com>
10139 * layout.cc (Layout::section_name_mapping): New array, replacing
10140 Layout::linkonce_mapping.
10141 (Layout::section_name_mapping_count): New variable, replacing
10142 Layout::linkonce_mapping_count.
10143 (Layout::linkonce_output_name): Remove.
10144 (Layout::output_section_name): Rewrite.
10145 * layout.h (class Layout): Rename Linkonce_mapping to
10146 Section_name_mapping, linkonce_mapping to section_name_mapping,
10147 linkonce_mapping_count to section_name_mapping_count. Don't
10148 declare linkonce_output_name.
10150 2009-06-03 Doug Kwan <dougkwan@google.com>
10152 * gold/arm.cc (namespace utils): New.
10153 (Target_arm::reloc_is_non_pic): Define new method.
10154 (class Arm_relocate_functions): New.
10155 (Target_arm::Relocate::relocate): Handle relocation types used by
10158 2009-06-03 Ian Lance Taylor <iant@google.com>
10160 * arm.cc (Target_arm::scan::global): Use || instead of |.
10162 2009-06-02 Doug Kwan <dougkwan@google.com>
10164 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10165 issued_non_pic_error_.
10166 (class Target_arm::Scan): Declare new method check_non_pic.
10167 Define new method symbol_needs_plt_entry.
10168 Declare new data member issued_non_pic_error_.
10169 (class Target_arm::Relocate): Declare new method
10170 should_apply_static_reloc.
10171 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10172 (Target_arm::Scan::check_non_pic): Define new method.
10173 (Target_arm::Scan::local): Handle a small subset of reloc types used
10175 (Target_arm::Scan::local): Same.
10176 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10178 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10180 * incremental.cc (Incremental_inputs::report_command_line): Filter
10181 out --incremental-* options.
10183 2009-05-29 Doug Kwan <dougkwan@google.com>
10185 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10187 (class Target_arm): Update comment.
10188 (Target_arm::Target_arm): Initialize new data members GOT_,
10189 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10190 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10191 and Target_arm::rel_dyn_section.
10192 Declare new_enum Target_arm::Got_type.
10193 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10195 Update commments for member do_dynsym_value.
10196 (Target_arm::got_size, Target_arm::plt_section,
10197 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10198 new methods inside class defintion.
10199 (Target_arm::got_section): Define new method.
10200 (Target_arm::rel_dyn_section): Same.
10201 (Output_data_plt_arm): New template class.
10202 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10203 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10204 (Output_data_plt_arm::add_entry): Same.
10205 (Output_data_plt_arm::first_plt_entry): Define new
10206 static data member for PLT instruction template.
10207 (Output_data_plt_arm::plt_entry): Same.
10208 (Output_data_plt_arm::do_write): Define new method.
10209 (Target_arm::make_plt_entry): Same.
10210 (Target_arm::do_finalize_sections): Same.
10211 (Target_arm::do_dynsym_value): Same.
10213 2009-05-28 Doug Kwan <dougkwan@google.com>
10215 * Makefile.am (TARGETSOURCES): Add arm.cc.
10216 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10217 * Makefile.in: Regenerate.
10218 * arm.cc: New file.
10219 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10221 2009-05-26 Doug Kwan <dougkwan@google.com>
10223 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10224 (General_options::check_excluded_libs): Strip off directories in
10225 archive name before matching like GNU ld does.
10226 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10227 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10228 (exclude_libs_test_LDFLAGS): Add linker option
10229 -Wl,--exclude-libs,libexclude_libs_test_3
10230 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10231 an explicit archive without using -l.
10232 (alt/libexclude_libs_test_3.a): New make rule.
10233 * testsuite/Makefile.in: Regenerate.
10234 * testsuite/exclude_libs_test.c : Declare lib3_default().
10236 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10237 * exclude_libs_test_3.c: New file.
10239 2009-05-26 Nick Clifton <nickc@redhat.com>
10241 * po/id.po: New Indonesian translation.
10242 * po/gold.pot: Updated template file.
10244 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10246 * testsuite/Makefile.am: Add -ffunction-sections to compile
10247 gc_comdat_test files. Add -Wl,--gc-sections to build
10249 * testsuite/Makefile.in: Regenerate.
10250 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10252 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10254 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10255 kept comdat section was garbage collected.
10256 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10257 * testsuite/Makefile.in: Regenerate.
10258 * testsuite/gc_comdat_test.sh: New file.
10259 * testsuite/gc_comdat_test_1.cc: New file.
10260 * testsuite/gc_comdat_test_2.cc: New file.
10262 2009-05-19 Doug Kwan <dougkwan@google.com>
10264 * archive.cc (Archive::Archive): Move constructor from archive.h
10265 to here. Initialize no_export_.
10266 (Archive::get_elf_object_for_member): Set no_export flag of object.
10267 * archive.h (Archive::Archive): Move constructor body to
10269 (Archive::no_export): New method.
10270 (Archive::no_export_): New field.
10271 * object.h (Object::Object): Initialize no_export_ to false.
10272 (Object::no_export, Object::set_no_export): New methods.
10273 (Object::no_export_): New field.
10274 * options.cc (General_options::parse_exclude_libs): New method.
10275 (General_options::check_excluded_libs) Same.
10276 * options.h (exclude_libs): New option.
10277 (General_options::check_excluded_libs): New method declaration.
10278 (General_options::excluded_libs_): New field.
10279 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10280 default or protected visibility if an object has no-export flag set.
10281 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10282 (check_SCRIPTS): Add exclude_libs_test.sh.
10283 (check_DATA): Add exclude_libs_test.syms.
10284 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10285 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10286 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10287 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10288 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10289 libexclude_libs_test_2.a): New rules.
10290 * testsuite/Makefile.in: Regenerate.
10291 * testsuite/exclude_libs_test.c: New file.
10292 * testsuite/exclude_libs_test.sh: Ditto.
10293 * testsuite/exclude_libs_test_1.c: Ditto.
10294 * testsuite/exclude_libs_test_2.c: Ditto.
10296 2009-05-15 Ian Lance Taylor <iant@google.com>
10298 * configure.ac: Check for declarations for cases where libiberty.h
10299 checks HAVE_DECL_xxx.
10300 * configure, config.in: Rebuild.
10302 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10304 * gold.h (Incremental_argument_list): Remove (invalid) forward
10306 * incremental.cc (Incremental_inputs::report_achive): New method.
10307 (Incremental_inputs::report_object): New method.
10308 (Incremental_inputs::report_script): New method.
10309 (Incremental_inputs::finalize_inputs): New method.
10310 (Incremental_inputs::finalize): Call finalize_inputs().
10311 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10312 Create inputs entries.
10313 * incremental.h (Incremental_input_type): New enum.
10314 (Incremental_inputs::Incremental_input): Initialize new fields.
10315 (Incremental_inputs::report_inputs): New method.
10316 (Incremental_inputs::report_achive): New method.
10317 (Incremental_inputs::report_object): New method.
10318 (Incremental_inputs::report_script): New method.
10319 (Incremental_inputs::finalize_inputs): New method.
10320 (Incremental_inputs::Input_info): New struct.
10321 (Incremental_inputs::Input_info_map): New typedef.
10322 (Incremental_inputs::lock_): New field.
10323 (Incremental_inputs::Inputs_): New field.
10324 (Incremental_inputs::Inputs_map): New field.
10325 * main.cc (main): Call Incremental_input::report_inputs.
10326 * options.h (Input_argument_list): Typedef moved from
10328 (Input_file_group::Files): Remove, use ::Input_argument_list.
10329 (Input_file_group::Input_argument_list): Remove, use
10330 ::Input_argument_list.
10331 * plugin.cc (Plugin_manager::add_input_file): Add error in
10333 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10335 * script.cc (read_input_script): Call
10336 Incremental_input::report_script.
10337 * script.h (Script_info): New class.
10339 2009-04-27 Ian Lance Taylor <iant@google.com>
10341 * x86_64.cc (do_adjust_output_section): Set entsize to
10344 2009-04-23 Elliott Hughes <enh@google.com>
10346 * output.cc (Output_file::close): After short writes, continue
10347 writing from the correct offset in the buffer being written.
10349 2009-04-23 Chris Demetriou <cgd@google.com>
10351 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10352 * configure: Regenerate.
10353 * config.in: Regenerate.
10354 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10355 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10357 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10359 * incremental.cc (Incremental_inputs_header_data): Renamed from
10360 Incremental_input_header_data.
10361 (Incremental_inputs_header_data::data_size): New field.
10362 (Incremental_inputs_header_data::put_input_file_count): Renamed
10363 from input_file_count.
10364 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10365 from command_line_offset.
10366 (Incremental_inputs_header_data::put_reserved): Renamed from
10368 (Incremental_inputs_entry_data): Renamed from
10369 Incremental_input_entry_data.
10370 (Incremental_inputs_entry_data::data_size): New field.
10371 (Incremental_inputs::report_command_line): New method.
10372 (Incremental_inputs::finalize): New method.
10373 (Incremental_inputs::create_incremental_inputs_data): New method.
10374 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10375 * incremental.h: New file.
10376 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10377 (Layout::finalize): Create incremental inputs section in
10378 incremental builds.
10379 (Layout::create_incremental_info_sections): New method.
10380 * layout.h (Layout::incremental_inputs): New method.
10381 (Layout::create_incremental_info_sections): New method.
10382 (Layout::incremental_inputs_): New field.
10383 * main.cc (main): Notify Incremental_input of the command line.
10385 2009-04-01 Ian Lance Taylor <iant@google.com>
10386 Mikolaj Zalewski <mikolajz@google.com>
10388 * gold.h (reserve_unordered_map): Define, three versions, one for
10389 each version of Unordered_map.
10390 * layout.cc (Layout::Layout): Remove options parameter. Add
10391 number_of_input_files parameter. Don't initialize options_.
10392 Initialize number_of_input_files_ and resized_signatures_. Move
10393 sections_are_attached_.
10394 (Layout::layout_group): Reserve space for group_signatures_.
10395 (Layout::find_or_add_kept_section): Change name parameter to be a
10396 reference. Resize signatures_ map when it gets large enough.
10397 (Layout::layout_eh_frame): Use parameters->options() instead of
10399 (Layout::make_output_section): Likewise.
10400 (Layout::attach_allocated_section_to_segment): Likewise.
10401 (Layout::finalize, Layout::create_executable_stack): Likewise.
10402 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10403 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10404 * layout.h (class Layout): Update declarations. Remove options_
10405 field. Add number_of_input_files_ and resized_signatures_
10406 fields. Move sections_are_attached_ field.
10407 * main.cc (main): Pass number of input files to Layout
10408 constructor. Don't pass options.
10410 2009-03-30 Ian Lance Taylor <iant@google.com>
10412 * ffsll.c (ffsll): Correct implementation.
10414 2009-03-27 Ian Lance Taylor <iant@google.com>
10416 * ffsll.c: New file.
10417 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10418 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10419 * ftruncate.c (ftruncate): Declare before definition.
10420 * mremap.c (mremap): Likewise.
10421 * pread.c (pread): Likewise.
10422 * configure, Makefile.in, config.in: Rebuild.
10424 * mremap.c: New file.
10425 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10426 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10427 (mremap): Declare if HAVE_MREMAP is not defined.
10428 * configure, Makefile.in, config.in: Rebuild.
10430 2009-03-27 Cary Coutant <ccoutant@google.com>
10432 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10433 position independent.
10434 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10435 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10437 2009-03-24 Cary Coutant <ccoutant@google.com>
10439 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10441 (needs_dynamic_reloc): Likewise.
10443 2009-03-24 Ian Lance Taylor <iant@google.com>
10445 * yyscript.y (file_cmd): Recognize EXTERN.
10446 (extern_name_list, extern_name_list_body): New nonterminals.
10447 * script.cc (script_add_extern): Define.
10448 * script-c.h (script_add_extern): Declare.
10450 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10452 * object.cc (is_elf_object): Define.
10453 * object.h (is_elf_object): Declare.
10454 * archive.cc (Archive::get_elf_object_for_member): Call
10456 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10458 2009-03-24 Elliott Hughes <enh@google.com>
10460 * output.cc (Output_file::map_anonymous): Define.
10461 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10462 try an anonymous one. Report the size if the mmap fails.
10463 * output.h (class Output_file): Declare map_anonymous.
10465 2009-03-24 Ian Lance Taylor <iant@google.com>
10467 * target-select.cc (instantiate_target): Don't acquire the lock if
10468 the instantiated_target_ field has already been set.
10470 2009-03-23 Ian Lance Taylor <iant@google.com>
10472 * gold-threads.h (class Initialize_lock): Define.
10473 * gold-threads.cc (class Initialize_lock_once): Define.
10474 (initialize_lock_control): New static variable.
10475 (initialize_lock_pointer): New static variable.
10476 (initialize_lock_once): New static function.
10477 (Initialize_lock::Initialize_lock): Define.
10478 (Initialize_lock::initialize): Define.
10479 * target-select.h: Include "gold-threads.h".
10480 (class Target_selector): Add lock_ and initialize_lock_ fields.
10481 Don't define instantiate_target, just declare it.
10482 * target-select.cc (Target_selector::Target_selector): Initialize
10484 (Target_selector::instantiate_target): Define.
10485 * descriptors.h: Include "gold-threads.h".
10486 (class Descriptors): Add initialize_lock_ field.
10487 * descriptors.cc (Descriptors::Descriptors): Initialize new
10489 (Descriptors::open): Use initialize_lock_ field
10490 * errors.h (class Errors): Add initialize_lock_ field.
10491 * errors.cc (Errors::Errors): Initialize new field.
10492 (Errors::initialize_lock): Use initialize_lock_ field.
10493 * powerpc.cc (class Target_selector_powerpc): Remove
10494 instantiated_target_ field. In do_recognize call
10495 instantiate_target rather than do_instantiate_target. In
10496 do_instantiate_target just allocate a new target.
10497 * sparc.cc (class Target_selector_sparc): Likewise.
10499 * freebsd.h: New file.
10500 * i386.cc: Include "freebsd.h".
10501 (Target_i386): Derive from Target_freebsd rather than
10503 (Target_selector_i386): Derive from Target_selector_freebsd rather
10504 than Target_selector.
10505 * x86_64.cc: Include "freebsd.h".
10506 (Target_x86_64): Derive from Target_freebsd rather than
10508 (Target_selector_x86_64): Derive from Target_selector_freebsd
10509 rather than Target_selector.
10510 * target.h (class Target): Add adjust_elf_header and
10511 do_adjust_elf_header.
10512 * output.cc (Output_file_header:: do_sized_write): Call target
10513 adjust_elf_header routine.
10514 * configure.tgt: Set targ_osabi.
10515 * configure.ac: Define GOLD_DEFAULT_OSABI.
10516 * parameters.cc (Parameters::default_target): Pass
10517 GOLD_DEFAULT_OSABI to select_target.
10518 * target-select.h (class Target_selector): Make instantiate_target
10519 protected rather than private.
10520 * Makefile.am (HFILES): Add freebsd.h.
10521 * configure, Makefile.in, config.in: Rebuild.
10523 * merge.cc (do_add_input_section): Correct pend value. Change
10524 message about last entry not being null terminated from error to
10527 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10529 * incremental.cc: New file.
10530 * Makefile.am (CCFILES): Add incremental.cc.
10531 * Makefile.in: Rebuild.
10533 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10535 * layout.cc (Layout::output_section_name): Preserve names
10536 of '.note.' sections.
10538 2009-03-19 Ian Lance Taylor <iant@google.com>
10540 * descriptors.cc (Descriptors::open): Check that the options are
10541 valid before using them.
10543 2009-03-18 Ian Lance Taylor <iant@google.com>
10545 * script-sections.h: Include <list>.
10546 (class Script_sections): Change Sections_elements from std::vector
10547 to std::list. Typedef public Elements_iterator. Add
10548 orphan_section_placement_, data_segment_align_start_, and
10549 saw_data_segment_align_ fields. Remove data_segment_align_index_
10551 * script-sections.cc (class Orphan_section_placement): New class.
10552 (class Sections_element): Add virtual functions is_relro and
10553 orphan_section_init. Remove virtual function place_orphan_here.
10554 (class Output_section_definition): Add is_relro and
10555 orphan_section_init. Remove place_orphan_here.
10556 (class Orphan_output_section): Likewise.
10557 (Script_sections::Script_sections): Update for field changes.
10558 (Script_sections::data_segment_align): Set saw_data_segment_align_
10559 and data_segment_align_start_, not data_segment_align_index.
10560 (Script_sections::data_segment_relro_end): Check
10561 saw_data_segment_align_. Use data_segment_align_start_ rather
10562 than data_segment_align_index_.
10563 (Script_sections::place_orphan): Rewrite to use
10564 Orphan_section_placement.
10566 2009-03-17 Ian Lance Taylor <iant@google.com>
10568 * archive.cc (Archive::add_symbols): Check for a version attached
10569 to the symbol name in the archive map.
10570 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10571 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10572 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10573 (ver_test_11.a): New target.
10574 * testsuite/Makefile.in: Rebuild.
10576 * configure.ac: Check for chsize and posix_fallocate. Replace
10578 * ftruncate.c: New file, from gnulib.
10579 * output.cc (posix_fallocate): Define dummy version if not
10580 HAVE_POSIX_FALLOCATE.
10581 (Output_file::map): Call posix_fallocate rather than lseek and
10583 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10584 * configure, Makefile.in, config.in: Rebuild.
10586 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10588 * layout.h (Layout::create_note): Add section_name parameter.
10589 * layout.cc (Layout::create_note): Likewise.
10590 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10592 2009-03-17 Ian Lance Taylor <iant@google.com>
10594 * descriptors.cc: Include "options.h".
10595 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10596 (Descriptors::open): Always use O_CLOEXEC when opening a new
10597 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10598 then set FD_CLOEXEC.
10600 * sparc.cc (class Target_sparc): Add has_got_section.
10601 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10602 make sure we have a GOT section.
10604 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10605 (Target_sparc::Scan::local): Likewise.
10606 (Target_sparc::Scan::global): Likewise.
10607 (Target_sparc::Relocate::relocate): Likewise.
10608 (Target_sparc::Relocate::relocate_tls): Likewise.
10610 * symtab.cc (Symbol_table::define_default_version): New function,
10611 broken out of add_from_object.
10612 (Symbol_table::add_from_object): Call define_default_version.
10613 (Symbol_table::define_special_symbol): Add resolve_oldsym
10614 parameter. Change all callers. If the version for a symbol comes
10615 from a version script, resolve it with the symbol with the same
10616 name with no version. Also add the symbol without a version if
10618 (do_define_in_output_data): If resolving with oldsym, don't delete
10620 (do_define_in_output_segment): Likewise.
10621 (do_define_as_constant): Likewise.
10622 * symtab.h (class Symbol_table): Update declarations.
10624 2009-03-13 Ian Lance Taylor <iant@google.com>
10626 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10627 (Read_symbols::requeue): New function.
10628 (Read_symbols::do_read_symbols): If make_elf_object fails because
10629 the target type is not configured, and the file was searched for,
10630 issue a warning and retry with the next directory.
10631 (Add_symbols::run): If the file has an incompatible format, and
10632 it was searched for, requeue the Read_symbols task. On error,
10633 release the object.
10634 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10635 dirindex parameter to constructor. Change all callers. Declare
10636 incompatible_warning and requeue.
10637 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10638 input_argument_ and input_group_ fields. Add them to
10639 constructor. Change all callers.
10640 (class Read_script): Add dirindex_ field. Add it to constructor.
10641 Change all callers.
10642 * archive.cc (Archive::setup): Remove input_objects parameter.
10643 Change all callers.
10644 (Archive::get_file_and_offset): Likewise.
10645 (Archive::read_all_symbols): Likewise.
10646 (Archive::read_symbols): Likewise.
10647 (Archive::get_elf_object_for_member): Remove input_objects
10648 parameter. Add punconfigured parameter. Change all callers.
10649 (Archive::add_symbols): Change return type to bool. Check return
10650 value of include_member.
10651 (Archive::include_all_members): Likewise.
10652 (Archive::include_member): Change return type to bool. Return
10653 false if first included object has incompatible target. Set
10654 included_member_ field.
10655 (Add_archive_symbols::run): If add_symbols returns false, requeue
10657 * archive.h (class Archive): Add included_member_ field.
10658 Initialize it in constructor. Add input_file and searched_for
10659 methods. Update declarations.
10660 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10661 input_argument_ fields. Add them to constructor. Change all
10663 * script.cc: Include "target-select.h".
10664 (class Parser_closure): Add skip_on_incompatible_target_ and
10665 found_incompatible_target_ fields. Add
10666 skip_on_incompatible_target parameter to constructor. Change all
10667 callers. Add methods skip_on_incompatible_target,
10668 clear_skip_on_incompatible_target, found_incompatible_target, and
10669 set_found_incompatible_target.
10670 (read_input_script): Add dirindex parameter. Change all callers.
10671 If parser finds an incompatible target, requeue Read_symbols
10673 (script_set_symbol): Clear skip_on_incompatible_target in
10675 (script_add_assertion, script_parse_option): Likewise.
10676 (script_start_sections, script_add_phdr): Likewise.
10677 (script_check_output_format): New function.
10678 * script.h (read_input_script): Update declaration.
10679 * script-c.h (script_check_output_format): Declare.
10680 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10681 (ignore_cmd): Remove OUTPUT_FORMAT.
10682 * fileread.cc (Input_file::Input_file): Add explicit this.
10683 (Input_file::will_search_for): New function.
10684 (Input_file::open): Add pindex parameter. Change all callers.
10685 * fileread.h (class Input_file): Add input_file_argument method.
10686 Declare will_search_for. Update declarations.
10687 * object.cc (make_elf_object): Add punconfigured parameter.
10688 Change all callers.
10689 * object.h (class Object): Make input_file public. Add
10690 searched_for method.
10691 (make_elf_object): Update declaration.
10692 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10694 * dirsearch.h (class Dirsearch): Update declaration.
10695 * options.h (class General_options): Add --warn-search-mismatch.
10696 * parameters.cc (Parameters::is_compatible_target): New function.
10697 * parameters.h (class Parameters): Declare is_compatible_target.
10698 * workqueue.cc (Workqueue::add_blocker): New function.
10699 * workqueue.h (class Workqueue): Declare add_blocker.
10701 * fileread.cc (Input_file::open): Remove options parameter.
10702 Change all callers.
10703 (Input_file::open_binary): Likewise.
10704 * script.cc (read_input_script): Likewise.
10705 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10706 options parameter from constructor. Change all callers.
10707 (class Read_script): Likewise.
10708 * fileread.h (class Input_file): Update declarations.
10709 * script.h (read_input_script): Update declaration.
10711 2009-03-10 Nick Clifton <nickc@redhat.com>
10713 * po/es.po: New Spanish translation.
10715 2009-03-06 Cary Coutant <ccoutant@google.com>
10717 * options.cc (parse_short_option): Keep dash_z from registering itself.
10719 2009-03-03 Ian Lance Taylor <iant@google.com>
10722 * target-reloc.h (relocate_section): Pass output_section to
10724 * i386.cc (Target_i386::should_apply_static_reloc): Add
10725 output_section parameter. Change all callers.
10726 (Target_i386::Relocate::relocate): Add output_section parameter.
10727 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10728 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10729 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10730 * testsuite/two_file_shared.sh: New script.
10731 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10732 (check_DATA): Add two_file_shared.dbg.
10733 (two_file_shared.dbg): New target.
10734 * testsuite/Makefile.in: Rebuild.
10736 2009-03-01 Ian Lance Taylor <iant@google.com>
10738 * configure.ac: Check for byteswap.h.
10739 * configure: Rebuild.
10740 * config.in: Rebuild.
10742 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10744 * layout.cc (Layout::find_or_add_kept_section): New function.
10745 (Layout::add_comdat): Removed.
10746 * layout.h (struct Kept_section): Move out of class Layout.
10747 Remove trailing underscores from field names. Add group_sections
10748 field. Rename group_ field to is_group. Change all uses.
10749 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10750 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10751 comdat_groups_ field.
10752 (Sized_relobj::include_section_group): Use
10753 find_or_add_kept_section and Kept_section::group_sections.
10754 (Sized_relobj::include_linkonce_section): Likewise.
10755 * object.cc (class Sized_relobj): Don't define Comdat_group or
10756 Comdat_group_table. Remove find_comdat_group and
10757 add_comdat_group. Remove comdat_groups_ field.
10758 * plugin.cc (include_comdat_group): Use
10759 Layout::find_or_add_kept_section.
10761 2009-02-28 Ian Lance Taylor <iant@google.com>
10763 * README: --gc-sections and map files are now supported. Document
10764 some build requirements.
10767 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10768 relocatable link set the value of the section symbol to zero.
10769 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10770 relocatable link don't include the section address in the local
10773 2009-02-27 Ian Lance Taylor <iant@google.com>
10776 * options.h (class Search_directory): Add is_system_directory.
10777 (class General_options): Declare is_in_system_directory.
10778 * options.cc (get_relative_sysroot): Make static.
10779 (get_default_sysroot): Make static.
10780 (General_optoins::is_in_system_directory): New function.
10781 * fileread.cc (Input_file::is_in_system_directory): New function.
10782 * fileread.h (class Input_file): Declare is_in_system_directory.
10783 * object.h (class Object): Add is_in_system_directory.
10784 (class Input_objects): Remove system_library_directory_ field.
10785 * object.cc (Input_objects::add_object): Don't set
10786 system_library_directory_.
10787 (input_objects::found_in_system_library_directory): Remove.
10788 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10789 parameter. Change all callers.
10790 (Symbol_table::sized_write_globals): Likewise.
10791 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10792 Call Object::is_in_system_directory.
10793 * symtab.h (class Symbol_table): Update declarations.
10796 * descriptors.h (Open_descriptor): Add is_on_stack field.
10797 * descriptors.cc (Descriptors::open): If the descriptor is on the
10798 top of the stack, remove it. Initialize is_on_stack field.
10799 (Descriptors::release): Only add pod to stack if it is not on the
10801 (Descriptors::close_some_descriptor): Clear stack_next and
10802 is_on_stack fields.
10805 * output.cc (Output_section::find_starting_output_address): Rename
10806 from starting_output_address; add PADDR parameter; change return
10808 * output.h (class Output_section): Declare
10809 find_starting_output_address instead of starting_output_address.
10810 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10811 section symbol for which we can't find a merge section.
10814 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10815 hidden or internal, force the symbol to be local.
10816 * resolve.cc (Symbol::override_visibility): Define.
10817 (Symbol::override_base): Use override_visibility.
10818 (Symbol_table::resolve): Likewise.
10819 (Symbol::override_base_with_special): Likewise.
10820 (Symbol_table::override_with_special): If the visibility is hidden
10821 or internal, force the symbol to be local.
10822 * symtab.h (class Symbol): Add set_visibility and
10823 override_visibility.
10824 * testsuite/ver_test_1.sh: New file.
10825 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10826 (check_DATA): Add ver_test_1.syms.
10827 (ver_test_1.syms): New target.
10828 * testsuite/Makefile.in: Rebuild.
10830 2009-02-25 Cary Coutant <ccoutant@google.com>
10832 * layout.cc (Layout::choose_output_section): Don't rename sections
10833 when using a linker script that has a SECTIONS clause.
10834 * Makefile.in: Regenerate.
10836 * testsuite/Makefile.am (script_test_5.sh): New test case.
10837 * testsuite/Makefile.in: Regenerate.
10838 * testsuite/script_test_5.cc: New file.
10839 * testsuite/script_test_5.sh: New file.
10840 * testsuite/script_test_5.t: New file.
10842 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10844 * archive.cc (Archive::include_member): Update calls to add_symbols.
10845 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10846 the Layout argument.
10847 * dynobj.h (do_add_symbols): Add the Layout argument.
10848 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10850 * object.h (Object::add_symbols): Add the Layout argument.
10851 (Object::do_add_symbols): Add the Layout argument.
10852 (Sized_relobj::do_add_symbols): Add the Layout argument.
10853 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10854 Unify the two versions.
10855 (Add_plugin_symbols): Remove.
10856 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10857 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10858 (Add_plugin_symbols): Remove.
10859 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10860 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10861 (Add_symbols::run): Make it work with Pulginobj.
10863 2009-02-06 Ian Lance Taylor <iant@google.com>
10865 * object.cc (Sized_relobj::do_layout): Make info message start
10866 with lower case letter.
10868 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10870 * binary.cc: Fix file comment.
10872 * options.h (enum Incremental_disposition): Define.
10873 (class General_options): Add new options: --incremental,
10874 --incremental_changed, --incremental_unchanged,
10875 --incremental_unknown. Add incremental_disposition_ and
10876 implicit_incremental_ fields.
10877 (General_options::incremental_disposition): New function.
10878 (class Position_dependent_options): Add incremental_disposition
10880 (Position_dependent_options::copy_from_options): Set incremental
10882 * options.cc (General_options::parse_incremental_changed): New
10884 (General_options::parse_incremental_unchanged): New function.
10885 (General_options::parse_incremental_unknown): New function.
10886 (General_options::General_options): Initialize new fields
10887 incremental_disposition_ and implicit_incremental_.
10888 (General_options::finalize): Check for uasge of --incremental-*
10889 without --incremental.
10891 2009-02-06 Chris Demetriou <cgd@google.com>
10893 * gold.h (gold_undefined_symbol): Change to take only a Symbol
10894 pointer and to report location as the file name associated with
10896 (gold_undefined_symbol_at_location): New function to replace the
10897 old gold_undefined_symbol functionality.
10898 * target-reloc.h (relocate_section): Update to use
10899 gold_undefined_symbol_at_location.
10900 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10901 Call gold_undefined_symbol function rather than gold_error.
10902 * errors.h (Errors::undefined_symbol): Take location as a
10903 string, rather than calculating it from a relocation.
10904 * errors.cc (Errors::fatal): Print "fatal error:" before the
10906 (Errors::error, Errors::error_at_location): Print "error: "
10907 before the formatted message.
10908 (Errors::undefined_symbol): Take location as a string, rather
10909 than calculating it from a relocation.
10910 (gold_undefined_symbol_at_location): New function akin to
10911 old gold_undefined_symbol, calculates location from relocation.
10912 (gold_undefined_symbol): Change to take only a Symbol pointer
10913 and to report location as the file name associated with the symbol.
10914 * testsuite/debug_msg.sh: Update for changed error messages.
10915 * testsuite/undef_symbol.sh: Likewise.
10917 2009-02-04 Duncan Sands <baldrick@free.fr>
10920 * reduced_debug_output.h
10921 (Output_reduced_debug_abbrev_section::failed): Use format for
10923 (Output_reduced_debug_info_section::faild): Likewise.
10925 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
10927 * script.cc (Lazy_demangler): New class.
10928 (Version_script_info::get_symbol_version_helper): Demangle a
10931 2009-01-29 Cary Coutant <ccoutant@google.com>
10933 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10935 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10937 2009-01-28 Ian Lance Taylor <iant@google.com>
10939 * version.cc (version_string): Bump to 1.9.
10941 * gold.h: Include <cstring> and <stdint.h>.
10942 * version.cc: Include <cstdio>.
10943 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10945 * reduced_debug_output.cc (insert_into_vector): Rename from
10946 Insert_into_vector; change all callers. Use Swap_unaligned to
10947 avoid aliasing issue; remove union since it is unnecessary.
10949 2009-01-27 Sriraman Tallam <tmsriram@google.com>
10951 * Makefile.am (CCFILES): Add gc.cc.
10952 (HFILES): Add gc.h.
10953 * Makefile.in: Regenerate.
10954 * gold.cc (Gc_runner): New class.
10955 (queue_initial_tasks): Call garbage collection related tasks
10956 when corresponding options are invoked.
10957 (queue_middle_gc_tasks): New function.
10958 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10959 processed early before laying out sections during garbage collection.
10960 * gold.h (queue_middle_gc_tasks): New function.
10961 (is_prefix_of): Move from "layout.cc".
10962 * i386.cc (Target_i386::gc_process_relocs): New function.
10963 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10964 * main.cc (main): Create object of class "Garbage_collection".
10965 * object.cc (Relobj::copy_symbols_data): New function.
10966 (Relobj::is_section_name_included): New function.
10967 (Sized_relobj::do_layout): Allow this function to be called twice
10968 during garbage collection and defer layout of section during the
10970 * object.h (Relobj::get_symbols_data): New function.
10971 (Relobj::is_section_name_included): New function.
10972 (Relobj::copy_symbols_data): New function.
10973 (Relobj::set_symbols_data): New function.
10974 (Relobj::get_relocs_data): New function.
10975 (Relobj::set_relocs_data): New function.
10976 (Relobj::is_output_section_offset_invalid): New pure virtual function.
10977 (Relobj::gc_process_relocs): New function.
10978 (Relobj::do_gc_process_relocs): New pure virtual function.
10979 (Relobj::sd_): New data member.
10980 (Sized_relobj::is_output_section_offset_invalid): New function.
10981 (Sized_relobj::do_gc_process_relocs): New function.
10982 * options.h (General_options::gc_sections): Modify to not be a no-op.
10983 (General_options::print_gc_sections): New option.
10984 * plugin.cc (Plugin_finish::run): Remove function call to
10985 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
10986 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10987 * reloc.cc (Read_relocs::run): Add task to process relocs and
10988 determine unreferenced sections when doing garbage collection.
10989 (Gc_process_relocs): New class.
10990 (Sized_relobj::do_gc_process_relocs): New function.
10991 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10992 sections that are garbage collected.
10993 * reloc.h (Gc_process_relocs): New class.
10994 * sparc.cc (Target_sparc::gc_process_relocs): New function.
10995 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10996 symbols whose corresponding sections are garbage collected.
10997 (Symbol_table::Symbol_table): Add new parameter for the garbage
10999 (Symbol_table::gc_mark_undef_symbols): New function.
11000 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11001 (Symbol_table::gc_mark_dyn_syms): New function.
11002 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11004 (Symbol_table::add_from_object): Likewise.
11005 (Symbol_table::add_from_relobj): When building shared objects, do not
11006 treat externally visible symbols as garbage.
11007 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11008 table information for static and relocatable links.
11009 * symtab.h (Symbol_table::set_gc): New function.
11010 (Symbol_table::gc): New function.
11011 (Symbol_table::gc_mark_undef_symbols): New function.
11012 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11013 (Symbol_table::gc_mark_dyn_syms): New function.
11014 (Symbol_table::gc_): New data member.
11015 * target.h (Sized_target::gc_process_relocs): New pure virtual
11017 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11018 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11020 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11022 * options.h (General_options::gc_sections): Define as a no-op for now.
11023 (General_options::no_keep_memory): Ditto.
11024 (General_options::Bshareable): Define.
11025 * options.cc (General_options::finalize): Honor -Bshareable.
11027 2009-01-20 Andreas Schwab <schwab@suse.de>
11029 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11030 read the value in the contents, since we don't use it. Use the
11031 template endianness when writing.
11032 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11034 2009-01-19 Andreas Schwab <schwab@suse.de>
11036 * configure.tgt (powerpc64-*): Fix targ_obj.
11038 2009-01-15 Ian Lance Taylor <iant@google.com>
11040 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11041 local symbols when stripping all symbols.
11043 2009-01-14 Cary Coutant <ccoutant@google.com>
11045 * output.cc (Output_reloc): Add explicit instantiations.
11047 2009-01-14 Cary Coutant <ccoutant@google.com>
11049 * archive.cc (Archive::get_elf_object_for_member): Remove call
11050 to File_read::claim_for_plugin.
11051 * descriptors.cc (Descriptors::open): Remove reference to
11053 (Descriptors::claim_for_plugin): Remove.
11054 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11055 (Descriptors::is_claimed): Remove.
11056 (claim_descriptor_for_plugin): Remove.
11057 * fileread.cc (File_read::claim_for_plugin): Remove.
11058 * fileread.h (File_read::claim_for_plugin): Remove.
11059 (File_read::descriptor): Reopen descriptor if necessary.
11060 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11061 (Plugin_manager::all_symbols_read): Add task parameter. Change
11063 (Plugin_manager::get_input_file): New function.
11064 (Plugin_manager::release_input_file): New function.
11065 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11066 corresponding data member.
11067 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11068 and pass to base constructor. Change all callers.
11069 (get_input_file, release_input_file): New functions.
11070 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11071 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11072 (Plugin_manager::all_symbols_read): Add task parameter.
11073 (Plugin_manager::get_input_file): New function.
11074 (Plugin_manager::release_input_file): New function.
11075 (Plugin_manager::task_): New data member.
11076 (Pluginobj::Pluginobj): Add filesize parameter.
11077 (Pluginobj::filename): New function.
11078 (Pluginobj::descriptor): New function.
11079 (Pluginobj::filesize): New function.
11080 (Pluginobj::filesize_): New data member.
11081 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11082 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11083 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11085 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11086 with archive libraries.
11087 * testsuite/Makefile.in: Regenerate.
11088 * testsuite/plugin_test.c (struct sym_info): New type.
11089 (get_input_file, release_input_file): New static variables.
11090 (onload): Capture new transfer vector entries.
11091 (claim_file_hook): Stop reading at end of file according to filesize.
11092 Factor out parsing of readelf output into separate function.
11093 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11094 APIs and get the source file name from the symbol table. Convert
11095 source file name to corresponding object file name. Print info
11096 message when adding new input files.
11097 (parse_readelf_line): New function.
11098 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11099 * testsuite/plugin_test_2.sh: Likewise.
11100 * testsuite/plugin_test_3.sh: Likewise.
11101 * testsuite/plugin_test_4.sh: New test case.
11103 2009-01-07 Ian Lance Taylor <iant@google.com>
11105 * version.cc (version_string): Bump to 1.8.
11107 2008-12-23 Cary Coutant <ccoutant@google.com>
11109 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11110 * plugin.cc (Plugin_manager::finish): Rename as
11111 layout_deferred_objects. Move cleanup to separate function.
11112 (Plugin_manager::cleanup): New function.
11113 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11115 * plugin.h (Plugin_manager::finish): Rename as
11116 layout_deferred_objects.
11117 (Plugin_manager::cleanup): New function.
11118 (Plugin_manager::cleanup_done): New field.
11120 2008-12-23 Cary Coutant <ccoutant@google.com>
11122 * plugin.cc (is_visible_from_outside): New function.
11123 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11124 so we don't return "IR only" status for exported symbols or -r links.
11126 * testsuite/Makefile.am (plugin_test_3): New test case.
11127 * testsuite/Makefile.in: Regenerate.
11128 * testsuite/plugin_test_3.sh: New file.
11130 2008-12-22 Cary Coutant <ccoutant@google.com>
11132 * object.cc (Sized_relobj::layout_section): New function.
11133 (Sized_relobj::do_layout): Defer layout of input sections until after
11134 plugin has provided replacement files.
11135 (Sized_relobj::do_layout_deferred_sections): New function.
11136 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11137 (Relobj::layout_deferred_sections): New function.
11138 (Relobj::do_layout_deferred_sections): New function.
11139 (Sized_relobj::do_layout_deferred_sections): New function.
11140 (Sized_relobj::layout_section): New function.
11141 (Sized_relobj::Deferred_layout): New structure.
11142 (Sized_relobj::deferred_layout_): New field.
11143 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11144 Change all callers. Layout deferred sections.
11145 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11147 (Plugin_hook::run): Move code from do_plugin_hook inline.
11148 (Plugin_hook::do_plugin_hook): Remove.
11149 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11150 (Plugin_manager::finish): Renamed, was cleanup.
11151 (Plugin_manager::should_defer_layout): New function.
11152 (Plugin_manager::add_deferred_layout_object): New function.
11153 (Plugin_manager::Deferred_layout_list): New type.
11154 (Plugin_manager::deferred_layout_objects_): New field.
11155 (Plugin_hook::do_plugin_hook): Remove.
11157 2008-12-17 Ian Lance Taylor <iant@google.com>
11159 * options.h (class General_options): Add --no case for
11162 2008-12-16 Cary Coutant <ccoutant@google.com>
11164 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11166 (Plugin_manager::claim_file): Create plugin object even if
11167 plugin did not call the add_symbols callback.
11168 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11169 asking for more symbols than were added.
11170 * testsuite/Makefile.am (plugin_test_1): Add test case with
11172 (empty.syms): New target.
11173 * testsuite/Makefile.in: Regenerate.
11174 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11175 message. Don't call add_symbols if no globals.
11176 (all_symbols_read_hook): Don't provide replacement for empty
11179 2008-12-12 Ian Lance Taylor <iant@google.com>
11181 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11182 r_type == 0 for a local symbol with r_sym == 0.
11183 (scan_relocatable_relocs): Pass r_sym to
11184 local_non_section_strategy.
11185 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11188 * configure.ac: Update test for TLS descriptors: they are
11189 supported as of glibc 2.9.
11190 * configure: Rebuild.
11192 2008-12-11 Ian Lance Taylor <iant@google.com>
11195 * target-reloc.h (Default_scan_relocatable_relocs): For each
11196 function, map r_type == 0 to RELOC_DISCARD.
11198 2008-12-10 Cary Coutant <ccoutant@google.com>
11200 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11201 object to override a kept COMDAT group from a plugin object.
11203 2008-12-09 Ian Lance Taylor <iant@google.com>
11206 * yyscript.y (file_cmd): Handle INPUT.
11208 * testsuite/initpri1.c: Change all declarations to be full
11209 prototypes by adding void, to avoid compiler warnings.
11211 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11213 * options.cc (General_options::parse_plugin_opt): New.
11214 (General_options::add_plugin): The argument now is just the filename.
11215 (General_options::add_plugin_option): New.
11216 * options.h (plugin_opt): New.
11217 (add_plugin): Change argument name.
11218 (add_plugin_option): New.
11219 * plugin.cc (Plugin::load): Don't parse the plugin option.
11220 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11221 (Plugin::add_option): New.
11222 (Plugin::args_): Change type.
11223 (Plugin::filename_): New.
11224 (Plugin_manager::add_plugin_option): New.
11225 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11226 * testsuite/Makefile.in: Regenerate.
11228 2008-12-05 Cary Coutant <ccoutant@google.com>
11230 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11231 Handle --strip-lto-sections option.
11232 * options.h (strip_lto_sections): New option.
11234 2008-12-01 Cary Coutant <ccoutant@google.com>
11236 * plugin.cc (ld_plugin_message): Change format parameter to const.
11237 Fix mismatch between new[] and delete.
11239 2008-11-14 Cary Coutant <ccoutant@google.com>
11241 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11244 2008-11-05 Craig Silverstein <csilvers@google.com>
11246 * options.cc (General_options::parse_dynamic_list): New function.
11247 * options.h (General_options): New flags dynamic_list,
11248 dynamic_list_data, dynamic_list_cpp_new, and
11249 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11250 (General_options::in_dynamic_list): New function.
11251 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11252 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11253 (Lex::can_continue_name): Likewise.
11255 (read_script_file): New parameter script_options.
11256 (read_dynamic_list): New function.
11257 (Script_options::define_dynamic_list): New function.
11258 (dynamic_list_keyword_parsecodes): New variable.
11259 (dynamic_list_keywords): New variable.
11260 * script.h (Script_options::define_dynamic_list): New function
11262 (read_dynamic_list): New function prototype.
11263 * symtab.cc (strprefix): New macro.
11264 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11265 dynamic_list_data, dynamic_list_cpp_new, and
11266 dynamic_list_cpp_typeinfo.
11267 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11268 (dynamic_list_expr): New rule.
11269 (dynamic_list_nodes): Likewise.
11270 (dynamic_list_node): Likewise.
11271 * testsuite/Makefile.am (dynamic_list): New test.
11272 * testsuite/Makefile.in: Regenerated.
11273 * testsuite/dynamic_list.t: New file.
11274 * testsuite/dynamic_list.sh: New file.
11276 2008-11-05 Craig Silverstein <csilvers@google.com>
11278 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11279 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11280 (t11_last): Likewise.
11281 * testsuite/ver_test_6.c (main): Likewise.
11283 2008-10-07 Cary Coutant <ccoutant@google.com>
11285 * options.c (General_options::finalize): Add check for -static and
11287 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11290 2008-10-02 Cary Coutant <ccoutant@google.com>
11292 * plugin.cc (make_sized_plugin_object): Fix conditional
11293 compilation to work when not all targets are enabled.
11295 2008-09-29 Cary Coutant <ccoutant@google.com>
11297 * archive.cc (Archive::get_file_and_offset): Use filename instead
11298 of name to get library path.
11299 (Archive::include_member): Unlock external member of a thin archive.
11301 * testsuite/Makefile.am (TEST_AR): New variable.
11302 (thin_archive_test_1): New test.
11303 (thin_archive_test_2): New test.
11304 * testsuite/Makefile.in: Regenerate.
11305 * testsuite/thin_archive_main.cc: New file.
11306 * testsuite/thin_archive_test_1.cc: New file.
11307 * testsuite/thin_archive_test_2.cc: New file.
11308 * testsuite/thin_archive_test_3.cc: New file.
11309 * testsuite/thin_archive_test_4.cc: New file.
11311 2008-09-29 Cary Coutant <ccoutant@google.com>
11313 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11314 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11316 (Sized_relobj::do_finalize_local_symbols): Likewise.
11317 (Sized_relobj::map_to_kept_section): Likewise.
11318 * object.h (Sized_relobj::invalid_address): New constant.
11319 (Sized_relobj::do_output_section_offset): Check for invalid_address
11321 * output.cc (Output_reloc::local_section_offset): Use constant
11322 invalid_address instead of -1U.
11323 (Output_reloc::get_address): Likewise.
11324 (Output_section::output_address): Change -1U to -1ULL.
11325 * output.h (Output_reloc::invalid_address): New constant.
11326 * reloc.cc (Sized_relobj::write_sections): Use constant
11327 invalid_address instead of -1U.
11328 (Sized_relobj::relocate_sections): Likewise.
11329 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11330 values for merge sections.
11331 * target-reloc.h (relocate_for_relocatable): Use constant
11332 invalid_address instead of -1U.
11334 2008-09-19 Cary Coutant <ccoutant@google.com>
11336 Add plugin functionality for link-time optimization (LTO).
11337 * configure.ac (plugins): Add --enable-plugins option.
11338 * configure: Regenerate.
11339 * config.in: Regenerate.
11340 * Makefile.am (LIBDL): New variable.
11341 (CCFILES): Add plugin.cc.
11342 (HFILES): Add plugin.h.
11343 (ldadd_var): Add LIBDL.
11344 * Makefile.in: Regenerate.
11346 * archive.cc: Include "plugin.h".
11347 (Archive::setup): Don't preread archive symbols when using a plugin.
11348 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11349 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11351 (Archive::include_member): Add symbols from plugin objects.
11352 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11353 * descriptors.cc (Descriptors::open): Check for file descriptors
11354 abandoned by plugins.
11355 (Descriptors::claim_for_plugin): New function.
11356 * descriptors.h (Descriptors::claim_for_plugin): New function.
11357 (Open_descriptor::is_claimed): New field.
11358 (claim_descriptor_for_plugin): New function.
11359 * fileread.cc (File_read::claim_for_plugin): New function.
11360 * fileread.h (File_read::claim_for_plugin): New function.
11361 (File_read::descriptor): New function.
11362 * gold.cc: Include "plugin.h".
11363 (queue_initial_tasks): Add task to call plugin hooks for generating
11365 * main.cc: Include "plugin.h".
11366 (main): Load plugin libraries.
11367 * object.h (Pluginobj): Declare.
11368 (Object::pluginobj): New function.
11369 (Object::do_pluginobj): New function.
11370 (Object::set_target): New function.
11371 * options.cc: Include "plugin.h".
11372 (General_options::parse_plugin): New function.
11373 (General_options::General_options): Initialize plugins_ field.
11374 (General_options::add_plugin): New function.
11375 * options.h (Plugin_manager): Declare.
11376 (General_options): Add --plugin option.
11377 (General_options::has_plugins): New function.
11378 (General_options::plugins): New function.
11379 (General_options::add_plugin): New function.
11380 (General_options::plugins_): New field.
11381 * plugin.cc: New file.
11382 * plugin.h: New file.
11383 * readsyms.cc: Include "plugin.h".
11384 (Read_symbols::do_read_symbols): Check for archive before checking
11385 for ELF file. Call plugin hooks to claim files.
11386 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11387 from a real object file; force override when processing replacement
11389 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11390 (Symbol::init_base_object): Likewise.
11391 (Symbol::init_base_output_data): Likewise.
11392 (Symbol::init_base_output_segment): Likewise.
11393 (Symbol::init_base_constant): Likewise.
11394 (Symbol::init_base_undefined): Likewise.
11395 (Symbol::output_section): Assert that object is not a plugin.
11396 (Symbol_table::add_from_pluginobj): New function.
11397 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11399 (Symbol_table::sized_write_globals): Likewise.
11400 (Symbol_table::add_from_pluginobj): Instantiate template.
11401 * symtab.h (Sized_pluginobj): Declare.
11402 (Symbol::in_real_elf): New function.
11403 (Symbol::set_in_real_elf): New function.
11404 (Symbol::in_real_elf_): New field.
11405 (Symbol_table::add_from_pluginobj): New function.
11407 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11408 (LIBDL): New variable.
11409 (LDADD): Add LIBDL.
11410 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11411 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11412 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11413 (MOSTLYCLEANFILES): Likewise.
11414 * testsuite/Makefile.in: Regenerate.
11415 * testsuite/plugin_test.c: New file.
11416 * testsuite/plugin_test_1.sh: New file.
11417 * testsuite/plugin_test_2.sh: New file.
11419 2008-09-16 Ian Lance Taylor <iant@google.com>
11421 * target-reloc.h (relocate_section): Check whether a symbol is
11422 defined by the ABI before reporting an undefined symbol error.
11423 * target.h (Target::is_defined_by_abi): Make parameter const.
11424 (Target::do_is_defined_by_abi): Likewise.
11425 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11426 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11427 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11428 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11429 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11430 * testsuite/Makefile.in: Rebuild.
11432 * fileread.cc (make_view): Add casts to avoid warning.
11434 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11436 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11437 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11439 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11441 * options.h (General_options::output_is_executable): New.
11442 (General_options::output_is_pie): New.
11443 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11444 for shared libraries.
11445 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11447 2008-09-11 Chris Demetriou <cgd@google.com>
11449 * options.h (origin): New -z option.
11450 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11451 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11454 2008-09-05 Cary Coutant <ccoutant@google.com>
11456 * fileread.cc (File_read::make_view): Add check for attempt to map
11457 beyond end of file.
11459 2008-09-05 Cary Coutant <ccoutant@google.com>
11461 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11462 explicit instantiations.
11464 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11467 * options.cc (General_options::finalize): Allow undefined symbols
11468 in shlibs if linking -shared.
11471 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11472 symbols as not needing a dynsym entry.
11474 2008-08-20 Craig Silverstein <csilvers@google.com>
11476 * fileread.cc (File_read::open): Do not lock the file unless it
11477 was successfully opened.
11479 2008-08-14 Cary Coutant <ccoutant@google.com>
11481 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11482 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11483 * testsuite/tls_test.cc (struct int128): 128-bit struct
11484 for testing TLS relocs with non-zero addend.
11485 (v12): New TLS variable.
11487 (t_last): Add check for v12.
11488 * testsuite/tls_test.h (t12): New function.
11489 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11491 2008-08-13 Ian Lance Taylor <iant@google.com>
11493 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11494 set tls_segment_ or relro_segment_.
11495 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11497 * output.h (Output_section::clear_is_relro): New function.
11498 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11499 sections specially even when output_data_ is empty.
11500 (Output_segment::maximum_alignment): When first section is relro,
11501 only force alignment for PT_LOAD segments.
11502 * script.cc (script_data_segment_align): New function.
11503 (script_data_segment_relro_end): New function.
11504 * script-c.h (script_data_segment_align): Declare.
11505 (script_data_segment_relro_end): Declare.
11506 * script-sections.h (class Script_sections): Declare
11507 data_segment_align and data_segment_relro_end. Add fields
11508 segment_align_index_ and saw_relro_end_.
11509 * script-sections.cc (class Sections_element): Add set_is_relro
11510 virtual function. Add new bool* parameter to place_orphan_here.
11511 Add get_output_section virtual function.
11512 (class Output_section_definition): Add set_is_relro. Add new
11513 bool* parameter to place_orphan_here. Add get_output_section.
11514 Add is_relro_ field.
11515 (Output_section_definition::Output_section_definition): Initialize
11516 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11517 and is_relro_ fields.
11518 (Output_section_definition::place_orphan_here): Add is_relro
11520 (Output_section_definition::set_section_addresses): Set relro for
11522 (Output_section_definition::alternate_constraint): Likewise.
11523 (class Orphan_output_section): Add new bool* parameter to
11524 place_orphan_here. Add get_output_section.
11525 (Orphan_output_section::place_orphan_here): Add is_relro
11527 (Script_sections::Script_sections): Initialize
11528 data_segment_align_index_ and saw_relro_end_.
11529 (Script_sections::data_segment_align): New function.
11530 (Script_sections::data_segment_relro_end): New function.
11531 (Script_sections::place_orphan): Set or clear is_relro.
11532 (Script_sections::set_section_addresses): Force alignment of first
11534 * yyscript.y (exp): Call script_data_segment_align and
11535 script_data_segment_relro_end.
11536 * testsuite/relro_script_test.t: New file.
11537 * testsuite/relro_test.cc (using_script): Declare.
11538 (t1, t2): Test using_script.
11539 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11540 (relro_script_test_SOURCES): Define.
11541 (relro_script_test_DEPENDENCIES): Define.
11542 (relro_script_test_LDFLAGS): Define.
11543 (relro_script_test_LDADD): Define.
11544 (relro_script_test.so): New target.
11545 * testsuite/Makefile.in: Rebuild.
11547 2008-08-06 Cary Coutant <ccoutant@google.com>
11549 * archive.cc (Archive::total_archives, Archive::total_members)
11550 (Archive::total_members_loaded): New variables.
11551 (Archive::setup): Add parameter. Add option to preread
11553 (Archive::read_armap): Add counter.
11554 (Archive::get_file_and_offset): New function.
11555 (Archive::get_elf_object_for_member): New function.
11556 (Archive::read_all_symbols): New function.
11557 (Archive::read_symbols): New function.
11558 (Archive::add_symbols): Add counters.
11559 (Archive::include_all_members): Use armap to find members if it's
11561 (Archive::include_member): Skip reading symbols if already read.
11562 Factored code into Archive::get_file_and_offset and
11563 Archive::get_elf_object_for_member. Changed call to
11564 Mapfile::report_include_archive_member.
11565 (Archive::print_stats): New function.
11566 * archive.h: Declare Object and Read_symbols_data classes.
11567 (Archive::Archive): Add initializers for new members.
11568 (Archive::setup): Add parameter.
11569 (Archive::print_stats): New function.
11570 (Archive::total_archives, Archive::total_members)
11571 (Archive::total_members_loaded): New variables.
11572 (Archive::get_file_and_offset): New function.
11573 (Archive::get_elf_object_for_member): New function.
11574 (Archive::read_all_symbols): New function.
11575 (Archive::read_symbols): New function.
11576 (Archive::Archive_member): New class.
11577 (Archive::members_): New member.
11578 (Archive::num_members_): New member.
11579 * main.cc: Include archive.h.
11580 (main): Call Archive::print_stats.
11581 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11582 archive parameter; member_name is now the fully-decorated name.
11583 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11584 * options.h: (General_options): Add --preread-archive-symbols option.
11585 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11588 2008-08-04 Ian Lance Taylor <iant@google.com>
11590 * symtab.h (Symbol::use_plt_offset): New function.
11591 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11592 * powerpc.cc (Relocate::relocate): Likewise.
11593 * sparc.cc (Relocate::relocate): Likewise.
11594 * x86_64.cc (Relocate::relocate): Likewise.
11595 * testsuite/weak_plt.sh: New test.
11596 * testsuite/weak_plt_main.cc: New test.
11597 * testsuite/weak_plt_shared.cc: New test.
11598 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11599 (check_PROGRAMS): Add weak_plt.
11600 (check_DATA): Add weak_plt_shared.so.
11601 (weak_plt_main_pic.o, weak_plt): New targets.
11602 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11603 * testsuite/Makefile.in: Rebuild.
11605 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11607 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11608 * testsuite/Makefile.in: Rebuild.
11610 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11612 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11613 * Makefile.in: Regenerate.
11614 * po/POTFILES.in: Regenerate.
11616 2008-07-29 Ian Lance Taylor <iant@google.com>
11618 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11619 symbols before other symbols.
11620 * testsuite/script_test_2.cc (test_addr): Declare.
11621 (test_addr_alias): Declare.
11622 (main): Check that test_addr and test_addr_alias have the right
11624 * testsuite/script_test_2.t: Define test_addr_alias and
11627 2008-07-24 Ian Lance Taylor <iant@google.com>
11630 * descriptors.cc: New file.
11631 * descriptors.h: New file.
11632 * gold-threads.h (class Hold_optional_lock): New class.
11633 * fileread.cc: Include "descriptors.h".
11634 (File_read::~File_read): Release descriptor rather than closing
11636 (File_read::open) [file]: Call open_descriptor rather than open.
11637 Set is_descriptor_opened_.
11638 (File_read::open) [memory]: Assert that descriptor is not open.
11639 (File_read::reopen_descriptor): New function.
11640 (File_read::release): Release descriptor.
11641 (File_read::do_read): Make non-const. Reopen descriptor.
11642 (File_read::read): Make non-const.
11643 (File_read::make_view): Reopen descriptor.
11644 (File_read::do_readv): Likewise.
11645 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11646 Update declarations.
11647 * layout.cc: Include "descriptors.h".
11648 (Layout::create_build_id): Use open_descriptor rather than open.
11649 * output.cc: Include "descriptors.h".
11650 (Output_file::open): Use open_descriptor rather than open.
11651 * archive.cc (Archive::const_iterator): Change Archive to be
11653 (Archive::begin, Archive::end): Make non-const.
11654 (Archive::count_members): Likewise.
11655 * archive.h (class Archive): Update declarations.
11656 * object.h (Object::read): Make non-const.
11657 * Makefile.am (CCFILES): Add descriptors.cc.
11658 (HFILES): Add descriptors.h.
11659 * Makefile.in: Rebuild.
11662 * gold.h: Always include <clocale>. Add Solaris workarounds
11663 following code in binutils/sysdep.h.
11666 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11667 this->eh_frame_hdr_ is NULL before using it.
11669 * dynobj.cc (Versions::Versions): Update comment.
11671 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11672 the base version name.
11674 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11675 array size plus one.
11676 (Stringpool_template::set_string_offsets): Subtract one from key
11677 before using it as an array index.
11678 (Stringpool_template::get_offset_with_length): Likewise.
11679 (Stringpool_template::write_to_buffer): Likewise.
11680 * stringpool.h (Stringpool_template::get_offset_from_key):
11683 2008-07-23 Ian Lance Taylor <iant@google.com>
11686 * object.h (Merged_symbol_value::value): Do our best to handle a
11690 * script.cc (Version_script_info::get_versions): Don't add empty
11691 version tag to return value.
11692 (Version_script_info::get_symbol_version_helper): Change return
11693 type to bool. Add pversion parameter. Change all callers.
11694 (script_register_vers_node): Don't require a non-NULL tag.
11695 * script.h (class Version_script_info): Update declarations.
11696 (Version_script_info::get_symbol_version): Change return type to
11697 bool. Add version parameter. Change all callers.
11698 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11699 handling. Handle an empty version from a version script.
11700 (Symbol_table::define_special_symbol): Likewise.
11701 * testsuite/ver_test_10.script: New file.
11702 * testsuite/ver_test_10.sh: New file.
11703 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11704 (check_DATA): Add ver_test_10.syms.
11705 (ver_test_10.syms, ver_test_10.so): New target.
11706 * testsuite/Makefile.in: Rebuild.
11708 2008-07-23 Simon Baldwin <simonb@google.com>
11710 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11711 to zero for undefined symbols from dynamic libraries.
11713 2008-07-23 Ian Lance Taylor <iant@google.com>
11715 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11716 Change all callers.
11717 * symtab.h (class Symbol_table): Update declaration.
11718 * testsuite/ver_test_9.cc: New file.
11719 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11720 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11721 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11722 (ver_test_9.so, ver_test_9.o): New targets.
11723 * testsuite/Makefile.in: Rebuild.
11725 2008-07-22 Ian Lance Taylor <iant@google.com>
11727 * options.h (class General_options): Define --check-sections.
11728 * layout.cc (Layout::set_segment_offsets): Handle
11731 * options.h (class General_options): Define -n/--nmagic and
11733 * options.cc (General_options::finalize): For -n/--nmagic or
11734 -N/--omagic, set -static.
11735 * layout.cc (Layout::attach_allocated_section_to_segment): If
11736 -N/--omagic, don't put read-only and read-write sections in
11737 different segments.
11738 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11739 finding a read-only segment.
11740 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11741 don't set the minimum segment alignment to the common page size,
11742 and don't set the file offset to the address modulo the page size.
11743 * script-sections.cc (Script_sections::create_segments): If
11744 -n/--omagic, don't put read-only and read-write sections in
11745 different segments.
11747 * cref.cc: New file.
11748 * cref.h: New file.
11749 * options.h (class General_options): Add --print-symbol-counts.
11750 * main.cc (main): Issue defined symbol report if requested.
11751 * archive.cc (Archive::interpret_header): Make into a const member
11753 (Archive::add_symbols): Call Input_objects::archive_start and
11755 (Archive::const_iterator): Define new class.
11756 (Archive::begin, Archive::end): New functions.
11757 (Archive::include_all_members): Rewrite to use iterator.
11758 (Archive::count_members): New function.
11759 * archive.h (class Archive): Update declarations.
11760 (Archive::filename): New function.
11761 * object.cc: Include "cref.h".
11762 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11763 (Sized_relobj::do_get_global_symbol_counts): New function.
11764 (Input_objects::add_object): Add object to cross-referencer.
11765 (Input_objects::archive_start): New function.
11766 (Input_objects::archive_stop): New function.
11767 (Input_objects::print_symbol_counts): New function.
11768 * object.h: Declare Cref and Archive.
11769 (Object::get_global_symbol_counts): New function.
11770 (Object::do_get_global_symbol_counts): New pure virtual function.
11771 (class Sized_relobj): Add defined_count_ field. Update
11773 (class Input_objects): Add cref_ field. Update constructor.
11774 Update declarations.
11775 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11777 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11779 (Sized_dynobj::do_get_global_symbol_counts): New function.
11780 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11781 defined_count_. Update declarations. Define Symbols typedef.
11782 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11783 parameter. Change all callers.
11784 (Symbol_table::add_from_dynobj): Add sympointers and defined
11785 parameters. Change all callers.
11786 * symtab.h (class Symbol_table): Update declarations.
11787 * Makefile.am (CCFILES): Add cref.cc.
11788 (HFILES): Add cref.h.
11789 * Makefile.in: Rebuild.
11791 2008-07-22 Simon Baldwin <simonb@google.com>
11793 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11794 to zero when writing undefined symbols.
11796 2008-07-22 Ian Lance Taylor <iant@google.com>
11798 * output.cc (Output_section::add_input_section): Don't try to
11799 merge empty merge sections.
11801 2008-07-21 Craig Silverstein <csilvers@google.com>
11803 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11804 Include symbol version in error message.
11806 2008-07-20 Chris Demetriou <cgd@google.com>
11808 * configure.ac (gold_cv_c_random_seed): New configured variable.
11809 (RANDOM_SEED_CFLAGS): New substituted variable.
11810 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11811 * configure: Rebuild.
11812 * Makefile.in: Likewise.
11813 * testsuite/Makefile.in: Likewise.
11815 2008-07-18 Ian Lance Taylor <iant@google.com>
11817 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11818 where we see NAME/NULL and NAME/VERSION as separate symbols.
11819 * testsuite/ver_test_main.cc (main): Call t4.
11820 (t4, t4_2a): Define.
11821 * testsuite/ver_test_2.cc (t4_2): Define.
11822 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11823 * testsuite/ver_test_4.cc (t4_2a): Define.
11824 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11825 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11827 2008-07-17 Ian Lance Taylor <iant@google.com>
11829 * dynobj.cc (Versions::add_def): If we give an error about a
11830 missing version, go ahead and create the version anyhow.
11832 2008-07-10 Ian Lance Taylor <iant@google.com>
11834 Handle output sections with more than 0x7fffffff bytes.
11835 * object.h (class Relobj): Change map_to_output_ to
11836 output_sections_, and just keep a section pointer. Change all
11837 uses. Move comdat group support to Sized_relobj.
11838 (Relobj::is_section_specially_mapped): Remove.
11839 (Relobj::output_section): Remove poff parameter. Change all
11841 (Relobj::output_section_offset): New function.
11842 (Relobj::set_section_offset): Rewrite.
11843 (Relobj::map_to_output): Remove.
11844 (Relobj::output_sections): New function.
11845 (Relobj::do_output_section_offset): New pure virtual function.
11846 (Relobj::do_set_section_offset): Likewise.
11847 (class Sized_relobj): Add section_offsets_ field. Add comdat
11848 group support from Relobj. Update declarations.
11849 (Sized_relobj::get_output_section_offset): New function.
11850 (Sized_relobj::do_output_section_offset): New function.
11851 (Sized_relobj::do_set_section_offset): New function.
11852 * object.cc (Relobj::output_section_address): Remove.
11853 (Sized_relobj::Sized_relobj): Initialize new fields.
11854 (Sized_relobj::include_section_group): Cast find_kept_object to
11856 (Sized_relobj::include_linkonce_section): Likewise.
11857 (Sized_relobj::do_layout): Use separate arrays for output section
11859 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11861 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11862 output_sections and section_offsets.
11863 (Sized_relobj::write_local_symbols): Likewise.
11864 (map_to_kept_section): Compute output address directly.
11865 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11866 output_sections and section_offsets.
11867 (Sized_relobj::write_sections): Likewise.
11868 (Sized_relobj::relocate_sections): Likewise.
11869 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11870 * output.h (class Output_reloc): Update declarations. Change
11871 u2_.relobj to Sized_relobj*.
11872 (class Output_data_reloc): Change add functions to use
11874 * output.cc (Output_reloc::Output_reloc): Change relobj to
11876 (Output_reloc::local_section_offset): Change return type to
11877 Elf_Addr. Use get_output_section_offset.
11878 (Output_reloc::get_address): Likewise.
11879 (Output_section::is_input_address_mapped): Don't call
11880 is_section_specially_mapped.
11881 (Output_section::output_offset): Likewise.
11882 (Output_section::output_address): Likewise.
11883 (Output_section::starting_output_address): Likewise.
11884 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11885 parameter to Sized_relobj*.
11886 (Copy_relocs::need_copy_reloc): Likewise.
11887 (Copy_relocs::save): Likewise.
11888 * copy-relocs.h (class Copy_relocs): Update declarations.
11889 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11890 Sized_relobj*. Change relobj_ field to Sized_relobj*.
11891 * target-reloc.h (relocate_for_relocatable): Change
11892 offset_in_output_section type to Elf_Addr. Change code that uses
11894 * layout.cc (Layout::layout): Always set *off.
11895 * mapfile.cc (Mapfile::print_input_section): Use
11896 output_section_offset.
11897 * i386.cc (Target_i386::copy_reloc): Change object parameter to
11899 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11900 * sparc.cc (Target_sparc::copy_reloc): Likewise.
11901 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11903 2008-07-03 Ian Lance Taylor <iant@google.com>
11905 * layout.cc (Layout::include_section): Do not discard unrecognized
11906 SHT_STRTAB sections.
11908 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
11910 * script.cc (Lex::can_continue_name): Make '?' allowable in
11911 version-script names.
11912 * testsuite/version_script.map: Change glob pattern to use '?'
11914 2008-06-30 Manish Singh <yosh@gimp.org>
11917 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11920 2008-06-30 Ian Lance Taylor <iant@google.com>
11924 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11925 versions]: Don't try to read the value in the contents, since we
11926 don't use it. Use the template endianness when writing.
11928 2008-06-25 Cary Coutant <ccoutant@google.com>
11930 * fileread.cc (File_read::make_view): Assert on zero-length view.
11931 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11932 symbol table when there are no symbols to read.
11934 2008-06-23 Craig Silverstein <csilvers@google.com>
11936 * version.cc (version_string): Bump to 1.7
11938 2008-06-18 Craig Silverstein <csilvers@google.com>
11940 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11941 constant 0xFFFF to type Valtype.
11942 (Powerpc_relocate_functions::rel16_ha): Likewise.
11944 2008-06-17 Ian Lance Taylor <iant@google.com>
11946 * output.h (Output_section::Input_section): Initialize p2align_ to
11947 zero for Output_section_data constructors.
11948 (Output_section::Input_section::addralign): If not an input
11949 section, return the alignment of the Output_section_data.
11950 * testsuite/copy_test.cc: New file.
11951 * testsuite/copy_test_1.cc: New file.
11952 * testsuite/copy_test_2.cc: New file.
11953 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11954 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11955 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11956 (copy_test_1_pic.o, copy_test_1.so): New targets.
11957 (copy_test_2_pic.o, copy_test_2.so): New targets.
11958 * testsuite/Makefile.in: Rebuild.
11960 * script-sections.cc (Script_sections::place_orphan): Initialize
11961 local variable exact.
11963 2008-06-13 David Edelsohn <edelsohn@gnu.org>
11965 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11967 2008-06-12 David Edelsohn <edelsohn@gnu.org>
11968 David S. Miller <davem@davemloft.net>
11970 * powerpc.cc: New file.
11971 * Makefile.am (TARGETSOURCES): Add powerpc.cc
11972 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11973 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11974 * Makefile.in: Rebuild.
11976 2008-06-09 Ian Lance Taylor <iant@google.com>
11978 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11980 (throwing, orig_terminate): New static variables.
11981 (terminate_handler): New static function.
11982 (t2): Set terminate handler.
11984 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
11987 * binary.cc (Binary_to_elf::sized_convert): Fix .data
11990 2008-05-30 Cary Coutant <ccoutant@google.com>
11992 * archive.cc (Archive::include_all_members) Correct to step
11993 over symbol table and extended name table in thin archives.
11995 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
11998 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12001 2008-05-28 Caleb Howe <cshowe@google.com>
12003 * reduced_debug_output.cc: New file.
12004 * reduced_debug_output.h: New file.
12005 * options.h (class General_options): Add --strip-debug-non-line.
12006 * options.cc (General_options::finalize): Add strip_debug_non_line
12007 to the strip heirarchy.
12008 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12010 * layout.cc: Include "reduced_debug_output.h".
12011 (Layout::Layout): Initialize new fields.
12012 (line_only_debug_sections): New static array.
12013 (is_lines_only_debug_sections): New static inline function.
12014 (Layout::include_section): Handle --strip-debug-non-line.
12015 (Layout::make_output_section): If --strip-debug-non-line, build
12016 new output sections for .debug_abbrev and .debug_info.
12017 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12018 gold. Warn about possible overflow.
12019 (read_signed_LEB_128): Likewise.
12020 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12021 (read_signed_LEB_128): Declare.
12022 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12023 (HFILES): Add reduced_debug_output.h.
12024 * Makefile.in: Rebuild.
12026 2008-05-21 Ian Lance Taylor <iant@google.com>
12028 * mapfile.cc: New file.
12029 * mapfile.h: New file.
12030 * options.h (class General_options): Add -M/--print-map and -Map.
12031 * options.cc (General_options::finalize): Make -M equivalent to
12033 * main.cc: Include <cstdio> and "mapfile.h".
12034 (main): Open mapfile if requested.
12035 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12036 constructor. Change caller.
12037 (queue_initial_tasks): Add mapfile parameter. Change caller.
12038 (queue_middle_tasks): Likewise.
12039 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12041 * archive.cc: Include "mapfile.h".
12042 (Archive::add_symbols): Add mapfile parameter. Change all
12043 callers. Pass mapfile, symbol, and reason to include_member.
12044 (Archive::include_all_members): Add mapfile parameter. Change all
12046 (Archive::include_member): Add mapfile, sym, and why parameters.
12047 Change all callers. Report inclusion to map file.
12048 * archive.h: Include "fileread.h".
12049 (class Archive): Update declarations.
12050 (Archive::file): New const method.
12051 (class Add_archive_symbols): Add mapfile_ field. Update
12052 constructor. Change all callers.
12053 * readsyms.h (class Read_symbols): Likewise.
12054 (class Finish_group): Likewise.
12055 (class Read_script): Likewise.
12056 * common.cc: Include "mapfile.h".
12057 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12059 (Symbol_table::do_allocate_commons): Likewise.
12060 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12061 symbol allocation to mapfile.
12062 * common.h (class Allocate_commons_task): Add mapfile_ field.
12063 Update constructor. Change all callers.
12064 * symtab.h (class Symbol_table): Update declarations.
12065 * layout.cc: Include "mapfile.h".
12066 (Layout_task_runner::run): Print information to mapfile.
12067 (Layout::create_gold_note): Change Output_data_fixed_space to
12068 Output_data_zero_fill.
12069 (Layout::create_build_id): Likewise.
12070 (Layout::print_to_mapfile): New function.
12071 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12072 constructor. Change caller.
12073 (class Layout): Declare print_to_mapfile.
12074 * output.cc (Output_section::Input_section::print_to_mapfile): New
12076 (Output_section::add_input_section): If producing a map, always
12077 add to input_sections_ list.
12078 (Output_section::do_print_to_mapfile): New function.
12079 (Output_segment::print_sections_to_mapfile): New function.
12080 (Output_segment::print_section_list_to_mapfile): New function.
12081 * output.h: Include "mapfile.h".
12082 (Output_data::print_to_mapfile): New function.
12083 (Output_data::do_print_to_mapfile): New virtual function.
12084 (Output_segment_headers::do_print_to_mapfile): New function.
12085 (Output_file_header::do_print_to_mapfile): New function.
12086 (Output_data_const::do_print_to_mapfile): New function.
12087 (class Output_data_const_buffer): Add map_name_ field. Update
12088 constructor. Change all callers. Add do_print_to_mapfile
12090 (class Output_data_fixed_space): Likewise.
12091 (class Output_data_space): Likewise.
12092 (class Output_data_zero_fill): New class.
12093 (Output_data_strtab::do_print_to_mapfile): New function.
12094 (Output_data_reloc_base::do_print_to_mapfile): New function.
12095 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12096 (Output_data_group::do_print_to_mapfile): New function.
12097 (Output_data_got::do_print_to_mapfile): New function.
12098 (Output_data_dynamic::do_print_to_mapfile): New function.
12099 (Output_symtab_xindex::do_print_to_mapfile): New function.
12100 (class Output_section): Declare do_print_to_mapflie. Declare
12101 print_to_mapfile in Input_section.
12102 (class Output_segment): Declare new functions.
12103 * object.h (Sized_relobj::symbol_count): New function.
12104 * script-sections.cc
12105 (Output_section_element_dot_assignment::set_section_addresses):
12106 Change Output_data_fixed_space to Output_data_zero_fill.
12107 (Output_data_expression::do_print_to_mapfile): New function.
12108 * script.cc (read_input_script): Add mapfile parameter. Change
12110 * script.h (read_input_script): Update declaration.
12111 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12112 (Eh_frame::do_print_to_mapfile): New function.
12113 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12114 (Output_merge_string::do_print_to_mapfile): New function.
12115 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12117 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12119 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12121 * Makefile.am (CCFILES): Add mapfile.cc.
12122 (HFILES): Add mapfile.h.
12123 * Makefile.in: Rebuild.
12125 2008-05-19 Ian Lance Taylor <iant@google.com>
12127 * options.h (class General_options): Add -z relro.
12128 * layout.cc (Layout::Layout): Initialize relro_segment_.
12129 (Layout::add_output_section_data): Return the output section.
12130 (Layout::make_output_section): Rcognize relro sections and mark
12131 them appropriately.
12132 (Layout::attach_allocated_section_to_segment): Put relro sections
12133 in a PT_GNU_RELRO segment.
12134 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12136 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12138 (Layout::linkonce_mapping): Map d.rel.ro.local to
12139 .data.rel.ro.local.
12140 (Layout::output_section_name): Us .data.rel.ro.local for any
12141 section which begins with that.
12142 * layout.h (class Layout): Update add_output_section_data
12143 declaration. Add relro_segment_ field.
12144 * output.cc (Output_section::Output_section): Initialize is_relro_
12145 and is_relro_local_ fields.
12146 (Output_segment::add_output_section): Group relro sections.
12147 (Output_segment::is_first_section_relro): New function.
12148 (Output_segment::maximum_alignment): If there is a relro section,
12149 align the segment to the common page size.
12150 (Output_segment::set_section_addresses): Track whether we are
12151 looking at relro sections. If the last section is a relro
12152 section, align to the common page size.
12153 (Output_segment::set_section_list_addresses): Add in_relro
12154 parameter. Change all callers. Align to the page size when
12155 moving from relro to non-relro section.
12156 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12158 * output.h (class Output_section): Add is_relro_ and
12159 is_relro_local_ fields.
12160 (Output_section::is_relro): New function.
12161 (Output_section::set_is_relro): New function.
12162 (Output_section::is_relro_local): New function.
12163 (Output_section::set_is_relro_local): New function.
12164 (class Output_segment): Update declarations.
12165 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12166 * sparc.cc (Target_sparc::got_section): Likewise.
12167 * x86_64.cc (Target_x86_64::got_section): Likewise.
12168 * testsuite/relro_test_main.cc: New file.
12169 * testsuite/relro_test.cc: New file.
12170 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12171 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12172 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12173 (relro_test.so, relro_test_pic.o): New targets.
12174 * testsuite/Makefile.in: Rebuild.
12176 2008-05-16 Ian Lance Taylor <iant@google.com>
12178 * output.cc (Output_segment::add_output_section): Remove front
12180 * output.h (class Output_segment): Remove
12181 add_initial_output_section and overloaded add_output_section.
12182 Update declaration of remaining add_output_section.
12183 * layout.cc (Layout::create_interp): Call add_output_section
12184 rather than add_initial_output_section.
12185 (Layout::finish_dynamic_section): Likewise.
12187 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12188 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12189 know the dynamic type.
12190 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12191 field. Initialize it in constructor.
12192 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12193 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12194 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12197 * output.cc (Output_reloc::get_address): Change return type to
12199 * output.h (class Output_reloc): Update get_address declaration.
12200 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12201 for section addresses.
12203 2008-05-09 Ian Lance Taylor <iant@google.com>
12206 * gold.cc (gold_nomem): Use return value of write.
12208 2008-05-08 Ian Lance Taylor <iant@google.com>
12210 * symtab.c (Symbol::init_base_output_data): Add version
12211 parameter. Change all callers.
12212 (Symbol::init_base_output_segment): Likewise.
12213 (Symbol::init_base_constant): Likewise.
12214 (Symbol::init_base_undefined): Likewise.
12215 (Sized_symbol::init_output_data): Likewise.
12216 (Sized_symbol::init_output_segment): Likewise.
12217 (Sized_symbol::init_constant): Likewise.
12218 (Sized_symbol::init_undefined): Likewise.
12219 (Symbol_table::do_define_in_output_data): If the new symbol has a
12220 version, mark it as the default.
12221 (Symbol_table::do_define_in_output_segment): Likewise.
12222 (Symbol_table::do_define_as_constant): Likewise.
12223 * symtab.h (class Symbol): Update declarations.
12224 (class Sized_symbol): Likewise.
12225 * resolve.cc (Symbol::override_version): New function.
12226 (Symbol::override_base): Call override_version.
12227 (Symbol::override_base_with_special): Likewise.
12228 * testsuite/ver_script_8.script: New file.
12229 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12230 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12231 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12232 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12234 2008-05-06 Ian Lance Taylor <iant@google.com>
12237 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12239 (class General_options): Remove existing --undefined, and add
12240 --no-undefined instead. Add new --undefined as synonym for -u.
12241 * archive.cc (Archive::add_symbols): Check whether symbol was
12243 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12244 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12245 all uses. Add IS_UNDEFINED. Update declarations to split
12246 different versions of init_base. Declare init_base_undefined.
12247 (Symbol::is_defined): Handle IS_UNDEFINED.
12248 (Symbol::is_undefined): Likewise.
12249 (Symbol::is_weak_undefined): Call is_undefined.
12250 (Symbol::is_absolute): Handle IS_CONSTANT.
12251 (class Sized_symbol): Update declarations to split different
12252 versions of init. Declare init_undefined.
12253 (class Symbol_table): Declare new functions.
12254 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12255 Change all callers.
12256 (Symbol::init_base_output_data): Likewise.
12257 (Symbol::init_base_output_segment): Likewise.
12258 (Symbol::init_base_constant): Likewise.
12259 (Symbol::init_base_undefined): New function.
12260 (Sized_symbol::init_object): Rename from init. Change all
12262 (Sized_symbol::init_output_data): Likewise.
12263 (Sized_symbol::init_output_segment): Likewise.
12264 (Sized_symbol::init_constant): Likewise.
12265 (Sized_symbol::init_undefined): New function.
12266 (Symbol_table::add_undefined_symbols_from_command_line): New
12268 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12270 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12271 (Symbol::output_section): Likewise.
12272 (Symbol::set_output_section): Likewise.
12273 (Symbol_table::sized_finalize_symbol): Likewise.
12274 (Symbol_table::sized_write_globals): Likewise.
12275 * resolve.cc (Symbol_table::should_override): Likewise.
12276 (Symbol::override_base_with_special): Likewise.
12278 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12279 symbol, change it to have default visibility.
12280 * testsuite/protected_1.cc: New file.
12281 * testsuite/protected_2.cc: New file.
12282 * testsuite/protected_3.cc: New file.
12283 * testsuite/protected_main_1.cc: New file.
12284 * testsuite/protected_main_2.cc: New file.
12285 * testsuite/protected_main_3.cc: New file.
12286 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12287 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12288 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12289 (protected_1.so): New target.
12290 (protected_1_pic.o, protected_2_pic.o): New targets.
12291 (protected_3_pic.o): New target.
12292 (check_PROGRAMS): Add protected_2.
12293 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12294 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12295 * testsuite/Makefile.in: Rebuild.
12297 * options.h (DEFINE_var): Add set_user_set_##varname__.
12298 (DEFINE_bool_alias): New macro.
12299 (class General_options): Define -Bstatic using DEFINE_bool_alias
12300 rather than DEFINE_special. Add --undefined as an alias for -z
12302 * options.cc (General_options::parse_Bstatic): Remove.
12304 * options.h (class General_options): Add --fatal-warnings.
12305 * main.cc (main): Implement --fatal-warnings.
12306 * errors.h (Errors::warning_count): New function.
12308 * options.h (class General_options): Add -Bsymbolic-functions.
12309 * symtab.h (Symbol::is_preemptible): Check for
12310 -Bsymbolic-functions.
12312 2008-05-05 Ian Lance Taylor <iant@google.com>
12314 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12315 as noVARNAME rather than no-VARNAME.
12316 (class General_options): Add option -z combreloc.
12317 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12319 (Output_reloc::sort_before) [SHT_REL]: New function.
12320 (Output_reloc::sort_before) [SHT_RELA]: New function.
12321 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12322 Sort_relocs_comparison.
12323 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12324 parameter. Change all callers.
12325 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12326 sort_relocs parameter. Change all callers.
12327 * output.cc (Output_reloc::get_address): New function, broken out
12329 (Output_reloc::write_rel): Call it.
12330 (Output_reloc::compare): New function.
12331 (Output_data_reloc_base::do_write): Optionally sort relocs.
12333 * configure.ac: If targ_extra_obj is set, link it in.
12334 * configure.tgt: Initialize all variables.
12335 (x86_64*): Set targ_extra_obj and targ_extra_size.
12336 * configure: Rebuild.
12338 * object.cc (Sized_relobj::include_section_group): Adjust section
12339 indexes read from group data. Build vector to pass to
12341 * layout.cc (Layout::layout_group): Add flags and shndxes
12342 parameters. Remove contents parameter. Change caller. Update
12343 explicit instantiations.
12344 * layout.h (class Layout): Update layout_group declaration.
12345 * output.cc (Output_data_group::Output_data_group): Add flags and
12346 input_shndxes parameters. Remove contents parameter. Change
12348 (Output_data_group::do_write): Change input_sections_ to
12350 * output.h (class Output_data_group): Update constructor
12351 declaration. Rename input_sections_ to input_shndxes_.
12352 * testsuite/many_sections_test.cc: Add template.
12354 2008-04-30 Cary Coutant <ccoutant@google.com>
12356 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12358 * layout.cc (Layout::include_section): Refactored check for debug
12360 (Layout::add_comdat): Add new parameters. Change type
12361 of signature parameter. Add object and shndx to signatures table.
12362 (Layout::find_kept_object): New function.
12363 * layout.h: Include <cstring>.
12364 (Layout::is_debug_info_section): New function.
12365 (Layout::add_comdat): Add new parameters.
12366 (Layout::find_kept_object): New function.
12367 (Layout::Kept_section): New struct.
12368 (Layout::Signatures): Change type of map range.
12369 * object.cc (Relobj::output_section_address): New function.
12370 (Sized_relobj::include_section_group): Add new parameters. Change
12371 calls to Layout::add_comdat. Change to build table of kept comdat
12372 groups and table mapping discarded sections to kept sections.
12373 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12374 (Sized_relobj::do_layout): Change calls to include_section_group and
12375 include_linkonce_section.
12376 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12377 value to zero when section is discarded.
12378 (Sized_relobj::map_to_kept_section): New function.
12379 * object.h (Relobj::output_section_address): New function.
12380 (Relobj::Comdat_group): New type.
12381 (Relobj::find_comdat_group): New function.
12382 (Relobj::Comdat_group_table): New type.
12383 (Relobj::Kept_comdat_section): New type.
12384 (Relobj::Kept_comdat_section_table): New type.
12385 (Relobj::add_comdat_group): New function.
12386 (Relobj::set_kept_comdat_section): New function.
12387 (Relobj::get_kept_comdat_section): New function.
12388 (Relobj::comdat_groups_): New field.
12389 (Relobj::kept_comdat_sections_): New field.
12390 (Symbol_value::input_value): Update comment.
12391 (Sized_relobj::map_to_kept_section) New function.
12392 (Sized_relobj::include_linkonce_section): Add new parameter.
12393 * target-reloc.h (Comdat_behavior): New type.
12394 (get_comdat_behavior): New function.
12395 (relocate_section): Add code to map a discarded section to the
12396 corresponding kept section when applying a relocation.
12398 2008-04-30 Craig Silverstein <csilvers@google.com>
12400 * dwarf_reader.cc (next_generation_count): New static var.
12401 (Addr2line_cache_entry): New struct.
12402 (addr2line_cache): New static var.
12403 (Dwarf_line_info::one_addr2line): Added caching.
12404 (Dwarf_line_info::clear_addr2line_cache): New function.
12405 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12406 cache-size parameter.
12407 (Dwarf_line_info::one_addr2line_cache): New function.
12408 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12409 new cache-size argument to one_addr2line(), and clear cache.
12411 2008-04-28 Cary Coutant <ccoutant@google.com>
12413 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12414 R_386_PC8 relocations.
12416 2008-04-23 Ian Lance Taylor <iant@google.com>
12418 * object.cc (Sized_relobj::include_section_group): Check for
12419 invalid section group.
12421 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12424 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12425 than read for file header.
12426 * archive.cc (Archive::include_member): Likewise.
12428 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12430 * aclocal.m4: Regenerate.
12431 * configure: Regenerate.
12433 2008-04-19 Ian Lance Taylor <iant@google.com>
12435 * version.cc (version_string): Bump to 1.6.
12437 * testsuite/Makefile.am (many_sections_r_test): New target.
12438 (many_sections_r_test_SOURCES): Remove.
12439 (many_sections_r_test_DEPENDENCIES): Remove.
12440 (many_sections_r_test_LDFLAGS): Remove.
12441 (many_sections_r_test_LDADD): Remove.
12443 * object.cc (Sized_relobj::do_add_symbols): Always pass
12444 local_symbol_count_ to add_from_relobj.
12446 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12447 every thousand variables.
12448 * testsuite/Makefile.in: Rebuild.
12450 * object.cc (Xindex::initialize_symtab_xindex): New function.
12451 (Xindex::read_symtab_xindex): New function.
12452 (Xindex::sym_xindex_to_shndx): New function.
12453 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12455 (Sized_relobj::do_initialize_xindex): New function.
12456 (Sized_relobj::do_read_symbols): Adjust section links.
12457 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12458 parameter. Change all callers.
12459 (Sized_relobj::include_section_group): Adjust section links and
12460 symbol section indexes.
12461 (Sized_relobj::do_layout): Adjust section links.
12462 (Sized_relobj::do_count_local_symbols): Adjust section links and
12463 symbol section indexes.
12464 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12465 ordinary and special symbols.
12466 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12467 dynsym_xindex parameters. Change all callers. Adjust section
12468 links. Use SHN_XINDEX when needed.
12469 (Sized_relobj::get_symbol_location_info): Adjust section links.
12470 Don't get fooled by special symbols.
12471 * object.h (class Xindex): Define.
12472 (class Object): Add xindex_ parameter. Declare virtual functoin
12473 do_initialize_xindex.
12474 (Object::adjust_sym_shndx): New function.
12475 (Object::set_xindex): New protected function.
12476 (class Symbol_value): Add is_ordinary_shndx_ field.
12477 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12478 (Symbol_value::value): Assert ordinary section.
12479 (Symbol_value::initialize_input_to_output_map): Likewise.
12480 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12481 Change all callers.
12482 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12484 (class Sized_relobj): Update declarations.
12485 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12486 parameter. Change all callers.
12487 (Sized_relobj::adjust_shndx): New function.
12488 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12490 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12491 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12492 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12493 (Sized_dynobj::read_dynsym_section): Adjust section links.
12494 (Sized_dynobj::read_dynamic): Likewise.
12495 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12497 (Sized_dynobj::do_initialize_xindex): New function.
12498 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12499 do_initialize_xindex.
12500 (Sized_dynobj::adjust_shndx): New function.
12501 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12502 dynsym_xindex_ fields.
12503 (Layout::finalize): Add a call to set_section_indexes before
12504 creating the symtab sections.
12505 (Layout::set_section_indexes): Don't do anything if the section
12506 already has a section index.
12507 (Layout::create_symtab_sections): Add shnum parameter. Change
12508 caller. Create .symtab_shndx section if needed.
12509 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12511 (Layout::allocated_output_section_count): New function.
12512 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12514 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12515 fields. Update declarations.
12516 (Layout::symtab_xindex): New function.
12517 (Layout::dynsym_xindex): New function.
12518 (class Write_symbols_task): Add layout_ field.
12519 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12521 * output.cc (Output_section_headers::Output_section_headers): Add
12522 shstrtab_section parameter. Change all callers.
12523 (Output_section_headers::do_sized_write): Store overflow values
12524 for section count and section string table section index in
12525 section header zero.
12526 (Output_file_header::do_sized_write): Check for overflow of
12527 section count and section string table section index.
12528 (Output_symtab_xindex::do_write): New function.
12529 (Output_symtab_xindex::endian_do_write): New function.
12530 * output.h (class Output_section_headers): Add shstrtab_section_.
12531 Update declarations.
12532 (class Output_symtab_xindex): Define.
12533 (Output_section::has_out_shndx): New function.
12534 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12536 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12537 Change all callers.
12538 (Sized_symbol::init): Likewise.
12539 (Symbol::output_section): Check for ordinary symbol.
12540 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12541 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12543 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12544 Change all callers. Simplify handling of symbols from sections
12545 not included in the link.
12546 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12548 (Weak_alias_sorter::operator()): Assert that symbols are
12550 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12552 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12553 parameters. Change all callers.
12554 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12555 symbol distinction. Use SHN_XINDEX when needed.
12556 (Symbol_table::write_section_symbol): Add symtab_xindex
12557 parameter. Change all callers.
12558 (Symbol_table::sized_write_section_symbol): Likewise. Use
12559 SHN_XINDEX when needed.
12560 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12562 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12563 (Symbol::is_defined): Check is_ordinary.
12564 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12565 (Symbol::is_absolute, Symbol::is_common): Likewise.
12566 (class Sized_symbol): Update declarations.
12567 (class Symbol_table): Update declarations.
12568 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12569 parameters. Change all callers.
12570 (Sized_symbol::override): Likewise.
12571 (Symbol_table::override): Likewise.
12572 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12573 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12574 is_ordinary, and orig_st_shndx parameters. Change all callers.
12575 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12576 to be in an ordinary section.
12577 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12578 object and is_ordinary parameters. Change all callers.
12579 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12580 Change all callers. Don't add undefined or non-ordinary symbols
12582 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12583 Change all callers.
12584 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12586 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12587 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12588 (Sized_relobj::relocate_sections): Likewise.
12589 * target-reloc.h (scan_relocs): Adjust section symbol index.
12590 (scan_relocatable_relocs): Likewise.
12591 * i386.cc (Scan::local): Check for ordinary symbols.
12592 * sparc.cc (Scan::local): Likewise.
12593 * x86_64.cc (Scan::local): Likewise.
12594 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12595 to symbol_section_and_value.
12596 * testsuite/many_sections_test.cc: New file.
12597 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12598 (check_PROGRAMS): Add many_sections_test.
12599 (many_sections_test_SOURCES): Define.
12600 (many_sections_test_DEPENDENCIES): Define.
12601 (many_sections_test_LDFLAGS): Define.
12602 (BUILT_SOURCES): Add many_sections_define.h.
12603 (many_sections_define.h): New target.
12604 (BUILT_SOURCES): Add many_sections_check.h.
12605 (many_sections_check.h): New target.
12606 (check_PROGRAMS): Add many_sections_r_test.
12607 (many_sections_r_test_SOURCES): Define.
12608 (many_sections_r_test_DEPENDENCIES): Define.
12609 (many_sections_r_test_LDFLAGS): Define.
12610 (many_sections_r_test_LDADD): Define.
12611 (many_sections_r_test.o): New target.
12612 * testsuite/Makefile.in: Rebuild.
12614 2008-04-17 Cary Coutant <ccoutant@google.com>
12616 * errors.cc (Errors::info): New function.
12617 (gold_info): New function.
12618 * errors.h (Errors::info): New function.
12619 * gold.h (gold_info): New function.
12620 * object.cc (Input_objects::add_object): Print trace output.
12621 * options.cc (options::parse_set): New function.
12622 (General_options::parse_wrap): Deleted.
12623 (General_options::General_options): Deleted initializer.
12624 * options.h (options::String_set): New typedef.
12625 (options::parse_set): New function.
12626 (DEFINE_set): New macro.
12627 (General_options::wrap): Changed to use DEFINE_set. Changed
12628 callers of any_wrap_symbols and is_wrap_symbol.
12629 (General_options::trace, General_options::trace_symbol):
12631 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12632 (General_options::wrap_symbols_): Deleted.
12633 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12635 2008-04-17 David S. Miller <davem@davemloft.net>
12637 * options.cc (General_options::parse_V): New function.
12638 * options.h: Add entries for -V and -Qy.
12640 2008-04-17 Ian Lance Taylor <iant@google.com>
12642 * common.cc (Symbol_table::allocate_commons): Remove options
12643 parameter. Change caller.
12644 (Symbol_table::do_allocate_commons): Remove options parameter.
12645 Change caller. Just call do_allocate_commons_list twice.
12646 (Symbol_table::do_allocate_commons_list): New function, broken out
12647 of do_allocate_commons.
12648 * common.h (class Allocate_commons_task): Remove options_ field.
12649 Update constructor.
12650 * symtab.cc (Symbol_table::Symbol_table): Initialize
12652 (Symbol_table::add_from_object): Put TLS common symbols on
12654 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12655 which are IN_OUTPUT_DATA.
12656 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12657 allocate_commons and do_allocate_commons declarations. Declare
12658 do_allocate_commons_list.
12659 * gold.cc (queue_middle_tasks): Update creation of
12660 Allocate_commons_task to not pass options.
12661 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12662 (TLS_TEST_C_FLAGS): New variable.
12663 (tls_test_c_pic.o): New target.
12664 (tls_test_shared.so): Link in tls_test_c_pic.o.
12665 (tls_test_c_pic_ie.o): New target.
12666 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12667 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12668 (tls_test_c.o): New target.
12669 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12670 (tls_pic_test_LDADD): Likewise.
12671 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12672 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12673 (tls_test_c_gnu2.o): New target.
12674 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12676 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12677 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12678 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12679 * testsuite/tls_test.cc: Include "config.h".
12680 (t_last): Call t11_last.
12681 * testsuite/tls_test.h (t11, t11_last): Declare.
12682 * testsuite/tls_test_c.c: New file.
12683 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12684 * configure.ac: Check for OpenMP support.
12685 * configure, config.in, Makefile.in: Rebuild.
12686 * testsuite/Makefile.in: Rebuild.
12688 2008-04-16 Cary Coutant <ccoutant@google.com>
12690 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12691 (Target_i386::tls_base_symbol_defined_): New field.
12692 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12693 (Target_i386::Scan::global): Likewise.
12694 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12695 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12696 (Target_x86_64::tls_base_symbol_defined_): New field.
12697 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12698 (Target_x86_64::Scan::global): Likewise.
12700 2008-04-16 Cary Coutant <ccoutant@google.com>
12702 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12703 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12704 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12705 building shared libraries.
12706 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12707 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12708 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12709 * testsuite/Makefile.in: Rebuild.
12710 * testsuite/weak_undef.h: New file.
12711 * testsuite/weak_undef_file1.cc: Add extra test cases.
12712 * testsuite/weak_undef_file2.cc: Likewise.
12713 * testsuite/weak_undef_test.cc: Likewise.
12715 2008-04-16 David S. Miller <davem@davemloft.net>
12717 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12718 Add issued_non_pic_error_ field. Declare check_non_pic.
12719 (Target_sparc::Scan::check_non_pic): New function.
12720 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12721 (Target_sparc::Scan::global): Likewise.
12723 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12724 * configure: Rebuild.
12726 * options.h (DEFINE_enable): New macro.
12727 (new_dtags): New enable option.
12728 (initfirst, interpose, loadfltr, nodefaultlib,
12729 nodelete, nodlopen, nodump): New -z options.
12730 * layout.cc (Layout:finish_dynamic_section): If new
12731 dtags enabled, emit DT_RUNPATH. Also, emit a
12732 DT_FLAGS_1 containing any specified -z flags.
12734 2008-04-16 Ian Lance Taylor <iant@google.com>
12736 * copy-relocs.cc: New file.
12737 * copy-relocs.h: New file.
12738 * reloc.cc: Remove Copy_relocs code.
12739 * reloc.h: Likewise.
12740 * reloc-types.h (struct Reloc_types) [both versions]: Add
12741 get_reloc_addend_noerror.
12742 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12743 variants of add_global which take an addend which must be zero.
12744 * i386.cc: Include "copy-relocs.h".
12745 (class Target_i386): Change type of copy_relocs_ to variable,
12746 update initializer.
12747 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12748 Change all callers.
12749 (Target_i386::do_finalize_sections): Change handling of
12751 * sparc.cc: Include "copy-relocs.h".
12752 (class Target_sparc): Change type of copy_relocs_ to variable,
12753 update initializer.
12754 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12755 Change all callers.
12756 (Target_sparc::do_finalize_sections): Change handling of
12758 * x86_64.cc: Include "copy-relocs.h".
12759 (class Target_x86_64): Change type of copy_relocs_ to variable,
12760 update initializer.
12761 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12762 class. Change all callers.
12763 (Target_x86_64::do_finalize_sections): Change handling of
12765 * Makefile.am (CCFILES): Add copy-relocs.cc.
12766 (HFILES): Add copy-relocs.h.
12768 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12770 * testsuite/script_test_4.sh: Permit leading zeroes.
12772 2008-04-15 Ian Lance Taylor <iant@google.com>
12774 * script-sections.cc (Script_sections::create_segments): Use
12775 header_size_adjustment even when there is enough room for the
12777 * testsuite/script_test_4.sh: New file.
12778 * testsuite/script_test_4.t: New file.
12779 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12780 (check_DATA): Add script_test_4.stdout.
12781 (MOSTLYCLEANFILES): Likewise.
12782 (script_test_4): New target.
12783 (script_test_4.stdout): New target.
12784 * testsuite/Makefile.in: Rebuild.
12786 * sparc.cc: Add definitions for Output_data_plt_sparc class
12789 2008-04-14 David S. Miller <davem@davemloft.net>
12791 * sparc.cc: New file.
12792 * Makefile.am (TARGETSOURCES): Add sparc.cc
12793 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12794 * configure.tgt: Document targ_extra_size and
12795 targ_extra_big_endian. Add entries for sparc-* and
12797 * configure.ac: Handle targ_extra_size and
12798 targ_extra_big_endian.
12799 * Makefile.in: Rebuild.
12800 * configure: Likewise.
12801 * po/POTFILES.in: Likewise.
12802 * po/gold.pot: Likewise.
12804 2008-04-14 Ian Lance Taylor <iant@google.com>
12806 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12807 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12808 in the name/type/flags to section mapping. Don't call
12809 allocate_output_section.
12810 (Layout::choose_output_section): Change parameter from adjust_name
12811 to is_input_section. Don't permit input sections after sections
12812 are attached to segments. Don't call allocate_output_section.
12813 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12814 not write_enable_output_section.
12815 (Layout::make_output_section): Don't push to
12816 unattached_section_list_ nor call attach_to_segment. Call
12817 attach_section_to_segment if sections are attached.
12818 (Layout::attach_sections_to_segments): New function.
12819 (Layout::attach_section_to_segment): New function.
12820 (Layout::attach_allocated_section_to_segment): Rename from
12821 attach_to_segment. Remove flags parameter.
12822 (Layout::allocate_output_section): Remove function.
12823 (Layout::write_enable_output_section): Remove function.
12824 * layout.h (class Layout): Update for above changes. Add new
12825 field sections_are_attached_.
12826 * output.h (Output_section::update_flags_for_input_section): New
12828 * output.cc (Output_section::add_input_section): Call
12829 update_flags_for_input_section.
12830 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12832 2008-04-11 Cary Coutant <ccoutant@google.com>
12834 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12835 thought unnecessary.
12836 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12838 2008-04-11 Ian Lance Taylor <iant@google.com>
12840 * output.h (class Output_section_data): Remove inline definition
12842 * output.cc (Output_section_data::set_addralign): New function.
12844 2008-04-11 Cary Coutant <ccoutant@google.com>
12846 Add support for TLS descriptors for i386 and x86_64.
12847 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12848 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12849 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12851 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12852 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12853 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12855 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12856 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12857 Fix problem with initial-exec relocations.
12858 (Target_i386::Relocate::relocate_tls): Likewise.
12859 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12861 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12862 support for section-plus-offset dynamic table entries.
12863 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12864 (Output_data_dynamic::Dynamic_entry): Add support for
12865 section-plus-offset dynamic table entries.
12866 (Output_data_dynamic::Classification): Likewise.
12867 (Output_data_dynamic::classification_): Renamed offset_.
12868 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12869 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12870 (Target_x86_64::make_plt_section): New function.
12871 (Target_x86_64::reserve_tlsdesc_entries): New function.
12872 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12873 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12874 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12875 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12876 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12877 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12878 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12879 add extra PLT entry for TLS descriptors.
12880 (Output_data_plt_x86_64::got_): New field.
12881 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12882 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12884 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12886 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12887 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12888 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12889 R_386_TLS_DESC_CALL relocations.
12890 (Target_x86_64::Scan::global): Likewise.
12891 (Target_x86_64::do_finalize_sections): Add dynamic table entries
12892 for TLS descriptors.
12893 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12894 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12895 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12896 GD-to-IE relaxation.
12897 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12898 and TLS_DESCRIPTORS.
12899 * Makefile.in: Rebuild.
12900 * configure: Rebuild.
12901 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12902 (tls_test_shared2.so): New target.
12903 (tls_shared_gd_to_ie_test_SOURCES): New variable.
12904 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12905 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12906 (tls_shared_gd_to_ie_test_LDADD): New variable.
12907 (tls_shared_gnu2_gd_to_ie_test): New target.
12908 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12910 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12911 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12912 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12913 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12914 (tls_shared_gnu2_test): New target.
12915 (tls_test_gnu2_shared.so): New target.
12916 (tls_shared_gnu2_test_SOURCES): New variable.
12917 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12918 (tls_shared_gnu2_test_LDFLAGS): New variable.
12919 (tls_shared_gnu2_test_LDADD): New variable.
12920 * testsuite/Makefile.in: Rebuild.
12921 * testsuite/Makefile.
12923 2008-04-11 Ian Lance Taylor <iant@google.com>
12925 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12927 * testsuite/Makefile.in: Rebuild.
12929 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12931 * testsuite/script_test_2.cc (main): Adjust test.
12933 2008-04-11 David S. Miller <davem@davemloft.net>
12934 Ian Lance Taylor <iant@google.com>
12936 * options.h (General_options): Add entries for '-Y' and
12938 * options.cc (General_options:finalize): If -Y was used, add those
12939 entries to the library path instead of the default "/lib" and
12942 2008-04-11 David S. Miller <davem@davemloft.net>
12944 * testsuite/justsyms.t: Start at 0x100.
12945 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12946 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12948 * testsuite/script_test_2.cc: Adjust string and section length
12951 2008-04-09 Ian Lance Taylor <iant@google.com>
12954 * script-sections.cc (Sections_element::allocate_to_segment): Add
12956 (Output_section_definition::allocate_to_segment): Likewise.
12957 (Orphan_output_section::allocate_to_segment): Likewise.
12958 (Script_sections::attach_sections_using_phdrs_clause): Don't
12959 propagate non-PT_LOAD segments to orphan sections.
12960 * testsuite/Makefile.am (script_test_3.stdout): Generate using
12961 readelf rather than objdump.
12962 * testsuite/script_test_3.sh: Adjust accordingly. Test that
12963 .interp section and PT_INTERP segment are the same size.
12964 * testsuite/Makefile.in: Rebuild.
12966 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12967 aliases for symbols defined in the same object.
12968 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12969 (weak_alias_test_SOURCES): New variable.
12970 (weak_alias_test_DEPENDENCIES): New variable.
12971 (weak_alias_test_LDFLAGS): New variable.
12972 (weak_alias_test_LDADD): New variable.
12973 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12974 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12975 (weak_alias_test_3.o): New target.
12976 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12977 * testsuite/weak_alias_test_main.cc: New file.
12978 * testsuite/weak_alias_test_1.cc: New file.
12979 * testsuite/weak_alias_test_2.cc: New file.
12980 * testsuite/weak_alias_test_3.cc: New file.
12982 2008-04-08 Ian Lance Taylor <iant@google.com>
12984 * options.h (class General_options): Add --noinhibit-exec option.
12985 * main.cc (main): Check --noinhibit-exec.
12987 * options.h (class General_options): Define --wrap as a special
12988 option. Add wrap_symbols_ field.
12989 (General_options::any_wrap_symbols): New function.
12990 (General_options::is_wrap_symbol): New function.
12991 * options.cc (General_options::parse_wrap): New function.
12992 (General_options::General_options): Initialize wrap_symbols_.
12993 * symtab.cc (Symbol_table::wrap_symbol): New function.
12994 (Symbol_table::add_from_object): Handle --wrap.
12995 * symtab.h (class Symbol_table): Declare wrap_symbol.
12996 * target.h (Target::wrap_char): New function.
12997 (Target::Target_info): Add wrap_char field.
12998 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12999 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13000 * testsuite/testfile.cc (Target_test::test_target_info):
13003 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13006 * layout.h (class Layout): Add added_eh_frame_data_ field.
13007 * layout.cc (Layout::Layout): Initialize new field.
13008 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13009 output section until we find a section we merged successfully.
13010 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13011 that the size be non-zero.
13013 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13016 2008-04-08 Craig Silverstein <csilvers@google.com>
13018 * configure.ac: Export new conditional variable HAVE_ZLIB.
13019 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13021 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13022 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13024 2008-04-07 Ian Lance Taylor <iant@google.com>
13026 * version.cc (version_string): Set to "1.5".
13028 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13029 Add issued_non_pic_error_ field. Declare check_non_pic.
13030 (Target_x86_64::Scan::check_non_pic): New function.
13031 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13032 (Target_x86_64::Scan::global): Likewise.
13034 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13035 addend parameter. Change caller. Handle merge sections.
13036 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13037 Address to Addend. Don't add in the result of
13038 local_section_offset, pass down the addend and use the returned
13040 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13041 Update declarations of local_section_offset and symbol_value.
13042 * testsuite/two_file_test_1.cc (t18): New function.
13043 * testsuite/two_file_test_2.cc (f18): New function.
13044 * testsuite/two_file_test_main.cc (main): Call t18.
13045 * testsuite/two_file_test.h (t18, f18): Declare.
13047 * configure.ac: Don't test for objdump, c++filt, or readelf.
13048 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13050 (TEST_READELF): New variable.
13051 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13052 (check_PROGRAMS): Add two_file_strip_test.
13053 (two_file_strip_test): New target.
13054 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13055 (two_file_same_shared_strip_test_SOURCES): New variable.
13056 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13057 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13058 (two_file_same_shared_strip_test_LDADD): New variable.
13059 (two_file_shared_strip.so): New target.
13060 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13061 (ver_test_5.syms, ver_test_7.syms): Likewise.
13062 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13063 (strip_test_3.stdout): Use TEST_OBJDUMP.
13064 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13066 2008-04-04 Cary Coutant <ccoutant@google.com>
13068 * symtab.h (Symbol::is_weak_undefined): New function.
13069 (Symbol::is_strong_undefined): New function.
13070 (Symbol::is_absolute): New function.
13071 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13072 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13074 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13075 (weak_undef_test): New target.
13076 * testsuite/Makefile.in: Rebuild.
13077 * testsuite/weak_undef_file1.cc: New file.
13078 * testsuite/weak_undef_file2.cc: New file.
13079 * testsuite/weak_undef_test.cc: New file.
13081 2008-04-03 Craig Silverstein <csilvers@google.com>
13083 * compressed_output.h (class Output_compressed_section): Use
13085 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13087 (zlib_compressed_suffix): Removed.
13088 (Output_compressed_section::set_final_data_size): Use unsigned
13090 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13091 Fix linker invocation.
13092 (flagstest_o_specialfile_and_compress_debug_sections):
13094 * testsuite/Makefile.in: Regenerated.
13096 2008-04-02 David S. Miller <davem@davemloft.net>
13098 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13099 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13101 2008-04-02 Craig Silverstein <csilvers@google.com>
13105 2008-04-02 Ian Lance Taylor <iant@google.com>
13107 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13108 parameters. Update for new key type to views_. Change all
13110 (File_read::read): Adjust for byteshift in returned view.
13111 (File_read::add_view): New function, broken out of
13112 find_and_make_view.
13113 (File_read::make_view): New function, broken out of
13114 find_and_make_view.
13115 (File_read::find_or_make_view): Add offset and aligned
13116 parameters. Rewrite accordingly. Change all callers.
13117 (File_read::get_view): Add offset and aligned parameters. Adjust
13118 for byteshift in return value.
13119 (File_read::get_lasting_view): Likewise.
13120 * fileread.h (class File_read): Update declarations.
13121 (class File_read::View): Add byteshift_ field. Add byteshift to
13122 constructor. Add byteshift method.
13123 * archive.h (Archive::clear_uncached_views): New function.
13124 (Archive::get_view): Add aligned parameter. Change all callers.
13125 * object.h (Object::get_view): Add aligned parameter. Change all
13127 (Object::get_lasting_view): Likewise.
13129 * fileread.cc (File_read::release): Don't call clear_views if
13130 there are multiple objects.
13131 * fileread.h (File_read::clear_uncached_views): New function.
13132 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13135 2008-03-31 Cary Coutant <ccoutant@google.com>
13137 Add thin archive support.
13138 * archive.cc (Archive::armagt): New const.
13139 (Archive::setup): Remove task parameter and calls to unlock.
13140 (Archive::unlock_nested_archives): New function.
13141 (Archive::read_header): Add nested_off parameter. Change
13143 (Archive::interpret_header): Likewise.
13144 (Archive::include_all_members): Change to handle thin
13146 (Archive::include_member): Likewise.
13147 * archive.h (Archive::Archive): Add new parameters and
13149 (Archive::armagt): New const.
13150 (Archive::setup): Remove task parameter.
13151 (Archive::unlock_nested_archives): New function.
13152 (Archive::read_header): Add nested_off parameter.
13153 (Archive::interpret_header): Likewise.
13154 (Archive::Nested_archive_table): New typedef.
13155 (Archive::is_thin_archive_): New field.
13156 (Archive::nested_archives_): New field.
13157 (Archive::options_): New field.
13158 (Archive::dirpath_): New field.
13159 (Archive::task_): New field.
13160 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13161 for thin archives. Pass additional parameters to
13162 Archive::Archive. Unlock the archive file after calling
13165 2008-03-29 Ian Lance Taylor <iant@google.com>
13167 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13168 version symbol to be local.
13169 * testsuite/ver_test_4.sh: New file.
13170 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13171 (check_DATA): Add ver_test_4.syms.
13172 (ver_test_4.syms): New target.
13173 * testsuite/Makefile.in: Rebuild.
13176 (Output_section::Input_section_sort_entry::has_priority): New
13178 (Output_section::Input_section_sort_entry::match_file_name): New
13180 (Output_section::Input_section_sort_entry::match_section_name):
13182 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13184 (Output_section::Input_section_sort_entry::match_section_file):
13186 (Output_section::Input_section_sort_compare::operator()): Rewrite
13187 using new Input_section_sort_entry functions. Sort crtbegin and
13188 crtend first. Sort sections with no priority before sections with
13190 * testsuite/initpri1.c (d3): Check j != 4.
13191 (cd5): New constructor/destructor function.
13192 (main): Check j != 2.
13194 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13195 new symbol when resolving, don't call set_is_default.
13196 * testsuite/ver_test_7.cc: New file.
13197 * testsuite/ver_test_7.sh: New file.
13198 * testsuite/Makefile.am (ver_test_7.so): New target.
13199 (ver_test_7.o): New target.
13200 (check_SCRIPTS): Add ver_test_7.sh.
13201 (check_DATA): Add ver_test_7.syms.
13202 (ver_test_7.syms): New target.
13204 2008-03-28 Ian Lance Taylor <iant@google.com>
13206 * layout.cc (Layout::layout): If we see an input section with a
13207 name that needs sorting, set the must_sort flag for the output
13209 (Layout::make_output_section): If the name of the output section
13210 indicates that it might require sorting, set the may_sort flag.
13211 * output.h (Output_section::may_sort_attached_input_sections): New
13213 (Output_section::set_may_sort_attached_input_sections): New
13215 (Output_section::must_sort_attached_input_sections): New
13217 (Output_section::set_must_sort_attached_input_sections): New
13219 (class Output_section): Declare Input_section_sort_entry. Define
13220 Input_section_sort_compare. Declare
13221 sort_attached_input_sections. Add new fields:
13222 may_sort_attached_input_sections_,
13223 must_sort_attached_input_sections_,
13224 attached_input_sections_are_sorted_.
13225 * output.cc (Output_section::Output_section): Initialize new
13227 (Output_section::add_input_section): Add an entry to
13228 input_sections_ if may_sort or must_sort are true.
13229 (Output_section::set_final_data_size): Call
13230 sort_attached_input_sections if necessary.
13231 (Output_section::Input_section_sort_entry): Define new class.
13232 (Output_section::Input_section_sort_compare::operator()): New
13234 (Output_section::sort_attached_input_sections): New function.
13235 * configure.ac: Check whether the compiler supports constructor
13236 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13237 * testsuite/initpri1.c: New file.
13238 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13239 CONSTRUCTOR_PRIORITY.
13240 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13241 (initpri1_LDFLAGS): New variable.
13242 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13244 2008-03-27 Ian Lance Taylor <iant@google.com>
13246 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13247 * testsuite/common_test_1.c: New file.
13248 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13249 (common_test_1_SOURCES): New variable.
13250 (common_test_1_DEPENDENCIES): New variable.
13251 (common_test_1_LDFLAGS): New variable.
13253 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13254 and commons_ correctly when NAME/VERSION does not override
13256 * testsuite/ver_test_6.c: New file.
13257 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13258 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13259 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13261 2008-03-26 Ian Lance Taylor <iant@google.com>
13263 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13264 of an undefined symbol from a version script.
13265 * testsuite/Makefile.am (ver_test_5.so): New target.
13266 (ver_test_5.o): New target.
13267 (check_SCRIPTS): Add ver_test_5.sh.
13268 (check_DATA): Add ver_test_5.syms.
13269 (ver_test_5.syms): New target.
13270 * testsuite/ver_test_5.cc: New file.
13271 * testsuite/ver_test_5.script: New file.
13272 * testsuite/ver_test_5.sh: New file.
13273 * Makefile.in, testsuite/Makefile.in: Rebuild.
13276 Fix problems building gold with gcc 4.3.0.
13277 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13278 (gold_error_at_location, gold_warning_at_location): Use it.
13279 * configure.ac: Check whether we can compile and use a template
13280 function with a printf attribute.
13281 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13282 when jumping over bytes.
13283 * object.cc: Instantiate Object::read_section_data.
13284 * debug.h: Include <cstring>
13285 * dwarf_reader.cc: Include <algorithm>
13286 * main.cc: Include <cstring>.
13287 * options.cc: Include <cstring>.
13288 * output.cc: Include <cstring>.
13289 * script.cc: Include <cstring>.
13290 * script.h: Include <string>.
13291 * symtab.cc: Include <cstring> and <algorithm>.
13292 * target-select.cc: Include <cstring>.
13293 * version.cc: Include <string>.
13294 * testsuite/testmain.cc: Include <cstdlib>.
13295 * configure, config.in: Rebuild.
13297 2008-03-25 Ian Lance Taylor <iant@google.com>
13299 * options.cc: Include "../bfd/bfdver.h".
13300 (options::help): Print bug reporting address.
13302 * version.cc (print_version): Adjust output for current value of
13303 BFD_VERSION_STRING.
13307 * options.cc (options::help): Print list of supported targets.
13308 * target-select.h: Include <vector>.
13309 (class Target_selector): Make machine_, size_, and is_big_endian_
13310 fields const. Add bfd_name_ and instantiated_target_ fields.
13311 (Target_selector::Target_selector): Add bfd_name parameter.
13312 (Target_selector::recognize): Make non-virtual, call
13314 (Target_selector::recognize_by_name): Make non-virtual, call
13315 do_recognize_by_name.
13316 (Target_selector::supported_names): New function.
13317 (Target_selector::bfd_name): New function.
13318 (Target_selector::do_instantiate_target): New pure virtual
13320 (Target_selector::do_recognize): New virtual function.
13321 (Target_selector::do_recognize_by_name): New virtual function.
13322 (Target_selector::instantiate_target): New private function.
13323 (supported_target_names): Declare.
13324 * target-select.cc (Target_selector::Target_selector): Update for
13325 new parameter and fields.
13326 (select_target_by_name): Check that the name matches before
13327 calling recognize_by_name.
13328 (supported_target_names): New function.
13329 * i386.cc (class Target_selector_i386): Update Target_selector
13330 constructor call. Remove recognize and recognize_by_name. Add
13331 do_instantiate_target.
13332 * x86_64.cc (class Target_selector_x86_64): Likewise.
13333 * testsuite/testfile.cc (class Target_selector_test): Update for
13334 changes to Target_selector.
13336 * README: Rewrite, with some notes on unsupported features.
13338 2008-03-24 Cary Coutant <ccoutant@google.com>
13340 * i386.cc (Target_i386::Got_type): New enum declaration.
13341 (Target_i386::Scan::local): Updated callers of Output_data_got
13343 (Target_i386::Scan::global): Likewise.
13344 (Target_i386::Relocate::relocate): Likewise.
13345 (Target_i386::Relocate::relocate_tls): Likewise.
13346 * object.h (Got_offset_list): New class.
13347 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13348 (Sized_relobj::local_got_offset): Likewise.
13349 (Sized_relobj::set_local_got_offset): Likewise.
13350 (Sized_relobj::local_has_tls_got_offset): Removed.
13351 (Sized_relobj::local_tls_got_offset): Removed.
13352 (Sized_relobj::set_local_tls_got_offset): Removed.
13353 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13354 * output.cc (Output_data_got::add_global): Added got_type parameter.
13355 (Output_data_got::add_global_with_rel): Likewise.
13356 (Output_data_got::add_global_with_rela): Likewise.
13357 (Output_data_got::add_global_pair_with_rel): New function.
13358 (Output_data_got::add_global_pair_with_rela): New function.
13359 (Output_data_got::add_local): Added got_type parameter.
13360 (Output_data_got::add_local_with_rel): Likewise.
13361 (Output_data_got::add_local_with_rela): Likewise.
13362 (Output_data_got::add_local_pair_with_rel): New function.
13363 (Output_data_got::add_local_pair_with_rela): New function.
13364 (Output_data_got::add_global_tls): Removed.
13365 (Output_data_got::add_global_tls_with_rel): Removed.
13366 (Output_data_got::add_global_tls_with_rela): Removed.
13367 (Output_data_got::add_local_tls): Removed.
13368 (Output_data_got::add_local_tls_with_rel): Removed.
13369 (Output_data_got::add_local_tls_with_rela): Removed.
13370 * output.h (Output_data_got::add_global): Added got_type parameter.
13371 (Output_data_got::add_global_with_rel): Likewise.
13372 (Output_data_got::add_global_with_rela): Likewise.
13373 (Output_data_got::add_global_pair_with_rel): New function.
13374 (Output_data_got::add_global_pair_with_rela): New function.
13375 (Output_data_got::add_local): Added got_type parameter.
13376 (Output_data_got::add_local_with_rel): Likewise.
13377 (Output_data_got::add_local_with_rela): Likewise.
13378 (Output_data_got::add_local_pair_with_rel): New function.
13379 (Output_data_got::add_local_pair_with_rela): New function.
13380 (Output_data_got::add_global_tls): Removed.
13381 (Output_data_got::add_global_tls_with_rel): Removed.
13382 (Output_data_got::add_global_tls_with_rela): Removed.
13383 (Output_data_got::add_local_tls): Removed.
13384 (Output_data_got::add_local_tls_with_rel): Removed.
13385 (Output_data_got::add_local_tls_with_rela): Removed.
13386 * resolve.cc (Symbol::override_base_with_special): Removed
13387 reference to has_got_offset_ field.
13388 * symtab.cc (Symbol::init_fields): Replaced initialization
13389 of got_offset_ with got_offsets_. Removed initialization
13391 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13392 (Symbol::got_offset): Likewise.
13393 (Symbol::set_got_offset): Likewise.
13394 (Symbol::has_tls_got_offset): Removed.
13395 (Symbol::tls_got_offset): Removed.
13396 (Symbol::set_tls_got_offset): Removed.
13397 (Symbol::got_offset_): Removed.
13398 (Symbol::tls_mod_got_offset_): Removed.
13399 (Symbol::tls_pair_got_offset_): Removed.
13400 (Symbol::got_offsets_): New field.
13401 (Symbol::has_got_offset): Removed.
13402 (Symbol::has_tls_mod_got_offset): Removed.
13403 (Symbol::has_tls_pair_got_offset): Removed.
13404 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13405 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13407 (Target_x86_64::Scan::global): Likewise.
13408 (Target_x86_64::Relocate::relocate): Likewise.
13409 (Target_x86_64::Relocate::relocate_tls): Likewise.
13411 2008-03-25 Ben Elliston <bje@au.ibm.com>
13413 * yyscript.y: Fix spelling error in comment.
13415 2008-03-24 Ian Lance Taylor <iant@google.com>
13417 * options.h (class General_options): Define build_id option.
13418 * layout.h (class Layout): Declare write_build_id, create_note,
13419 create_build_id. Add build_id_note_ member.
13420 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13421 "libiberty.h", "md5.h", "sha1.h".
13422 (Layout::Layout): Initialize eh_frame_data_,
13423 eh_frame_hdr_section_, and build_id_note_.
13424 (Layout::finalize): Call create_build_id.
13425 (Layout::create_note): New function, broken out of
13426 Layout::create_gold_note.
13427 (Layout::create_gold_note): Call create_note.
13428 (Layout::create_build_id): New function.
13429 (Layout::write_build_id): New function.
13430 (Close_task_runner::run): Call write_build_id.
13432 * x86_64.cc: Correct license to GPLv3.
13434 2008-03-23 Ian Lance Taylor <iant@google.com>
13436 * options.cc: Include "demangle.h".
13437 (parse_optional_string): New function.
13438 (parse_long_option): Handle takes_optional_argument.
13439 (parse_short_option): Update dash_z initializer. Handle
13440 takes_optional_argument.
13441 (General_options::General_options): Initialize do_demangle_.
13442 (General_options::finalize): Set do_demangle_. Handle demangling
13444 * options.h (parse_optional_string): Declare.
13445 (struct One_option): Add optional_arg field. Update constructor.
13446 Update call constructor calls. Add takes_optional_argument
13448 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13449 (DEFINE_optional_string): Define.
13450 (General_options::demangle): Change from DEFINE_bool to
13451 DEFINE_optional_string.
13452 (General_options::no_demangle): New function.
13453 (General_options::do_demangle): New function.
13454 (General_options::set_do_demangle): New function.
13455 (General_options::execstack_status_): Move definition to end of
13457 (General_options::static_): Likewise.
13458 (General_options::do_demangle_): New field.
13459 * object.cc (big_endian>::get_symbol_location_info): Call
13460 Options::do_demangle, not Options::demangle.
13461 * symtab.cc (demangle): Likewise.
13463 2008-03-22 Ian Lance Taylor <iant@google.com>
13465 * gold.h: Include <cstddef> and <sys/types.h>
13466 * options.h: Include <cstring>.
13468 2008-03-21 Ian Lance Taylor <iant@google.com>
13470 * Added source code to GNU binutils.