1 2012-09-05 Alan Modra <amodra@gmail.com>
3 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4 * configure: Regenerate.
5 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
6 (plugin_final_layout.stdout): Likewise.
7 (memory_test): Set page sizes to 0x1000.
8 * testsuite/Makefile.in: Regenerate.
9 * testsuite/discard_locals_test.sh: Add FIXME comment.
10 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
11 * testsuite/pr14265.t: Add .got output section statement.
12 * testsuite/script_test_2.t: Likewise.
13 * testsuite/script_test_3.t: Likewise.
14 * testsuite/script_test_4.t: Likewise.
15 * testsuite/script_test_5.t: Likewise.
16 * testsuite/script_test_6.t: Likewise.
17 * testsuite/script_test_7.t: Likewise.
18 * testsuite/script_test_9.t: Likewise.
20 2012-09-05 Alan Modra <amodra@gmail.com>
22 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
23 (Powerpc_relocate_functions::Status): New typedef.
24 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
25 (Target_powerpc::Scan::local): Handle REL64.
26 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
28 (Target_powerpc::symval_for_branch): New function, extracted from..
29 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
30 checks. Report overflow errors.
32 2012-09-05 Alan Modra <amodra@gmail.com>
34 * object.h (Sized_relobj_file::emit_relocs): Delete.
35 (Sized_relobj_file::emit_relocs_reltype): Delete.
36 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
37 relocate_relocs for --emit-relocs.
38 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
39 * output.h: Update comment.
40 (Output_segment::first_section): New function.
41 (Output_segment::first_section_load_address): Use first_section.
42 * output.cc (Output_segment::first_section): New function extracted..
43 (Output_segment::first_section_load_address): ..from here. Delete.
44 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
45 * target.h (Sized_target::relocate_for_relocatable): Likewise.
46 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
47 adjust call to target.h function.
48 * i386.cc (Target_i386): Likewise.
49 * sparc.cc (Target_sparc): Likewise.
50 * x86_64.cc (Target_x86_64): Likewise.
51 * powerpc.cc (Target_powerpc): Likewise.
52 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
53 first tls section has section symbol for optimised local dynamic
55 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
56 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
58 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
59 Rename to relocate_relocs. Update error message.
61 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
63 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
66 2012-08-31 Alan Modra <amodra@gmail.com>
68 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
69 (Powerpc_relobj::toc_base_offset): New stub function.
70 (Target_powerpc): Add tp_offset, dtp_offset. Rename
71 got_mod_index_offset to tlsld_got_offset. Update all refs.
72 (Target_powerpc::Relocate::enum skip_tls): New.
73 (Target_powerpc::call_tls_get_addr_): New var.
74 (Target_powerpc::is_branch_reloc): Move to file scope.
75 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
76 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
78 (Target_powerpc::enum Got_type): Delete old values, add new ones.
79 (powerpc_info): Correct common_pagesize for ppc64.
80 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
81 (Powerpc_relocate_functions): Add overflow check enums and functions.
82 Add non-shift version of rela, rela_ua. Delete all rel public
83 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
84 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
85 addr16_ha3, addr14 functions.
86 (Output_data_got_powerpc::add_constant_pair): New function.
87 (Output_data_got_powerpc::got_base_offset): Likewise.
88 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
89 (instruction constants): Sort, add some more.
90 (Output_data_glink::do_write): Add and use Address typedef. Use
91 object->toc_base_offset() stub for 64-bit.
92 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
93 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
94 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
95 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
96 Always treat .opd relocs as against locally defined symbol.
97 Correct condition for RELATIVE relocs.
98 (Target_powerpc::do_finalize_sections): Test for NULL sections.
99 (Target_powerpc::Relocate::relocate): Use plt call stub as value
100 for 32-bit syms with a plt entry. Correct ppc64 toc base
101 calculations. Handle TLS relocs, and more. Add overflow
102 checking and adjust for Powerpc_relocate_functions changes.
103 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
104 Reinstate --emit-relocs code with FIXME.
106 2012-08-30 Alan Modra <amodra@gmail.com>
108 * layout.cc (Layout::set_segment_offsets): Set p_align to
109 abi_pagesize, not common_pagesize.
110 (Layout::relaxation_loop_body): Similarly use abi_pagesize
111 to determine whether file header can go in segment.
113 2012-08-30 Alan Modra <amodra@gmail.com>
115 * output.h (Output_reloc::Output_reloc <output section>): Add
116 is_relative param. Adjust calls.
117 (Output_reloc::add_output_section_relative): New functions.
118 * output.cc (Output_reloc::Output_reloc <output section>): Handle
120 (Output_reloc::symbol_value): Handle SECTION_CODE.
122 2012-08-24 Sriraman Tallam <tmsriram@google.com>
124 * gold.cc (queue_middle_tasks): Call layout again when unique
125 segments for sections is desired.
126 * layout.cc (Layout::Layout): Initialize new members.
127 (Layout::get_output_section_flags): New function.
128 (Layout::choose_output_section): Call get_output_section_flags.
129 (Layout::layout): Make output section for mapping to a unique segment.
130 (Layout::insert_section_segment_map): New function.
131 (Layout::attach_allocated_section_to_segment): Make unique segment for
132 output sections marked so.
133 (Layout::segment_precedes): Check for unique segments when sorting.
134 * layout.h (Layout::Unique_segment_info): New struct.
135 (Layout::Section_segment_map): New typedef.
136 (Layout::insert_section_segment_map): New function.
137 (Layout::get_output_section_flags): New function.
138 (Layout::is_unique_segment_for_sections_specified): New function.
139 (Layout::set_unique_segment_for_sections_specified): New function.
140 (Layout::unique_segment_for_sections_specified_): New member.
141 (Layout::section_segment_map_): New member.
142 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
143 Rename is_gc_pass_one to is_pass_one.
144 Rename is_gc_pass_two to is_pass_two.
145 Rename is_gc_or_icf to is_two_pass.
146 Check for which pass based on whether symbols data is present.
147 Make it two pass when unique segments for sections is desired.
148 * output.cc (Output_section::Output_section): Initialize new
150 * output.h (Output_section::is_unique_segment): New function.
151 (Output_section::set_is_unique_segment): New function.
152 (Output_section::is_unique_segment_): New member.
153 (Output_section::extra_segment_flags): New function.
154 (Output_section::set_extra_segment_flags): New function.
155 (Output_section::extra_segment_flags_): New member.
156 (Output_section::segment_alignment): New function.
157 (Output_section::set_segment_alignment): New function.
158 (Output_section::segment_alignment_): New member.
159 (Output_segment::Output_segment): Initialize is_unique_segment_.
160 (Output_segment::is_unique_segment): New function.
161 (Output_segment::set_is_unique_segment): New function.
162 (Output_segment::is_unique_segment_): New member.
163 * plugin.cc (allow_unique_segment_for_sections): New function.
164 (unique_segment_for_sections): New function.
165 (Plugin::load): Add new functions to transfer vector.
166 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
167 * Makefile.in: Regenerate.
168 * testsuite/plugin_final_layout.sh: Check if unique segment
170 * testsuite/plugin_section_order.c (onload): Check if new interfaces
172 (allow_unique_segment_for_sections): New global.
173 (unique_segment_for_sections): New global.
174 (claim_file_hook): Call allow_unique_segment_for_sections.
175 (all_symbols_read_hook): Call unique_segment_for_sections.
177 2012-08-22 Cary Coutant <ccoutant@google.com>
179 * layout.cc (Layout::include_section): Don't assert on GROUP
180 sections with --emit-relocs.
182 2012-08-21 Cary Coutant <ccoutant@google.com>
184 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
185 if --export-dynamic-symbol names an undef symbol.
187 2012-08-18 Alan Modra <amodra@gmail.com>
189 * powerpc.cc: Formatting and white space.
190 (Powerpc_relobj): Rename got2_section_ to special_.
191 Add opd_ent_shndx_ and opd_ent_off_ vectors.
192 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
193 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
194 (Target_powerpc): Add Address typedef and invalid_address. Use
196 (Target_powerpc::is_branch_reloc): New function.
197 (Powerpc_relocate_functions): Add Address typedef, use throughout.
198 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
199 for dst_mask, value and addend.
200 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
201 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
202 (Output_data_glink::do_write): Correct toc base. Don't try to use
203 uint16_t for 24-bit offset. Use get_output_section_offset and
205 (Target_powerpc::Scan::local): Handle more relocs.
206 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
207 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
208 Plug in toc restoring insn after plt calls. Translate branches
209 to function descriptor symbols to corresponding entry point.
210 (Target_powerpc::relocate_for_relocatable): Check return from
211 get_output_section_offset.
212 * symtab.h: Comment typo.
214 2012-08-14 Ian Lance Taylor <iant@google.com>
216 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
217 unsupported_relocal_local to call unsupported_reloc_global.
219 2012-08-14 Nick Clifton <nickc@redhat.com>
222 * script-sections.cc (Sections_element::output_section_name): Add
223 keep return parameter.
224 (Output_section_element::match_name): Add keep return parameter.
225 Return the value of the keep_ member.
226 * script-sections.h (class Output_section): Update
227 output_section_name prototype.
228 * layout.cc (Layout::keep_input_section): New public member
230 (Layout::choose_output_section): Pass keep parameter to
232 * layout.h (class Layout): Add keep_input_section.
233 * object.cc (Sized_relobj_file::do_layout): Check for kept input
235 * testsuite/Makefile.am: Add a test.
236 * testsuite/Makefile.in: Regenerate.
237 * testsuite/pr14265.c: Source file for the test.
238 * testsuite/pr14265.t: Linker script for the test.
239 * testsuite/pr14265.sh: Shell script for the test.
241 2012-08-14 Alan Modra <amodra@gmail.com>
243 * target.h (Target::output_section_name): New function.
244 (Target::do_output_section_name): New function.
245 * layout.cc (Layout::choose_output_section): Call the above.
246 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
248 2012-08-14 Alan Modra <amodra@gmail.com>
250 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
251 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
252 for replace_constant call.
253 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
254 (Output_data_glink::do_print_to_mapfile): New function.
255 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
256 (Target_powerpc::Relocate::relocate): Likewise.
258 2012-08-14 Alan Modra <amodra@gmail.com>
260 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
261 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
262 (Output_data_glink::add_entry,find_entry): Remove shndx param.
263 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
264 all references to shndx_. Handle special case for R_PPC_PLTREL24
266 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
267 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
268 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
270 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
271 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
273 2012-08-12 Alan Modra <amodra@gmail.com>
275 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
276 (glink insn constants): Use uint32_t.
277 (Output_data_glink::add_entry): Use insert, not [] operator.
279 2012-08-11 Alan Modra <amodra@gmail.com>
281 * object.h (Sized_relobj_file::find_shdr): New function.
282 (Sized_relobj_file::find_special_sections): New function.
283 * object.cc (Sized_relobj_file::find_shdr): New function.
284 (Sized_relobj_file::find_eh_frame): Use find_shdr.
285 (Sized_relobj_file::find_special_sections): New function, split out..
286 (Sized_relobj_file::do_read_symbols): ..from here.
287 * output.h (Output_data_got::replace_constant): New function.
288 (Output_data_got::num_entries): New function.
289 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
290 (Output_data_got::got_offset): Protected rather than private.
291 (Output_data_got::replace_got_entry): New function.
292 * output.cc (Output_data_got::replace_got_entry): New function.
293 * powerpc.cc (class Powerpc_relobj): New.
294 (class Powerpc_relocate_functions): Delete all psymval variants or
295 convert to value,addend type. Delete pcrela, pcrela_unaligned.
296 Implement _ha functions using corresponding _hi function.
297 (Powerpc_relobj::find_special_sections): New function.
298 (Target_powerpc::do_make_elf_object): New function.
299 (class Output_data_got_powerpc): New.
300 (class Output_data_glink): New.
301 (class Powerpc_scan_relocatable_reloc): New.
302 Many more changes througout file.
304 2012-08-09 Nick Clifton <nickc@redhat.com>
306 * po/vi.po: Updated Vietnamese translation.
308 2012-08-07 Ian Lance Taylor <iant@google.com>
310 * layout.cc (Layout::add_target_dynamic_tags): If
311 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
314 2012-07-30 Nick Clifton <nickc@redhat.com>
316 * po/gold.pot: Updated template.
317 * po/es.po: Updated Spanish translation.
319 2012-07-18 Cary Coutant <ccoutant@google.com>
322 * configure.ac: Add check for -gpubnames support.
323 * configure: Regenerate.
324 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
325 support; force -gno-pubnames.
326 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
328 (gdb_index_test_4): New test.
329 * testsuite/Makefile.in: Regenerate.
330 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
331 * testsuite/gdb_index_test_2.sh: Likewise.
332 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
333 * testsuite/gdb_index_test_4.sh: New script.
334 * testsuite/gdb_index_test_comm.sh: New script with common code;
335 don't look for space after colon.
337 2012-07-16 Sriraman Tallam <tmsriram@google.com>
339 * gold.cc (queue_middle_tasks): Update function order only after
340 deferred objects due to plugins are processed.
342 2012-07-11 Ian Lance Taylor <iant@google.com>
344 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
345 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
346 (Target_arm::scan_reloc_for_stub): Likewise.
347 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
348 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
349 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
350 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
351 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
353 2012-07-10 Dodji Seketeli <dodji@redhat.com>
354 Ian Lance Taylor <iant@google.com>
357 * configure.ac: Test whether std::tr1::hash<off_t> works.
358 * gold.h: Add a specialization for std::tr1::hash<off_t> if
360 * output.h (class Output_fill): Add virtual destructor.
361 * configure, config.in: Rebuild.
363 2012-06-22 Roland McGrath <mcgrathr@google.com>
365 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
367 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
369 * plugin.cc (Plugin::load): Handle position independent executables.
371 2012-06-06 Cary Coutant <ccoutant@google.com>
373 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
375 (lines_only_debug_sections): Likewise.
376 (gdb_fast_lookup_sections): New static array.
377 (is_gdb_debug_section): Rename formal parameter.
378 (is_lines_only_debug_section): Likewise.
379 (is_gdb_fast_lookup_section): New function.
380 (Layout::include_section): Check for ".zdebug_" prefix; pass
381 section name suffix to is_gdb_debug_section, et al.; check for
382 fast-lookup sections when building .gdb_index.
383 * options.h (--strip-debug-gdb): Update GDB version number.
385 2012-06-06 Cary Coutant <ccoutant@google.com>
387 * configure.ac: Add check for fallocate.
388 * configure: Regenerate.
389 * config.in: Regenerate.
391 * options.h (class General_options): Add --mmap-output-file and
392 --posix-fallocate options.
393 * output.cc: (posix_fallocate): Remove; replace with...
394 (gold_fallocate): New function.
395 (Output_file::map_no_anonymous): Call gold_fallocate.
396 (Output_file::map): Check --mmap-output-file option.
398 2012-06-05 Jing Yu <jingyu@google.com>
400 * gold.h (textdomain): Add do {} to empty while(0).
401 (bindtextdomain): Likewise.
403 2012-06-04 Cary Coutant <ccoutant@google.com>
405 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
408 2012-05-25 Sriraman Tallam <tmsriram@google.com>
410 * symtab.cc (Symbol_table::define_special_symbol):
411 Initialize *poldsym to prevent uninitialized variable errors.
413 2012-05-23 Cary Coutant <ccoutant@google.com>
415 * layout.cc (Layout::section_name_mapping): Add rules to handle
416 exact match on .data.rel.ro.local or .data.rel.ro.
417 (Layout::output_section_name): Check for exact matches.
419 2012-05-23 Cary Coutant <ccoutant@google.com>
421 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
424 2012-05-22 Cary Coutant <ccoutant@google.com>
426 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
427 object before exporting symbol.
429 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
431 * testsuite/tls_test.cc: Include "config.h" first.
432 * testsuite/tls_test_c.c: Likewise.
434 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
435 Nick Clifton <nickc@redhat.com>
438 * configure.in: Add check that sysdep.h has been included before
439 any system header files.
440 * configure: Regenerate.
441 * config.in: Regenerate.
443 2012-05-14 Cary Coutant <ccoutant@google.com>
445 * layout.cc (Layout::make_output_section): Mark .tdata section
447 * testsuite/relro_test.cc: Add a TLS variable.
449 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
452 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
453 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
456 2012-05-08 Cary Coutant <ccoutant@google.com>
458 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
459 (lines_only_debug_sections): Likewise.
461 2012-05-02 Roland McGrath <mcgrathr@google.com>
465 * Makefile.am (CCFILES, HFILES): Add them.
466 * Makefile.in: Regenerate.
467 * i386.cc (Output_data_plt_i386_nacl): New class.
468 (Output_data_plt_i386_nacl_exec): New class.
469 (Output_data_plt_i386_nacl_dyn): New class.
470 (Target_i386_nacl): New class.
471 (Target_selector_i386_nacl): New class.
472 (target_selector_i386): Use it instead of Target_selector_i386.
473 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
474 (Target_x86_64_nacl): New class.
475 (Target_selector_x86_64_nacl): New class.
476 (target_selector_x86_64, target_selector_x32): Use it instead of
477 Target_selector_x86_64.
478 * arm.cc (Output_data_plt_arm_nacl): New class.
479 (Target_arm_nacl): New class.
480 (Target_selector_arm_nacl): New class.
481 (target_selector_arm, target_selector_armbe): Use it instead of
484 * target-select.cc (select_target): Take new Input_file* and off_t
485 arguments, pass them on to recognize method of selector.
486 * object.cc (make_elf_sized_object): Update caller.
487 * parameters.cc (parameters_force_valid_target): Likewise.
488 * incremental.cc (make_sized_incremental_binary): Likewise.
489 * target-select.h: Update decl.
490 (Target_selector::recognize): Take new Input_file* argument,
491 pass it on to do_recognize.
492 (Target_selector::do_recognize): Take new Input_file* argument.
493 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
494 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
495 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
496 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
498 * target.h (Target::Target_info): New members isolate_execinstr
500 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
501 * arm.cc (Target_arm::arm_info): Update initializer.
502 * i386.cc (Target_i386::i386_info): Likewise.
503 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
504 * sparc.cc (Target_sparc::sparc_info): Likewise.
505 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
506 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
507 * layout.cc (Layout::attach_allocated_section_to_segment):
508 Take new const Target* argument. If target->isolate_execinstr(), act
510 (Layout::find_first_load_seg): Take new const Target* argument;
511 if target->isolate_execinstr(), reject PF_X segments.
512 (Layout::relaxation_loop_body): Update caller.
513 (Layout::set_segment_offsets): If target->isolate_execinstr(),
514 reset file offset to zero when we hit LOAD_SEG, and then do a second
515 loop over the segments before LOAD_SEG to reassign offsets after
516 addresses have been determined. Handle target->rosegment_gap().
517 (Layout::attach_section_to_segment): Take new const Target* argument;
518 pass it to attach_allocated_section_to_segment.
519 (Layout::make_output_section): Update caller.
520 (Layout::attach_sections_to_segments): Take new const Target* argument;
521 pass it to attach_section_to_segment.
522 * gold.cc (queue_middle_tasks): Update caller.
523 * layout.h (Layout): Update method decls with new arguments.
525 * arm.cc (Target_arm::Target_arm): Take optional argument for the
526 Target_info pointer to use.
527 (Target_arm::do_make_data_plt): New virtual method.
528 (Target_arm::make_data_plt): New method that calls it.
529 (Target_arm::make_plt_entry): Use it.
530 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
531 for the section alignment.
532 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
534 (Output_data_plt_arm::first_plt_entry_offset): Call it.
535 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
537 (Output_data_plt_arm::get_plt_entry_size): Call it.
538 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
539 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
540 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
542 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
543 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
544 method instead of sizeof(plt_entry).
545 (Output_data_plt_arm::add_entry): Likewise.
546 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
547 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
549 (Target_arm::plt_entry_size): Likewise.
550 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
552 (Output_data_plt_arm_standard): ... here, new class.
553 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
554 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
555 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
557 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
558 Take additional argument for the PLT entry size.
559 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
560 Use get_plt_entry_size method rather than plt_entry_size variable.
561 (Output_data_plt_x86_64::reserve_slot): Likewise.
562 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
563 (Output_data_plt_x86_64::add_entry): Likewise.
564 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
565 (Output_data_plt_x86_64::address_for_global): Likewise.
566 (Output_data_plt_x86_64::address_for_local): Likewise.
567 (Output_data_plt_x86_64::set_final_data_size): Likewise.
568 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
569 Make method non-static.
570 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
572 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
573 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
574 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
575 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
577 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
578 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
580 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
581 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
583 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
584 (Output_data_plt_x86_64::plt_entry_size)
585 (Output_data_plt_x86_64::first_plt_entry)
586 (Output_data_plt_x86_64::plt_entry)
587 (Output_data_plt_x86_64::tlsdesc_plt_entry)
588 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
589 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
590 (Output_data_plt_x86_64_standard): ... here, new class.
591 (Target_x86_64::Target_x86_64): Take optional argument for the
592 Target_info pointer to use.
593 (Target_x86_64::do_make_data_plt): New virtual method.
594 (Target_x86_64::make_data_plt): New method to call it.
595 (Target_x86_64::init_got_plt_for_update): Use that.
596 Call this->plt_->add_eh_frame method here.
597 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
598 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
599 rather than static method.
600 (Target_x86_64::plt_entry_size): Likewise.
601 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
602 rather than plt_entry_size variable. Move guts of PLT filling to...
603 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
604 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
605 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
607 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
608 additional argument for the section alignment.
609 Don't do add_eh_frame_for_plt here.
610 (Output_data_plt_i386::first_plt_entry_offset): Make the method
611 non-static. Use get_plt_entry_size method rather than plt_entry_size
613 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
615 (Output_data_plt_i386::get_plt_entry_size): Call it.
616 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
617 (Output_data_plt_i386::add_eh_frame): New method to call it.
618 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
620 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
621 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
623 (Output_data_plt_i386::fill_plt_entry): New method to call it.
624 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
625 method instead of plt_entry_size.
626 (Output_data_plt_i386::plt_entry_size)
627 (Output_data_plt_i386::plt_eh_frame_fde_size)
628 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
629 (Output_data_plt_i386_standard): ... here, new class.
630 (Output_data_plt_i386_exec): New class.
631 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
632 (Output_data_plt_i386_exec::first_plt_entry): ... here.
633 (Output_data_plt_i386::exec_plt_entry): Move to ...
634 (Output_data_plt_i386_exec::plt_entry): ... here.
635 (Output_data_plt_i386_dyn): New class.
636 (Output_data_plt_i386::first_plt_entry): Move to ...
637 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
638 (Output_data_plt_i386::dyn_plt_entry): Move to ...
639 (Output_data_plt_i386_dyn::plt_entry): ... here.
640 (Target_i386::Target_i386): Take optional argument for the Target_info
642 (Target_i386::do_make_data_plt): New virtual method.
643 (Target_i386::make_data_plt): New method to call it.
644 (Target_i386::make_plt_section): Use that.
645 Call this->plt_->add_eh_frame method here.
646 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
647 rather than plt_entry_size variable.
648 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
649 (Output_data_plt_i386::address_for_local): Likewise.
650 (Output_data_plt_i386::do_write): Likewise.
651 Move guts of PLT filling to...
652 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
653 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
654 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
655 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
657 2012-05-01 Cary Coutant <ccoutant@google.com>
659 * dwarf_reader.cc (Dwarf_die::read_attributes)
660 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
661 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
662 * reduced_debug_output.cc
663 (Output_reduced_debug_info_section::get_die_end): Remove
664 DW_FORM_GNU_ref_index. Add default case.
666 2012-04-26 Mark Wielaard <mjw@redhat.com>
668 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
669 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
670 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
671 DW_AT_high_pc as offset from DW_AT_low_pc.
673 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
674 * testsuite/Makefile.in: Regenerate.
675 * testsuite/gdb_index_test_3.c: New test source file.
676 * testsuite/gdb_index_test_3.sh: New test source file.
678 2012-04-25 Ian Lance Taylor <iant@google.com>
680 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
682 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
683 as a class, not a struct.
684 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
685 (Target_arm::apply_cortex_a8_workaround): Likewise.
686 * gc.h: Declare Reloc_types as a struct, not a class.
687 * object.h: Declare Symbols_data as a struct.
688 * reloc.h: Declare Read_relocs_data as a struct.
689 * target.h: Declare Relocate_info as a struct.
691 2012-04-24 David S. Miller <davem@davemloft.net>
693 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
694 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
697 2012-04-24 Cary Coutant <ccoutant@google.com>
699 * incremental-dump.cc (find_input_containing_global): Replace
700 magic number with symbolic constant.
701 (dump_incremental_inputs): Update version number.
702 * incremental.cc (Output_section_incremental_inputs): Update version
703 number; import symbolic constants from Incremental_inputs_reader.
704 (Incremental_inputs::create_data_sections): Align relocations
705 section correctly for 64-bit targets.
706 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
707 constants; add padding.
708 (Output_section_incremental_inputs::write_header): Add assert for
710 (Output_section_incremental_inputs::write_input_files): Add assert
711 for input_entry_size.
712 (Output_section_incremental_inputs::write_info_blocks): Add padding;
713 add assert for object_info_size, input_section_entry_size,
714 global_sym_entry_size.
715 * incremental.h (Incremental_inputs_reader): Add symbolic constants
716 for data structure sizes; use them.
717 (Incremental_input_entry_reader): Import symbolic constants from
718 Incremental_inputs_reader; use them.
720 2012-04-23 David S. Miller <davem@davemloft.net>
722 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
724 (Target_sparc::Target_sparc): Initialize new fields.
725 (Target_sparc::do_make_elf_object): New function.
726 (Target_sparc::do_adjust_elf_header): New function.
728 2012-04-23 Cary Coutant <ccoutant@google.com>
730 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
731 CU range table of gdb index.
733 2012-04-20 David S. Miller <davem@davemloft.net>
735 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
738 2012-04-16 David S. Miller <davem@davemloft.net>
740 * sparc.cc (Target_sparc::got_address): New function.
741 (Sparc_relocate_functions::gdop_hix22): New function.
742 (Sparc_relocate_functions::gdop_lox10): New function.
743 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
745 (Target_sparc::Scan::local): Likewise if the global symbol is not
746 preemptible and is not IFUNC.
747 (Target_sparc::Relocate::relocate): Perform GOTDATA code
748 transformations for local and non-preemptible non-IFUNC global
751 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
752 writing out 64-bit part of ranges.
754 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
755 -fpic and -fpie respectively.
756 * Makefile.in: Regenerate.
758 * sparc.cc (class Target_sparc): Add rela_ifunc_.
759 (Target_sparc::Target_sparc): Initialize new field.
760 (Target_sparc::do_plt_section_for_global): New function.
761 (Target_sparc::do_plt_section_for_local): New function.
762 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
763 (Target_sparc::make_plt_section): New function, broken out of
764 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
765 (Target_sparc::make_plt_entry): Call make_plt_section.
766 (Target_sparc::make_local_ifunc_plt_entry): New function.
767 (Target_sparc::rela_ifunc_section): New function.
768 (Target_sparc::plt_section): Remove const.
769 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
770 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
771 and ifunc_count_ fields.
772 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
773 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
774 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
775 (Output_data_plt_sparc::rela_ifunc): New function.
776 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
777 (Output_data_plt_sparc::has_ifunc_section): New function.
778 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
779 (Output_data_plt_sparc::address_for_global): New function.
780 (Output_data_plt_sparc::address_for_local): New function.
781 (Output_data_plt_sparc::plt_index_to_offset): New function.
782 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
784 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
786 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
787 R_SPARC_JMP_IREL to switch.
788 (Target_sparc::Scan::check_non_pic): Likewise.
789 (Target_sparc::Scan::local): Handle IFUNC symbols.
790 (Target_sparc::Scan::local): Likewise.
791 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
792 and plt_address_for_local.
793 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
794 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
796 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
797 (class Output_data_reloc): Adjust calls to Output_reloc_type.
798 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
799 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
801 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
802 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
804 * sparc.cc (Target_sparc::Scan::global): Likewise.
805 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
807 2012-04-16 Cary Coutant <ccoutant@google.com>
809 * archive.cc (Library_base::should_include_member): Check for
810 --export-dynamic-symbol.
811 * options.h (class General_options): Add --export-dynamic-symbol.
812 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
813 --export-dynamic-symbol.
814 (Symbol_table::gc_mark_undef_symbols): Likewise.
815 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
817 2012-04-12 David S. Miller <davem@davemloft.net>
819 * sparc.cc (Reloc::wdisp10): New relocation method.
820 (Reloc::h34): Likewise.
821 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
822 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
824 (Target_sparc::Scan::local): Likewise.
825 (Target_sparc::Scan::global): Likewise.
826 (Target_sparc::Relocate::relocate): Likewise.
828 2012-04-09 Cary Coutant <ccoutant@google.com>
830 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
833 2012-04-06 Ian Lance Taylor <iant@google.com>
835 * timer.cc: #include <unistd.h>.
837 2012-04-06 Roland McGrath <mcgrathr@google.com>
839 * configure.in (AC_CHECK_HEADERS): Add locale.h.
840 * config.in: Regenerate.
841 * configure: Regenerate.
843 2012-04-05 Nick Clifton <nickc@redhat.com>
845 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
846 (AM_LC_MESSAGES): Add.
847 * aclocal.m4: Regenerate.
848 * config.in: Regenerate.
849 * configure: Regenerate.
851 2012-03-21 Cary Coutant <ccoutant@google.com>
853 * Makefile.am: Add gdb-index.cc, gdb-index.h.
854 * Makefile.in: Regenerate.
855 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
856 (Sized_elf_reloc_mapper::symbol_section): New function.
857 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
858 (make_elf_reloc_mapper): New function.
859 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
860 (Dwarf_abbrev_table::do_read_abbrevs): New function.
861 (Dwarf_abbrev_table::do_get_abbrev): New function.
862 (Dwarf_ranges_table::read_ranges_table): New function.
863 (Dwarf_ranges_table::read_range_list): New function.
864 (Dwarf_pubnames_table::read_section): New function.
865 (Dwarf_pubnames_table::read_header): New function.
866 (Dwarf_pubnames_table::next_name): New function.
867 (Dwarf_die::Dwarf_die): New function.
868 (Dwarf_die::read_attributes): New function.
869 (Dwarf_die::skip_attributes): New function.
870 (Dwarf_die::set_name): New function.
871 (Dwarf_die::set_linkage_name): New function.
872 (Dwarf_die::attribute): New function.
873 (Dwarf_die::string_attribute): New function.
874 (Dwarf_die::int_attribute): New function.
875 (Dwarf_die::uint_attribute): New function.
876 (Dwarf_die::ref_attribute): New function.
877 (Dwarf_die::child_offset): New function.
878 (Dwarf_die::sibling_offset): New function.
879 (Dwarf_info_reader::check_buffer): New function.
880 (Dwarf_info_reader::parse): New function.
881 (Dwarf_info_reader::do_parse): New function.
882 (Dwarf_info_reader::do_read_string_table): New function.
883 (Dwarf_info_reader::lookup_reloc): New function.
884 (Dwarf_info_reader::get_string): New function.
885 (Dwarf_info_reader::visit_compilation_unit): New function.
886 (Dwarf_info_reader::visit_type_unit): New function.
887 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
888 Sized_elf_reloc_mapper.
889 (Sized_dwarf_line_info::symbol_section): Remove function.
890 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
891 (Sized_dwarf_line_info::read_line_mappings): Remove object
892 parameter, adjust callers.
893 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
894 * dwarf_reader.h: Include <sys/types.h>.
895 (class Track_relocs): Remove forward declaration.
896 (class Elf_reloc_mapper): New class.
897 (class Sized_elf_reloc_mapper): New class.
898 (class Dwarf_abbrev_table): New class.
899 (class Dwarf_range_list): New class.
900 (class Dwarf_ranges_table): New class.
901 (class Dwarf_pubnames_table): New class.
902 (class Dwarf_die): New class.
903 (class Dwarf_info_reader): New class.
904 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
905 (Sized_dwarf_line_info::symbol_section): Remove member function.
906 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
908 * gdb-index.cc: New source file.
909 * gdb-index.h: New source file.
910 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
911 and .debug_types sections, call Layout::add_to_gdb_index.
912 (Sized_relobj_incr::do_section_name): Implement.
913 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
914 return type; Implement.
915 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
917 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
918 parameter list and return type.
919 (Sized_incr_dynobj::do_section_contents): Likewise.
920 * layout.cc: Include gdb-index.h.
921 (Layout::Layout): Initialize gdb_index_data_.
922 (Layout::init_fixed_output_section): Check for .gdb_index section.
923 (Layout::add_to_gdb_index): New function. Instantiate.
924 * layout.h: Add forward declaration for class Gdb_index.
925 (Layout::add_to_gdb_index): New member function.
926 (Layout::gdb_index_data_): New data member.
927 * main.cc: Include gdb-index.h.
928 (main): Print statistics for gdb index.
929 * object.cc (Object::section_contents): Move code into
931 (need_decompressed_section): Check for sections needed when building
933 (build_compressed_section_map): Likewise.
934 (Sized_relobj_file::do_read_symbols): Need local symbols when building
936 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
937 sections; call Layout::add_to_gdb_index.
938 (Sized_relobj_file::do_decompressed_section_contents): Call
939 do_section_contents directly.
940 * object.h (Object::do_section_contents): Adjust parameter list and
942 (Object::do_decompressed_section_contents): Call do_section_contents
944 (Sized_relobj_file::do_section_contents): Adjust parameter list and
946 * options.h (class General_options): Add --gdb-index option.
947 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
948 list and return type.
949 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
950 * reloc.h (Track_relocs::checkpoint): New function.
951 (Track_relocs::reset): New function.
953 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
955 * testsuite/Makefile.in: Regenerate.
956 * testsuite/gdb_index_test.cc: New test source file.
957 * testsuite/gdb_index_test_1.sh: New test source file.
958 * testsuite/gdb_index_test_2.sh: New test source file.
960 2012-03-19 Doug Kwan <dougkwan@google.com>
962 * arm.cc (Target_arm::do_define_standard_symbols): New method.
963 (Target_arm::do_finalize_sections): Remove code which defines
964 __exidx_start and __exidx_end. Make symbol table parameter
965 anonymous as it is not used.
966 * gold.cc (queue_middle_tasks): Call target hook to define any
967 target-specific symbols.
968 * target.h (Target::define_standard_symbols): New method.
969 (Target::do_define_standard_symbols): Same.
970 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
971 * testsuite/Makefile.in: Regenerate.
972 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
974 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
975 relocations are generated for __exidx_start and __exidx_end.
977 2012-03-16 Doug Kwan <dougkwan@google.com>
979 * testsuite/Makefile.am: Disable test initpri3b.
980 * testsuite/Makefile.in: Regenerate.
982 2012-03-15 Doug Kwan <dougkwan@google.com>
984 * arm.cc (Target_arm::got_section): Make .got section read-only
987 2012-03-15 Ian Lance Taylor <iant@google.com>
990 * layout.cc (Layout::make_output_section): Correctly mark
991 SHT_INIT_ARRAY, et. al., as relro.
993 2012-03-14 Doug Kwan <dougkwan@google.com>
995 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
996 dynamic relocations for protected symbols in shared objects.
998 2012-03-13 Ian Lance Taylor <iant@google.com>
1000 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1001 keep the larger alignment.
1003 2012-03-12 Cary Coutant <ccoutant@google.com>
1005 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1006 handling of DW_LNE_define_file.
1008 2012-03-12 Cary Coutant <ccoutant@google.com>
1010 * reduced_debug_output.cc
1011 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1014 2012-02-29 Cary Coutant <ccoutant@google.com>
1016 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1018 2012-02-29 Cary Coutant <ccoutant@google.com>
1020 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1021 Call Object::decompressed_section_contents.
1022 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1024 (Sized_dwarf_line_info::buffer_start_): New data member.
1025 * merge.cc (Output_merge_data::do_add_input_section): Call
1026 Object::decompressed_section_contents.
1027 (Output_merge_string::do_add_input_section): Likewise.
1028 * object.cc (need_decompressed_section): New function.
1029 (build_compressed_section_map): Decompress sections needed later.
1030 (Sized_relobj_file::do_decompressed_section_contents): New function.
1031 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1032 * object.h (Object::decompressed_section_contents): New function.
1033 (Object::discard_decompressed_sections): New function.
1034 (Object::do_decompressed_section_contents): New function.
1035 (Object::do_discard_decompressed_sections): New function.
1036 (Compressed_section_info): New type.
1037 (Compressed_section_map): Include decompressed section contents.
1038 (Sized_relobj_file::do_decompressed_section_contents): New function.
1039 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1041 2012-02-16 Cary Coutant <ccoutant@google.com>
1043 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1044 * testsuite/Makefile.in: Regenerate.
1046 2012-02-14 Cary Coutant <ccoutant@google.com>
1048 * options.cc (General_options::finalize): Disallow -pie and -static.
1050 2012-02-03 Doug Kwan <dougkwan@google.com>
1052 * arm.cc (Arm_relocate_functions::abs8,
1053 Arm_relocate_functions::abs16): Use
1054 Bits::has_signed_unsigned_overflow32.
1055 (Arm_relocate_functions::thm_abs8): Correct range of
1057 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1060 2012-02-02 Doug Kwan <dougkwan@google.com>
1062 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1063 position independent outputs, not just shared objects.
1065 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1067 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1068 * configure: Regenerated.
1070 2012-01-27 Ian Lance Taylor <iant@google.com>
1072 * reloc.h (Bits): New class with static functions, copied from
1073 namespace utils in arm.cc.
1074 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1077 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1079 * incremental.cc (write_info_blocks): Correct relocation offset.
1081 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1083 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1084 (Relocate::tls_gd_to_le): Likewise.
1086 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1088 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1090 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1092 * configure.ac: Check if -mcmodel=medium works.
1093 * configure: Regenerated.
1095 2012-01-24 Cary Coutant <ccoutant@google.com>
1097 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1099 (read_unsigned_LEB_128_x): ... this new function.
1100 (read_signed_LEB_128): Replaced with inline definition and ...
1101 (read_signed_LEB_128_x): ... this new function.
1102 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1103 (read_unsigned_LEB_128): Add inline definition.
1104 (read_signed_LEB_128_x): New function.
1105 (read_signed_LEB_128): Add inline definition.
1106 * testsuite/Makefile.am (leb128_unittest): New unit test.
1107 * testsuite/Makefile.in: Regenerate.
1108 * testsuite/leb128_unittest.cc: New unit test.
1110 2012-01-23 Ian Lance Taylor <iant@google.com>
1113 * i386.cc (Target_i386::do_code_fill): When using a jmp
1114 instruction, pad with nop instructions.
1115 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1117 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1119 * x86_64.cc (gc_process_relocs): Add typename on types used in
1121 (scan_relocs): Likewise.
1122 (relocate_section): Likewise.
1123 (apply_relocation): Likewise.
1125 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1127 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1128 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1131 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1133 * x86_64.cc: Initial support for x32.
1135 2012-01-03 Cary Coutant <ccoutant@google.com>
1137 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1138 Use abstract base class for GOT.
1139 * gold/output.h (class Output_data_got_base): New abstract base class.
1140 (class Output_data_got): Derive from new base class, adjust ctors.
1141 (Output_data_got::reserve_slot): Make virtual; rename to
1142 do_reserve_slot; Adjust callers.
1143 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1144 pointer to abstract base class.
1145 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1147 2011-12-18 Ian Lance Taylor <iant@google.com>
1149 * object.h (Relobj::local_symbol_value): New function.
1150 (Relobj::local_plt_offset): New function.
1151 (Relobj::local_has_got_offset): New function.
1152 (Relobj::local_got_offset): New function.
1153 (Relobj::set_local_got_offset): New function.
1154 (Relobj::do_local_symbol_value): New pure virtual function.
1155 (Relobj::do_local_plt_offset): Likewise.
1156 (Relobj::do_local_has_got_offset): Likewise.
1157 (Relobj::do_local_got_offset): Likewise.
1158 (Relobj::do_set_local_got_offset): Likewise.
1159 (Sized_relobj::do_local_has_got_offset): Rename from
1160 local_has_got_offset.
1161 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1162 (Sized_relobj::do_set_local_got_offset): Rename from
1163 set_local_got_offset.
1164 (Sized_relobj_file::do_local_plt_offset): Rename from
1166 (Sized_relobj_file::do_local_symbol_value): New function.
1167 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1169 * output.cc (Output_data_got::Got_entry::write): Change object to
1170 Relobj. Use local_symbol_value.
1171 (Output_data_got::add_global_with_rel): Change rel_dyn to
1172 Output_data_reloc_generic*. Use add_global_generic.
1173 (Output_data_got::add_global_with_rela): Remove. Change all
1174 callers to use add_global_with_rel.
1175 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1176 Output_data_reloc_generic*. Use add_global_generic.
1177 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1178 callers to use add_global_pair_with_rel.
1179 (Output_data_got::add_local): Change object to Relobj*.
1180 (Output_data_got::add_local_plt): Likewise.
1181 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1182 change rel_dyn to Output_data_reloc_generic*. Use
1184 (Output_data_got::add_local_with_rela): Remove. Change all
1185 callers to use all_local_with_rel.
1186 (Output_data_got::add_local_pair_with_rel): Change object to
1187 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1188 add_output_section_generic.
1189 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1190 callers to use add_local_pair_with_rel.
1191 (Output_data_got::reserve_local): Change object to Relobj*.
1192 * output.h: (class Output_data_reloc_generic): Add pure virtual
1193 declarations for add_global_generic, add_local_generic,
1194 add_output_section_generic.
1195 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1196 functions for Output_data_reloc_generic. Update declarations for
1197 changes listed in output.cc.
1198 (class Output_data_got): Change template parameter to got_size.
1199 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1200 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1202 (Sized_relobj_incr::do_local_plt_offset): New function.
1203 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1206 2011-12-17 Cary Coutant <ccoutant@google.com>
1208 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1209 * resolve.cc (Symbol_table::resolve): Likewise.
1210 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1212 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1214 2011-12-16 Ian Lance Taylor <iant@google.com>
1216 * output.h (Output_data_reloc_generic::add): Only call
1217 add_dynamic_reloc if this is a dynamic reloc section.
1219 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1222 * target-reloc.h (apply_relocation): Replace <64, false> with
1225 2011-11-25 Nick Clifton <nickc@redhat.com>
1227 * po/it.po: New Italian translation.
1229 2011-11-17 Sterling Augustine <saugustine@google.com>
1231 * script.cc (script_include_directive): Implement.
1232 (read_script_file): New local variables name and search_path. Update
1233 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1234 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1235 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1237 2011-11-11 Sterling Augustine <saugustine@google.com>
1239 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1240 (file_or_sections_cmd): Likewise.
1242 2011-11-11 Doug Kwan <dougkwan@google.com>
1244 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1245 if --just-symbols is given.
1247 2011-11-10 Doug Kwan <dougkwan@google.com>
1250 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1251 when processing data relocs.
1252 * reloc.h (Relocate_functions::rel_unaligned): New method.
1253 (Relocate_functions::pcrel_unaligned): Ditto.
1254 (Relocate_functions::rel32_unaligned): Ditto.
1255 (Relocate_functions::pcrel32_unaligned): Ditto.
1257 2011-11-09 Doug Kwan <dougkwan@google.com>
1260 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1261 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1262 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1263 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1264 (Relocate_functions::rel_unaligned): New.
1265 (Relocate_functions::rel32_unaligned): New.
1266 * target-reloc.h (relocate_for_relocatable): Add code to handle
1267 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1268 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1269 arm_unaligned_reloc_r): New targets.
1270 * testsuite/Makefile.in: Regenerate.
1271 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1274 2011-11-02 Ian Lance Taylor <iant@google.com>
1276 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1278 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1279 * options.cc (General_options::finalize): Use library search path
1280 from configure script if specified. If not native and no sysroot,
1281 only search TOOLLIBDIR.
1282 * options.h (Search_directory::Search_directory): Change name to
1284 (General_options::add_to_library_path_with_sysroot): Change arg to
1286 * configure, Makefile.in, config.in: Rebuild.
1288 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1290 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1291 we are working around the ARM1176 Erratum.
1292 * options.h (General_options::fix_arm1176): Add option.
1293 * testsuite/Makefile.am: Add testcases, and keep current ones
1295 * testsuite/Makefile.in: Regenerate.
1296 * testsuite/arm_fix_1176.s: New file.
1297 * testsuite/arm_fix_1176.sh: Likewise.
1299 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1301 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1303 (Target_arm::may_use_blx): Remove method.
1304 (Target_arm::set_may_use_blx): Likewise.
1305 (Target_arm::may_use_v4t_interworking): New method.
1306 (Target_arm::may_use_v5t_interworking): Likewise.
1307 (Target_arm::may_use_blx_): Remove member variable.
1308 (Arm_relocate_functions::arm_branch_common): Check for v5T
1310 (Arm_relocate_functions::thumb_branch_common): Likewise.
1311 (Reloc_stub::stub_type_for_reloc): Likewise.
1312 (Target_arm::do_finalize_sections): Correct interworking checks.
1313 * testsuite/Makefile.am: Add new tests.
1314 * testsuite/Makefile.in: Regenerate.
1315 * testsuite/arm_farcall_arm_arm.s: New test.
1316 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1317 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1318 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1319 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1320 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1321 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1322 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1324 2011-10-31 Cary Coutant <ccoutant@google.com>
1327 * expression.cc (Expression::eval_with_dot): Add
1328 is_section_dot_assignment parameter.
1329 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1330 absolute and assigning to dot within a section.
1331 * script-sections.cc
1332 (Output_section_element_assignment::set_section_addresses): Pass
1333 dot_section to set_if_absolute.
1334 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1335 as is_section_dot_assignment flag to eval_with_dot.
1336 (Output_section_element_dot_assignment::set_section_addresses):
1338 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1339 parameter. Also set value if relative to dot_section; set the
1340 symbol's output_section.
1341 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1342 parameter. Adjust all callers.
1343 (Expression::eval_maybe_dot): Likewise.
1344 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1346 * testsuite/script_test_2.t: Test assignment of an absolute value
1347 to dot within an output section element.
1349 2011-10-31 Cary Coutant <ccoutant@google.com>
1351 * options.h (class General_options): Add --[no-]gnu-unique options.
1352 * symtab.cc (Symbol_table::sized_write_globals): Convert
1353 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1355 2011-10-31 Cary Coutant <ccoutant@google.com>
1358 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1359 unnecessary assertion.
1360 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1362 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1364 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1366 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1368 Change to just keep the section associated with symbol.
1369 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1370 they are externally visible and --export-dynamic is turned on.
1371 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1373 2011-10-19 Ian Lance Taylor <iant@google.com>
1376 * script-sections.cc
1377 (Output_section_element_dot_assignment::needs_output_section): New
1380 2011-10-19 Ian Lance Taylor <iant@google.com>
1383 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1384 --section-start option was seen.
1385 * options.h (General_options::any_section_start): New function.
1387 2011-10-18 David S. Miller <davem@davemloft.net>
1390 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1391 member to track relocation locations that have moved during TLS
1392 reloc optimizations.
1393 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1394 (Target_sparc::Relocate::relocate): Adjust view down by 4
1395 bytes if it matches reloc_adjust_addr_.
1396 (Target_sparc::Relocate::relocate_tls): Always move the
1397 __tls_get_addr call delay slot instruction forward 4 bytes when
1398 performing relaxation.
1400 2011-10-18 Cary Coutant <ccoutant@google.com>
1402 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1403 (Output_file::map_no_anonymous): Check for non-zero
1404 return code from posix_fallocate.
1406 2011-10-17 Cary Coutant <ccoutant@google.com>
1409 * plugin.cc (is_visible_from_outside): Check for symbols
1410 referenced from dynamic objects.
1411 * resolve.cc (Symbol_table::resolve): Don't count references
1412 from dynamic objects as references from real ELF files.
1413 * testsuite/plugin_test_2.sh: Adjust expected result.
1415 2011-10-17 Cary Coutant <ccoutant@google.com>
1417 * gold.cc: Include timer.h.
1418 (queue_middle_tasks): Stamp time.
1419 (queue_final_tasks): Likewise.
1420 * main.cc (main): Store timer in parameters. Print timers
1422 * parameters.cc (Parameters::Parameters): Initialize timer_.
1423 (Parameters::set_timer): New function.
1424 (set_parameters_timer): New function.
1425 * parameters.h (Parameters::set_timer): New function.
1426 (Parameters::timer): New function.
1427 (Parameters::timer_): New data member.
1428 (set_parameters_timer): New function.
1429 * timer.cc (Timer::stamp): New function.
1430 (Timer::get_pass_time): New function.
1431 * timer.h (Timer::stamp): New function.
1432 (Timer::get_pass_time): New function.
1433 (Timer::pass_times_): New data member.
1435 2011-10-17 Cary Coutant <ccoutant@google.com>
1437 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1438 task for members of lib groups.
1440 2011-10-17 Cary Coutant <ccoutant@google.com>
1443 * fileread.cc (File_read::find_view): Add assert.
1444 (File_read::make_view): Move bounds check (replace with assert)...
1445 (File_read::find_or_make_view): ... to here.
1447 2011-10-12 Cary Coutant <ccoutant@google.com>
1449 * output.cc (Output_file::open_base_file): Handle case where
1450 ::read returns less than requested size.
1452 2011-10-10 Cary Coutant <ccoutant@google.com>
1454 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1455 Initialize defined_count_.
1456 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1457 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1458 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1459 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1460 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1461 * incremental.h (Sized_relobj_incr::defined_count_): New data
1463 (Sized_incr_dynobj::defined_count_): New data member.
1464 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1465 Return zeroes instead of internal error.
1467 2011-10-10 Cary Coutant <ccoutant@google.com>
1470 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1471 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1472 * output.h (class Output_reloc): Add use_plt_offset flag.
1473 (Output_reloc::type_): Adjust size of bit field.
1474 (Output_reloc::use_plt_offset_): New bit field.
1475 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1476 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1477 flag. Adjust all callers.
1478 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1479 creating RELATIVE relocations.
1481 2011-10-10 Nick Clifton <nickc@redhat.com>
1483 * po/es.po: Updated Spanish translation.
1484 * po/fi.po: Updated Finnish translation.
1486 2011-10-03 Diego Novillo <dnovillo@google.com>
1488 * options.cc (parse_uint): Fix dereference of RETVAL.
1490 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1492 * layout.h (section_order_map_): New member.
1493 (get_section_order_map): New member function.
1494 * output.cc (Output_section::add_input_section): Check for patterns
1495 only when --section-ordering-file is specified.
1496 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1497 output_sections have been formed.
1498 * layout.cc (Layout_Layout): Initialize section_order_map_.
1499 * plugin.cc (update_section_order): Store order in order_map. Do not
1501 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1502 * testsuite/Makefile.in: Regenerate.
1503 * testsuite/plugin_section_order.c: New file.
1504 * testsuite/plugin_final_layout.cc: New file.
1505 * testsuite/plugin_final_layout.sh: New file.
1507 2011-09-29 Cary Coutant <ccoutant@google.com>
1509 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1511 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1512 symbols during incremental update.
1513 (Symbol_table::add_from_dynobj): Likewise.
1515 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1516 Ian Lance Taylor <iant@google.com>
1518 * symtab.cc (Symbol_table::define_special_symbol): Always
1519 canonicalize version string.
1521 2011-09-26 Cary Coutant <ccoutant@google.com>
1523 * gold.cc (queue_initial_tasks): Move option checks ...
1524 * options.cc (General_options::finalize): ... to here. Disable
1525 some options; make others fatal.
1527 2011-09-26 Cary Coutant <ccoutant@google.com>
1530 * plugin.cc (get_symbols_v2): New function.
1531 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1532 (is_referenced_from_outside): New function.
1533 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1534 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1535 (get_symbols): Pass version parameter.
1536 (get_symbols_v2): New function.
1537 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1539 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1540 (onload): Add LDPT_GET_SYMBOLS_V2.
1541 (all_symbols_read_hook): Use get_symbols_v2; check for
1542 LDPR_PREVAILING_DEF_IRONLY_EXP.
1543 * testsuite/plugin_test_3.sh: Update expected results.
1545 2011-09-23 Simon Baldwin <simonb@google.com>
1547 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1548 configuration options.
1549 * configure: Regenerate.
1550 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1551 * Makefile.in: Regenerate.
1552 * testsuite/Makefile.in: Regenerate.
1554 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1556 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1558 2011-09-19 Cary Coutant <ccoutant@google.com>
1560 * incremental.cc (can_incremental_update): Fix typo in comment.
1561 * incremental.h (can_incremental_update): Likewise.
1563 2011-09-18 Cary Coutant <ccoutant@google.com>
1565 * incremental.cc (can_incremental_update): New function.
1566 * incremental.h (can_incremental_update): New function.
1567 * layout.cc (Layout::init_fixed_output_section): Call it.
1568 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1569 * object.cc (Sized_relobj_file::do_layout): Call
1570 can_incremental_update.
1572 2011-09-13 Cary Coutant <ccoutant@google.com>
1574 * configure.ac: Check for glibc support for gnu_indirect_function
1575 support with static linking, setting automake conditional
1577 * Makefile.in: Regenerate.
1578 * configure: Regenerate.
1580 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1581 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1583 * testsuite/Makefile.in: Regenerate.
1585 2011-09-13 Cary Coutant <ccoutant@google.com>
1587 * incremental.cc (Sized_relobj_incr::do_layout): Call
1588 report_comdat_group for kept comdat sections.
1589 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1590 * testsuite/Makefile.in: Regenerate.
1591 * testsuite/incr_comdat_test_1.cc: New source file.
1592 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1593 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1594 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1596 2011-09-13 Ian Lance Taylor <iant@google.com>
1598 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1599 variable external_symbols_offset.
1601 2011-09-12 Ian Lance Taylor <iant@google.com>
1603 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1604 triggered if object has no symbols.
1606 2011-09-09 David S. Miller <davem@davemloft.net>
1608 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1609 (Output_fill_debug_line::do_write): Likewise.
1611 2011-08-29 Cary Coutant <ccoutant@google.com>
1613 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1614 casts to match formatting specs.
1615 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1617 2011-08-26 Cary Coutant <ccoutant@google.com>
1619 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1620 remaining hole size when allocating.
1621 (Layout::make_output_section): Set fill methods for debug sections.
1622 * layout.h (Free_list::Free_list_node): Move from private to
1624 (Free_list::set_min_hole_size): New function.
1625 (Free_list::begin, Free_list::end): New functions.
1626 (Free_list::min_hole_): New data member.
1627 * output.cc: Include dwarf.h.
1628 (Output_fill_debug_info::do_minimum_hole_size): New function.
1629 (Output_fill_debug_info::do_write): New function.
1630 (Output_fill_debug_line::do_minimum_hole_size): New function.
1631 (Output_fill_debug_line::do_write): New function.
1632 (Output_section::Output_section): Initialize new data member.
1633 (Output_section::set_final_data_size): Ensure patch space is larger
1634 than minimum hole size.
1635 (Output_section::do_write): Fill holes in debug sections.
1636 * output.h (Output_fill): New class.
1637 (Output_fill_debug_info): New class.
1638 (Output_fill_debug_line): New class.
1639 (Output_section::set_free_space_fill): New function.
1640 (Output_section::free_space_fill_): New data member.
1641 * testsuite/Makefile.am (incremental_test_3): Add
1642 --incremental-patch option.
1643 (incremental_test_4): Likewise.
1644 (incremental_test_5): Likewise.
1645 (incremental_test_6): Likewise.
1646 (incremental_copy_test): Likewise.
1647 (incremental_common_test_1): Likewise.
1648 * testsuite/Makefile.in: Regenerate.
1650 2011-08-26 Nick Clifton <nickc@redhat.com>
1652 * po/es.po: Updated Spanish translation.
1654 2011-08-01 Cary Coutant <ccoutant@google.com>
1656 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1657 * gold/testsuite/Makefile.in: Regenerate.
1658 * gold/testsuite/justsyms_exec.c: New source file.
1659 * gold/testsuite/justsyms_lib.c: New source file.
1661 2011-08-01 Cary Coutant <ccoutant@google.com>
1663 * layout.cc (Layout::set_segment_offsets): Don't realign text
1664 segment if -Ttext was specified.
1665 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1667 * object.h (Sized_relobj_file::e_type): New function.
1668 (Sized_relobj_file::e_type_): New data member.
1669 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1670 base address for ET_EXEC files.
1671 * target.cc (Target::do_make_elf_object_implementation): Allow
1672 ET_EXEC files with --just-symbols option.
1674 2011-07-28 Cary Coutant <ccoutant@google.com>
1676 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1677 Add thread_number parameter.
1678 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1679 * workqueue-threads.cc
1680 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1681 current thread if its thread number is greater than desired thread
1683 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1684 Add thread_number parameter.
1685 (Workqueue::should_cancel_thread): Likewise.
1686 (Workqueue::find_runnable_or_wait): Pass thread_number to
1687 should_cancel_thread.
1688 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1691 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1693 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1694 only after checking if it cannot be forced local.
1695 * symtab.h (is_externally_visible): Check if the symbol is not forced
1698 2011-07-15 Ian Lance Taylor <iant@google.com>
1700 * options.h (class General_options): Add --print-output-format.
1701 Move -EL next to -EB, for better --help output.
1702 * target-select.cc: Include <cstdio>, "options.h", and
1704 (Target_selector::do_target_bfd_name): New function.
1705 (print_output_format): New function.
1706 * target-select.h (class Target_selector): Update declarations.
1707 (Target_selector::target_bfd_name): New function.
1708 (print_output_format): Declare.
1709 * main.cc: Include "target-select.h".
1710 (main): Handle --print-output-format.
1711 * gold.cc: Include "target-select.h".
1712 (queue_initial_tasks): Handle --print-output-format when there are
1714 * parameters.cc (parameters_force_valid_target): Give a better
1715 error message if -EB/-EL does not match target.
1716 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1719 2011-07-15 Ian Lance Taylor <iant@google.com>
1721 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1722 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1723 (Output_data_plt_i386::do_write): Write address of .dynamic
1724 section to first entry in .got.plt section.
1725 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1726 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1728 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1729 section to first entry in .got.plt section.
1730 * layout.h (Layout::dynamic_section): New function.
1732 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1734 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1736 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1737 input_section_position_, and input_section_glob_.
1738 (read_layout_from_file): Call function section_ordering_specified.
1739 * layout.h (is_section_ordering_specified): New function.
1740 (section_ordering_specified): New function.
1741 (section_ordering_specified_): New boolean member.
1742 * main.cc(main): Call load_plugins after layout object is defined.
1743 * output.cc (Output_section::add_input_section): Use
1744 function section_ordering_specified to check if section ordering is
1746 * output.cc (Output_section::add_relaxed_input_section): Use
1747 function section_ordering_specified to check if section ordering is
1749 (Output_section::update_section_layout): New function.
1750 (Output_section::sort_attached_input_sections): Check if input section
1752 * output.h (Output_section::update_section_layout): New function.
1753 * plugin.cc (get_section_count): New function.
1754 (get_section_type): New function.
1755 (get_section_name): New function.
1756 (get_section_contents): New function.
1757 (update_section_order): New function.
1758 (allow_section_ordering): New function.
1759 (Plugin::load): Add the new interfaces to the transfer vector.
1760 (Plugin_manager::load_plugins): New parameter.
1761 (Plugin_manager::all_symbols_read): New parameter.
1762 (Plugin_manager::claim_file): New parameter. Save the elf object for
1764 (Plugin_manager::get_elf_object): New function.
1765 (Plugin_manager::get_view): Change to directly use the bool to check
1766 if get_view is called from claim_file_hook.
1767 * plugin.h (input_objects): New function
1768 (Plugin__manager::load_plugins): New parameter.
1769 (Plugin_manager::claim_file): New parameter.
1770 (Plugin_manager::get_elf_object): New function.
1771 (Plugin_manager::in_claim_file_handler): New function.
1772 (Plugin_manager::in_claim_file_handler_): New member.
1773 (layout): New function.
1774 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1775 handler with an extra parameter. Make the elf object before calling
1777 * testsuite/plugin_test.c (get_section_count): New function pointer.
1778 (get_section_type): New function pointer.
1779 (get_section_name): New function pointer.
1780 (get_section_contents): New function pointer.
1781 (update_section_order): New function pointer.
1782 (allow_section_ordering): New function pointer.
1783 (onload): Check if the new interfaces exist.
1785 2011-07-13 Ian Lance Taylor <iant@google.com>
1787 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1789 * x86_64.cc (Target_x86_64::got_section): Likewise.
1790 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1791 (relro_now_test_SOURCES): New variable.
1792 (relro_now_test_DEPENDENCIES): New variable.
1793 (relro_now_test_LDFLAGS): New variable.
1794 (relro_now_test_LDADD): New variable.
1795 (relro_now_test.so): New target.
1796 * testsuite/Makefile.in: Rebuild.
1798 2011-07-12 Ian Lance Taylor <iant@google.com>
1801 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1802 GLOB_DAT relocation rather than a RELATIVE relocation for a
1803 protected symbol when creating a shared library.
1804 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1805 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1806 * testsuite/protected_main_1.cc (main): Test that protected
1807 function has same address.
1809 2011-07-11 Ian Lance Taylor <iant@google.com>
1812 * options.h (class General_options): Add -Bgroup.
1813 * options.cc (General_options::finalize): If -Bgroup is set,
1814 default to --unresolved-symbols=report-all.
1815 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1816 * target-reloc.h (issue_undefined_symbol_error): Handle
1817 --unresolved-symbols=report-all.
1819 2011-07-08 Ian Lance Taylor <iant@google.com>
1822 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1823 if linker script discards key sections.
1824 (Layout::create_dynamic_symtab): Likewise.
1825 (Layout::assign_local_dynsym_offsets): Likewise.
1826 (Layout::sized_create_version_sections): Likewise.
1827 (Layout::create_interp): Likewise.
1828 (Layout::finish_dynamic_section): Likewise.
1829 (Layout::set_dynamic_symbol_size): Likewise.
1831 2011-07-08 Ian Lance Taylor <iant@google.com>
1834 * options.h (class General_options): Add --unresolved-symbols.
1835 * target-reloc.h (issue_undefined_symbol_error): Check
1836 --unresolved-symbols. Add comments.
1838 2011-07-08 Ian Lance Taylor <iant@google.com>
1840 * testsuite/odr_violation2.cc (Ordering::operator()): Make
1841 expression more complex.
1843 2011-07-08 Ian Lance Taylor <iant@google.com>
1846 * target-reloc.h (issue_undefined_symbol_error): New inline
1847 function, broken out of relocate_section.
1848 (relocate_section): Call issue_undefined_symbol_error.
1849 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1850 there is no TLS segment if we are about to issue an undefined
1852 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1854 2011-07-08 Ian Lance Taylor <iant@google.com>
1857 * resolve.cc (Symbol_table::should_override): Add fromtype
1858 parameter. Change all callers. Give error when linking together
1859 TLS and non-TLS symbol.
1860 (Symbol_table::should_override_with_special): Add fromtype
1861 parameter. Change all callers.
1862 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1863 there is no TLS segment if we have reported some errors.
1864 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1866 2011-07-08 Ian Lance Taylor <iant@google.com>
1869 * target.h (Target::plt_address_for_global): New function.
1870 (Target::plt_address_for_local): New function.
1871 (Target::plt_section_for_global): Remove.
1872 (Target::plt_section_for_local): Remove.
1873 (Target::do_plt_address_for_global): New virtual function.
1874 (Target::do_plt_address_for_local): New virtual function.
1875 (Target::do_plt_section_for_global): Remove.
1876 (Target::do_plt_section_for_local): Remove.
1877 (Target::register_global_plt_entry): Add Symbol_table and Layout
1879 * output.cc (Output_data_got::Got_entry::write): Use
1880 plt_address_for_global and plt_address_for_local.
1881 * layout.cc (Layout::add_target_dynamic_tags): Use size and
1882 address of output section.
1883 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1884 got_irelative_, and irelative_count_ fields. Update
1886 (Output_data_plt_i386::has_irelative_section): New function.
1887 (Output_data_plt_i386::entry_count): Add irelative_count_.
1888 (Output_data_plt_i386::set_final_data_size): Likewise.
1889 (class Target_i386): Add got_irelative_ and rel_irelative_
1890 fields. Update declarations.
1891 (Target_i386::Target_i386): Initialize new fields.
1892 (Target_i386::do_plt_address_for_global): New function replacing
1893 do_plt_section_for_global.
1894 (Target_i386::do_plt_address_for_local): New function replacing
1895 do_plt_section_for_local.
1896 (Target_i386::got_section): Create got_irelative_.
1897 (Target_i386::rel_irelative_section): New function.
1898 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1899 fields. Don't define __rel_iplt_{start,end}.
1900 (Output_data_plt_i386::add_entry): Add symtab and layout
1901 parameters. Change all callers. Use different PLT and GOT for
1903 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1904 layout parameters. Change all callers. Use different PLT and
1906 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1907 (Output_data_plt_i386::rel_irelative): New function.
1908 (Output_data_plt_i386::address_for_global): New function.
1909 (Output_data_plt_i386::address_for_local): New function.
1910 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
1911 IRELATIVE GOT when changing IFUNC GOT entries.
1912 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1914 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1915 if we didn't create an IRELATIVE GOT.
1916 (Target_i386::Relocate::relocate): Use plt_address_for_global and
1917 plt_address_for_local.
1918 (Target_i386::do_dynsym_value): Use plt_address_for_global.
1919 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1920 got_irelative_, and irelative_count_ fields. Update
1922 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1923 Initialize new fields. Remove symtab parameter. Change all
1925 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1927 (Output_data_plt_x86_64::has_irelative_section): New function.
1928 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1929 (class Target_x86_64): Add got_irelative_ and rel_irelative_
1930 fields. Update declarations.
1931 (Target_x86_64::Target_x86_64): Initialize new fields.
1932 (Target_x86_64::do_plt_address_for_global): New function replacing
1933 do_plt_section_for_global.
1934 (Target_x86_64::do_plt_address_for_local): New function replacing
1935 do_plt_section_for_local.
1936 (Target_x86_64::got_section): Create got_irelative_.
1937 (Target_x86_64::rela_irelative_section): New function.
1938 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
1939 all callers. Don't create __rel_iplt_{start,end}.
1940 (Output_data_plt_x86_64::add_entry): Add symtab and layout
1941 parameters. Change all callers. Use different PLT and GOT for
1943 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1944 layout parameters. Change all callers. Use different PLT and
1946 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1947 parameters. Change all callers. Use different PLT and GOT for
1949 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1950 (Output_data_plt_x86_64::rela_irelative): New function.
1951 (Output_data_plt_x86_64::address_for_global): New function.
1952 (Output_data_plt_x86_64::address_for_local): New function.
1953 (Output_data_plt_x86_64::set_final_data_size): Likewise.
1954 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1955 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1956 (Target_x86_64::register_global_plt_entry): Add symtab and layout
1958 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1960 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1961 symbols if we didn't create an IRELATIVE GOT.
1962 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1963 plt_address_for_local.
1964 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1965 * testsuite/ifuncvar1.c: New test file.
1966 * testsuite/ifuncvar2.c: New test file.
1967 * testsuite/ifuncvar3.c: New test file.
1968 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1969 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1970 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1971 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1972 * testsuite/Makefile.in: Rebuild.
1974 2011-07-07 Cary Coutant <ccoutant@google.com>
1976 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1977 (two_file_test_1_ndebug.o): Likewise.
1978 (two_file_test_1b_ndebug.o): Likewise.
1979 (two_file_test_2_ndebug.o): Likewise.
1980 (two_file_test_main_ndebug.o): Likewise.
1981 (incremental_test_2): Link with no-debug versions.
1983 2011-07-06 Cary Coutant <ccoutant@google.com>
1985 * gold/incremental.cc
1986 (Output_section_incremental_inputs::write_info_blocks): Check for
1987 hidden and internal symbols.
1989 2011-07-06 Cary Coutant <ccoutant@google.com>
1991 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1992 Check disposition for startup file.
1993 (Incremental_inputs::report_command_line): Ignore
1994 --incremental-startup-unchanged option.
1995 * options.cc (General_options::parse_incremental_startup_unchanged):
1997 (General_options::General_options): Initialize new data member.
1998 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1999 (General_options): Add --incremental-startup-unchanged option.
2000 (General_options::incremental_startup_disposition): New function.
2001 (General_options::incremental_startup_disposition_): New data member.
2003 2011-07-06 Cary Coutant <ccoutant@google.com>
2005 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2006 input file index to Script_info ctor.
2007 (Sized_incremental_binary::do_file_has_changed): Find the
2008 command-line argument for files named in scripts.
2009 * incremental.h (Script_info::Script_info): New ctor
2010 with input file index.
2011 (Script_info::input_file_index): New function.
2012 (Script_info::input_file_index_): New data member.
2013 (Incremental_binary::get_library): Add const.
2014 (Incremental_binary::get_script_info): Add const.
2015 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2016 * testsuite/Makefile.am (incremental_test_5): New test case.
2017 (incremental_test_6): New test case.
2018 * testsuite/Makefile.in: Regenerate.
2020 2011-07-06 Cary Coutant <ccoutant@google.com>
2022 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2023 debug output when command lines differ.
2025 2011-07-06 Cary Coutant <ccoutant@google.com>
2027 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2028 --incremental-patch option.
2029 * layout.cc (Free_list::allocate): Extend allocation beyond original
2031 (Layout::make_output_section): Mark sections that should get
2033 * options.cc (parse_percent): New function.
2034 * options.h (parse_percent): New function.
2035 (DEFINE_percent): New macro.
2036 (General_options): Add --incremental-patch option.
2037 * output.cc (Output_section::Output_section): Initialize new data
2039 (Output_section::add_input_section): Print section name when out
2041 (Output_section::add_output_section_data): Likewise.
2042 (Output_section::set_final_data_size): Add patch space when
2043 doing --incremental-full.
2044 (Output_section::do_reset_address_and_file_offset): Remove patch
2046 (Output_segment::set_section_list_addresses): Print debug output
2047 only if --incremental-update.
2048 * output.h (Output_section::set_is_patch_space_allowed): New function.
2049 (Output_section::is_patch_space_allowed_): New data member.
2050 (Output_section::patch_space_): New data member.
2051 * parameters.cc (Parameters::incremental_full): New function.
2052 * parameters.h (Parameters::incremental_full): New function
2053 * testsuite/Makefile.am (incremental_test_2): Add test for
2054 --incremental-patch option.
2055 * testsuite/Makefile.in: Regenerate.
2056 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2057 (t18): Remove function body.
2059 2011-07-05 Doug Kwan <dougkwan@google.com>
2062 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2063 Arm_Address type for relocation result.
2064 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2066 (Arm_relocate_functions::abs32): Use unaligned access.
2067 (Arm_relocate_functions::rel32): Ditto.
2068 (Arm_relocate_functions::prel31): Ditto.
2069 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2070 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2071 static data relocations.
2072 * testsuite/Makefile.in: Regnerate.
2073 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2075 2011-07-05 Ian Lance Taylor <iant@google.com>
2078 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2079 symbols if necessary.
2080 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2082 2011-07-05 Ian Lance Taylor <iant@google.com>
2085 * resolve.cc (Symbol::override_base_with_special): Simply override
2086 version with special symbol version, ignoring previous version.
2088 2011-07-05 Ian Lance Taylor <iant@google.com>
2090 * object.cc (Sized_relobj_file::include_section_group): Add
2091 information to comment about signature location.
2093 2011-07-02 Ian Lance Taylor <iant@google.com>
2096 * options.h (class General_options): Add -f and -F.
2097 * options.cc (General_options::finalize): Fatal error if -f/-F
2098 are used without -shared.
2099 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2101 2011-07-02 Ian Lance Taylor <iant@google.com>
2103 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2105 2011-07-01 Ian Lance Taylor <iant@google.com>
2109 * resolve.cc (Symbol::override_base_with_special): Don't override
2110 the version if the overriding symbol has a different name.
2111 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2112 all callers. If we give an error about an undefined version,
2113 define the base version if necessary.
2114 * dynobj.h (class Versions): Update declaration.
2115 * testsuite/weak_alias_test_5.cc: New file.
2116 * testsuite/weak_alias_test.script: New file.
2117 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2118 and versioned_alias have the right value, and call t2.
2119 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2120 weak_alias_test_5.so.
2121 (weak_alias_test_LDADD): Likewise.
2122 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2123 * testsuite/Makefile.in: Rebuild.
2125 2011-07-01 Ian Lance Taylor <iant@google.com>
2128 * options.h (class General_options): Support -z notext.
2129 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2131 (two_file_shared_nonpic.so): Likewise.
2132 (two_file_shared_mixed.so): Likewise.
2133 (two_file_shared_mixed_1.so): Likewise.
2134 (weak_undef_lib_nonpic.so): Likewise.
2135 (alt/weak_undef_lib_nonpic.so): Likewise.
2136 (tls_test_shared_nonpic.so): Likewise.
2137 * testsuite/Makefile.in: Rebuild.
2139 2011-07-01 Ian Lance Taylor <iant@google.com>
2142 * configure.ac: Test whether static linking works, setting
2143 the automake conditional HAVE_STATIC.
2144 * testsuite/Makefile.am: Disable tests using -static if
2145 HAVE_STATIC is not true.
2146 * configure, testsuite/Makefile.in: Rebuild.
2148 2011-07-01 Ian Lance Taylor <iant@google.com>
2151 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2152 Assert if we see DW_EH_PE_indirect.
2153 * target.h (Target::ehframe_datarel_base): New function.
2154 (Target::do_ehframe_datarel_base): New target function.
2155 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2156 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2159 2011-07-01 Ian Lance Taylor <iant@google.com>
2162 * options.h (class General_options): Add
2163 --ld-generated-unwind-info.
2164 * ehframe.cc (Fde::write): Add address parameter. Change all
2165 callers. If associated with PLT, fill in address and size.
2166 (Cie::set_output_offset): Only add merge mapping if there is an
2168 (Cie::write): Add address parameter. Change all callers.
2169 (Eh_frame::add_ehframe_for_plt): New function.
2170 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2171 input_offset_ fields into union u_, with new plt field.
2172 (Fde::Fde): Adjust for new union field.
2173 (Fde::Fde) [Output_data version]: New constructor.
2174 (Fde::add_mapping): Only add merge mapping if there is an object.
2175 (class Cie): Update declarations.
2176 (class Eh_frame): Declare add_ehframe_for_plt.
2177 * layout.cc (Layout::layout_eh_frame): Break out code into
2178 make_eh_frame_section, and call it.
2179 (Layout::make_eh_frame_section): New function.
2180 (Layout::add_eh_frame_for_plt): New function.
2181 * layout.h (class Layout): Update declarations.
2182 * merge.cc (Merge_map::add_mapping): Add assertion.
2183 * i386.cc: Include "dwarf.h".
2184 (class Output_data_plt_i386): Make first_plt_entry,
2185 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2186 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2187 and plt_eh_frame_fde.
2188 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2189 boundary. Call add_eh_frame_for_plt if appropriate.
2190 * x86_64.cc: Include "dwarf.h".
2191 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2192 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2193 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2194 and plt_eh_frame_fde.
2195 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2198 2011-06-29 Ian Lance Taylor <iant@google.com>
2201 * object.cc (Sized_relobj_file::layout_section): Change shdr
2202 parameter to be const.
2203 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2205 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2206 appropriate. Call layout_eh_frame_section.
2207 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2209 * object.h (class Sized_relobj_file): Update declarations.
2211 2011-06-29 Ian Lance Taylor <iant@google.com>
2214 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2216 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2218 2011-06-29 Ian Lance Taylor <iant@google.com>
2221 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2223 * layout.cc (Layout::layout_eh_frame): Likewise.
2225 2011-06-29 Ian Lance Taylor <iant@google.com>
2228 * layout.cc (Layout::symtab_section_shndx): New function.
2229 * layout.h (class Layout): Declare symtab_section_shndx.
2230 * output.cc (Output_section::write_header): Call it.
2232 2011-06-29 Ian Lance Taylor <iant@google.com>
2235 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2236 symbols which are not used in a relocation.
2238 2011-06-28 Ian Lance Taylor <iant@google.com>
2241 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2242 script create indistinguishable segments.
2243 (Layout::set_segment_offsets): Use stable_sort when sorting
2244 segments. Pass this to Compare_segments constructor.
2245 * layout.h (class Layout): Make segment_precedes non-static.
2246 (class Compare_segments): Change from struct to class. Add
2247 layout_ field. Add constructor.
2248 * script-sections.cc
2249 (Script_sections::attach_sections_using_phdrs_clause): Rename
2250 local orphan to is_orphan. Don't report failure to put empty
2251 section in segment. On attachment failure, report name of
2252 section, and attach to first PT_LOAD segment.
2254 2011-06-28 Ian Lance Taylor <iant@google.com>
2257 * target-select.cc (Target_selector::Target_selector): Add
2258 emulation parameter. Change all callers.
2259 (select_target_by_bfd_name): Rename from select_target_by_name.
2261 (select_target_by_emulation): New function.
2262 (supported_emulation_names): New function.
2263 * target-select.h (class Target_selector): Add emulation_ field.
2264 Update declarations.
2265 (Target_selector::recognize_by_bfd_name): Rename from
2266 recognize_by_name. Change all callers.
2267 (Target_selector::supported_bfd_names): Rename from
2268 supported_names. Change all callers.
2269 (Target_selector::recognize_by_emulation): New function.
2270 (Target_selector::supported_emulations): New function.
2271 (Target_selector::emulation): New function.
2272 (Target_selector::do_recognize_by_bfd_name): Rename from
2273 do_recognize_by_name. Change all callers.
2274 (Target_selector::do_supported_bfd_names): Rename from
2275 do_supported_names. Change all callers.
2276 (Target_selector::do_recognize_by_emulation): New function.
2277 (Target_selector::do_supported_emulations): New function.
2278 (select_target_by_bfd_name): Change name in declaration.
2279 (select_target_by_emulation): Declare.
2280 (supported_emulation_names): Declare.
2281 * parameters.cc (parameters_force_valid_target): Try to find
2282 target based on emulation from -m option.
2283 * options.h (class General_options): Change doc string for -m.
2284 * options.cc (help): Print emulations.
2285 (General_options::parse_V): Likewise.
2286 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2287 Add emulation parameter. Change all callers.
2289 2011-06-28 Ian Lance Taylor <iant@google.com>
2291 * target.h (class Target): Add osabi_ field.
2292 (Target::osabi): New function.
2293 (Target::set_osabi): New function.
2294 (Target::Target): Initialize osabi_.
2295 (Target::do_adjust_elf_header): Make pure virtual.
2296 (Sized_target::do_adjust_elf_header): Declare.
2297 * target.cc (Sized_target::do_adjust_elf_header): New function.
2298 (class Sized_target): Instantiate all versions.
2299 * freebsd.h (class Target_freebsd): Remove.
2300 (Target_selector_freebsd::do_recognize): Call set_osabi on
2302 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2303 (Target_selector_freebsd::set_osabi): Remove.
2304 * i386.cc (class Target_i386): Inherit from Sized_target rather
2305 than Target_freebsd.
2306 * x86_64.cc (class Target_x86_64): Likewise.
2308 2011-06-28 Ian Lance Taylor <iant@google.com>
2310 * target.h (Target::can_check_for_function_pointers): Rewrite.
2312 (Target::can_icf_inline_merge_sections): Likewise.
2313 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2314 (Target::Target_info): Add can_icf_inline_merge_sections field.
2315 (Target::do_can_check_for_function_pointers): New virtual
2317 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2318 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2319 from can_check_for_function_pointers, move in file.
2320 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2321 section_may_have_icf_unsafe_poineters, move in file.
2322 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2323 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2324 Rename from can_check_for_function_pointers, move in file.
2325 (Target_i386::can_icf_inline_merge_sections): Remove.
2326 (Target_i386::i386_info): Initialize
2327 can_icf_inline_merge_sections.
2328 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2329 Initialize can_icf_inline_merge_sections.
2330 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2331 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2332 Rename from can_check_for_function_pointers, move in file.
2333 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2334 (Target_x86_64::x86_64_info): Initialize
2335 can_icf_inline_merge_sections.
2336 * testsuite/testfile.cc (Target_test::test_target_info):
2338 * icf.cc (get_section_contents): Correct formatting.
2340 2011-06-27 Ian Lance Taylor <iant@google.com>
2342 * symtab.cc (Symbol::versioned_name): New function.
2343 (Symbol_table::add_to_final_symtab): Use versioned_name when
2345 (Symbol_table::sized_write_symbol): Likewise.
2346 * symtab.h (class Symbol): Declare versioned_name.
2347 * stringpool.h (class Stringpool_template): Add variant of add
2348 which takes a std::basic_string.
2349 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2350 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2351 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2352 (ver_test_12.o): New target.
2353 * testsuite/Makefile.in: Rebuild.
2355 2011-06-27 Doug Kwan <dougkwan@google.com>
2357 * arm.cc (Arm_relocate_functions::thm_jump8,
2358 Arm_relocate_functions::thm_jump11): Use a wider signed
2359 type to compute offset.
2360 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2362 * testsuite/Makefile.in: Regenerate.
2363 * testsuite/arm_branch_in_range.sh: Check test results of
2364 arm_thm_jump11 and arm_thm_jump8.
2365 * testsuite/arm_thm_jump11.s: New test source file.
2366 * testsuite/arm_thm_jump11.t: New linker script.
2367 * testsuite/arm_thm_jump8.s: New test source file.
2368 * testsuite/arm_thm_jump8.t: New linker script.
2370 2011-06-24 Ian Lance Taylor <iant@google.com>
2372 * layout.cc: Include "object.h".
2373 (ctors_sections_in_init_array): New static variable.
2374 (Layout::is_ctors_in_init_array): New function.
2375 (Layout::layout): Add entry to ctors_sections_in_init_array if
2377 * layout.h (class Layout): Declare is_ctors_in_init_array.
2378 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2379 is_ctors_reverse_view is set.
2380 (Sized_relobj_file::write_sections): Add layout parameter. Change
2381 all callers. Set is_ctors_reverse_view field of View_size.
2382 (Sized_relobj_file::reverse_words): New function.
2383 * object.h (Sized_relobj_file::View_size): Add
2384 is_ctors_reverse_view field.
2385 (class Sized_relobj_file): Update declarations.
2386 * testsuite/initpri3.c: New test.
2387 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2389 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2390 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2391 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2392 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2393 * testsuite/Makefile.in: Rebuild.
2395 2011-06-24 Cary Coutant <ccoutant@google.com>
2397 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2398 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2399 (debug_msg_cdebug.err): New targets.
2400 * testsuite/Makefile.in: Regenerate.
2401 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2402 Fix checks for link with shared library.
2404 2011-06-24 Doug Kwan <dougkwan@google.com>
2406 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2407 skip empty text sections.
2408 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2410 2011-06-22 Ian Lance Taylor <iant@google.com>
2413 * options.h (class General_options): Add --ctors-in-init-array.
2414 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2415 friends as SHT_PROGBITS for merging sections.
2416 (Layout::layout): Remove special handling of .init_array and
2417 friends. Don't sort if doing relocatable link. Sort for .ctors
2418 and .dtors if ctors_in_init_array.
2419 (Layout::make_output_section): Force correct section types for
2420 .init_array and friends. Don't sort if doing relocatable link,
2421 Don't sort .ctors and .dtors if ctors_in_init_array.
2422 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2423 (Layout::output_section_name): Add relobj parameter. Change all
2424 callers. Handle .ctors. and .dtors. in code rather than table.
2425 Handle .ctors and .dtors if ctors_in_init_array.
2426 (Layout::match_file_name): New function, moved from output.cc.
2427 * layout.h (class Layout): Update declarations.
2428 * output.cc: Include "layout.h".
2429 (Input_section_sort_entry::get_priority): New function.
2430 (Input_section_sort_entry::match_file_name): Just call
2431 Layout::match_file_name.
2432 (Output_section::Input_section_sort_init_fini_compare::operator()):
2433 Handle .ctors and .dtors. Sort by explicit priority rather than
2435 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2436 * testsuite/initpri2.c: New test.
2437 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2438 (check_PROGRAMS): Add initpri2.
2439 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2440 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2441 * configure, testsuite/Makefile.in: Rebuild.
2443 2011-06-19 Ian Lance Taylor <iant@google.com>
2446 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2447 .interp section to a PT_INTERP segment even if we have seen a
2448 --dynamic-linker option. Don't do it if we have seen a PHDRS
2449 clause in a linker script.
2450 (Layout::finalize): Don't create a .interp section if we've
2451 already create a PT_INTERP segment.
2452 (Layout::create_interp): Always call choose_output_section (revert
2453 patch of 2011-06-17). Don't create PT_INTERP segment.
2454 * script-sections.cc
2455 (Script_sections::create_note_and_tls_segments): Add a .interp
2456 section to a PT_INTERP segment even if we have seen a
2457 --dynamic-linker option.
2459 2011-06-18 Ian Lance Taylor <iant@google.com>
2461 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2462 merely because a non-PT_LOAD segment has a dynamic reloc.
2464 2011-06-18 Ian Lance Taylor <iant@google.com>
2466 * layout.cc (Layout::finish_dynamic_section): Don't create
2467 DT_FLAGS entry if not needed.
2469 2011-06-18 Ian Lance Taylor <iant@google.com>
2472 * layout.cc (Layout::layout_eh_frame): Correct handling of
2473 writable .eh_frame section.
2475 2011-06-17 Ian Lance Taylor <iant@google.com>
2478 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2479 symbol is redefined with the exact same object and value.
2481 2011-06-17 Ian Lance Taylor <iant@google.com>
2484 * layout.h (class Layout): Add interp_segment_ field.
2485 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2486 (Layout::attach_allocated_section_to_segment): If making shared
2487 library, put .interp section in PT_INTERP segment.
2488 (Layout::finalize): Also call create_interp if -dynamic-linker
2490 (Layout::create_interp): Assert that there is no PT_INTERP
2491 segment. If not using a SECTIONS clause, use make_output_section.
2492 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2493 * script-sections.cc
2494 (Script_sections::create_note_and_tls_segments): If making shared
2495 library, put .interp section in PT_INTERP segment.
2497 2011-06-17 Ian Lance Taylor <iant@google.com>
2499 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2500 when making a shared library.
2502 2011-06-17 Ian Lance Taylor <iant@google.com>
2504 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2505 parameter. Change all callers. Don't issue warning about PC32
2506 against locally defined symbol.
2508 2011-06-16 Ian Lance Taylor <iant@google.com>
2510 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2511 occurs in same object.
2513 2011-06-14 Alan Modra <amodra@gmail.com>
2515 * po/POTFILES.in: Regenerate.
2517 2011-06-09 Ian Lance Taylor <iant@google.com>
2519 * script-sections.cc
2520 (Orphan_output_section::set_section_addresses): For a relocatable
2521 link set address to 0.
2523 2011-06-09 Cary Coutant <ccoutant@google.com>
2526 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2527 used with --compress-debug-sections.
2528 * gold/object.cc (Sized_relobj_file::do_layout): Report
2529 uncompressed size of compressed input sections.
2531 2011-06-08 Cary Coutant <ccoutant@google.com>
2534 * testsuite/two_file_test_2_v1.cc: Change initialization of
2535 v2 to keep it in .data.
2537 2011-06-07 Cary Coutant <ccoutant@google.com>
2539 * common.cc (Symbol_table::do_allocate_commons_list): Call
2541 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2542 (Errors::fallback): New function.
2543 (gold_fallback): New function.
2544 * errors.h (Errors::fallback): New function.
2545 * gold.cc (gold_exit): Change status parameter to enum; adjust
2547 (queue_initial_tasks): Call gold_fallback.
2548 * gold.h: Include cstdlib.
2549 (Exit_status): New enum type.
2550 (gold_exit): Change status parameter to enum.
2551 (gold_fallback): New function.
2552 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2553 (Layout::create_symtab_sections): Likewise.
2554 (Layout::create_shdrs): Likewise.
2555 * main.cc (main): Adjust call to gold_exit.
2556 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2557 (Output_data_got::add_got_entry_pair): Likewise.
2558 (Output_section::add_input_section): Likewise.
2559 (Output_section::add_output_section_data): Likewise.
2560 (Output_segment::set_section_list_addresses): Likewise.
2561 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2563 2011-06-07 Cary Coutant <ccoutant@google.com>
2565 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2566 for incremental links.
2567 * output.cc (Output_segment::set_section_list_addresses): Remove
2568 FIXME and test for TLS or BSS.
2570 2011-06-07 Cary Coutant <ccoutant@google.com>
2572 * testsuite/Makefile.am: Add incremental_copy_test,
2573 incremental_common_test_1.
2574 * testsuite/Makefile.in: Regenerate.
2575 * testsuite/common_test_1_v1.c: New source file.
2576 * testsuite/common_test_1_v2.c: New source file.
2577 * testsuite/copy_test_v1.cc: New source file.
2579 2011-06-07 Cary Coutant <ccoutant@google.com>
2581 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2582 update, allocate common from bss section's free list.
2583 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2584 linker-defined symbols.
2585 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2586 Skip GOT and PLT entries that are no longer referenced.
2587 (Output_section_incremental_inputs::write_info_blocks): Mark
2588 linker-defined symbols.
2589 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2590 * output.cc (Output_section::allocate): New function.
2591 * output.h (Output_section::allocate): New function.
2592 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2593 linker-defined symbols.
2594 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2595 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2596 (Symbol::init_base_output_data): Likewise.
2597 (Symbol::init_base_output_segment): Likewise.
2598 (Symbol::init_base_constant): Likewise.
2599 (Sized_symbol::init_output_data): Likewise.
2600 (Sized_symbol::init_output_segment): Likewise.
2601 (Sized_symbol::init_constant): Likewise.
2602 (Symbol_table::do_define_in_output_data): Likewise.
2603 (Symbol_table::do_define_in_output_segment): Likewise.
2604 (Symbol_table::do_define_as_constant): Likewise.
2605 * symtab.h (Symbol::is_predefined): New function.
2606 (Symbol::init_base_output_data): Add is_predefined parameter.
2607 (Symbol::init_base_output_segment): Likewise.
2608 (Symbol::init_base_constant): Likewise.
2609 (Symbol::is_predefined_): New data member.
2610 (Sized_symbol::init_output_data): Add is_predefined parameter.
2611 (Sized_symbol::init_output_segment): Likewise.
2612 (Sized_symbol::init_constant): Likewise.
2613 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2615 2011-06-07 Cary Coutant <ccoutant@google.com>
2617 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2618 instead of emit_copy_reloc.
2619 (Copy_relocs::emit_copy_reloc): Refactor.
2620 (Copy_relocs::make_copy_reloc): New function.
2621 (Copy_relocs::add_copy_reloc): Remove.
2622 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2624 (Copy_relocs::make_copy_reloc): New function.
2625 (Copy_relocs::add_copy_reloc): Remove.
2626 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2627 unchanged input files.
2628 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2629 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2630 Reserve BSS space for COPY relocations.
2631 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2632 (Output_section_incremental_inputs::write_info_blocks): Record
2633 whether a symbol is copied from a shared object.
2634 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2635 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2636 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2637 (Incremental_input_entry_reader::get_output_symbol_index): Add
2639 (Incremental_binary::emit_copy_relocs): New function.
2640 (Incremental_binary::do_emit_copy_relocs): New function.
2641 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2643 (Sized_incremental_binary::add_copy_reloc): New function.
2644 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2645 (Sized_incremental_binary::Copy_reloc): New struct.
2646 (Sized_incremental_binary::Copy_relocs): New typedef.
2647 (Sized_incremental_binary::copy_relocs_): New data member.
2648 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2649 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2650 * target.h (Sized_target::emit_copy_reloc): New function.
2651 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2653 2011-06-02 Cary Coutant <ccoutant@google.com>
2656 * gold/archive.cc (Archive::Archive): Initialize new data member.
2657 (Archive::include_all_members): Return if archive has already been
2659 * gold/archive.h (Archive::include_all_members_): New data member.
2661 2011-06-02 Nick Clifton <nickc@redhat.com>
2663 * dynobj.h: Fix spelling mistake in comment.
2664 * output.cc: Likewise.
2666 2011-05-31 Doug Kwan <dougkwan@google.com>
2670 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2671 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2672 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2673 redundant arm_exidx_test.so.
2674 * testsuite/Makefile.in: Regenerate.
2675 (check_SCRIPTS): Add pr12826.sh
2676 (check_DATA): Add pr12826.stdout
2677 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2678 * testsuite/pr12826.sh: New file.
2679 * testsuite/pr12826_1.s: Ditto.
2680 * testsuite/pr12826_1.s: Ditto.
2682 2011-05-30 Ian Lance Taylor <iant@google.com>
2684 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2687 2011-05-29 Ian Lance Taylor <iant@google.com>
2690 * testsuite/Makefile.am: Use different file name for two_file_test
2691 temporary file for each incremental test.
2692 * testsuite/Makefile.in: Rebuild.
2694 2011-05-29 Ian Lance Taylor <iant@google.com>
2696 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2697 binary input file is empty.
2699 2011-05-27 Ian Lance Taylor <iant@google.com>
2701 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2702 (ver_test_9.so): Likewise.
2703 * testsuite/Makefile.in: Rebuild.
2705 2011-05-26 Cary Coutant <ccoutant@google.com>
2707 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2708 * incremental.cc (Incremental_inputs::report_input_section): Fix
2709 comment, indentation.
2710 (Incremental_inputs::report_comdat_group): New function.
2711 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2712 of data for incremental input file entry.
2713 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2714 group count, COMDAT group signatures.
2715 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2716 an unchanged input file.
2717 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2718 Initialize new data member.
2719 (Incremental_object_entry::add_comdat_group): New function.
2720 (Incremental_object_entry::get_comdat_group_count): New function.
2721 (Incremental_object_entry::get_comdat_signature_key): New function.
2722 (Incremental_object_entry::groups_): New data member.
2723 (Incremental_inputs::report_comdat_group): New function.
2724 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2725 data for incremental input file entry.
2726 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2727 (Incremental_input_entry_reader::get_input_section): Adjust size of
2728 data for incremental input file entry.
2729 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2730 (Incremental_input_entry_reader::get_comdat_group_signature): New
2732 * object.cc (Sized_relobj::include_section_group): Report kept
2733 COMDAT groups for incremental links.
2735 2011-05-24 David Meyer <pdox@google.com>
2737 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2738 with name parameter. Add found_name parameter.
2739 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2740 * dirsearch.h (class Dirsearch): Update declaration.
2742 2011-05-24 Ian Lance Taylor <iant@google.com>
2744 * archive.cc (Library_base::should_include_member): Pull in object
2745 from archive if it defines the entry symbol.
2746 * parameters.cc (Parameters::entry): New function.
2747 * parameters.h (class Parameters): Declare entry.
2748 * output.h (class Output_file_header): Remove entry_ field.
2749 * output.cc (Output_file_header::Output_file_header): Remove entry
2750 parameter. Change all callers.
2751 (Output_file_header::entry): Use parameters->entry.
2752 * gold.cc (queue_middle_tasks): Likewise.
2753 * plugin.cc (Plugin_hook::run): Likewise.
2755 2011-05-24 Cary Coutant <ccoutant@google.com>
2757 * gold.cc (queue_initial_tasks): Pass incremental base filename
2758 to Output_file::open_base_file; don't print error message.
2759 * incremental-dump.cc (main): Adjust call to
2760 Output_file::open_for_modification.
2761 * incremental-dump.cc (main): Likewise.
2762 * incremental.cc (Incremental_inputs::report_command_line):
2763 Ignore --incremental-base option when comparing command lines.
2764 Ignore parameter when given as separate argument.
2765 * options.h (class General_options): Add --incremental-base.
2766 * output.cc (Output_file::Output_file):
2767 (Output_file::open_base_file): Add base_name and writable parameters;
2768 read base file into new file; print error message here.
2769 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2771 * output.h (Output_file::open_for_modification): Rename to...
2772 (Output_file::open_base_file): ...this; add base_name and
2773 writable parameters; adjust all callers.
2774 (Output_file::map_no_anonymous): Add writable parameter; adjust all
2776 * testsuite/Makefile.am (incremental_test_4): Test
2778 * testsuite/Makefile.in: Regenerate.
2780 2011-05-24 Cary Coutant <ccoutant@google.com>
2782 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2784 * testsuite/Makefile.in: Regenerate.
2785 * testsuite/two_file_test_1_v1.cc: New test source file.
2786 * testsuite/two_file_test_1b_v1.cc: New test source file.
2787 * testsuite/two_file_test_2_v1.cc: New test source file.
2789 2011-05-24 Cary Coutant <ccoutant@google.com>
2791 * dynobj.h (Dynobj::do_dynobj): New function.
2792 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2793 flag and soname for shared objects.
2794 * incremental.cc (Incremental_inputs::report_object): Make
2795 either Incremental_object_entry or Incremental_dynobj_entry; add
2796 soname to string table.
2797 (Incremental_inputs::report_input_section): Add assertion.
2798 (Output_section_incremental_inputs::set_final_data_size): Adjust
2799 type of input file entry for shared libraries; adjust size of
2800 shared library info entry.
2801 (Output_section_incremental_inputs::write_input_files): Write
2802 as_needed flag for shared libraries.
2803 (Output_section_incremental_inputs::write_info_blocks): Adjust type
2804 of input file entry for shared libraries; write soname.
2805 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2806 soname from incremental info.
2807 * incremental.h (enum Incremental_input_flags): Add
2808 INCREMENTAL_INPUT_AS_NEEDED.
2809 (Incremental_input_entry::Incremental_input_entry): Initialize new
2811 (Incremental_input_entry::set_as_needed): New function.
2812 (Incremental_input_entry::as_needed): New function.
2813 (Incremental_input_entry::do_dynobj_entry): New function.
2814 (Incremental_input_entry::as_needed_): New data member.
2815 (Incremental_object_entry::Incremental_object_entry): Don't check
2817 (Incremental_object_entry::do_type): Likewise.
2818 (class Incremental_dynobj_entry): New class.
2819 (Incremental_input_entry_reader::as_needed): New function.
2820 (Incremental_input_entry_reader::get_soname): New function.
2821 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2822 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2823 size of shared library info entry.
2824 * layout.cc (Layout::finish_dynamic_section): Don't test for
2825 incremental link when adding DT_NEEDED entries.
2826 * object.h (Object::Object): Initialize new data member.
2827 (Object::dynobj): New function.
2828 (Object::set_as_needed): New function.
2829 (Object::as_needed): New function.
2830 (Object::do_dynobj): New function.
2831 (Object::as_needed_): New data member.
2833 2011-05-24 Cary Coutant <ccoutant@google.com>
2835 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2836 info; adjust display of GOT entries.
2837 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2838 vector of input objects; remove file_status_.
2839 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2840 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2841 got_plt reader; call target hooks to reserve GOT entries.
2842 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2843 of input file info header and GOT info entry.
2844 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2846 (Got_plt_view_info::got_descriptor): Remove.
2847 (Got_plt_view_info::sym_index): New data member.
2848 (Got_plt_view_info::input_index): New data member.
2849 (Local_got_offset_visitor::visit): Write input file index.
2850 (Global_got_offset_visitor::visit): Write 0 for input file index.
2851 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2852 with sym_index and input_index.
2853 (Output_section_incremental_inputs::write_got_plt): Adjust size of
2854 incremental info GOT entry; replace got_descriptor with input_index.
2855 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2856 map from input file index to object.
2857 (Sized_relobj_incr::do_layout): Replace direct data member reference
2858 with accessor function.
2859 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2860 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2861 Adjust size of input file info header.
2862 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2863 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2864 (Incremental_input_entry_reader::get_input_section): Adjust size of
2865 input file info header.
2866 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2867 of incremental info GOT entry.
2868 (Incremental_got_plt_reader::get_got_desc): Remove.
2869 (Incremental_got_plt_reader::get_got_symndx): New function.
2870 (Incremental_got_plt_reader::get_got_input_index): New function.
2871 (Sized_incremental_binary::Sized_incremental_binary): Remove
2872 file_status_; add input_objects_.
2873 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2874 (Sized_incremental_binary::set_file_is_unchanged): Remove.
2875 (Sized_incremental_binary::file_is_unchanged): Remove.
2876 (Sized_incremental_binary::set_input_object): New function.
2877 (Sized_incremental_binary::input_object): New function.
2878 (Sized_incremental_binary::file_status_): Remove.
2879 (Sized_incremental_binary::input_objects_): New data member.
2880 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2882 (Sized_relobj_incr::invalid_address): Move to base class.
2883 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2885 (Sized_relobj_incr::do_output_section_offset): Likewise.
2886 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2887 (Sized_relobj_incr::section_offsets_): Likewise.
2888 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2890 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2891 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2892 with accessor function.
2893 (Sized_relobj_file::do_layout): Likewise.
2894 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2895 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2896 (Sized_relobj_file::compute_final_local_value): Replace refs to
2897 section_offsets_ with accessor function.
2898 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2899 * object.h (Relobj::Relobj): Initialize new data members.
2900 (Relobj::add_dyn_reloc): New function.
2901 (Relobj::first_dyn_reloc): New function.
2902 (Relobj::dyn_reloc_count): New function.
2903 (Relobj::first_dyn_reloc_): New data member.
2904 (Relobj::dyn_reloc_count_): New data member.
2905 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2907 (Sized_relobj::Address): New typedef.
2908 (Sized_relobj::invalid_address): Move here from child class.
2909 (Sized_relobj::Sized_relobj): Initialize new data members.
2910 (Sized_relobj::sized_relobj): New function.
2911 (Sized_relobj::is_output_section_offset_invalid): Move here from
2913 (Sized_relobj::get_output_section_offset): Likewise.
2914 (Sized_relobj::local_has_got_offset): Likewise.
2915 (Sized_relobj::local_got_offset): Likewise.
2916 (Sized_relobj::set_local_got_offset): Likewise.
2917 (Sized_relobj::do_for_all_local_got_entries): Likewise.
2918 (Sized_relobj::clear_got_offsets): New function.
2919 (Sized_relobj::section_offsets): Move here from child class.
2920 (Sized_relobj::do_output_section_offset): Likewise.
2921 (Sized_relobj::do_set_section_offset): Likewise.
2922 (Sized_relobj::Local_got_offsets): Likewise.
2923 (Sized_relobj::local_got_offsets_): Likewise.
2924 (Sized_relobj::section_offsets_): Likewise.
2925 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2927 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2929 (Sized_relobj_file::sized_relobj): New function
2930 (Sized_relobj_file::local_has_got_offset): Move to base class.
2931 (Sized_relobj_file::local_got_offset): Likewise.
2932 (Sized_relobj_file::set_local_got_offset): Likewise.
2933 (Sized_relobj_file::get_output_section_offset): Likewise.
2934 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2935 (Sized_relobj_file::do_output_section_offset): Likewise.
2936 (Sized_relobj_file::do_set_section_offset): Likewise.
2937 (Sized_relobj_file::Local_got_offsets): Likewise.
2938 (Sized_relobj_file::local_got_offsets_): Likewise.
2939 (Sized_relobj_file::section_offsets_): Likewise.
2940 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2942 (set_needs_dynsym_index): Convert relobj to derived class pointer.
2943 (Output_reloc::get_symbol_index): Likewise.
2944 (Output_reloc::local_section_offset): Likewise.
2945 (Output_reloc::get_address): Likewise.
2946 (Output_reloc::symbol_value): Likewise.
2947 (Output_data_got::reserve_slot): Move to class definition.
2948 (Output_data_got::reserve_local): New function.
2949 (Output_data_got::reserve_slot_for_global): Remove.
2950 (Output_data_got::reserve_global): New function.
2951 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2952 (all constructors, two instantiations).
2953 (Output_reloc::get_relobj): New function (two instantiations).
2954 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2955 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2956 (Output_data_reloc::add_global): Adjust type of relobj.
2957 (Output_data_reloc::add_global_relative): Likewise.
2958 (Output_data_reloc::add_symbolless_global_addend): Likewise.
2959 (Output_data_reloc::add_local): Likewise.
2960 (Output_data_reloc::add_local_relative): Likewise.
2961 (Output_data_reloc::add_symbolless_local_addend): Likewise.
2962 (Output_data_reloc::add_local_section): Likewise.
2963 (Output_data_reloc::add_output_section): Likewise.
2964 (Output_data_reloc::add_absolute): Likewise.
2965 (Output_data_reloc::add_target_specific): Likewise.
2966 (Output_data_got::reserve_slot): Move definition here.
2967 (Output_data_got::reserve_local): New function.
2968 (Output_data_got::reserve_global): New function.
2969 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2970 section_offsets_ with accessor function.
2971 (Sized_relobj_file::write_sections): Likewise.
2972 (Sized_relobj_file::do_relocate_sections): Likewise.
2973 * target.h (Sized_target::reserve_local_got_entry): New function.
2974 (Sized_target::reserve_global_got_entry): New function.
2975 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2976 (Target_x86_64::reserve_global_got_entry): New function.
2977 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2979 2011-05-23 Cary Coutant <ccoutant@google.com>
2981 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2982 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2983 bit when checking got_type.
2984 * incremental.cc (Sized_incremental_binary::setup_readers):
2985 Store symbol table and string table locations; initialize bit vector
2986 of file status flags.
2987 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2989 (Sized_incremental_binary::do_process_got_plt): New function.
2990 (Sized_incremental_binary::get_symtab_view): Use stored locations.
2991 (Output_section_incremental_inputs::set_final_data_size): Record
2992 file index for each input file.
2993 (Output_section_incremental_inputs::write_got_plt): Store file index
2994 instead of input entry offset for each GOT entry.
2996 (Incremental_input_entry::Incremental_input_entry): Initialize new
2998 (Incremental_input_entry::set_offset): Store file index.
2999 (Incremental_input_entry::get_file_index): New function.
3000 (Incremental_input_entry::file_index_): New data member.
3001 (Incremental_binary::process_got_plt): New function.
3002 (Incremental_binary::do_process_got_plt): New function.
3003 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3005 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3006 (Sized_incremental_binary::set_file_is_unchanged): New function.
3007 (Sized_incremental_binary::file_is_unchanged): New function.
3008 (Sized_incremental_binary::do_process_got_plt): New function.
3009 (Sized_incremental_binary::file_status_): New data member.
3010 (Sized_incremental_binary::main_symtab_loc_): New data member.
3011 (Sized_incremental_binary::main_strtab_loc_): New data member.
3012 * output.cc (Output_data_got::Got_entry::write): Add case
3014 (Output_data_got::add_global): Call add_got_entry.
3015 (Output_data_got::add_global_plt): Likewise.
3016 (Output_data_got::add_global_with_rel): Likewise.
3017 (Output_data_got::add_global_with_rela): Likewise.
3018 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3019 (Output_data_got::add_global_pair_with_rela): Likewise.
3020 (Output_data_got::add_local): Call add_got_entry.
3021 (Output_data_got::add_local_plt): Likewise.
3022 (Output_data_got::add_local_with_rel): Likewise.
3023 (Output_data_got::add_local_with_rela): Likewise.
3024 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3025 (Output_data_got::add_local_pair_with_rela): Likewise.
3026 (Output_data_got::reserve_slot): New function.
3027 (Output_data_got::reserve_slot_for_global): New function.
3028 (Output_data_got::add_got_entry): New function.
3029 (Output_data_got::add_got_entry_pair): New function.
3030 (Output_section::add_output_section_data): Edit FIXME.
3032 (Output_section_data_build::Output_section_data_build): New
3033 constructor with size parameter.
3034 (Output_data_space::Output_data_space): Likewise.
3035 (Output_data_got::Output_data_got): Initialize new data member; new
3036 constructor with size parameter.
3037 (Output_data_got::add_constant): Call add_got_entry.
3038 (Output_data_got::reserve_slot): New function.
3039 (Output_data_got::reserve_slot_for_global): New function.
3040 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3041 (Output_data_got::add_got_entry): New function.
3042 (Output_data_got::add_got_entry_pair): New function.
3043 (Output_data_got::free_list_): New data member.
3044 * target.h (Sized_target::init_got_plt_for_update): New function.
3045 (Sized_target::register_global_plt_entry): New function.
3046 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3047 Initialize new data member; call init; add constructor with PLT count.
3048 (Output_data_plt_x86_64::init): New function.
3049 (Output_data_plt_x86_64::add_relocation): New function.
3050 (Output_data_plt_x86_64::reserve_slot): New function.
3051 (Output_data_plt_x86_64::free_list_): New data member.
3052 (Target_x86_64::init_got_plt_for_update): New function.
3053 (Target_x86_64::register_global_plt_entry): New function.
3054 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3055 incremental updates.
3056 (Output_data_plt_x86_64::add_relocation): New function.
3057 * testsuite/object_unittest.cc (Object_test): Set default options.
3059 2011-05-16 Ian Lance Taylor <iant@google.com>
3061 * options.h (class General_options): Make -i a synonym for -r.
3063 2011-05-16 Ian Lance Taylor <iant@google.com>
3065 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3067 2011-05-10 Cary Coutant <ccoutant@google.com>
3069 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3072 2011-05-06 Ian Lance Taylor <iant@google.com>
3074 * layout.cc (Layout::layout): If the output section flags change,
3075 update the ordering.
3077 2011-04-25 Cary Coutant <ccoutant@google.com>
3079 * incremental-dump.cc (dump_incremental_inputs): Print local
3080 symbol info for each input file.
3082 (Output_section_incremental_inputs::set_final_data_size): Add local
3083 symbol info to input file entries in incremental info.
3084 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3085 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3086 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3087 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3089 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3090 (Sized_incr_relobj::do_relocate): Write the local symbols.
3091 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3092 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3093 Adjust size of input file header.
3094 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3095 (Incremental_inputs_reader::get_local_symbol_count): New function.
3096 (Incremental_inputs_reader::get_input_section): Adjust size of input
3098 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3099 (Sized_incr_relobj::This): New typedef.
3100 (Sized_incr_relobj::sym_size): New const data member.
3101 (Sized_incr_relobj::Local_symbol): New struct.
3102 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3103 (Sized_incr_relobj::do_local_symbol_offset): New function.
3104 (Sized_incr_relobj::local_symbol_count_): New data member.
3105 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3106 (Sized_incr_relobj::local_symbol_index_): New data member.
3107 (Sized_incr_relobj::local_symbol_offset_): New data member.
3108 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3109 (Sized_incr_relobj::local_symbols_): New data member.
3110 * object.h (Relobj::output_local_symbol_count): New function.
3111 (Relobj::local_symbol_offset): New function.
3112 (Relobj::do_output_local_symbol_count): New function.
3113 (Relobj::do_local_symbol_offset): New function.
3114 (Sized_relobj::do_output_local_symbol_count): New function.
3115 (Sized_relobj::do_local_symbol_offset): New function.
3117 2011-04-22 Vladimir Simonov <sv@sw.ru>
3119 * descriptors.cc (set_close_on_exec): New function.
3120 (Descriptors::open): Use set_close_on_exec.
3121 * output.cc (S_ISLNK): Define if not defined.
3123 2011-04-22 Cary Coutant <ccoutant@google.com>
3125 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3127 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3128 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3129 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3131 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3132 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3133 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3135 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3137 (Incremental_binary::apply_incremental_relocs): New function.
3138 (Incremental_binary::do_apply_incremental_relocs): New function.
3139 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3141 (Sized_incremental_binary::add_global_symbol): New function.
3142 (Sized_incremental_binary::global_symbol): New function.
3143 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3144 (Sized_incremental_binary::symbol_map_): New data member.
3145 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3146 * target.h (Sized_target::apply_relocation): New function.
3147 * target-reloc.h (apply_relocation): New function.
3148 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3150 2011-04-22 Doug Kwan <dougkwan@google.com>
3152 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3153 flag of a SHT_ARM_EXIDX section.
3154 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3155 * testsuite/Makefile.in: Regenerate.
3156 * testsuite/arm_exidx_test.s: New file.
3157 * testsuite/arm_exidx_test.sh: Same.
3159 2011-04-20 Cary Coutant <ccoutant@google.com>
3162 * archive.h (Incremental_archive_entry::Archive_member):
3163 Initialize arg_serial_ (second constructor).
3165 2011-04-17 Ian Lance Taylor <iant@google.com>
3167 * object.cc (Relocate_info::location): Simplify location string.
3168 * errors.cc (Errors::error_at_location): Don't print program
3170 (Errors::warning_at_location): Likewise.
3171 (Errors::undefined_symbol): Likewise.
3172 * testsuite/debug_msg.sh: Update accordingly.
3174 2011-04-14 Cary Coutant <ccoutant@google.com>
3176 * gold/layout.cc (Layout::symtab_section_offset): New function.
3177 * gold/layout.h (Layout::symtab_section_offset): New function.
3178 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3180 2011-04-12 Ian Lance Taylor <iant@google.com>
3182 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3183 with MREMAP_MAYMOVE.
3184 * output.h (class Output_file): Add map_is_allocated_ field.
3185 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3186 not available, provide stubs. If mremap is not available, #define
3188 (MREMAP_MAYMOVE): Define if not defined.
3189 (Output_file::Output_file): Initialize map_is_allocated_.
3190 (Output_file::resize): Check map_is_allocated_.
3191 (Output_file::map_anonymous): If mmap fails, use malloc.
3192 (Output_file::unmap): Don't do anything for an anonymous map.
3193 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3194 is not available, provide stubs.
3195 (File_read::View::~View): Use free rather than delete[].
3196 (File_read::make_view): Use malloc rather than new[]. If mmap
3198 (File_read::find_or_make_view): Use malloc rather than new[].
3199 * gold.h: Remove HAVE_REMAP code.
3200 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3201 exists. Rename mremap to gold_mremap. If mmap is not available
3203 * configure, config.in: Rebuild.
3205 2011-04-11 Ian Lance Taylor <iant@google.com>
3207 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3208 initialize local variable v.
3210 2011-04-11 Cary Coutant <ccoutant@google.com>
3212 * archive.cc (Archive::include_member): Adjust call to
3214 (Add_archive_symbols::run): Track argument serial numbers.
3215 (Lib_group::include_member): Likewise.
3216 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3217 * archive.h (Incremental_archive_entry::Archive_member):
3218 Initialize arg_serial_.
3219 (Archive_member::arg_serial_): New data member.
3220 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3221 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3223 (Sized_dynobj::do_for_all_local_got_entries): New function.
3224 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3226 * fileread.cc (get_mtime): New function.
3227 * fileread.h (get_mtime): New function.
3228 * gold.cc (queue_initial_tasks): Check for incremental update.
3229 (process_incremental_input): New function.
3230 (queue_middle_tasks): Don't force valid target for incremental
3232 * incremental-dump.cc (find_input_containing_global): Adjust
3233 size of symbol info entry.
3234 (dump_incremental_inputs): Dump argument serial number and
3235 in_system_directory flag; bias shndx by 1; print symbol names
3236 when dumping per-file symbol lists; use new symbol info readers.
3238 (Output_section_incremental_inputs:update_data_size): New function.
3239 (Sized_incremental_binary::setup_readers): Setup input readers
3240 for each input file; build maps for files added from libraries
3242 (Sized_incremental_binary::check_input_args): New function.
3243 (Sized_incremental_binary::do_check_inputs): Build map of argument
3244 serial numbers to input arguments.
3245 (Sized_incremental_binary::do_file_has_changed): Rename
3246 do_file_is_unchanged to this; compare file modification times.
3247 (Sized_incremental_binary::do_init_layout): New function.
3248 (Sized_incremental_binary::do_reserve_layout): New function.
3249 (Sized_incremental_binary::do_get_input_reader): Remove.
3250 (Sized_incremental_binary::get_symtab_view): New function.
3251 (Incremental_checker::can_incrementally_link_output_file): Remove.
3252 (Incremental_inputs::report_command_line): Exclude --debug options.
3253 (Incremental_inputs::report_archive_begin): Add parameter; track
3254 argument serial numbers; don't put input file entry for archive
3255 before archive members.
3256 (Incremental_inputs::report_archive_end): Put input file entry
3257 for archive after archive members.
3258 (Incremental_inputs::report_object): Add parameter; track argument
3259 serial numbers and in_system_directory flag.
3260 (Incremental_inputs::report_script): Add parameter; track argument
3262 (Output_section_incremental_inputs::set_final_data_size): Adjust
3263 size of symbol info entry; check for forwarding symbols.
3264 (Output_section_incremental_inputs::write_input_files): Write
3265 in_system_directory flag and argument serial number.
3266 (Output_section_incremental_inputs::write_info_blocks): Map section
3267 indices between incremental info and original input file; store
3268 input section index for each symbol.
3269 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3270 change operator() to visit().
3271 (class Global_got_offset_visitor): Likewise.
3272 (class Global_symbol_visitor_got_plt):
3273 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3275 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3276 (Sized_incr_relobj::do_read_symbols): New function.
3277 (Sized_incr_relobj::do_layout): New function.
3278 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3279 (Sized_incr_relobj::do_add_symbols): New function.
3280 (Sized_incr_relobj::do_should_include_member): New function.
3281 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3282 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3283 (Sized_incr_relobj::do_section_size): New function.
3284 (Sized_incr_relobj::do_section_name): New function.
3285 (Sized_incr_relobj::do_section_contents): New function.
3286 (Sized_incr_relobj::do_section_flags): New function.
3287 (Sized_incr_relobj::do_section_entsize): New function.
3288 (Sized_incr_relobj::do_section_address): New function.
3289 (Sized_incr_relobj::do_section_type): New function.
3290 (Sized_incr_relobj::do_section_link): New function.
3291 (Sized_incr_relobj::do_section_info): New function.
3292 (Sized_incr_relobj::do_section_addralign): New function.
3293 (Sized_incr_relobj::do_initialize_xindex): New function.
3294 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3295 (Sized_incr_relobj::do_read_relocs): New function.
3296 (Sized_incr_relobj::do_gc_process_relocs): New function.
3297 (Sized_incr_relobj::do_scan_relocs): New function.
3298 (Sized_incr_relobj::do_count_local_symbols): New function.
3299 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3300 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3301 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3302 (Sized_incr_relobj::do_relocate): New function.
3303 (Sized_incr_relobj::do_set_section_offset): New function.
3304 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3305 (Sized_incr_dynobj::do_read_symbols): New function.
3306 (Sized_incr_dynobj::do_layout): New function.
3307 (Sized_incr_dynobj::do_add_symbols): New function.
3308 (Sized_incr_dynobj::do_should_include_member): New function.
3309 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3310 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3311 (Sized_incr_dynobj::do_section_size): New function.
3312 (Sized_incr_dynobj::do_section_name): New function.
3313 (Sized_incr_dynobj::do_section_contents): New function.
3314 (Sized_incr_dynobj::do_section_flags): New function.
3315 (Sized_incr_dynobj::do_section_entsize): New function.
3316 (Sized_incr_dynobj::do_section_address): New function.
3317 (Sized_incr_dynobj::do_section_type): New function.
3318 (Sized_incr_dynobj::do_section_link): New function.
3319 (Sized_incr_dynobj::do_section_info): New function.
3320 (Sized_incr_dynobj::do_section_addralign): New function.
3321 (Sized_incr_dynobj::do_initialize_xindex): New function.
3322 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3323 (make_sized_incremental_object): New function.
3324 (Incremental_library::copy_unused_symbols): New function.
3325 (Incremental_library::do_for_all_unused_symbols): New function.
3326 * incremental.h (enum Incremental_input_flags): New type.
3327 (class Incremental_checker): Remove.
3328 (Incremental_input_entry::Incremental_input_entry): Add argument
3330 (Incremental_input_entry::arg_serial): New function.
3331 (Incremental_input_entry::set_is_in_system_directory): New function.
3332 (Incremental_input_entry::is_in_system_directory): New function.
3333 (Incremental_input_entry::arg_serial_): New data member.
3334 (Incremental_input_entry::is_in_system_directory_): New data member.
3335 (class Script_info): Move here from script.h.
3336 (Script_info::Script_info): Add filename parameter.
3337 (Script_info::filename): New function.
3338 (Script_info::filename_): New data member.
3339 (Incremental_script_entry::Incremental_script_entry): Add argument
3341 (Incremental_object_entry::Incremental_object_entry): Likewise.
3342 (Incremental_object_entry::add_input_section): Build list of input
3343 sections with map to original shndx.
3344 (Incremental_object_entry::get_input_section_index): New function.
3345 (Incremental_object_entry::shndx_): New data member.
3346 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3347 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3348 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3350 (Incremental_inputs::report_archive_begin): Likewise.
3351 (Incremental_inputs::report_object): Likewise.
3352 (Incremental_inputs::report_script): Likewise.
3353 (class Incremental_global_symbol_reader): New class.
3354 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3355 and store flags and input file type.
3356 (Incremental_input_entry_reader::arg_serial): New function.
3357 (Incremental_input_entry_reader::type): Extract type from flags.
3358 (Incremental_input_entry_reader::is_in_system_directory): New function.
3359 (Incremental_input_entry_reader::get_input_section_count): Call
3360 accessor function for type.
3361 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3362 function for type; adjust size of global symbol entry.
3363 (Incremental_input_entry_reader::get_global_symbol_count): Call
3364 accessor function for type.
3365 (Incremental_input_entry_reader::get_object_count): Likewise.
3366 (Incremental_input_entry_reader::get_object_offset): Likewise.
3367 (Incremental_input_entry_reader::get_member_count): Likewise.
3368 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3369 (Incremental_input_entry_reader::get_member_offset): Likewise.
3370 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3371 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3372 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3373 (Incremental_input_entry_reader::get_global_symbol_reader): New
3375 (Incremental_input_entry_reader::get_output_symbol_index): New
3377 (Incremental_input_entry_reader::type_): Remove.
3378 (Incremental_input_entry_reader::flags_): New data member.
3379 (Incremental_inputs_reader::input_file_offset): New function.
3380 (Incremental_inputs_reader::input_file_index): New function.
3381 (Incremental_inputs_reader::input_file): Call input_file_offset.
3382 (Incremental_inputs_reader::input_file_at_offset): New function.
3383 (Incremental_relocs_reader::get_r_type): Reformat.
3384 (Incremental_relocs_reader::get_r_shndx): Reformat.
3385 (Incremental_relocs_reader::get_r_offset): Reformat.
3386 (Incremental_relocs_reader::data): New function.
3387 (Incremental_binary::Incremental_binary): Initialize new data members.
3388 (Incremental_binary::check_inputs): Add cmdline parameter.
3389 (Incremental_binary::file_is_unchanged): Remove.
3390 (Input_reader::arg_serial): New function.
3391 (Input_reader::get_unused_symbol_count): New function.
3392 (Input_reader::get_unused_symbol): New function.
3393 (Input_reader::do_arg_serial): New function.
3394 (Input_reader::do_get_unused_symbol_count): New function.
3395 (Input_reader::do_get_unused_symbol): New function.
3396 (Incremental_binary::input_file_count): New function.
3397 (Incremental_binary::get_input_reader): Change signature to use
3398 index instead of filename.
3399 (Incremental_binary::file_has_changed): New function.
3400 (Incremental_binary::get_input_argument): New function.
3401 (Incremental_binary::get_library): New function.
3402 (Incremental_binary::get_script_info): New function.
3403 (Incremental_binary::init_layout): New function.
3404 (Incremental_binary::reserve_layout): New function.
3405 (Incremental_binary::output_file): New function.
3406 (Incremental_binary::do_check_inputs): New function.
3407 (Incremental_binary::do_file_is_unchanged): Remove.
3408 (Incremental_binary::do_file_has_changed): New function.
3409 (Incremental_binary::do_init_layout): New function.
3410 (Incremental_binary::do_reserve_layout): New function.
3411 (Incremental_binary::do_input_file_count): New function.
3412 (Incremental_binary::do_get_input_reader): Change signature.
3413 (Incremental_binary::input_args_map_): New data member.
3414 (Incremental_binary::library_map_): New data member.
3415 (Incremental_binary::script_map_): New data member.
3416 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3418 (Sized_incremental_binary::output_section): New function.
3419 (Sized_incremental_binary::inputs_reader): Add const.
3420 (Sized_incremental_binary::symtab_reader): Add const.
3421 (Sized_incremental_binary::relocs_reader): Add const.
3422 (Sized_incremental_binary::got_plt_reader): Add const.
3423 (Sized_incremental_binary::get_symtab_view): New function.
3424 (Sized_incremental_binary::Inputs_reader): New typedef.
3425 (Sized_incremental_binary::Input_entry_reader): New typedef.
3426 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3427 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3428 (Sized_incremental_binary::do_file_has_changed): New function.
3429 (Sized_incremental_binary::do_init_layout): New function.
3430 (Sized_incremental_binary::do_reserve_layout): New function.
3431 (Sized_input_reader::Inputs_reader): Remove.
3432 (Sized_input_reader::Input_entry_reader): Remove.
3433 (Sized_input_reader::do_arg_serial): New function.
3434 (Sized_input_reader::do_get_unused_symbol_count): New function.
3435 (Sized_input_reader::do_get_unused_symbol): New function.
3436 (Sized_incremental_binary::do_input_file_count): New function.
3437 (Sized_incremental_binary::do_get_input_reader): Change signature;
3438 use index instead of filename.
3439 (Sized_incremental_binary::section_map_): New data member.
3440 (Sized_incremental_binary::input_entry_readers_): New data member.
3441 (class Sized_incr_relobj): New class.
3442 (class Sized_incr_dynobj): New class.
3443 (make_sized_incremental_object): New function.
3444 (class Incremental_library): New class.
3445 * layout.cc (Free_list::num_lists): New static data member.
3446 (Free_list::num_nodes): New static data member.
3447 (Free_list::num_removes): New static data member.
3448 (Free_list::num_remove_visits): New static data member.
3449 (Free_list::num_allocates): New static data member.
3450 (Free_list::num_allocate_visits): New static data member.
3451 (Free_list::init): New function.
3452 (Free_list::remove): New function.
3453 (Free_list::allocate): New function.
3454 (Free_list::dump): New function.
3455 (Free_list::print_stats): New function.
3456 (Layout_task_runner::run): Resize output file for incremental updates.
3457 (Layout::Layout): Initialize new data members.
3458 (Layout::set_incremental_base): New function.
3459 (Layout::init_fixed_output_section): New function.
3460 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3461 incremental updates.
3462 (Layout::create_gold_note): Do not create gold note section for
3463 incremental updates.
3464 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3465 for incremental updates.
3466 (Layout::set_section_offsets): For incremental updates, allocate space
3468 (Layout::create_symtab_sections): Layout with offsets relative to
3469 start of section; for incremental updates, allocate space from free
3471 (Layout::create_shdrs): For incremental updates, allocate space from
3473 (Layout::finish_dynamic_section): For incremental updates, do not
3474 check --as-needed (fixed in subsequent patch).
3475 * layout.h (class Free_list): New class.
3476 (Layout::set_incremental_base): New function.
3477 (Layout::incremental_base): New function.
3478 (Layout::init_fixed_output_section): New function.
3479 (Layout::allocate): New function.
3480 (Layout::incremental_base_): New data member.
3481 (Layout::free_list_): New data member.
3482 * main.cc (main): Print Free_list statistics.
3483 * object.cc (Relobj::finalize_incremental_relocs): Add
3484 clear_counts parameter; clear counts only when clear_counts is set.
3485 (Sized_relobj::Sized_relobj): Initialize new base class.
3486 (Sized_relobj::do_layout): Don't report special sections.
3487 (Sized_relobj::do_for_all_local_got_entries): New function.
3488 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3489 symtab_off to all symbol table offsets.
3490 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3491 * object.h (class Got_offset_list): Move to top of file.
3492 (Object::Object): Allow case where input_file == NULL.
3493 (Object::~Object): Likewise.
3494 (Object::input_file): Assert that input_file != NULL.
3495 (Object::lock): Allow case where input_file == NULL.
3496 (Object::unlock): Likewise.
3497 (Object::is_locked): Likewise.
3498 (Object::token): Likewise.
3499 (Object::release): Likewise.
3500 (Object::is_incremental): New function.
3501 (Object::get_mtime): New function.
3502 (Object::for_all_local_got_entries): New function.
3503 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3504 (Object::set_is_in_system_directory): New function.
3505 (Object::is_in_system_directory): New function.
3506 (Object::do_is_incremental): New function.
3507 (Object::do_get_mtime): New function.
3508 (Object::do_for_all_local_got_entries): New function.
3509 (Object::is_in_system_directory_): New data member.
3510 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3511 (class Sized_relobj_base): New class.
3512 (class Sized_relobj): Derive from Sized_relobj_base.
3513 (class Sized_relobj::Symbols): Redeclare from base class.
3514 (class Sized_relobj::local_got_offset_list): Remove.
3515 (class Sized_relobj::Output_sections): Redeclare from base class.
3516 (class Sized_relobj::do_for_all_local_got_entries): New function.
3517 (class Sized_relobj::write_local_symbols): Add offset parameter.
3518 (class Sized_relobj::local_symbol_offset_): Update comment.
3519 (class Sized_relobj::local_dynsym_offset_): Update comment.
3520 * options.cc (Input_arguments::add_file): Remove const.
3521 * options.h (Input_file_argument::Input_file_argument):
3522 Initialize arg_serial_ (all constructors).
3523 (Input_file_argument::set_arg_serial): New function.
3524 (Input_file_argument::arg_serial): New function.
3525 (Input_file_argument::arg_serial_): New data member.
3526 (Input_arguments::Input_arguments): Initialize file_count_.
3527 (Input_arguments::add_file): Remove const.
3528 (Input_arguments::number_of_input_files): New function.
3529 (Input_arguments::file_count_): New data member.
3530 (Command_line::number_of_input_files): Call
3531 Input_arguments::number_of_input_files.
3532 * output.cc (Output_segment_headers::Output_segment_headers):
3534 (Output_section::Input_section::current_data_size): New function.
3535 (Output_section::Output_section): Initialize new data members.
3536 (Output_section::add_input_section): Don't do merge sections for
3537 an incremental link; allocate space from free list for an
3539 (Output_section::add_output_section_data): Allocate space from
3540 free list for an incremental update.
3541 (Output_section::update_data_size): New function.
3542 (Output_section::set_fixed_layout): New function.
3543 (Output_section::reserve): New function.
3544 (Output_segment::set_section_addresses): Remove const.
3545 (Output_segment::set_section_list_addresses): Remove const; allocate
3546 space from free list for an incremental update.
3547 (Output_segment::set_offset): Adjust size of RELRO segment for an
3549 * output.h (Output_data::current_data_size): Move here from
3551 (Output_data::pre_finalize_data_size): New function.
3552 (Output_data::update_data_size): New function.
3553 (Output_section_headers::update_data_size): new function.
3554 (Output_section_data_build::current_data_size): Move to Output_data.
3555 (Output_data_strtab::update_data_size): New function.
3556 (Output_section::current_data_size): Move to Output_data.
3557 (Output_section::set_fixed_layout): New function.
3558 (Output_section::has_fixed_layout): New function.
3559 (Output_section::reserve): New function.
3560 (Output_section::update_data_size): New function.
3561 (Output_section::has_fixed_layout_): New data member.
3562 (Output_section::free_list_): New data member.
3563 (Output_segment::set_section_addresses): Remove const.
3564 (Output_segment::set_section_list_addresses): Remove const.
3565 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3567 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3569 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3570 parameter when calling Add_symbols constructor; store argument
3571 serial number for members of a lib group.
3572 (Add_symbols::locks): Allow case where token == NULL.
3573 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3574 (Read_member::~Read_member): New function.
3575 (Read_member::is_runnable): New function.
3576 (Read_member::locks): New function.
3577 (Read_member::run): New function.
3578 (Check_script::~Check_script): New function.
3579 (Check_script::is_runnable): New function.
3580 (Check_script::locks): New function.
3581 (Check_script::run): New function.
3582 (Check_library::~Check_library): New function.
3583 (Check_library::is_runnable): New function.
3584 (Check_library::locks): New function.
3585 (Check_library::run): New function.
3586 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3587 (Add_symbols::library_): New data member.
3588 (class Read_member): New class.
3589 (class Check_script): New class.
3590 (class Check_library): New class.
3591 * reloc.cc (Read_relocs::is_runnable): Allow case where
3593 (Read_relocs::locks): Likewise.
3594 (Scan_relocs::locks): Likewise.
3595 (Relocate_task::locks): Likewise.
3596 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3598 (Sized_relobj::incremental_relocs_scan): Fix comment.
3599 (Sized_relobj::do_relocate): Pass output file offset to
3600 write_local_symbols.
3601 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3602 from class declaration.
3603 * script.cc (read_input_script): Allocate Script_info; pass
3604 argument serial number to report_script.
3605 * script.h (class Script_info): Move to incremental.h.
3606 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3607 * symtab.h (Symbol_table::add_from_incrobj): New function.
3608 (Symbol_table::set_file_offset): New function.
3610 2011-04-05 Cary Coutant <ccoutant@google.com>
3612 * incremental-dump.cc (dump_incremental_inputs): Change signature
3613 to take a Sized_incremental_binary; change caller. Use readers
3614 in Sized_incremental_binary.
3616 (Sized_incremental_binary::find_incremental_inputs_sections):
3617 Rename do_find_incremental_inputs_sections to this.
3618 (Sized_incremental_binary::setup_readers): New function.
3619 (Sized_incremental_binary::do_check_inputs): Check
3620 has_incremental_info_ flag; move setup code to setup_readers;
3622 (Sized_incremental_binary::do_file_is_unchanged): New function.
3623 (Sized_incremental_binary::do_get_input_reader): New function.
3624 * incremental.h (class Incremental_binary): Move to end of file.
3625 (Incremental_binary::file_is_unchanged): New function.
3626 (Incremental_binary::do_file_is_unchanged): New function.
3627 (Incremental_binary::Input_reader): New class.
3628 (Incremental_binary::get_input_reader): New function.
3629 (class Sized_incremental_binary): Move to end of file.
3630 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3631 input section reader classes.
3632 (Sized_incremental_binary::has_incremental_info): New function.
3633 (Sized_incremental_binary::inputs_reader): New function.
3634 (Sized_incremental_binary::symtab_reader): New function.
3635 (Sized_incremental_binary::relocs_reader): New function.
3636 (Sized_incremental_binary::got_plt_reader): New function.
3637 (Sized_incremental_binary::do_file_is_unchanged): New function.
3638 (Sized_incremental_binary::Sized_input_reader): New class.
3639 (Sized_incremental_binary::get_input_reader): New function.
3640 (Sized_incremental_binary::find_incremental_inputs_sections):
3641 Rename do_find_incremental_inputs_sections to this.
3642 (Sized_incremental_binary::setup_readers): New function.
3643 (Sized_incremental_binary::has_incremental_info_): New data member.
3644 (Sized_incremental_binary::inputs_reader_): New data member.
3645 (Sized_incremental_binary::symtab_reader_): New data member.
3646 (Sized_incremental_binary::relocs_reader_): New data member.
3647 (Sized_incremental_binary::got_plt_reader_): New data member.
3648 (Sized_incremental_binary::current_input_file_): New data member.
3650 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3653 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3656 2011-03-30 Cary Coutant <ccoutant@google.com>
3658 * archive.cc (Archive::include_member): Adjust call to report_object.
3659 (Add_archive_symbols::run): Add script_info to call to
3660 report_archive_begin.
3661 (Lib_group::include_member): Adjust call to report_object.
3662 (Add_lib_group_symbols::run): Adjust call to report_object.
3663 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3664 blocks. Add object count for script input files.
3665 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3666 script_info parameter; change all callers.
3667 (Incremental_inputs::report_object): Add script_info parameter;
3669 (Incremental_inputs::report_script): Store backpointer to
3670 incremental info entry.
3671 (Output_section_incremental_inputs::set_final_data_size): Record
3672 additional information for scripts.
3673 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3674 * incremental.h (Incremental_script_entry::add_object): New function.
3675 (Incremental_script_entry::get_object_count): New function.
3676 (Incremental_script_entry::get_object): New function.
3677 (Incremental_script_entry::objects_): New data member; adjust
3679 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3680 (Incremental_inputs::report_object): Add script_info parameter.
3681 (Incremental_inputs_reader::get_object_count): New function.
3682 (Incremental_inputs_reader::get_object_offset): New function.
3683 * options.cc (Input_arguments::add_file): Return reference to
3685 * options.h (Input_argument::set_script_info): New function.
3686 (Input_argument::script_info): New function.
3687 (Input_argument::script_info_): New data member; adjust all
3689 (Input_file_group::add_file): Return reference to new input argument.
3690 (Input_file_lib::add_file): Likewise.
3691 (Input_arguments::add_file): Likewise.
3692 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3693 * script.cc (Parser_closure::Parser_closure): Add script_info
3694 parameter; adjust all callers.
3695 (Parser_closure::script_info): New function.
3696 (Parser_closure::script_info_): New data member.
3697 (read_input_script): Report scripts earlier to incremental info.
3698 (script_add_file): Set script_info in Input_argument.
3699 (script_add_library): Likewise.
3700 * script.h (Script_options::Script_info): Rewrite class.
3702 2011-03-29 Cary Coutant <ccoutant@google.com>
3704 * archive.cc (Library_base::should_include_member): Move
3705 method here from class Archive.
3706 (Archive::Archive): Initialize base class.
3707 (Archive::should_include_member): Move to base class.
3708 (Archive::do_for_all_unused_symbols): New function.
3709 (Add_archive_symbols::run): Remove redundant access to
3711 (Lib_group::Lib_group): Initialize base class.
3712 (Lib_group::do_filename): New function.
3713 (Lib_group::include_member): Pass pointer to Lib_group to
3715 (Lib_group::do_for_all_unused_symbols): New function.
3716 (Add_lib_group_symbols::run): Report archive information for
3718 * archive.h (class Library_base): New base class.
3719 (class Archive): Derive from Library_base.
3720 (Archive::filename): Move to base class.
3721 (Archive::set_incremental_info): Likewise.
3722 (Archive::incremental_info): Likewise.
3723 (Archive::Should_include): Likewise.
3724 (Archive::should_include_member): Likewise.
3725 (Archive::Armap_entry): Remove.
3726 (Archive::Unused_symbol_iterator): Remove.
3727 (Archive::unused_symbols_begin): Remove.
3728 (Archive::unused_symbols_end): Remove.
3729 (Archive::do_filename): New function.
3730 (Archive::do_get_mtime): New function.
3731 (Archive::do_for_all_unused_symbols): New function.
3732 (Archive::task_): Move to base class.
3733 (Archive::incremental_info_): Likewise.
3734 (class Lib_group): Derive from Library_base.
3735 (Lib_group::do_filename): New function.
3736 (Lib_group::do_get_mtime): New function.
3737 (Lib_group::do_for_all_unused_symbols): New function.
3738 (Lib_group::task_): Move to base class.
3739 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3741 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3743 * incremental.cc (Incremental_inputs::report_archive_begin):
3744 Use Library_base; call library's get_mtime; add incremental inputs
3745 entry before members.
3746 (class Unused_symbol_visitor): New class.
3747 (Incremental_inputs::report_archive_end): Use Library_base; use
3748 visitor class to record unused symbols; don't add incremental inputs
3749 entry after members.
3750 (Incremental_inputs::report_object): Use Library_base.
3752 (Incremental_archive_entry::Incremental_archive_entry): Remove
3753 unused Archive parameter.
3754 (Incremental_inputs::report_archive_begin): Use Library_base.
3755 (Incremental_inputs::report_archive_end): Likewise.
3756 (Incremental_inputs::report_object): Likewise.
3757 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3759 * object.h (Object::for_all_global_symbols): New function.
3760 (Object::do_for_all_global_symbols): New function.
3761 (Sized_relobj::do_for_all_global_symbols): New function.
3762 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3764 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
3767 2011-03-27 Ian Lance Taylor <iant@google.com>
3769 * archive.cc (Archive::interpret_header): Return -1 if something
3770 goes wrong. Change callers accordingly.
3772 2011-03-25 Cary Coutant <ccoutant@google.com>
3774 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3775 * testsuite/Makefile.in: Regenerate.
3777 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
3779 * plugin.cc (get_view): New.
3780 (Plugin::load): Pass get_view to the plugin.
3781 (Plugin_manager::get_view): New.
3783 2011-03-21 Ian Lance Taylor <iant@google.com>
3785 * testsuite/final_layout.sh: Rewrite to not use dc.
3786 * testsuite/relro_test.sh: Fail if dc is not present.
3788 2011-03-21 Sriraman Tallam <tmsriram@google.com>
3790 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3792 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3793 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3795 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3796 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3798 2011-03-14 Ian Lance Taylor <iant@google.com>
3800 * script-sections.cc (Sort_output_sections::script_compare):
3801 Rename from is_before, change return type.
3802 (Sort_output_sections::operator()): Adjust accordingly.
3804 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
3807 * testsuite/odr_violation2.cc: Add comment to make all error line
3808 numbers double digits.
3809 * testsuite/debug_msg.sh: Adjust expected errors.
3811 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
3813 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3814 but mark earlier ones as non-canonical
3815 (offset_to_iterator): Update search target and example
3816 (do_addr2line): Return extra lines in a vector*
3817 (format_file_lineno): Extract from do_addr2line
3818 (one_addr2line): Add vector* out-param
3819 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3820 when a lineno entry appeared last for its instruction
3821 (Dwarf_line_info): Add vector* out-param
3822 * object.cc (Relocate_info): Pass NULL for the vector* out-param
3823 * symtab.cc (Odr_violation_compare): Include the lineno in the
3825 (linenos_from_loc): New. Combine the canonical line for an
3826 address with its other lines.
3827 (True_if_intersect): New. Helper functor to make
3828 std::set_intersection a query.
3829 (detect_odr_violations): Compare sets of lines instead of just
3830 one line for each function. This became less deterministic, but
3831 has fewer false positives.
3832 * symtab.h: Declarations.
3833 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3834 mix an optimized and non-optimized object in the same binary
3835 (odr_violation2.so): Same.
3836 * testsuite/Makefile.in: Regenerate from Makefile.am.
3837 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3838 * testsuite/debug_msg.sh: Update line numbers and add
3840 * testsuite/odr_violation1.cc: Use OdrDerived, in a
3841 non-optimized context.
3842 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3843 isn't inlined, and use OdrDerived in an optimized context.
3844 * testsuite/odr_header1.h: Defines OdrDerived, where
3845 optimization will change the
3846 first-instruction-in-the-destructor's file and line number.
3847 * testsuite/odr_header2.h: Defines OdrBase.
3849 2011-03-09 Ian Lance Taylor <iant@google.com>
3851 * fileread.cc (File_read::clear_views): Don't delete the whole
3854 2011-03-08 Ian Lance Taylor <iant@google.com>
3857 * fileread.cc: #include <climits>.
3858 (GOLD_IOV_MAX): Define.
3859 (File_read::read_multiple): Limit number of entries by iov_max.
3860 * fileread.h (class File_read): Always set max_readv_entries to
3863 2011-03-07 Ian Lance Taylor <iant@google.com>
3866 * options.h (class General_options): Add -dy and -dn.
3868 2011-03-02 Cary Coutant <ccoutant@google.com>
3870 * testsuite/script_test_9.t: Add TLS segment.
3872 2011-03-02 Simon Baldwin <simonb@google.com>
3874 * configure.ac: Add check for gnu_indirect_function support in
3875 the toolchain building binutils.
3876 * configure: Rebuild.
3878 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
3880 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3881 plugin only symbols.
3882 (Symbol_table::sized_finalize_symbol) Mark symbol only present
3883 in plugin files as not needed in the symbol table.
3885 2011-02-11 Sriraman Tallam <tmsriram@google.com>
3887 * output.cc (Output_section::add_input_section): Delay fill
3888 generation for section ordering.
3890 2011-02-09 Ian Lance Taylor <iant@google.com>
3893 * object.h (class Sized_relobj): Remove clear_local_symbols.
3894 * reloc.cc (Sized_relobj::do_relocate): Don't call
3895 clear_local_symbols.
3897 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
3899 * plugin.cc (is_visible_from_outside): Return true for symbols
3902 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
3904 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3907 2011-02-02 Sriraman Tallam <tmsriram@google.com>
3909 * icf.h (is_section_foldable_candidate): Change type of parameter
3911 * icf.cc (Icf::find_identical_sections): Change type of local variable
3912 section_name to be std::string.
3913 (is_function_ctor_or_dtor): Change type of parameter to std::string.
3915 2011-01-25 Ian Lance Taylor <iant@google.com>
3917 * script.cc (script_add_extern): Rewrite to use
3918 add_symbol_reference.
3920 2011-01-25 Doug Kwan <dougkwan@google.com>
3922 * icf.cc (get_section_contents): Always lock section's object.
3924 2011-01-24 Ian Lance Taylor <iant@google.com>
3926 * options.h (class General_options): Accept
3927 --no-detect-odr-violations.
3929 2011-01-24 Ian Lance Taylor <iant@google.com>
3931 * version.cc (version_string): Bump to 1.11.
3933 2011-01-24 Ian Lance Taylor <iant@google.com>
3935 * plugin.cc (class Plugin_rescan): Define new class.
3936 (Plugin_manager::claim_file): Set any_claimed_.
3937 (Plugin_manager::save_archive): New function.
3938 (Plugin_manager::save_input_group): New function.
3939 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3941 (Plugin_manager::new_undefined_symbol): New function.
3942 (Plugin_manager::rescan): New function.
3943 (Plugin_manager::rescannable_defines): New function.
3944 (Plugin_manager::add_input_file): Set any_added_.
3945 * plugin.h (class Plugin_manager): define new fields rescannable_,
3946 undefined_symbols_, any_claimed_, and any_added_. Declare
3947 Plugin_rescan as friend. Declare new functions.
3948 (Plugin_manager::Rescannable): Define type.
3949 (Plugin_manager::Rescannable_list): Define type.
3950 (Plugin_manager::Undefined_symbol_list): Define type.
3951 (Plugin_manager::Plugin_manager): Initialize new fields.
3952 * archive.cc (Archive::defines_symbol): New function.
3953 (Add_archive_symbols::run): Pass archive to plugins if any.
3954 * archive.h (class Archive): Declare defines_symbol.
3955 * readsyms.cc (Input_group::~Input_group): New function.
3956 (Finish_group::run): Pass input_group to plugins if any.
3957 * readsyms.h (class Input_group): Declare destructor.
3958 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3961 2011-01-10 Ian Lance Taylor <iant@google.com>
3963 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3965 (Layout::set_segment_offsets): Reset increase_relro before calling
3966 set_section_addresses a second time.
3968 2011-01-04 Cary Coutant <ccoutant@google.com>
3970 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3971 sections before NOBITS sections.
3973 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
3975 * version.cc (print_version): Update copyright to 2011.
3977 2010-12-23 Cary Coutant <ccoutant@google.com>
3979 * output.h (Output_data_reloc::add_output_section): Pass OD instead
3980 of OS to this->add. Add OD parameter to second form of the function.
3982 2010-12-20 Ian Lance Taylor <iant@google.com>
3984 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3985 second of two consecutive entries with same offset.
3987 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
3989 * testsuite/Makefile.am (ifuncmain2static_LDADD)
3990 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3991 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3992 to avoid unneeded links against $(LDADD).
3993 * testsuite/Makefile.in: Regenerate.
3995 2010-12-15 Ian Lance Taylor <iant@google.com>
3998 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3999 for R_X86_64_32 and R_X86_64_PC32.
4000 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4001 ver_matching_def_pic.o.
4002 (ver_matching_def_pic.o): New target.
4004 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4006 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4007 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4008 Move definition before File_read::View member definitions.
4009 (File_read::View::~View): Initialize and hold lock before
4010 updating current_mapped_bytes.
4012 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4014 * dwarf_reader.cc: Remove outdated comment.
4015 * gold-threads.cc: Fix typo in error message.
4016 * archive.cc: Fix typos in comments.
4017 * archive.h: Likewise.
4018 * arm-reloc-property.cc: Likewise.
4019 * arm-reloc-property.h: Likewise.
4020 * arm-reloc.def: Likewise.
4022 * attributes.h: Likewise.
4023 * cref.cc: Likewise.
4024 * ehframe.cc: Likewise.
4025 * fileread.h: Likewise.
4027 * i386.cc: Likewise.
4029 * incremental.h: Likewise.
4030 * int_encoding.cc: Likewise.
4031 * layout.h: Likewise.
4032 * main.cc: Likewise.
4033 * merge.h: Likewise.
4034 * object.cc: Likewise.
4035 * object.h: Likewise.
4036 * options.cc: Likewise.
4037 * readsyms.cc: Likewise.
4038 * reduced_debug_output.cc: Likewise.
4039 * reloc.cc: Likewise.
4040 * script-sections.cc: Likewise.
4041 * sparc.cc: Likewise.
4042 * symtab.h: Likewise.
4043 * target-reloc.h: Likewise.
4044 * target.cc: Likewise.
4045 * target.h: Likewise.
4046 * timer.cc: Likewise.
4047 * timer.h: Likewise.
4048 * x86_64.cc: Likewise.
4050 2010-12-09 Cary Coutant <ccoutant@google.com>
4052 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4054 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4055 parameter; change all callers.
4056 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4057 * options.h (warn_execstack): New option.
4059 2010-12-07 Doug Kwan <dougkwan@google.com>
4061 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4062 like function call relocations.
4064 2010-12-07 Ian Lance Taylor <iant@google.com>
4066 * archive.cc (Archive::get_elf_object_for_member): Permit
4067 punconfigured to be NULL.
4068 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4069 (Archive::include_member): Pass NULL to get_elf_object_for_member
4070 if we searched for the archive and this is the first included
4073 2010-12-01 Ian Lance Taylor <iant@google.com>
4075 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4076 track_relocs_type_ field.
4077 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4078 Set track_relocs_type_.
4079 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4080 contents when using RELA relocs.
4081 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4083 * reloc.cc (Track_relocs::next_addend): New function.
4084 * reloc.h (class Track_relocs): Declare next_addend.
4086 2010-12-01 Ian Lance Taylor <iant@google.com>
4088 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4091 2010-12-01 Ian Lance Taylor <iant@google.com>
4093 * README: Update compilers known to work and fail.
4095 2010-11-23 Matthias Klose <doko@ubuntu.com>
4097 * configure.in: For --enable-gold, handle value `default' instead of
4098 `both*'. Always install ld as ld.bfd, install as ld if gold is
4100 * configure: Regenerate.
4102 2010-11-18 Doug Kwan <dougkwan@google.com>
4104 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4105 and right_alignment to be zero. Store result alignment only if it is
4106 greater than existing alignment.
4108 2010-11-16 Cary Coutant <ccoutant@google.com>
4111 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4112 Check for ".zdebug_line".
4114 2010-11-16 Doug Kwan <dougkwan@google.com>
4115 Cary Coutant <ccoutant@google.com>
4117 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4118 by reference; adjust all callers.
4119 * output.cc (Output_segment::set_section_addresses): Adjust references
4120 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4122 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4123 end at page boundary.
4125 2010-11-16 Cary Coutant <ccoutant@google.com>
4128 * layout.cc (Layout::choose_output_section): Transform names of
4129 compressed sections even when using a script with a SECTIONS clause.
4130 (Layout::output_section_name): Remove code to transform
4131 compressed debug section names.
4132 * output.cc (Output_section::add_input_section): Use uncompressed
4133 section size when tracking input sections.
4135 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4137 * symtab.h (Symbol::NON_PIC_REF): Remove.
4138 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4139 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4140 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4141 (Symbol::use_plt_offset): Take a flags argument and pass it
4142 directly to needs_dynamic_reloc. Restrict check for undefined
4143 weak symbols to function calls.
4144 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4145 (Target_arm::Scan::global): Use it.
4146 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4147 (Target_arm::Relocate::relocate): Likewise.
4148 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4149 parameter with an r_type parameter. Use get_reference_flags
4151 (Target_arm::Relocate::relocate): Update accordingly.
4152 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4153 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4154 (Target_i386::Scan::global): Likewise.
4155 (Target_i386::Relocate::relocate): Likewise.
4156 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4157 parameter with an r_type parameter. Use get_reference_flags
4159 (Target_i386::Relocate::relocate): Update accordingly.
4160 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4161 (Target_powerpc::Scan::global): Use it.
4162 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4163 (Target_powerpc::Relocate::relocate): Likewise.
4164 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4165 (Target_sparc::Scan::global): Use it.
4166 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4167 (Target_sparc::Relocate::relocate): Likewise.
4168 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4169 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4170 (Target_x86_64::Scan::global): Likewise.
4171 (Target_x86_64::Relocate::relocate): Likewise.
4173 2010-11-08 Doug Kwan <dougkwan@google.com>
4174 Cary Coutant <ccoutant@google.com>
4176 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4177 (Arm_exidx_merge_section::section_contents_): New data member.
4178 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4179 (Arm_input_section::~Arm_input_section): De-allocate memory.
4180 (Arm_input_section::original_contents_): New data member.
4181 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4182 in parameters instead of calling Object::section_contents without
4184 (Arm_output_section::group_section): New parameter TASK. Pass it
4185 to callees that need locking objects.
4186 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4187 to lock EXIDX input sections. Fix a formatting issue. Call
4188 Arm_exidx_merged_section::build_contents to create merged section
4190 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4191 to lock object of stub table owner.
4192 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4193 TEXT_SIZE to initialize data member TEXT_SIZE_.
4194 (Arm_exidx_input_section::addralign): Fix typo in comment.
4195 (Arm_exidx_input_section::text_size): New method.
4196 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4197 that require locking objects. Lock objects before scanning for stubs
4198 and updating local symbols.
4199 (Arm_input_section<big_endian>::init): Copy contents of original
4201 (Arm_input_section<big_endian>::do_write): Use saved contents of
4202 original input section instead of calling Object::section_contents
4204 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4205 size without calling Object::section_size().
4206 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4207 for size. Allocate a buffer for merged EXIDX entries.
4208 (Arm_exidx_merged_section::build_contents): New method.
4209 (Arm_exidx_merged_section::do_write): Move merge section contents
4210 building code to Arm_exidx_merged_section::build_contetns. Write
4211 out contetns in buffer instead of building it on the fly.
4212 (Arm_relobj::make_exidx_input_section): Also pass text section size
4213 to Arm_exidx_input_section constructor.
4214 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4215 (Arm_dynobj::do_read_symbols): Fix memory leak.
4216 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4217 * target.h: (class Task): Add forward declaration.
4218 (Target::relax): Add new parameter TASK and pass it to
4220 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4222 2010-11-05 Cary Coutant <ccoutant@google.com>
4225 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4226 object when reading from the file.
4227 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4229 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4230 when reading section contents.
4231 (get_section_contents): Likewise.
4232 (icf::find_identical_sections): Likewise.
4233 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4234 object when reading from the file.
4235 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4236 the object when doing deferred section layout.
4238 2010-11-03 Nick Clifton <nickc@redhat.com>
4241 * script.h (class Symbol_assignment: name): New member. Returns
4242 the name of the symbol.
4243 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4244 Returns true if the given symbol name is on the list of
4245 assignments wating to be processed.
4246 * archive.cc (should_incldue_member): If the symbol is undefined,
4247 check to see if it is on the list of symbols pending assignment.
4249 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4251 * script-sections.cc (Script_sections::find_memory_region): Check
4252 for a NULL output section pointer.
4254 2010-10-29 Doug Kwan <dougkwan@google.com>
4256 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4257 Output_section::add_relaxed_input_section.
4258 * output.cc (Output_section::add_relaxed_input_section): Add new
4259 arguments LAYOUT and NAME. Set section order index.
4260 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4261 Copy section order index.
4262 * output.h (Output_section::add_relaxed_input_section): Add new
4263 arguments LAYOUT and NAME.
4265 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4267 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4268 NATIVE_OR_CROSS_LINKER.
4269 * testsuite/Makefile.in: Regenerate.
4271 2010-10-20 Doug Kwan <dougkwan@google.com>
4273 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4274 without SHF_LINK_ORDER flags.
4275 * layout.cc (Layout::choose_output_section): Do not filter
4276 SHF_LINK_ORDER flag in a relocatable link.
4278 2010-10-17 Cary Coutant <ccoutant@google.com>
4280 * output.h (Output_segment::set_section_addresses): Change function
4281 signature. Update all callers.
4282 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4284 (Output_segment::set_section_addresses): Align after last TLS
4285 section. Add padding before last relro section instead of after.
4287 2010-10-17 Doug Kwan <dougkwan@google.com>
4289 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4290 GOT output section to be writable.
4292 2010-10-14 Cary Coutant <ccoutant@google.com>
4294 * debug.h (DEBUG_INCREMENTAL): New flag.
4295 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4296 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4298 * incremental.cc (report_command_line): Ignore all forms of
4300 * layout.cc (Layout::Layout): Check parameters for incremental link
4302 * options.cc (General_options::parse_incremental): New function.
4303 (General_options::parse_no_incremental): New function.
4304 (General_options::parse_incremental_full): New function.
4305 (General_options::parse_incremental_update): New function.
4306 (General_options::incremental_mode_): New data member.
4307 (General_options::finalize): Check incremental_mode_.
4308 * options.h (General_options): Update help text for --incremental.
4309 Add --no-incremental, --incremental-full, --incremental-update.
4310 (General_options::Incremental_mode): New enum type.
4311 (General_options::incremental_mode): New function.
4312 (General_options::incremental_mode_): New data member.
4313 * parameters.cc (Parameters::incremental_mode_): New data member.
4314 (Parameters::set_options): Set incremental_mode_.
4315 (Parameters::set_incremental_full): New function.
4316 (Parameters::incremental): New function.
4317 (Parameters::incremental_update): New function.
4318 (set_parameters_incremental_full): New function.
4319 * parameters.h (Parameters::set_incremental_full): New function.
4320 (Parameters::incremental): New function.
4321 (Parameters::incremental_update): New function.
4322 (Parameters::incremental_mode_): New data member.
4323 (set_parameters_incremental_full): New function.
4324 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4325 incremental link mode.
4326 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4327 (Sized_relobj::do_relocate_sections): Likewise.
4328 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4330 * testsuite/Makefile.in: Regenerate.
4331 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4333 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4335 * script-sections.h (class Script_sections): Make
4336 Sections_elements typedef public.
4337 * script-sections.cc (class Sort_output_sections): Add elements_
4338 field. Add constructor which sets it; change all callers.
4339 (Sort_output_sections::is_before): New function.
4340 (Sort_output_sections::operator()): Call is_before.
4341 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4343 * testsuite/script_test_10.sh: New test. Test script section
4345 * testsuite/script_test_10.t: Likewise.
4346 * testsuite/script_test_10.s: Likewise.
4347 * testsuite/Makefile.am: Wrap the cross linker tests and the
4348 common tests into NATIVE_OR_CROSS_LINKER.
4349 (check_SCRIPTS): Add script_test_10.sh.
4350 (check_DATA): Add script_test_10.stdout.
4351 (script_test_10.o, script_test_10): New targets.
4352 (script_test_10.stdout): New target.
4353 * configure, testsuite/Makefile.in: Regenerate.
4355 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4357 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4358 error for the deprecated relocations.
4359 (Target_arm::Scan::global): Likewise.
4360 (Target_arm::Relocate::relocate): Likewise.
4362 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4364 * fileread.cc (Input_file::find_file): Initialize *found_name
4365 and *namep when using the fallback search for case 4.
4367 2010-10-11 Cary Coutant <ccoutant@google.com>
4369 * options.h (class General_options): Redefine -z lazy as an alias for
4370 the negation of -z now.
4372 2010-10-11 Ian Lance Taylor <iant@google.com>
4374 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4377 2010-10-06 Nick Clifton <nickc@redhat.com>
4379 * script-sections.cc(class Memory_region): Remove
4380 current_lma_offset_ field. Rename current_vma_offset_ to
4381 current_offset_. Add last_section_ field.
4382 (Memory_region::get_current_vma_address): Rename to
4383 get_current_address.
4384 (Memory_region::get_current_lma_address): Delete.
4385 (Memory_region::increment_vma_offset): Rename to
4387 (Memory_region::increment_lma_offset): Delete.
4388 (Memory_region::attributes_compatible): New method. Returns
4389 true if the provided section is compatible with the region.
4390 (Memory_region::get_last_section): New method. Returns the last
4391 section to use the region.
4392 (Memory_region::set_last_section): New method. Stores the last
4393 section to use the region.
4394 (Script_sections::block_in_region): New method. Returns true if
4395 a block of memory is contained within a region.
4396 (Script_sections::find_memory_region): New method. Locates a
4397 memory region to be used to set a VMA or LMA address.
4398 (Output_section_definition::set_section_addresses): Add code to
4399 check for addresses set by memory regions.
4400 (Output_segment::set_section_addresses): Remove memory region
4402 (Script_sections::create_segment): Add a warning if a header
4403 segment is created outside of any region.
4404 * script-sections.h (class Script_sections): Add prototypes for
4405 find_memory_region and block_in_region methods.
4406 * testsuite/memory_test.s: Use .long instead of .word.
4407 * testsuite/memory_test.t: Add some more output sections.
4408 * testsuite/memory_test.sh: Update expected output.
4410 2010-10-02 Doug Kwan <dougkwan@google.com>
4412 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4413 defintion to symtab.h
4414 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4415 declaration to defintion.
4417 2010-10-01 Nick Clifton <nickc@redhat.com>
4419 * expression.cc (eval): Replace dummy argument with NULL.
4420 (eval_maybe_dot): Check for a NULL result section pointer.
4421 (Symbol_expression::value): Likewise.
4422 (Dot_expression::value): Likewise.
4423 (BINARY_EXPRESSION): Likewise.
4424 (Max_expression::value): Likewise.
4425 (Min_expression::value): Likewise.
4426 (Absolute_expression::value): Likewise.
4427 (Addr_expression::value_from_output_section): Likewise.
4428 (Loaddddr_expression::value_from_output_section): Likewise.
4429 (Segment_start_expression::value): Likewise.
4430 * script-sections.cc
4431 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4433 (Sections_elememt_dot_assignment::set_section_addresses):
4435 (Output_data_expression::do_write_to_buffer): Likewise.
4436 (Output_section_definition::finalize_symbols): Likewise.
4437 (Output_section_definition::set_section_addresses): Likewise.
4439 2010-09-30 Doug Kwan <dougkwan@google.com>
4441 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4443 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4445 * target.h (Target::can_icf_inline_merge_sections): New virtual
4447 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4449 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4451 * icf.cc (get_section_contents): Inline merge sections only when
4454 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4456 * configure: Regenerate.
4458 2010-09-17 Ian Lance Taylor <iant@google.com>
4460 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4461 * testsuite/Makefile.am (memory_test.o): New target.
4462 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4464 * testsuite/Makefile.in: Rebuild.
4466 2010-09-17 Doug Kwan <dougkwan@google.com>
4468 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4469 defintion if relocation uses GOT entries of the symbol.
4470 * testsuite/icf_safe_test.sh: Fix test.
4471 * testsuite/icf_safe_so_test.sh: Fix test.
4473 2010-09-16 Cary Coutant <ccoutant@google.com>
4475 * script_sections.cc (class Memory_region): Remove "NULL" from
4476 vector initializations.
4478 2010-09-15 Cary Coutant <ccoutant@google.com>
4480 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4481 Resolve forwarding symbols.
4483 2010-09-15 Doug Kwan <dougkwan@google.com>
4485 * gold/testsuite/script_test_3.t: Add ARM special sections.
4486 * gold/testsuite/script_test_4.t: Same.
4487 * gold/testsuite/script_test_5.t: Same.
4488 * gold/testsuite/script_test_6.t: Same.
4489 * gold/testsuite/script_test_7.t: Same.
4490 * gold/testsuite/script_test_7.t: Same.
4491 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4493 2010-09-14 Cary Coutant <ccoutant@google.com>
4495 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4496 (Target_x86_64::Relocate::relocate_tls): Replace check for
4497 saw_tls_block_reloc_ with test for executable section.
4499 2010-09-12 Cary Coutant <ccoutant@google.com>
4501 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4502 position-independent executables to shared libraries need dynamic
4504 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4505 position-independent executables.
4506 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4507 * testsuite/Makefile.in: Regenerate.
4509 2010-09-10 Nick Clifton <nickc@redhat.com>
4512 * testsuite/memory_test.t: Discard any sections that are not
4515 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4518 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4519 "This::" to work around a bug in gcc 4.2.
4521 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4523 2010-09-09 Rafael Espindola <espindola@google.com>
4525 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4526 sections with different PF_X flags in the same segment.
4527 (Layout::find_first_load_seg): Search all segments to find the first
4529 * options.h (rosegment): New.
4531 2010-09-08 Rafael Espindola <espindola@google.com>
4533 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4535 2010-09-08 Doug Kwan <dougkwan@google.com>
4537 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4538 (Arm_relobj::do_relocate_sections): Add new parameter for output
4539 file to match the parent.
4540 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4541 of local symbols instead of input values. Update code to track
4542 changes in gold::relocate_section.
4543 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4544 (Sized_relobj::compute_final_local_value_internal): New methods.
4545 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4546 body into private version of Sized_relobj::compute_final_local_value.
4547 Call the inline method.
4548 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4549 merged symbol value if there is one.
4550 (Symbol_value::has_output_value): New method defintiion.
4551 (Sized_relobj::Compute_final_local_value_status): New enum type.
4552 (Sized_relobj::compute_final_local_value): New methods.
4553 (Sized_relobj::compute_final_local_value_internal): New methods.
4554 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4555 and arm_cortex_a8.sh.
4556 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4557 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4559 * Makefile.in: Regenerate.
4560 * testsuite/arm_bl_out_of_range.s: Update test.
4561 * testsuite/thumb_bl_out_of_range.s: Ditto.
4562 * testsuite/thumb_blx_out_of_range.s: Ditto.
4563 * testsuite/arm_branch_out_of_range.sh: New file.
4564 * testsuite/arm_cortex_a8.sh: Ditto.
4565 * testsuite/arm_cortex_a8_b.s: Ditto.
4566 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4567 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4568 * testsuite/arm_cortex_a8_bl.s: Ditto.
4569 * testsuite/arm_cortex_a8_blx.s: Ditto.
4570 * testsuite/arm_cortex_a8_local.s: Ditto.
4571 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4572 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4574 2010-09-08 Rafael Espindola <espindola@google.com>
4576 * Makefile.am (memory_test.stdout): Run readelf with -W.
4577 * Makefile.in: Regenerate.
4578 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4581 2010-09-08 Rafael Espindola <espindola@google.com>
4583 * script-sections.cc (Script_sections::add_memory_region): Convert
4584 field precision to int.
4585 * script.cc (script_set_section_region, script_set_section_region):
4586 Convert field precision to int.
4588 2010-09-08 Rafael Espindola <espindola@google.com>
4590 * arm.cc (do_finalize_sections): Create the __exidx_start and
4591 __exdix_end symbols even when the section is missing.
4593 2010-09-08 Nick Clifton <nickc@redhat.com>
4595 * README: Remove claim that MEMORY is not supported.
4596 * expression.cc (script_exp_function_origin)
4597 (script_exp_function_length): Move from here to ...
4598 * script.cc: ... here.
4599 (script_set_section_region, script_add_memory)
4600 (script_parse_memory_attr, script_include_directive): New
4602 * script-sections.cc
4603 (class Memory_region): New class.
4604 (class Output_section_definition): Add set_memory_region,
4605 set_section_vma, set_section_lma and get_section_name methods.
4606 (class Script_Sections): Add add_memory_region,
4607 find_memory_region, find_memory_region_origin,
4608 find_memory_region_length and set_memory_region methods.
4609 Have set_section_addresses method walk the list of set memory
4611 Extend the print methos to display memory regions.
4612 * script-sections.h: Add prototypes for new methods.
4613 Add enum for MEMORY region attributes.
4614 * yyscript.y: Add support for parsing MEMORY regions.
4615 * script-c.h: Add prototypes for new functions.
4616 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4617 * testsuite/Makefile.in: Regenerate.
4618 * testsuite/memory_test.sh: New script.
4619 * testsuite/memory_test.s: New assembler source file.
4620 * testsuite/memory_test.t: New linker script.
4622 2010-08-27 Doug Kwan <dougkwan@google.com>
4624 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4625 reference override an existing dynamic weak reference.
4626 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4627 * testsuite/Makefile.in: Regenerate.
4628 * testsuite/dyn_weak_ref.sh: New file.
4629 * testsuite/dyn_weak_ref_1.c: Ditto.
4630 * testsuite/dyn_weak_ref_2.c: Ditto.
4632 2010-08-27 Ian Lance Taylor <iant@google.com>
4634 * incremental.h (class Incremental_input_entry): Add virtual
4637 2010-08-27 Ian Lance Taylor <iant@google.com>
4639 * testsuite/start_lib_test_3.c: Mark t3 as used.
4641 2010-08-27 Nick Clifton <nickc@redhat.com>
4643 * options.cc (version_script): Fix small typo in previous
4646 2010-08-25 Nick Clifton <nickc@redhat.com>
4648 * archive.cc: Formatting fixes: Remove whitespace between
4649 typename and following asterisk. Remove whitespace between
4650 function name and opening parenthesis.
4651 * archive.h: Likewise.
4653 * attributes.cc: Likewise.
4654 * attributes.h: Likewise.
4655 * common.cc: Likewise.
4656 * copy-relocs.cc: Likewise.
4657 * dirsearch.h: Likewise.
4658 * dynobj.cc: Likewise.
4659 * ehframe.cc: Likewise.
4660 * ehframe.h: Likewise.
4661 * expression.cc: Likewise.
4662 * fileread.cc: Likewise.
4663 * fileread.h: Likewise.
4665 * gold-threads.cc: Likewise.
4666 * gold.cc: Likewise.
4667 * i386.cc: Likewise.
4669 * incremental-dump.cc: Likewise.
4670 * incremental.cc: Likewise.
4671 * layout.cc: Likewise.
4672 * layout.h: Likewise.
4673 * main.cc: Likewise.
4674 * merge.cc: Likewise.
4675 * merge.h: Likewise.
4676 * object.cc: Likewise.
4677 * object.h: Likewise.
4678 * options.cc: Likewise.
4679 * options.h: Likewise.
4680 * output.cc: Likewise.
4681 * output.h: Likewise.
4682 * plugin.cc: Likewise.
4683 * plugin.h: Likewise.
4684 * powerpc.cc: Likewise.
4685 * reloc.cc: Likewise.
4686 * script-c.h: Likewise.
4687 * script-sections.cc: Likewise.
4688 * script.cc: Likewise.
4689 * stringpool.cc: Likewise.
4690 * symtab.cc: Likewise.
4691 * symtab.h: Likewise.
4692 * target.cc: Likewise.
4693 * timer.cc: Likewise.
4694 * timer.h: Likewise.
4695 * version.cc: Likewise.
4696 * x86_64.cc: Likewise.
4698 2010-08-24 Nick Clifton <nickc@redhat.com>
4701 * layout.cc (segment_precedes): Sort segments by their physical
4702 addresses, if they have been set.
4704 2010-08-23 Cary Coutant <ccoutant@google.com>
4706 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4708 (Lib_group::include_member): Unlock object after deleting its
4710 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4713 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4714 Cary Coutant <ccoutant@google.com>
4716 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4717 constructor, and set_blocker.
4718 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4720 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4721 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4722 * testsuite/Makefile.am (start_lib_test): New test case.
4723 * testsuite/Makefile.in: Regenerate.
4724 * testsuite/start_lib_test_main.c: New file.
4725 * testsuite/start_lib_test_1.c: New file.
4726 * testsuite/start_lib_test_2.c: New file.
4727 * testsuite/start_lib_test_3.c: New file.
4729 2010-08-19 Ian Lance Taylor <iant@google.com>
4731 * Makefile.in: Rebuild with automake 1.11.1.
4732 * aclocal.m4: Likewise.
4733 * testsuite/Makefile.in: Likewise.
4735 2010-08-19 Ian Lance Taylor <iant@google.com>
4738 * i386.cc (class Output_data_plt_i386): Update declarations.
4739 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4740 local_ifuncs_ fields.
4741 (Target_i386::do_plt_section_for_global): New function.
4742 (Target_i386::do_plt_section_for_local): New function.
4743 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4744 parameter; change all callers. Initialize global_ifuncs_ and
4745 local_ifuncs_. If doing a static link define __rel_iplt_start and
4747 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4748 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4749 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4751 (Target_i386::make_plt_section): New function, broken out of
4752 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4753 (Target_i386::make_plt_entry): Call make_plt_section.
4754 (Target_i386::make_local_ifunc_plt_entry): New function.
4755 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4756 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4757 R_386_IRELATIVE to switch.
4758 (Target_i386::Scan::global): Likewise.
4759 (Target_i386::Relocate::relocate): Likewise.
4760 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4762 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4763 (Target_x86_64::do_plt_section_for_global): New function.
4764 (Target_x86_64::do_plt_section_for_local): New function.
4765 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4766 parameter; change all callers. If doing a static link define
4767 __rela_iplt_start and __rela_iplt_end.
4768 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4769 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4770 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4772 (Target_x86_64::make_local_ifunc_plt_entry): New function.
4773 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4775 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4776 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
4777 R_X86_64_IRELATIVE to switch.
4778 (Target_x86_64::Scan::global): Likewise.
4779 (Target_x86_64::Relocate::relocate): Likewise.
4780 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4782 * target.h (class Target): Add plt_section_for_global and
4783 plt_section_for_local functions. Add do_plt_section_for_global
4784 and do_plt_section_for_local virtual functions.
4785 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
4786 clarifying comments.
4787 (Symbol::use_plt_offset): Handle IFUNC symbol.
4788 * object.cc (Sized_relobj::Sized_relobj): Initialize
4790 (Sized_relobj::local_has_plt_offset): New function.
4791 (Sized_relobj::local_plt_offset): New function.
4792 (Sized_relobj::set_local_plt_offset): New function.
4793 (Sized_relobj::do_count): Handle IFUNC symbol.
4794 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
4795 a bit away from input_shndx_ field. Add set_is_func_symbol and
4796 is_ifunc_symbol functions.
4797 (class Sized_relobj): Update declarations. Remove Tls_got_entry
4798 and Local_tls_got_offsets. Define Local_plt_offsets. Add
4799 local_plt_offsets_ field.
4800 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4801 * output.h (class Output_section_data): Add non-const
4802 output_section function.
4803 (class Output_data_got): Update declarations.
4804 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4805 Add use_plt_offset parameter to global and local constructors.
4806 Change all callers. Change local_sym_index_ field to 31 bits.
4807 Change GSYM_CODE and CONSTANT_CODE accordingly.
4808 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4809 doing a static link don't set sh_link field.
4810 (Output_data_got::Got_entry::write): Use PLT offset if
4812 (Output_data_got::add_global_plt): New function.
4813 (Output_data_got::add_local_plt): New function.
4814 * target-reloc.h (relocate_section): Handle IFUNC symbol.
4815 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4816 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4817 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4818 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4820 * testsuite/ifunc-sel.h: New file.
4821 * testsuite/ifuncmain1.c: New file.
4822 * testsuite/ifuncmain1vis.c: New file.
4823 * testsuite/ifuncmod1.c: New file.
4824 * testsuite/ifuncdep2.c: New file.
4825 * testsuite/ifuncmain2.c: New file.
4826 * testsuite/ifuncmain3.c: New file.
4827 * testsuite/ifuncmod3.c: New file.
4828 * testsuite/ifuncmain4.c: New file.
4829 * testsuite/ifuncmain5.c: New file.
4830 * testsuite/ifuncmod5.c: New file.
4831 * testsuite/ifuncmain6pie.c: New file.
4832 * testsuite/ifuncmod6.c: New file.
4833 * testsuite/ifuncmain7.c: New file.
4834 * configure, testsuite/Makefile.in: Rebuild.
4836 2010-08-18 Ian Lance Taylor <iant@google.com>
4839 (Output_section_incremental_inputs::write_input_files): Add cast
4840 to avoid signed/unsigned comparison warning.
4841 (Output_section_incremental_inputs::write_info_blocks): Likewise.
4843 2010-08-12 Cary Coutant <ccoutant@google.com>
4845 * common.cc (Sort_commons::operator()): Remove unnecessary code.
4847 2010-08-13 Ian Lance Taylor <iant@google.com>
4849 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4851 2010-08-12 Cary Coutant <ccoutant@google.com>
4852 Doug Kwan <dougkwan@google.com>
4854 * resolve.cc (Symbol_table::should_override): When a weak dynamic
4855 defintion overrides non-weak undef, remember that the original undef
4857 * symtab.cc (Symbol_table::sized_write_global): For undef without
4858 an original weak binding, set binding to global in output.
4859 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4860 * testsuite/Makefile.in: Regenerate.
4861 * testsuite/strong_ref_weak_def.sh: New file.
4862 * testsuite/strong_ref_weak_def_1.c: Ditto.
4863 * testsuite/strong_ref_weak_def_2.c: Ditto.
4865 2010-08-12 Cary Coutant <ccoutant@google.com>
4867 * testsuite/incremental_test.sh: Rewrite.
4868 * testsuite/incremental_test_1.c: Rewrite.
4869 * testsuite/incremental_test_2.c: Rewrite.
4871 2010-08-12 Cary Coutant <ccoutant@google.com>
4873 * arm.cc (Target_arm::got_size): Add const.
4874 (Target_arm::got_entry_count): New function.
4875 (Target_arm::plt_entry_count): New function.
4876 (Target_arm::first_plt_entry_offset): New function.
4877 (Target_arm::plt_entry_size): New function.
4878 (Output_data_plt_arm::entry_count): New function.
4879 (Output_data_plt_arm::first_plt_entry_offset): New function.
4880 (Output_data_plt_arm::get_plt_entry_size): New function.
4881 * i386.cc (Target_i386::got_size): Add const.
4882 (Target_i386::got_entry_count): New function.
4883 (Target_i386::plt_entry_count): New function.
4884 (Target_i386::first_plt_entry_offset): New function.
4885 (Target_i386::plt_entry_size): New function.
4886 (Output_data_plt_i386::entry_count): New function.
4887 (Output_data_plt_i386::first_plt_entry_offset): New function.
4888 (Output_data_plt_i386::get_plt_entry_size): New function.
4889 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4890 find_incremental_inputs_sections. Dump incremental_got_plt section.
4891 * incremental.cc: Include target.h.
4892 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4893 parameter. Adjust all callers. Find incremental_got_plt section.
4894 (Incremental_inputs::create_data_sections): Create incremental_got_plt
4896 (Output_section_incremental_inputs::set_final_data_size): Calculate
4897 size of incremental_got_plt section.
4898 (Output_section_incremental_inputs::do_write): Write the
4899 incremental_got_plt section.
4900 (Got_plt_view_info): New struct.
4901 (Local_got_offset_visitor): New class.
4902 (Global_got_offset_visitor): New class.
4903 (Global_symbol_visitor_got_plt): New class.
4904 (Output_section_incremental_inputs::write_got_plt): New function.
4905 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4906 Add parameter. Adjust all callers.
4907 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4908 (Incremental_inputs::got_plt_section): New function.
4909 (Incremental_inputs::got_plt_section_): New data member.
4910 (Incremental_got_plt_reader): New class.
4911 * layout.cc (Layout::create_incremental_info_sections): Add the
4912 incremental_got_plt section.
4913 * object.h (Got_offset_list::get_list): New function.
4914 (Got offset_list::for_all_got_offsets): New function.
4915 (Sized_relobj::local_got_offset_list): New function.
4916 * powerpc.cc (Target_powerpc::got_size): Add const.
4917 (Target_powerpc::got_entry_count): New function.
4918 (Target_powerpc::plt_entry_count): New function.
4919 (Target_powerpc::first_plt_entry_offset): New function.
4920 (Target_powerpc::plt_entry_size): New function.
4921 (Output_data_plt_powerpc::entry_count): New function.
4922 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4923 (Output_data_plt_powerpc::get_plt_entry_size): New function.
4924 * sparc.cc (Target_sparc::got_size): Add const.
4925 (Target_sparc::got_entry_count): New function.
4926 (Target_sparc::plt_entry_count): New function.
4927 (Target_sparc::first_plt_entry_offset): New function.
4928 (Target_sparc::plt_entry_size): New function.
4929 (Output_data_plt_sparc::entry_count): New function.
4930 (Output_data_plt_sparc::first_plt_entry_offset): New function.
4931 (Output_data_plt_sparc::get_plt_entry_size): New function.
4932 * symtab.h (Symbol::got_offset_list): New function.
4933 (Symbol_table::for_all_symbols): New function.
4934 * target.h (Sized_target::got_entry_count): New function.
4935 (Sized_target::plt_entry_count): New function.
4936 (Sized_target::plt_entry_size): New function.
4937 * x86_64.cc (Target_x86_64::got_size): Add const.
4938 (Target_x86_64::got_entry_count): New function.
4939 (Target_x86_64::plt_entry_count): New function.
4940 (Target_x86_64::first_plt_entry_offset): New function.
4941 (Target_x86_64::plt_entry_size): New function.
4942 (Output_data_plt_x86_64::entry_count): New function.
4943 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4944 (Output_data_plt_x86_64::get_plt_entry_size): New function.
4946 2010-08-12 Cary Coutant <ccoutant@google.com>
4948 * archive.cc: Include incremental.h.
4949 (Archive::Archive): Initialize incremental_info_.
4950 (Archive::include_member): Record archive members in incremental info.
4951 (Add_archive_symbols::run): Record begin and end of an archive in
4953 (Lib_group::include_member): Record objects in incremental info.
4954 * archive.h (Incremental_archive_entry): Forward declaration.
4955 (Archive::set_incremental_info): New member function.
4956 (Archive::incremental_info): New member function.
4957 (Archive::Unused_symbol_iterator): New class.
4958 (Archive::unused_symbols_begin): New member function.
4959 (Archive::unused_symbols_end): New member function.
4960 (Archive::incremental_info_): New data member.
4961 * incremental-dump.cc (find_input_containing_global): New function.
4962 (dump_incremental_inputs): Dump new incremental info sections.
4963 * incremental.cc: Include symtab.h.
4964 (Output_section_incremental_inputs): New class.
4965 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4966 new incremental info sections.
4967 (Sized_incremental_binary::do_check_inputs): Likewise.
4968 (Incremental_inputs::report_archive): Remove.
4969 (Incremental_inputs::report_archive_begin): New function.
4970 (Incremental_inputs::report_archive_end): New function.
4971 (Incremental_inputs::report_object): New function.
4972 (Incremental_inputs::finalize_inputs): Remove.
4973 (Incremental_inputs::report_input_section): New function.
4974 (Incremental_inputs::report_script): Rewrite.
4975 (Incremental_inputs::finalize): Do nothing but finalize string table.
4976 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4977 (Incremental_inputs::sized_create_inputs_section_data): Remove.
4978 (Incremental_inputs::create_data_sections): New function.
4979 (Incremental_inputs::relocs_entsize): New function.
4980 (Output_section_incremental_inputs::set_final_data_size): New function.
4981 (Output_section_incremental_inputs::do_write): New function.
4982 (Output_section_incremental_inputs::write_header): New function.
4983 (Output_section_incremental_inputs::write_input_files): New function.
4984 (Output_section_incremental_inputs::write_info_blocks): New function.
4985 (Output_section_incremental_inputs::write_symtab): New function.
4986 * incremental.h (Incremental_script_entry): Forward declaration.
4987 (Incremental_object_entry): Forward declaration.
4988 (Incremental_archive_entry): Forward declaration.
4989 (Incremental_inputs): Forward declaration.
4990 (Incremental_inputs_header_data): Remove.
4991 (Incremental_inputs_header): Remove.
4992 (Incremental_inputs_header_write): Remove.
4993 (Incremental_inputs_entry_data): Remove.
4994 (Incremental_inputs_entry): Remove.
4995 (Incremental_inputs_entry_write): Remove.
4996 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4997 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4998 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4999 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5001 (Incremental_input_entry): New class.
5002 (Incremental_script_entry): New class.
5003 (Incremental_object_entry): New class.
5004 (Incremental_archive_entry): New class.
5005 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5006 (Incremental_inputs::report_inputs): Remove.
5007 (Incremental_inputs::report_archive): Remove.
5008 (Incremental_inputs::report_archive_begin): New function.
5009 (Incremental_inputs::report_archive_end): New function.
5010 (Incremental_inputs::report_object): Change prototype.
5011 (Incremental_inputs::report_input_section): New function.
5012 (Incremental_inputs::report_script): Change prototype.
5013 (Incremental_inputs::get_reloc_count): New function.
5014 (Incremental_inputs::set_reloc_count): New function.
5015 (Incremental_inputs::create_data_sections): New function.
5016 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5017 (Incremental_inputs::inputs_section): New function.
5018 (Incremental_inputs::symtab_section): New function.
5019 (Incremental_inputs::relocs_section): New function.
5020 (Incremental_inputs::get_stringpool): Add const.
5021 (Incremental_inputs::command_line): Add const.
5022 (Incremental_inputs::inputs): Remove.
5023 (Incremental_inputs::command_line_key): New function.
5024 (Incremental_inputs::input_file_count): New function.
5025 (Incremental_inputs::input_files): New function.
5026 (Incremental_inputs::relocs_entsize): New function.
5027 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5028 (Incremental_inputs::finalize_inputs): Remove.
5029 (Incremental_inputs::Input_info): Remove.
5030 (Incremental_inputs::lock_): Remove.
5031 (Incremental_inputs::inputs_): Change type.
5032 (Incremental_inputs::inputs_map_): Remove.
5033 (Incremental_inputs::current_object_entry_): New data member.
5034 (Incremental_inputs::inputs_section_): New data member.
5035 (Incremental_inputs::symtab_section_): New data member.
5036 (Incremental_inputs::relocs_section_): New data member.
5037 (Incremental_inputs::reloc_count_): New data member.
5038 (Incremental_inputs_reader): New class.
5039 (Incremental_symtab_reader): New class.
5040 (Incremental_relocs_reader): New class.
5041 * layout.cc (Layout::finalize): Move finalization of incremental info
5042 and creation of incremental info sections to follow finalization of
5043 symbol table. Set offsets for postprocessing sections.
5044 (Layout::create_incremental_info_sections): Call
5045 Incremental_inputs::create_data_sections. Add incremental symtab
5046 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5047 sections to layout after input sections.
5048 * layout.h (struct Timespec): Forward declaration.
5049 (Layout::incremental_inputs): Add const.
5050 (Layout::create_incremental_info_sections): Add parameter.
5051 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5052 * object.cc: Include incremental.h.
5053 (Relobj::finalize_incremental_relocs): New function.
5054 (Sized_relobj::do_layout): Record input sections in incremental info.
5055 * object.h (Object::output_section): New function.
5056 (Object::output_section_offset): Moved from Relobj.
5057 (Object::get_incremental_reloc_base): New function.
5058 (Object::get_incremental_reloc_count): New function.
5059 (Object::do_output_section): New function.
5060 (Object::do_output_section_offset): Moved from Relobj.
5061 (Object::do_get_incremental_reloc_base): New function.
5062 (Object::do_get_incremental_reloc_count): New function.
5063 (Object::Object): Initialize new data members.
5064 (Relobj::output_section): Renamed do_output_section and moved to
5066 (Relobj::output_section_offset): Moved to Object.
5067 (Relobj::do_get_incremental_reloc_base): New function.
5068 (Relobj::do_get_incremental_reloc_count): New function.
5069 (Relobj::allocate_incremental_reloc_counts): New function.
5070 (Relobj::count_incremental_reloc): New function.
5071 (Relobj::finalize_incremental_relocs): New function.
5072 (Relobj::next_incremental_reloc_index): New function.
5073 (Relobj::reloc_counts_): New data member.
5074 (Relobj::reloc_bases_): New data member.
5075 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5076 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5077 (Sized_relobj::incremental_relocs_scan): New function.
5078 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5079 (Sized_relobj::incremental_relocs_write): New function.
5080 (Sized_relobj::incremental_relocs_write_reltype): New function.
5081 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5083 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5084 archives and object files elsewhere.
5085 (Add_symbols::run): Report object files here.
5086 (Finish_group::run): Report end of archive at end of group.
5087 * reloc.cc: Include layout.h, incremental.h.
5088 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5089 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5090 (Sized_relobj::incremental_relocs_scan): New function.
5091 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5092 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5093 (Sized_relobj::incremental_relocs_write): New function.
5094 (Sized_relobj::incremental_relocs_write_reltype): New function.
5095 * script.cc (read_input_script): Rewrite test for incremental link.
5096 Change call to Incremental_inputs::report_script.
5097 * symtab.h (Symbol_table::first_global_index): New function.
5098 (Symbol_table::output_count): New function.
5100 2010-08-12 Doug Kwan <dougkwan@google.com>
5102 * arm.cc (Target_arm::merge_object_attributes): Check command line
5103 options --no-wchar-size-warning and --no-enum-size-warning.
5104 * options.h (General_options): Add ld-compatible options
5105 --no-enum-size-warning and --no-wchar-size-warning.
5107 2010-08-04 Ian Lance Taylor <iant@google.com>
5109 * x86_64.cc (Target_x86_64::Scan::local): Use
5110 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5111 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5112 (Target_x86_64::Scan::global): Likewise.
5113 (Target_x86_64::Relocate::relocate): Likewise.
5114 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5117 2010-08-03 Cary Coutant <ccoutant@google.com>
5119 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5120 to reserve space in merged_strings vector. Keep total input size
5122 (Output_merge_string::do_print_merge_stats): Print total input size.
5123 * merge.h (Output_merge_string): Add input_size_ field.
5124 * stringpool.cc (Stringpool_template::string_length): Move
5125 implementations out of Stringpool_template class and place in
5127 * stringpool.h (string_length): Move out of Stringpool_template.
5129 2010-08-03 Ian Lance Taylor <iant@google.com>
5132 * layout.cc (relaxation_loop_body): If address of load segment is
5133 set, adjust address to include headers if possible.
5135 2010-08-03 Ian Lance Taylor <iant@google.com>
5137 * version.cc (version_string): Bump to 1.10.
5139 2010-08-03 Ian Lance Taylor <iant@google.com>
5142 * layout.h (enum Output_section_order): Define.
5143 (class Layout): Update declarations.
5144 * layout.cc (Layout::get_output_section): Add order parameter.
5145 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5146 is_first_non_relro parameters. Change all callers.
5147 (Layout::choose_output_section): Likewise.
5148 (Layout::add_output_section_data): Likewise.
5149 (Layout::make_output_section): Likewise. Set order.
5150 (Layout::default_section_order): New function.
5151 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5152 * output.cc (Output_section::Output_section): Initialize order_.
5153 Don't initialize deleted fields.
5154 (Output_segment::Output_segment): Don't initialize deleted
5156 (Output_segment::add_output_section_to_load): New function
5157 replacing add_output_section. Change all callers to call this or
5158 add_output_section_to_nonload.
5159 (Output_segment::add_output_section_to_nonload): New function.
5160 (Output_segment::remove_output_section): Rewrite.
5161 (Output_segment::add_initial_output_data): Likewise.
5162 (Output_segment::has_any_data_sections): Likewise.
5163 (Output_segment::is_first_section_relro): Likewise.
5164 (Output_segment::maximum_alignment): Likewise.
5165 (Output_segment::has_dynamic_reloc): New function replacing
5166 dynamic_reloc_count. Change all callers.
5167 (Output_segment::has_dynamic_reloc_list): New function replacing
5168 dynamic_reloc_count_list. Change all callers.
5169 (Output_segment::set_section_addresses): Rewrite.
5170 (Output_segment::set_offset): Rewrite.
5171 (Output_segment::find_first_and_last_list): Remove.
5172 (Output_segment::set_tls_offsets): Rewrite.
5173 (Output_segment::first_section_load_address): Likewise.
5174 (Output_segment::output_section_count): Likewise.
5175 (Output_segment::section_with_lowest_load_address): Likewise.
5176 (Output_segment::write_section_headers): Likewise.
5177 (Output_segment::print_sections_to_map): Likewise.
5178 * output.h (class Output_data): Remove dynamic_reloc_count_
5179 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5180 (Output_data::add_dynamic_reloc): Rewrite.
5181 (Output_data::has_dynamic_reloc): New function.
5182 (Output_data::dynamic_reloc_count): Remove.
5183 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5184 is_last_relro_, is_first_non_relro_, is_interp_,
5185 is_dynamic_linker_section_ fields. Add order and set_order
5186 functions. Remove is_relro_local, set_is_relro_local,
5187 is_last_relro, set_is_last_relro, is_first_non_relro,
5188 set_is_first_non_relro functions, is_interp, set_is_interp,
5189 is_dynamic_linker_section, and set_is_dynamic_linker_section
5191 (class Output_segment): Change Output_data_list from std::list to
5192 std:;vector. Add output_lists_ field. Remove output_data_ and
5193 output_bss_ fields. Update declarations.
5195 2010-08-02 Ian Lance Taylor <iant@google.com>
5197 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5198 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5199 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5201 2010-08-02 Ian Lance Taylor <iant@google.com>
5204 * script.cc (Script_options::Script_options): Initialize
5205 symbol_definitions_ and symbol_references_.
5206 (Script_options::add_symbol_assignment): Update
5207 symbol_definitions_ and symbol_references_.
5208 (Script_options::add_symbol_reference): New function.
5209 (script_symbol): New function.
5210 * script.h (class Script_options): Add symbol_definitions_ and
5211 symbol_references_ fields.
5212 (Script_options::referenced_const_iterator): New type.
5213 (Script_options::referenced_begin): New function.
5214 (Script_options::referenced_end): New function.
5215 (Script_options::is_referenced): New function.
5216 (Script_options::any_unreferenced): New function.
5217 * script-c.h (script_symbol): Declare.
5218 * yyscript.y (exp): Call script_symbol.
5219 * symtab.cc: Include "script.h".
5220 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5221 Change all callers. Check symbols referenced by scripts.
5222 (Symbol_table::add_undefined_symbols_from_command_line): Add
5223 layout parameter. Change all callers.
5224 (Symbol_table::do_add_undefined_symbols_from_command_line):
5225 Likewise. Break out loop body. Check symbols referenced by
5227 (Symbol_table::add_undefined_symbol_from_command_line): New
5228 function broken out of
5229 do_add_undefined_symbols_from_command_line.
5230 * symtab.h (class Symbol_table): Update declarations.
5231 * archive.cc: Include "layout.h".
5232 (Archive::should_include_member): Add layout parameter. Change
5233 all callers. Check for symbol mentioned in expression.
5234 * archive.h (class Archive): Update declaration.
5235 * object.cc (Sized_relobj::do_should_include_member): Add layout
5237 * object.h (Object::should_include_member): Add layout parameter.
5239 (Object::do_should_include_member): Add layout parameter.
5240 (class Sized_relobj): Update declaration.
5241 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5243 * dynobj.h (class Sized_dynobj): Update declaration.
5244 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5246 * plugin.h (class Sized_pluginobj): Update declaration.
5248 2010-08-02 Ian Lance Taylor <iant@google.com>
5251 * output.cc (Output_segment::set_offset): Search for the first and
5252 last sections rather than assuming that the list is in order.
5253 (Output_segment::find_first_and_last_list): New function.
5254 * output.h (class Output_segment): Update declarations.
5255 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5256 (relro_strip_test_SOURCES): New variable.
5257 (relro_strip_test_DEPENDENCIES): New variable.
5258 (relro_strip_test_LDFLAGS): New variable.
5259 (relro_strip_test_LDADD): New variable.
5260 (relro_strip_test.so): New target.
5262 2010-08-02 Ian Lance Taylor <iant@google.com>
5264 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5265 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5266 (Target_i386::got_tlsdesc_section): New function.
5267 (Target_i386::got_section): Create space for GOT entries for
5268 TLSDESC relocations.
5269 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5271 (Target_i386::Scan::global): Likewise.
5272 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5274 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5275 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5276 (Target_x86_64::got_tlsdesc_section): New function.
5277 (Target_x86_64::got_section): Create space for GOT entries for
5278 TLSDESC relocations.
5279 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5281 (Target_x86_64::Scan::global): Likewise.
5282 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5285 2010-08-02 Ian Lance Taylor <iant@google.com>
5287 * testsuite/final_layout.sh: Use dc to convert from hex to
5290 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5292 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5293 paramter to the call to gold::gc_process_relocs.
5294 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5295 paramter to the call to gold::gc_process_relocs.
5296 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5297 parameter to the call to gold::gc_process_relocs.
5298 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5299 template parameter to the call to gold::gc_process_relocs.
5300 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5301 paramter to the call to gold::gc_process_relocs.
5302 * gc.h (get_embedded_addend_size): New function.
5303 (gc_process_relocs): Save the size of the reloc for use by ICF.
5304 * icf.cc (get_section_contents): Get the addend from the text section
5305 for SHT_REL relocation sections.
5306 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5307 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5308 * int_encoding.h (read_from_pointer): New overloaded function.
5309 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5310 * testsuite/icf_sht_rel_addend_test.sh: New file.
5311 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5312 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5314 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5316 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5317 * Makefile.in: Regenerate.
5318 * testsuite/Makefile.in: Regenerate.
5320 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5322 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5323 * gold/testsuite/debug_msg.cc: Likewise.
5324 * gold/testsuite/odr_violation1.cc
5325 * gold/testsuite/odr_violation2.cc
5327 2010-07-21 Cary Coutant <ccoutant@google.com>
5329 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5330 string, and length fields.
5331 (Output_merge_string::Merged_strings_list): New type.
5332 (Output_merge_string::Merged_strings_lists): New typedef.
5333 (Output_merge_string): Replace merged_strings_ with
5334 merged_strings_lists_.
5335 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5336 Merged_strings_list per input object and section. Don't store pointer
5337 to the string. Don't store length with each merged string entry.
5338 (Output_merge_string::finalize_merged_data): Loop over list of merged
5339 strings lists. Recompute length of each merged string.
5341 2010-07-15 Cary Coutant <ccoutant@google.com>
5343 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5346 2010-07-14 Ian Lance Taylor <iant@google.com>
5348 * descriptors.cc (Descriptors::open): Report correct name in error
5351 2010-07-13 Doug Kwan <dougkwan@google.com>
5353 * arm.cc (Arm_input_section::Arm_input_section): For a
5354 SHT_ARM_EXIDX section, always keeps the input sections.
5355 (Arm_input_section::set_exidx_section_link): New method.
5356 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5357 has_errors_ to false.
5358 (Arm_exidx_input_section::has_errors,
5359 Arm_exidx_input_section::set_has_errors): New methods.
5360 (Arm_exidx_input_section::has_errors_): New data member.
5361 (Arm_relobj::get_exidx_shndx_list): New method.
5362 (Arm_output_section::append_text_sections_to_list): Do not skip
5363 section without SHF_EXECINSTR.
5364 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5366 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5367 section header. Make error messages more verbose. Check for
5368 a non-executable section linked to an EXIDX section.
5369 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5370 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5371 check that there is no deferred EXIDX section if we exit early.
5372 Instead of not making an EXIDX section in case of an error, make one
5373 and set the has_errors flag of it.
5374 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5375 in a relocatable link.
5376 (Target_arm::do_relax): Look for the EXIDX output section instead of
5377 assuming that it is called .ARM.exidx.
5378 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5379 section list. Do not check for SHF_EXECINSTR section flags but
5380 skip any input section with errors.
5381 * output.cc (Output_section::Output_section): Initialize
5382 always_keeps_input_sections_ to false.
5383 (Output_section::add_input_section): Check for
5384 always_keeps_input_sections_.
5385 * output.h (Output_section::always_keeps_input_sections,
5386 Output_section::set_always_keeps_input_sections): New methods.
5387 (Output_section::always_keeps_input_sections): New data member.
5389 2010-07-13 Rafael Espindola <espindola@google.com>
5391 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5392 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5394 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5395 Ian Lance Taylor <iant@google.com>
5397 * output.h (Output_section_lookup_maps::add_merge_section):
5398 Correct check of whether value was inserted.
5399 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5400 (Output_section_lookup_maps::add_relaxed_input_section):
5402 * arm.cc (Target_arm::got_section): Remove used local os.
5403 * i386.cc (Target_i386::got_section): Likewise.
5404 * x86_64.cc (Target_x86_64::got_section): Likewise.
5405 * sparc.cc (Target_sparc::got_section): Likewise.
5406 (Target_sparc::relocate): Remove unused local have_got_offset.
5407 * powerpc.cc (Target_powerpc::relocate): Likewise.
5409 2010-07-13 Ian Lance Taylor <iant@google.com>
5411 * compressed_output.cc (zlib_decompress): Fix signature in
5414 * archive.cc (Archive::include_member): Unlock an external member
5415 of a thin archive. Don't bother to delete an object we know is
5418 2010-07-12 Cary Coutant <ccoutant@google.com>
5420 * compressed_output.cc (zlib_decompress): New function.
5421 (get_uncompressed_size): New function.
5422 (decompress_input_section): New function.
5423 * compressed_output.h (get_uncompressed_size): New function.
5424 (decompress_input_section): New function.
5425 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5426 Handle compressed debug sections.
5427 * layout.cc (is_compressed_debug_section): New function.
5428 (Layout::output_section_name): Map compressed section names to
5430 * layout.h (is_compressed_debug_section): New function.
5431 (is_debug_info_section): Recognize compressed debug sections.
5432 * merge.cc: Include compressed_output.h.
5433 (Output_merge_data::do_add_input_section): Handle compressed
5435 (Output_merge_string::do_add_input_section): Handle compressed
5437 * object.cc: Include compressed_output.h.
5438 (Sized_relobj::Sized_relobj): Initialize new data members.
5439 (build_compressed_section_map): New function.
5440 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5441 * object.h (Object::section_is_compressed): New method.
5442 (Object::do_section_is_compressed): New method.
5443 (Sized_relobj::Compressed_section_map): New type.
5444 (Sized_relobj::do_section_is_compressed): New method.
5445 (Sized_relobj::compressed_sections_): New data member.
5446 * output.cc (Output_section::add_input_section): Handle compressed
5448 * reloc.cc: Include compressed_output.h.
5449 (Sized_relobj::write_sections): Handle compressed debug sections.
5451 2010-07-08 Cary Coutant <ccoutant@google.com>
5453 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5454 weak when resolving to a dynamic def.
5455 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5456 for weak undef/dynamic def cases. Adjust callers.
5457 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5458 undef_binding_weak_.
5459 (Symbol_table::sized_write_globals): Adjust symbol binding.
5460 (Symbol_table::sized_write_symbol): Add binding parameter.
5461 * symtab.h (Symbol::set_undef_binding): New method.
5462 (Symbol::is_undef_binding_weak): New method.
5463 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5464 (Symbol_table::should_override): Add new parameter.
5465 (Symbol_table::sized_write_symbol): Add new parameter.
5467 * testsuite/weak_undef_file1.cc: Add new test case.
5468 * testsuite/weak_undef_file2.cc: Fix header comment.
5469 * testsuite/weak_undef_test.cc: Add new test case.
5471 2010-06-29 Doug Kwan <dougkwan@google.com>
5473 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5474 Initialize USE_SYMBOL_.
5475 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5477 (Arm_reloc_property::uses_symbol_): New data member declaration.
5478 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5479 uses symbol value and symbol is undefined but not weakly undefined.
5481 2010-06-28 Rafael Espindola <espindola@google.com>
5483 * plugin.cc (Plugin::load): Use dlerror.
5485 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5487 * symtab.cc (detect_odr_violations): When reporting an ODR
5488 violation, report an object where the symbol is defined.
5490 2010-06-25 Doug Kwan <dougkwan@google.com>
5492 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5493 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5495 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5496 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5497 target hook to detect function points.
5498 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5499 * icf.h (Icf::check_section_for_function_pointers): Change type of
5500 parameter SECTION_NAME to const reference to std::string. Use
5501 target hook to determine if section may have unsafe pointers.
5502 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5505 2010-06-21 Rafael Espindola <espindola@google.com>
5507 * fileread.cc (Input_file::find_fie): New
5508 (Input_file::open): Use Input_file::find_fie.
5509 * fileread.h (Input_file::find_fie): New
5510 * plugin.cc (set_extra_library_path): New.
5511 (Plugin::load): Add set_extra_library_path to the transfer vector.
5512 (Plugin_manager::set_extra_library_path): New.
5513 (Plugin_manager::add_input_file): Use the extra search path if set.
5514 (set_extra_library_path(): New.
5515 * plugin.h (Plugin_manager): Add set_extra_library_path and
5518 2010-06-19 Cary Coutant <ccoutant@google.com>
5520 * layout.cc (gdb_sections): Add .debug_types.
5521 (lines_only_debug_sections): Likewise.
5523 2010-06-18 Rafael Espindola <espindola@google.com>
5525 * plugin.cc (add_input_file,add_input_library)
5526 (Plugin_manager::add_input_file): Make filename arguments const.
5527 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5530 2010-06-16 Doug Kwan <dougkwan@google.com>
5532 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5533 .ARM.attributes section if we have not merged any input
5534 attributes sections.
5536 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5538 * arm.cc: Allow combining objects with no EABI version
5541 2010-06-15 Rafael Espindola <espindola@google.com>
5543 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5545 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5547 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5548 (struct iovec): Correct !HAVE_READV definition.
5550 2010-06-10 Cary Coutant <ccoutant@google.com>
5552 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5553 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5555 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5558 * symtab.h (Symbol::is_placeholder): New member function.
5559 * target-reloc.h (relocate_section): Check for placeholder symbols.
5561 * testsuite/Makefile.am (plugin_test_8): New test.
5562 (plugin_test_9): New test.
5563 * testsuite/Makefile.in: Regenerate.
5565 2010-06-09 Nick Clifton <nickc@redhat.com>
5567 * yyscript.y (input_list_element): Allow strings prefixed with
5568 the '-' character. Treat these as libraries.
5569 * script.cc (script_add_library): New function. Adds a library
5570 specified by "-l<name>" found in an input script.
5571 * script-c.h: Add prototype for script_add_library.
5573 2010-06-07 Doug Kwan <dougkwan@google.com>
5575 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5576 Restrict stub-group size to be within long conditional branch
5577 range when working around cortex-A8 erratum.
5579 2010-06-07 Damien Diederen <dd@crosstwine.com>
5581 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5584 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5588 (Output_section::Input_section_sort_entry::compare_section_ordering):
5589 Change to return non-zero correctly.
5590 (Output_section::Input_section_sort_section_order_index_compare
5591 ::operator()): Change to fix ambiguity in comparisons.
5593 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5595 * gold.h (is_wildcard_string): New function.
5596 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5597 (Layout::layout_eh_frame): Ditto.
5598 (Layout::find_section_order_index): New method.
5599 (Layout::read_layout_from_file): New method.
5600 * layout.h (Layout::find_section_order_index): New method.
5601 (Layout::read_layout_from_file): New method.
5602 (Layout::input_section_position_): New private member.
5603 (Layout::input_section_glob_): New private member.
5604 * main.cc (main): Call read_layout_from_file here.
5605 * options.h (--section-ordering-file): New option.
5606 * output.cc (Output_section::input_section_order_specified_): New
5608 (Output_section::Output_section): Initialize new member.
5609 (Output_section::add_input_section): Add new parameter.
5610 Keep input sections when --section-ordering-file is used.
5611 (Output_section::set_final_data_size): Sort input sections when
5612 section ordering file is specified.
5613 (Output_section::Input_section_sort_entry): Add new parameter.
5615 (Output_section::Input_section_sort_entry::compare_section_ordering):
5617 (Output_section::Input_section_sort_compare::operator()): Change to
5618 consider section_order_index.
5619 (Output_section::Input_section_sort_init_fini_compare::operator()):
5620 Change to consider section_order_index.
5621 (Output_section::Input_section_sort_section_order_index_compare
5622 ::operator()): New method.
5623 (Output_section::sort_attached_input_sections): Change to sort
5624 according to section order when specified.
5625 (Output_section::add_input_section<32, true>): Add new parameter.
5626 (Output_section::add_input_section<64, true>): Add new parameter.
5627 (Output_section::add_input_section<32, false>): Add new parameter.
5628 (Output_section::add_input_section<64, false>): Add new parameter.
5629 * output.h (Output_section::add_input_section): Add new parameter.
5630 (Output_section::input_section_order_specified): New
5632 (Output_section::set_input_section_order_specified): New method.
5633 (Input_section::Input_section): Initialize section_order_index_.
5634 (Input_section::section_order_index): New method.
5635 (Input_section::set_section_order_index): New method.
5636 (Input_section::section_order_index_): New member.
5637 (Input_section::Input_section_sort_section_order_index_compare): New
5639 (Output_section::input_section_order_specified_): New member.
5640 * script-sections.cc (is_wildcard_string): Delete and move modified
5642 (Output_section_element_input::Output_section_element_input): Modify
5643 call to is_wildcard_string.
5644 (Output_section_element_input::Input_section_pattern
5645 ::Input_section_pattern): Ditto.
5646 (Output_section_element_input::Output_section_element_input): Ditto.
5647 * testsuite/Makefile.am (final_layout): New test case.
5648 * testsuite/Makefile.in: Regenerate.
5649 * testsuite/final_layout.cc: New file.
5650 * testsuite/final_layout.sh: New file.
5652 2010-06-01 Rafael Espindola <espindola@google.com>
5654 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5656 2010-06-01 Rafael Espindola <espindola@google.com>
5658 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5659 visibility of symbols.
5661 2010-05-27 Doug Kwan <dougkwan@google.com>
5663 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5664 from start of output section instead of address for a local symbol
5665 in a merged or relaxed section when doing a relocatable link.
5667 2010-05-26 Rafael Espindola <espindola@google.com>
5670 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5671 adding sections the garbage collector removed.
5672 * gold/testsuite/Makefile.am: Add test.
5673 * gold/testsuite/Makefile.in: Regenerate.
5674 * gold/testsuite/plugin_test_7.sh: New.
5675 * gold/testsuite/plugin_test_7_1.c: New.
5676 * gold/testsuite/plugin_test_7_2.c: New.
5678 2010-05-26 Rafael Espindola <espindola@google.com>
5680 * script-sections.cc (Output_section_definition::set_section_addresses):
5681 Check for --section-start.
5683 2010-05-26 Doug Kwan <dougkwan@google.com>
5685 * arm.cc (Arm_scan_relocatable_relocs): New class.
5686 (Target_arm::relocate_special_relocatable): New method.
5687 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5688 (Arm_relocate_functions::thumb_branch_common): Same.
5689 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5690 instead of Default_scan_relocatable_relocs.
5691 * target-reloc.h (relocate_for_relocatable): Let target handle
5692 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5693 * target.h (Sized_target::relocate_special_relocatable): New method.
5695 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5697 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5699 2010-05-23 Doug Kwan <dougkwan@google.com>
5701 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5703 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5704 with a direct branch, not a conditional branch, to a stub.
5705 * merge.cc (Output_merge_base::record_input_section): New method
5707 (Output_merge_data::do_add_input_section): Record input section if
5708 keeps-input-sections flag is set.
5709 (Output_merge_string::do_add_input_section): Ditto.
5710 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5711 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5713 (Output_merge_base::keeps_input_sections,
5714 Output_merge_base::set_keeps_input_sections,
5715 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5717 (Output_merge_base::Input_sections): New type declaration.
5718 (Output_merge_base::input_sections_begin,
5719 Output_merge_base::input_sections_end,
5720 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5721 (Output_merge_base::bool keeps_input_sections_,
5722 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5723 Output_merge_base::input_sections_): New data members.
5724 (Output_merge_data::do_set_keeps_input_sections): New method
5726 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5727 * output.cc (Output_section::Input_section::relobj): Move method
5728 defintion from class declaration to here and handle merge sections.
5729 (Output_section::Input_section::shndx): Ditto.
5730 (Output_section::Output_section): Remove initializations of removed
5731 data members and initialize new data member LOOKUP_MAPS_.
5732 (Output_section::add_input_section): Set keeps-input-sections flag
5733 for a newly created merge output section as appropriate. Adjust code
5734 to use Output_section_lookup_maps class.
5735 (Output_section::add_relaxed_input_section): Adjst code for lookup
5736 maps code refactoring.
5737 (Output_section::add_merge_input_section): Add a new parameter
5738 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5739 class. If adding input section to a newly created merge output
5740 section fails, remove the new merge section.
5741 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5742 Adjust code for use of the Output_section_lookup_maps class.
5743 (Output_section::find_merge_section): Ditto.
5744 (Output_section::build_lookup_maps): New method defintion.
5745 (Output_section::find_relaxed_input_section): Adjust code to use
5746 Output_section_lookup_maps class.
5747 (Output_section::get_input_sections): Export merge sections. Adjust
5748 code to use Output_section_lookup_maps class.
5749 (Output_section:::add_script_input_section): Adjust code to use
5750 Output_section_lookup_maps class. Update lookup maps for merge
5752 (Output_section::discard_states): Use Output_section_lookup_maps.
5753 (Output_section::restore_states): Same.
5754 * output.h (Merge_section_properties): Move class defintion out of
5756 (Output_section_lookup_maps): New class.
5757 (Output_section::Input_section::is_merge_section): New method
5759 (Output_section::Input_section::relobj): Move defintion out of class
5760 defintion. Declare method only.
5761 (Output_section::Input_section::shndx): Ditto.
5762 (Output_section::Input_section::output_merge_base): New method defintion.
5763 (Output_section::Input_section::u2_.pomb): New union field.
5764 (Output_section::Merge_section_by_properties_map,
5765 Output_section::Output_section_data_by_input_section_map,
5766 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5768 (Output_section::add_merge_input_section): Add new parameter
5769 KEEPS_INPUT_SECTIONS.
5770 (Output_section::build_lookup_maps): New method declaration.
5771 (Output_section::merge_section_map_,
5772 Output_section::merge_section_by_properties_map_,
5773 Output_section::relaxed_input_section_map_,
5774 Output_section::is_relaxed_input_section_map_valid_): Remove data
5776 (Output_section::lookup_maps_): New data member.
5778 2010-05-21 Doug Kwan <dougkwan@google.com>
5781 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5782 avoid a compilation error.
5784 2010-05-19 Rafael Espindola <espindola@google.com>
5786 * script-sections.cc (Output_section_definition::allocate_to_segment):
5787 Update the phdrs_list even when the output section is NULL.
5788 * testsuite/Makefile.am: Add test.
5789 * testsuite/Makefile.in: Regenerate.
5790 * testsuite/script_test_9.cc: New.
5791 * testsuite/script_test_9.sh: New.
5792 * testsuite/script_test_9.t: New.
5794 2010-05-19 Doug Kwan <dougkwan@google.com>
5796 * arm.cc (Arm_input_section::original_size): New method.
5797 (Arm_input_section::do_addralign): Add a cast.
5798 (Arm_input_section::do_output_offset): Remove static cast.
5799 (Arm_input_section::original_addralign,
5800 Arm_input_section::original_size_): Change type to uint32_t.
5801 (Arm_input_section::init): Add safe casts for section alignment
5803 (Arm_input_section::set_final_data_size): Do not set address and
5804 offset of stub table.
5805 (Arm_output_section::fix_exidx_coverage): Change use of of
5806 Output_section::Simple_input_section to that of
5807 Output_section::Input_section.
5808 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5809 except for the first pass.
5810 * output.cc (Output_section::get_input_sections): Change type of
5811 input_sections to std::list<Input_section>.
5812 (Output_section::add_script_input_section): Rename from
5813 Output_section::add_simple_input_section. Change type of SIS
5814 parameter from Simple_input_section to Input_section.
5815 * output.h (Output_section::Simple_input_section): Remove class.
5816 (Output_section::Input_section): Change class visibility to public.
5817 (Output_section::Input_section::addralign): Use stored alignments
5818 for special input sections if set.
5819 (Output_section::Input_section::set_addralign): New method.
5820 (Output_section::get_input_sections): Change parameter type from
5821 list of Simple_input_section to list of Input_section.
5822 (Output_section::add_script_input_section): Rename from
5823 Output_section::add_simple_input_section. Change first parameter's
5824 type from Simple_input_section to Input_section and remove the
5825 second and third parameters.
5826 * script-sections.cc (Input_section::Input_section_list): Change
5827 type to list of Output_section::Input_section/
5828 (Input_section_info::Input_section_info): Change parameter type of
5829 INPUT_SECTION to Output_section::Input_section.
5830 (Input_section_info::input_section): Change return type.
5831 (Input_section_info::input_section_): Change type to
5832 Output_section::Input_section.
5833 (Output_section_element_input::set_section_addresses): Adjust code
5834 to use Output_section::Input_section instead of
5835 Output_section::Simple_input_section. Adjust code for renaming
5836 of Output_section::add_simple_input_section.
5837 (Orphan_output_section::set_section_addresses): Ditto.
5839 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5841 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5842 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5844 2010-05-18 Rafael Espindola <espindola@google.com>
5846 * options.cc (General_options::finalize): Handle -nostdlib.
5847 * options.h (nostdlib): New option.
5848 * script.cc (script_add_search_dir): Handle -nostdlib.
5850 2010-05-12 Doug Kwan <dougkwan@google.com>
5852 * arm.cc (Target_arm::do_finalize_sections): Create an empty
5853 attributes section only if there no attributes section after merging.
5854 (Target_arm::merge_object_attributes): Move value of
5855 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5856 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5857 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5858 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5859 and arm_attr_merge_7.stdout.
5860 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5861 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5862 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5863 arm_attr_merge_7b.o): New rules.
5864 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5866 * testsuite/Makefile.in: Regenerate.
5867 * testsuite/arm_attr_merge.sh: New file.
5868 * testsuite/arm_attr_merge_[67][ab].s: Same.
5870 2010-05-05 Nick Clifton <nickc@redhat.com>
5872 * po/es.po: Updated Spanish translation.
5874 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5876 * Makefile.am (install-exec-local): Properly install gold as
5877 default cross linker.
5878 * Makefile.in: Regenerated.
5880 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
5881 Nick Clifton <nickc@redhat.com>
5883 * configure.ac (install_as_default): Define and set to false
5884 unless --enable-gold or --enable-gold=both/gold has been
5886 * configure: Regenerate.
5888 * Makefile.am (install-exec-local): Install the executable as
5889 'ld.gold'. If install_as_default is true then also install it as
5891 * Makefile.in: Regenerated.
5893 2010-04-24 Ian Lance Taylor <iant@google.com>
5895 * layout.cc (Layout::layout_reloc): In relocatable link don't
5896 combine reloc sections for grouped sections.
5898 2010-04-23 Sriraman Tallam <tmsriram@google.com>
5900 * gc.h (gc_process_relocs): Pass information on relocs pointing to
5901 sections that are not ordinary to icf.
5902 * icf.cc (get_section_contents): Handle relocation pointing to section
5903 with no object or shndx information.
5904 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5905 * testsuite/Makefile.in: Regenerate.
5906 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5907 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5909 2010-04-22 Ian Lance Taylor <iant@google.com>
5911 * expression.cc (Expression::Expression_eval_info): Add
5912 result_alignment_pointer field.
5913 (Expression::eval_with_dot): Add result_alignment_pointer
5914 parameter. Change all callers.
5915 (Expression::eval_maybe_dot): Likewise.
5916 (class Binary_expression): Add alignment_pointer parameter to
5917 left_value and right_value. Change all callers.
5918 (BINARY_EXPRESSION): Set result alignment.
5919 (class Trinary_expression): Add alignment_pointer parameter to
5920 arg2_value and arg3_value. Change all callers.
5921 (Trinary_cond::value): Set result alignment.
5922 (Max_expression::value, Min_expression::value): Likewise.
5923 (Align_expression::value): Likewise.
5924 * script-sections.cc (class Sections_element): Add dot_alignment
5925 parameter to set_section_addresses virtual function. Update
5927 (class Output_section_element): Likewise.
5928 (Script_sections::create_segments): Add dot_alignment parameter.
5930 (Script_sections::create_segments_from_phdrs_clause): Likewise.
5931 (Script_sections::set_phdrs_clause_addresses): Likewise.
5932 * script-sections.h: Update declarations.
5933 * script.h: Update declarations.
5934 * output.h (Output_segment::set_minimum_p_align): Don't decrease
5936 * testsuite/script_test_3.t: Set large alignment.
5937 * testsuite/script_test_3.sh: Make sure that at least one LOAD
5938 segment has expected alignment.
5940 2010-04-22 Nick Clifton <nickc@redhat.com>
5942 * po/gold.pot: Updated by the Translation project.
5943 * po/vi.po: Updated Vietnamese translation.
5945 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
5947 * testsuite/Makefile.am (check_PROGRAMS): Add
5948 icf_virtual_function_folding_test.
5949 * testsuite/Makefile.in: Regenerated.
5951 2010-04-15 Andrew Haley <aph@redhat.com>
5953 * options.h (merge_exidx_entries): New option.
5954 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5955 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5956 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5957 (Target_arm::merge_exidx_entries): New function.
5958 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5959 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5960 to Arm_exidx_fixup constructor.
5961 Add new arg, merge_exidx_entries.
5962 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5963 Arm_output_section::fix_exidx_coverage.
5965 2010-04-18 Sriraman Tallam <tmsriram@google.com>
5967 * icf.cc (get_section_contents): Check for preemptible functions.
5968 Ignore addend when appropriate.
5969 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
5971 (add_from_relobj): Check for section folded.
5972 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5973 * symtab.h (should_add_dynsym_entry): Add new parameter.
5974 * target-reloc.h (scan_relocs): Check for section folded.
5975 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5976 Check reloc types for function pointers in shared objects.
5977 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5979 (icf_preemptible_functions_test): New test case.
5980 (icf_string_merge_test): New test case.
5981 * testsuite.Makefile.in: Regenerate.
5982 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5983 bar_glob. Refactor code.
5984 * testsuite/icf_preemptible_functions_test.cc: New file.
5985 * testsuite/icf_preemptible_functions_test.sh: New file.
5986 * testsuite/icf_string_merge_test.cc: New file.
5987 * testsuite/icf_string_merge_test.sh: New file.
5988 * testsuite/icf_virtual_function_folding_test.cc: New file.
5989 * testsuite/icf_virtual_function_folding_test.sh: New file.
5991 2010-04-14 Doug Kwan <dougkwan@google.com>
5993 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5994 for local symbol recounting if we remove a section due to ICF.
5995 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5996 there are no regular objects in input.
5998 2010-04-13 Doug Kwan <dougkwan@google.com>
6000 * arm.cc (Arm_input_section::set_final_data_size): Compute
6001 accurate final data size instead of using current data size.
6003 2010-04-09 Doug Kwan <dougkwan@google.com>
6005 * layout.cc (Layout::choose_output_section): Handle script section
6007 (Layout::make_output_section_for_script): Add section type parameter.
6008 Handle script section types.
6009 * layout.h (Layout::make_output_section_for_script): Add section
6011 * output.cc (Output_section::Output_section): Initialize data member
6013 (Output_section::do_reset_address_and_file_offset): Do not set address
6014 to 0 if section is a NOLOAD section.
6015 * output.h (Output_section::is_noload): New method.
6016 (Output_section::set_is_noload): Ditto.
6017 (Output_section::is_noload_): New data member.
6018 * script-c.h (Script_section_type): New enum type.
6019 (struct Parser_output_section_header): Add new file section_type.
6020 * script-sections.cc (Sections_element::output_section_name): Add
6021 parameter for returning script section type.
6022 (Output_section_definition::output_section_name): Ditto.
6023 (Output_section_definition::section_type)P; New method.
6024 (Output_section_definiton::script_section_type_name): Ditto.
6025 (Output_section_definition::script_section_type_): New data member.
6026 (Output_section_definition::Output_section_definition): Initialize
6027 data member Output_section_definition::script_section_type_.
6028 (Output_section_definition::create_sections): Pass script section type
6029 to Layout::make_output_section_for_script.
6030 (Output_section_definition::output_section_name): Return script
6031 section type to caller.
6032 (Output_section_definition::set_section_address): Do not advance
6033 dot value and load address if section type is NOLOAD. Set address
6034 of NOLOAD sections regardless of section flags.
6035 (Output_section_definition::print): Print section type if it is
6036 not SCRIPT_SECTION_TYPE_NONE.
6037 (Output_section_definition::section_type): New method.
6038 (Output_section_definition::script_section_type_name): Ditto.
6039 (Script_sections::output_section_name): Add new parameter
6040 PSECTION_TYPE for returning script section type. Pass it to
6041 section elements. Handle discard sections.
6042 (Sort_output_sections::operator()): Handle NOLOAD sections.
6043 * script-sections.h (Script_sections::Section_type): New enum type.
6044 (Script_sections::output_section_name): Add a new parameter for
6045 returning script section type.
6046 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6048 * yyscript.y (union): Add new field SECTION_TYPE.
6049 (COPY, DSECT, INFO, NOLOAD): New tokens.
6050 (opt_address_and_section_type): Change type to output_section_header.
6051 (section_type): New non-terminal
6052 (section_header): Handle section type.
6053 (opt_address_and_section_type): Return section type value.
6055 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6057 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6058 * testsuite/plugin_common_test_2.c (foo): Likewise.
6060 2010-04-08 Doug Kwan <dougkwan@google.com>
6062 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6064 * output.cc (Output_section::add_merge_input_section): Simplify
6065 code and return status of Output_merge_base::add_input_section.
6066 Update merge section map only if Output_merge_base::add_input_section
6069 2010-04-07 Doug Kwan <dougkwan@google.com>
6071 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6072 if section is marked as containing instructions but has no mapping
6074 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6075 correct section index.
6076 (Arm_relobj::find_linked_text_section): Ditto.
6078 2010-04-07 Cary Coutant <ccoutant@google.com>
6080 * archive.cc (include_member): Destroy Read_symbols_data object before
6082 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6083 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6084 (Read_symbols_data::~Read_symbols_data) New destructor.
6085 (Section_relocs::Section_relocs) New constructor.
6086 (Section_relocs::~Section_relocs) New destructor.
6087 (Read_relocs_data::Read_relocs_data) New constructor.
6088 (Read_relocs_data::~Read_relocs_data) New destructor.
6089 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6090 pointers to NULL after deleting.
6092 2010-04-07 Doug Kwan <dougkwan@google.com>
6094 * arm.cc: Replace "endianity" with "endianness" in comments.
6095 (Arm_exidx_cantunwind): Ditto.
6096 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6097 (Arm_relobj::merge_flags_and_attributes): New method.
6098 (Arm_relobj::merge_flags_and_attributes_): New data member.
6099 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6100 (Arm_relobj::scan_sections_for_stubs): Ditto.
6101 (Arm_relobj::do_read_symbols): Check to see if we really want to
6102 merge processor-specific flags and attributes. Exit early if
6103 an object is empty except for section names and the undefined symbol.
6104 (Target_arm::do_finalize_sections): Move check for ELF format to
6105 Arm_relobj::do_read_symbols. Merge processor specific flags and
6106 attributes from a regular object only when we have determined that
6107 it is aapropriate. Do not create an .ARM.attributes section in
6108 output if there is no regular input object.
6109 (Target_arm::merge_processor_specific_flags): Check
6110 --warn-mismatch before printing any error.
6111 (Target_arm::merge_object_attributes): Ditto.
6112 * gold.cc (queue_middle_tasks): Handle the case in which there is
6113 no regular object in input.
6114 * options.cc (General_options::parse_EB): New method.
6115 (General_options::parse_EL): Same.
6116 (General_options::General_options): Initialize endianness_.
6117 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6119 (General_options::Endianness): New enum.
6120 (General_options::endianness): New method.
6121 (General_options::endianness_): New data member.
6122 * parameters.cc (Parameters::set_options): Check target endianness.
6123 (Parameters::set_target_once): Ditto.
6124 (Parameters::check_target_endianness): New method.
6125 (parameters_force_valid_target): If either -EL or -EB is specified,
6126 use it to define endianness of default target.
6127 * parameters.h (Parameters::check_target_endianness): New method
6129 * target.h (class Target): Change "endianity" to "endianness"
6132 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6134 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6135 * configure: Regenerate.
6136 * Makefile.in: Regenerate.
6137 * testsuite/Makefile.in: Regenerate.
6139 2010-04-06 Cary Coutant <ccoutant@google.com>
6142 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6143 prevailing definitions of common symbols.
6144 * testsuite/plugin_test_6.sh: New test case.
6145 * testsuite/plugin_common_test_1.c: New test case.
6146 * testsuite/plugin_common_test_2.c: New test case.
6147 * testsuite/Makefile.am (plugin_test_6): New test case.
6148 * testsuite/Makefile.in: Regenerate.
6150 2010-04-06 Nick Clifton <nickc@redhat.com>
6152 * po/vi.po: New Vietnamese translation.
6154 2010-03-30 Doug Kwan <dougkwan@google.com>
6156 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6158 2010-03-25 Doug Kwan <dougkwan@google.com>
6160 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6161 to avoid a conversion warning on a 32-bit host.
6163 2010-03-24 Ian Lance Taylor <iant@google.com>
6165 * testsuite/script_test_3.t: Add a TLS segment.
6166 * testsuite/Makefile.am (check_PROGRAMS): Add
6167 tls_phdrs_script_test.
6168 (tls_phdrs_script_test_SOURCES): Define.
6169 (tls_phdrs_script_test_DEPENDENCIES): Define.
6170 (tls_phdrs_script_test_LDFLAGS): Define.
6171 (tls_phdrs_script_test_LDADD): Define.
6172 * testsuite/Makefile.in: Rebuild.
6174 2010-03-23 Cary Coutant <ccoutant@google.com>
6176 * fileread.cc (find_or_make_view): Fix comment.
6178 2010-03-23 Ian Lance Taylor <iant@google.com>
6180 * script-sections.cc (class Orphan_section_placement): Define
6181 PLACE_TLS and PLACE_TLS_BSS.
6182 (Orphan_section_placement::Orphan_section_placement): Initialize
6184 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6185 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6186 (tls_script_test_SOURCES): Define.
6187 (tls_script_test_DEPENDENCIES): Define.
6188 (tls_script_test_LDFLAGS): Define.
6189 (tls_script_test_LDADD): Define.
6190 * testsuite/Makefile.in: Rebuild.
6192 2010-03-22 Doug Kwan <dougkwan@google.com>
6194 * arm.cc (Arm_relocate_functions::abs8,
6195 Arm_relocate_functions::abs16): Use correct check for overflow
6196 specified in the ARM ELF specs.
6197 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6198 target of a BLX instruction specially.
6199 (Reloc_stub::stub_type_for_reloc): Ditto.
6200 (Relocate::relocate): Use symbolic names instead of numeric relocation
6201 codes to report error.
6202 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6204 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6205 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6206 thumb2_blx_out_of_range.stdout
6207 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6208 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6209 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6210 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6211 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6212 thumb2_blx_in_range, thumb2_blx_in_range.o,
6213 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6214 thumb2_blx_out_of_range.o): New rules.
6215 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6216 thumb2_blx_in_range and thumb2_blx_out_of_range.
6217 * testsuite/Makefile.in: Regenerate.
6218 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6219 * testsuite/thumb_blx_in_range.s: New file.
6220 * testsuite/thumb_blx_out_of_range.s: New file.
6222 2010-03-22 Rafael Espindola <espindola@google.com>
6224 * archive.cc (Should_include): Move to archive.h.
6225 (should_include_member): Make it a member of Archive.
6227 (Add_lib_group_symbols): New.
6228 * archive.h: Include options.h.
6229 (Archive_member): Moved from Archive.
6230 (Should_include): Moved from archive.cc.
6232 (Add_lib_group_symbols): New.
6233 * dynobj.cc (do_should_include_member): New.
6234 * dynobj.h (do_should_include_member): New.
6235 * gold.cc (queue_initial_tasks): Update call to queue.
6236 * main.cc (main): Print lib group stats.
6237 * object.cc (do_should_include_member): New.
6238 * object.h: Include archive.h.
6239 (Object::should_include_member): New.
6240 (Object::do_should_include_member): New.
6241 (Sized_relobj::do_should_include_member): New.
6242 * options.cc (General_options::parse_start_lib): New.
6243 (General_options::parse_end_lib): New.
6244 (Input_arguments::add_file): Handle lib groups.
6245 (Input_arguments::start_group): Check we are not in a lib.
6246 (Input_arguments::start_lib): New.
6247 (Input_arguments::end_lib): New.
6248 * options.h (General_options): Add start_lib and end_lib.
6249 (Input_argument::lib_): New.
6250 (Input_argument::lib): New.
6251 (Input_argument::is_lib): New.
6252 (Input_file_lib): New.
6253 (Input_arguments::in_lib_): New.
6254 (Input_arguments::in_lib): New.
6255 (Input_arguments::start_lib): New.
6256 (Input_arguments::end_lib_): New.
6257 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6258 in unused members as preempted.
6259 (Sized_pluginobj::do_should_include_member): New.
6260 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6261 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6263 (Read_symbols::do_whole_lib_group): New.
6264 (Read_symbols::do_lib_group): New.
6265 (Read_symbols::do_read_symbols): Handle lib groups.
6266 (Read_symbols::get_name): Handle lib groups.
6267 * readsyms.h (Read_symbols): Add an archive member pointer.
6268 (Read_symbols::do_whole_lib_group): New.
6269 (Read_symbols::do_lib_group): New.
6270 (Read_symbols::member_): New.
6271 * script.cc (read_input_script): Update call to queue_soon.
6273 2010-03-19 Doug Kwan <dougkwan@google.com>
6275 * arm.cc (Stub_table::Stub_table): Initialize new data members
6276 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6277 (Stub_table::add_reloc_stub): Assign stub offset and update
6278 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6279 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6281 (Stub_table::update_data_size_and_addralign): Use
6282 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6283 instead of going over all reloc stubs.
6284 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6285 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6286 Stringpool_template::offset_ to size of Stringpool_char.
6287 (Stringpool_template::new_key_offset): Remove code to initialize
6288 Stringpool_template::offset_.
6289 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6290 Stringpool_template::offset_ to zero.
6292 2010-03-15 Doug Kwan <dougkwan@google.com>
6294 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6296 (Stringpool_template::new_key_offset): New method.
6297 (Stringpool_template::add_string): Assign offsets when adding new
6299 (Stringpool_template::set_string_offsets): Do not set string offsets
6300 when not optimizing.
6301 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6303 (Chunked_vector::clear): Clear size_.
6304 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6305 (Chunked_vector::size): Return size_.
6306 (Chunked_vector::push_back): Use size_ to find insert position.
6307 (Chunked_vector::size_): New data member.
6308 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6309 (Stringpool_template::new_key_offset): New method declaration.
6310 (Stringpool_template::offset_): New data member.
6312 2010-03-15 Rafael Espindola <espindola@google.com>
6314 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6315 Add_symbols' constructor.
6316 * readsyms.h (Add_symbols): Remove the input_group member.
6318 2010-03-10 Ian Lance Taylor <iant@google.com>
6320 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6321 target to ask whether a reference to a symbol requires a stack
6323 * target.h (Target::is_call_to_non_split): New function.
6324 (Target::do_is_call_to_non_split): Declare virtual function.
6325 * target.cc: Include "symtab.h".
6326 (Target::do_is_call_to_non_split): New function.
6327 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6329 2010-03-10 Cary Coutant <ccoutant@google.com>
6331 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6332 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6333 (File_read::open[2]): Add whole_file_view_ to list of views.
6334 (File_read::make_view): Remove test of whole_file_view_.
6335 (File_read::find_or_make_view): Create whole_file_view_ if
6337 (File_read::clear_views): Replace bool parameter with enum;
6338 adjust all callers. Don't delete views with permanent data;
6339 do delete cached views and views from archives if
6340 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6341 if clearing the corresponding view.
6342 * fileread.h (File_read::Clear_views_mode): New enum.
6343 (File_read::View::is_permanent_view): New method.
6344 (File_read::clear_views): Replace bool parameter
6345 with enum; adjust all callers.
6346 * options.h (General_options): Change keep_files_mapped option;
6347 add map_whole_files.
6348 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6350 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6353 2010-03-10 David S. Miller <davem@davemloft.net>
6355 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6357 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6359 * icf.cc (get_section_contents): Add '@' marker after processing the
6362 2010-03-08 Doug Kwan <dougkwan@google.com>
6364 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6365 due to a conversion warning.
6366 (Arm_relobj::update_output_local_symbol_count): Check for local
6367 symbol with unset output index.
6369 2010-03-05 Ian Lance Taylor <iant@google.com>
6371 * options.h (class General_options): Add --spare-dynamic-tags.
6372 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6373 --spare-dynamic-tags.
6375 2010-03-05 Ian Lance Taylor <iant@google.com>
6377 * incremental.cc: Include "libiberty.h".
6379 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6381 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6382 function, is_info_ member.
6383 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6384 (Versions::Versions): Update caller.
6385 (Versions::define_base_version): Likewise.
6386 (Versions::add_def): Likewise.
6388 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6390 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6391 (Scan::possible_function_pointer_reloc): New function.
6392 (Scan::local_reloc_may_be_function_pointer): Change to call
6393 possible_function_pointer_reloc.
6394 (Scan::global_reloc_may_be_function_pointer): Ditto.
6395 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6396 relocations in ".data.rel.ro._ZTV" section.
6397 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6398 * testsuite/icf_safe_so_test.cc: Ditto.
6399 * testsuite/icf_safe_test.cc: Ditto.
6400 * testsuite/icf_safe_test.sh: Ditto.
6402 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6403 Ian Lance Taylor <iant@google.com>
6405 * target-reloc.h (relocate_section): Check the symbol table index
6406 for -1U before setting the local symbol index.
6407 (scan_relocatable_relocs): If copying the relocation, record that
6408 the local symbol is required.
6409 * object.h (Symbol_value::is_output_symtab_index_set): New
6411 (Symbol_value::may_be_discarded_from_output_symtab): New
6413 (Symbol_value::has_output_symtab_entry): New function.
6414 (Symbol_value::needs_output_symtab_entry): Remove.
6415 (Symbol_value::output_symtab_index): Make sure the symbol index is
6417 (Symbol_value::set_output_symtab_index): Make sure the symbol
6418 index is not set. Make sure the new index is valid.
6419 (Symbol_value::set_must_have_output_symtab_entry): New function.
6420 (Symbol_value::has_output_dynsym_entry): New function.
6421 (Symbol_value::set_output_dynsym_index): Make sure the new index
6423 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6424 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6425 local symbol if permitted.
6426 (Sized_relobj::do_finalize_local_symbols): Call
6427 is_output_symtab_index_set rather than needs_output_symtab_entry.
6428 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6429 rather than needs_output_symtab_entry. Call
6430 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6431 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6432 is_output_symtab_index_set rather than needs_output_symtab_entry.
6433 * testsuite/discard_locals_relocatable_test.c: New file.
6434 * testsuite/discard_locals_test.sh: Test -r.
6435 * testsuite/Makefile.am (check_DATA): Add
6436 discard_locals_relocatable_test1.syms,
6437 discard_local_relocatable_test2.syms.
6438 (MOSTLYCLEANFILES): Likewise. Also add
6439 discard_locals_relocatable_test1.lout and
6440 discard_locals_relocatable_test2.out.
6441 (discard_locals_relocatable_test1.syms): New target.
6442 (discard_locals_relocatable_test.o): New target.
6443 (discard_locals_relocatable_test1.out): New target.
6444 (discard_locals_relocatable_test2.syms): New target.
6445 (discard_locals_relocatable_test2.out): New target.
6446 (various): Add missing ../ld-new dependencies.
6447 * testsuite/Makefile.in: Rebuild.
6449 2010-03-03 Nick Clifton <nickc@redhat.com>
6451 * po/fi.po: New Finnish translation.
6453 2010-03-01 Doug Kwan <dougkwan@google.com>
6455 * layout.cc (Layout::Layout): Force section types of .init_array*,
6456 .preinit_array* and .fini_array* sections.
6457 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6458 Fix check of return value of std::string::find.().
6459 (Output_section::Input_section_sort_compare::operator()): Remove
6460 comment about .init_array.
6461 (Output_section::Input_section_sort_init_fini_compare::operator()):
6463 (Output_section::sort_attached_input_sections): Handle .init_array
6464 and .fini_array specially.
6465 * output.h (Output_section::Inut_section_sort_compare): Update
6467 (Output_section::Input_section_sort_init_fini_compare): New struct.
6469 2010-02-26 Doug Kwan <dougkwan@google.com>
6471 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6472 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6473 * testsuite/debug_msg.sh: Avoid matching source line number for
6474 use of global variable undef_int.
6476 2010-02-26 Doug Kwan <dougkwan@google.com>
6478 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6479 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6480 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6481 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6482 * options.cc (General_options::General_options): Initialize member
6484 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6485 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6486 and rm_no_fix_v4bx.stdout
6487 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6488 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6489 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6490 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6491 and arm_no_fix_v4bx.
6492 * Makefile.in: Regenerate.
6493 * testsuite/arm_fix_v4bx.s: New file.
6494 * testsuite/arm_fix_v4bx.sh: Ditto.
6496 2010-02-24 Doug Kwan <dougkwan@google.com>
6498 * arm.cc (Target_arm::got_section): Make the .got section the first
6499 non RELRO section in the data segment.
6500 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6501 suffixes of section names.
6503 2010-02-24 Doug Kwan <dougkwan@google.com>
6505 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6506 flags and attributes merging if an input file is a binary file.
6507 * fileread.cc (Input_file::open): Record format of original file.
6508 * fileread.h (Input_file::Format): New enum type.
6509 (Input_file::Input_file): Initialize data member format_.
6510 (Input_file::format): New method definition.
6511 (Input_file::format_):: New data member.
6513 2010-02-24 Doug Kwan <dougkwan@google.com>
6515 * arm.cc (Arm_output_data_got): New class.
6516 (ARM_TCB_SIZE): New constant
6517 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6518 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6519 If user uses a script with a SECTIONS clause, issue only a warning
6520 for a misplaced EXIDX input section. Otherwise, issue an error.
6521 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6523 (Target_arm::got_mode_index_entry): Handle static linking.
6524 (Target_arm::Scan::local): Ditto.
6525 (Target_arm::Scan::global): Ditto.
6526 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6527 all incorrectly implemented relocations.
6528 (Target_arm::fix_exidx_coverage): Pass layout to
6529 Arm_output_section::fix_exidx_coverage.
6530 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6531 from ".ARM.exidx." and ".ARM.extab.".
6533 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6535 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6536 section if it does not already exist.
6537 * attributes.cc (Attributes_section_data::Attributes_section_data):
6538 Don't crash if size is zero.
6540 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6541 Ian Lance Taylor <iant@google.com>
6543 * gold.cc (queue_middle_tasks): If no input files were opened,
6545 * workqueue.h (Task_function::Task_function): Assert that there is
6548 2010-02-22 Doug Kwan <dougkwan@google.com>
6550 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6551 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6552 types to avoid warnings due to different uint64_t implementations
6555 2010-02-21 Doug Kwan <dougkwan@google.com>
6557 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6558 handling of the maximum backward branch offset.
6559 (Arm_relocate_functions::thumb_branch_common): Ditto.
6560 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6561 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6562 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6563 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6564 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6565 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6566 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6567 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6568 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6569 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6570 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6571 thumb2_bl_out_of_range.o): New rules.
6572 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6573 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6574 thumb2_bl_out_of_range
6575 * testsuite/Makefile.in: Regenerate.
6576 * testsuite/arm_bl_in_range.s: New file.
6577 * testsuite/arm_bl_out_of_range.s: Ditto.
6578 * testsuite/arm_branch_in_range.sh: Ditto.
6579 * testsuite/arm_branch_range.t: Ditto.
6580 * testsuite/thumb2_branch_range.t: Ditto.
6581 * testsuite/thumb_bl_in_range.s: Ditto.
6582 * testsuite/thumb_bl_out_of_range.s: Ditto.
6583 * testsuite/thumb_branch_range.t: Ditto.
6585 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6587 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6588 Add reloc offset information.
6589 * icf.cc (get_section_contents): Change iterators to point to the new
6590 vectors. Add reloc offset information to the contents.
6591 * icf.h (Icf::Sections_reachable_info): New typedef.
6592 (Icf::Sections_reachable_list): New typedef.
6593 (Icf::Offset_info): New typedef.
6594 (Icf::Reloc_info): New struct typedef.
6595 (Icf::Reloc_info_list): New typedef.
6596 (Icf::symbol_reloc_list): Delete method.
6597 (Icf::addend_reloc_list): Delete method.
6598 (Icf::section_reloc_list): Delete method.
6599 (Icf::reloc_info_list): New method.
6600 (Icf::reloc_info_list_): New member.
6602 2010-02-19 Doug Kwan <dougkwan@google.com>
6604 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6605 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6606 * arm.cc (Arm_relocation_functions): New forward declaration.
6607 (Target_arm::Target_arm): Initialize new data members
6608 got_mod_index_offset_ and tls_base_symbol_defined_.
6609 (Target_arm::Relocate::relocate_tls): New method.
6610 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6611 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6613 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6614 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6615 (Target_arm::got_mod_index_offset_,
6616 Target_arm::tls_base_symbol_defined_): New data members.
6617 (Target_arm::Scan::local, Target::Scan::global,
6618 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6621 2010-02-18 Doug Kwan <dougkwan@google.com>
6623 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6624 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6625 text section as a parameter becuase some broken tools may not set
6626 the link in section header.
6627 (Target_arm::has_got_section): New method.
6628 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6629 without any mapping symbol as data only. Remove warning.
6630 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6631 link in its section header, try to discover the link by inspecting the
6632 REL31 relocation at the beginning of the section.
6633 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6635 (Target_arm::Scan::global): Treat any reference to the symbol
6636 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6638 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6640 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6641 (Scan::global_reloc_may_be_function_pointer): New function.
6642 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6643 (Scan::global_reloc_may_be_function_pointer): New function.
6644 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6645 (Scan::global_reloc_may_be_function_pointer): New function.
6646 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6647 (Scan::global_reloc_may_be_function_pointer): New function.
6648 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6649 (Scan::global_reloc_may_be_function_pointer): New function.
6650 (Scan::possible_function_pointer_reloc): New function.
6651 (Target_x86_64::can_check_for_function_pointers): New function.
6652 * gc.h (gc_process_relocs): Scan relocation types to determine if
6653 function pointers were taken for targets that support it.
6654 * icf.cc (Icf::find_identical_sections): Include functions for
6655 folding in safe ICF whose pointer is not taken.
6656 * icf.h (Secn_fptr_taken_set): New typedef.
6657 (fptr_section_id_): New member.
6658 (section_has_function_pointers): New function.
6659 (set_section_has_function_pointers): New function.
6660 (check_section_for_function_pointers): New function.
6661 * options.h: Fix comment for safe ICF option.
6662 * target.h (can_check_for_function_pointers): New function.
6663 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6664 Modify icf_safe_test for X86-64.
6665 * testsuite/Makefile.in: Regenerate.
6666 * testsuite/icf_safe_so_test.cc: New file.
6667 * testsuite/icf_safe_so_test.sh: New file.
6668 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6669 (main): Change to take pointer to function kept_func_3.
6670 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6671 folding is done correctly for X86-64.
6673 2010-02-12 David S. Miller <davem@davemloft.net>
6675 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6676 is_symbolless parameter.
6677 (Output_reloc<SHT_REL>::is_symbolless): New.
6678 (Output_reloc<SHT_REL>::is_symbolless_): New.
6679 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6680 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6681 (Output_reloc<SHT_RELA>::is_symbolless): New.
6682 (Output_data_reloc::add_global): Handle is_symbolless.
6683 (Output_data_reloc::add_global_relative): Likewise.
6684 (Output_data_reloc::add_local): Likewise.
6685 (Output_data_reloc::add_local_relative): Likewise.
6686 (Output_data_reloc::add_symbolless_global_addend): New.
6687 (Output_data_reloc::add_symbolless_local_addend): New.
6688 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6690 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6691 instead of ->is_relative_
6692 (Output_reloc::write): Likewise.
6693 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6694 (Output_reloc::write_rel): Simplify.
6696 * sparc.cc (Target_sparc::Scan::local): Use
6697 ->add_symbolless_local_addend as needed.
6698 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6699 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6700 based upon relocation offset.
6702 2010-02-11 Doug Kwan <dougkwan@google.com>
6704 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6705 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6706 beginning of function.
6707 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6708 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6709 parameter is_32bit in calls to should_apply_static_reloc.
6710 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6711 (check_DATA): Add arm_abs_global.stdout.
6712 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6713 arm_abs_global.stdout): New rules.
6714 (MOSTLLYCLEANFILES): Add arm_abs_global
6715 * Makefile.in: Regenerate.
6716 * testsuite/arm_abs_global.s: New file.
6717 * testsuite/arm_abs_global.sh: Ditto.
6718 * testsuite/arm_abs_lib.s: Ditto.
6720 2010-02-11 Ian Lance Taylor <iant@google.com>
6722 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6724 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6725 Allocate_commons_task first.
6726 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6727 task, rather than symtab_lock_.
6728 (Gc_process_relocs::~Gc_process_relocs): New function.
6729 (Gc_process_relocs::is_runnable): Check this_blocker_.
6730 (Gc_process_relocs::locks): Use next_blocker_ rather than
6732 (Scan_relocs::~Scan_relocs): New function.
6733 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6735 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6737 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6738 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6739 constructor accordingly.
6740 (class Gc_process_relocs): Likewise.
6741 (class Scan_relocs): Likewise.
6742 * common.h (class Allocate_commons_task): Remove symtab_lock_
6743 field, and corresponding constructor parameter.
6744 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6746 (Allocate_commons_task::locks): Likewise.
6748 2010-02-11 Ian Lance Taylor <iant@google.com>
6750 * gold-threads.h (class Once): Define.
6751 (class Initialize_lock): Rewrite as child of Once.
6752 * gold-threads.cc (class Once_initialize): Define.
6753 (once_pointer_control): New static variable.
6754 (once_pointer, once_arg): New static variables.
6755 (c_run_once): New static function.
6756 (Once::Once, Once::run_once, Once::internal_run): New functions.
6757 (class Initialize_lock_once): Remove.
6758 (initialize_lock_control): Remove.
6759 (initialize_lock_pointer): Remove.
6760 (initialize_lock_once): Remove.
6761 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6762 (Initialize_lock::initialize): Rewrite.
6763 (Initialize_lock::do_run_once): New function.
6764 * archive.cc (Archive::interpret_header): Only clear name if it is
6766 * fileread.cc: Include "gold-threads.h"
6767 (file_counts_lock): New static variable.
6768 (file_counts_initialize_lock): Likewise.
6769 (File_read::release): Only increment counts when using --stats.
6770 Use a lock around the increment.
6771 * parameters.cc (class Set_parameters_target_once): Define.
6772 (set_parameters_target_once): New static variable.
6773 (Parameters::Parameters): Move here from parameters.h.
6774 (Parameters::set_target): Rewrite.
6775 (Parameters::set_target_once): New function.
6776 (Parameters::clear_target): Move here and rewrite.
6777 * parameters.h (class Parameters): Update declarations. Add
6778 set_parameters_target_once_ field.
6779 (Parameters::Parameters): Move to parameters.cc.
6780 (Parameters::clear_target): Likewise.
6781 * readsyms.cc (Read_symbols::do_group): Create a Start_group
6783 (Start_group::~Start_group): New function.
6784 (Start_group::is_runnable): New function.
6785 (Start_group::locks, Start_group::run): New functions.
6786 (Finish_group::run): Change saw_undefined to size_t.
6787 * readsyms.h (class Start_group): Define.
6788 (class Finish_group): Change saw_undefined_ field to size_t.
6789 (Finish_group::Finish_group): Remove saw_undefined and
6790 this_blocker parameters. Change all callers.
6791 (Finish_group::set_saw_undefined): New function.
6792 (Finish_group::set_blocker): New function.
6793 * symtab.h (class Symbol_table): Change saw_undefined to return
6794 size_t. Change saw_undefined_ field to size_t.
6795 * target-select.cc (Set_target_once::do_run_once): New function.
6796 (Target_selector::Target_selector): Initialize set_target_once_
6797 field. Don't initialize lock_ and initialize_lock_ fields.
6798 (Target_selector::instantiate_target): Rewrite.
6799 (Target_selector::set_target): New function.
6800 * target-select.h (class Set_target_once): Define.
6801 (class Target_selector): Update declarations. Make
6802 Set_target_once a friend. Remove lock_ and initialize_lock_
6803 fields. Add set_target_once_ field.
6805 2010-02-10 Ian Lance Taylor <iant@google.com>
6807 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6809 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
6810 (queue_middle_tasks): Add all blockers before queueing any tasks.
6811 (queue_final_tasks): Likewise.
6812 * token.h (Task_token::add_blockers): New function.
6813 * object.h (Input_objects::number_of_relobjs): New function.
6815 2010-02-10 Ian Lance Taylor <iant@google.com>
6817 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6818 shared, not if not position independent.
6819 * x86_64.cc (Relocate::relocate_tls): Likewise.
6820 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6821 (tls_pie_pic_test): New target.
6822 * testsuite/Makefile.in: Rebuild.
6824 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6825 (tls_test_main_pie.o, tls_test_pie.o): New targets.
6826 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6827 * testsuite/Makefile.in: Rebuild.
6829 2010-02-09 David S. Miller <davem@davemloft.net>
6831 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6832 R_SPARC_RELATIVE using ->add_local_relative().
6833 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6835 * output.h (Output_data_dynamic::add_section_size): New method
6836 that takes two Output_data objects.
6837 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6838 entry param. Handle it in initializers.
6839 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6840 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6841 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6843 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6844 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6845 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6846 for dynrel_includes_plt.
6847 * i386.cc (Target_i386::do_finalize_sections): Likewise.
6848 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6849 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6851 (Target_sparc::do_finalize_sections): Update to pass true for
6852 dynrel_includes_plt.
6853 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6854 output before .rela.plt
6855 (Target_powerpc::do_finalize_sections): Update to pass true for
6856 dynrel_includes_plt when 32-bit.
6858 2010-02-08 Doug Kwan <dougkwan@google.com>
6860 * arm.cc (Arm_relobj::simple_input_section_output_address): New
6862 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6863 Arm_relobj::scan_section_for_cortex_a8_stubs,
6864 Arm_relobj::do_relocation_section): Instead of calling
6865 Output_section::output_address, use faster
6866 Arm_relobj::simple_input_section_output_address.
6868 2010-02-08 David S. Miller <davem@davemloft.net>
6870 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6871 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6872 relocation helper function.
6874 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6875 just like R_SPARC_GOT{10,13,22}.
6876 (Target_sparc::Scan::local): Likewise.
6877 (Target_sparc::Relocate:relocate): Likewise.
6879 2010-02-06 Ian Lance Taylor <iant@google.com>
6881 * configure.ac: Rewrite targetobjs duplicate removal code to use
6882 only shell constructs.
6883 * configure: Rebuild.
6885 2010-02-05 Doug Kwan <dougkwan@google.com>
6888 * arm.cc (Arm_relobj::section_is_scannable): New method.
6889 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6890 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6892 2010-02-04 Doug Kwan <dougkwan@google.com>
6895 * arm-reloc-property.cc (cstdio): Include.
6896 * configure.ac (targetobjs): Remove duplicates.
6897 * configure: Regenerate.
6898 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6899 big and little endian version for a given address size.
6901 2010-02-03 Doug Kwan <dougkwan@google.com>
6903 * arm-reloc-property.cc
6904 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6906 * arm-reloc-property.h
6907 (Arm_reloc_property_table::get_implemented_static_reloc_property):
6908 New method definition.
6909 (Arm_reloc_property_table::reloc_name_in_error_message): New method
6911 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6913 (GOT_PREL): Change implemented to Y.
6914 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6915 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6916 (Arm_relocate_functions::movw_abs_nc): Remove method.
6917 (Arm_relocate_functions::movt_abs): Ditto.
6918 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6919 (Arm_relocate_functions::thm_movt_abs): Ditto.
6920 (Arm_relocate_functions::movw_rel_nc): Ditto.
6921 (Arm_relocate_functions::movw_rel): Ditto.
6922 (Arm_relocate_functions::movt_rel): Ditto.
6923 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6924 (Arm_relocate_functions:thm_movw_rel): Ditto.
6925 (Arm_relocate_functions:thm_movt_rel): Ditto.
6926 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6927 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6928 New method definitions.
6929 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6930 (Arm_relocation_functions::arm_grp_ldr): Ditto.
6931 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6932 (Arm_relocation_functions::arm_grp_ldc): Ditto.
6933 (Target_arm::Relocate::relocate): Check for non-static or
6934 unimplemented relocation code and exit early. Change calls to
6935 Target_arm::reloc_uses_thumb_bit and
6936 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6937 instead. Refactor code to handle similar relocations to increase
6938 code sharing. Remove check for unsupported relocation code in switch
6940 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6941 relocation property table to find out size. Change error message to
6942 print out the name of a relocation code instead of the numeric value.
6943 (Target_arm::scan_reloc_for_stub): Use relocation property table
6944 instead of calling Target_arm::reloc_uses_thumb_bit().
6946 2010-02-02 Doug Kwan <dougkwan@google.com>
6948 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6949 types of relaxed input section.
6951 2010-02-02 Doug Kwan <dougkwan@google.com>
6953 * Makefile.am (HFILES): Add arm-reloc-property.h.
6955 (TARGETSOURCES): Add arm-reloc-property.cc
6956 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6957 (libgold_a_SOURCES): $(DEFFILES)
6958 * Makefile.in: Regenerate.
6959 * arm-reloc-property.cc: New file.
6960 * arm-reloc-property.h: New file.
6961 * arm-reloc.def: New file.
6962 * arm.cc: Update comments.
6963 (arm-reloc-property.h): New included header.
6964 (arm_reloc_property_table): New global variable.
6965 (Target_arm::do_select_as_default_target): New method definition.
6966 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6967 arm-reloc-property to targ_extra_obj.
6968 * parameters.cc (set_parameters_target): Call
6969 Target::select_as_default_target().
6970 * target.h (Target::select_as_default_target): New method definition.
6971 (Target::do_select_as_default_target): Same.
6973 2010-02-01 Doug Kwan <dougkwan@google.com>
6975 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6976 first_output_text_section_.
6977 (Arm_exidx_fixup::first_output_text_section): New method definition.
6978 (Arm_exidx_fixup::first_output_text_section_): New data member.
6979 (Arm_exidx_fixup::process_exidx_section): Record the first text
6980 output section seen.
6981 (Arm_output_section::fix_exidx_coverage): Set correct linked section
6982 and entsize in output section header.
6984 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6986 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6987 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6988 (Arm_relocate_functions::thm_alu11): New Method.
6989 (Arm_relocate_functions::thm_pc8): New Method.
6990 (Arm_relocate_functions::thm_pc12): New Method.
6991 (Target_arm::Scan::local): Handle the relocations.
6992 (Target_arm::Scan::global): Likewise.
6993 (Target_arm::Relocate::relocate): Likewise.
6994 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6996 2010-01-29 Doug Kwan <dougkwan@google.com>
6998 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6999 of relocation types as ld.
7001 2010-01-29 Doug Kwan <dougkwan@google.com>
7003 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7005 (Arm_relocate_functions::thumb_branch_common): Ditto.
7006 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7007 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7008 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7009 Arm_relocate_functions::jump24): Remove.
7010 (Target_arm::Relocate::relocate): Adjust code to call
7011 Arm_relocation_functions::arm_branch_common and
7012 Arm_relocation_functions::thumb_branch_common instead of their removed
7013 wrappers. Merge switch-cases together to reduce source code size.
7015 2010-01-29 Doug Kwan <dougkwan@google.com>
7017 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7018 output_local_symbol_count_needs_update_.
7019 (Arm_relobj::output_local_symbol_count_needs_update,
7020 Arm_relobj::set_output_local_symbol_count_needs_update,
7021 Arm_relobj::update_output_local_symbol_count): New methods.
7022 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7024 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7025 of pointed function as in a R_ARM_PREL31 relocation.
7026 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7027 for output local symbol count updating.
7028 (Target_arm::do_relax): Update output local symbol counts in objects
7030 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7032 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7034 * arm.cc: Added support for the ARM relocations:
7035 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7036 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7037 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7039 (Arm_relocate_functions::movw_rel): New method.
7040 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7041 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7043 (Arm_relocate_functions::thm_movw_rel): New method.
7044 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7046 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7048 (Target_arm::Scan::global): Likewise.
7049 (Target_arm::Relocate::relocate): Likewise.
7050 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7053 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7055 * arm.cc: Added support for ARM group relocations.
7056 (Target_arm::reloc_needs_sym_origin): New method.
7057 (Arm_relocate_functions::calc_grp_kn): New method.
7058 (Arm_relocate_functions::calc_grp_residual): New method.
7059 (Arm_relocate_functions::calc_grp_gn): New method.
7060 (Arm_relocate_functions::arm_grp_alu): New Method.
7061 (Arm_relocate_functions::arm_grp_ldr): New Method.
7062 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7063 (Arm_relocate_functions::arm_grp_ldc): New Method.
7064 (Target_arm::Scan::local): Handle the ARM group relocations.
7065 (Target_arm::Scan::global): Likewise.
7066 (Target_arm::Relocate::relocate): Likewise.
7067 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7070 2010-01-26 Doug Kwan <dougkwan@google.com>
7072 * arm.cc (set): Include.
7073 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7075 (Arm_output_section::Text_section_list): New type.
7076 (Arm_output_section::append_text_sections_to_list): New method.
7077 (Arm_output_section::fix_exidx_coverage): Ditto.
7078 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7079 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7080 Relobj::set_section_offset() instead of
7081 Sized_relobj::invalidate_section_offset().
7082 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7083 parameter for section headers. Ignore relocation sections for
7084 unallocated sections and EXIDX sections.
7085 (Target_arm::fix_exidx_coverage): New method.
7086 (Target_arm::output_section_address_less_than): New type.
7087 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7088 linked text section instead of the EXIDX section.
7089 (Arm_output_section::create_stub_group): Add an assertion to check
7090 that this is not an EXIDX output section.
7091 (Arm_output_section::append_text_sections_to_list): New method.
7092 (Arm_output_section::fix_exidx_coverage): Ditto.
7093 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7094 Arm_relobj::section_needs_reloc_stub_scanning.
7095 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7097 (Target_arm::fix_exidx_coverage): New method.
7098 * object.h (Relobj::set_output_section): New method.
7099 (Sized_relobj::invalidate_section_offset): Remove method.
7100 (Sized_relobj::do_invalidate_section_offset): Remove method.
7101 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7103 2010-01-25 Doug Kwan <dougkwan@google.com>
7105 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7106 Fix warning due to signed and unsigned comparison on a 32-bit host.
7108 2010-01-22 Doug Kwan <dougkwan@google.com>
7110 * arm.cc (Target_arm::do_relax): Record an output section for section
7111 offset adjustment it contains any stub table that has changed.
7112 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7113 offsets in an output section if necessary.
7114 * output.cc (Output_section::Output_section): Initialize
7115 section_offsets_need_adjustments_.
7116 (Output_section::add_input_section_for_script): Renamed to
7117 Output_section::add_simple_input_section.
7118 (Output_section::save_states): Add a comment.
7119 (Output_section::discard_states): New method defintion.
7120 (Output_section::adjust_section_offsets): Same.
7121 * output.h (Output_section::add_input_section_for_script): Renamed to
7122 Output_section::add_simple_input_section.
7123 (Output_section::discard_states): New method declaration.
7124 (Output_section::adjust_section_offsets): Same.
7125 (Output_section::section_offsets_need_adjustment,
7126 Output_section::set_section_offsets_need_adjustment): New method
7128 (Output_section::section_offsets_need_adjustment_): New data member.
7129 * script-sections.cc
7130 (Output_section_element_input::set_section_address): Adjust code for
7131 renaming of Output_section::add_input_section_for_script.
7132 (Orphan_output_section::set_section_address): Same.
7134 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7136 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7137 Fix_v4bx enum values .
7138 * gold/options.h (General_options): New option definitions.
7139 (General_options::fix_v4bx): New method.
7140 (General_options::Fix_v4bx): New enum.
7141 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7142 (General_options::parse_fix_v4bx_interworking): New method.
7144 2010-01-22 Doug Kwan <dougkwan@google.com>
7146 * arm.cc (Arm_exidx_fixup): New class.
7148 2010-01-21 Doug Kwan <dougkwan@google.com>
7150 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7152 (Arm_exidx_section_offset_map): New type.
7154 2010-01-21 Doug Kwan <dougkwan@google.com>
7156 * arm.cc (Arm_exidx_input_section): New class.
7157 (Arm_relobj::exidx_input_section_by_link,
7158 Arm_relobj::exidx_input_section_by_shndx,
7159 Arm_relobj::make_exidx_input_section): New methods.
7160 (read_arm_attributes_section): Remove.
7161 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7162 information about them.
7163 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7166 2010-01-20 Doug Kwan <dougkwan@google.com>
7168 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7169 Input_section_specifier to Section_id.
7170 (Target_arm::new_arm_input_section: Adjust code for change of key
7172 (Target_arm::find_arm_input_section): Ditto.
7173 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7174 (Section_id): Remove.
7175 (Garbage_collection::Section_id_hash): Remove.
7176 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7177 (Section_id): Remove.
7178 (Icf::Section_id_hash): Remove.
7179 * object.h (Section_id, Const_section_id, Section_id_hash,
7180 Const_section_id_hash): New type definitions.
7181 * output.cc (Output_section::add_relaxed_input_section): Change to
7182 use Const_section_id instead of Input_section_specifier as key type.
7183 (Output_section::add_merge_input_section): Ditto.
7184 (Output_section::build_relaxation_map): Change to use Section_id
7185 instead of Input_section_specifier as key type.
7186 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7188 (Output_section::convert_input_sections_to_relaxed_sections): Change
7189 to use Const_section_id instead of Input_section_specifier as key type.
7190 (Output_section::find_merge_section): Ditto.
7191 (Output_section::find_relaxed_input_section): Ditto.
7192 * output.h (Input_section_specifier): Remove class.
7193 (Output_section::Output_section_data_by_input_section_map): Change
7194 key type to Const_section_id.
7195 (Output_section::Output_relaxed_input_section_by_input_section_map):
7197 (Output_section::Relaxation_map): Change key type to Section_id.
7199 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7201 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7202 (class Arm_v4bx_stub): New class.
7203 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7204 (Stub_factory::make_arm_v4bx_stub): New method.
7205 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7206 (Stub_table::empty): Handle v4bx stubs.
7207 (Stub_table::add_arm_v4bx_stub): New method.
7208 (Stub_table::find_arm_v4bx_stub): New method.
7209 (Arm_relocate_functions::v4bx): New method.
7210 (Target_arm::fix_v4bx): New method.
7211 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7212 (Stub_table::relocate_stubs): Likewise.
7213 (Stub_table::do_write): Likewise.
7214 (Stub_table::update_data_size_and_addralign): Likewise.
7215 (Stub_table::finalize_stubs): Likewise.
7216 (Target_arm::Scan::local): Likewise.
7217 (Target_arm::Scan::global): Likewise.
7218 (Target_arm::do_finalize_sections): Likewise.
7219 (Target_arm::Relocate::relocate): Likewise.
7220 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7222 (Target_arm::scan_reloc_for_stub): Likewise.
7223 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7225 2010-01-19 Ian Lance Taylor <iant@google.com>
7227 * output.cc (Output_section_headers::do_sized_write): Write large
7228 segment count to sh_info field.
7229 (Output_file_header::do_sized_write): For large segment count,
7230 write PN_XNUM to e_phnum field.
7232 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7234 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7235 (Arm_relocate_functions::thm_jump8): New function.
7236 (Arm_relocate_functions::thm_jump11): New function.
7237 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7239 (Target_arm::Scan::global): Likewise.
7240 (Target_arm::Relocate::relocate): Likewise.
7241 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7244 2010-01-14 Doug Kwan <dougkwan@google.com>
7246 * arm.cc (map, utility): Include headers.
7247 (Target_arm::apply_cortex_a8_workaround): New method.
7248 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7249 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7250 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7251 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7252 the --[no-]fix-cortex-a8 command line options.
7253 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7254 (Target_arm::relocate_stub): Use addend in instruction template.
7255 * options.h (DEFINE_bool): Set the user-set flag.
7256 (General_options): Add --[no-]-fix-cortex options.
7257 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7258 : Update fast look-up map after conversion.
7260 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7262 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7263 in the first pass of do_layout.
7265 2010-01-13 Doug Kwan <dougkwan@google.com>
7267 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7268 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7269 apparent compiler problem of not folding static constant integral
7270 data members of elfcpp::Elf_sizes<32>.
7272 2010-01-13 Doug Kwan <dougkwan@google.com>
7274 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7275 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7276 Arm_relobj::scan_section_for_cortex_a8_erratum,
7277 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7278 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7279 sections to scan for relocation stubs into a new method
7280 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7281 relocation and Cortex-A8 stub scanning.
7282 (Target_arm::do_relax): Force stubs to be after stubbed sections
7283 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7284 the beginning of a new relaxation pass. Update a comment.
7285 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7287 2010-01-12 Ian Lance Taylor <iant@google.com>
7289 * target-reloc.h (visibility_error): New inline function.
7290 (relocate_section): Call visibility_error.
7291 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7292 (MOSTLYCLEANFILES): Likewise.
7293 (protected_4_pic.o, protected_3.err): New targets.
7294 * testsuite/protected_4.cc: New file.
7296 2010-01-12 Doug Kwan <dougkwan@google.com>
7298 * arm.cc (Cortex_a8_reloc): New class.
7299 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7300 and cortex_a8_relocs_info_.
7301 (Target_arm::fix_cortex_a8): New method definition.
7302 (Target_arm::Cortex_a8_relocs_info): New type.
7303 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7304 New data member declarations.
7305 (Target_arm::scan_reloc_for_stub): Record information about
7306 relocations for THUMB branches that might be exempted from the
7307 Cortex-A8 workaround.
7308 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7309 at the beginning of a relaxation pass.
7311 2010-01-12 Doug Kwan <dougkwan@google.com>
7313 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7314 (Arm_relobj::Mapping_symbol_position,
7315 Arm_reloj::Mapping_symbol_position_less,
7316 Arm_relobj::Mapping_symbols_info): New types.
7317 (Target_arm::is_mapping_symbol_name): New method definition.
7318 (Arm_relobj::do_count_local_symbols): Save information about mapping
7321 2010-01-11 Doug Kwan <dougkwan@google.com>
7323 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7324 Arm_relocate_functions::thumb32_branch_upper,
7325 Arm_relocate_functions::thumb32_branch_lower,
7326 Arm_relocate_functions::thumb32_cond_branch_offset,
7327 Arm_relocate_functions::thumb32_cond_branch_upper,
7328 Arm_relocate_functions::thumb32_cond_branch_lower,
7329 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7330 branch offset encoding.
7331 (Arm_relocate_functions::thumb_branch_common): Use new branch
7332 offset encoding methods to avoid code duplication.
7333 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7334 (Stub_addend_reader::operator()): Use new branch encoding method
7335 to avoid code duplication.
7337 2010-01-11 Doug Kwan <dougkwan@google.com>
7339 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7340 (Target_arm::do_finalize_sections): Define special EXIDX section
7341 symbols only if referenced.
7342 * gc.h (Garbage_collection::add_reference): New method.
7343 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7346 2010-01-11 Ian Lance Taylor <iant@google.com>
7348 * script.cc (Version_script_info::build_expression_list_lookup):
7349 Change complaing about duplicate wildcard match from error to
7352 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7354 (Version_script_info::Version_script_info): Initialize globs_,
7355 default_version_, default_is_global_, and exact_. Don't
7356 initialize globals_ or locals_.
7357 (Version_script_info::build_lookup_tables): Build local symbols
7359 (Version_script_info::unquote): New function.
7360 (Version_script_info::add_exact_match): New function.
7361 (Version_script_info::build_expression_list_lookup): Remove lookup
7362 parameter. Add is_global parameter. Change all callers. Handle
7363 wildcard pattern specially. Unquote pattern. Call
7365 (Version_script_info::get_name_to_match): New function.
7366 (Version_script_info::get_symbol_version): New function.
7367 (Version_script_info::get_symbol_version_helper): Remove.
7368 (Version_script_info::check_unmatched_names): Call unquote.
7369 * script.h (class Version_script_info): Change get_symbol_version
7370 to be non-inline and add is_global parameter; change all callers.
7371 Rewrite symbol_is_local. Update declarations. Define struct
7372 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7373 Remove globals_ and locals_ members. Add exact_, globs_,
7374 default_version_, is_global_.
7375 (Version_script_info::Glob): Remove pattern, add expression and
7376 is_global. Update constructor. Change all callers.
7377 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7379 (Versions::symbol_section_contents): If a symbol is undefined, or
7380 defined in a dynamic object, set the version index to
7382 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7384 (Symbol_table::add_from_pluginobj): Likewise.
7385 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7387 2010-01-11 Doug Kwan <dougkwan@google.com>
7389 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7390 (incremental_dump_LDADD): Add linking option for libintl.
7391 * Makefile.in: Regenerate.
7393 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7396 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7398 * testsuite/Makefile.in: Regenerated.
7400 2010-01-10 Doug Kwan <dougkwan@google.com>
7402 * options.h (DEFINE_var): Use parentheses around argument varname__
7403 in macro body to avoid any unintended subsequent substitutions.
7405 2010-01-10 Ian Lance Taylor <iant@google.com>
7407 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7408 candidates before doing symbol resolution.
7410 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7411 ODR candidates if only one is weak.
7413 2010-01-08 Ian Lance Taylor <iant@google.com>
7415 * script.cc (Version_script_info::build_expression_list_lookup):
7416 Don't warn about ambiguous version, just record the ambiguity.
7417 (Version_script_info::get_symbol_version_helper): Give error if
7418 version is ambiguous.
7420 2010-01-08 Doug Kwan <dougkwan@google.com>
7422 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7423 prev_data_size_ and prev_addralign_. Remove initializer for
7424 deleted data member has_been_changed_.
7425 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7426 to determine if the table is empty.
7427 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7429 (Stub_table::add_reloc_stub): Define method in class definition
7430 instead of just declaring it there.
7431 (Stub_table::add_cortex_a8_stub): New method definition.
7432 (Stub_table::update_data_size_and_addralign): Ditto.
7433 (Stub_table::finalize_stubs): Ditto.
7434 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7435 (Stub_table::do_addralign_): Return address alignment in the
7436 (Stub_table::do_reset_address_and_file_offset): Define method in
7437 class definition instead of declaring it there. Set current data
7438 size to be the data size of the previous pass.
7439 (Stub_table::set_final_data_size): Use current data size as the
7441 (Stub_table::relocate_stub): Change parameter type of stub from
7442 Reloc_stub pointer to Stub pointer.
7443 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7444 (Stub_table::Cortex_a8_stub_list): New typedef.
7445 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7446 Stub_table::prev_addralign_): New data member.
7447 (Arm_relobj::Arm_relobj): Initialize data member
7448 section_has_cortex_a8_workaround_.
7449 (Arm_relobj::section_has_cortex_a8_workaround,
7450 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7452 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7454 (Target_arm::relocate_stub): Change parameter type of stub from
7455 Reloc_stub pointer to Stub pointer.
7456 (Insn_template::size, Insn_template::alignment): Handle
7457 THUMB16_SPECIAL_TYPE.
7458 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7459 Stub_table::update_data_size_and_addralign,
7460 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7462 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7463 (Stub_table::do_write): Ditto.
7464 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7466 2010-01-08 Ian Lance Taylor <iant@google.com>
7469 * symtab.h (class Symbol): Remove fields is_target_special_ and
7470 has_plt_offset_. Add field is_defined_in_discarded_section_.
7471 (Symbol::is_defined_in_discarded_section): New function.
7472 (Symbol::set_is_defined_in_discarded_section): New function.
7473 (Symbol::has_plt_offset): Rewrite.
7474 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7475 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7476 Don't initialize is_target_special_ or has_plt_offset_.
7477 Initialize is_defined_in_discarded_section_.
7478 (Symbol_table::add_from_relobj): If appropriate, set
7479 is_defined_in_discarded_section.
7480 * resolve.cc (Symbol::override_base_with_special): Don't test
7481 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7482 * target-reloc.h (relocate_section): Do special handling for
7483 symbols defined in discarded sections for global symbols as well
7486 2010-01-08 Ian Lance Taylor <iant@google.com>
7488 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7489 the SHT_SYMTAB case.
7491 2010-01-08 Ian Lance Taylor <iant@google.com>
7493 * object.cc (Sized_relobj::do_layout): Don't get confused if
7494 layout_eh_frame returns NULL.
7496 2010-01-08 Ian Lance Taylor <iant@google.com>
7499 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7500 dynamic symbol table, use the normal symbol table.
7501 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7504 2010-01-08 Ian Lance Taylor <iant@google.com>
7507 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7510 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7512 * version.cc (print_version): Change to "Copyright 2010".
7514 2010-01-08 Ian Lance Taylor <iant@google.com>
7518 * i386.cc (class Target_i386): Change return type of plt_section
7520 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7521 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7522 tls_desc_rel_ field.
7523 (Output_data_plt_i386::rel_tls_desc): New function.
7524 (Target_i386::rel_tls_desc_section): New function.
7525 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7526 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7527 R_386_TLS_DESC reloc in rel_tls_desc_section.
7528 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7529 Define struct Tlsdesc_info.
7530 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7531 (Target_x86_64::do_reloc_symbol_index): New function.
7532 (Target_x86_64::add_tlsdesc_info): New function.
7533 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7534 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7536 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7538 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7539 (Target_x86_64::rela_tlsdesc_section): New function.
7540 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7542 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7543 (Target_x86_64::do_reloc_addend): New function.
7544 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7545 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7546 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7547 (Output_reloc::type): New function.
7548 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7549 (Output_reloc::is_target_specific): New function.
7550 (Output_reloc::target_arg): New function.
7551 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7552 absolute relocs and target specific relocs.
7553 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7554 add_target_specific.
7555 (class Output_data_reloc) [SHT_RELA]: Likewise.
7556 * output.cc (Output_reloc::Output_reloc): Add four new versions
7557 for absolute relocs and target specific relocs.
7558 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7559 (Output_reloc::get_symbol_index): Likewise.
7560 (Output_reloc::local_section_offset): Check that local_sym_index_
7561 is not TARGET_CODE or 0.
7562 (Output_reloc::symbol_value): Likewise.
7563 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7565 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7566 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7568 * layout.cc (add_target_dynamic_tags): Use output section for
7569 DT_PLTRELSZ and DT_JMPREL.
7571 2010-01-07 Ian Lance Taylor <iant@google.com>
7574 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7576 (class Output_data_reloc_generic): Define.
7577 (class Output_data_reloc_base): Change base class to
7578 Output_data_reloc_generic. Change add() method to call
7579 bump_relative_reloc_count for a relative reloc. Remove
7581 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7583 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7584 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7586 * layout.h (class Layout): Update declaration.
7588 2010-01-07 Ian Lance Taylor <iant@google.com>
7590 * output.h (class Output_data): Add const version of
7591 output_section and do_output_section.
7592 (class Output_section_data): Add const version of
7594 (class Output_section): Likewise.
7595 * layout.cc (Layout::add_target_dynamic_tags): New function.
7596 * layout.h (class Layout): Update declarations.
7597 * arm.cc (Target_arm::do_finalize_sections): Use
7598 add_target_dynamic_tags.
7599 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7600 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7601 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7602 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7604 2010-01-07 Ian Lance Taylor <iant@google.com>
7607 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7610 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7611 Ian Lance Taylor <iant@google.com>
7614 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7615 Xindex::read_symtab_xindex.
7617 2010-01-07 Doug Kwan <dougkwan@google.com>
7619 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7620 (Insn_template::thumb16_bcond_insn): New method declaration.
7621 (Insn_template): Fix spelling.
7622 (Stub::thumb16_special): New method declaration.
7623 (Stub::do_write): Define virtual method which was previously pure
7625 (Stub::do_thumb16_special): New method declaration.
7626 (Stub::do_fixed_endian_write): New template member.
7627 (Reloc_stub::do_write): Remove.
7628 (Reloc_stub::do_fixed_endian_write): Remove.
7629 (Cortex_a8_stub): New class definition.
7630 (Stub_factory::make_cortex_a8_stub): New method definition.
7631 (Stub_factory::Stub_factory): Add missing static storage class
7632 qualifier for elf32_arm_stub_a8_veneer_blx.
7634 2010-01-07 Ian Lance Taylor <iant@google.com>
7637 * options.h (class General_options): Add --warn-unresolved-symbols
7638 and --error-unresolved-symbols.
7639 * errors.cc (Errors::undefined_symbol): Implement
7640 --warn-unresolved-symbols.
7642 * options.h (class General_options): Add -z text and -z textoff.
7643 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7645 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7647 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7648 (Garbage_collection::cident_sections): New function.
7649 (Garbage_collection::add_cident_section): New function.
7650 (Garbage_collection::cident_sections_): New member.
7651 (gc_process_relocs): Add references to sections whose names are C
7653 * gold.h (cident_section_start_prefix): New constant.
7654 (cident_section_stop_prefix): New constant.
7655 (is_cident): New function.
7656 * layout.cc (Layout::define_section_symbols): Replace string constants
7657 with the newly defined constants.
7658 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7660 * testsuite/Makefile.am: Add gc_orphan_section_test.
7661 * testsuite/Makefile.in: Regenerate.
7662 * testsuite/gc_orphan_section_test.cc: New file.
7663 * testsuite/gc_orphan_section_test.sh: New file.
7665 2010-01-06 Ian Lance Taylor <iant@google.com>
7668 * options.h (class General_options): Add --warn-shared-textrel.
7669 * layout.cc (Layout::finish_dynamic_section): Implement
7670 --warn-shared-textrel.
7673 * options.h (class General_options): Add --warn-multiple-gp.
7675 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7677 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7678 $(THREADSLIB) and $(LIBDL).
7679 * Makefile.in: Rebuild.
7681 2010-01-06 Ian Lance Taylor <iant@google.com>
7684 * options.cc (General_options::parse_section_start): New function.
7685 (General_options::section_start): New function.
7686 (General_options::General_options): Initialize all members.
7687 * options.h: Include <map>
7688 (class General_options): Add --section-start. Add section_starts_
7690 * layout.cc (Layout::attach_allocated_section_to_segment): If
7691 --section-start was used, set the address of the segment. Remove
7692 local sort_sections.
7693 (Layout::relaxation_loop_body): If the address of the load segment
7694 has been set by --section-start, don't use it.
7695 * output.h (Output_segment::update_flags_for_output_section): New
7697 * output.cc (Output_segment::add_output_section): Call
7698 update_flags_for_output_section.
7700 2010-01-05 Ian Lance Taylor <iant@google.com>
7703 * options.h (class General_options): Add --undefined-version.
7704 * script.cc (struct Version_expression): Add was_matched_by_symbol
7706 (Version_script_info::matched_symbol): New function.
7707 (Version_script_info::get_symbol_version_helper): Call
7709 (Version_script_info::check_unmatched_names): New function.
7710 * script.h (class Version_script_info): Update declarations.
7711 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7713 * options.h (class General_options): Use DEFINE_bool_alias for
7714 allow_multiple_definition.
7715 * resolve.cc (Symbol_table::should_override): Don't test
7716 allow_multiple_definition.
7719 * options.h (class General_options): Add --cref.
7720 * main.cc (main): Print cref table if --cref. Don't close mapfile
7721 until after printing cref table.
7722 * cref.cc: Include "symtab.h".
7723 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7724 (Cref_table_compare::operator()): New function.
7725 (Cref_inputs::gather_cref): New function.
7726 (filecol): New static const.
7727 (Cref_inputs::print_cref): New function.
7728 (Cref::print_cref): New function.
7729 * cref.h: Include <cstdio>.
7730 (class Cref): Update declarations.
7731 * mapfile.h (Mapfile::file): New function.
7732 * object.h (class Object): Define Symbols. Declare virtual
7733 do_get_global_symbols.
7734 (Object::get_global_symbols): New function.
7735 * object.cc (Input_objects::add_object): Pass object to cref_ if
7737 (Input_objects::archive_start): Likewise.
7738 (Input_objects::archive_stop): Likewise.
7739 (Input_objects::print_cref): New function.
7740 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7741 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7743 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7745 * plugin.h (class Sized_pluginobj): Update declarations.
7747 2010-01-05 Ian Lance Taylor <iant@google.com>
7749 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7750 to is_default_version. Rename insdef to insdefault.
7751 (Symbol_table::add_from_relobj): Rename def to is_default_version
7752 and local to is_forced_local.
7753 (Symbol_table::add_from_pluginobj): Likewise.
7754 (Symbol_table::add_from_dynobj): Likewise.
7755 (Symbol_table::define_special_symbol): Rename insdef to
7758 2010-01-04 Ian Lance Taylor <iant@google.com>
7761 * options.h (class General_options): Add
7762 --allow-multiple-definition and -z muldefs.
7763 * resolve.cc (Symbol_table::should_override): Don't warn about a
7764 multiple symbol definition if --allow-multiple-definition or -z
7768 * options.h (class General_options): Add --add-needed and
7769 --copy-dt-needed-entries. Tweak --as-needed help entry.
7770 * object.cc (Input_objects::check_dynamic_dependencies): Give an
7771 error if --copy-dt-needed-entries aka --add-needed is used and
7772 would cause a change in behaviour.
7775 * options.h (class General_options): Add -G as a short version of
7776 --shared. Add no-op options -assert, -g, and -i.
7778 2010-01-04 Sriraman Tallam <tmsriram@google.com>
7780 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7781 check for .text or .gnu.linkonce.t sections.
7782 * icf.cc (Icf::find_identical_sections): Ditto.
7783 Change the detection for mangled function name within the section
7785 * icf.h (is_section_foldable_candidate): New function.
7787 2009-12-30 Ian Lance Taylor <iant@google.com>
7790 * options.h (class General_options): Permit two dashes with
7791 --retain-symbols-file.
7793 2009-12-30 Ian Lance Taylor <iant@google.com>
7796 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7797 don't put the file header and segment headers in the text
7801 * common.cc (Sort_commons::operator()): Stabilize sort when both
7803 (Symbol_table::do_allocate_commons_list): When allocating common
7804 symbols, skip a symbol which is no longer common.
7805 * symtab.h (Symbol::is_common): Test whether the symbol comes from
7806 an object before checking its type.
7807 * testsuite/common_test_2.c: New file.
7808 * testsuite/common_test_3.c: New file.
7809 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7810 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7811 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7812 (common_test_2_pic.o, common_test_2.so): New targets.
7813 (common_test_3_pic.o, common_test_3.so): New targets.
7814 * testsuite/Makefile.in: Rebuild.
7817 * script.cc (read_input_script): If we see a new SECTIONS clause,
7818 and we have added an input section, give an error.
7819 * layout.h (class Layout): Add have_added_input_section function.
7820 Add have_added_input_section_ field.
7821 * layout.cc (Layout::Layout): Initialize
7822 have_added_input_section_.
7823 (Layout::layout): Set have_added_input_section_.
7824 (Layout::layout_eh_frame): Likewise.
7826 2009-12-30 Ian Lance Taylor <iant@google.com>
7829 * options.h (class General_options): Add --sort-common option.
7830 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7831 * common.cc (Sort_common): Add sort_order parameter to
7832 constructor. Add sort_order_ field.
7833 (Sort_commons::operator): Check sort_order_.
7834 (Symbol_table::allocate_commons): Determine the sort order.
7835 (Symbol_table::do_allocate_commons): Add sort_order parameter.
7837 (Symbol_table::do_allocate_commons_list): Likewise.
7839 2009-12-30 Ian Lance Taylor <iant@google.com>
7842 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7843 symbols from this object, don't change the visibility of an
7845 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7847 2009-12-30 Ian Lance Taylor <iant@google.com>
7850 * script.h (class Version_script_info): Define Language enum.
7851 Update declarations. Define Glob, Exact, and Lookup types. Add
7852 new fields globals_, locals_, and is_finalized_.
7853 * script.cc: Various formatting fixes.
7854 (class Parser_closure): Change language_stack_ from a vector of
7855 std::string to one of Version_script_info::Language. Adjust all
7857 (class Lazy_demangler): Remove.
7858 (struct Version_expression): Change language from std::string to
7859 Version_script_info::Language.
7860 (Version_script_info::Version_script_info): New function.
7861 (Version_script_info::~Version_script_info): Don't call clear.
7862 (Version_script_info::finalize): New function.
7863 (Version_script_info::build_lookup_tables): New function.
7864 (Version_script_info::build_expression_list_lookup): New
7866 (Version_script_info::get_symbol_version_helper): Rewrite to use
7868 (Version_script_info::print_expression_list): Adjust to use
7869 Version_script_info::Language.
7870 (script_push_lex_into_version_mode): Check that the version script
7871 has not been finalized.
7872 (version_script_push_lang): Change language string to
7873 Version_script_info::Language.
7874 * options.cc (Command_line::version_script): New function.
7875 * options.h (class General_options): Add finalize_dynamic_list
7876 function. Change version_script from declaration to definition.
7877 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7878 * testsuite/version_script.map: Remove duplicate def of foo.
7879 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7881 * testsuite/Makefile.in: Rebuild.
7883 2009-12-30 Ian Lance Taylor <iant@google.com>
7886 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7887 if the input symbol index is 0, make the output symbol index 0.
7889 2009-12-30 Ian Lance Taylor <iant@google.com>
7892 * options.h (class General_options): Add -x/--discard-all.
7893 * object.cc (Sized_relobj::do_count_local_symbols): Handle
7894 --discard-all. If the local symbol needs a dynamic entry, check
7895 that before handling --discard-locals.
7897 2009-12-30 Ian Lance Taylor <iant@google.com>
7900 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7902 (Output_segment::add_output_section): Don't change the flags if
7906 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7907 GNU hash table if they need a dynamic value. Otherwise, don't add
7908 them if they are defined in a dynamic object or are forced local.
7910 2009-12-29 Ian Lance Taylor <iant@google.com>
7913 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7914 .gnu.hash table for a 32-bit target.
7917 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7918 regular and a dynamic object only needs a dynamic symbol table
7919 entry if it is externally visible.
7922 * i386.cc (class Target_i386): Initialize global_offset_table_ in
7923 constructor. Add global_offset_table_ field.
7924 (Target_i386::got_section): Set global_offset_table_.
7925 (Target_i386::do_finalize_sections): Set global_offset_table_
7927 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7928 in constructor. Add global_offset_table_ field.
7929 (Target_x86_64::got_section): Set global_offset_table_.
7930 (Target_x86_64::do_finalize_sections): Set global_offset_table_
7933 * layout.cc (Layout::Layout): Initialize increase_relro_.
7934 (Layout::get_output_section): Add is_relro, is_last_relro, and
7935 is_first_non_relro parameters. Change all callers.
7936 (Layout::choose_output_section): Likewise.
7937 (Layout::add_output_section_data): Likewise.
7938 (Layout::make_output_section): Likewise.
7939 (Layout::set_segment_offsets): Clear increase_relro when using a
7941 * layout.h (class Layout): Add increase_relro method. Add
7942 increase_relro_ field. Update declarations.
7943 * output.cc (Output_section::Output_section): Initialize
7944 is_last_relro_ and is_first_non_relro_.
7945 (Output_segment::add_output_section): Group relro sections is
7946 do_sort is true. Handle is_last_relro and is_first_non_relro.
7947 (Output_segment::maximum_alignment): Remove relro handling.
7948 (Output_segment::set_section_addresses): Add increase_relro
7949 parameter. Change all callers. Add initial alignment to align
7950 relro sections on separate page. Remove old relro handling.
7951 (Output_segment::set_section_list_addresses): Remove in_relro
7952 parameter. Change all callers.
7953 (Output_segment::set_offset): Add increase parameter. Change all
7954 callers. Remove old relro handling.
7955 * output.h (class Output_section): Add new methods: is_last_relro,
7956 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7957 Add is_last_relro_ and is_first_non_relro_ fields.
7958 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7959 Create separate .got.plt section. Call increase_relro.
7960 * x86_64.cc (Target_x86_64::got_section): Likewise.
7961 * testsuite/relro_script_test.t: Add .got.plt.
7964 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7965 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7966 (Layout::finalize): Call set_dynamic_symbol_size.
7967 (Layout::set_dynamic_symbol_size): New function.
7968 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
7969 set_dynamic_symbol_size.
7972 * output.h (class Output_section): Add is_entsize_zero_ field.
7973 * output.cc (Output_section::Output_section): Initialize
7975 (Output_section::set_entsize): If two different entsizes are
7976 requested, force it to zero.
7977 (Output_section::add_input_section): Set flags for .debug_str
7978 before updating section flags. Set entsize.
7979 (Output_section::update_flags_for_input_section): Set SHF_MERGE
7980 and SHF_STRING if all input sections have those flags.
7982 2009-12-29 Rafael Espindola <espindola@google.com>
7984 * main.cc (main): Fix the sys time reporting.
7985 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7988 2009-12-29 Sriraman Tallam <tmsriram@google.com>
7990 * options.cc (General_options::parse_version): Allow -v to exit
7991 without an error if there is nothing to link.
7993 2009-12-29 Ian Lance Taylor <iant@google.com>
7995 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7996 using a version of gcc before 4.1.
7997 * configure: Rebuild.
7999 2009-12-28 Chris Demetriou <cgd@google.com>
8001 * attributes.cc (Output_attributes_section_data::do_write): Use
8002 std::vector::front rather than std::vector::data.
8004 2009-12-28 Ian Lance Taylor <iant@google.com>
8006 * symtab.h (class Symbol_table): Add enum Defined.
8007 * resolve.cc (Symbol_table::should_override): Add defined
8008 parameter. Change all callers. Test whether object is NULL
8009 before calling a method on it.
8010 (Symbol_table::report_resolve_problem): Add defined parameter.
8012 (Symbol_table::should_override_with_special): Likewise.
8013 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8014 parameter. Change all callers.
8015 (Symbol_table::do_define_in_output_data): Likewise.
8016 (Symbol_table::define_in_output_segment): Likewise.
8017 (Symbol_table::do_define_in_output_segment): Likewise.
8018 (Symbol_table::define_as_constant): Likewise.
8019 (Symbol_table::do_define_as_constant): Likewise.
8020 * script.h (class Symbol_assignment): Add is_defsym parameter to
8021 constructor; change all callers.
8022 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8023 parameter. Change all callers. Add is_defsym_ field.
8024 (class Parser_closure): Add parsing_defsym parameter to
8025 constructor; change all callers. Add parsing_defsym accessor
8026 function. Add parsing_defsym_ field.
8028 2009-12-28 Ian Lance Taylor <iant@google.com>
8030 * gold.cc (queue_middle_tasks): Fix formatting.
8031 * object.cc (Relobj::is_section_name_included): Likewise.
8033 2009-12-23 Ian Lance Taylor <iant@google.com>
8035 * i386.cc (Target_i386::do_calls_non_split): Recognize
8036 -fsplit-stack prologue for a function with a static chain.
8037 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8038 -fsplit-stack prologue when using %r11.
8040 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8042 * options.cc (General_options::parse_version): Make -v continue and do
8043 the link like GNU ld does.
8045 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8047 * Makefile.am (CCFILES): Add timer.cc.
8048 (HFILES): Add timer.h.
8049 * configure.ac: Check for sysconf and times.
8050 * main.cc: include timer.h.
8051 (main): Use Timer instead of get_run_time.
8054 * workqueue.cc: include timer.h.
8055 (Workqueue::find_and_run_task):
8056 Report user, sys and wall time.
8057 * Makefile.in: Regenerate.
8058 * config.in: Regenerate.
8059 * configure: Regenerate.
8061 2009-12-16 Doug Kwan <dougkwan@google.com>
8063 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8065 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8066 relaxed input sections.
8067 * output.cc (Output_section::find_relaxed_input_section): Change
8068 return type to Output_relaxed_input_section pointer. Adjust code
8069 for new type of relaxed_input_section_map_.
8070 * output.h (Output_section::find_relaxed_input_section): Change
8071 return type to Output_relaxed_input_section pointer.
8072 (Output_section::Output_relaxed_input_section_by_input_section_map):
8074 (Output_section::relaxed_input_section_map_): Change type to
8075 Output_section::Output_relaxed_input_section_by_input_section_map.
8076 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8079 2009-12-15 Ian Lance Taylor <iant@google.com>
8081 * layout.cc (Layout::create_shstrtab): Only write out after input
8082 sections if we are compressing debug sections.
8084 2009-12-15 Ian Lance Taylor <iant@google.com>
8086 * archive.cc (Archive::add_symbols): Only look up a symbol without
8087 a version if there is, in fact, a version.
8089 2009-12-14 Ian Lance Taylor <iant@google.com>
8091 Revert -Wshadow changes, all changes from:
8092 2009-12-11 Doug Kwan <dougkwan@google.com>
8093 2009-12-11 Nick Clifton <nickc@redhat.com>
8094 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8096 2009-12-11 Doug Kwan <dougkwan@google.com>
8098 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8100 * attributes.cc (Object_attribute::size): Ditto.
8101 (Attributes_section_data::size): Ditto.
8102 (Attributes_section_data::Attributes_section_data): Ditto.
8103 (Output_attributes_section_data::do_write): Ditto.
8104 * attributes.h (Object_attribute::set_type): Ditto.
8105 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8107 2009-12-11 Nick Clifton <nickc@redhat.com>
8109 * archive.cc: Fix shadowed variable warnings.
8111 * compressed_output.cc: Likewise.
8112 * compressed_output.h: Likewise.
8113 * configure: Likewise.
8114 * dwarf_reader.cc: Likewise.
8115 * dynobj.cc: Likewise.
8116 * dynobj.h: Likewise.
8117 * ehframe.cc: Likewise.
8118 * ehframe.h: Likewise.
8119 * errors.cc: Likewise.
8120 * expression.cc: Likewise.
8121 * fileread.cc: Likewise.
8122 * fileread.h: Likewise.
8123 * freebsd.h: Likewise.
8124 * i386.cc: Likewise.
8126 * incremental.h: Likewise.
8127 * layout.cc: Likewise.
8128 * layout.h: Likewise.
8129 * mapfile.cc: Likewise.
8130 * merge.cc: Likewise.
8131 * merge.h: Likewise.
8132 * object.cc: Likewise.
8133 * object.h: Likewise.
8134 * options.h: Likewise.
8135 * output.cc: Likewise.
8136 * output.h: Likewise.
8137 * parameters.cc: Likewise.
8138 * plugin.cc: Likewise.
8139 * powerpc.cc: Likewise.
8140 * reduced_debug_output.cc: Likewise.
8141 * reduced_debug_output.h: Likewise.
8142 * reloc.cc: Likewise.
8143 * reloc.h: Likewise.
8144 * resolve.cc: Likewise.
8145 * script-sections.cc: Likewise.
8146 * script.cc: Likewise.
8147 * script.h: Likewise.
8148 * sparc.cc: Likewise.
8149 * symtab.cc: Likewise.
8150 * symtab.h: Likewise.
8151 * target-select.cc: Likewise.
8152 * target-select.h: Likewise.
8153 * token.h: Likewise.
8154 * workqueue.cc: Likewise.
8155 * workqueue.h: Likewise.
8156 * x86_64.cc: Likewise.
8158 2009-12-10 Doug Kwan <dougkwan@google.com>
8160 * arm.cc (attributes.h): New include.
8161 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8162 (Arm_relobj::~Arm_relobj): Delete object pointed by
8163 attributes_section_data_.
8164 (Arm_relobj::attributes_section_data): New method definition.
8165 (Arm_relobj::attributes_section_data_): New data member declaration.
8166 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8167 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8168 attributes_section_data_.
8169 (Arm_dynobj::attributes_section_data): New method definition.
8170 (Arm_dynobj::attributes_section_data_): New data member declaration.
8171 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8172 initialization value of may_use_blx_ to false.
8173 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8174 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8175 object attributes to compute results instead of hard-coding.
8176 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8177 Target_arm::get_secondary_compatible_arch,
8178 Target_arm::set_secondary_compatible_arch
8179 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8180 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8181 New method declarations.
8182 (Target_arm::get_aeabi_object_attribute): New method definition.
8183 (Target_arm::attributes_section_data_): New data member declaration.
8184 (read_arm_attributes_section): New template definition.
8185 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8186 (Arm_dynobj::do_read_symbols): Ditto.
8187 (Target_arm::do_finalize_sections): Merge attributes sections from
8188 input. Check for BLX use after attributes section merging.
8189 Fix __exidx_start and __exidx_end visibility. Create an
8190 .ARM.attributes section if necessary.
8191 (Target_arm::get_secondary_compatible_arch,
8192 Target_arm::set_secondary_compatible_arch,
8193 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8194 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8195 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8196 New method definitions.
8198 2009-12-09 Ian Lance Taylor <iant@google.com>
8200 * plugin.cc (Plugin::load): Don't cast from void* to a function
8203 2009-12-09 Ian Lance Taylor <iant@google.com>
8205 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8208 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8210 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8211 Replace two_file_shared_1.so with two_file_shared_2.so.
8212 * testsuite/Makefile.in: Regenerated.
8214 2009-12-08 Doug Kwan <dougkwan@google.com>
8216 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8217 (HFILES): Add attributes.h and int_encoding.h.
8218 * Makefile.in: Regenerate.
8219 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8220 function definitions to int_encoding.cc
8221 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8222 prototypes to int_encoding.h
8223 * reduced_debug_output.cc (int_encoding.h): New include.
8224 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8225 function definitions to int_encoding.cc
8226 (insert_into_vector, read_from_pointer): Move template definitions to
8228 * attributes.cc: New file.
8229 * attributes.h: New file.
8230 * int_encoding.cc: New file.
8231 * int_encoding.h: New file.
8233 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8236 * incremental-dump.cc (dump_incremental_inputs): New.
8237 (main): Use dump_incremental_inputs.
8239 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8242 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8243 checking elfcpp::STT_FUNC.
8244 (Target_i386::Relocate::relocate): Likewise.
8245 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8247 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8248 symbols from shared libraries into normal FUNC symbols.
8250 * symtab.h (Symbol): Add is_func and use it.
8252 2009-12-05 Doug Kwan <dougkwan@google.com>
8254 * arm.cc (Target_arm::arm_info): Initialize new fields
8255 attributes_section and attributes_vendor.
8256 * i386.cc (Target_i386::i386_info): Same.
8257 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8258 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8259 fields attributes_section and attributes_vendor.
8260 * sparc.cc (Target_sparc::sparc_info): Same.
8261 * target.h (Target::attributes_section, Target::attributes_vendor,
8262 Target::is_attributes_section, Target::attribute_arg_type,
8263 Target::attributes_order): New method definitions.
8264 (Target::Target_info::attributes_section,
8265 Target::Target_info::attributes_vendor): New fields.
8266 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8267 virtual method definitions.
8268 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8269 attributes_section and attributes_vendor.
8270 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8272 2009-12-05 Doug Kwan <dougkwan@google.com>
8274 * arm.cc: Update comments about interworking and stub generation.
8275 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8276 considered as non-PIC.
8277 (Arm_relocate_functions::base_abs): Fix formatting.
8278 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8279 of function to use GOT entry address instead of offset.
8280 (Target_arm::Scan::global): Issue an error if a symbol would need a
8281 PLT does not get one because it is untyped. Remove code to create
8282 dynamic symbols for relative branches.
8283 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8284 takes unsigned integer instead of boolean.
8286 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8288 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8289 (two_file_test_LDADD): Likewise.
8290 (common_test_1_LDADD): Likewise.
8291 (exception_test_LDADD) Likewise.
8292 (weak_test_LDADD): Likewise.
8293 (many_sections_test_LDADD): Likewise.
8294 (initpri1_LDADD): Likewise.
8295 (script_test_1_LDADD): Likewise.
8296 (script_test_2_LDADD): Likewise.
8297 (justsyms_LDADD): Likewise.
8298 (binary_test_LDADD): Likewise.
8299 (large_LDADD): Likewise.
8300 * testsuite/Makefile.in: Regenerated.
8302 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8304 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8305 (Symbol_table::override_with_special): Likewise.
8306 (Symbol_table::add_from_object): Likewise.
8308 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8310 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8311 Don't set the data_offset twice.
8313 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8315 * testsuite/Makefile.in: Regenerate.
8317 2009-12-03 Doug Kwan <dougkwan@google.com>
8319 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8320 (Target_arm::do_finalize_sections): Add parameter for symbol table
8321 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8322 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8323 parameter for symbol table pointer.
8324 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8325 an additional parameter for a pointer to symbol table.
8326 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8327 parameter for a symbol table pointer.
8328 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8329 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8331 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8332 parameter for a symbol table pointer.
8334 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8336 * incremental.cc (Incremental_inputs_header)
8337 (Incremental_inputs_header_write, Incremental_inputs_entry)
8338 (Incremental_inputs_entry_write): Move ...
8339 * incremental.h (Incremental_inputs_header)
8340 (Incremental_inputs_header_write, Incremental_inputs_entry)
8341 (Incremental_inputs_entry_write): here.
8343 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8345 * incremental.cc (make_sized_incremental_binary): Set the target.
8346 Error if it is incompatible.
8347 * output.h (Output_file): Add filename method.
8349 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8351 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8352 from the get_* methods.
8354 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8356 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8357 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8358 Write 0 for the data_offset of scripts.
8360 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8362 * testsuite/Makefile.am: Add the incremental_test.sh test.
8363 * testsuite/incremental_test.sh: New.
8364 * testsuite/incremental_test_1.c: New.
8365 * testsuite/incremental_test_2.c: New.
8367 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8369 * incremental-dump.cc (main): Fix typos.
8371 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8374 * incremental-dump.cc (main): Use llu to print 64 bit values.
8376 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8377 H.J. Lu <hongjiu.lu@intel.com>
8379 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8381 (incremental_dump_LDADD): Likewise.
8382 * Makefile.in: Regenerated.
8384 2009-11-25 Doug Kwan <dougkwan@google.com>
8388 2009-11-25 Doug Kwan <dougkwan@google.com>
8390 * arm.cc (Target_arm::Target_arm): Move method definition
8391 outside of class definition. Add code to handle
8392 --target1-rel, --target1-abs and --target2= options.
8393 (Target_arm::get_reloc_reloc_type): Change method to be
8394 non-static and const.
8395 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8396 New data member declaration.
8397 (Target_arm::Scan::local, Target_arm::Scan::global,
8398 Target_arm::Relocate::relocate,
8399 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8400 Adjust call to Target_arm::get_real_reloc_type.
8401 (Target_arm::get_real_reloc_type): Use command line options
8402 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8403 * options.h (--target1-rel, --target1-abs, --target2): New
8406 2009-11-25 Doug Kwan <dougkwan@google.com>
8408 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8409 class definition. Add code to handle --target1-rel, --target1-abs
8410 and --target2= options.
8411 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8413 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8415 (Target_arm::Scan::local, Target_arm::Scan::global,
8416 Target_arm::Relocate::relocate,
8417 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8418 call to Target_arm::get_real_reloc_type.
8419 (Target_arm::get_real_reloc_type): Use command line options to
8420 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8421 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8424 2009-11-25 Doug Kwan <dougkwan@google.com>
8426 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8427 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8428 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8430 (Arm_relocate_functions::thm_call): Replace body with a call to
8431 Arm_relocate_functions::thumb_branch_common.
8432 (Arm_relocate_functions::thm_jump24,
8433 Arm_relocate_functions::thm_xpc22): New method definitions.
8434 (Arm_relocate_functions::thumb_branch_common): New method definition.
8435 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8437 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8438 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8440 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8442 * Makefile.am: Build incremental-dump
8443 * Makefile.in: Regenerate.
8444 * incremental-dump.cc: New.
8445 * incremental.cc (Incremental_inputs_header_data,
8446 Incremental_inputs_entry_data): Move to incremental.h
8447 * incremental.h: (Incremental_inputs_header_data,
8448 Incremental_inputs_entry_data): Move from incremental.cc
8450 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8452 * incremental.cc (Incremental_inputs_header,
8453 Incremental_inputs_header_write, Incremental_inputs_entry,
8454 Incremental_inputs_entry_write): Add a typedef with the data type.
8456 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8458 * incremental.cc (Incremental_inputs_header,
8459 Incremental_inputs_header_write, Incremental_inputs_entry,
8460 Incremental_inputs_entry_write): Update comment about which
8461 type has the filed descriptions.
8463 2009-11-15 Doug Kwan <dougkwan@google.com>
8465 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8466 (Arm_relocate_functions::arm_branch_common): Change method defintion
8467 in class definition to a method declaration and update list of formal
8469 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8470 Arm_relocation_functions::jump24): Adjust call to
8471 Arm_relocate_functions::arm_branch_common. Update list of formal
8473 (Arm_relocate_functions::xpc25): New method definition.
8474 (Arm_relocate_functions::arm_branch_common): Move method defintion
8475 out from class definition. Use stubs for mode-switching and extending
8477 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8478 specially. Change code to enable use of stubs in ARM branches.
8480 2009-11-10 Doug Kwan <dougkwan@google.com>
8482 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8483 in method declaration.
8484 (Target_arm::relocate_stub): New method declaration.
8485 (Target_arm::default_target): Change to return a pointer instead of
8487 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8488 Target_arm::default_target.
8489 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8491 (Target_arm::relocate_section): Adjust view.
8492 (Target_arm::relocate_stub): New method definition.
8494 2009-11-10 Doug Kwan <dougkwan@google.com>
8496 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8498 * incremental.cc (open_incremental_binary): Initialized local
8499 variables to avoid warnings.
8500 * object.cc (make_elf_object): Ditto.
8501 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8504 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8507 * testsuite/plugin_test.c: Include "config.h".
8509 2009-11-09 Doug Kwan <dougkwan@google.com>
8511 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8512 (arm_symbol_value): Remove.
8513 (Arm_relocate_functions::arm_branch_common,
8514 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8515 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8516 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8517 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8518 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8519 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8520 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8521 Arm_relocate_functions::thm_mobw_abs_nc,
8522 Arm_relocate_functions::thm_mov_abs,
8523 Arm_relocate_functions::movw_prel_nc,
8524 Arm_relocate_functions::thm_movt_abs,
8525 Arm_relocate_functions::movt_prel,
8526 Arm_relocate_functions::thm_movw_prel_nc,
8527 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8528 (Target_arm::Relocate::relocate): Only decompose address into two
8529 parts if relocation type uses the thumb-bit and pass the actual
8530 bit instead of a flag indicating that the thumb-bit is used. Adjust
8531 calls to methods in Arm_relocate_functions for this change.
8533 2009-11-08 Ian Lance Taylor <iant@google.com>
8536 * reloc.cc: Instantiate
8537 Sized_relobj::initialize_input_to_output_maps and
8538 Sized_relobj:free_input_to_output_maps.
8540 2009-11-06 Ian Lance Taylor <iant@google.com>
8543 * defstd.cc (in_segment): Set only_if_ref true for "end".
8545 2009-11-06 Doug Kwan <dougkwan@google.com>
8547 * arm.cc (class Reloc_stub): Correct a comment.
8548 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8549 (Target_arm::scan_section_for_stubs): New method declaration.
8550 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8551 Change methods from private to protected.
8552 (Target_arm::do_may_relax): New method definition.
8553 (Target_arm::do_relax, Target_arm::group_sections,
8554 Target_arm::scan_reloc_for_stub,
8555 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8556 (Target_arm::arm_input_section_map_): New data member declaration.
8557 (Target_arm::scan_reloc_for_stub,
8558 Target_arm::scan_reloc_section_for_stubs,
8559 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8560 Target_arm::do_relax): New method definitions.
8562 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8564 * configure.ac: Check for (struct stat)::st_mtim
8565 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8566 * config.in: Regenerate.
8567 * configure: Regenerate.
8569 2009-11-05 Ian Lance Taylor <iant@google.com>
8572 * output.cc (Output_segment::add_output_section): Add missing
8575 2009-11-04 Ian Lance Taylor <iant@google.com>
8578 * object.h (class Object): Add is_needed and set_is_needed
8579 methods. Add is_needed_ field. Make bool fields into bitfields.
8580 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8581 defined in a dynamic object and referenced by a regular object,
8582 set is_needed for the dynamic object.
8583 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8584 if the file is marked with as_needed and it is not needed.
8586 2009-11-04 Ian Lance Taylor <iant@google.com>
8589 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8590 tags if data is discarded by linker script.
8591 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8592 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8593 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8594 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8596 2009-11-04 Ian Lance Taylor <iant@google.com>
8598 * layout.cc (Layout::get_output_section): Add is_interp and
8599 is_dynamic_linker_section parameters. Change all callers.
8600 (Layout::choose_output_section): Likewise.
8601 (Layout::make_output_section): Likewise.
8602 (Layout::add_output_section_data): Add is_dynamic_linker_section
8603 parameter. Change all callers.
8604 * layout.h (class Layout): Update declarations.
8605 * output.h (class Output_section): Add is_interp, set_is_interp,
8606 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8607 Add is_interp_, is_dynamic_linker_section_ fields. Change
8608 generate_code_fills_at_write_ to a bitfield.
8609 * output.cc (Output_section::Output_sections): Initialize new
8611 (Output_segment::add_output_section): Add do_sort parameter.
8614 2009-11-03 Ian Lance Taylor <iant@google.com>
8617 * options.h (class General_options): Add --warn-common.
8618 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8619 merging two common symbols.
8620 (Symbol_table::should_override): Handle --warn-common when merging
8621 a common symbol with a defined symbol. Use report_resolve_problem
8622 for multiple definitions.
8623 (Symbol_table::report_resolve_problem): New function.
8624 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8626 2009-11-03 Doug Kwan <dougkwan@google.com>
8628 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8630 (Target_arm::stub_factory): New method definition.
8631 (Target_arm::new_arm_input_section,
8632 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8633 Target_arm::reloc_uses_thumb_bit): New method declarations.
8634 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8635 New type definitions.
8636 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8637 member declarations.
8638 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8639 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8640 New method definitions.
8642 2009-11-03 Ian Lance Taylor <iant@google.com>
8644 * options.h (class General_options): Add --warn_constructors.
8646 2009-11-03 Ian Lance Taylor <iant@google.com>
8649 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8650 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8652 2009-11-03 Ian Lance Taylor <iant@google.com>
8655 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8656 --msgid-bugs-address.
8657 (install-pdf): New target.
8658 (install-data_yes): Look up one directory to find mkinstalldirs.
8660 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8662 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8665 2009-10-30 Doug Kwan <dougkwan@google.com>
8667 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8669 2009-10-30 Doug Kwan <dougkwan@google.com>
8671 * arm.cc (Stub_addend_reader): New struct template definition
8672 and partial specializations.
8673 (Stub_addend_reader::operator()): New method definition for a
8674 partially specialized template.
8676 2009-10-30 Doug Kwan <dougkwan@google.com>
8678 * arm.cc (Arm_relobj::processor_specific_flags): New method
8680 (Arm_relobj::do_read_symbols): New method declaration.
8681 (Arm_relobj::processor_specific_flags_): New data member declaration.
8682 (Arm_dynobj): New class definition.
8683 (Target_arm::do_finalize_sections): Add input_objects parameter.
8684 (Target_arm::do_adjust_elf_header): New method declaration.
8685 (Target_arm::are_eabi_versions_compatible,
8686 (Target_arm::merge_processor_specific_flags): New method declaration.
8687 (Target_arm::do_make_elf_object): New overloaded method definitions
8689 (Arm_relobj::do_read_symbols): New method definition.
8690 (Arm_dynobj::do_read_symbols): Ditto.
8691 (Target_arm::do_finalize_sections): Add input_objects parameters.
8692 Merge processor-specific flags from all input objects.
8693 (Target_arm::are_eabi_versions_compatible,
8694 Target_arm::merge_processor_specific_flags,
8695 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8696 New method definitions.
8697 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8698 Input_objects pointer type parameter.
8699 * layout.cc (Layout::finalize): Pass input objects to target's.
8700 finalize_sections function.
8701 * output.cc (Output_file_header::do_sized_write): Set ELF file
8702 header's processor-specific flags.
8703 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8704 Input_objects pointer type parameter.
8705 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8706 * target.h (Input_objects): New forward class declaration.
8707 (Target::processor_specific_flags,
8708 Target::are_processor_specific_flags_sect): New method definitions.
8709 (Target::finalize_sections): Add input_objects parameter.
8710 (Target::Target): Initialize processor_specific_flags_ and
8711 are_processor_specific_flags_set_.
8712 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8714 (Target::set_processor_specific_flags): New method definition.
8715 (Target::processor_specific_flags_,
8716 Target::are_processor_specific_flags_set_): New data member
8718 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8719 Input_objects pointer type parameter.
8721 2009-10-30 Doug Kwan <dougkwan@google.com>
8723 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8725 2009-10-28 Ian Lance Taylor <iant@google.com>
8727 * object.h (class Relobj): Drop options parameter from
8728 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8729 do_scan_relocs, do_relocate. Change all callers.
8730 (class Sized_relobj): Drop options parameters from
8731 do_gc_process_relocs, do_scan_relocs, do_relocate,
8732 do_relocate_sections, relocate_sections, emit_relocs_scan,
8733 emit_relocs_scan_reltype. Change all callers.
8734 (struct Relocate_info): Remove options field and all references to
8736 * reloc.h (class Read_relocs): Remove options constructor
8737 parameter and options_ field. Change all callers.
8738 (class Gc_process_relocs, class Scan_relocs): Likewise.
8739 (class Relocate_task): Likewise.
8740 * target-reloc.h (scan_relocs): Remove options parameter. Change
8742 (scan_relocatable_relocs): Likewise.
8743 * target.h (class Sized_target): Remove options parameter from
8744 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8746 * gc.h (gc_process_relocs): Remove options parameter. Change all
8748 * arm.cc: Update functions to remove options parameters.
8749 * i386.cc: Likewise.
8750 * powerpc.cc: Likewise.
8751 * sparc.cc: Likewise.
8752 * x86_64.cc: Likewise.
8753 * testsuite/testfile.cc: Likewise.
8755 2009-10-28 Doug Kwan <dougkwan@google.com>
8757 * arm.cc (Arm_relobj): New class definition.
8758 (Arm_relobj::scan_sections_for_stubs,
8759 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8760 New method definitions.
8762 2009-10-28 Cary Coutant <ccoutant@google.com>
8764 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8765 (Plugin::cleanup_done_): New member.
8766 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8767 (Plugin_manager::cleanup_done_): Remove.
8768 (Plugin_manager::add_input_file): Edit error message.
8769 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8770 (Plugin_manager::cleanup): Remove use of cleanup_done_.
8772 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
8774 * fileread.cc: (File_read::View::~View): Use the new
8775 data_ownership_ filed.
8776 (File_read::~File_read): Dispose the new whole_file_view_.
8777 (File_read::open): Mmap the whole file if needed.
8778 (File_read::open): Use whole_file_view_ instead of contents_.
8779 (File_read::find_view): Use whole_file_view_ if applicable.
8780 (File_read::do_read): Use whole_file_view_ instead of contents_.
8781 (File_read::make_view): Use whole_file_view_ instead of contents_,
8782 update File_read::View::View call.
8783 (File_read::find_or_make_view): Update File_read::View::View
8785 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8787 (File_read::View::Data_ownership): New enum.
8788 (File_read::View::View): Replace bool mapped_ with Data_ownership
8790 (File_read::View::mapped_): Remove (replaced by data_ownership_).
8791 (File_read::View::data_ownership_): New field.
8792 (File_read::contents_): Remove (replaced by whole_file_view_).
8793 (File_read::whole_file_view_): New field.
8794 * options.h (class General_options): Add --keep-files-mapped.
8796 2009-10-27 Cary Coutant <ccoutant@google.com>
8798 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8799 * testsuite/Makefile.am (plugin_test_5): New test case.
8800 * testsuite/Makefile.in: Regenerate.
8802 2009-10-25 Doug Kwan <dougkwan@google.com>
8804 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8805 from private to protected to allow access by child class.
8806 (Sized_relobj::do_relocate_sections): New method declaration.
8807 (Sized_relobj::relocate_sections): Virtualize.
8808 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8809 Sized_relobj::relocate_sections. Instantiate template explicitly
8810 for different target sizes and endianity.
8812 2009-10-24 Doug Kwan <dougkwan@google.com>
8814 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8815 (Arm_input_section::as_arm_input_section): New method.
8816 (Arm_output_section): New class definition.
8817 (Arm_output_section::create_stub_group,
8818 Arm_output_section::group_sections): New method definitions.
8820 2009-10-22 Doug Kwan <dougkwan@google.com>
8822 * arm.cc (Arm_input_section): New class definition.
8823 (Arm_input_section::init, Arm_input_section:do_write,
8824 Arm_input_section::set_final_data_size,
8825 Arm_input_section::do_reset_address_and_file_offset): New method
8828 2009-10-21 Doug Kwan <dougkwan@google.com>
8830 * arm.cc (Stub_table, Arm_input_section): New forward class
8832 (Stub_table): New class defintion.
8833 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8834 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8835 New method definition.
8837 2009-10-21 Doug Kwan <dougkwan@google.com>
8839 * arm.cc: Update copyright comments.
8840 (Target_arm): New forward class template declaration.
8841 (Arm_address): New type.
8842 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8843 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8844 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8846 (Insn_template): Same.
8847 (DEF_STUBS): New macro.
8848 (Stub_type): New enum type.
8849 (Stub_template): New class definition.
8852 (Stub_factory): Same.
8853 (Target_arm::Target_arm): Initialize may_use_blx_ and
8854 should_force_pic_veneer_.
8855 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8856 Target_arm::should_force_pic_veneer,
8857 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8858 Target_arm::using_thumb_only, Target_arm:;default_target): New
8860 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8861 New data member declarations.
8862 (Insn_template::size, Insn_template::alignment): New method defintions.
8863 (Stub_template::Stub_template): New method definition.
8864 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8865 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8866 (Stub_factory::Stub_factory): New method definition.
8867 * gold.h (string_hash): New template.
8868 * output.h (Input_section_specifier::hash_value): Use
8870 (Input_section_specifier::string_hash): Remove.
8871 * stringpool.cc (Stringpool_template::string_hash): Use
8874 2009-10-20 Doug Kwan <dougkwan@google.com>
8876 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8877 symbols of relaxed input sections.
8878 * output.h (Output_section::find_relaxed_input_section): Make
8881 2009-10-16 Doug Kwan <dougkwan@google.com>
8883 * dynobj.cc (Versions::Versions): Initialize version_script_.
8884 Only insert base version symbol definition for a shared object
8885 if version script defines any version versions.
8886 (Versions::define_base_version): New method definition.
8887 (Versions::add_def): Check that base version is not needed.
8888 (Versions::add_need): Define base version lazily.
8889 * dynobj.h (Versions::define_base_version): New method declaration.
8890 (Versions::needs_base_version_): New data member declaration.
8891 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8892 (check_DATA): Add no_version_test.stdout.
8893 (libno_version_test.so, no_version_test.o no_version_test.stdout):
8895 * testsuite/Makefile.in: Regenerate.
8896 * testsuite/no_version_test.c: New file.
8897 * testsuite/no_version_test.sh: Ditto.
8899 2009-10-16 Doug Kwan <dougkwan@google.com>
8901 * expression.cc (class Segment_start_expression): New class definition.
8902 (Segment_start_expression::value): New method definition.
8903 (script_exp_function_segment_start): Return a new
8904 Segment_start_expression.
8905 * gold/script-c.h (script_saw_segment_start_expression): New function
8907 * script-sections.cc (Script_sections::Script_sections): Initialize
8908 SAW_SEGMENT_START_EXPRESSION_ to false.
8909 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8910 and -Tbbs options to specify section addresses if given in
8911 command line and no SEGMENT_START expression is seen in a script.
8912 * script-sections.h (Script_sections::saw_segment_start_expression,
8913 Script_sections::set_saw_segment_start_expression): New method
8915 (Script_sections::saw_segment_start_expression_): New data member
8917 * script.cc (script_saw_segment_start_expression): New function.
8918 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8919 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8920 script_test_7.sh and script_test_8.sh.
8921 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8922 script_test_8.stdout.
8923 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8924 (script_test_6, script_test_6.stdout, script_test_7,
8925 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8926 * Makefile.in: Regenerate.
8927 * testsuite/script_test_6.sh: New file.
8928 * testsuite/script_test_6.t: Same.
8929 * testsuite/script_test_7.sh: Same.
8930 * testsuite/script_test_7.t: Same.
8931 * testsuite/script_test_8.sh: Same.
8933 2009-10-16 Doug Kwan <dougkwan@google.com>
8935 * output.cc (Output_segment::set_section_list_address): Cast
8936 expressions to unsigned long long type to avoid format warnings.
8938 2009-10-15 Ian Lance Taylor <iant@google.com>
8940 * script.cc (Script_options::add_symbol_assignment): Always add a
8941 dot assignment to script_sections_.
8942 * script-sections.cc (Script_sections::add_dot_assignment):
8943 Initialize if necessary.
8945 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8946 program headers with no load segment if there is a linker script.
8948 * layout.cc (Layout::set_segment_offsets): Align the file offset
8949 to the segment aligment for -N or -n with no load segment.
8950 * output.cc (Output_segment::add_output_section): Don't crash if
8951 the first section is a TLS section.
8952 (Output_segment::set_section_list_addresses): Print an error
8953 message if the address moves backward in a linker script.
8954 * script-sections.cc
8955 (Output_section_element_input::set_section_addresses): Don't
8956 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8957 (Orphan_output_section::set_section_addresses): Likewise.
8959 2009-10-15 Doug Kwan <dougkwan@google.com>
8961 * layout.cc (Layout::finish_dynamic_section): Generate tags
8962 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8963 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8964 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8966 2009-10-14 Ian Lance Taylor <iant@google.com>
8968 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8970 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8971 data_shdr fields of relinfo.
8972 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8973 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
8974 R_386_TLS_LDO_32, adjust based on section flags.
8975 (Target_i386::Relocate::fix_up_ldo): Remove.
8977 2009-10-13 Ian Lance Taylor <iant@google.com>
8979 Add support for -pie.
8980 * options.h (class General_options): Add -pie and
8982 (General_options::output_is_position_independent): Test -pie.
8983 (General_options::output_is_executable): Return true if not shared
8984 and not relocatable.
8985 (General_options::output_is_pie): Remove.
8986 * options.cc (General_options::finalize): Reject incompatible uses
8988 * gold.cc (queue_middle_tasks): A -pie link is not static.
8989 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8990 * symtab.cc (Symbol::final_value_is_known): Return false if
8991 output_is_position_independent.
8992 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8993 output_is_position_independent.
8994 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8995 output_is_position_independent.
8996 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8997 output_is_position_independent.
8998 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9000 (basic_pie_test.o, basic_pie_test): New targets.
9001 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9002 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9003 (two_file_pie_test): New target.
9004 * testsuite/Makefile.in: Rebuild.
9005 * README: Remove note saying that -pie is not supported.
9007 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9009 * options.h (class General_options): Add -init and -fini.
9010 * layout.cc (Layout::finish_dynamic_section): Emit
9011 given init and fini functions.
9013 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9015 * gc.h (gc_process_relocs): Check if icf is enabled using new
9017 * gold.cc (queue_initial_tasks): Likewise.
9018 (queue_middle_tasks): Likewise.
9019 * object.cc (do_layout): Likewise.
9020 * symtab.cc (is_section_folded): Likewise.
9021 * main.cc (main): Likewise.
9022 * reloc.cc (Read_relocs::run): Likewise.
9023 (Sized_relobj::do_scan_relocs): Likewise.
9024 * icf.cc (is_function_ctor_or_dtor): New function.
9025 (Icf::find_identical_sections): Check if function is ctor or dtor when
9027 * options.h (General_options::icf): Change option to be an enum.
9028 (Icf_status): New enum.
9029 (icf_enabled): New method.
9030 (icf_safe_folding): New method.
9031 (set_icf_status): New method.
9032 (icf_status_): New variable.
9033 * (options.cc) (General_options::finalize): Set icf_status_.
9034 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9035 icf_test and icf_keep_unique_test to use the --icf enum flag.
9036 * testsuite/icf_safe_test.sh: New file.
9037 * testsuite/icf_safe_test.cc: New file.
9039 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9041 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9042 includes to gc.h and icf.h.
9043 * arm.cc: Include gc.h.
9044 * gold.cc: Likewise.
9045 * i386.cc: Likewise.
9046 * powerpc.cc: Likewise.
9047 * sparc.cc: Likewise.
9048 * x86_64.cc: Likewise.
9049 * gc.h: Include icf.h.
9051 2009-10-11 Ian Lance Taylor <iant@google.com>
9053 * plugin.cc: Include "gold.h" before other header files.
9055 2009-10-10 Chris Demetriou <cgd@google.com>
9057 * options.h (Input_file_argument::Input_file_type): New enum.
9058 (Input_file_argument::is_lib_): Replace with...
9059 (Input_file_argument::type_): New member.
9060 (Input_file_argument::Input_file_argument): Take Input_file_type
9061 'type' rather than boolean 'is_lib' as second argument.
9062 (Input_file_argument::is_lib): Use type_.
9063 (Input_file_argument::is_searched_file): New function.
9064 (Input_file_argument::may_need_search): Handle is_searched_file.
9065 * options.cc (General_options::parse_library): Support -l:filename.
9066 (General_options::parse_just_symbols): Update for Input_file_argument
9068 (Command_line::process): Likewise.
9069 * archive.cc (Archive::get_file_and_offset): Likewise.
9070 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9071 * script.cc (read_script_file, script_add_file): Likewise.
9072 * fileread.cc (Input_file::Input_file): Likewise.
9073 (Input_file::will_search_for): Handle is_searched_file.
9074 (Input_file::open): Likewise.
9075 * readsyms.cc (Read_symbols::get_name): Likewise.
9076 * testsuite/Makefile.am (searched_file_test): New test.
9077 * testsuite/Makefile.in: Regenerate.
9078 * testsuite/searched_file_test.cc: New file.
9079 * testsuite/searched_file_test_lib.cc: New file.
9081 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9082 Ian Lance Taylor <iant@google.com>
9084 * descriptor.cc: Include <cstdio> and "binary-io.h".
9085 (Descriptors::open): Open the files in binary mode always.
9086 * script.cc (Lex::get_token): Treat \r as whitespace.
9088 2009-10-09 Ian Lance Taylor <iant@google.com>
9090 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9092 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9093 Ian Lance Taylor <iant@google.com>
9095 * configure.ac: Check for readv function also.
9096 * fileread.cc (readv): Define if not HAVE_READV.
9097 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9099 * config.in: Regenerate.
9100 * configure: Regenerate.
9102 2009-10-09 Doug Kwan <dougkwan@google.com>
9104 * layout.cc (Layout::make_output_section): Call target hook to make
9105 ordinary output section.
9106 (Layout::finalize): Adjust parameter list of call the
9107 Target::may_relax().
9108 * layout.h (class Layout::section_list): New method.
9109 * merge.h (Output_merge_base::entsize): Change visibility to public.
9110 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9112 (Output_merge_string::do_is_string): New method.
9113 * object.cc (Sized_relobj::do_setup): renamed from
9114 Sized_relobj::set_up.
9115 * object.h (Sized_relobj::adjust_shndx,
9116 Sized_relobj::initializ_input_to_output_maps,
9117 Sized_relobj::free_input_to_output_maps): Change visibilities to
9119 (Sized_relobj::setup): Virtualize.
9120 (Sized_relobj::do_setup): New method declaration.
9121 (Sized_relobj::invalidate_section_offset,
9122 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9123 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9124 * options.cc (parse_int): New function.
9125 * options.h (parse_int): New declaration.
9126 (DEFINE_int): New macro.
9127 (stub_group_size): New option.
9128 * output.cc (Output_section::Output_section): Initialize memebers
9129 merge_section_map_, merge_section_by_properties_map_,
9130 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9131 (Output_section::add_input_section): Handled deferred code-fill
9132 generation and remove an old comment.
9133 (Output_section::add_relaxed_input_section): New method definition.
9134 (Output_section::add_merge_input_section): Use merge section by
9135 properties map to speed to search. Update merge section maps
9137 (Output_section::build_relaxation_map): New method definition.
9138 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9140 (Output_section::relax_input_section): Renamed to
9141 Output_section::convert_input_sections_to_relaxed_sections and change
9142 interface to take a vector of pointers to relaxed sections.
9143 (Output_section::find_merge_section,
9144 Output_section::find_relaxed_input_section): New method definitions.
9145 (Output_section::is_input_address_mapped,
9146 Output_section::output_offset, Output_section::output_address):
9147 Use output section data maps to speed up searching.
9148 (Output_section::find_starting_output_address): Add comments.
9149 (Output_section::do_write,
9150 Output_section::write_to_postprocessing_buffer): Do code-fill
9151 generation as appropriate.
9152 (Output_section::get_input_sections): Invalidate relaxed input section
9154 (Output_section::restore_states): Adjust type of checkpoint .
9155 Invalidate relaxed input section map.
9156 * output.h (Output_merge_base): New class declaration.
9157 (Input_section_specifier): New class defintion.
9158 (class Output_relaxed_input_section) Change base class to
9159 Output_section_data_build.
9160 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9161 base class initializer.
9162 (Output_section::add_relaxed_input_section): New method declaration.
9163 (Output_section::Input_section): Change visibility to protected.
9164 (Output_section::Input_section::relobj,
9165 Output_section::Input_section::shndx): Handle relaxed input sections.
9166 Output_section::input_sections) Change visibility to protected. Also
9167 define overload to return a non-const pointer.
9168 (Output_section::Merge_section_properties): New class defintion.
9169 (Output_section::Merge_section_by_properties_map,
9170 Output_section::Output_section_data_by_input_section_map,
9171 Output_section::Relaxation_map): New types.
9172 (Output_section::relax_input_section): Rename method to
9173 Output_section::convert_input_sections_to_relaxed_sections and change
9174 interface to take a vector of relaxed section pointers.
9175 (Output_section::find_merge_section,
9176 Output_section::find_relaxed_input_section,
9177 Output_section::build_relaxation_map,
9178 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9179 New method declarations.
9180 (Output_section::merge_section_map_
9181 Output_section::merge_section_by_properties_map_,
9182 Output_section::relaxed_input_section_map_,
9183 Output_section::is_relaxed_input_section_map_valid_,
9184 Output_section::generate_code_fills_at_write_): New data members.
9185 * script-sections.cc
9186 (Output_section_element_input::set_section_addresses): Call
9187 current_data_size and addralign methods of relaxed input sections.
9188 (Orphan_output_section::set_section_addresses): Call current_data_size
9189 and addralign methods of relaxed input sections.
9190 * symtab.cc (Symbol_table::compute_final_value): Extract template
9191 from the body of Symbol_table::sized_finalize_symbol.
9192 (Symbol_table::sized_finalized_symbol): Call
9193 Symbol_table::compute_final_value.
9194 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9195 (Symbol_table::compute_final_value): New templated method declaration.
9196 * target.cc (Target::do_make_output_section): New method defintion.
9197 * target.h (Target::make_output_section): New method declaration.
9198 (Target::relax): Add more parameters for input objects, symbol table
9199 and layout. Adjust call to do_relax.
9200 (Target::do_make_output_section): New method declaration.
9201 (Target::do_relax): Add parameters for input objects, symbol table
9204 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9206 * pread.c: Include stdio.h.
9208 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9210 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9213 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9215 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9216 Change read_shndx type to unsigned int.
9217 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9219 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9220 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9221 Change read_shndx type to unsigned int.
9222 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9224 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9225 * layout.cc (Layout::create_symtab_sections): Cast the result of
9226 local_symcount * symsize to off_t in the gold_assert.
9228 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9230 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9231 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9233 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9234 (Arm_relocate_functions::thm_abs5): New function.
9235 (Arm_relocate_functions::abs12): New function.
9236 (Arm_relocate_functions::abs16): New function.
9237 (Arm_relocate_functions::base_abs): New function.
9238 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9239 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9240 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9242 (Scan::global): Likewise.
9243 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9244 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9245 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9246 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9249 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9251 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9252 (Arm_relocate_functions::movt_prel): New function.
9253 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9254 (Arm_relocate_functions::thm_movt_prel): New function.
9255 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9256 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9257 (Scan::global, Relocate::relocate): Likewise.
9258 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9260 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9262 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9263 Incremental_checker.
9264 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9266 (class Incremental_inputs_header): New class.
9267 (Incremental_inputs_header_writer): Edit comment.
9268 (Incremental_inputs_entry): New class.
9269 (Incremental_inputs_entry_writer): Edit comment.
9270 (Sized_incremental_binary::do_find_incremental_inputs_section):
9271 Add *strtab_shndx parameter, fill it.
9272 (Sized_incremental_binary::do_check_inputs): New method.
9273 (Incremental_checker::can_incrementally_link_output_file): Use
9274 Sized_incremental_binary::check_inputs.
9275 (Incremental_inputs::report_command_line): Save command line in
9278 (Incremental_binary::find_incremental_inputs_section): New
9280 (Incremental_binary::do_find_incremental_inputs_section): Add
9281 strtab_shndx parameter.
9282 (Incremental_binary::do_check_inputs): New pure virtual method.
9283 (Sized_incremental_binary::do_check_inputs): Declare.
9284 (Incremental_checker::Incremental_checker): Add incremental_inputs
9285 parameter, use it to initialize incremental_inputs_.
9286 (Incremental_checker::incremental_inputs_): New field.
9287 (Incremental_checker::command_line): New method.
9288 (Incremental_checker::inputs): New method.
9289 (Incremental_checker::command_line_): New field.
9291 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9293 * incremental.cc: Include <cstdarg> and "target-select.h".
9294 (vexplain_no_incremental): New function.
9295 (explain_no_incremental): New function.
9296 (Incremental_binary::error): New method.
9297 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9299 (make_sized_incremental_binary): New function.
9300 (open_incremental_binary): New function.
9301 (can_incrementally_link_file): Add checks if output is ELF and has
9303 * incremental.h: Include "elfcpp_file.h" and "output.h".
9304 (Incremental_binary): New class.
9305 (Sized_incremental_binary): New class.
9306 (open_incremental_binary): Declare.
9307 * object.cc (is_elf_object): Use
9308 elfcpp::Elf_recognizer::is_elf_file.
9309 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9310 * output.h (Output_file::filesize): New method.
9312 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9314 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9316 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9317 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9319 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9321 (Arm_relocate_functions::movw_abs_nc): New function.
9322 (Arm_relocate_functions::movt_abs): New function.
9323 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9324 (Arm_relocate_functions::thm_movt_abs): New function.
9325 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9326 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9327 (Scan::global): Likewise.
9328 (Relocate::relocate): Likewise.
9329 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9331 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9333 * arm.cc (Arm_relocate_functions::got_prel) New function.
9334 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9335 (Relocate::relocate): Likewise.
9336 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9338 2009-10-06 Ian Lance Taylor <iant@google.com>
9340 * options.h (class General_options): Define
9341 split_stack_adjust_size parameter.
9342 * object.h (class Object): Add uses_split_stack_ and
9343 has_no_split_stack_ fields. Add uses_split_stack and
9344 has_no_split_stack accessor functions. Declare
9345 handle_split_stack_section.
9346 (class Reloc_symbol_changes): Define.
9347 (class Sized_relobj): Define Function_offsets. Declare
9348 split_stack_adjust, split_stack_adjust_reltype, and
9350 * object.cc (Object::handle_split_stack_section): New function.
9351 (Sized_relobj::do_layout): Call handle_split_stack_section.
9352 * dynobj.cc (Sized_dynobj::do_layout): Call
9353 handle_split_stack_section.
9354 * reloc.cc (Sized_relobj::relocate_sections): Call
9355 split_stack_adjust for executable sections in split_stack
9356 objects. Pass reloc_map to relocate_section.
9357 (Sized_relobj::split_stack_adjust): New function.
9358 (Sized_relobj::split_stack_adjust_reltype): New function.
9359 (Sized_relobj::find_functions): New function.
9360 * target-reloc.h: Include "object.h".
9361 (relocate_section): Add reloc_symbol_changes parameter. Change
9363 * target.h (class Target): Add calls_non_split method. Declare
9364 do_calls_non_split virtual method. Declare match_view and
9366 * target.cc: Include "elfcpp.h".
9367 (Target::do_calls_non_split): New function.
9368 (Target::match_view): New function.
9369 (Target::set_view_to_nop): New function.
9370 * gold.cc (queue_middle_tasks): Give an error if mixing
9371 split-stack and non-split-stack objects with -r.
9372 * i386.cc (Target_i386::relocate_section): Add
9373 reloc_symbol_changes parameter.
9374 (Target_i386::do_calls_non_split): New function.
9375 * x86_64.cc (Target_x86_64::relocate_section): Add
9376 reloc_symbol_changes parameter.
9377 (Target_x86_64::do_calls_non_split): New function.
9378 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9380 * powerpc.cc (Target_powerpc::relocate_section): Add
9381 reloc_symbol_changes parameter.
9382 * sparc.cc (Target_sparc::relocate_section): Add
9383 reloc_symbol_changes parameter.
9384 * configure.ac: Call AM_CONDITIONAL for the default target.
9385 * configure: Rebuild.
9386 * testsuite/Makefile.am (TEST_AS): New variable.
9387 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9388 (check_DATA): Add split_i386 and split_x86_64 files.
9389 (SPLIT_DEFSYMS): Define.
9390 (split_i386_[1234n].o): New targets.
9391 (split_i386_[124]): New targets.
9392 (split_i386_[1234r].stdout): New targets.
9393 (split_x86_64_[1234n].o): New targets.
9394 (split_x86_64_[124]): New targets.
9395 (split_x86_64_[1234r].stdout): New targets.
9396 (MOSTLYCLEANFILES): Add new executables.
9397 * testsuite/split_i386.sh: New file.
9398 * testsuite/split_x86_64.sh: New file.
9399 * testsuite/split_i386_1.s: New file.
9400 * testsuite/split_i386_2.s: New file.
9401 * testsuite/split_i386_3.s: New file.
9402 * testsuite/split_i386_4.s: New file.
9403 * testsuite/split_i386_n.s: New file.
9404 * testsuite/split_x86_64_1.s: New file.
9405 * testsuite/split_x86_64_2.s: New file.
9406 * testsuite/split_x86_64_3.s: New file.
9407 * testsuite/split_x86_64_4.s: New file.
9408 * testsuite/split_x86_64_n.s: New file.
9409 * testsuite/testfile.cc (Target_test): Update relocation_section
9411 * testsuite/Makefile.in: Rebuild.
9413 2009-10-06 Ian Lance Taylor <iant@google.com>
9415 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9416 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9417 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9418 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9419 the address on ldo_addrs_.
9420 (Target_i386::Relocate::fix_up_ldo): New function.
9422 2009-10-06 Rafael Espindola <espindola@google.com>
9424 * plugin.cc (add_input_library): New.
9425 (Plugin::load): Add add_input_library to tv.
9426 (Plugin_manager::add_input_file): Add the is_lib argument.
9427 (add_input_file): Update call to Plugin_manager::add_input_file.
9428 (add_input_library): New.
9429 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9431 2009-09-30 Doug Kwan <dougkwan@google.com>
9433 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9434 symbol and call Symbol::may_need_copy_reloc to determine if
9435 a copy reloc is needed.
9436 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9437 nocopyreloc is given in command line.
9438 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9439 given in command line.
9440 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9441 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9442 of the removed Target_i386::may_need_copy_reloc.
9443 * options.h (copyreloc): New option with default value false.
9444 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9445 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9446 instead of the removed Target_powerpc::may_need_copy_reloc.
9447 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9448 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9449 instead of the removed Target_sparc::may_need_copy_reloc.
9450 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9451 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9452 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9453 instead of the removed Target_x86_64::may_need_copy_reloc.
9455 2009-09-30 Ian Lance Taylor <iant@google.com>
9457 * object.h (class Object): Remove target_ field, and target,
9458 sized_target, and set_target methods.
9459 (Object::sized_target): Remove.
9460 (class Sized_relobj): Update declarations. Remove sized_target.
9461 * object.cc (Sized_relobj::setup): Remove target parameter.
9463 (Input_objects::add_object): Don't do anything with the target.
9464 (make_elf_sized_object): Add punconfigured parameter. Change all
9465 callers. Set or test parameter target.
9466 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9468 * parameters.cc (Parameters::set_target): Change parameter type to
9470 (Parameters::default_target): Remove.
9471 (set_parameters_target): Change parameter type to be non-const.
9472 (parameters_force_valid_target): New function.
9473 (parameters_clear_target): New function.
9474 * parameters.h (class Parameters): Update declarations. Remove
9475 default_target method. Add sized_target and clear_target
9476 methods. Change target_ to be non-const.
9477 (set_parameters_target): Update declaration.
9478 (parameters_force_valid_target): Declare.
9479 (parameters_clear_target): Declare.
9480 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9481 as NULL if we aren't searching.
9482 (Add_symbols::run): Don't check for compatible target.
9483 * fileread.cc (Input_file::open_binary): Call
9484 parameters_force_valid_target.
9485 * gold.cc (queue_middle_tasks): Likewise.
9486 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9487 set_target on object.
9488 * dynobj.h (class Sized_dynobj): Update declarations.
9489 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9490 make_elf_object returns NULL.
9491 (Archive::include_member): Don't check whether object target is
9493 * output.cc (Output_section::add_input_section): Get target from
9495 (Output_section::relax_input_section): Likewise.
9496 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9498 (Sized_relobj::do_scan_relocs): Likewise.
9499 (Sized_relobj::relocate_sections): Likewise.
9500 * resolve.cc (Symbol_table::resolve): Likewise.
9501 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9502 parameter. Change all callers.
9503 (Symbol_table::add_from_object): Get target from parameters.
9504 (Symbol_table::add_from_relobj): Don't check object target.
9505 (Symbol_table::add_from_dynobj): Likewise.
9506 (Symbol_table::define_special_symbol): Get target from
9508 * symtab.h (class Symbol_table): Update declaration.
9509 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9510 parameter. Change all callers. Clear parameter target.
9511 (Binary_test): Test target here.
9512 * testsuite/object_unittest.cc (gold_testsuite): Remove
9513 target_test_pointer parameter. Change all callers.
9514 (Object_test): Test target here.
9516 2009-09-26 Ian Lance Taylor <iant@google.com>
9518 * testsuite/initpri1.c: Don't try to use constructor priorities if
9519 compiling with gcc before 4.3.
9521 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9523 * testsuite/retain_symbols_file_test.sh (check_present): Change
9524 output file name to retain_symbols_file_test.stdout.
9525 (check_absent): Likewise.
9527 2009-09-18 Craig Silverstein <csilvers@google.com>
9529 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9530 * options.cc: Include <cerrno> and <fstream>.
9531 (General_options::finalize): Parse -retain-symbols-file tag.
9532 * options.h: New flag.
9533 (General_options): New method should_retain_symbol, new
9534 variable symbols_to_retain.
9535 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9536 should_retain_symbol map.
9537 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9538 * testsuite/Makefile.in: Regenerate.
9539 * testsuite/retain_symbols_file_test.sh: New file.
9541 2009-09-18 Nick Clifton <nickc@redhat.com>
9543 * po/es.po: Updated Spanish translation.
9545 2009-09-17 Doug Kwan <dougkwan@google.com>
9547 * debug.h (DEBUG_RELAXATION): New constant.
9548 (DEBUG_ALL): Add DEBUG_RELAXATION.
9549 (debug_string_to_enum): Add relaxation debug option.
9551 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9552 Layout::Relaxation_debug_check::read_sections,
9553 Layout::Relaxation_debug_check::read_sections): New method definitions.
9554 (Layout::Layout): Initialize data members
9555 record_output_section_data_from_scrips_,
9556 script_output_section_data_list_ and relaxation_debug_check_.
9557 (Layout::save_segments, Layout::restore_segments,
9558 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9559 Layout::relaxation_loop_body): New method definitions.
9560 (Layout::finalize): Support relaxation. Move section layout code to
9561 Layout::relaxation_loop_body.
9562 (Layout::set_asection_address_from_script): Move code for orphan
9563 section placement out.
9564 (Layout::place_orphan_sections_in_script): New method definition.
9565 * layout.h (Output_segment_headers, Output_file_header):
9566 New forward class declarations.
9567 (Layout::~Layout): Define.
9568 (Layout::new_output_section_data_from_script): New method definition.
9569 (Layout::place_orphan_sections_in_script): New method declaration.
9570 (Layout::Segment_states): New type declaration.
9571 (Layout::save_segments, Layout::restore_segments,
9572 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9573 Layout::relaxation_loop_body): New method declarations.
9574 (Layout::Output_section_data_list): New type declaration.
9575 (Layout::Relaxation_debug_check): New class definition.
9576 (Layout::record_output_section_data_from_script_,
9577 Layout::script_output_section_data_list_, Layout::segment_states_,
9578 Layout::relaxation_debug_check_): New data members.
9579 * output.cc: (Output_section_headers::do_size): New method definition.
9580 (Output_section_headers::Output_section_headers): Move size
9581 computation to Output_section_headers::do_size.
9582 (Output_segment_headers::do_size): New method definition.
9583 (Output_file_header::Output_file_header): Move size computation to
9584 Output_file_header::do_size and call it.
9585 (Output_file_header::do_size): New method definition.
9586 (Output_data_group::Output_data_group): Adjust call to
9587 Output_section_data.
9588 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9589 (Output_symtab_xindex::do_write): Add array bound check.
9590 (Output_section::Input_section::print_to_mapfile): Handle
9591 RELAXED_INPUT_SECTION_CODE.
9592 (Output_section::Output_section): Initialize data member checkpoint_.
9593 (Output_section::~Output_section): Delete checkpoint object pointed
9595 (Output_section::add_input_section): Always add an Input_section if
9597 (Output_section::add_merge_input_section): Add assert.
9598 (Output_section::relax_input_section): New method definition.
9599 (Output_section::set_final_data_size): Set load address to zero for
9600 an unallocated section.
9601 (Output_section::do_address_and_file_offset_have_reset_values):
9602 New method definition.
9603 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9604 Handle relaxed input section.
9605 (Output_section::sort_attached_input_sections): Checkpoint input
9606 section list lazily.
9607 (Output_section::get_input_sections): Change type of input_sections to
9608 list of Simple_input_section pointers. Checkpoint input section list
9609 lazily. Also handle relaxed input sections.
9610 (Output_section::add_input_section_for_script): Take a reference to
9611 a Simple_input_section object instead of Relobj pointer and section
9612 index as parameter. Handle relaxed input sections.
9613 (Output_section::save_states, Output_section::restore_states): New
9615 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9616 (Output_data::is_data_size_fixed): New method definition.
9617 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9619 (Output_data::address_and_file_offset_have_reset_values): New method
9621 (Output_data::do_address_and_file_offset_have_reset_values): New method
9623 (Output_data::set_data_size): Check that data size is not fixed.
9624 (Output_data::fix_data_size): New method definition.
9625 (Output_data::is_data_size_fixed_): New data member.
9626 (Output_section_headers::set_final_data_size): New method definition.
9627 (Output_section_headers::do_size): New method declaration.
9628 (Output_segment_headers::set_final_data_size): New method definition.
9629 (Output_segment_headers::do_size): New method declaration.
9630 (Output_file_header::set_final_data_size)::New method definition.
9631 (Output_file_header::do_size)::New method declaration.
9632 (Output_section_data::Output_section_data): Add new parameter
9633 is_data_size_fixed and use it to fix data size.
9634 (Output_data_const::Output_data_const): Adjust call to base class
9635 constructor and fix data size.
9636 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9637 base class constructor and fix data size.
9638 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9639 base class constructor and fix data size.
9640 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9641 class constructor and fix data size.
9642 (Output_data_group::set_final_data_size): New method definition.
9643 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9644 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9645 class constructor and fix data size.
9646 (Output_relaxed_input_section): New class definition.
9647 (Output_section::Simple_input_section): New class definition.
9648 (Output_section::get_input_sections): Adjust parameter list.
9649 (Output_section::add_input_section_for_script): Same.
9650 (Output_section::save_states, Output_section::restore_states,
9651 Output_section::do_address_and_file_offset_have_reset_values,
9652 (Output_section::Input_section::Input_section): Handle
9653 RELAXED_INPUT_SECTION_CODE. Add new overload for
9654 Output_relaxed_input_section.
9655 (Output_section::Input_section::is_input_section,
9656 Output_section::Input_section::set_output_section): Handle relaxed
9658 (Output_section::Input_section::is_relaxed_input_section,
9659 Output_section::Input_section::output_section_data,
9660 Output_section::Input_section::relaxed_input_section): New method
9662 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9664 (Output_section::Input_section::u1_): Update comments.
9665 (Output_section::Input_section::u2_): Add new union member poris.
9666 (Output_section::Checkpoint_output_section): New classs definition.
9667 (Output_section::relax_input_section): New method declaration.
9668 (Output_section::checkpoint_): New data member.
9669 (Output_segment): Update comments.
9670 (Output_segment::Output_segment): Un-privatize copy constructor.
9671 (Output_segment::operator=): Un-privatize.
9672 * script-sections.cc (Output_section_element::Input_section_list):
9673 Change element type to Output_section::Simple_input_section.
9674 (Output_section_element_dot_assignment::set_section_addresses):
9675 Register output section data for relaxation clean up.
9676 (Output_data_exression::Output_data_expression): Adjust call to base
9677 constructor to fix data size.
9678 (Output_section_element_data::set_section_addresses): Register
9679 Output_data_expression object for relaxation clean up.
9680 (struct Input_section_info): Replace Relobj pointer and section index
9681 pair with Output_section::Simple_input_section and Convert struct to a
9683 (Input_section_sorter::operator()): Adjust access to
9684 Input_section_info data member to use accessors.
9685 (Output_section_element_input::set_section_addresses): Use layout
9686 parameter. Adjust code to use Output_section::Simple_input_section
9687 and Input_secction_info classes. Register filler for relaxation
9689 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9690 and section index pair with Output_section::Simple_input_section
9691 class. Adjust code accordingly.
9692 (Phdrs_element::release_segment): New method definition.
9693 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9695 (Script_sections::release_segments): New method definition.
9696 * gold/script-sections.h (Script_sections::release_segments): New
9698 * gold/target.h (Target::may_relax, Target::relax,
9699 Target::do_may_relax, Target::do_relax): New method definitions.
9701 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9703 * arm.cc (has_signed_unsigned_overflow): New function.
9704 (Arm_relocate_functions::abs8): New function.
9705 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9706 (Target_arm::Scan::global): Likewise.
9707 (Target_arm::relocate::relocate): Likewise.
9708 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9711 2009-09-16 Cary Coutant <ccoutant@google.com>
9713 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9714 * testsuite/Makefile.in: Regenerate.
9716 2009-09-11 Nick Clifton <nickc@redhat.com>
9718 * po/gold.pot: Updated by the Translation project.
9720 2009-09-08 Cary Coutant <ccoutant@google.com>
9722 * output.cc (Output_file::open): Add execute permission to empty file.
9723 * testsuite/Makefile.am (permission_test): New test.
9724 * testsuite/Makefile.in: Regenerate.
9726 2009-09-02 Ian Lance Taylor <iant@google.com>
9728 * output.cc (Output_file::resize): Call map_no_anonymous rather
9731 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9733 * gold.cc: Include "incremental.h".
9734 (queue_initial_tasks): Call Incremental_checker methods.
9735 * incremental.cc: Include "output.h".
9736 (Incremental_checker::can_incrementally_link_output_file): New
9738 * incremental.h (Incremental_checker): New class.
9740 * output.cc (Output_file::open_for_modification): New method.
9741 (Output_file::map_anonymous): Changed return type to bool. Record
9743 (Output_file::map_no_anonymous): New method, broken out of map.
9744 (Output_file::map): Use map_no_anonymous and map_anonymous.
9745 * output.h (class Output_file): Update declarations.
9747 2009-08-24 Cary Coutant <ccoutant@google.com>
9749 * options.h (Command_line::Pre_options): New class.
9750 (Command_line::pre_options): New member.
9751 * options.cc (gold::options::ready_to_register): New variable.
9752 (One_option::register_option): Do nothing if not registering options.
9753 Assert if same short option registered twice.
9754 (General_options::General_options): Turn off option registration when
9756 (Command_line::Pre_options::Pre_options): New constructor.
9758 2009-08-24 Cary Coutant <ccoutant@google.com>
9760 * options.h (General_options::no_keep_memory): Remove incorrect
9763 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9765 * Makefile.am (am__skiplex, am__skipyacc): New.
9766 * Makefile.in: Regenerate.
9768 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
9770 * Makefile.am (AM_CPPFLAGS): Renamed from ...
9771 (INCLUDES): ... this.
9772 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9773 (AM_CPPFLAGS): Renamed from ...
9774 (INCLUDE): ... this.
9775 * Makefile.in, testsuite/Makefile.in: Regenerate.
9777 * Makefile.in: Regenerate.
9778 * aclocal.m4: Likewise.
9779 * config.in: Likewise.
9780 * configure: Likewise.
9781 * testsuite/Makefile.in: Likewise.
9783 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9784 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9785 * Makefile.in: Regenerate.
9786 * testsuite/Makefile.in: Regenerate.
9788 2009-08-19 Cary Coutant <ccoutant@google.com>
9790 * resolve.cc (Symbol_table::resolve): Don't complain about defined
9791 symbols in shared libraries overridden by hidden or internal symbols
9792 in the main program.
9794 2009-08-19 Chris Demetriou <cgd@google.com>
9796 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9797 checking source file names in error messages.
9799 2009-08-18 Doug Kwan <dougkwan@google.com>
9801 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9802 an elcpp::Ehdr as parameter. Adjust call to set_target.
9803 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9804 an elfcpp::Ehdr as parameter.
9805 * object.cc (Object::set_target): Remove the version that looks up
9806 a target and sets it.
9807 (Sized_relobj::setup): Take a Target object instead of
9808 an elfcpp::Ehdr as parameter. Adjust call to set_target.
9809 (make_elf_sized_object): Find target and ask target to
9811 * object.h: (Object::set_target): Remove the version that looks up
9812 a target and sets it.
9813 (Sized_relobj::setup): Take a Target object instead of
9814 an elfcpp:Ehdr as parameter.
9815 * target.cc: Include dynobj.h.
9816 (Target::do_make_elf_object_implementation): New.
9817 (Target::do_make_elf_object): New.
9818 * target.h (Target::make_elf_object): New template declaration.
9819 (Target::do_make_elf_object): New method declarations.
9820 (Target::do_make_elf_object_implementation): New template declaration.
9822 2009-08-14 Ian Lance Taylor <iant@google.com>
9824 * gold.h (FUNCTION_NAME): Define.
9825 (gold_unreachable): Use FUNCTION_NAME.
9827 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9829 * icf.cc (Icf::find_identical_sections): Issue a warning when a
9830 symbol in the --keep-unique list is not found.
9832 2009-08-12 Sriraman Tallam <tmsriram@google.com>
9834 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9835 been maked as --keep-unique.
9836 (Icf::unfold_section): New function.
9837 * icf.h (Icf::unfold_section): New function.
9838 * options.h (General_options::keep_unique): New option.
9839 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9840 * testsuite/Makefile.in: Regenerate.
9841 * testsuite/icf_keep_unique_test.sh: New file.
9842 * testsuite/icf_keep_unique_test.cc: New file.
9844 2009-08-12 Cary Coutant <ccoutant@google.com>
9847 * resolve.cc (Symbol_table::resolve): Check for references from
9848 dynamic objects to hidden and internal symbols.
9849 * testsuite/Makefile.am (hidden_test.sh): New test.
9850 * testsuite/Makefile.in: Regenerate.
9851 * testsuite/hidden_test.sh: New script.
9852 * testsuite/hidden_test_1.c: New test source.
9853 * testsuite/hidden_test_main.c: New test source.
9855 2009-08-11 Doug Kwan <dougkwan@google.com>
9857 * arm.cc: Update comments.
9858 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9859 segment to locate the .ARM.exidx section if present.
9861 2009-08-09 Doug Kwan <dougkwan@google.com>
9863 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9866 2009-08-07 Sriraman Tallam <tmsriram@google.com>
9867 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9870 2009-08-06 Sriraman Tallam <tmsriram@google.com>
9872 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9873 valid tls_segment only for non-debug-section relocations.
9874 * testsuite/Makefile.am: Add gc_tls_test.
9875 * testsuite/Makefile.in: Regenerate.
9876 * testsuite/gc_tls_test.cc: New file.
9877 * testsuite/gc_tls_test.sh: New file.
9879 2009-08-05 Sriraman Tallam <tmsriram@google.com>
9883 * Makefile.am (CCFILES): Add icf.cc.
9885 * Makefile.in: Regenerate.
9886 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9887 * gc.h (gc_process_relocs): Populate lists used by icf to contain
9888 section, symbol and addend information for the relocs.
9889 * gold.cc (queue_middle_tasks): Call identical code folding.
9890 * gold.h: Add defines for multimap.
9891 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9892 to the call of finalize_local_symbols.
9893 * main.cc (main): Create object of class Icf.
9894 * object.cc (Sized_relobj::do_layout): Allow this function to be
9895 called twice during icf.
9896 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9897 to sections marked as identical by icf.
9898 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9900 (Sized_relobj::do_section_entsize): New function.
9901 * object.h (Object::section_entsize): New function.
9902 (Object::do_section_entsize): New pure virtual function.
9903 (Relobj::finalize_local_symbols): Add new parameter.
9904 (Relobj::do_section_entsize): New function.
9905 * options.h (General_options::icf): New option.
9906 (General_options::icf_iterations): New option.
9907 (General_options::print_icf_sections): New option.
9908 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9909 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9910 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9912 * symtab.cc (Symbol_table::is_section_folded): New function.
9913 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
9914 to sections marked as identical by icf.
9915 * symtab.h (Symbol_table::set_icf): New function.
9916 (Symbol_table::icf): New function.
9917 (Symbol_table::is_section_folded): New function.
9918 (Symbol_table::icf_): New data member.
9919 * target-reloc.h (relocate_section): Ignore sections folded by icf.
9920 * testsuite/Makefile.am: Add commands to build icf_test.
9921 * testsuite/Makefile.in: Regenerate.
9922 * testsuite/icf_test.sh: New file.
9923 * testsuite/icf_test.cc: New file.
9925 2009-07-24 Chris Demetriou <cgd@google.com>
9927 * layout.cc (is_compressible_debug_section): Fix incorrect
9928 comment about compressed section names.
9930 2009-07-20 Ian Lance Taylor <ian@airs.com>
9933 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9935 2009-07-16 Ian Lance Taylor <iant@google.com>
9938 * layout.h: #include <map>.
9939 (class Kept_section): Change from struct to class. Add accessors
9940 and setters. Add section size to Comdat_group mapping. Change
9941 Comdat_group to std::map. Add is_comdat_ field. Add
9942 linkonce_size field in union.
9943 (class Layout): Update declaration of find_or_add_kept_section.
9944 Don't declare find_kept_object.
9945 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9946 parameter. Add object, shndx, is_comdat, and is_group_name
9947 parameters. Change all callers. Adjust for new Kept_section.
9948 (Layout::find_kept_object): Remove.
9949 * object.cc (Sized_relobj::include_section_group): Update use of
9950 Kept_section. Rename secnum to shndx. Only record
9951 Kept_comdat_section if sections are the same size.
9952 (Sized_relobj::include_linkonce_section): Update use of
9953 Kept_section. Only record Kept_comdat_section if sections are the
9954 same size. Set size of linkonce section.
9955 (Sized_relobj::map_to_kept_section): Update call to
9956 get_kept_comdat_section.
9957 * object.h (class Sized_relobj): Rename fields in
9958 Kept_comdat_section to drop trailing underscores; change object
9959 field to Relobj*. Change Kept_comdat_section_table to store
9960 struct rather than pointer.
9961 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9962 Add kept_object and kept_shndx parameters. Change all callers.
9963 (Sized_relobj::get_kept_comdat_section): Change return type to
9964 bool. Add kept_object and kept_shndx parameters. Change all
9966 * plugin.cc (Pluginobj::include_comdat_group): Update call to
9967 Layout::find_or_add_kept_section.
9969 2009-07-09 Ian Lance Taylor <iant@google.com>
9971 * merge.cc (Object_merge_map::initialize_input_to_output_map):
9972 Reserve space in the hash table.
9974 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
9976 * fileread.cc (File_read::get_mtime): New method.
9977 * fileread.h (Timespec): New structure.
9978 (File_read::get_mtime): New method.
9979 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9980 Renamed from timestamp_nsec.
9981 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9983 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9985 (Incremental_inputs::report_archive): Save mtime; style fix.
9986 (Incremental_inputs::report_obejct): Save mtime; style fix.
9987 (Incremental_inputs::report_script): Save mtime; style fix.
9988 (Incremental_inputs::finalize_inputs): Style fix.
9989 (Incremental_inputs::finalize): Style fix.
9990 (Incremental_inputs::create_input_section_data): Store inputs
9992 * incremental.h (Incremental_inputs::report_script): Add mtime
9994 (Incremental_inputs::Input_info::Input_info): Intialize only one
9996 (Incremental_inputs::Input_info::archive): Move to nameless
9998 (Incremental_inputs::Input_info::obejct): Move to nameless union.
9999 (Incremental_inputs::Input_info::script): Move to nameless union.
10000 (Incremental_inputs::mtime): New field.
10001 * script.cc (read_input_script): Pass file mtime to
10003 * script.h (Script_info::inputs): Style fix.
10005 2009-07-01 Ian Lance Taylor <ian@airs.com>
10007 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10010 2009-06-24 Ian Lance Taylor <iant@google.com>
10013 * layout.cc (Layout::choose_output_section): If we find an
10014 existing section, update the flags.
10015 (Layout::create_notes): New function, broken out of
10017 (Layout::finalize): Don't create note sections.
10018 (Layout::create_note): Don't crash if linker script discards
10020 (Layout::create_gold_note): Likewise.
10021 (Layout::create_build_id): Likewise. Don't set
10022 after_input_sections on the section.
10023 (Layout::create_executable_stack_info): Remove target parameter.
10025 * layout.h (class Layout): Declare create_notes. Update
10026 declaration of create_executable_stack_info.
10027 * gold.cc (queue_middle_tasks): Call create_notes.
10028 * output.cc (Output_section::update_flags_for_input_section): Move
10029 here from output.h. If SHF_ALLOC flag is newly set, mark address
10031 * output.h (Output_data::mark_address_invalid): New function.
10032 (class Output_section): Only declare, not define,
10033 update_flags_for_input_section. Remove set_flags.
10035 2009-06-24 Ian Lance Taylor <iant@google.com>
10037 * script-sections.cc (Output_section_definition::
10038 set_section_addresses): Rename shadowing local load_address to
10041 2009-06-24 Ian Lance Taylor <iant@google.com>
10044 * reloc.cc (relocate_sections): Skip empty relocation sections.
10046 2009-06-23 Ian Lance Taylor <iant@google.com>
10049 * layout.cc (Layout::create_note): Use choose_output_section
10050 rather than make_output_section.
10052 2009-06-23 Ian Lance Taylor <iant@google.com>
10055 * options.cc (General_options::parse_V): Set printed_version_.
10056 (General_options::General_options): Initialize printed_version_.
10057 * options.h (class General_options): Add printed_version_ field.
10058 * gold.cc (queue_initial_tasks): If there are no input files,
10059 don't give a fatal error if we printed the version information.
10060 (queue_middle_tasks): If using -r with a shared object, give a
10061 fatal error rather than an ordinary error.
10063 2009-06-23 Ian Lance Taylor <iant@google.com>
10066 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10067 (Layout::make_output_section): Set have_stabstr_section_ if we see
10068 a .stab*str section.
10069 (Layout::finalize): Call link_stabs_sections.
10070 (Layout::link_stabs_sections): New file.
10071 * layout.h (class Layout): Add have_stabstr_section_ field.
10072 Declare link_stabs_sections.
10074 2009-06-23 Doug Kwan <dougkwan@google.com>
10076 * Makefile.am (libgold_a_LIBADD): New.
10077 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10078 * Makefile.in: Regenerate.
10079 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10080 * configure: Regenerate.
10081 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10082 * fileread.cc: Include sys/state.h
10083 * gold.h: Declare memmem and strndup if found missing.
10084 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10086 2009-06-23 Ian Lance Taylor <iant@google.com>
10088 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10089 * configure: Rebuild.
10091 2009-06-23 Ian Lance Taylor <iant@google.com>
10094 * object.cc (Object::section_contents): Don't try to get a view if
10095 the section has length zero.
10096 (Object::handle_gnu_warning_section): If the section is empty, use
10097 the name of the section as the warning.
10099 2009-06-23 Ian Lance Taylor <iant@google.com>
10102 * stringpool.h (class Stringpool_template): Add optimize_ field.
10103 (Stringpool_template::set_optimize): New function.
10104 * stringpool.cc (Stringpool_template::Stringpool_template):
10105 Initialize optimize_ field.
10106 (Stringpool_template::set_string_offsets): Test local optimize
10107 fild rather than parameter.
10108 * layout.cc (Layout::Layout): Call set_optimize on the section
10111 2009-06-22 Ian Lance Taylor <iant@google.com>
10114 * yyscript.y: Parse TARGET.
10115 * script.cc (script_set_target): New function.
10116 * script-c.h (script_set_target): Declare.
10117 * options.cc (General_options::string_to_object_format): Rename
10118 from string_to_object_format in anonymous namespace. Change
10120 * options.h (class General_options): Declare
10121 string_to_object_format.
10123 2009-06-22 Ian Lance Taylor <iant@google.com>
10125 * script-sections.cc (Script_sections::create_segments): Don't put
10126 program headers in a PT_LOAD segment if -n or -N.
10128 2009-06-22 Ian Lance Taylor <iant@google.com>
10131 * options.h (class General_options): Add -z lazy and -z now. Sort
10132 -z options into alphabetical order.
10133 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10135 2009-06-21 Ian Lance Taylor <iant@google.com>
10137 * layout.cc (Layout::make_output_section): Call
10138 Target::new_output_section.
10139 (Layout::attach_allocated_section_to_segment): Put large section
10140 sections in a separate load segment with the large segment flag
10142 (Layout::segment_precedes): Sort large data segments after other
10144 (align_file_offset): New static function.
10145 (Layout::set_segment_offsets): Use align_file_offset.
10146 * output.h (class Output_section): Add is_small_section_ and
10147 is_large_section_ fields.
10148 (Output_section::is_small_section): New function.
10149 (Output_section::set_is_small_section): New function.
10150 (Output_section::is_large_section): New function.
10151 (Output_section::set_is_large_section): New function.
10152 (Output_section::is_large_data_section): New function.
10153 (class Output_segment): Add is_large_data_segment_ field.
10154 (Output_segment::is_large_data_segment): New function.
10155 (Output_segment::set_is_large_data_segment): New function.
10156 * output.cc (Output_section::Output_section): Initialize new
10158 (Output_segment::Output_segment): Likewise.
10159 (Output_segment::add_output_section): Add assertion that large
10160 data sections always go in large data segments. Force small data
10161 sections to the end of the list of data sections. Force small BSS
10162 sections to the start of the list of BSS sections. For large BSS
10163 sections to the end of the list of BSS sections.
10164 * symtab.h (class Symbol): Declare is_common_shndx.
10165 (Symbol::is_defined): Check Symbol::is_common_shndx.
10166 (Symbol::is_common): Likewise.
10167 (class Symbol_table): Define enum Commons_section_type. Update
10168 declarations. Add small_commons_ and large_commons_ fields.
10169 * symtab.cc (Symbol::is_common_shndx): New function.
10170 (Symbol_table::Symbol_table): Initialize new fields.
10171 (Symbol_table::add_from_object): Put small and large common
10172 symbols in the right list.
10173 (Symbol_table::sized_finalized_symbol): Check
10174 Symbol::is_common_shndx.
10175 (Symbol_table::sized_write_globals): Likewise.
10176 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10177 common symbol lists. Don't call do_allocate_commons_list if the
10179 (Symbol_table::do_allocate_commons_list): Remove is_tls
10180 parameter. Add comons_section_type parameter. Change all
10181 callers. Handle small and large common symbols.
10182 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10183 Symbol::is_common_shndx.
10184 * resolve.cc (symbol_to_bits): Likewise.
10185 * target.h (Target::small_common_shndx): New function.
10186 (Target::small_common_section_flags): New function.
10187 (Target::large_common_shndx): New function.
10188 (Target::large_common_section_flags): New function.
10189 (Target::new_output_section): New function.
10190 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10191 small_common_section_flags, and large_common_section_flags
10193 (Target::do_new_output_section): New virtual function.
10194 * arm.cc (Target_arm::arm_info): Initialize new fields.
10195 * i386.cc (Target_i386::i386_info): Likewise.
10196 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10198 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10199 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10200 (Target_x86_64::do_new_output_section): New function.
10201 * configure.ac: Define conditional MCMODEL_MEDIUM.
10202 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10203 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10204 (large_LDFLAGS): Define.
10205 * testsuite/large.c: New file.
10206 * testsuite/testfile.cc (Target_test::test_target_info):
10207 Initialize new fields.
10208 * configure, testsuite/Makefile.in: Rebuild.
10210 2009-06-05 Doug Kwan <dougkwan@google.com>
10212 * Makefile.am (CCFILES): Add target.cc.
10213 * Makefile.in: Regenerate.
10214 * i386.cc (class Target_i386): Define new virtual method to
10215 override do_is_local_label_name in parent.
10216 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10217 local symbols if --discard-locals or -X is given.
10218 * options.h (class General_options): Declare new options
10219 '--discard-locals' and '-X' for discarding locals.
10220 * target.h (class Target): Define new methods is_local_label_name.
10221 Declare new virtual method do_is_local_label_name.
10222 * target.cc: New file.
10223 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10224 (check_SCRIPTS): Add discard_locals_test.sh.
10225 (check_DATA): Add discard_local_tests.syms.
10226 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10227 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10228 * testsuite/Makefile.in: Regenerate.
10229 * testsuite/discard_locals_test.c: New file.
10230 * testsuite/discard_locals_test.sh: Same.
10232 2009-06-05 Doug Kwan <dougkwan@google.com>
10234 * object.cc (Sized_relobj::Sized_relobj): Initialize
10235 discarded_eh_frame_shndx_ to -1U.
10236 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10238 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10239 a discarded .eh_frame section.
10240 (Sized_relobj::do_finalize_local_symbols): Ditto.
10241 * object.h (class Sized_relobj): Declare new member
10242 discarded_eh_frame_shndx_.
10243 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10244 (local_labels_test.o, local_labels_test): New rules.
10245 * testsuite/Makefile.in: Regenerate.
10247 2009-06-04 Doug Kwan <dougkwan@google.com>
10249 * layout.cc (Layout::section_name_mapping): Add mapping for
10250 special ARM sections.
10252 2009-06-03 Doug Kwan <dougkwan@google.com>
10254 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10255 (utils::has_overflow): Same.
10257 2009-06-03 Ian Lance Taylor <iant@google.com>
10259 * layout.cc (Layout::section_name_mapping): New array, replacing
10260 Layout::linkonce_mapping.
10261 (Layout::section_name_mapping_count): New variable, replacing
10262 Layout::linkonce_mapping_count.
10263 (Layout::linkonce_output_name): Remove.
10264 (Layout::output_section_name): Rewrite.
10265 * layout.h (class Layout): Rename Linkonce_mapping to
10266 Section_name_mapping, linkonce_mapping to section_name_mapping,
10267 linkonce_mapping_count to section_name_mapping_count. Don't
10268 declare linkonce_output_name.
10270 2009-06-03 Doug Kwan <dougkwan@google.com>
10272 * gold/arm.cc (namespace utils): New.
10273 (Target_arm::reloc_is_non_pic): Define new method.
10274 (class Arm_relocate_functions): New.
10275 (Target_arm::Relocate::relocate): Handle relocation types used by
10278 2009-06-03 Ian Lance Taylor <iant@google.com>
10280 * arm.cc (Target_arm::scan::global): Use || instead of |.
10282 2009-06-02 Doug Kwan <dougkwan@google.com>
10284 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10285 issued_non_pic_error_.
10286 (class Target_arm::Scan): Declare new method check_non_pic.
10287 Define new method symbol_needs_plt_entry.
10288 Declare new data member issued_non_pic_error_.
10289 (class Target_arm::Relocate): Declare new method
10290 should_apply_static_reloc.
10291 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10292 (Target_arm::Scan::check_non_pic): Define new method.
10293 (Target_arm::Scan::local): Handle a small subset of reloc types used
10295 (Target_arm::Scan::local): Same.
10296 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10298 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10300 * incremental.cc (Incremental_inputs::report_command_line): Filter
10301 out --incremental-* options.
10303 2009-05-29 Doug Kwan <dougkwan@google.com>
10305 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10307 (class Target_arm): Update comment.
10308 (Target_arm::Target_arm): Initialize new data members GOT_,
10309 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10310 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10311 and Target_arm::rel_dyn_section.
10312 Declare new_enum Target_arm::Got_type.
10313 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10315 Update commments for member do_dynsym_value.
10316 (Target_arm::got_size, Target_arm::plt_section,
10317 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10318 new methods inside class defintion.
10319 (Target_arm::got_section): Define new method.
10320 (Target_arm::rel_dyn_section): Same.
10321 (Output_data_plt_arm): New template class.
10322 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10323 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10324 (Output_data_plt_arm::add_entry): Same.
10325 (Output_data_plt_arm::first_plt_entry): Define new
10326 static data member for PLT instruction template.
10327 (Output_data_plt_arm::plt_entry): Same.
10328 (Output_data_plt_arm::do_write): Define new method.
10329 (Target_arm::make_plt_entry): Same.
10330 (Target_arm::do_finalize_sections): Same.
10331 (Target_arm::do_dynsym_value): Same.
10333 2009-05-28 Doug Kwan <dougkwan@google.com>
10335 * Makefile.am (TARGETSOURCES): Add arm.cc.
10336 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10337 * Makefile.in: Regenerate.
10338 * arm.cc: New file.
10339 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10341 2009-05-26 Doug Kwan <dougkwan@google.com>
10343 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10344 (General_options::check_excluded_libs): Strip off directories in
10345 archive name before matching like GNU ld does.
10346 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10347 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10348 (exclude_libs_test_LDFLAGS): Add linker option
10349 -Wl,--exclude-libs,libexclude_libs_test_3
10350 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10351 an explicit archive without using -l.
10352 (alt/libexclude_libs_test_3.a): New make rule.
10353 * testsuite/Makefile.in: Regenerate.
10354 * testsuite/exclude_libs_test.c : Declare lib3_default().
10356 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10357 * exclude_libs_test_3.c: New file.
10359 2009-05-26 Nick Clifton <nickc@redhat.com>
10361 * po/id.po: New Indonesian translation.
10362 * po/gold.pot: Updated template file.
10364 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10366 * testsuite/Makefile.am: Add -ffunction-sections to compile
10367 gc_comdat_test files. Add -Wl,--gc-sections to build
10369 * testsuite/Makefile.in: Regenerate.
10370 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10372 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10374 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10375 kept comdat section was garbage collected.
10376 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10377 * testsuite/Makefile.in: Regenerate.
10378 * testsuite/gc_comdat_test.sh: New file.
10379 * testsuite/gc_comdat_test_1.cc: New file.
10380 * testsuite/gc_comdat_test_2.cc: New file.
10382 2009-05-19 Doug Kwan <dougkwan@google.com>
10384 * archive.cc (Archive::Archive): Move constructor from archive.h
10385 to here. Initialize no_export_.
10386 (Archive::get_elf_object_for_member): Set no_export flag of object.
10387 * archive.h (Archive::Archive): Move constructor body to
10389 (Archive::no_export): New method.
10390 (Archive::no_export_): New field.
10391 * object.h (Object::Object): Initialize no_export_ to false.
10392 (Object::no_export, Object::set_no_export): New methods.
10393 (Object::no_export_): New field.
10394 * options.cc (General_options::parse_exclude_libs): New method.
10395 (General_options::check_excluded_libs) Same.
10396 * options.h (exclude_libs): New option.
10397 (General_options::check_excluded_libs): New method declaration.
10398 (General_options::excluded_libs_): New field.
10399 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10400 default or protected visibility if an object has no-export flag set.
10401 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10402 (check_SCRIPTS): Add exclude_libs_test.sh.
10403 (check_DATA): Add exclude_libs_test.syms.
10404 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10405 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10406 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10407 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10408 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10409 libexclude_libs_test_2.a): New rules.
10410 * testsuite/Makefile.in: Regenerate.
10411 * testsuite/exclude_libs_test.c: New file.
10412 * testsuite/exclude_libs_test.sh: Ditto.
10413 * testsuite/exclude_libs_test_1.c: Ditto.
10414 * testsuite/exclude_libs_test_2.c: Ditto.
10416 2009-05-15 Ian Lance Taylor <iant@google.com>
10418 * configure.ac: Check for declarations for cases where libiberty.h
10419 checks HAVE_DECL_xxx.
10420 * configure, config.in: Rebuild.
10422 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10424 * gold.h (Incremental_argument_list): Remove (invalid) forward
10426 * incremental.cc (Incremental_inputs::report_achive): New method.
10427 (Incremental_inputs::report_object): New method.
10428 (Incremental_inputs::report_script): New method.
10429 (Incremental_inputs::finalize_inputs): New method.
10430 (Incremental_inputs::finalize): Call finalize_inputs().
10431 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10432 Create inputs entries.
10433 * incremental.h (Incremental_input_type): New enum.
10434 (Incremental_inputs::Incremental_input): Initialize new fields.
10435 (Incremental_inputs::report_inputs): New method.
10436 (Incremental_inputs::report_achive): New method.
10437 (Incremental_inputs::report_object): New method.
10438 (Incremental_inputs::report_script): New method.
10439 (Incremental_inputs::finalize_inputs): New method.
10440 (Incremental_inputs::Input_info): New struct.
10441 (Incremental_inputs::Input_info_map): New typedef.
10442 (Incremental_inputs::lock_): New field.
10443 (Incremental_inputs::Inputs_): New field.
10444 (Incremental_inputs::Inputs_map): New field.
10445 * main.cc (main): Call Incremental_input::report_inputs.
10446 * options.h (Input_argument_list): Typedef moved from
10448 (Input_file_group::Files): Remove, use ::Input_argument_list.
10449 (Input_file_group::Input_argument_list): Remove, use
10450 ::Input_argument_list.
10451 * plugin.cc (Plugin_manager::add_input_file): Add error in
10453 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10455 * script.cc (read_input_script): Call
10456 Incremental_input::report_script.
10457 * script.h (Script_info): New class.
10459 2009-04-27 Ian Lance Taylor <iant@google.com>
10461 * x86_64.cc (do_adjust_output_section): Set entsize to
10464 2009-04-23 Elliott Hughes <enh@google.com>
10466 * output.cc (Output_file::close): After short writes, continue
10467 writing from the correct offset in the buffer being written.
10469 2009-04-23 Chris Demetriou <cgd@google.com>
10471 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10472 * configure: Regenerate.
10473 * config.in: Regenerate.
10474 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10475 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10477 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10479 * incremental.cc (Incremental_inputs_header_data): Renamed from
10480 Incremental_input_header_data.
10481 (Incremental_inputs_header_data::data_size): New field.
10482 (Incremental_inputs_header_data::put_input_file_count): Renamed
10483 from input_file_count.
10484 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10485 from command_line_offset.
10486 (Incremental_inputs_header_data::put_reserved): Renamed from
10488 (Incremental_inputs_entry_data): Renamed from
10489 Incremental_input_entry_data.
10490 (Incremental_inputs_entry_data::data_size): New field.
10491 (Incremental_inputs::report_command_line): New method.
10492 (Incremental_inputs::finalize): New method.
10493 (Incremental_inputs::create_incremental_inputs_data): New method.
10494 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10495 * incremental.h: New file.
10496 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10497 (Layout::finalize): Create incremental inputs section in
10498 incremental builds.
10499 (Layout::create_incremental_info_sections): New method.
10500 * layout.h (Layout::incremental_inputs): New method.
10501 (Layout::create_incremental_info_sections): New method.
10502 (Layout::incremental_inputs_): New field.
10503 * main.cc (main): Notify Incremental_input of the command line.
10505 2009-04-01 Ian Lance Taylor <iant@google.com>
10506 Mikolaj Zalewski <mikolajz@google.com>
10508 * gold.h (reserve_unordered_map): Define, three versions, one for
10509 each version of Unordered_map.
10510 * layout.cc (Layout::Layout): Remove options parameter. Add
10511 number_of_input_files parameter. Don't initialize options_.
10512 Initialize number_of_input_files_ and resized_signatures_. Move
10513 sections_are_attached_.
10514 (Layout::layout_group): Reserve space for group_signatures_.
10515 (Layout::find_or_add_kept_section): Change name parameter to be a
10516 reference. Resize signatures_ map when it gets large enough.
10517 (Layout::layout_eh_frame): Use parameters->options() instead of
10519 (Layout::make_output_section): Likewise.
10520 (Layout::attach_allocated_section_to_segment): Likewise.
10521 (Layout::finalize, Layout::create_executable_stack): Likewise.
10522 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10523 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10524 * layout.h (class Layout): Update declarations. Remove options_
10525 field. Add number_of_input_files_ and resized_signatures_
10526 fields. Move sections_are_attached_ field.
10527 * main.cc (main): Pass number of input files to Layout
10528 constructor. Don't pass options.
10530 2009-03-30 Ian Lance Taylor <iant@google.com>
10532 * ffsll.c (ffsll): Correct implementation.
10534 2009-03-27 Ian Lance Taylor <iant@google.com>
10536 * ffsll.c: New file.
10537 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10538 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10539 * ftruncate.c (ftruncate): Declare before definition.
10540 * mremap.c (mremap): Likewise.
10541 * pread.c (pread): Likewise.
10542 * configure, Makefile.in, config.in: Rebuild.
10544 * mremap.c: New file.
10545 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10546 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10547 (mremap): Declare if HAVE_MREMAP is not defined.
10548 * configure, Makefile.in, config.in: Rebuild.
10550 2009-03-27 Cary Coutant <ccoutant@google.com>
10552 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10553 position independent.
10554 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10555 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10557 2009-03-24 Cary Coutant <ccoutant@google.com>
10559 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10561 (needs_dynamic_reloc): Likewise.
10563 2009-03-24 Ian Lance Taylor <iant@google.com>
10565 * yyscript.y (file_cmd): Recognize EXTERN.
10566 (extern_name_list, extern_name_list_body): New nonterminals.
10567 * script.cc (script_add_extern): Define.
10568 * script-c.h (script_add_extern): Declare.
10570 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10572 * object.cc (is_elf_object): Define.
10573 * object.h (is_elf_object): Declare.
10574 * archive.cc (Archive::get_elf_object_for_member): Call
10576 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10578 2009-03-24 Elliott Hughes <enh@google.com>
10580 * output.cc (Output_file::map_anonymous): Define.
10581 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10582 try an anonymous one. Report the size if the mmap fails.
10583 * output.h (class Output_file): Declare map_anonymous.
10585 2009-03-24 Ian Lance Taylor <iant@google.com>
10587 * target-select.cc (instantiate_target): Don't acquire the lock if
10588 the instantiated_target_ field has already been set.
10590 2009-03-23 Ian Lance Taylor <iant@google.com>
10592 * gold-threads.h (class Initialize_lock): Define.
10593 * gold-threads.cc (class Initialize_lock_once): Define.
10594 (initialize_lock_control): New static variable.
10595 (initialize_lock_pointer): New static variable.
10596 (initialize_lock_once): New static function.
10597 (Initialize_lock::Initialize_lock): Define.
10598 (Initialize_lock::initialize): Define.
10599 * target-select.h: Include "gold-threads.h".
10600 (class Target_selector): Add lock_ and initialize_lock_ fields.
10601 Don't define instantiate_target, just declare it.
10602 * target-select.cc (Target_selector::Target_selector): Initialize
10604 (Target_selector::instantiate_target): Define.
10605 * descriptors.h: Include "gold-threads.h".
10606 (class Descriptors): Add initialize_lock_ field.
10607 * descriptors.cc (Descriptors::Descriptors): Initialize new
10609 (Descriptors::open): Use initialize_lock_ field
10610 * errors.h (class Errors): Add initialize_lock_ field.
10611 * errors.cc (Errors::Errors): Initialize new field.
10612 (Errors::initialize_lock): Use initialize_lock_ field.
10613 * powerpc.cc (class Target_selector_powerpc): Remove
10614 instantiated_target_ field. In do_recognize call
10615 instantiate_target rather than do_instantiate_target. In
10616 do_instantiate_target just allocate a new target.
10617 * sparc.cc (class Target_selector_sparc): Likewise.
10619 * freebsd.h: New file.
10620 * i386.cc: Include "freebsd.h".
10621 (Target_i386): Derive from Target_freebsd rather than
10623 (Target_selector_i386): Derive from Target_selector_freebsd rather
10624 than Target_selector.
10625 * x86_64.cc: Include "freebsd.h".
10626 (Target_x86_64): Derive from Target_freebsd rather than
10628 (Target_selector_x86_64): Derive from Target_selector_freebsd
10629 rather than Target_selector.
10630 * target.h (class Target): Add adjust_elf_header and
10631 do_adjust_elf_header.
10632 * output.cc (Output_file_header:: do_sized_write): Call target
10633 adjust_elf_header routine.
10634 * configure.tgt: Set targ_osabi.
10635 * configure.ac: Define GOLD_DEFAULT_OSABI.
10636 * parameters.cc (Parameters::default_target): Pass
10637 GOLD_DEFAULT_OSABI to select_target.
10638 * target-select.h (class Target_selector): Make instantiate_target
10639 protected rather than private.
10640 * Makefile.am (HFILES): Add freebsd.h.
10641 * configure, Makefile.in, config.in: Rebuild.
10643 * merge.cc (do_add_input_section): Correct pend value. Change
10644 message about last entry not being null terminated from error to
10647 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10649 * incremental.cc: New file.
10650 * Makefile.am (CCFILES): Add incremental.cc.
10651 * Makefile.in: Rebuild.
10653 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10655 * layout.cc (Layout::output_section_name): Preserve names
10656 of '.note.' sections.
10658 2009-03-19 Ian Lance Taylor <iant@google.com>
10660 * descriptors.cc (Descriptors::open): Check that the options are
10661 valid before using them.
10663 2009-03-18 Ian Lance Taylor <iant@google.com>
10665 * script-sections.h: Include <list>.
10666 (class Script_sections): Change Sections_elements from std::vector
10667 to std::list. Typedef public Elements_iterator. Add
10668 orphan_section_placement_, data_segment_align_start_, and
10669 saw_data_segment_align_ fields. Remove data_segment_align_index_
10671 * script-sections.cc (class Orphan_section_placement): New class.
10672 (class Sections_element): Add virtual functions is_relro and
10673 orphan_section_init. Remove virtual function place_orphan_here.
10674 (class Output_section_definition): Add is_relro and
10675 orphan_section_init. Remove place_orphan_here.
10676 (class Orphan_output_section): Likewise.
10677 (Script_sections::Script_sections): Update for field changes.
10678 (Script_sections::data_segment_align): Set saw_data_segment_align_
10679 and data_segment_align_start_, not data_segment_align_index.
10680 (Script_sections::data_segment_relro_end): Check
10681 saw_data_segment_align_. Use data_segment_align_start_ rather
10682 than data_segment_align_index_.
10683 (Script_sections::place_orphan): Rewrite to use
10684 Orphan_section_placement.
10686 2009-03-17 Ian Lance Taylor <iant@google.com>
10688 * archive.cc (Archive::add_symbols): Check for a version attached
10689 to the symbol name in the archive map.
10690 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10691 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10692 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10693 (ver_test_11.a): New target.
10694 * testsuite/Makefile.in: Rebuild.
10696 * configure.ac: Check for chsize and posix_fallocate. Replace
10698 * ftruncate.c: New file, from gnulib.
10699 * output.cc (posix_fallocate): Define dummy version if not
10700 HAVE_POSIX_FALLOCATE.
10701 (Output_file::map): Call posix_fallocate rather than lseek and
10703 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10704 * configure, Makefile.in, config.in: Rebuild.
10706 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10708 * layout.h (Layout::create_note): Add section_name parameter.
10709 * layout.cc (Layout::create_note): Likewise.
10710 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10712 2009-03-17 Ian Lance Taylor <iant@google.com>
10714 * descriptors.cc: Include "options.h".
10715 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10716 (Descriptors::open): Always use O_CLOEXEC when opening a new
10717 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10718 then set FD_CLOEXEC.
10720 * sparc.cc (class Target_sparc): Add has_got_section.
10721 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10722 make sure we have a GOT section.
10724 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10725 (Target_sparc::Scan::local): Likewise.
10726 (Target_sparc::Scan::global): Likewise.
10727 (Target_sparc::Relocate::relocate): Likewise.
10728 (Target_sparc::Relocate::relocate_tls): Likewise.
10730 * symtab.cc (Symbol_table::define_default_version): New function,
10731 broken out of add_from_object.
10732 (Symbol_table::add_from_object): Call define_default_version.
10733 (Symbol_table::define_special_symbol): Add resolve_oldsym
10734 parameter. Change all callers. If the version for a symbol comes
10735 from a version script, resolve it with the symbol with the same
10736 name with no version. Also add the symbol without a version if
10738 (do_define_in_output_data): If resolving with oldsym, don't delete
10740 (do_define_in_output_segment): Likewise.
10741 (do_define_as_constant): Likewise.
10742 * symtab.h (class Symbol_table): Update declarations.
10744 2009-03-13 Ian Lance Taylor <iant@google.com>
10746 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10747 (Read_symbols::requeue): New function.
10748 (Read_symbols::do_read_symbols): If make_elf_object fails because
10749 the target type is not configured, and the file was searched for,
10750 issue a warning and retry with the next directory.
10751 (Add_symbols::run): If the file has an incompatible format, and
10752 it was searched for, requeue the Read_symbols task. On error,
10753 release the object.
10754 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10755 dirindex parameter to constructor. Change all callers. Declare
10756 incompatible_warning and requeue.
10757 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10758 input_argument_ and input_group_ fields. Add them to
10759 constructor. Change all callers.
10760 (class Read_script): Add dirindex_ field. Add it to constructor.
10761 Change all callers.
10762 * archive.cc (Archive::setup): Remove input_objects parameter.
10763 Change all callers.
10764 (Archive::get_file_and_offset): Likewise.
10765 (Archive::read_all_symbols): Likewise.
10766 (Archive::read_symbols): Likewise.
10767 (Archive::get_elf_object_for_member): Remove input_objects
10768 parameter. Add punconfigured parameter. Change all callers.
10769 (Archive::add_symbols): Change return type to bool. Check return
10770 value of include_member.
10771 (Archive::include_all_members): Likewise.
10772 (Archive::include_member): Change return type to bool. Return
10773 false if first included object has incompatible target. Set
10774 included_member_ field.
10775 (Add_archive_symbols::run): If add_symbols returns false, requeue
10777 * archive.h (class Archive): Add included_member_ field.
10778 Initialize it in constructor. Add input_file and searched_for
10779 methods. Update declarations.
10780 (class Add_archive_symbols): Add dirpath_, dirindex_, and
10781 input_argument_ fields. Add them to constructor. Change all
10783 * script.cc: Include "target-select.h".
10784 (class Parser_closure): Add skip_on_incompatible_target_ and
10785 found_incompatible_target_ fields. Add
10786 skip_on_incompatible_target parameter to constructor. Change all
10787 callers. Add methods skip_on_incompatible_target,
10788 clear_skip_on_incompatible_target, found_incompatible_target, and
10789 set_found_incompatible_target.
10790 (read_input_script): Add dirindex parameter. Change all callers.
10791 If parser finds an incompatible target, requeue Read_symbols
10793 (script_set_symbol): Clear skip_on_incompatible_target in
10795 (script_add_assertion, script_parse_option): Likewise.
10796 (script_start_sections, script_add_phdr): Likewise.
10797 (script_check_output_format): New function.
10798 * script.h (read_input_script): Update declaration.
10799 * script-c.h (script_check_output_format): Declare.
10800 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10801 (ignore_cmd): Remove OUTPUT_FORMAT.
10802 * fileread.cc (Input_file::Input_file): Add explicit this.
10803 (Input_file::will_search_for): New function.
10804 (Input_file::open): Add pindex parameter. Change all callers.
10805 * fileread.h (class Input_file): Add input_file_argument method.
10806 Declare will_search_for. Update declarations.
10807 * object.cc (make_elf_object): Add punconfigured parameter.
10808 Change all callers.
10809 * object.h (class Object): Make input_file public. Add
10810 searched_for method.
10811 (make_elf_object): Update declaration.
10812 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
10814 * dirsearch.h (class Dirsearch): Update declaration.
10815 * options.h (class General_options): Add --warn-search-mismatch.
10816 * parameters.cc (Parameters::is_compatible_target): New function.
10817 * parameters.h (class Parameters): Declare is_compatible_target.
10818 * workqueue.cc (Workqueue::add_blocker): New function.
10819 * workqueue.h (class Workqueue): Declare add_blocker.
10821 * fileread.cc (Input_file::open): Remove options parameter.
10822 Change all callers.
10823 (Input_file::open_binary): Likewise.
10824 * script.cc (read_input_script): Likewise.
10825 * readsyms.h (class Read_symbols): Remove options_ field. Remove
10826 options parameter from constructor. Change all callers.
10827 (class Read_script): Likewise.
10828 * fileread.h (class Input_file): Update declarations.
10829 * script.h (read_input_script): Update declaration.
10831 2009-03-10 Nick Clifton <nickc@redhat.com>
10833 * po/es.po: New Spanish translation.
10835 2009-03-06 Cary Coutant <ccoutant@google.com>
10837 * options.cc (parse_short_option): Keep dash_z from registering itself.
10839 2009-03-03 Ian Lance Taylor <iant@google.com>
10842 * target-reloc.h (relocate_section): Pass output_section to
10844 * i386.cc (Target_i386::should_apply_static_reloc): Add
10845 output_section parameter. Change all callers.
10846 (Target_i386::Relocate::relocate): Add output_section parameter.
10847 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10848 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10849 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10850 * testsuite/two_file_shared.sh: New script.
10851 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10852 (check_DATA): Add two_file_shared.dbg.
10853 (two_file_shared.dbg): New target.
10854 * testsuite/Makefile.in: Rebuild.
10856 2009-03-01 Ian Lance Taylor <iant@google.com>
10858 * configure.ac: Check for byteswap.h.
10859 * configure: Rebuild.
10860 * config.in: Rebuild.
10862 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
10864 * layout.cc (Layout::find_or_add_kept_section): New function.
10865 (Layout::add_comdat): Removed.
10866 * layout.h (struct Kept_section): Move out of class Layout.
10867 Remove trailing underscores from field names. Add group_sections
10868 field. Rename group_ field to is_group. Change all uses.
10869 (class Layout): Declare find_or_add_kept_section, not add_comdat.
10870 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10871 comdat_groups_ field.
10872 (Sized_relobj::include_section_group): Use
10873 find_or_add_kept_section and Kept_section::group_sections.
10874 (Sized_relobj::include_linkonce_section): Likewise.
10875 * object.cc (class Sized_relobj): Don't define Comdat_group or
10876 Comdat_group_table. Remove find_comdat_group and
10877 add_comdat_group. Remove comdat_groups_ field.
10878 * plugin.cc (include_comdat_group): Use
10879 Layout::find_or_add_kept_section.
10881 2009-02-28 Ian Lance Taylor <iant@google.com>
10883 * README: --gc-sections and map files are now supported. Document
10884 some build requirements.
10887 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10888 relocatable link set the value of the section symbol to zero.
10889 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10890 relocatable link don't include the section address in the local
10893 2009-02-27 Ian Lance Taylor <iant@google.com>
10896 * options.h (class Search_directory): Add is_system_directory.
10897 (class General_options): Declare is_in_system_directory.
10898 * options.cc (get_relative_sysroot): Make static.
10899 (get_default_sysroot): Make static.
10900 (General_optoins::is_in_system_directory): New function.
10901 * fileread.cc (Input_file::is_in_system_directory): New function.
10902 * fileread.h (class Input_file): Declare is_in_system_directory.
10903 * object.h (class Object): Add is_in_system_directory.
10904 (class Input_objects): Remove system_library_directory_ field.
10905 * object.cc (Input_objects::add_object): Don't set
10906 system_library_directory_.
10907 (input_objects::found_in_system_library_directory): Remove.
10908 * symtab.cc (Symbol_table::write_globals): Remove input_objects
10909 parameter. Change all callers.
10910 (Symbol_table::sized_write_globals): Likewise.
10911 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10912 Call Object::is_in_system_directory.
10913 * symtab.h (class Symbol_table): Update declarations.
10916 * descriptors.h (Open_descriptor): Add is_on_stack field.
10917 * descriptors.cc (Descriptors::open): If the descriptor is on the
10918 top of the stack, remove it. Initialize is_on_stack field.
10919 (Descriptors::release): Only add pod to stack if it is not on the
10921 (Descriptors::close_some_descriptor): Clear stack_next and
10922 is_on_stack fields.
10925 * output.cc (Output_section::find_starting_output_address): Rename
10926 from starting_output_address; add PADDR parameter; change return
10928 * output.h (class Output_section): Declare
10929 find_starting_output_address instead of starting_output_address.
10930 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10931 section symbol for which we can't find a merge section.
10934 * symtab.cc (Symbol_table::add_from_object): If the visibility is
10935 hidden or internal, force the symbol to be local.
10936 * resolve.cc (Symbol::override_visibility): Define.
10937 (Symbol::override_base): Use override_visibility.
10938 (Symbol_table::resolve): Likewise.
10939 (Symbol::override_base_with_special): Likewise.
10940 (Symbol_table::override_with_special): If the visibility is hidden
10941 or internal, force the symbol to be local.
10942 * symtab.h (class Symbol): Add set_visibility and
10943 override_visibility.
10944 * testsuite/ver_test_1.sh: New file.
10945 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10946 (check_DATA): Add ver_test_1.syms.
10947 (ver_test_1.syms): New target.
10948 * testsuite/Makefile.in: Rebuild.
10950 2009-02-25 Cary Coutant <ccoutant@google.com>
10952 * layout.cc (Layout::choose_output_section): Don't rename sections
10953 when using a linker script that has a SECTIONS clause.
10954 * Makefile.in: Regenerate.
10956 * testsuite/Makefile.am (script_test_5.sh): New test case.
10957 * testsuite/Makefile.in: Regenerate.
10958 * testsuite/script_test_5.cc: New file.
10959 * testsuite/script_test_5.sh: New file.
10960 * testsuite/script_test_5.t: New file.
10962 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
10964 * archive.cc (Archive::include_member): Update calls to add_symbols.
10965 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10966 the Layout argument.
10967 * dynobj.h (do_add_symbols): Add the Layout argument.
10968 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10970 * object.h (Object::add_symbols): Add the Layout argument.
10971 (Object::do_add_symbols): Add the Layout argument.
10972 (Sized_relobj::do_add_symbols): Add the Layout argument.
10973 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10974 Unify the two versions.
10975 (Add_plugin_symbols): Remove.
10976 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10977 (Sized_pluginobj::do_add_symbols): Unify the two versions.
10978 (Add_plugin_symbols): Remove.
10979 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10980 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10981 (Add_symbols::run): Make it work with Pulginobj.
10983 2009-02-06 Ian Lance Taylor <iant@google.com>
10985 * object.cc (Sized_relobj::do_layout): Make info message start
10986 with lower case letter.
10988 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
10990 * binary.cc: Fix file comment.
10992 * options.h (enum Incremental_disposition): Define.
10993 (class General_options): Add new options: --incremental,
10994 --incremental_changed, --incremental_unchanged,
10995 --incremental_unknown. Add incremental_disposition_ and
10996 implicit_incremental_ fields.
10997 (General_options::incremental_disposition): New function.
10998 (class Position_dependent_options): Add incremental_disposition
11000 (Position_dependent_options::copy_from_options): Set incremental
11002 * options.cc (General_options::parse_incremental_changed): New
11004 (General_options::parse_incremental_unchanged): New function.
11005 (General_options::parse_incremental_unknown): New function.
11006 (General_options::General_options): Initialize new fields
11007 incremental_disposition_ and implicit_incremental_.
11008 (General_options::finalize): Check for uasge of --incremental-*
11009 without --incremental.
11011 2009-02-06 Chris Demetriou <cgd@google.com>
11013 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11014 pointer and to report location as the file name associated with
11016 (gold_undefined_symbol_at_location): New function to replace the
11017 old gold_undefined_symbol functionality.
11018 * target-reloc.h (relocate_section): Update to use
11019 gold_undefined_symbol_at_location.
11020 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11021 Call gold_undefined_symbol function rather than gold_error.
11022 * errors.h (Errors::undefined_symbol): Take location as a
11023 string, rather than calculating it from a relocation.
11024 * errors.cc (Errors::fatal): Print "fatal error:" before the
11026 (Errors::error, Errors::error_at_location): Print "error: "
11027 before the formatted message.
11028 (Errors::undefined_symbol): Take location as a string, rather
11029 than calculating it from a relocation.
11030 (gold_undefined_symbol_at_location): New function akin to
11031 old gold_undefined_symbol, calculates location from relocation.
11032 (gold_undefined_symbol): Change to take only a Symbol pointer
11033 and to report location as the file name associated with the symbol.
11034 * testsuite/debug_msg.sh: Update for changed error messages.
11035 * testsuite/undef_symbol.sh: Likewise.
11037 2009-02-04 Duncan Sands <baldrick@free.fr>
11040 * reduced_debug_output.h
11041 (Output_reduced_debug_abbrev_section::failed): Use format for
11043 (Output_reduced_debug_info_section::faild): Likewise.
11045 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11047 * script.cc (Lazy_demangler): New class.
11048 (Version_script_info::get_symbol_version_helper): Demangle a
11051 2009-01-29 Cary Coutant <ccoutant@google.com>
11053 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11055 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11057 2009-01-28 Ian Lance Taylor <iant@google.com>
11059 * version.cc (version_string): Bump to 1.9.
11061 * gold.h: Include <cstring> and <stdint.h>.
11062 * version.cc: Include <cstdio>.
11063 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11065 * reduced_debug_output.cc (insert_into_vector): Rename from
11066 Insert_into_vector; change all callers. Use Swap_unaligned to
11067 avoid aliasing issue; remove union since it is unnecessary.
11069 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11071 * Makefile.am (CCFILES): Add gc.cc.
11072 (HFILES): Add gc.h.
11073 * Makefile.in: Regenerate.
11074 * gold.cc (Gc_runner): New class.
11075 (queue_initial_tasks): Call garbage collection related tasks
11076 when corresponding options are invoked.
11077 (queue_middle_gc_tasks): New function.
11078 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11079 processed early before laying out sections during garbage collection.
11080 * gold.h (queue_middle_gc_tasks): New function.
11081 (is_prefix_of): Move from "layout.cc".
11082 * i386.cc (Target_i386::gc_process_relocs): New function.
11083 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11084 * main.cc (main): Create object of class "Garbage_collection".
11085 * object.cc (Relobj::copy_symbols_data): New function.
11086 (Relobj::is_section_name_included): New function.
11087 (Sized_relobj::do_layout): Allow this function to be called twice
11088 during garbage collection and defer layout of section during the
11090 * object.h (Relobj::get_symbols_data): New function.
11091 (Relobj::is_section_name_included): New function.
11092 (Relobj::copy_symbols_data): New function.
11093 (Relobj::set_symbols_data): New function.
11094 (Relobj::get_relocs_data): New function.
11095 (Relobj::set_relocs_data): New function.
11096 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11097 (Relobj::gc_process_relocs): New function.
11098 (Relobj::do_gc_process_relocs): New pure virtual function.
11099 (Relobj::sd_): New data member.
11100 (Sized_relobj::is_output_section_offset_invalid): New function.
11101 (Sized_relobj::do_gc_process_relocs): New function.
11102 * options.h (General_options::gc_sections): Modify to not be a no-op.
11103 (General_options::print_gc_sections): New option.
11104 * plugin.cc (Plugin_finish::run): Remove function call to
11105 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11106 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11107 * reloc.cc (Read_relocs::run): Add task to process relocs and
11108 determine unreferenced sections when doing garbage collection.
11109 (Gc_process_relocs): New class.
11110 (Sized_relobj::do_gc_process_relocs): New function.
11111 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11112 sections that are garbage collected.
11113 * reloc.h (Gc_process_relocs): New class.
11114 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11115 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11116 symbols whose corresponding sections are garbage collected.
11117 (Symbol_table::Symbol_table): Add new parameter for the garbage
11119 (Symbol_table::gc_mark_undef_symbols): New function.
11120 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11121 (Symbol_table::gc_mark_dyn_syms): New function.
11122 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11124 (Symbol_table::add_from_object): Likewise.
11125 (Symbol_table::add_from_relobj): When building shared objects, do not
11126 treat externally visible symbols as garbage.
11127 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11128 table information for static and relocatable links.
11129 * symtab.h (Symbol_table::set_gc): New function.
11130 (Symbol_table::gc): New function.
11131 (Symbol_table::gc_mark_undef_symbols): New function.
11132 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11133 (Symbol_table::gc_mark_dyn_syms): New function.
11134 (Symbol_table::gc_): New data member.
11135 * target.h (Sized_target::gc_process_relocs): New pure virtual
11137 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11138 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11140 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11142 * options.h (General_options::gc_sections): Define as a no-op for now.
11143 (General_options::no_keep_memory): Ditto.
11144 (General_options::Bshareable): Define.
11145 * options.cc (General_options::finalize): Honor -Bshareable.
11147 2009-01-20 Andreas Schwab <schwab@suse.de>
11149 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11150 read the value in the contents, since we don't use it. Use the
11151 template endianness when writing.
11152 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11154 2009-01-19 Andreas Schwab <schwab@suse.de>
11156 * configure.tgt (powerpc64-*): Fix targ_obj.
11158 2009-01-15 Ian Lance Taylor <iant@google.com>
11160 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11161 local symbols when stripping all symbols.
11163 2009-01-14 Cary Coutant <ccoutant@google.com>
11165 * output.cc (Output_reloc): Add explicit instantiations.
11167 2009-01-14 Cary Coutant <ccoutant@google.com>
11169 * archive.cc (Archive::get_elf_object_for_member): Remove call
11170 to File_read::claim_for_plugin.
11171 * descriptors.cc (Descriptors::open): Remove reference to
11173 (Descriptors::claim_for_plugin): Remove.
11174 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11175 (Descriptors::is_claimed): Remove.
11176 (claim_descriptor_for_plugin): Remove.
11177 * fileread.cc (File_read::claim_for_plugin): Remove.
11178 * fileread.h (File_read::claim_for_plugin): Remove.
11179 (File_read::descriptor): Reopen descriptor if necessary.
11180 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11181 (Plugin_manager::all_symbols_read): Add task parameter. Change
11183 (Plugin_manager::get_input_file): New function.
11184 (Plugin_manager::release_input_file): New function.
11185 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11186 corresponding data member.
11187 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11188 and pass to base constructor. Change all callers.
11189 (get_input_file, release_input_file): New functions.
11190 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11191 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11192 (Plugin_manager::all_symbols_read): Add task parameter.
11193 (Plugin_manager::get_input_file): New function.
11194 (Plugin_manager::release_input_file): New function.
11195 (Plugin_manager::task_): New data member.
11196 (Pluginobj::Pluginobj): Add filesize parameter.
11197 (Pluginobj::filename): New function.
11198 (Pluginobj::descriptor): New function.
11199 (Pluginobj::filesize): New function.
11200 (Pluginobj::filesize_): New data member.
11201 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11202 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11203 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11205 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11206 with archive libraries.
11207 * testsuite/Makefile.in: Regenerate.
11208 * testsuite/plugin_test.c (struct sym_info): New type.
11209 (get_input_file, release_input_file): New static variables.
11210 (onload): Capture new transfer vector entries.
11211 (claim_file_hook): Stop reading at end of file according to filesize.
11212 Factor out parsing of readelf output into separate function.
11213 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11214 APIs and get the source file name from the symbol table. Convert
11215 source file name to corresponding object file name. Print info
11216 message when adding new input files.
11217 (parse_readelf_line): New function.
11218 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11219 * testsuite/plugin_test_2.sh: Likewise.
11220 * testsuite/plugin_test_3.sh: Likewise.
11221 * testsuite/plugin_test_4.sh: New test case.
11223 2009-01-07 Ian Lance Taylor <iant@google.com>
11225 * version.cc (version_string): Bump to 1.8.
11227 2008-12-23 Cary Coutant <ccoutant@google.com>
11229 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11230 * plugin.cc (Plugin_manager::finish): Rename as
11231 layout_deferred_objects. Move cleanup to separate function.
11232 (Plugin_manager::cleanup): New function.
11233 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11235 * plugin.h (Plugin_manager::finish): Rename as
11236 layout_deferred_objects.
11237 (Plugin_manager::cleanup): New function.
11238 (Plugin_manager::cleanup_done): New field.
11240 2008-12-23 Cary Coutant <ccoutant@google.com>
11242 * plugin.cc (is_visible_from_outside): New function.
11243 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11244 so we don't return "IR only" status for exported symbols or -r links.
11246 * testsuite/Makefile.am (plugin_test_3): New test case.
11247 * testsuite/Makefile.in: Regenerate.
11248 * testsuite/plugin_test_3.sh: New file.
11250 2008-12-22 Cary Coutant <ccoutant@google.com>
11252 * object.cc (Sized_relobj::layout_section): New function.
11253 (Sized_relobj::do_layout): Defer layout of input sections until after
11254 plugin has provided replacement files.
11255 (Sized_relobj::do_layout_deferred_sections): New function.
11256 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11257 (Relobj::layout_deferred_sections): New function.
11258 (Relobj::do_layout_deferred_sections): New function.
11259 (Sized_relobj::do_layout_deferred_sections): New function.
11260 (Sized_relobj::layout_section): New function.
11261 (Sized_relobj::Deferred_layout): New structure.
11262 (Sized_relobj::deferred_layout_): New field.
11263 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11264 Change all callers. Layout deferred sections.
11265 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11267 (Plugin_hook::run): Move code from do_plugin_hook inline.
11268 (Plugin_hook::do_plugin_hook): Remove.
11269 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11270 (Plugin_manager::finish): Renamed, was cleanup.
11271 (Plugin_manager::should_defer_layout): New function.
11272 (Plugin_manager::add_deferred_layout_object): New function.
11273 (Plugin_manager::Deferred_layout_list): New type.
11274 (Plugin_manager::deferred_layout_objects_): New field.
11275 (Plugin_hook::do_plugin_hook): Remove.
11277 2008-12-17 Ian Lance Taylor <iant@google.com>
11279 * options.h (class General_options): Add --no case for
11282 2008-12-16 Cary Coutant <ccoutant@google.com>
11284 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11286 (Plugin_manager::claim_file): Create plugin object even if
11287 plugin did not call the add_symbols callback.
11288 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11289 asking for more symbols than were added.
11290 * testsuite/Makefile.am (plugin_test_1): Add test case with
11292 (empty.syms): New target.
11293 * testsuite/Makefile.in: Regenerate.
11294 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11295 message. Don't call add_symbols if no globals.
11296 (all_symbols_read_hook): Don't provide replacement for empty
11299 2008-12-12 Ian Lance Taylor <iant@google.com>
11301 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11302 r_type == 0 for a local symbol with r_sym == 0.
11303 (scan_relocatable_relocs): Pass r_sym to
11304 local_non_section_strategy.
11305 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11308 * configure.ac: Update test for TLS descriptors: they are
11309 supported as of glibc 2.9.
11310 * configure: Rebuild.
11312 2008-12-11 Ian Lance Taylor <iant@google.com>
11315 * target-reloc.h (Default_scan_relocatable_relocs): For each
11316 function, map r_type == 0 to RELOC_DISCARD.
11318 2008-12-10 Cary Coutant <ccoutant@google.com>
11320 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11321 object to override a kept COMDAT group from a plugin object.
11323 2008-12-09 Ian Lance Taylor <iant@google.com>
11326 * yyscript.y (file_cmd): Handle INPUT.
11328 * testsuite/initpri1.c: Change all declarations to be full
11329 prototypes by adding void, to avoid compiler warnings.
11331 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11333 * options.cc (General_options::parse_plugin_opt): New.
11334 (General_options::add_plugin): The argument now is just the filename.
11335 (General_options::add_plugin_option): New.
11336 * options.h (plugin_opt): New.
11337 (add_plugin): Change argument name.
11338 (add_plugin_option): New.
11339 * plugin.cc (Plugin::load): Don't parse the plugin option.
11340 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11341 (Plugin::add_option): New.
11342 (Plugin::args_): Change type.
11343 (Plugin::filename_): New.
11344 (Plugin_manager::add_plugin_option): New.
11345 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11346 * testsuite/Makefile.in: Regenerate.
11348 2008-12-05 Cary Coutant <ccoutant@google.com>
11350 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11351 Handle --strip-lto-sections option.
11352 * options.h (strip_lto_sections): New option.
11354 2008-12-01 Cary Coutant <ccoutant@google.com>
11356 * plugin.cc (ld_plugin_message): Change format parameter to const.
11357 Fix mismatch between new[] and delete.
11359 2008-11-14 Cary Coutant <ccoutant@google.com>
11361 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11364 2008-11-05 Craig Silverstein <csilvers@google.com>
11366 * options.cc (General_options::parse_dynamic_list): New function.
11367 * options.h (General_options): New flags dynamic_list,
11368 dynamic_list_data, dynamic_list_cpp_new, and
11369 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11370 (General_options::in_dynamic_list): New function.
11371 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11372 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11373 (Lex::can_continue_name): Likewise.
11375 (read_script_file): New parameter script_options.
11376 (read_dynamic_list): New function.
11377 (Script_options::define_dynamic_list): New function.
11378 (dynamic_list_keyword_parsecodes): New variable.
11379 (dynamic_list_keywords): New variable.
11380 * script.h (Script_options::define_dynamic_list): New function
11382 (read_dynamic_list): New function prototype.
11383 * symtab.cc (strprefix): New macro.
11384 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11385 dynamic_list_data, dynamic_list_cpp_new, and
11386 dynamic_list_cpp_typeinfo.
11387 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11388 (dynamic_list_expr): New rule.
11389 (dynamic_list_nodes): Likewise.
11390 (dynamic_list_node): Likewise.
11391 * testsuite/Makefile.am (dynamic_list): New test.
11392 * testsuite/Makefile.in: Regenerated.
11393 * testsuite/dynamic_list.t: New file.
11394 * testsuite/dynamic_list.sh: New file.
11396 2008-11-05 Craig Silverstein <csilvers@google.com>
11398 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11399 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11400 (t11_last): Likewise.
11401 * testsuite/ver_test_6.c (main): Likewise.
11403 2008-10-07 Cary Coutant <ccoutant@google.com>
11405 * options.c (General_options::finalize): Add check for -static and
11407 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11410 2008-10-02 Cary Coutant <ccoutant@google.com>
11412 * plugin.cc (make_sized_plugin_object): Fix conditional
11413 compilation to work when not all targets are enabled.
11415 2008-09-29 Cary Coutant <ccoutant@google.com>
11417 * archive.cc (Archive::get_file_and_offset): Use filename instead
11418 of name to get library path.
11419 (Archive::include_member): Unlock external member of a thin archive.
11421 * testsuite/Makefile.am (TEST_AR): New variable.
11422 (thin_archive_test_1): New test.
11423 (thin_archive_test_2): New test.
11424 * testsuite/Makefile.in: Regenerate.
11425 * testsuite/thin_archive_main.cc: New file.
11426 * testsuite/thin_archive_test_1.cc: New file.
11427 * testsuite/thin_archive_test_2.cc: New file.
11428 * testsuite/thin_archive_test_3.cc: New file.
11429 * testsuite/thin_archive_test_4.cc: New file.
11431 2008-09-29 Cary Coutant <ccoutant@google.com>
11433 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11434 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11436 (Sized_relobj::do_finalize_local_symbols): Likewise.
11437 (Sized_relobj::map_to_kept_section): Likewise.
11438 * object.h (Sized_relobj::invalid_address): New constant.
11439 (Sized_relobj::do_output_section_offset): Check for invalid_address
11441 * output.cc (Output_reloc::local_section_offset): Use constant
11442 invalid_address instead of -1U.
11443 (Output_reloc::get_address): Likewise.
11444 (Output_section::output_address): Change -1U to -1ULL.
11445 * output.h (Output_reloc::invalid_address): New constant.
11446 * reloc.cc (Sized_relobj::write_sections): Use constant
11447 invalid_address instead of -1U.
11448 (Sized_relobj::relocate_sections): Likewise.
11449 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11450 values for merge sections.
11451 * target-reloc.h (relocate_for_relocatable): Use constant
11452 invalid_address instead of -1U.
11454 2008-09-19 Cary Coutant <ccoutant@google.com>
11456 Add plugin functionality for link-time optimization (LTO).
11457 * configure.ac (plugins): Add --enable-plugins option.
11458 * configure: Regenerate.
11459 * config.in: Regenerate.
11460 * Makefile.am (LIBDL): New variable.
11461 (CCFILES): Add plugin.cc.
11462 (HFILES): Add plugin.h.
11463 (ldadd_var): Add LIBDL.
11464 * Makefile.in: Regenerate.
11466 * archive.cc: Include "plugin.h".
11467 (Archive::setup): Don't preread archive symbols when using a plugin.
11468 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11469 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11471 (Archive::include_member): Add symbols from plugin objects.
11472 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11473 * descriptors.cc (Descriptors::open): Check for file descriptors
11474 abandoned by plugins.
11475 (Descriptors::claim_for_plugin): New function.
11476 * descriptors.h (Descriptors::claim_for_plugin): New function.
11477 (Open_descriptor::is_claimed): New field.
11478 (claim_descriptor_for_plugin): New function.
11479 * fileread.cc (File_read::claim_for_plugin): New function.
11480 * fileread.h (File_read::claim_for_plugin): New function.
11481 (File_read::descriptor): New function.
11482 * gold.cc: Include "plugin.h".
11483 (queue_initial_tasks): Add task to call plugin hooks for generating
11485 * main.cc: Include "plugin.h".
11486 (main): Load plugin libraries.
11487 * object.h (Pluginobj): Declare.
11488 (Object::pluginobj): New function.
11489 (Object::do_pluginobj): New function.
11490 (Object::set_target): New function.
11491 * options.cc: Include "plugin.h".
11492 (General_options::parse_plugin): New function.
11493 (General_options::General_options): Initialize plugins_ field.
11494 (General_options::add_plugin): New function.
11495 * options.h (Plugin_manager): Declare.
11496 (General_options): Add --plugin option.
11497 (General_options::has_plugins): New function.
11498 (General_options::plugins): New function.
11499 (General_options::add_plugin): New function.
11500 (General_options::plugins_): New field.
11501 * plugin.cc: New file.
11502 * plugin.h: New file.
11503 * readsyms.cc: Include "plugin.h".
11504 (Read_symbols::do_read_symbols): Check for archive before checking
11505 for ELF file. Call plugin hooks to claim files.
11506 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11507 from a real object file; force override when processing replacement
11509 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11510 (Symbol::init_base_object): Likewise.
11511 (Symbol::init_base_output_data): Likewise.
11512 (Symbol::init_base_output_segment): Likewise.
11513 (Symbol::init_base_constant): Likewise.
11514 (Symbol::init_base_undefined): Likewise.
11515 (Symbol::output_section): Assert that object is not a plugin.
11516 (Symbol_table::add_from_pluginobj): New function.
11517 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11519 (Symbol_table::sized_write_globals): Likewise.
11520 (Symbol_table::add_from_pluginobj): Instantiate template.
11521 * symtab.h (Sized_pluginobj): Declare.
11522 (Symbol::in_real_elf): New function.
11523 (Symbol::set_in_real_elf): New function.
11524 (Symbol::in_real_elf_): New field.
11525 (Symbol_table::add_from_pluginobj): New function.
11527 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11528 (LIBDL): New variable.
11529 (LDADD): Add LIBDL.
11530 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11531 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11532 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11533 (MOSTLYCLEANFILES): Likewise.
11534 * testsuite/Makefile.in: Regenerate.
11535 * testsuite/plugin_test.c: New file.
11536 * testsuite/plugin_test_1.sh: New file.
11537 * testsuite/plugin_test_2.sh: New file.
11539 2008-09-16 Ian Lance Taylor <iant@google.com>
11541 * target-reloc.h (relocate_section): Check whether a symbol is
11542 defined by the ABI before reporting an undefined symbol error.
11543 * target.h (Target::is_defined_by_abi): Make parameter const.
11544 (Target::do_is_defined_by_abi): Likewise.
11545 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11546 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11547 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11548 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11549 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11550 * testsuite/Makefile.in: Rebuild.
11552 * fileread.cc (make_view): Add casts to avoid warning.
11554 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11556 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11557 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11559 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11561 * options.h (General_options::output_is_executable): New.
11562 (General_options::output_is_pie): New.
11563 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11564 for shared libraries.
11565 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11567 2008-09-11 Chris Demetriou <cgd@google.com>
11569 * options.h (origin): New -z option.
11570 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11571 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11574 2008-09-05 Cary Coutant <ccoutant@google.com>
11576 * fileread.cc (File_read::make_view): Add check for attempt to map
11577 beyond end of file.
11579 2008-09-05 Cary Coutant <ccoutant@google.com>
11581 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11582 explicit instantiations.
11584 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11587 * options.cc (General_options::finalize): Allow undefined symbols
11588 in shlibs if linking -shared.
11591 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11592 symbols as not needing a dynsym entry.
11594 2008-08-20 Craig Silverstein <csilvers@google.com>
11596 * fileread.cc (File_read::open): Do not lock the file unless it
11597 was successfully opened.
11599 2008-08-14 Cary Coutant <ccoutant@google.com>
11601 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11602 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11603 * testsuite/tls_test.cc (struct int128): 128-bit struct
11604 for testing TLS relocs with non-zero addend.
11605 (v12): New TLS variable.
11607 (t_last): Add check for v12.
11608 * testsuite/tls_test.h (t12): New function.
11609 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11611 2008-08-13 Ian Lance Taylor <iant@google.com>
11613 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11614 set tls_segment_ or relro_segment_.
11615 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11617 * output.h (Output_section::clear_is_relro): New function.
11618 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11619 sections specially even when output_data_ is empty.
11620 (Output_segment::maximum_alignment): When first section is relro,
11621 only force alignment for PT_LOAD segments.
11622 * script.cc (script_data_segment_align): New function.
11623 (script_data_segment_relro_end): New function.
11624 * script-c.h (script_data_segment_align): Declare.
11625 (script_data_segment_relro_end): Declare.
11626 * script-sections.h (class Script_sections): Declare
11627 data_segment_align and data_segment_relro_end. Add fields
11628 segment_align_index_ and saw_relro_end_.
11629 * script-sections.cc (class Sections_element): Add set_is_relro
11630 virtual function. Add new bool* parameter to place_orphan_here.
11631 Add get_output_section virtual function.
11632 (class Output_section_definition): Add set_is_relro. Add new
11633 bool* parameter to place_orphan_here. Add get_output_section.
11634 Add is_relro_ field.
11635 (Output_section_definition::Output_section_definition): Initialize
11636 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11637 and is_relro_ fields.
11638 (Output_section_definition::place_orphan_here): Add is_relro
11640 (Output_section_definition::set_section_addresses): Set relro for
11642 (Output_section_definition::alternate_constraint): Likewise.
11643 (class Orphan_output_section): Add new bool* parameter to
11644 place_orphan_here. Add get_output_section.
11645 (Orphan_output_section::place_orphan_here): Add is_relro
11647 (Script_sections::Script_sections): Initialize
11648 data_segment_align_index_ and saw_relro_end_.
11649 (Script_sections::data_segment_align): New function.
11650 (Script_sections::data_segment_relro_end): New function.
11651 (Script_sections::place_orphan): Set or clear is_relro.
11652 (Script_sections::set_section_addresses): Force alignment of first
11654 * yyscript.y (exp): Call script_data_segment_align and
11655 script_data_segment_relro_end.
11656 * testsuite/relro_script_test.t: New file.
11657 * testsuite/relro_test.cc (using_script): Declare.
11658 (t1, t2): Test using_script.
11659 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11660 (relro_script_test_SOURCES): Define.
11661 (relro_script_test_DEPENDENCIES): Define.
11662 (relro_script_test_LDFLAGS): Define.
11663 (relro_script_test_LDADD): Define.
11664 (relro_script_test.so): New target.
11665 * testsuite/Makefile.in: Rebuild.
11667 2008-08-06 Cary Coutant <ccoutant@google.com>
11669 * archive.cc (Archive::total_archives, Archive::total_members)
11670 (Archive::total_members_loaded): New variables.
11671 (Archive::setup): Add parameter. Add option to preread
11673 (Archive::read_armap): Add counter.
11674 (Archive::get_file_and_offset): New function.
11675 (Archive::get_elf_object_for_member): New function.
11676 (Archive::read_all_symbols): New function.
11677 (Archive::read_symbols): New function.
11678 (Archive::add_symbols): Add counters.
11679 (Archive::include_all_members): Use armap to find members if it's
11681 (Archive::include_member): Skip reading symbols if already read.
11682 Factored code into Archive::get_file_and_offset and
11683 Archive::get_elf_object_for_member. Changed call to
11684 Mapfile::report_include_archive_member.
11685 (Archive::print_stats): New function.
11686 * archive.h: Declare Object and Read_symbols_data classes.
11687 (Archive::Archive): Add initializers for new members.
11688 (Archive::setup): Add parameter.
11689 (Archive::print_stats): New function.
11690 (Archive::total_archives, Archive::total_members)
11691 (Archive::total_members_loaded): New variables.
11692 (Archive::get_file_and_offset): New function.
11693 (Archive::get_elf_object_for_member): New function.
11694 (Archive::read_all_symbols): New function.
11695 (Archive::read_symbols): New function.
11696 (Archive::Archive_member): New class.
11697 (Archive::members_): New member.
11698 (Archive::num_members_): New member.
11699 * main.cc: Include archive.h.
11700 (main): Call Archive::print_stats.
11701 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11702 archive parameter; member_name is now the fully-decorated name.
11703 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11704 * options.h: (General_options): Add --preread-archive-symbols option.
11705 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11708 2008-08-04 Ian Lance Taylor <iant@google.com>
11710 * symtab.h (Symbol::use_plt_offset): New function.
11711 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11712 * powerpc.cc (Relocate::relocate): Likewise.
11713 * sparc.cc (Relocate::relocate): Likewise.
11714 * x86_64.cc (Relocate::relocate): Likewise.
11715 * testsuite/weak_plt.sh: New test.
11716 * testsuite/weak_plt_main.cc: New test.
11717 * testsuite/weak_plt_shared.cc: New test.
11718 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11719 (check_PROGRAMS): Add weak_plt.
11720 (check_DATA): Add weak_plt_shared.so.
11721 (weak_plt_main_pic.o, weak_plt): New targets.
11722 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11723 * testsuite/Makefile.in: Rebuild.
11725 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11727 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11728 * testsuite/Makefile.in: Rebuild.
11730 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11732 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11733 * Makefile.in: Regenerate.
11734 * po/POTFILES.in: Regenerate.
11736 2008-07-29 Ian Lance Taylor <iant@google.com>
11738 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11739 symbols before other symbols.
11740 * testsuite/script_test_2.cc (test_addr): Declare.
11741 (test_addr_alias): Declare.
11742 (main): Check that test_addr and test_addr_alias have the right
11744 * testsuite/script_test_2.t: Define test_addr_alias and
11747 2008-07-24 Ian Lance Taylor <iant@google.com>
11750 * descriptors.cc: New file.
11751 * descriptors.h: New file.
11752 * gold-threads.h (class Hold_optional_lock): New class.
11753 * fileread.cc: Include "descriptors.h".
11754 (File_read::~File_read): Release descriptor rather than closing
11756 (File_read::open) [file]: Call open_descriptor rather than open.
11757 Set is_descriptor_opened_.
11758 (File_read::open) [memory]: Assert that descriptor is not open.
11759 (File_read::reopen_descriptor): New function.
11760 (File_read::release): Release descriptor.
11761 (File_read::do_read): Make non-const. Reopen descriptor.
11762 (File_read::read): Make non-const.
11763 (File_read::make_view): Reopen descriptor.
11764 (File_read::do_readv): Likewise.
11765 * fileread.h (class File_read): Add is_descriptor_opened_ field.
11766 Update declarations.
11767 * layout.cc: Include "descriptors.h".
11768 (Layout::create_build_id): Use open_descriptor rather than open.
11769 * output.cc: Include "descriptors.h".
11770 (Output_file::open): Use open_descriptor rather than open.
11771 * archive.cc (Archive::const_iterator): Change Archive to be
11773 (Archive::begin, Archive::end): Make non-const.
11774 (Archive::count_members): Likewise.
11775 * archive.h (class Archive): Update declarations.
11776 * object.h (Object::read): Make non-const.
11777 * Makefile.am (CCFILES): Add descriptors.cc.
11778 (HFILES): Add descriptors.h.
11779 * Makefile.in: Rebuild.
11782 * gold.h: Always include <clocale>. Add Solaris workarounds
11783 following code in binutils/sysdep.h.
11786 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11787 this->eh_frame_hdr_ is NULL before using it.
11789 * dynobj.cc (Versions::Versions): Update comment.
11791 * dynobj.cc (Versions::Versions): If there is an soname, use it as
11792 the base version name.
11794 * stringpool.cc (Stringpool_template::add_with_length): Set key to
11795 array size plus one.
11796 (Stringpool_template::set_string_offsets): Subtract one from key
11797 before using it as an array index.
11798 (Stringpool_template::get_offset_with_length): Likewise.
11799 (Stringpool_template::write_to_buffer): Likewise.
11800 * stringpool.h (Stringpool_template::get_offset_from_key):
11803 2008-07-23 Ian Lance Taylor <iant@google.com>
11806 * object.h (Merged_symbol_value::value): Do our best to handle a
11810 * script.cc (Version_script_info::get_versions): Don't add empty
11811 version tag to return value.
11812 (Version_script_info::get_symbol_version_helper): Change return
11813 type to bool. Add pversion parameter. Change all callers.
11814 (script_register_vers_node): Don't require a non-NULL tag.
11815 * script.h (class Version_script_info): Update declarations.
11816 (Version_script_info::get_symbol_version): Change return type to
11817 bool. Add version parameter. Change all callers.
11818 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11819 handling. Handle an empty version from a version script.
11820 (Symbol_table::define_special_symbol): Likewise.
11821 * testsuite/ver_test_10.script: New file.
11822 * testsuite/ver_test_10.sh: New file.
11823 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11824 (check_DATA): Add ver_test_10.syms.
11825 (ver_test_10.syms, ver_test_10.so): New target.
11826 * testsuite/Makefile.in: Rebuild.
11828 2008-07-23 Simon Baldwin <simonb@google.com>
11830 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11831 to zero for undefined symbols from dynamic libraries.
11833 2008-07-23 Ian Lance Taylor <iant@google.com>
11835 * symtab.cc (Symbol_table::resolve): Remove version parameter.
11836 Change all callers.
11837 * symtab.h (class Symbol_table): Update declaration.
11838 * testsuite/ver_test_9.cc: New file.
11839 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11840 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11841 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11842 (ver_test_9.so, ver_test_9.o): New targets.
11843 * testsuite/Makefile.in: Rebuild.
11845 2008-07-22 Ian Lance Taylor <iant@google.com>
11847 * options.h (class General_options): Define --check-sections.
11848 * layout.cc (Layout::set_segment_offsets): Handle
11851 * options.h (class General_options): Define -n/--nmagic and
11853 * options.cc (General_options::finalize): For -n/--nmagic or
11854 -N/--omagic, set -static.
11855 * layout.cc (Layout::attach_allocated_section_to_segment): If
11856 -N/--omagic, don't put read-only and read-write sections in
11857 different segments.
11858 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11859 finding a read-only segment.
11860 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11861 don't set the minimum segment alignment to the common page size,
11862 and don't set the file offset to the address modulo the page size.
11863 * script-sections.cc (Script_sections::create_segments): If
11864 -n/--omagic, don't put read-only and read-write sections in
11865 different segments.
11867 * cref.cc: New file.
11868 * cref.h: New file.
11869 * options.h (class General_options): Add --print-symbol-counts.
11870 * main.cc (main): Issue defined symbol report if requested.
11871 * archive.cc (Archive::interpret_header): Make into a const member
11873 (Archive::add_symbols): Call Input_objects::archive_start and
11875 (Archive::const_iterator): Define new class.
11876 (Archive::begin, Archive::end): New functions.
11877 (Archive::include_all_members): Rewrite to use iterator.
11878 (Archive::count_members): New function.
11879 * archive.h (class Archive): Update declarations.
11880 (Archive::filename): New function.
11881 * object.cc: Include "cref.h".
11882 (Sized_relobj::Sized_relobj): Initialize defined_count_.
11883 (Sized_relobj::do_get_global_symbol_counts): New function.
11884 (Input_objects::add_object): Add object to cross-referencer.
11885 (Input_objects::archive_start): New function.
11886 (Input_objects::archive_stop): New function.
11887 (Input_objects::print_symbol_counts): New function.
11888 * object.h: Declare Cref and Archive.
11889 (Object::get_global_symbol_counts): New function.
11890 (Object::do_get_global_symbol_counts): New pure virtual function.
11891 (class Sized_relobj): Add defined_count_ field. Update
11893 (class Input_objects): Add cref_ field. Update constructor.
11894 Update declarations.
11895 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11897 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11899 (Sized_dynobj::do_get_global_symbol_counts): New function.
11900 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11901 defined_count_. Update declarations. Define Symbols typedef.
11902 * symtab.cc (Symbol_table::add_from_relobj): Add defined
11903 parameter. Change all callers.
11904 (Symbol_table::add_from_dynobj): Add sympointers and defined
11905 parameters. Change all callers.
11906 * symtab.h (class Symbol_table): Update declarations.
11907 * Makefile.am (CCFILES): Add cref.cc.
11908 (HFILES): Add cref.h.
11909 * Makefile.in: Rebuild.
11911 2008-07-22 Simon Baldwin <simonb@google.com>
11913 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11914 to zero when writing undefined symbols.
11916 2008-07-22 Ian Lance Taylor <iant@google.com>
11918 * output.cc (Output_section::add_input_section): Don't try to
11919 merge empty merge sections.
11921 2008-07-21 Craig Silverstein <csilvers@google.com>
11923 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11924 Include symbol version in error message.
11926 2008-07-20 Chris Demetriou <cgd@google.com>
11928 * configure.ac (gold_cv_c_random_seed): New configured variable.
11929 (RANDOM_SEED_CFLAGS): New substituted variable.
11930 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11931 * configure: Rebuild.
11932 * Makefile.in: Likewise.
11933 * testsuite/Makefile.in: Likewise.
11935 2008-07-18 Ian Lance Taylor <iant@google.com>
11937 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11938 where we see NAME/NULL and NAME/VERSION as separate symbols.
11939 * testsuite/ver_test_main.cc (main): Call t4.
11940 (t4, t4_2a): Define.
11941 * testsuite/ver_test_2.cc (t4_2): Define.
11942 * testsuite/ver_test_2.script: Put t4_2a in VER2.
11943 * testsuite/ver_test_4.cc (t4_2a): Define.
11944 * testsuite/ver_test_4.script: Put t4_2a in VER2.
11945 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11947 2008-07-17 Ian Lance Taylor <iant@google.com>
11949 * dynobj.cc (Versions::add_def): If we give an error about a
11950 missing version, go ahead and create the version anyhow.
11952 2008-07-10 Ian Lance Taylor <iant@google.com>
11954 Handle output sections with more than 0x7fffffff bytes.
11955 * object.h (class Relobj): Change map_to_output_ to
11956 output_sections_, and just keep a section pointer. Change all
11957 uses. Move comdat group support to Sized_relobj.
11958 (Relobj::is_section_specially_mapped): Remove.
11959 (Relobj::output_section): Remove poff parameter. Change all
11961 (Relobj::output_section_offset): New function.
11962 (Relobj::set_section_offset): Rewrite.
11963 (Relobj::map_to_output): Remove.
11964 (Relobj::output_sections): New function.
11965 (Relobj::do_output_section_offset): New pure virtual function.
11966 (Relobj::do_set_section_offset): Likewise.
11967 (class Sized_relobj): Add section_offsets_ field. Add comdat
11968 group support from Relobj. Update declarations.
11969 (Sized_relobj::get_output_section_offset): New function.
11970 (Sized_relobj::do_output_section_offset): New function.
11971 (Sized_relobj::do_set_section_offset): New function.
11972 * object.cc (Relobj::output_section_address): Remove.
11973 (Sized_relobj::Sized_relobj): Initialize new fields.
11974 (Sized_relobj::include_section_group): Cast find_kept_object to
11976 (Sized_relobj::include_linkonce_section): Likewise.
11977 (Sized_relobj::do_layout): Use separate arrays for output section
11979 (Sized_relobj::do_count_local_symbols): Change map_to_output to
11981 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11982 output_sections and section_offsets.
11983 (Sized_relobj::write_local_symbols): Likewise.
11984 (map_to_kept_section): Compute output address directly.
11985 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11986 output_sections and section_offsets.
11987 (Sized_relobj::write_sections): Likewise.
11988 (Sized_relobj::relocate_sections): Likewise.
11989 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11990 * output.h (class Output_reloc): Update declarations. Change
11991 u2_.relobj to Sized_relobj*.
11992 (class Output_data_reloc): Change add functions to use
11994 * output.cc (Output_reloc::Output_reloc): Change relobj to
11996 (Output_reloc::local_section_offset): Change return type to
11997 Elf_Addr. Use get_output_section_offset.
11998 (Output_reloc::get_address): Likewise.
11999 (Output_section::is_input_address_mapped): Don't call
12000 is_section_specially_mapped.
12001 (Output_section::output_offset): Likewise.
12002 (Output_section::output_address): Likewise.
12003 (Output_section::starting_output_address): Likewise.
12004 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12005 parameter to Sized_relobj*.
12006 (Copy_relocs::need_copy_reloc): Likewise.
12007 (Copy_relocs::save): Likewise.
12008 * copy-relocs.h (class Copy_relocs): Update declarations.
12009 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12010 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12011 * target-reloc.h (relocate_for_relocatable): Change
12012 offset_in_output_section type to Elf_Addr. Change code that uses
12014 * layout.cc (Layout::layout): Always set *off.
12015 * mapfile.cc (Mapfile::print_input_section): Use
12016 output_section_offset.
12017 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12019 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12020 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12021 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12023 2008-07-03 Ian Lance Taylor <iant@google.com>
12025 * layout.cc (Layout::include_section): Do not discard unrecognized
12026 SHT_STRTAB sections.
12028 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12030 * script.cc (Lex::can_continue_name): Make '?' allowable in
12031 version-script names.
12032 * testsuite/version_script.map: Change glob pattern to use '?'
12034 2008-06-30 Manish Singh <yosh@gimp.org>
12037 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12040 2008-06-30 Ian Lance Taylor <iant@google.com>
12044 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12045 versions]: Don't try to read the value in the contents, since we
12046 don't use it. Use the template endianness when writing.
12048 2008-06-25 Cary Coutant <ccoutant@google.com>
12050 * fileread.cc (File_read::make_view): Assert on zero-length view.
12051 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12052 symbol table when there are no symbols to read.
12054 2008-06-23 Craig Silverstein <csilvers@google.com>
12056 * version.cc (version_string): Bump to 1.7
12058 2008-06-18 Craig Silverstein <csilvers@google.com>
12060 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12061 constant 0xFFFF to type Valtype.
12062 (Powerpc_relocate_functions::rel16_ha): Likewise.
12064 2008-06-17 Ian Lance Taylor <iant@google.com>
12066 * output.h (Output_section::Input_section): Initialize p2align_ to
12067 zero for Output_section_data constructors.
12068 (Output_section::Input_section::addralign): If not an input
12069 section, return the alignment of the Output_section_data.
12070 * testsuite/copy_test.cc: New file.
12071 * testsuite/copy_test_1.cc: New file.
12072 * testsuite/copy_test_2.cc: New file.
12073 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12074 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12075 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12076 (copy_test_1_pic.o, copy_test_1.so): New targets.
12077 (copy_test_2_pic.o, copy_test_2.so): New targets.
12078 * testsuite/Makefile.in: Rebuild.
12080 * script-sections.cc (Script_sections::place_orphan): Initialize
12081 local variable exact.
12083 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12085 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12087 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12088 David S. Miller <davem@davemloft.net>
12090 * powerpc.cc: New file.
12091 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12092 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12093 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12094 * Makefile.in: Rebuild.
12096 2008-06-09 Ian Lance Taylor <iant@google.com>
12098 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12100 (throwing, orig_terminate): New static variables.
12101 (terminate_handler): New static function.
12102 (t2): Set terminate handler.
12104 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12107 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12110 2008-05-30 Cary Coutant <ccoutant@google.com>
12112 * archive.cc (Archive::include_all_members) Correct to step
12113 over symbol table and extended name table in thin archives.
12115 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12118 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12121 2008-05-28 Caleb Howe <cshowe@google.com>
12123 * reduced_debug_output.cc: New file.
12124 * reduced_debug_output.h: New file.
12125 * options.h (class General_options): Add --strip-debug-non-line.
12126 * options.cc (General_options::finalize): Add strip_debug_non_line
12127 to the strip heirarchy.
12128 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12130 * layout.cc: Include "reduced_debug_output.h".
12131 (Layout::Layout): Initialize new fields.
12132 (line_only_debug_sections): New static array.
12133 (is_lines_only_debug_sections): New static inline function.
12134 (Layout::include_section): Handle --strip-debug-non-line.
12135 (Layout::make_output_section): If --strip-debug-non-line, build
12136 new output sections for .debug_abbrev and .debug_info.
12137 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12138 gold. Warn about possible overflow.
12139 (read_signed_LEB_128): Likewise.
12140 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12141 (read_signed_LEB_128): Declare.
12142 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12143 (HFILES): Add reduced_debug_output.h.
12144 * Makefile.in: Rebuild.
12146 2008-05-21 Ian Lance Taylor <iant@google.com>
12148 * mapfile.cc: New file.
12149 * mapfile.h: New file.
12150 * options.h (class General_options): Add -M/--print-map and -Map.
12151 * options.cc (General_options::finalize): Make -M equivalent to
12153 * main.cc: Include <cstdio> and "mapfile.h".
12154 (main): Open mapfile if requested.
12155 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12156 constructor. Change caller.
12157 (queue_initial_tasks): Add mapfile parameter. Change caller.
12158 (queue_middle_tasks): Likewise.
12159 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12161 * archive.cc: Include "mapfile.h".
12162 (Archive::add_symbols): Add mapfile parameter. Change all
12163 callers. Pass mapfile, symbol, and reason to include_member.
12164 (Archive::include_all_members): Add mapfile parameter. Change all
12166 (Archive::include_member): Add mapfile, sym, and why parameters.
12167 Change all callers. Report inclusion to map file.
12168 * archive.h: Include "fileread.h".
12169 (class Archive): Update declarations.
12170 (Archive::file): New const method.
12171 (class Add_archive_symbols): Add mapfile_ field. Update
12172 constructor. Change all callers.
12173 * readsyms.h (class Read_symbols): Likewise.
12174 (class Finish_group): Likewise.
12175 (class Read_script): Likewise.
12176 * common.cc: Include "mapfile.h".
12177 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12179 (Symbol_table::do_allocate_commons): Likewise.
12180 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12181 symbol allocation to mapfile.
12182 * common.h (class Allocate_commons_task): Add mapfile_ field.
12183 Update constructor. Change all callers.
12184 * symtab.h (class Symbol_table): Update declarations.
12185 * layout.cc: Include "mapfile.h".
12186 (Layout_task_runner::run): Print information to mapfile.
12187 (Layout::create_gold_note): Change Output_data_fixed_space to
12188 Output_data_zero_fill.
12189 (Layout::create_build_id): Likewise.
12190 (Layout::print_to_mapfile): New function.
12191 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12192 constructor. Change caller.
12193 (class Layout): Declare print_to_mapfile.
12194 * output.cc (Output_section::Input_section::print_to_mapfile): New
12196 (Output_section::add_input_section): If producing a map, always
12197 add to input_sections_ list.
12198 (Output_section::do_print_to_mapfile): New function.
12199 (Output_segment::print_sections_to_mapfile): New function.
12200 (Output_segment::print_section_list_to_mapfile): New function.
12201 * output.h: Include "mapfile.h".
12202 (Output_data::print_to_mapfile): New function.
12203 (Output_data::do_print_to_mapfile): New virtual function.
12204 (Output_segment_headers::do_print_to_mapfile): New function.
12205 (Output_file_header::do_print_to_mapfile): New function.
12206 (Output_data_const::do_print_to_mapfile): New function.
12207 (class Output_data_const_buffer): Add map_name_ field. Update
12208 constructor. Change all callers. Add do_print_to_mapfile
12210 (class Output_data_fixed_space): Likewise.
12211 (class Output_data_space): Likewise.
12212 (class Output_data_zero_fill): New class.
12213 (Output_data_strtab::do_print_to_mapfile): New function.
12214 (Output_data_reloc_base::do_print_to_mapfile): New function.
12215 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12216 (Output_data_group::do_print_to_mapfile): New function.
12217 (Output_data_got::do_print_to_mapfile): New function.
12218 (Output_data_dynamic::do_print_to_mapfile): New function.
12219 (Output_symtab_xindex::do_print_to_mapfile): New function.
12220 (class Output_section): Declare do_print_to_mapflie. Declare
12221 print_to_mapfile in Input_section.
12222 (class Output_segment): Declare new functions.
12223 * object.h (Sized_relobj::symbol_count): New function.
12224 * script-sections.cc
12225 (Output_section_element_dot_assignment::set_section_addresses):
12226 Change Output_data_fixed_space to Output_data_zero_fill.
12227 (Output_data_expression::do_print_to_mapfile): New function.
12228 * script.cc (read_input_script): Add mapfile parameter. Change
12230 * script.h (read_input_script): Update declaration.
12231 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12232 (Eh_frame::do_print_to_mapfile): New function.
12233 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12234 (Output_merge_string::do_print_to_mapfile): New function.
12235 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12237 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12239 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12241 * Makefile.am (CCFILES): Add mapfile.cc.
12242 (HFILES): Add mapfile.h.
12243 * Makefile.in: Rebuild.
12245 2008-05-19 Ian Lance Taylor <iant@google.com>
12247 * options.h (class General_options): Add -z relro.
12248 * layout.cc (Layout::Layout): Initialize relro_segment_.
12249 (Layout::add_output_section_data): Return the output section.
12250 (Layout::make_output_section): Rcognize relro sections and mark
12251 them appropriately.
12252 (Layout::attach_allocated_section_to_segment): Put relro sections
12253 in a PT_GNU_RELRO segment.
12254 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12256 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12258 (Layout::linkonce_mapping): Map d.rel.ro.local to
12259 .data.rel.ro.local.
12260 (Layout::output_section_name): Us .data.rel.ro.local for any
12261 section which begins with that.
12262 * layout.h (class Layout): Update add_output_section_data
12263 declaration. Add relro_segment_ field.
12264 * output.cc (Output_section::Output_section): Initialize is_relro_
12265 and is_relro_local_ fields.
12266 (Output_segment::add_output_section): Group relro sections.
12267 (Output_segment::is_first_section_relro): New function.
12268 (Output_segment::maximum_alignment): If there is a relro section,
12269 align the segment to the common page size.
12270 (Output_segment::set_section_addresses): Track whether we are
12271 looking at relro sections. If the last section is a relro
12272 section, align to the common page size.
12273 (Output_segment::set_section_list_addresses): Add in_relro
12274 parameter. Change all callers. Align to the page size when
12275 moving from relro to non-relro section.
12276 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12278 * output.h (class Output_section): Add is_relro_ and
12279 is_relro_local_ fields.
12280 (Output_section::is_relro): New function.
12281 (Output_section::set_is_relro): New function.
12282 (Output_section::is_relro_local): New function.
12283 (Output_section::set_is_relro_local): New function.
12284 (class Output_segment): Update declarations.
12285 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12286 * sparc.cc (Target_sparc::got_section): Likewise.
12287 * x86_64.cc (Target_x86_64::got_section): Likewise.
12288 * testsuite/relro_test_main.cc: New file.
12289 * testsuite/relro_test.cc: New file.
12290 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12291 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12292 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12293 (relro_test.so, relro_test_pic.o): New targets.
12294 * testsuite/Makefile.in: Rebuild.
12296 2008-05-16 Ian Lance Taylor <iant@google.com>
12298 * output.cc (Output_segment::add_output_section): Remove front
12300 * output.h (class Output_segment): Remove
12301 add_initial_output_section and overloaded add_output_section.
12302 Update declaration of remaining add_output_section.
12303 * layout.cc (Layout::create_interp): Call add_output_section
12304 rather than add_initial_output_section.
12305 (Layout::finish_dynamic_section): Likewise.
12307 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12308 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12309 know the dynamic type.
12310 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12311 field. Initialize it in constructor.
12312 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12313 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12314 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12317 * output.cc (Output_reloc::get_address): Change return type to
12319 * output.h (class Output_reloc): Update get_address declaration.
12320 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12321 for section addresses.
12323 2008-05-09 Ian Lance Taylor <iant@google.com>
12326 * gold.cc (gold_nomem): Use return value of write.
12328 2008-05-08 Ian Lance Taylor <iant@google.com>
12330 * symtab.c (Symbol::init_base_output_data): Add version
12331 parameter. Change all callers.
12332 (Symbol::init_base_output_segment): Likewise.
12333 (Symbol::init_base_constant): Likewise.
12334 (Symbol::init_base_undefined): Likewise.
12335 (Sized_symbol::init_output_data): Likewise.
12336 (Sized_symbol::init_output_segment): Likewise.
12337 (Sized_symbol::init_constant): Likewise.
12338 (Sized_symbol::init_undefined): Likewise.
12339 (Symbol_table::do_define_in_output_data): If the new symbol has a
12340 version, mark it as the default.
12341 (Symbol_table::do_define_in_output_segment): Likewise.
12342 (Symbol_table::do_define_as_constant): Likewise.
12343 * symtab.h (class Symbol): Update declarations.
12344 (class Sized_symbol): Likewise.
12345 * resolve.cc (Symbol::override_version): New function.
12346 (Symbol::override_base): Call override_version.
12347 (Symbol::override_base_with_special): Likewise.
12348 * testsuite/ver_script_8.script: New file.
12349 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12350 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12351 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12352 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12354 2008-05-06 Ian Lance Taylor <iant@google.com>
12357 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12359 (class General_options): Remove existing --undefined, and add
12360 --no-undefined instead. Add new --undefined as synonym for -u.
12361 * archive.cc (Archive::add_symbols): Check whether symbol was
12363 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12364 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12365 all uses. Add IS_UNDEFINED. Update declarations to split
12366 different versions of init_base. Declare init_base_undefined.
12367 (Symbol::is_defined): Handle IS_UNDEFINED.
12368 (Symbol::is_undefined): Likewise.
12369 (Symbol::is_weak_undefined): Call is_undefined.
12370 (Symbol::is_absolute): Handle IS_CONSTANT.
12371 (class Sized_symbol): Update declarations to split different
12372 versions of init. Declare init_undefined.
12373 (class Symbol_table): Declare new functions.
12374 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12375 Change all callers.
12376 (Symbol::init_base_output_data): Likewise.
12377 (Symbol::init_base_output_segment): Likewise.
12378 (Symbol::init_base_constant): Likewise.
12379 (Symbol::init_base_undefined): New function.
12380 (Sized_symbol::init_object): Rename from init. Change all
12382 (Sized_symbol::init_output_data): Likewise.
12383 (Sized_symbol::init_output_segment): Likewise.
12384 (Sized_symbol::init_constant): Likewise.
12385 (Sized_symbol::init_undefined): New function.
12386 (Symbol_table::add_undefined_symbols_from_command_line): New
12388 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12390 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12391 (Symbol::output_section): Likewise.
12392 (Symbol::set_output_section): Likewise.
12393 (Symbol_table::sized_finalize_symbol): Likewise.
12394 (Symbol_table::sized_write_globals): Likewise.
12395 * resolve.cc (Symbol_table::should_override): Likewise.
12396 (Symbol::override_base_with_special): Likewise.
12398 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12399 symbol, change it to have default visibility.
12400 * testsuite/protected_1.cc: New file.
12401 * testsuite/protected_2.cc: New file.
12402 * testsuite/protected_3.cc: New file.
12403 * testsuite/protected_main_1.cc: New file.
12404 * testsuite/protected_main_2.cc: New file.
12405 * testsuite/protected_main_3.cc: New file.
12406 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12407 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12408 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12409 (protected_1.so): New target.
12410 (protected_1_pic.o, protected_2_pic.o): New targets.
12411 (protected_3_pic.o): New target.
12412 (check_PROGRAMS): Add protected_2.
12413 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12414 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12415 * testsuite/Makefile.in: Rebuild.
12417 * options.h (DEFINE_var): Add set_user_set_##varname__.
12418 (DEFINE_bool_alias): New macro.
12419 (class General_options): Define -Bstatic using DEFINE_bool_alias
12420 rather than DEFINE_special. Add --undefined as an alias for -z
12422 * options.cc (General_options::parse_Bstatic): Remove.
12424 * options.h (class General_options): Add --fatal-warnings.
12425 * main.cc (main): Implement --fatal-warnings.
12426 * errors.h (Errors::warning_count): New function.
12428 * options.h (class General_options): Add -Bsymbolic-functions.
12429 * symtab.h (Symbol::is_preemptible): Check for
12430 -Bsymbolic-functions.
12432 2008-05-05 Ian Lance Taylor <iant@google.com>
12434 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12435 as noVARNAME rather than no-VARNAME.
12436 (class General_options): Add option -z combreloc.
12437 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12439 (Output_reloc::sort_before) [SHT_REL]: New function.
12440 (Output_reloc::sort_before) [SHT_RELA]: New function.
12441 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12442 Sort_relocs_comparison.
12443 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12444 parameter. Change all callers.
12445 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12446 sort_relocs parameter. Change all callers.
12447 * output.cc (Output_reloc::get_address): New function, broken out
12449 (Output_reloc::write_rel): Call it.
12450 (Output_reloc::compare): New function.
12451 (Output_data_reloc_base::do_write): Optionally sort relocs.
12453 * configure.ac: If targ_extra_obj is set, link it in.
12454 * configure.tgt: Initialize all variables.
12455 (x86_64*): Set targ_extra_obj and targ_extra_size.
12456 * configure: Rebuild.
12458 * object.cc (Sized_relobj::include_section_group): Adjust section
12459 indexes read from group data. Build vector to pass to
12461 * layout.cc (Layout::layout_group): Add flags and shndxes
12462 parameters. Remove contents parameter. Change caller. Update
12463 explicit instantiations.
12464 * layout.h (class Layout): Update layout_group declaration.
12465 * output.cc (Output_data_group::Output_data_group): Add flags and
12466 input_shndxes parameters. Remove contents parameter. Change
12468 (Output_data_group::do_write): Change input_sections_ to
12470 * output.h (class Output_data_group): Update constructor
12471 declaration. Rename input_sections_ to input_shndxes_.
12472 * testsuite/many_sections_test.cc: Add template.
12474 2008-04-30 Cary Coutant <ccoutant@google.com>
12476 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12478 * layout.cc (Layout::include_section): Refactored check for debug
12480 (Layout::add_comdat): Add new parameters. Change type
12481 of signature parameter. Add object and shndx to signatures table.
12482 (Layout::find_kept_object): New function.
12483 * layout.h: Include <cstring>.
12484 (Layout::is_debug_info_section): New function.
12485 (Layout::add_comdat): Add new parameters.
12486 (Layout::find_kept_object): New function.
12487 (Layout::Kept_section): New struct.
12488 (Layout::Signatures): Change type of map range.
12489 * object.cc (Relobj::output_section_address): New function.
12490 (Sized_relobj::include_section_group): Add new parameters. Change
12491 calls to Layout::add_comdat. Change to build table of kept comdat
12492 groups and table mapping discarded sections to kept sections.
12493 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12494 (Sized_relobj::do_layout): Change calls to include_section_group and
12495 include_linkonce_section.
12496 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12497 value to zero when section is discarded.
12498 (Sized_relobj::map_to_kept_section): New function.
12499 * object.h (Relobj::output_section_address): New function.
12500 (Relobj::Comdat_group): New type.
12501 (Relobj::find_comdat_group): New function.
12502 (Relobj::Comdat_group_table): New type.
12503 (Relobj::Kept_comdat_section): New type.
12504 (Relobj::Kept_comdat_section_table): New type.
12505 (Relobj::add_comdat_group): New function.
12506 (Relobj::set_kept_comdat_section): New function.
12507 (Relobj::get_kept_comdat_section): New function.
12508 (Relobj::comdat_groups_): New field.
12509 (Relobj::kept_comdat_sections_): New field.
12510 (Symbol_value::input_value): Update comment.
12511 (Sized_relobj::map_to_kept_section) New function.
12512 (Sized_relobj::include_linkonce_section): Add new parameter.
12513 * target-reloc.h (Comdat_behavior): New type.
12514 (get_comdat_behavior): New function.
12515 (relocate_section): Add code to map a discarded section to the
12516 corresponding kept section when applying a relocation.
12518 2008-04-30 Craig Silverstein <csilvers@google.com>
12520 * dwarf_reader.cc (next_generation_count): New static var.
12521 (Addr2line_cache_entry): New struct.
12522 (addr2line_cache): New static var.
12523 (Dwarf_line_info::one_addr2line): Added caching.
12524 (Dwarf_line_info::clear_addr2line_cache): New function.
12525 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12526 cache-size parameter.
12527 (Dwarf_line_info::one_addr2line_cache): New function.
12528 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12529 new cache-size argument to one_addr2line(), and clear cache.
12531 2008-04-28 Cary Coutant <ccoutant@google.com>
12533 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12534 R_386_PC8 relocations.
12536 2008-04-23 Ian Lance Taylor <iant@google.com>
12538 * object.cc (Sized_relobj::include_section_group): Check for
12539 invalid section group.
12541 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12544 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12545 than read for file header.
12546 * archive.cc (Archive::include_member): Likewise.
12548 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12550 * aclocal.m4: Regenerate.
12551 * configure: Regenerate.
12553 2008-04-19 Ian Lance Taylor <iant@google.com>
12555 * version.cc (version_string): Bump to 1.6.
12557 * testsuite/Makefile.am (many_sections_r_test): New target.
12558 (many_sections_r_test_SOURCES): Remove.
12559 (many_sections_r_test_DEPENDENCIES): Remove.
12560 (many_sections_r_test_LDFLAGS): Remove.
12561 (many_sections_r_test_LDADD): Remove.
12563 * object.cc (Sized_relobj::do_add_symbols): Always pass
12564 local_symbol_count_ to add_from_relobj.
12566 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12567 every thousand variables.
12568 * testsuite/Makefile.in: Rebuild.
12570 * object.cc (Xindex::initialize_symtab_xindex): New function.
12571 (Xindex::read_symtab_xindex): New function.
12572 (Xindex::sym_xindex_to_shndx): New function.
12573 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12575 (Sized_relobj::do_initialize_xindex): New function.
12576 (Sized_relobj::do_read_symbols): Adjust section links.
12577 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12578 parameter. Change all callers.
12579 (Sized_relobj::include_section_group): Adjust section links and
12580 symbol section indexes.
12581 (Sized_relobj::do_layout): Adjust section links.
12582 (Sized_relobj::do_count_local_symbols): Adjust section links and
12583 symbol section indexes.
12584 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12585 ordinary and special symbols.
12586 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12587 dynsym_xindex parameters. Change all callers. Adjust section
12588 links. Use SHN_XINDEX when needed.
12589 (Sized_relobj::get_symbol_location_info): Adjust section links.
12590 Don't get fooled by special symbols.
12591 * object.h (class Xindex): Define.
12592 (class Object): Add xindex_ parameter. Declare virtual functoin
12593 do_initialize_xindex.
12594 (Object::adjust_sym_shndx): New function.
12595 (Object::set_xindex): New protected function.
12596 (class Symbol_value): Add is_ordinary_shndx_ field.
12597 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12598 (Symbol_value::value): Assert ordinary section.
12599 (Symbol_value::initialize_input_to_output_map): Likewise.
12600 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12601 Change all callers.
12602 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12604 (class Sized_relobj): Update declarations.
12605 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12606 parameter. Change all callers.
12607 (Sized_relobj::adjust_shndx): New function.
12608 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12610 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12611 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12612 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12613 (Sized_dynobj::read_dynsym_section): Adjust section links.
12614 (Sized_dynobj::read_dynamic): Likewise.
12615 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12617 (Sized_dynobj::do_initialize_xindex): New function.
12618 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12619 do_initialize_xindex.
12620 (Sized_dynobj::adjust_shndx): New function.
12621 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12622 dynsym_xindex_ fields.
12623 (Layout::finalize): Add a call to set_section_indexes before
12624 creating the symtab sections.
12625 (Layout::set_section_indexes): Don't do anything if the section
12626 already has a section index.
12627 (Layout::create_symtab_sections): Add shnum parameter. Change
12628 caller. Create .symtab_shndx section if needed.
12629 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12631 (Layout::allocated_output_section_count): New function.
12632 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12634 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12635 fields. Update declarations.
12636 (Layout::symtab_xindex): New function.
12637 (Layout::dynsym_xindex): New function.
12638 (class Write_symbols_task): Add layout_ field.
12639 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12641 * output.cc (Output_section_headers::Output_section_headers): Add
12642 shstrtab_section parameter. Change all callers.
12643 (Output_section_headers::do_sized_write): Store overflow values
12644 for section count and section string table section index in
12645 section header zero.
12646 (Output_file_header::do_sized_write): Check for overflow of
12647 section count and section string table section index.
12648 (Output_symtab_xindex::do_write): New function.
12649 (Output_symtab_xindex::endian_do_write): New function.
12650 * output.h (class Output_section_headers): Add shstrtab_section_.
12651 Update declarations.
12652 (class Output_symtab_xindex): Define.
12653 (Output_section::has_out_shndx): New function.
12654 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12656 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12657 Change all callers.
12658 (Sized_symbol::init): Likewise.
12659 (Symbol::output_section): Check for ordinary symbol.
12660 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12661 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12663 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12664 Change all callers. Simplify handling of symbols from sections
12665 not included in the link.
12666 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12668 (Weak_alias_sorter::operator()): Assert that symbols are
12670 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12672 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12673 parameters. Change all callers.
12674 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12675 symbol distinction. Use SHN_XINDEX when needed.
12676 (Symbol_table::write_section_symbol): Add symtab_xindex
12677 parameter. Change all callers.
12678 (Symbol_table::sized_write_section_symbol): Likewise. Use
12679 SHN_XINDEX when needed.
12680 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12682 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12683 (Symbol::is_defined): Check is_ordinary.
12684 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12685 (Symbol::is_absolute, Symbol::is_common): Likewise.
12686 (class Sized_symbol): Update declarations.
12687 (class Symbol_table): Update declarations.
12688 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12689 parameters. Change all callers.
12690 (Sized_symbol::override): Likewise.
12691 (Symbol_table::override): Likewise.
12692 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12693 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12694 is_ordinary, and orig_st_shndx parameters. Change all callers.
12695 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12696 to be in an ordinary section.
12697 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12698 object and is_ordinary parameters. Change all callers.
12699 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12700 Change all callers. Don't add undefined or non-ordinary symbols
12702 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12703 Change all callers.
12704 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12706 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12707 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12708 (Sized_relobj::relocate_sections): Likewise.
12709 * target-reloc.h (scan_relocs): Adjust section symbol index.
12710 (scan_relocatable_relocs): Likewise.
12711 * i386.cc (Scan::local): Check for ordinary symbols.
12712 * sparc.cc (Scan::local): Likewise.
12713 * x86_64.cc (Scan::local): Likewise.
12714 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12715 to symbol_section_and_value.
12716 * testsuite/many_sections_test.cc: New file.
12717 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12718 (check_PROGRAMS): Add many_sections_test.
12719 (many_sections_test_SOURCES): Define.
12720 (many_sections_test_DEPENDENCIES): Define.
12721 (many_sections_test_LDFLAGS): Define.
12722 (BUILT_SOURCES): Add many_sections_define.h.
12723 (many_sections_define.h): New target.
12724 (BUILT_SOURCES): Add many_sections_check.h.
12725 (many_sections_check.h): New target.
12726 (check_PROGRAMS): Add many_sections_r_test.
12727 (many_sections_r_test_SOURCES): Define.
12728 (many_sections_r_test_DEPENDENCIES): Define.
12729 (many_sections_r_test_LDFLAGS): Define.
12730 (many_sections_r_test_LDADD): Define.
12731 (many_sections_r_test.o): New target.
12732 * testsuite/Makefile.in: Rebuild.
12734 2008-04-17 Cary Coutant <ccoutant@google.com>
12736 * errors.cc (Errors::info): New function.
12737 (gold_info): New function.
12738 * errors.h (Errors::info): New function.
12739 * gold.h (gold_info): New function.
12740 * object.cc (Input_objects::add_object): Print trace output.
12741 * options.cc (options::parse_set): New function.
12742 (General_options::parse_wrap): Deleted.
12743 (General_options::General_options): Deleted initializer.
12744 * options.h (options::String_set): New typedef.
12745 (options::parse_set): New function.
12746 (DEFINE_set): New macro.
12747 (General_options::wrap): Changed to use DEFINE_set. Changed
12748 callers of any_wrap_symbols and is_wrap_symbol.
12749 (General_options::trace, General_options::trace_symbol):
12751 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12752 (General_options::wrap_symbols_): Deleted.
12753 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12755 2008-04-17 David S. Miller <davem@davemloft.net>
12757 * options.cc (General_options::parse_V): New function.
12758 * options.h: Add entries for -V and -Qy.
12760 2008-04-17 Ian Lance Taylor <iant@google.com>
12762 * common.cc (Symbol_table::allocate_commons): Remove options
12763 parameter. Change caller.
12764 (Symbol_table::do_allocate_commons): Remove options parameter.
12765 Change caller. Just call do_allocate_commons_list twice.
12766 (Symbol_table::do_allocate_commons_list): New function, broken out
12767 of do_allocate_commons.
12768 * common.h (class Allocate_commons_task): Remove options_ field.
12769 Update constructor.
12770 * symtab.cc (Symbol_table::Symbol_table): Initialize
12772 (Symbol_table::add_from_object): Put TLS common symbols on
12774 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12775 which are IN_OUTPUT_DATA.
12776 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
12777 allocate_commons and do_allocate_commons declarations. Declare
12778 do_allocate_commons_list.
12779 * gold.cc (queue_middle_tasks): Update creation of
12780 Allocate_commons_task to not pass options.
12781 * testsuite/Makefile.am (INCLUDES): Add -I.. .
12782 (TLS_TEST_C_FLAGS): New variable.
12783 (tls_test_c_pic.o): New target.
12784 (tls_test_shared.so): Link in tls_test_c_pic.o.
12785 (tls_test_c_pic_ie.o): New target.
12786 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12787 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12788 (tls_test_c.o): New target.
12789 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12790 (tls_pic_test_LDADD): Likewise.
12791 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12792 (tls_shared_gd_to_ie_test_LDADD): Likewise.
12793 (tls_test_c_gnu2.o): New target.
12794 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12796 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12797 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12798 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12799 * testsuite/tls_test.cc: Include "config.h".
12800 (t_last): Call t11_last.
12801 * testsuite/tls_test.h (t11, t11_last): Declare.
12802 * testsuite/tls_test_c.c: New file.
12803 * testsuite/tls_test_main.cc (thread_routine): Call t11.
12804 * configure.ac: Check for OpenMP support.
12805 * configure, config.in, Makefile.in: Rebuild.
12806 * testsuite/Makefile.in: Rebuild.
12808 2008-04-16 Cary Coutant <ccoutant@google.com>
12810 * i386.cc (Target_i386::define_tls_base_symbol): New function.
12811 (Target_i386::tls_base_symbol_defined_): New field.
12812 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12813 (Target_i386::Scan::global): Likewise.
12814 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12815 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12816 (Target_x86_64::tls_base_symbol_defined_): New field.
12817 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12818 (Target_x86_64::Scan::global): Likewise.
12820 2008-04-16 Cary Coutant <ccoutant@google.com>
12822 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12823 (Symbol::needs_plt_entry): Allow weak undefined symbols.
12824 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12825 building shared libraries.
12826 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12827 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12828 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12829 * testsuite/Makefile.in: Rebuild.
12830 * testsuite/weak_undef.h: New file.
12831 * testsuite/weak_undef_file1.cc: Add extra test cases.
12832 * testsuite/weak_undef_file2.cc: Likewise.
12833 * testsuite/weak_undef_test.cc: Likewise.
12835 2008-04-16 David S. Miller <davem@davemloft.net>
12837 * sparc.cc (Target_sparc::Scan): Change from struct to class.
12838 Add issued_non_pic_error_ field. Declare check_non_pic.
12839 (Target_sparc::Scan::check_non_pic): New function.
12840 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12841 (Target_sparc::Scan::global): Likewise.
12843 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12844 * configure: Rebuild.
12846 * options.h (DEFINE_enable): New macro.
12847 (new_dtags): New enable option.
12848 (initfirst, interpose, loadfltr, nodefaultlib,
12849 nodelete, nodlopen, nodump): New -z options.
12850 * layout.cc (Layout:finish_dynamic_section): If new
12851 dtags enabled, emit DT_RUNPATH. Also, emit a
12852 DT_FLAGS_1 containing any specified -z flags.
12854 2008-04-16 Ian Lance Taylor <iant@google.com>
12856 * copy-relocs.cc: New file.
12857 * copy-relocs.h: New file.
12858 * reloc.cc: Remove Copy_relocs code.
12859 * reloc.h: Likewise.
12860 * reloc-types.h (struct Reloc_types) [both versions]: Add
12861 get_reloc_addend_noerror.
12862 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12863 variants of add_global which take an addend which must be zero.
12864 * i386.cc: Include "copy-relocs.h".
12865 (class Target_i386): Change type of copy_relocs_ to variable,
12866 update initializer.
12867 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12868 Change all callers.
12869 (Target_i386::do_finalize_sections): Change handling of
12871 * sparc.cc: Include "copy-relocs.h".
12872 (class Target_sparc): Change type of copy_relocs_ to variable,
12873 update initializer.
12874 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12875 Change all callers.
12876 (Target_sparc::do_finalize_sections): Change handling of
12878 * x86_64.cc: Include "copy-relocs.h".
12879 (class Target_x86_64): Change type of copy_relocs_ to variable,
12880 update initializer.
12881 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12882 class. Change all callers.
12883 (Target_x86_64::do_finalize_sections): Change handling of
12885 * Makefile.am (CCFILES): Add copy-relocs.cc.
12886 (HFILES): Add copy-relocs.h.
12888 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12890 * testsuite/script_test_4.sh: Permit leading zeroes.
12892 2008-04-15 Ian Lance Taylor <iant@google.com>
12894 * script-sections.cc (Script_sections::create_segments): Use
12895 header_size_adjustment even when there is enough room for the
12897 * testsuite/script_test_4.sh: New file.
12898 * testsuite/script_test_4.t: New file.
12899 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12900 (check_DATA): Add script_test_4.stdout.
12901 (MOSTLYCLEANFILES): Likewise.
12902 (script_test_4): New target.
12903 (script_test_4.stdout): New target.
12904 * testsuite/Makefile.in: Rebuild.
12906 * sparc.cc: Add definitions for Output_data_plt_sparc class
12909 2008-04-14 David S. Miller <davem@davemloft.net>
12911 * sparc.cc: New file.
12912 * Makefile.am (TARGETSOURCES): Add sparc.cc
12913 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12914 * configure.tgt: Document targ_extra_size and
12915 targ_extra_big_endian. Add entries for sparc-* and
12917 * configure.ac: Handle targ_extra_size and
12918 targ_extra_big_endian.
12919 * Makefile.in: Rebuild.
12920 * configure: Likewise.
12921 * po/POTFILES.in: Likewise.
12922 * po/gold.pot: Likewise.
12924 2008-04-14 Ian Lance Taylor <iant@google.com>
12926 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12927 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12928 in the name/type/flags to section mapping. Don't call
12929 allocate_output_section.
12930 (Layout::choose_output_section): Change parameter from adjust_name
12931 to is_input_section. Don't permit input sections after sections
12932 are attached to segments. Don't call allocate_output_section.
12933 (Layout::layout_eh_frame): Call update_flags_for_input_section,
12934 not write_enable_output_section.
12935 (Layout::make_output_section): Don't push to
12936 unattached_section_list_ nor call attach_to_segment. Call
12937 attach_section_to_segment if sections are attached.
12938 (Layout::attach_sections_to_segments): New function.
12939 (Layout::attach_section_to_segment): New function.
12940 (Layout::attach_allocated_section_to_segment): Rename from
12941 attach_to_segment. Remove flags parameter.
12942 (Layout::allocate_output_section): Remove function.
12943 (Layout::write_enable_output_section): Remove function.
12944 * layout.h (class Layout): Update for above changes. Add new
12945 field sections_are_attached_.
12946 * output.h (Output_section::update_flags_for_input_section): New
12948 * output.cc (Output_section::add_input_section): Call
12949 update_flags_for_input_section.
12950 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12952 2008-04-11 Cary Coutant <ccoutant@google.com>
12954 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12955 thought unnecessary.
12956 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12958 2008-04-11 Ian Lance Taylor <iant@google.com>
12960 * output.h (class Output_section_data): Remove inline definition
12962 * output.cc (Output_section_data::set_addralign): New function.
12964 2008-04-11 Cary Coutant <ccoutant@google.com>
12966 Add support for TLS descriptors for i386 and x86_64.
12967 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12968 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12969 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12971 (Target_i386::got_mod_index_entry): Remove unnecessary code.
12972 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12973 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
12975 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12976 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12977 Fix problem with initial-exec relocations.
12978 (Target_i386::Relocate::relocate_tls): Likewise.
12979 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12981 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12982 support for section-plus-offset dynamic table entries.
12983 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12984 (Output_data_dynamic::Dynamic_entry): Add support for
12985 section-plus-offset dynamic table entries.
12986 (Output_data_dynamic::Classification): Likewise.
12987 (Output_data_dynamic::classification_): Renamed offset_.
12988 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12989 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12990 (Target_x86_64::make_plt_section): New function.
12991 (Target_x86_64::reserve_tlsdesc_entries): New function.
12992 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12993 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12994 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12995 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12996 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12997 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12998 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12999 add extra PLT entry for TLS descriptors.
13000 (Output_data_plt_x86_64::got_): New field.
13001 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13002 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13004 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13006 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13007 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13008 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13009 R_386_TLS_DESC_CALL relocations.
13010 (Target_x86_64::Scan::global): Likewise.
13011 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13012 for TLS descriptors.
13013 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13014 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13015 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13016 GD-to-IE relaxation.
13017 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13018 and TLS_DESCRIPTORS.
13019 * Makefile.in: Rebuild.
13020 * configure: Rebuild.
13021 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13022 (tls_test_shared2.so): New target.
13023 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13024 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13025 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13026 (tls_shared_gd_to_ie_test_LDADD): New variable.
13027 (tls_shared_gnu2_gd_to_ie_test): New target.
13028 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13030 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13031 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13032 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13033 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13034 (tls_shared_gnu2_test): New target.
13035 (tls_test_gnu2_shared.so): New target.
13036 (tls_shared_gnu2_test_SOURCES): New variable.
13037 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13038 (tls_shared_gnu2_test_LDFLAGS): New variable.
13039 (tls_shared_gnu2_test_LDADD): New variable.
13040 * testsuite/Makefile.in: Rebuild.
13041 * testsuite/Makefile.
13043 2008-04-11 Ian Lance Taylor <iant@google.com>
13045 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13047 * testsuite/Makefile.in: Rebuild.
13049 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13051 * testsuite/script_test_2.cc (main): Adjust test.
13053 2008-04-11 David S. Miller <davem@davemloft.net>
13054 Ian Lance Taylor <iant@google.com>
13056 * options.h (General_options): Add entries for '-Y' and
13058 * options.cc (General_options:finalize): If -Y was used, add those
13059 entries to the library path instead of the default "/lib" and
13062 2008-04-11 David S. Miller <davem@davemloft.net>
13064 * testsuite/justsyms.t: Start at 0x100.
13065 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13066 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13068 * testsuite/script_test_2.cc: Adjust string and section length
13071 2008-04-09 Ian Lance Taylor <iant@google.com>
13074 * script-sections.cc (Sections_element::allocate_to_segment): Add
13076 (Output_section_definition::allocate_to_segment): Likewise.
13077 (Orphan_output_section::allocate_to_segment): Likewise.
13078 (Script_sections::attach_sections_using_phdrs_clause): Don't
13079 propagate non-PT_LOAD segments to orphan sections.
13080 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13081 readelf rather than objdump.
13082 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13083 .interp section and PT_INTERP segment are the same size.
13084 * testsuite/Makefile.in: Rebuild.
13086 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13087 aliases for symbols defined in the same object.
13088 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13089 (weak_alias_test_SOURCES): New variable.
13090 (weak_alias_test_DEPENDENCIES): New variable.
13091 (weak_alias_test_LDFLAGS): New variable.
13092 (weak_alias_test_LDADD): New variable.
13093 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13094 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13095 (weak_alias_test_3.o): New target.
13096 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13097 * testsuite/weak_alias_test_main.cc: New file.
13098 * testsuite/weak_alias_test_1.cc: New file.
13099 * testsuite/weak_alias_test_2.cc: New file.
13100 * testsuite/weak_alias_test_3.cc: New file.
13102 2008-04-08 Ian Lance Taylor <iant@google.com>
13104 * options.h (class General_options): Add --noinhibit-exec option.
13105 * main.cc (main): Check --noinhibit-exec.
13107 * options.h (class General_options): Define --wrap as a special
13108 option. Add wrap_symbols_ field.
13109 (General_options::any_wrap_symbols): New function.
13110 (General_options::is_wrap_symbol): New function.
13111 * options.cc (General_options::parse_wrap): New function.
13112 (General_options::General_options): Initialize wrap_symbols_.
13113 * symtab.cc (Symbol_table::wrap_symbol): New function.
13114 (Symbol_table::add_from_object): Handle --wrap.
13115 * symtab.h (class Symbol_table): Declare wrap_symbol.
13116 * target.h (Target::wrap_char): New function.
13117 (Target::Target_info): Add wrap_char field.
13118 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13119 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13120 * testsuite/testfile.cc (Target_test::test_target_info):
13123 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13126 * layout.h (class Layout): Add added_eh_frame_data_ field.
13127 * layout.cc (Layout::Layout): Initialize new field.
13128 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13129 output section until we find a section we merged successfully.
13130 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13131 that the size be non-zero.
13133 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13136 2008-04-08 Craig Silverstein <csilvers@google.com>
13138 * configure.ac: Export new conditional variable HAVE_ZLIB.
13139 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13141 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13142 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13144 2008-04-07 Ian Lance Taylor <iant@google.com>
13146 * version.cc (version_string): Set to "1.5".
13148 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13149 Add issued_non_pic_error_ field. Declare check_non_pic.
13150 (Target_x86_64::Scan::check_non_pic): New function.
13151 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13152 (Target_x86_64::Scan::global): Likewise.
13154 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13155 addend parameter. Change caller. Handle merge sections.
13156 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13157 Address to Addend. Don't add in the result of
13158 local_section_offset, pass down the addend and use the returned
13160 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13161 Update declarations of local_section_offset and symbol_value.
13162 * testsuite/two_file_test_1.cc (t18): New function.
13163 * testsuite/two_file_test_2.cc (f18): New function.
13164 * testsuite/two_file_test_main.cc (main): Call t18.
13165 * testsuite/two_file_test.h (t18, f18): Declare.
13167 * configure.ac: Don't test for objdump, c++filt, or readelf.
13168 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13170 (TEST_READELF): New variable.
13171 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13172 (check_PROGRAMS): Add two_file_strip_test.
13173 (two_file_strip_test): New target.
13174 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13175 (two_file_same_shared_strip_test_SOURCES): New variable.
13176 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13177 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13178 (two_file_same_shared_strip_test_LDADD): New variable.
13179 (two_file_shared_strip.so): New target.
13180 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13181 (ver_test_5.syms, ver_test_7.syms): Likewise.
13182 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13183 (strip_test_3.stdout): Use TEST_OBJDUMP.
13184 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13186 2008-04-04 Cary Coutant <ccoutant@google.com>
13188 * symtab.h (Symbol::is_weak_undefined): New function.
13189 (Symbol::is_strong_undefined): New function.
13190 (Symbol::is_absolute): New function.
13191 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13192 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13194 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13195 (weak_undef_test): New target.
13196 * testsuite/Makefile.in: Rebuild.
13197 * testsuite/weak_undef_file1.cc: New file.
13198 * testsuite/weak_undef_file2.cc: New file.
13199 * testsuite/weak_undef_test.cc: New file.
13201 2008-04-03 Craig Silverstein <csilvers@google.com>
13203 * compressed_output.h (class Output_compressed_section): Use
13205 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13207 (zlib_compressed_suffix): Removed.
13208 (Output_compressed_section::set_final_data_size): Use unsigned
13210 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13211 Fix linker invocation.
13212 (flagstest_o_specialfile_and_compress_debug_sections):
13214 * testsuite/Makefile.in: Regenerated.
13216 2008-04-02 David S. Miller <davem@davemloft.net>
13218 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13219 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13221 2008-04-02 Craig Silverstein <csilvers@google.com>
13225 2008-04-02 Ian Lance Taylor <iant@google.com>
13227 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13228 parameters. Update for new key type to views_. Change all
13230 (File_read::read): Adjust for byteshift in returned view.
13231 (File_read::add_view): New function, broken out of
13232 find_and_make_view.
13233 (File_read::make_view): New function, broken out of
13234 find_and_make_view.
13235 (File_read::find_or_make_view): Add offset and aligned
13236 parameters. Rewrite accordingly. Change all callers.
13237 (File_read::get_view): Add offset and aligned parameters. Adjust
13238 for byteshift in return value.
13239 (File_read::get_lasting_view): Likewise.
13240 * fileread.h (class File_read): Update declarations.
13241 (class File_read::View): Add byteshift_ field. Add byteshift to
13242 constructor. Add byteshift method.
13243 * archive.h (Archive::clear_uncached_views): New function.
13244 (Archive::get_view): Add aligned parameter. Change all callers.
13245 * object.h (Object::get_view): Add aligned parameter. Change all
13247 (Object::get_lasting_view): Likewise.
13249 * fileread.cc (File_read::release): Don't call clear_views if
13250 there are multiple objects.
13251 * fileread.h (File_read::clear_uncached_views): New function.
13252 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13255 2008-03-31 Cary Coutant <ccoutant@google.com>
13257 Add thin archive support.
13258 * archive.cc (Archive::armagt): New const.
13259 (Archive::setup): Remove task parameter and calls to unlock.
13260 (Archive::unlock_nested_archives): New function.
13261 (Archive::read_header): Add nested_off parameter. Change
13263 (Archive::interpret_header): Likewise.
13264 (Archive::include_all_members): Change to handle thin
13266 (Archive::include_member): Likewise.
13267 * archive.h (Archive::Archive): Add new parameters and
13269 (Archive::armagt): New const.
13270 (Archive::setup): Remove task parameter.
13271 (Archive::unlock_nested_archives): New function.
13272 (Archive::read_header): Add nested_off parameter.
13273 (Archive::interpret_header): Likewise.
13274 (Archive::Nested_archive_table): New typedef.
13275 (Archive::is_thin_archive_): New field.
13276 (Archive::nested_archives_): New field.
13277 (Archive::options_): New field.
13278 (Archive::dirpath_): New field.
13279 (Archive::task_): New field.
13280 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13281 for thin archives. Pass additional parameters to
13282 Archive::Archive. Unlock the archive file after calling
13285 2008-03-29 Ian Lance Taylor <iant@google.com>
13287 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13288 version symbol to be local.
13289 * testsuite/ver_test_4.sh: New file.
13290 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13291 (check_DATA): Add ver_test_4.syms.
13292 (ver_test_4.syms): New target.
13293 * testsuite/Makefile.in: Rebuild.
13296 (Output_section::Input_section_sort_entry::has_priority): New
13298 (Output_section::Input_section_sort_entry::match_file_name): New
13300 (Output_section::Input_section_sort_entry::match_section_name):
13302 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13304 (Output_section::Input_section_sort_entry::match_section_file):
13306 (Output_section::Input_section_sort_compare::operator()): Rewrite
13307 using new Input_section_sort_entry functions. Sort crtbegin and
13308 crtend first. Sort sections with no priority before sections with
13310 * testsuite/initpri1.c (d3): Check j != 4.
13311 (cd5): New constructor/destructor function.
13312 (main): Check j != 2.
13314 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13315 new symbol when resolving, don't call set_is_default.
13316 * testsuite/ver_test_7.cc: New file.
13317 * testsuite/ver_test_7.sh: New file.
13318 * testsuite/Makefile.am (ver_test_7.so): New target.
13319 (ver_test_7.o): New target.
13320 (check_SCRIPTS): Add ver_test_7.sh.
13321 (check_DATA): Add ver_test_7.syms.
13322 (ver_test_7.syms): New target.
13324 2008-03-28 Ian Lance Taylor <iant@google.com>
13326 * layout.cc (Layout::layout): If we see an input section with a
13327 name that needs sorting, set the must_sort flag for the output
13329 (Layout::make_output_section): If the name of the output section
13330 indicates that it might require sorting, set the may_sort flag.
13331 * output.h (Output_section::may_sort_attached_input_sections): New
13333 (Output_section::set_may_sort_attached_input_sections): New
13335 (Output_section::must_sort_attached_input_sections): New
13337 (Output_section::set_must_sort_attached_input_sections): New
13339 (class Output_section): Declare Input_section_sort_entry. Define
13340 Input_section_sort_compare. Declare
13341 sort_attached_input_sections. Add new fields:
13342 may_sort_attached_input_sections_,
13343 must_sort_attached_input_sections_,
13344 attached_input_sections_are_sorted_.
13345 * output.cc (Output_section::Output_section): Initialize new
13347 (Output_section::add_input_section): Add an entry to
13348 input_sections_ if may_sort or must_sort are true.
13349 (Output_section::set_final_data_size): Call
13350 sort_attached_input_sections if necessary.
13351 (Output_section::Input_section_sort_entry): Define new class.
13352 (Output_section::Input_section_sort_compare::operator()): New
13354 (Output_section::sort_attached_input_sections): New function.
13355 * configure.ac: Check whether the compiler supports constructor
13356 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13357 * testsuite/initpri1.c: New file.
13358 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13359 CONSTRUCTOR_PRIORITY.
13360 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13361 (initpri1_LDFLAGS): New variable.
13362 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13364 2008-03-27 Ian Lance Taylor <iant@google.com>
13366 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13367 * testsuite/common_test_1.c: New file.
13368 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13369 (common_test_1_SOURCES): New variable.
13370 (common_test_1_DEPENDENCIES): New variable.
13371 (common_test_1_LDFLAGS): New variable.
13373 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13374 and commons_ correctly when NAME/VERSION does not override
13376 * testsuite/ver_test_6.c: New file.
13377 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13378 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13379 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13381 2008-03-26 Ian Lance Taylor <iant@google.com>
13383 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13384 of an undefined symbol from a version script.
13385 * testsuite/Makefile.am (ver_test_5.so): New target.
13386 (ver_test_5.o): New target.
13387 (check_SCRIPTS): Add ver_test_5.sh.
13388 (check_DATA): Add ver_test_5.syms.
13389 (ver_test_5.syms): New target.
13390 * testsuite/ver_test_5.cc: New file.
13391 * testsuite/ver_test_5.script: New file.
13392 * testsuite/ver_test_5.sh: New file.
13393 * Makefile.in, testsuite/Makefile.in: Rebuild.
13396 Fix problems building gold with gcc 4.3.0.
13397 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13398 (gold_error_at_location, gold_warning_at_location): Use it.
13399 * configure.ac: Check whether we can compile and use a template
13400 function with a printf attribute.
13401 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13402 when jumping over bytes.
13403 * object.cc: Instantiate Object::read_section_data.
13404 * debug.h: Include <cstring>
13405 * dwarf_reader.cc: Include <algorithm>
13406 * main.cc: Include <cstring>.
13407 * options.cc: Include <cstring>.
13408 * output.cc: Include <cstring>.
13409 * script.cc: Include <cstring>.
13410 * script.h: Include <string>.
13411 * symtab.cc: Include <cstring> and <algorithm>.
13412 * target-select.cc: Include <cstring>.
13413 * version.cc: Include <string>.
13414 * testsuite/testmain.cc: Include <cstdlib>.
13415 * configure, config.in: Rebuild.
13417 2008-03-25 Ian Lance Taylor <iant@google.com>
13419 * options.cc: Include "../bfd/bfdver.h".
13420 (options::help): Print bug reporting address.
13422 * version.cc (print_version): Adjust output for current value of
13423 BFD_VERSION_STRING.
13427 * options.cc (options::help): Print list of supported targets.
13428 * target-select.h: Include <vector>.
13429 (class Target_selector): Make machine_, size_, and is_big_endian_
13430 fields const. Add bfd_name_ and instantiated_target_ fields.
13431 (Target_selector::Target_selector): Add bfd_name parameter.
13432 (Target_selector::recognize): Make non-virtual, call
13434 (Target_selector::recognize_by_name): Make non-virtual, call
13435 do_recognize_by_name.
13436 (Target_selector::supported_names): New function.
13437 (Target_selector::bfd_name): New function.
13438 (Target_selector::do_instantiate_target): New pure virtual
13440 (Target_selector::do_recognize): New virtual function.
13441 (Target_selector::do_recognize_by_name): New virtual function.
13442 (Target_selector::instantiate_target): New private function.
13443 (supported_target_names): Declare.
13444 * target-select.cc (Target_selector::Target_selector): Update for
13445 new parameter and fields.
13446 (select_target_by_name): Check that the name matches before
13447 calling recognize_by_name.
13448 (supported_target_names): New function.
13449 * i386.cc (class Target_selector_i386): Update Target_selector
13450 constructor call. Remove recognize and recognize_by_name. Add
13451 do_instantiate_target.
13452 * x86_64.cc (class Target_selector_x86_64): Likewise.
13453 * testsuite/testfile.cc (class Target_selector_test): Update for
13454 changes to Target_selector.
13456 * README: Rewrite, with some notes on unsupported features.
13458 2008-03-24 Cary Coutant <ccoutant@google.com>
13460 * i386.cc (Target_i386::Got_type): New enum declaration.
13461 (Target_i386::Scan::local): Updated callers of Output_data_got
13463 (Target_i386::Scan::global): Likewise.
13464 (Target_i386::Relocate::relocate): Likewise.
13465 (Target_i386::Relocate::relocate_tls): Likewise.
13466 * object.h (Got_offset_list): New class.
13467 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13468 (Sized_relobj::local_got_offset): Likewise.
13469 (Sized_relobj::set_local_got_offset): Likewise.
13470 (Sized_relobj::local_has_tls_got_offset): Removed.
13471 (Sized_relobj::local_tls_got_offset): Removed.
13472 (Sized_relobj::set_local_tls_got_offset): Removed.
13473 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13474 * output.cc (Output_data_got::add_global): Added got_type parameter.
13475 (Output_data_got::add_global_with_rel): Likewise.
13476 (Output_data_got::add_global_with_rela): Likewise.
13477 (Output_data_got::add_global_pair_with_rel): New function.
13478 (Output_data_got::add_global_pair_with_rela): New function.
13479 (Output_data_got::add_local): Added got_type parameter.
13480 (Output_data_got::add_local_with_rel): Likewise.
13481 (Output_data_got::add_local_with_rela): Likewise.
13482 (Output_data_got::add_local_pair_with_rel): New function.
13483 (Output_data_got::add_local_pair_with_rela): New function.
13484 (Output_data_got::add_global_tls): Removed.
13485 (Output_data_got::add_global_tls_with_rel): Removed.
13486 (Output_data_got::add_global_tls_with_rela): Removed.
13487 (Output_data_got::add_local_tls): Removed.
13488 (Output_data_got::add_local_tls_with_rel): Removed.
13489 (Output_data_got::add_local_tls_with_rela): Removed.
13490 * output.h (Output_data_got::add_global): Added got_type parameter.
13491 (Output_data_got::add_global_with_rel): Likewise.
13492 (Output_data_got::add_global_with_rela): Likewise.
13493 (Output_data_got::add_global_pair_with_rel): New function.
13494 (Output_data_got::add_global_pair_with_rela): New function.
13495 (Output_data_got::add_local): Added got_type parameter.
13496 (Output_data_got::add_local_with_rel): Likewise.
13497 (Output_data_got::add_local_with_rela): Likewise.
13498 (Output_data_got::add_local_pair_with_rel): New function.
13499 (Output_data_got::add_local_pair_with_rela): New function.
13500 (Output_data_got::add_global_tls): Removed.
13501 (Output_data_got::add_global_tls_with_rel): Removed.
13502 (Output_data_got::add_global_tls_with_rela): Removed.
13503 (Output_data_got::add_local_tls): Removed.
13504 (Output_data_got::add_local_tls_with_rel): Removed.
13505 (Output_data_got::add_local_tls_with_rela): Removed.
13506 * resolve.cc (Symbol::override_base_with_special): Removed
13507 reference to has_got_offset_ field.
13508 * symtab.cc (Symbol::init_fields): Replaced initialization
13509 of got_offset_ with got_offsets_. Removed initialization
13511 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13512 (Symbol::got_offset): Likewise.
13513 (Symbol::set_got_offset): Likewise.
13514 (Symbol::has_tls_got_offset): Removed.
13515 (Symbol::tls_got_offset): Removed.
13516 (Symbol::set_tls_got_offset): Removed.
13517 (Symbol::got_offset_): Removed.
13518 (Symbol::tls_mod_got_offset_): Removed.
13519 (Symbol::tls_pair_got_offset_): Removed.
13520 (Symbol::got_offsets_): New field.
13521 (Symbol::has_got_offset): Removed.
13522 (Symbol::has_tls_mod_got_offset): Removed.
13523 (Symbol::has_tls_pair_got_offset): Removed.
13524 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13525 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13527 (Target_x86_64::Scan::global): Likewise.
13528 (Target_x86_64::Relocate::relocate): Likewise.
13529 (Target_x86_64::Relocate::relocate_tls): Likewise.
13531 2008-03-25 Ben Elliston <bje@au.ibm.com>
13533 * yyscript.y: Fix spelling error in comment.
13535 2008-03-24 Ian Lance Taylor <iant@google.com>
13537 * options.h (class General_options): Define build_id option.
13538 * layout.h (class Layout): Declare write_build_id, create_note,
13539 create_build_id. Add build_id_note_ member.
13540 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13541 "libiberty.h", "md5.h", "sha1.h".
13542 (Layout::Layout): Initialize eh_frame_data_,
13543 eh_frame_hdr_section_, and build_id_note_.
13544 (Layout::finalize): Call create_build_id.
13545 (Layout::create_note): New function, broken out of
13546 Layout::create_gold_note.
13547 (Layout::create_gold_note): Call create_note.
13548 (Layout::create_build_id): New function.
13549 (Layout::write_build_id): New function.
13550 (Close_task_runner::run): Call write_build_id.
13552 * x86_64.cc: Correct license to GPLv3.
13554 2008-03-23 Ian Lance Taylor <iant@google.com>
13556 * options.cc: Include "demangle.h".
13557 (parse_optional_string): New function.
13558 (parse_long_option): Handle takes_optional_argument.
13559 (parse_short_option): Update dash_z initializer. Handle
13560 takes_optional_argument.
13561 (General_options::General_options): Initialize do_demangle_.
13562 (General_options::finalize): Set do_demangle_. Handle demangling
13564 * options.h (parse_optional_string): Declare.
13565 (struct One_option): Add optional_arg field. Update constructor.
13566 Update call constructor calls. Add takes_optional_argument
13568 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13569 (DEFINE_optional_string): Define.
13570 (General_options::demangle): Change from DEFINE_bool to
13571 DEFINE_optional_string.
13572 (General_options::no_demangle): New function.
13573 (General_options::do_demangle): New function.
13574 (General_options::set_do_demangle): New function.
13575 (General_options::execstack_status_): Move definition to end of
13577 (General_options::static_): Likewise.
13578 (General_options::do_demangle_): New field.
13579 * object.cc (big_endian>::get_symbol_location_info): Call
13580 Options::do_demangle, not Options::demangle.
13581 * symtab.cc (demangle): Likewise.
13583 2008-03-22 Ian Lance Taylor <iant@google.com>
13585 * gold.h: Include <cstddef> and <sys/types.h>
13586 * options.h: Include <cstring>.
13588 2008-03-21 Ian Lance Taylor <iant@google.com>
13590 * Added source code to GNU binutils.