* powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
[binutils-gdb.git] / gold / ChangeLog
1 2012-10-16 Alan Modra <amodra@gmail.com>
2
3 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4 (Target_powerpc::do_finalize_sections): Call it.
5 (Output_data_save_res): New class and supporting functions.
6 (Target_powerpc::symval_for_branch): Only look up .opd entry for
7 normal symbols defined in object files.
8
9 2012-10-12 Alan Modra <amodra@gmail.com>
10
11 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
12 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
13 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
14 section if scan_opd_relocs not yet called.
15 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
16
17 2012-10-12 Alan Modra <amodra@gmail.com>
18
19 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
20 add_local_ifunc_entry): Revert last change.
21 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
22
23 2012-10-05 Alan Modra <amodra@gmail.com>
24
25 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
26 do_plt_address_for_global): New functions.
27 (Output_data_got_powerpc::do_write): Don't segfault when linking
28 statically.
29 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
30 add_local_ifunc_entry): Return true on adding entry..
31 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
32 glink->add_entry call. Remove unused symtab param. Adjust calls.
33 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
34 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
35 set up symbols here.
36 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
37 syms here. Do so even when no .iplt. Don't segfault when linking
38 statically.
39 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
40 new variants without reloc param.
41 (Glink_sym_ent::Glink_sym_ent): Likewise.
42 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
43 reloc when refs will resolve to plt call stub.
44 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
45 R_PPC_PLTREL24 to resolve locally.
46 (Target_powerpc::Scan::global): Correct ifunc handling.
47 (Target_powerpc::Relocate::relocate): Correct local sym glink
48 lookup. Don't destroy "value" when we have a plt call stub,
49 and when checking plt call validity.
50 (Target_powerpc::do_dynsym_value): Simplify.
51
52 2012-10-05 Alan Modra <amodra@gmail.com>
53
54 * i386.cc (Output_data_plt_i386::address_for_global,
55 address_for_local): Add plt offset to returned value. Adjust uses.
56 * sparc.cc (Output_data_plt_sparc::address_for_global,
57 address_for_local): Likewise.
58 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
59 address_for_local): Likewise.
60 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
61 address_for_local): Likewise.
62 * target.h (Target::plt_address_for_global, plt_address_for_local):
63 Update comment.
64 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
65 (Output_data_got::Got_entry::write): Nor here.
66 * output.h: Comment fix.
67
68 2012-10-02 Jiong Wang <jiwang@tilera.com>
69
70 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
71 global_offset_table_ value for larget got.
72 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
73
74 2012-09-29 Alan Modra <amodra@gmail.com>
75
76 * powerpc.cc (Target_powerpc::iplt_): New output section.
77 (Target_powerpc::iplt_section, make_iplt_section,
78 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
79 (Target_powerpc::make_plt_entry): Handle ifunc syms.
80 Target_powerpc::plt_entry_count): Count iplt entries too.
81 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
82 reloc section in constructor. New params.
83 (Target_powerpc::make_plt_section): Create reloc section here instead.
84 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
85 functions.
86 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
87 (Output_data_glink::add_entry, find_entry): New functions to
88 deal with local syms.
89 (Glink_sym_ent): Add support for local syms.
90 (Output_data_glink::do_write): Handle ifunc plt entries.
91 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
92 (Target_powerpc::Scan::local, global): Handle ifunc syms.
93 (Target_powerpc::Relocate::relocate): Likewise.
94 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
95
96 2012-09-25 Alan Modra <amodra@gmail.com>
97
98 * object.h (Sized_relobj_file::adjust_local_symbol,
99 do_adjust_local_symbol): New functions.
100 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
101 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
102 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
103 and irregular opd entry spacing.
104 (Powerpc_relobj::do_read_relocs): Add opd size checks.
105 (Global_symbol_visitor_opd): New functor.
106 (Target_powerpc::do_finalize_sections): Omit global symbols defined
107 on deleted opd entries.
108
109 2012-09-15 Jiong Wang <jiwang@tilera.com>
110
111 * tilegx.cc: New file.
112 * Makefile.am (TARGETSOURCES): Add tilegx.cc
113 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
114 * configure.tgt: Add entries for tilegx*.
115 * configure.ac: Likewise.
116 * Makefile.in: Rebuild.
117 * configure: Likewise.
118 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
119 tilegx.
120
121 2012-09-13 Alan Modra <amodra@gmail.com>
122
123 * target-reloc.h (scan_relocs): Call scan.local for relocs
124 against symbols in discarded sections. Pass is_discarded
125 param.
126 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
127 Add is_discarded param.
128 * powerpc (Target_powerpc::Scan::local): Likewise. Use
129 is_discarded to flag opd entry as discarded. Don't emit dyn
130 relocs on such entries.
131 (Target_powerpc::Scan::global): Similarly detect and handle
132 such opd entries.
133 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
134 opd_ent_. Update all uses.
135 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
136 (Target_powerpc::relocate_section): Zero out discarded opd
137 entry relocs.
138
139 2012-09-12 Ian Lance Taylor <iant@google.com>
140
141 PR gold/14570
142 * output.cc: Rename Output_data_got template parameter from size
143 to got_size for all functions. Compile all variants of
144 Output_data_got.
145 (Output_data_got::Got_entry::write): Correct use of size for
146 symbol value. Use local_is_tls rather than casting to
147 Sized_relobj_file.
148 * object.h (class Object): Add local_is_tls and do_local_is_tls.
149 (class Sized_relobj_file): Add do_local_is_tls.
150 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
151
152 2012-09-11 Alan Modra <amodra@gmail.com>
153
154 PR gold/14566
155 * layout.cc (Layout::set_segment_offsets): When using
156 common-page-size alignment, ensure we are on a new max-page-size
157 page.
158 * output.cc (Output_segment::set_section_addresses): Use
159 abi_pagesize, not common_pagesize for relro boundary.
160 (Output_segment::set_offset): Likewise.
161
162 2012-09-11 Alan Modra <amodra@gmail.com>
163
164 * output.h (Output_data_got::add_global_tls, add_local_tls,
165 add_local_tls_pair): New functions.
166 (Output_data_got::add_local_pair_with_rel): Remove second
167 reloc param. Expand comment.
168 (Output_data_got::Got_entry): Rename use_plt_offset_ to
169 use_plt_or_tls_offset_, similarly for constructor param.
170 (Output_data_got::Got_entry::write): Add got_index param.
171 * output.cc (Output_data_got::add_global_tls, add_local_tls,
172 add_local_tls_pair): New functions.
173 (Output_data_got::Got_entry::write): Handle tls symbols
174 with use_plt_or_tls_offset_ set specially.
175 (Output_data_got::add_local_pair_with_rel): Only one reloc.
176 (Output_data_got::do_write): Replace iterator with index, pass
177 index to entry write function.
178 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
179 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
180 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
181 call.
182 * i386.cc (Target_i386::Scan::local): Likewise.
183 * sparc.cc (Target_sparc::Scan::local): Likewise.
184 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
185 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
186 do_tls_offset_for_global): New functions.
187 (Target_powerpc::Scan::local): Correct TLS relocations and got
188 entry values.
189 (Target_powerpc::Scan::global): Don't emit unnecessary
190 dynamic relocations on TLS GOT entries.
191
192 2012-09-10 Matthias Klose <doko@ubuntu.com>
193
194 * config.in: Disable sanity check for kfreebsd.
195
196 2012-09-10 Sterling Augustine <saugustine@google.com>
197
198 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
199 (Gdb_index::pubtypes_read): New parameter.
200 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
201 to calls.
202 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
203 pubtypes_object_.
204
205 2012-09-09 Alan Modra <amodra@gmail.com>
206
207 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
208 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
209 * gc.h (gc_process_relocs): Call target gc_add_reference.
210 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
211 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
212 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
213 unnecessary cast.
214 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
215 to cater for when we don't need code offset. Update use.
216 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
217 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
218 set_opd_valid): New functions.
219 (Target_powerpc::do_gc_add_reference): New function.
220 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
221 stashed refs.
222 (Target_powerpc::do_gc_mark_symbol): New function.
223
224 2012-09-06 Cary Coutant <ccoutant@google.com>
225
226 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
227 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
228 (Dwarf_die::skip_attributes): Likewise.
229 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
230 * testsuite/gdb_index_test.cc (inline_func_1): New function.
231 (main): Call it.
232 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
233
234 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
235
236 * testsuite/script_test_3.t: Add .got.plt output section
237 statement.
238 * testsuite/script_test_4.t: Likewise.
239
240 2012-09-05 Alan Modra <amodra@gmail.com>
241
242 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
243 update all uses and lose "enum" when using type.
244
245 2012-09-05 Alan Modra <amodra@gmail.com>
246
247 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
248 * configure: Regenerate.
249 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
250 (plugin_final_layout.stdout): Likewise.
251 (memory_test): Set page sizes to 0x1000.
252 * testsuite/Makefile.in: Regenerate.
253 * testsuite/discard_locals_test.sh: Add FIXME comment.
254 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
255 * testsuite/pr14265.t: Add .got output section statement.
256 * testsuite/script_test_2.t: Likewise.
257 * testsuite/script_test_3.t: Likewise.
258 * testsuite/script_test_4.t: Likewise.
259 * testsuite/script_test_5.t: Likewise.
260 * testsuite/script_test_6.t: Likewise.
261 * testsuite/script_test_7.t: Likewise.
262 * testsuite/script_test_9.t: Likewise.
263
264 2012-09-05 Alan Modra <amodra@gmail.com>
265
266 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
267 (Powerpc_relocate_functions::Status): New typedef.
268 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
269 (Target_powerpc::Scan::local): Handle REL64.
270 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
271 for REL32 and REL64.
272 (Target_powerpc::symval_for_branch): New function, extracted from..
273 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
274 checks. Report overflow errors.
275
276 2012-09-05 Alan Modra <amodra@gmail.com>
277
278 * object.h (Sized_relobj_file::emit_relocs): Delete.
279 (Sized_relobj_file::emit_relocs_reltype): Delete.
280 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
281 relocate_relocs for --emit-relocs.
282 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
283 * output.h: Update comment.
284 (Output_segment::first_section): New function.
285 (Output_segment::first_section_load_address): Use first_section.
286 * output.cc (Output_segment::first_section): New function extracted..
287 (Output_segment::first_section_load_address): ..from here. Delete.
288 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
289 * target.h (Sized_target::relocate_for_relocatable): Likewise.
290 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
291 adjust call to target.h function.
292 * i386.cc (Target_i386): Likewise.
293 * sparc.cc (Target_sparc): Likewise.
294 * x86_64.cc (Target_x86_64): Likewise.
295 * powerpc.cc (Target_powerpc): Likewise.
296 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
297 first tls section has section symbol for optimised local dynamic
298 output relocs.
299 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
300 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
301 optimised tls code.
302 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
303 Rename to relocate_relocs. Update error message.
304
305 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
306
307 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
308 --just-symbols.
309
310 2012-08-31 Alan Modra <amodra@gmail.com>
311
312 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
313 (Powerpc_relobj::toc_base_offset): New stub function.
314 (Target_powerpc): Add tp_offset, dtp_offset. Rename
315 got_mod_index_offset to tlsld_got_offset. Update all refs.
316 (Target_powerpc::Relocate::enum skip_tls): New.
317 (Target_powerpc::call_tls_get_addr_): New var.
318 (Target_powerpc::is_branch_reloc): Move to file scope.
319 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
320 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
321 New functions.
322 (Target_powerpc::enum Got_type): Delete old values, add new ones.
323 (powerpc_info): Correct common_pagesize for ppc64.
324 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
325 (Powerpc_relocate_functions): Add overflow check enums and functions.
326 Add non-shift version of rela, rela_ua. Delete all rel public
327 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
328 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
329 addr16_ha3, addr14 functions.
330 (Output_data_got_powerpc::add_constant_pair): New function.
331 (Output_data_got_powerpc::got_base_offset): Likewise.
332 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
333 (instruction constants): Sort, add some more.
334 (Output_data_glink::do_write): Add and use Address typedef. Use
335 object->toc_base_offset() stub for 64-bit.
336 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
337 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
338 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
339 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
340 Always treat .opd relocs as against locally defined symbol.
341 Correct condition for RELATIVE relocs.
342 (Target_powerpc::do_finalize_sections): Test for NULL sections.
343 (Target_powerpc::Relocate::relocate): Use plt call stub as value
344 for 32-bit syms with a plt entry. Correct ppc64 toc base
345 calculations. Handle TLS relocs, and more. Add overflow
346 checking and adjust for Powerpc_relocate_functions changes.
347 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
348 Reinstate --emit-relocs code with FIXME.
349
350 2012-08-30 Alan Modra <amodra@gmail.com>
351
352 * layout.cc (Layout::set_segment_offsets): Set p_align to
353 abi_pagesize, not common_pagesize.
354 (Layout::relaxation_loop_body): Similarly use abi_pagesize
355 to determine whether file header can go in segment.
356
357 2012-08-30 Alan Modra <amodra@gmail.com>
358
359 * output.h (Output_reloc::Output_reloc <output section>): Add
360 is_relative param. Adjust calls.
361 (Output_reloc::add_output_section_relative): New functions.
362 * output.cc (Output_reloc::Output_reloc <output section>): Handle
363 is_relative.
364 (Output_reloc::symbol_value): Handle SECTION_CODE.
365
366 2012-08-24 Sriraman Tallam <tmsriram@google.com>
367
368 * gold.cc (queue_middle_tasks): Call layout again when unique
369 segments for sections is desired.
370 * layout.cc (Layout::Layout): Initialize new members.
371 (Layout::get_output_section_flags): New function.
372 (Layout::choose_output_section): Call get_output_section_flags.
373 (Layout::layout): Make output section for mapping to a unique segment.
374 (Layout::insert_section_segment_map): New function.
375 (Layout::attach_allocated_section_to_segment): Make unique segment for
376 output sections marked so.
377 (Layout::segment_precedes): Check for unique segments when sorting.
378 * layout.h (Layout::Unique_segment_info): New struct.
379 (Layout::Section_segment_map): New typedef.
380 (Layout::insert_section_segment_map): New function.
381 (Layout::get_output_section_flags): New function.
382 (Layout::is_unique_segment_for_sections_specified): New function.
383 (Layout::set_unique_segment_for_sections_specified): New function.
384 (Layout::unique_segment_for_sections_specified_): New member.
385 (Layout::section_segment_map_): New member.
386 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
387 Rename is_gc_pass_one to is_pass_one.
388 Rename is_gc_pass_two to is_pass_two.
389 Rename is_gc_or_icf to is_two_pass.
390 Check for which pass based on whether symbols data is present.
391 Make it two pass when unique segments for sections is desired.
392 * output.cc (Output_section::Output_section): Initialize new
393 members.
394 * output.h (Output_section::is_unique_segment): New function.
395 (Output_section::set_is_unique_segment): New function.
396 (Output_section::is_unique_segment_): New member.
397 (Output_section::extra_segment_flags): New function.
398 (Output_section::set_extra_segment_flags): New function.
399 (Output_section::extra_segment_flags_): New member.
400 (Output_section::segment_alignment): New function.
401 (Output_section::set_segment_alignment): New function.
402 (Output_section::segment_alignment_): New member.
403 (Output_segment::Output_segment): Initialize is_unique_segment_.
404 (Output_segment::is_unique_segment): New function.
405 (Output_segment::set_is_unique_segment): New function.
406 (Output_segment::is_unique_segment_): New member.
407 * plugin.cc (allow_unique_segment_for_sections): New function.
408 (unique_segment_for_sections): New function.
409 (Plugin::load): Add new functions to transfer vector.
410 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
411 * Makefile.in: Regenerate.
412 * testsuite/plugin_final_layout.sh: Check if unique segment
413 functionality works.
414 * testsuite/plugin_section_order.c (onload): Check if new interfaces
415 are available.
416 (allow_unique_segment_for_sections): New global.
417 (unique_segment_for_sections): New global.
418 (claim_file_hook): Call allow_unique_segment_for_sections.
419 (all_symbols_read_hook): Call unique_segment_for_sections.
420
421 2012-08-22 Cary Coutant <ccoutant@google.com>
422
423 * layout.cc (Layout::include_section): Don't assert on GROUP
424 sections with --emit-relocs.
425
426 2012-08-21 Cary Coutant <ccoutant@google.com>
427
428 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
429 if --export-dynamic-symbol names an undef symbol.
430
431 2012-08-18 Alan Modra <amodra@gmail.com>
432
433 * powerpc.cc: Formatting and white space.
434 (Powerpc_relobj): Rename got2_section_ to special_.
435 Add opd_ent_shndx_ and opd_ent_off_ vectors.
436 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
437 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
438 (Target_powerpc): Add Address typedef and invalid_address. Use
439 throughout.
440 (Target_powerpc::is_branch_reloc): New function.
441 (Powerpc_relocate_functions): Add Address typedef, use throughout.
442 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
443 for dst_mask, value and addend.
444 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
445 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
446 (Output_data_glink::do_write): Correct toc base. Don't try to use
447 uint16_t for 24-bit offset. Use get_output_section_offset and
448 check return.
449 (Target_powerpc::Scan::local): Handle more relocs.
450 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
451 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
452 Plug in toc restoring insn after plt calls. Translate branches
453 to function descriptor symbols to corresponding entry point.
454 (Target_powerpc::relocate_for_relocatable): Check return from
455 get_output_section_offset.
456 * symtab.h: Comment typo.
457
458 2012-08-14 Ian Lance Taylor <iant@google.com>
459
460 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
461 unsupported_relocal_local to call unsupported_reloc_global.
462
463 2012-08-14 Nick Clifton <nickc@redhat.com>
464
465 PR ld/14265
466 * script-sections.cc (Sections_element::output_section_name): Add
467 keep return parameter.
468 (Output_section_element::match_name): Add keep return parameter.
469 Return the value of the keep_ member.
470 * script-sections.h (class Output_section): Update
471 output_section_name prototype.
472 * layout.cc (Layout::keep_input_section): New public member
473 function.
474 (Layout::choose_output_section): Pass keep parameter to
475 output_section_name.
476 * layout.h (class Layout): Add keep_input_section.
477 * object.cc (Sized_relobj_file::do_layout): Check for kept input
478 sections.
479 * testsuite/Makefile.am: Add a test.
480 * testsuite/Makefile.in: Regenerate.
481 * testsuite/pr14265.c: Source file for the test.
482 * testsuite/pr14265.t: Linker script for the test.
483 * testsuite/pr14265.sh: Shell script for the test.
484
485 2012-08-14 Alan Modra <amodra@gmail.com>
486
487 * target.h (Target::output_section_name): New function.
488 (Target::do_output_section_name): New function.
489 * layout.cc (Layout::choose_output_section): Call the above.
490 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
491
492 2012-08-14 Alan Modra <amodra@gmail.com>
493
494 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
495 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
496 for replace_constant call.
497 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
498 (Output_data_glink::do_print_to_mapfile): New function.
499 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
500 (Target_powerpc::Relocate::relocate): Likewise.
501
502 2012-08-14 Alan Modra <amodra@gmail.com>
503
504 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
505 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
506 (Output_data_glink::add_entry,find_entry): Remove shndx param.
507 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
508 all references to shndx_. Handle special case for R_PPC_PLTREL24
509 here.
510 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
511 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
512 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
513 here.
514 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
515 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
516
517 2012-08-12 Alan Modra <amodra@gmail.com>
518
519 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
520 (glink insn constants): Use uint32_t.
521 (Output_data_glink::add_entry): Use insert, not [] operator.
522
523 2012-08-11 Alan Modra <amodra@gmail.com>
524
525 * object.h (Sized_relobj_file::find_shdr): New function.
526 (Sized_relobj_file::find_special_sections): New function.
527 * object.cc (Sized_relobj_file::find_shdr): New function.
528 (Sized_relobj_file::find_eh_frame): Use find_shdr.
529 (Sized_relobj_file::find_special_sections): New function, split out..
530 (Sized_relobj_file::do_read_symbols): ..from here.
531 * output.h (Output_data_got::replace_constant): New function.
532 (Output_data_got::num_entries): New function.
533 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
534 (Output_data_got::got_offset): Protected rather than private.
535 (Output_data_got::replace_got_entry): New function.
536 * output.cc (Output_data_got::replace_got_entry): New function.
537 * powerpc.cc (class Powerpc_relobj): New.
538 (class Powerpc_relocate_functions): Delete all psymval variants or
539 convert to value,addend type. Delete pcrela, pcrela_unaligned.
540 Implement _ha functions using corresponding _hi function.
541 (Powerpc_relobj::find_special_sections): New function.
542 (Target_powerpc::do_make_elf_object): New function.
543 (class Output_data_got_powerpc): New.
544 (class Output_data_glink): New.
545 (class Powerpc_scan_relocatable_reloc): New.
546 Many more changes througout file.
547
548 2012-08-09 Nick Clifton <nickc@redhat.com>
549
550 * po/vi.po: Updated Vietnamese translation.
551
552 2012-08-07 Ian Lance Taylor <iant@google.com>
553
554 * layout.cc (Layout::add_target_dynamic_tags): If
555 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
556 plt_rel.
557
558 2012-07-30 Nick Clifton <nickc@redhat.com>
559
560 * po/gold.pot: Updated template.
561 * po/es.po: Updated Spanish translation.
562
563 2012-07-18 Cary Coutant <ccoutant@google.com>
564
565 PR gold/14344
566 * configure.ac: Add check for -gpubnames support.
567 * configure: Regenerate.
568 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
569 support; force -gno-pubnames.
570 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
571 support.
572 (gdb_index_test_4): New test.
573 * testsuite/Makefile.in: Regenerate.
574 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
575 * testsuite/gdb_index_test_2.sh: Likewise.
576 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
577 * testsuite/gdb_index_test_4.sh: New script.
578 * testsuite/gdb_index_test_comm.sh: New script with common code;
579 don't look for space after colon.
580
581 2012-07-16 Sriraman Tallam <tmsriram@google.com>
582
583 * gold.cc (queue_middle_tasks): Update function order only after
584 deferred objects due to plugins are processed.
585
586 2012-07-11 Ian Lance Taylor <iant@google.com>
587
588 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
589 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
590 (Target_arm::scan_reloc_for_stub): Likewise.
591 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
592 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
593 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
594 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
595 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
596
597 2012-07-10 Dodji Seketeli <dodji@redhat.com>
598 Ian Lance Taylor <iant@google.com>
599
600 PR gold/14309
601 * configure.ac: Test whether std::tr1::hash<off_t> works.
602 * gold.h: Add a specialization for std::tr1::hash<off_t> if
603 needed.
604 * output.h (class Output_fill): Add virtual destructor.
605 * configure, config.in: Rebuild.
606
607 2012-06-22 Roland McGrath <mcgrathr@google.com>
608
609 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
610
611 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
612
613 * plugin.cc (Plugin::load): Handle position independent executables.
614
615 2012-06-06 Cary Coutant <ccoutant@google.com>
616
617 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
618 add .debug_macro.
619 (lines_only_debug_sections): Likewise.
620 (gdb_fast_lookup_sections): New static array.
621 (is_gdb_debug_section): Rename formal parameter.
622 (is_lines_only_debug_section): Likewise.
623 (is_gdb_fast_lookup_section): New function.
624 (Layout::include_section): Check for ".zdebug_" prefix; pass
625 section name suffix to is_gdb_debug_section, et al.; check for
626 fast-lookup sections when building .gdb_index.
627 * options.h (--strip-debug-gdb): Update GDB version number.
628
629 2012-06-06 Cary Coutant <ccoutant@google.com>
630
631 * configure.ac: Add check for fallocate.
632 * configure: Regenerate.
633 * config.in: Regenerate.
634
635 * options.h (class General_options): Add --mmap-output-file and
636 --posix-fallocate options.
637 * output.cc: (posix_fallocate): Remove; replace with...
638 (gold_fallocate): New function.
639 (Output_file::map_no_anonymous): Call gold_fallocate.
640 (Output_file::map): Check --mmap-output-file option.
641
642 2012-06-05 Jing Yu <jingyu@google.com>
643
644 * gold.h (textdomain): Add do {} to empty while(0).
645 (bindtextdomain): Likewise.
646
647 2012-06-04 Cary Coutant <ccoutant@google.com>
648
649 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
650 has_dynsym_index.
651
652 2012-05-25 Sriraman Tallam <tmsriram@google.com>
653
654 * symtab.cc (Symbol_table::define_special_symbol):
655 Initialize *poldsym to prevent uninitialized variable errors.
656
657 2012-05-23 Cary Coutant <ccoutant@google.com>
658
659 * layout.cc (Layout::section_name_mapping): Add rules to handle
660 exact match on .data.rel.ro.local or .data.rel.ro.
661 (Layout::output_section_name): Check for exact matches.
662
663 2012-05-23 Cary Coutant <ccoutant@google.com>
664
665 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
666 more carefully.
667
668 2012-05-22 Cary Coutant <ccoutant@google.com>
669
670 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
671 object before exporting symbol.
672
673 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
674
675 * testsuite/tls_test.cc: Include "config.h" first.
676 * testsuite/tls_test_c.c: Likewise.
677
678 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
679 Nick Clifton <nickc@redhat.com>
680
681 PR 14072
682 * configure.in: Add check that sysdep.h has been included before
683 any system header files.
684 * configure: Regenerate.
685 * config.in: Regenerate.
686
687 2012-05-14 Cary Coutant <ccoutant@google.com>
688
689 * layout.cc (Layout::make_output_section): Mark .tdata section
690 as RELRO.
691 * testsuite/relro_test.cc: Add a TLS variable.
692
693 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
694
695 PR gold/14091
696 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
697 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
698 R_X86_64_64.
699
700 2012-05-08 Cary Coutant <ccoutant@google.com>
701
702 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
703 (lines_only_debug_sections): Likewise.
704
705 2012-05-02 Roland McGrath <mcgrathr@google.com>
706
707 * nacl.cc: New file.
708 * nacl.h: New file.
709 * Makefile.am (CCFILES, HFILES): Add them.
710 * Makefile.in: Regenerate.
711 * i386.cc (Output_data_plt_i386_nacl): New class.
712 (Output_data_plt_i386_nacl_exec): New class.
713 (Output_data_plt_i386_nacl_dyn): New class.
714 (Target_i386_nacl): New class.
715 (Target_selector_i386_nacl): New class.
716 (target_selector_i386): Use it instead of Target_selector_i386.
717 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
718 (Target_x86_64_nacl): New class.
719 (Target_selector_x86_64_nacl): New class.
720 (target_selector_x86_64, target_selector_x32): Use it instead of
721 Target_selector_x86_64.
722 * arm.cc (Output_data_plt_arm_nacl): New class.
723 (Target_arm_nacl): New class.
724 (Target_selector_arm_nacl): New class.
725 (target_selector_arm, target_selector_armbe): Use it instead of
726 Target_selector_arm.
727
728 * target-select.cc (select_target): Take new Input_file* and off_t
729 arguments, pass them on to recognize method of selector.
730 * object.cc (make_elf_sized_object): Update caller.
731 * parameters.cc (parameters_force_valid_target): Likewise.
732 * incremental.cc (make_sized_incremental_binary): Likewise.
733 * target-select.h: Update decl.
734 (Target_selector::recognize): Take new Input_file* argument,
735 pass it on to do_recognize.
736 (Target_selector::do_recognize): Take new Input_file* argument.
737 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
738 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
739 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
740 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
741
742 * target.h (Target::Target_info): New members isolate_execinstr
743 and rosegment_gap.
744 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
745 * arm.cc (Target_arm::arm_info): Update initializer.
746 * i386.cc (Target_i386::i386_info): Likewise.
747 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
748 * sparc.cc (Target_sparc::sparc_info): Likewise.
749 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
750 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
751 * layout.cc (Layout::attach_allocated_section_to_segment):
752 Take new const Target* argument. If target->isolate_execinstr(), act
753 like --rosegment.
754 (Layout::find_first_load_seg): Take new const Target* argument;
755 if target->isolate_execinstr(), reject PF_X segments.
756 (Layout::relaxation_loop_body): Update caller.
757 (Layout::set_segment_offsets): If target->isolate_execinstr(),
758 reset file offset to zero when we hit LOAD_SEG, and then do a second
759 loop over the segments before LOAD_SEG to reassign offsets after
760 addresses have been determined. Handle target->rosegment_gap().
761 (Layout::attach_section_to_segment): Take new const Target* argument;
762 pass it to attach_allocated_section_to_segment.
763 (Layout::make_output_section): Update caller.
764 (Layout::attach_sections_to_segments): Take new const Target* argument;
765 pass it to attach_section_to_segment.
766 * gold.cc (queue_middle_tasks): Update caller.
767 * layout.h (Layout): Update method decls with new arguments.
768
769 * arm.cc (Target_arm::Target_arm): Take optional argument for the
770 Target_info pointer to use.
771 (Target_arm::do_make_data_plt): New virtual method.
772 (Target_arm::make_data_plt): New method that calls it.
773 (Target_arm::make_plt_entry): Use it.
774 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
775 for the section alignment.
776 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
777 method.
778 (Output_data_plt_arm::first_plt_entry_offset): Call it.
779 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
780 method.
781 (Output_data_plt_arm::get_plt_entry_size): Call it.
782 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
783 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
784 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
785 method.
786 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
787 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
788 method instead of sizeof(plt_entry).
789 (Output_data_plt_arm::add_entry): Likewise.
790 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
791 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
792 than static method.
793 (Target_arm::plt_entry_size): Likewise.
794 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
795 Move to ...
796 (Output_data_plt_arm_standard): ... here, new class.
797 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
798 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
799 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
800
801 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
802 Take additional argument for the PLT entry size.
803 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
804 Use get_plt_entry_size method rather than plt_entry_size variable.
805 (Output_data_plt_x86_64::reserve_slot): Likewise.
806 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
807 (Output_data_plt_x86_64::add_entry): Likewise.
808 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
809 (Output_data_plt_x86_64::address_for_global): Likewise.
810 (Output_data_plt_x86_64::address_for_local): Likewise.
811 (Output_data_plt_x86_64::set_final_data_size): Likewise.
812 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
813 Make method non-static.
814 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
815 method.
816 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
817 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
818 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
819 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
820 virtual method.
821 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
822 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
823 virtual method.
824 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
825 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
826 virtual method.
827 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
828 (Output_data_plt_x86_64::plt_entry_size)
829 (Output_data_plt_x86_64::first_plt_entry)
830 (Output_data_plt_x86_64::plt_entry)
831 (Output_data_plt_x86_64::tlsdesc_plt_entry)
832 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
833 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
834 (Output_data_plt_x86_64_standard): ... here, new class.
835 (Target_x86_64::Target_x86_64): Take optional argument for the
836 Target_info pointer to use.
837 (Target_x86_64::do_make_data_plt): New virtual method.
838 (Target_x86_64::make_data_plt): New method to call it.
839 (Target_x86_64::init_got_plt_for_update): Use that.
840 Call this->plt_->add_eh_frame method here.
841 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
842 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
843 rather than static method.
844 (Target_x86_64::plt_entry_size): Likewise.
845 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
846 rather than plt_entry_size variable. Move guts of PLT filling to...
847 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
848 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
849 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
850
851 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
852 additional argument for the section alignment.
853 Don't do add_eh_frame_for_plt here.
854 (Output_data_plt_i386::first_plt_entry_offset): Make the method
855 non-static. Use get_plt_entry_size method rather than plt_entry_size
856 variable.
857 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
858 method.
859 (Output_data_plt_i386::get_plt_entry_size): Call it.
860 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
861 (Output_data_plt_i386::add_eh_frame): New method to call it.
862 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
863 method.
864 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
865 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
866 method.
867 (Output_data_plt_i386::fill_plt_entry): New method to call it.
868 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
869 method instead of plt_entry_size.
870 (Output_data_plt_i386::plt_entry_size)
871 (Output_data_plt_i386::plt_eh_frame_fde_size)
872 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
873 (Output_data_plt_i386_standard): ... here, new class.
874 (Output_data_plt_i386_exec): New class.
875 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
876 (Output_data_plt_i386_exec::first_plt_entry): ... here.
877 (Output_data_plt_i386::exec_plt_entry): Move to ...
878 (Output_data_plt_i386_exec::plt_entry): ... here.
879 (Output_data_plt_i386_dyn): New class.
880 (Output_data_plt_i386::first_plt_entry): Move to ...
881 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
882 (Output_data_plt_i386::dyn_plt_entry): Move to ...
883 (Output_data_plt_i386_dyn::plt_entry): ... here.
884 (Target_i386::Target_i386): Take optional argument for the Target_info
885 pointer to use.
886 (Target_i386::do_make_data_plt): New virtual method.
887 (Target_i386::make_data_plt): New method to call it.
888 (Target_i386::make_plt_section): Use that.
889 Call this->plt_->add_eh_frame method here.
890 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
891 rather than plt_entry_size variable.
892 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
893 (Output_data_plt_i386::address_for_local): Likewise.
894 (Output_data_plt_i386::do_write): Likewise.
895 Move guts of PLT filling to...
896 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
897 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
898 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
899 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
900
901 2012-05-01 Cary Coutant <ccoutant@google.com>
902
903 * dwarf_reader.cc (Dwarf_die::read_attributes)
904 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
905 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
906 * reduced_debug_output.cc
907 (Output_reduced_debug_info_section::get_die_end): Remove
908 DW_FORM_GNU_ref_index. Add default case.
909
910 2012-04-26 Mark Wielaard <mjw@redhat.com>
911
912 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
913 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
914 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
915 DW_AT_high_pc as offset from DW_AT_low_pc.
916
917 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
918 * testsuite/Makefile.in: Regenerate.
919 * testsuite/gdb_index_test_3.c: New test source file.
920 * testsuite/gdb_index_test_3.sh: New test source file.
921
922 2012-04-25 Ian Lance Taylor <iant@google.com>
923
924 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
925 pointer.
926 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
927 as a class, not a struct.
928 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
929 (Target_arm::apply_cortex_a8_workaround): Likewise.
930 * gc.h: Declare Reloc_types as a struct, not a class.
931 * object.h: Declare Symbols_data as a struct.
932 * reloc.h: Declare Read_relocs_data as a struct.
933 * target.h: Declare Relocate_info as a struct.
934
935 2012-04-24 David S. Miller <davem@davemloft.net>
936
937 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
938 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
939 and R_SPARC_WPLT30.
940
941 2012-04-24 Cary Coutant <ccoutant@google.com>
942
943 * incremental-dump.cc (find_input_containing_global): Replace
944 magic number with symbolic constant.
945 (dump_incremental_inputs): Update version number.
946 * incremental.cc (Output_section_incremental_inputs): Update version
947 number; import symbolic constants from Incremental_inputs_reader.
948 (Incremental_inputs::create_data_sections): Align relocations
949 section correctly for 64-bit targets.
950 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
951 constants; add padding.
952 (Output_section_incremental_inputs::write_header): Add assert for
953 header_size.
954 (Output_section_incremental_inputs::write_input_files): Add assert
955 for input_entry_size.
956 (Output_section_incremental_inputs::write_info_blocks): Add padding;
957 add assert for object_info_size, input_section_entry_size,
958 global_sym_entry_size.
959 * incremental.h (Incremental_inputs_reader): Add symbolic constants
960 for data structure sizes; use them.
961 (Incremental_input_entry_reader): Import symbolic constants from
962 Incremental_inputs_reader; use them.
963
964 2012-04-23 David S. Miller <davem@davemloft.net>
965
966 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
967 and elf_flags_set_.
968 (Target_sparc::Target_sparc): Initialize new fields.
969 (Target_sparc::do_make_elf_object): New function.
970 (Target_sparc::do_adjust_elf_header): New function.
971
972 2012-04-23 Cary Coutant <ccoutant@google.com>
973
974 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
975 CU range table of gdb index.
976
977 2012-04-20 David S. Miller <davem@davemloft.net>
978
979 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
980 instead of false.
981
982 2012-04-16 David S. Miller <davem@davemloft.net>
983
984 * sparc.cc (Target_sparc::got_address): New function.
985 (Sparc_relocate_functions::gdop_hix22): New function.
986 (Sparc_relocate_functions::gdop_lox10): New function.
987 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
988 relocs.
989 (Target_sparc::Scan::local): Likewise if the global symbol is not
990 preemptible and is not IFUNC.
991 (Target_sparc::Relocate::relocate): Perform GOTDATA code
992 transformations for local and non-preemptible non-IFUNC global
993 symbols.
994
995 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
996 writing out 64-bit part of ranges.
997
998 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
999 -fpic and -fpie respectively.
1000 * Makefile.in: Regenerate.
1001
1002 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1003 (Target_sparc::Target_sparc): Initialize new field.
1004 (Target_sparc::do_plt_section_for_global): New function.
1005 (Target_sparc::do_plt_section_for_local): New function.
1006 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1007 (Target_sparc::make_plt_section): New function, broken out of
1008 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1009 (Target_sparc::make_plt_entry): Call make_plt_section.
1010 (Target_sparc::make_local_ifunc_plt_entry): New function.
1011 (Target_sparc::rela_ifunc_section): New function.
1012 (Target_sparc::plt_section): Remove const.
1013 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1014 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1015 and ifunc_count_ fields.
1016 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1017 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1018 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1019 (Output_data_plt_sparc::rela_ifunc): New function.
1020 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1021 (Output_data_plt_sparc::has_ifunc_section): New function.
1022 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1023 (Output_data_plt_sparc::address_for_global): New function.
1024 (Output_data_plt_sparc::address_for_local): New function.
1025 (Output_data_plt_sparc::plt_index_to_offset): New function.
1026 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1027 and entry_count.
1028 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1029 entry_count.
1030 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1031 R_SPARC_JMP_IREL to switch.
1032 (Target_sparc::Scan::check_non_pic): Likewise.
1033 (Target_sparc::Scan::local): Handle IFUNC symbols.
1034 (Target_sparc::Scan::local): Likewise.
1035 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1036 and plt_address_for_local.
1037 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1038 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1039
1040 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1041 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1042 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1043 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1044 global relocs too.
1045 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1046 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1047 calls.
1048 * sparc.cc (Target_sparc::Scan::global): Likewise.
1049 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1050
1051 2012-04-16 Cary Coutant <ccoutant@google.com>
1052
1053 * archive.cc (Library_base::should_include_member): Check for
1054 --export-dynamic-symbol.
1055 * options.h (class General_options): Add --export-dynamic-symbol.
1056 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1057 --export-dynamic-symbol.
1058 (Symbol_table::gc_mark_undef_symbols): Likewise.
1059 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1060
1061 2012-04-12 David S. Miller <davem@davemloft.net>
1062
1063 * sparc.cc (Reloc::wdisp10): New relocation method.
1064 (Reloc::h34): Likewise.
1065 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1066 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1067 R_SPARC_WDISP10.
1068 (Target_sparc::Scan::local): Likewise.
1069 (Target_sparc::Scan::global): Likewise.
1070 (Target_sparc::Relocate::relocate): Likewise.
1071
1072 2012-04-09 Cary Coutant <ccoutant@google.com>
1073
1074 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1075 low_pc == 0.
1076
1077 2012-04-06 Ian Lance Taylor <iant@google.com>
1078
1079 * timer.cc: #include <unistd.h>.
1080
1081 2012-04-06 Roland McGrath <mcgrathr@google.com>
1082
1083 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1084 * config.in: Regenerate.
1085 * configure: Regenerate.
1086
1087 2012-04-05 Nick Clifton <nickc@redhat.com>
1088
1089 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1090 (AM_LC_MESSAGES): Add.
1091 * aclocal.m4: Regenerate.
1092 * config.in: Regenerate.
1093 * configure: Regenerate.
1094
1095 2012-03-21 Cary Coutant <ccoutant@google.com>
1096
1097 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1098 * Makefile.in: Regenerate.
1099 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1100 (Sized_elf_reloc_mapper::symbol_section): New function.
1101 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1102 (make_elf_reloc_mapper): New function.
1103 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1104 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1105 (Dwarf_abbrev_table::do_get_abbrev): New function.
1106 (Dwarf_ranges_table::read_ranges_table): New function.
1107 (Dwarf_ranges_table::read_range_list): New function.
1108 (Dwarf_pubnames_table::read_section): New function.
1109 (Dwarf_pubnames_table::read_header): New function.
1110 (Dwarf_pubnames_table::next_name): New function.
1111 (Dwarf_die::Dwarf_die): New function.
1112 (Dwarf_die::read_attributes): New function.
1113 (Dwarf_die::skip_attributes): New function.
1114 (Dwarf_die::set_name): New function.
1115 (Dwarf_die::set_linkage_name): New function.
1116 (Dwarf_die::attribute): New function.
1117 (Dwarf_die::string_attribute): New function.
1118 (Dwarf_die::int_attribute): New function.
1119 (Dwarf_die::uint_attribute): New function.
1120 (Dwarf_die::ref_attribute): New function.
1121 (Dwarf_die::child_offset): New function.
1122 (Dwarf_die::sibling_offset): New function.
1123 (Dwarf_info_reader::check_buffer): New function.
1124 (Dwarf_info_reader::parse): New function.
1125 (Dwarf_info_reader::do_parse): New function.
1126 (Dwarf_info_reader::do_read_string_table): New function.
1127 (Dwarf_info_reader::lookup_reloc): New function.
1128 (Dwarf_info_reader::get_string): New function.
1129 (Dwarf_info_reader::visit_compilation_unit): New function.
1130 (Dwarf_info_reader::visit_type_unit): New function.
1131 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1132 Sized_elf_reloc_mapper.
1133 (Sized_dwarf_line_info::symbol_section): Remove function.
1134 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1135 (Sized_dwarf_line_info::read_line_mappings): Remove object
1136 parameter, adjust callers.
1137 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1138 * dwarf_reader.h: Include <sys/types.h>.
1139 (class Track_relocs): Remove forward declaration.
1140 (class Elf_reloc_mapper): New class.
1141 (class Sized_elf_reloc_mapper): New class.
1142 (class Dwarf_abbrev_table): New class.
1143 (class Dwarf_range_list): New class.
1144 (class Dwarf_ranges_table): New class.
1145 (class Dwarf_pubnames_table): New class.
1146 (class Dwarf_die): New class.
1147 (class Dwarf_info_reader): New class.
1148 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1149 (Sized_dwarf_line_info::symbol_section): Remove member function.
1150 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1151 base class.
1152 * gdb-index.cc: New source file.
1153 * gdb-index.h: New source file.
1154 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1155 and .debug_types sections, call Layout::add_to_gdb_index.
1156 (Sized_relobj_incr::do_section_name): Implement.
1157 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1158 return type; Implement.
1159 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1160 return type.
1161 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1162 parameter list and return type.
1163 (Sized_incr_dynobj::do_section_contents): Likewise.
1164 * layout.cc: Include gdb-index.h.
1165 (Layout::Layout): Initialize gdb_index_data_.
1166 (Layout::init_fixed_output_section): Check for .gdb_index section.
1167 (Layout::add_to_gdb_index): New function. Instantiate.
1168 * layout.h: Add forward declaration for class Gdb_index.
1169 (Layout::add_to_gdb_index): New member function.
1170 (Layout::gdb_index_data_): New data member.
1171 * main.cc: Include gdb-index.h.
1172 (main): Print statistics for gdb index.
1173 * object.cc (Object::section_contents): Move code into
1174 do_section_contents.
1175 (need_decompressed_section): Check for sections needed when building
1176 gdb index.
1177 (build_compressed_section_map): Likewise.
1178 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1179 gdb index.
1180 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1181 sections; call Layout::add_to_gdb_index.
1182 (Sized_relobj_file::do_decompressed_section_contents): Call
1183 do_section_contents directly.
1184 * object.h (Object::do_section_contents): Adjust parameter list and
1185 return type.
1186 (Object::do_decompressed_section_contents): Call do_section_contents
1187 directly.
1188 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1189 return type.
1190 * options.h (class General_options): Add --gdb-index option.
1191 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1192 list and return type.
1193 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1194 * reloc.h (Track_relocs::checkpoint): New function.
1195 (Track_relocs::reset): New function.
1196
1197 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1198 New test cases.
1199 * testsuite/Makefile.in: Regenerate.
1200 * testsuite/gdb_index_test.cc: New test source file.
1201 * testsuite/gdb_index_test_1.sh: New test source file.
1202 * testsuite/gdb_index_test_2.sh: New test source file.
1203
1204 2012-03-19 Doug Kwan <dougkwan@google.com>
1205
1206 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1207 (Target_arm::do_finalize_sections): Remove code which defines
1208 __exidx_start and __exidx_end. Make symbol table parameter
1209 anonymous as it is not used.
1210 * gold.cc (queue_middle_tasks): Call target hook to define any
1211 target-specific symbols.
1212 * target.h (Target::define_standard_symbols): New method.
1213 (Target::do_define_standard_symbols): Same.
1214 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1215 * testsuite/Makefile.in: Regenerate.
1216 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1217 and __exidx_end.
1218 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1219 relocations are generated for __exidx_start and __exidx_end.
1220
1221 2012-03-16 Doug Kwan <dougkwan@google.com>
1222
1223 * testsuite/Makefile.am: Disable test initpri3b.
1224 * testsuite/Makefile.in: Regenerate.
1225
1226 2012-03-15 Doug Kwan <dougkwan@google.com>
1227
1228 * arm.cc (Target_arm::got_section): Make .got section read-only
1229 if -z now is given.
1230
1231 2012-03-15 Ian Lance Taylor <iant@google.com>
1232
1233 PR gold/13850
1234 * layout.cc (Layout::make_output_section): Correctly mark
1235 SHT_INIT_ARRAY, et. al., as relro.
1236
1237 2012-03-14 Doug Kwan <dougkwan@google.com>
1238
1239 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1240 dynamic relocations for protected symbols in shared objects.
1241
1242 2012-03-13 Ian Lance Taylor <iant@google.com>
1243
1244 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1245 keep the larger alignment.
1246
1247 2012-03-12 Cary Coutant <ccoutant@google.com>
1248
1249 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1250 handling of DW_LNE_define_file.
1251
1252 2012-03-12 Cary Coutant <ccoutant@google.com>
1253
1254 * reduced_debug_output.cc
1255 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1256 codes to switch.
1257
1258 2012-02-29 Cary Coutant <ccoutant@google.com>
1259
1260 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1261
1262 2012-02-29 Cary Coutant <ccoutant@google.com>
1263
1264 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1265 Call Object::decompressed_section_contents.
1266 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1267 New dtor.
1268 (Sized_dwarf_line_info::buffer_start_): New data member.
1269 * merge.cc (Output_merge_data::do_add_input_section): Call
1270 Object::decompressed_section_contents.
1271 (Output_merge_string::do_add_input_section): Likewise.
1272 * object.cc (need_decompressed_section): New function.
1273 (build_compressed_section_map): Decompress sections needed later.
1274 (Sized_relobj_file::do_decompressed_section_contents): New function.
1275 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1276 * object.h (Object::decompressed_section_contents): New function.
1277 (Object::discard_decompressed_sections): New function.
1278 (Object::do_decompressed_section_contents): New function.
1279 (Object::do_discard_decompressed_sections): New function.
1280 (Compressed_section_info): New type.
1281 (Compressed_section_map): Include decompressed section contents.
1282 (Sized_relobj_file::do_decompressed_section_contents): New function.
1283 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1284
1285 2012-02-16 Cary Coutant <ccoutant@google.com>
1286
1287 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1288 * testsuite/Makefile.in: Regenerate.
1289
1290 2012-02-14 Cary Coutant <ccoutant@google.com>
1291
1292 * options.cc (General_options::finalize): Disallow -pie and -static.
1293
1294 2012-02-03 Doug Kwan <dougkwan@google.com>
1295
1296 * arm.cc (Arm_relocate_functions::abs8,
1297 Arm_relocate_functions::abs16): Use
1298 Bits::has_signed_unsigned_overflow32.
1299 (Arm_relocate_functions::thm_abs8): Correct range of
1300 overflow check.
1301 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1302 in assertions.
1303
1304 2012-02-02 Doug Kwan <dougkwan@google.com>
1305
1306 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1307 position independent outputs, not just shared objects.
1308
1309 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1310
1311 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1312 * configure: Regenerated.
1313
1314 2012-01-27 Ian Lance Taylor <iant@google.com>
1315
1316 * reloc.h (Bits): New class with static functions, copied from
1317 namespace utils in arm.cc.
1318 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1319 instead.
1320
1321 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1322
1323 * incremental.cc (write_info_blocks): Correct relocation offset.
1324
1325 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1326
1327 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1328 (Relocate::tls_gd_to_le): Likewise.
1329
1330 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1331
1332 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1333
1334 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1335
1336 * configure.ac: Check if -mcmodel=medium works.
1337 * configure: Regenerated.
1338
1339 2012-01-24 Cary Coutant <ccoutant@google.com>
1340
1341 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1342 definition and ...
1343 (read_unsigned_LEB_128_x): ... this new function.
1344 (read_signed_LEB_128): Replaced with inline definition and ...
1345 (read_signed_LEB_128_x): ... this new function.
1346 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1347 (read_unsigned_LEB_128): Add inline definition.
1348 (read_signed_LEB_128_x): New function.
1349 (read_signed_LEB_128): Add inline definition.
1350 * testsuite/Makefile.am (leb128_unittest): New unit test.
1351 * testsuite/Makefile.in: Regenerate.
1352 * testsuite/leb128_unittest.cc: New unit test.
1353
1354 2012-01-23 Ian Lance Taylor <iant@google.com>
1355
1356 PR gold/13617
1357 * i386.cc (Target_i386::do_code_fill): When using a jmp
1358 instruction, pad with nop instructions.
1359 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1360
1361 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1362
1363 * x86_64.cc (gc_process_relocs): Add typename on types used in
1364 template.
1365 (scan_relocs): Likewise.
1366 (relocate_section): Likewise.
1367 (apply_relocation): Likewise.
1368
1369 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1370
1371 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1372 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1373 under x32.
1374
1375 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1376
1377 * x86_64.cc: Initial support for x32.
1378
1379 2012-01-03 Cary Coutant <ccoutant@google.com>
1380
1381 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1382 Use abstract base class for GOT.
1383 * gold/output.h (class Output_data_got_base): New abstract base class.
1384 (class Output_data_got): Derive from new base class, adjust ctors.
1385 (Output_data_got::reserve_slot): Make virtual; rename to
1386 do_reserve_slot; Adjust callers.
1387 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1388 pointer to abstract base class.
1389 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1390
1391 2011-12-18 Ian Lance Taylor <iant@google.com>
1392
1393 * object.h (Relobj::local_symbol_value): New function.
1394 (Relobj::local_plt_offset): New function.
1395 (Relobj::local_has_got_offset): New function.
1396 (Relobj::local_got_offset): New function.
1397 (Relobj::set_local_got_offset): New function.
1398 (Relobj::do_local_symbol_value): New pure virtual function.
1399 (Relobj::do_local_plt_offset): Likewise.
1400 (Relobj::do_local_has_got_offset): Likewise.
1401 (Relobj::do_local_got_offset): Likewise.
1402 (Relobj::do_set_local_got_offset): Likewise.
1403 (Sized_relobj::do_local_has_got_offset): Rename from
1404 local_has_got_offset.
1405 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1406 (Sized_relobj::do_set_local_got_offset): Rename from
1407 set_local_got_offset.
1408 (Sized_relobj_file::do_local_plt_offset): Rename from
1409 local_plt_offset.
1410 (Sized_relobj_file::do_local_symbol_value): New function.
1411 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1412 local_plt_offset.
1413 * output.cc (Output_data_got::Got_entry::write): Change object to
1414 Relobj. Use local_symbol_value.
1415 (Output_data_got::add_global_with_rel): Change rel_dyn to
1416 Output_data_reloc_generic*. Use add_global_generic.
1417 (Output_data_got::add_global_with_rela): Remove. Change all
1418 callers to use add_global_with_rel.
1419 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1420 Output_data_reloc_generic*. Use add_global_generic.
1421 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1422 callers to use add_global_pair_with_rel.
1423 (Output_data_got::add_local): Change object to Relobj*.
1424 (Output_data_got::add_local_plt): Likewise.
1425 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1426 change rel_dyn to Output_data_reloc_generic*. Use
1427 add_local_generic.
1428 (Output_data_got::add_local_with_rela): Remove. Change all
1429 callers to use all_local_with_rel.
1430 (Output_data_got::add_local_pair_with_rel): Change object to
1431 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1432 add_output_section_generic.
1433 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1434 callers to use add_local_pair_with_rel.
1435 (Output_data_got::reserve_local): Change object to Relobj*.
1436 * output.h: (class Output_data_reloc_generic): Add pure virtual
1437 declarations for add_global_generic, add_local_generic,
1438 add_output_section_generic.
1439 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1440 functions for Output_data_reloc_generic. Update declarations for
1441 changes listed in output.cc.
1442 (class Output_data_got): Change template parameter to got_size.
1443 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1444 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1445 function.
1446 (Sized_relobj_incr::do_local_plt_offset): New function.
1447 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1448 add_global_generic.
1449
1450 2011-12-17 Cary Coutant <ccoutant@google.com>
1451
1452 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1453 * resolve.cc (Symbol_table::resolve): Likewise.
1454 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1455 arrays.
1456 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1457
1458 2011-12-16 Ian Lance Taylor <iant@google.com>
1459
1460 * output.h (Output_data_reloc_generic::add): Only call
1461 add_dynamic_reloc if this is a dynamic reloc section.
1462
1463 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1464
1465 PR gold/13505
1466 * target-reloc.h (apply_relocation): Replace <64, false> with
1467 <size, big_endian>.
1468
1469 2011-11-25 Nick Clifton <nickc@redhat.com>
1470
1471 * po/it.po: New Italian translation.
1472
1473 2011-11-17 Sterling Augustine <saugustine@google.com>
1474
1475 * script.cc (script_include_directive): Implement.
1476 (read_script_file): New local variables name and search_path. Update
1477 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1478 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1479 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1480
1481 2011-11-11 Sterling Augustine <saugustine@google.com>
1482
1483 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1484 (file_or_sections_cmd): Likewise.
1485
1486 2011-11-11 Doug Kwan <dougkwan@google.com>
1487
1488 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1489 if --just-symbols is given.
1490
1491 2011-11-10 Doug Kwan <dougkwan@google.com>
1492
1493 PR gold/13362
1494 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1495 when processing data relocs.
1496 * reloc.h (Relocate_functions::rel_unaligned): New method.
1497 (Relocate_functions::pcrel_unaligned): Ditto.
1498 (Relocate_functions::rel32_unaligned): Ditto.
1499 (Relocate_functions::pcrel32_unaligned): Ditto.
1500
1501 2011-11-09 Doug Kwan <dougkwan@google.com>
1502
1503 PR gold/13362
1504 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1505 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1506 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1507 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1508 (Relocate_functions::rel_unaligned): New.
1509 (Relocate_functions::rel32_unaligned): New.
1510 * target-reloc.h (relocate_for_relocatable): Add code to handle
1511 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1512 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1513 arm_unaligned_reloc_r): New targets.
1514 * testsuite/Makefile.in: Regenerate.
1515 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1516 linking.
1517
1518 2011-11-02 Ian Lance Taylor <iant@google.com>
1519
1520 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1521 NATIVE_LINKER.
1522 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1523 * options.cc (General_options::finalize): Use library search path
1524 from configure script if specified. If not native and no sysroot,
1525 only search TOOLLIBDIR.
1526 * options.h (Search_directory::Search_directory): Change name to
1527 const std::string&.
1528 (General_options::add_to_library_path_with_sysroot): Change arg to
1529 const std::string&.
1530 * configure, Makefile.in, config.in: Rebuild.
1531
1532 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1533
1534 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1535 we are working around the ARM1176 Erratum.
1536 * options.h (General_options::fix_arm1176): Add option.
1537 * testsuite/Makefile.am: Add testcases, and keep current ones
1538 working.
1539 * testsuite/Makefile.in: Regenerate.
1540 * testsuite/arm_fix_1176.s: New file.
1541 * testsuite/arm_fix_1176.sh: Likewise.
1542
1543 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1544
1545 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1546 may_use_blx_.
1547 (Target_arm::may_use_blx): Remove method.
1548 (Target_arm::set_may_use_blx): Likewise.
1549 (Target_arm::may_use_v4t_interworking): New method.
1550 (Target_arm::may_use_v5t_interworking): Likewise.
1551 (Target_arm::may_use_blx_): Remove member variable.
1552 (Arm_relocate_functions::arm_branch_common): Check for v5T
1553 interworking.
1554 (Arm_relocate_functions::thumb_branch_common): Likewise.
1555 (Reloc_stub::stub_type_for_reloc): Likewise.
1556 (Target_arm::do_finalize_sections): Correct interworking checks.
1557 * testsuite/Makefile.am: Add new tests.
1558 * testsuite/Makefile.in: Regenerate.
1559 * testsuite/arm_farcall_arm_arm.s: New test.
1560 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1561 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1562 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1563 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1564 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1565 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1566 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1567
1568 2011-10-31 Cary Coutant <ccoutant@google.com>
1569
1570 PR gold/13023
1571 * expression.cc (Expression::eval_with_dot): Add
1572 is_section_dot_assignment parameter.
1573 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1574 absolute and assigning to dot within a section.
1575 * script-sections.cc
1576 (Output_section_element_assignment::set_section_addresses): Pass
1577 dot_section to set_if_absolute.
1578 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1579 as is_section_dot_assignment flag to eval_with_dot.
1580 (Output_section_element_dot_assignment::set_section_addresses):
1581 Likewise.
1582 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1583 parameter. Also set value if relative to dot_section; set the
1584 symbol's output_section.
1585 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1586 parameter. Adjust all callers.
1587 (Expression::eval_maybe_dot): Likewise.
1588 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1589 Adjust all callers.
1590 * testsuite/script_test_2.t: Test assignment of an absolute value
1591 to dot within an output section element.
1592
1593 2011-10-31 Cary Coutant <ccoutant@google.com>
1594
1595 * options.h (class General_options): Add --[no-]gnu-unique options.
1596 * symtab.cc (Symbol_table::sized_write_globals): Convert
1597 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1598
1599 2011-10-31 Cary Coutant <ccoutant@google.com>
1600
1601 PR gold/13359
1602 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1603 unnecessary assertion.
1604 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1605
1606 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1607
1608 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1609 gc_mark_symbol.
1610 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1611 gc_mark_symbol.
1612 Change to just keep the section associated with symbol.
1613 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1614 they are externally visible and --export-dynamic is turned on.
1615 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1616
1617 2011-10-19 Ian Lance Taylor <iant@google.com>
1618
1619 PR gold/13163
1620 * script-sections.cc
1621 (Output_section_element_dot_assignment::needs_output_section): New
1622 function.
1623
1624 2011-10-19 Ian Lance Taylor <iant@google.com>
1625
1626 PR gold/13204
1627 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1628 --section-start option was seen.
1629 * options.h (General_options::any_section_start): New function.
1630
1631 2011-10-18 David S. Miller <davem@davemloft.net>
1632
1633 PR binutils/13301
1634 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1635 member to track relocation locations that have moved during TLS
1636 reloc optimizations.
1637 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1638 (Target_sparc::Relocate::relocate): Adjust view down by 4
1639 bytes if it matches reloc_adjust_addr_.
1640 (Target_sparc::Relocate::relocate_tls): Always move the
1641 __tls_get_addr call delay slot instruction forward 4 bytes when
1642 performing relaxation.
1643
1644 2011-10-18 Cary Coutant <ccoutant@google.com>
1645
1646 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1647 (Output_file::map_no_anonymous): Check for non-zero
1648 return code from posix_fallocate.
1649
1650 2011-10-17 Cary Coutant <ccoutant@google.com>
1651
1652 PR gold/13245
1653 * plugin.cc (is_visible_from_outside): Check for symbols
1654 referenced from dynamic objects.
1655 * resolve.cc (Symbol_table::resolve): Don't count references
1656 from dynamic objects as references from real ELF files.
1657 * testsuite/plugin_test_2.sh: Adjust expected result.
1658
1659 2011-10-17 Cary Coutant <ccoutant@google.com>
1660
1661 * gold.cc: Include timer.h.
1662 (queue_middle_tasks): Stamp time.
1663 (queue_final_tasks): Likewise.
1664 * main.cc (main): Store timer in parameters. Print timers
1665 for each pass.
1666 * parameters.cc (Parameters::Parameters): Initialize timer_.
1667 (Parameters::set_timer): New function.
1668 (set_parameters_timer): New function.
1669 * parameters.h (Parameters::set_timer): New function.
1670 (Parameters::timer): New function.
1671 (Parameters::timer_): New data member.
1672 (set_parameters_timer): New function.
1673 * timer.cc (Timer::stamp): New function.
1674 (Timer::get_pass_time): New function.
1675 * timer.h (Timer::stamp): New function.
1676 (Timer::get_pass_time): New function.
1677 (Timer::pass_times_): New data member.
1678
1679 2011-10-17 Cary Coutant <ccoutant@google.com>
1680
1681 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1682 task for members of lib groups.
1683
1684 2011-10-17 Cary Coutant <ccoutant@google.com>
1685
1686 PR gold/13288
1687 * fileread.cc (File_read::find_view): Add assert.
1688 (File_read::make_view): Move bounds check (replace with assert)...
1689 (File_read::find_or_make_view): ... to here.
1690
1691 2011-10-12 Cary Coutant <ccoutant@google.com>
1692
1693 * output.cc (Output_file::open_base_file): Handle case where
1694 ::read returns less than requested size.
1695
1696 2011-10-10 Cary Coutant <ccoutant@google.com>
1697
1698 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1699 Initialize defined_count_.
1700 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1701 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1702 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1703 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1704 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1705 * incremental.h (Sized_relobj_incr::defined_count_): New data
1706 member.
1707 (Sized_incr_dynobj::defined_count_): New data member.
1708 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1709 Return zeroes instead of internal error.
1710
1711 2011-10-10 Cary Coutant <ccoutant@google.com>
1712
1713 PR gold/13249
1714 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1715 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1716 * output.h (class Output_reloc): Add use_plt_offset flag.
1717 (Output_reloc::type_): Adjust size of bit field.
1718 (Output_reloc::use_plt_offset_): New bit field.
1719 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1720 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1721 flag. Adjust all callers.
1722 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1723 creating RELATIVE relocations.
1724
1725 2011-10-10 Nick Clifton <nickc@redhat.com>
1726
1727 * po/es.po: Updated Spanish translation.
1728 * po/fi.po: Updated Finnish translation.
1729
1730 2011-10-03 Diego Novillo <dnovillo@google.com>
1731
1732 * options.cc (parse_uint): Fix dereference of RETVAL.
1733
1734 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1735
1736 * layout.h (section_order_map_): New member.
1737 (get_section_order_map): New member function.
1738 * output.cc (Output_section::add_input_section): Check for patterns
1739 only when --section-ordering-file is specified.
1740 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1741 output_sections have been formed.
1742 * layout.cc (Layout_Layout): Initialize section_order_map_.
1743 * plugin.cc (update_section_order): Store order in order_map. Do not
1744 update the order.
1745 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1746 * testsuite/Makefile.in: Regenerate.
1747 * testsuite/plugin_section_order.c: New file.
1748 * testsuite/plugin_final_layout.cc: New file.
1749 * testsuite/plugin_final_layout.sh: New file.
1750
1751 2011-09-29 Cary Coutant <ccoutant@google.com>
1752
1753 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1754 Check for NULL.
1755 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1756 symbols during incremental update.
1757 (Symbol_table::add_from_dynobj): Likewise.
1758
1759 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1760 Ian Lance Taylor <iant@google.com>
1761
1762 * symtab.cc (Symbol_table::define_special_symbol): Always
1763 canonicalize version string.
1764
1765 2011-09-26 Cary Coutant <ccoutant@google.com>
1766
1767 * gold.cc (queue_initial_tasks): Move option checks ...
1768 * options.cc (General_options::finalize): ... to here. Disable
1769 some options; make others fatal.
1770
1771 2011-09-26 Cary Coutant <ccoutant@google.com>
1772
1773 gcc PR lto/47247
1774 * plugin.cc (get_symbols_v2): New function.
1775 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1776 (is_referenced_from_outside): New function.
1777 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1778 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1779 (get_symbols): Pass version parameter.
1780 (get_symbols_v2): New function.
1781 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1782 parameter.
1783 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1784 (onload): Add LDPT_GET_SYMBOLS_V2.
1785 (all_symbols_read_hook): Use get_symbols_v2; check for
1786 LDPR_PREVAILING_DEF_IRONLY_EXP.
1787 * testsuite/plugin_test_3.sh: Update expected results.
1788
1789 2011-09-23 Simon Baldwin <simonb@google.com>
1790
1791 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1792 configuration options.
1793 * configure: Regenerate.
1794 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1795 * Makefile.in: Regenerate.
1796 * testsuite/Makefile.in: Regenerate.
1797
1798 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1799
1800 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1801
1802 2011-09-19 Cary Coutant <ccoutant@google.com>
1803
1804 * incremental.cc (can_incremental_update): Fix typo in comment.
1805 * incremental.h (can_incremental_update): Likewise.
1806
1807 2011-09-18 Cary Coutant <ccoutant@google.com>
1808
1809 * incremental.cc (can_incremental_update): New function.
1810 * incremental.h (can_incremental_update): New function.
1811 * layout.cc (Layout::init_fixed_output_section): Call it.
1812 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1813 * object.cc (Sized_relobj_file::do_layout): Call
1814 can_incremental_update.
1815
1816 2011-09-13 Cary Coutant <ccoutant@google.com>
1817
1818 * configure.ac: Check for glibc support for gnu_indirect_function
1819 support with static linking, setting automake conditional
1820 IFUNC_STATIC.
1821 * Makefile.in: Regenerate.
1822 * configure: Regenerate.
1823
1824 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1825 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1826 for IFUNC_STATIC.
1827 * testsuite/Makefile.in: Regenerate.
1828
1829 2011-09-13 Cary Coutant <ccoutant@google.com>
1830
1831 * incremental.cc (Sized_relobj_incr::do_layout): Call
1832 report_comdat_group for kept comdat sections.
1833 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1834 * testsuite/Makefile.in: Regenerate.
1835 * testsuite/incr_comdat_test_1.cc: New source file.
1836 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1837 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1838 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1839
1840 2011-09-13 Ian Lance Taylor <iant@google.com>
1841
1842 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1843 variable external_symbols_offset.
1844
1845 2011-09-12 Ian Lance Taylor <iant@google.com>
1846
1847 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1848 triggered if object has no symbols.
1849
1850 2011-09-09 David S. Miller <davem@davemloft.net>
1851
1852 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1853 (Output_fill_debug_line::do_write): Likewise.
1854
1855 2011-08-29 Cary Coutant <ccoutant@google.com>
1856
1857 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1858 casts to match formatting specs.
1859 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1860
1861 2011-08-26 Cary Coutant <ccoutant@google.com>
1862
1863 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1864 remaining hole size when allocating.
1865 (Layout::make_output_section): Set fill methods for debug sections.
1866 * layout.h (Free_list::Free_list_node): Move from private to
1867 public.
1868 (Free_list::set_min_hole_size): New function.
1869 (Free_list::begin, Free_list::end): New functions.
1870 (Free_list::min_hole_): New data member.
1871 * output.cc: Include dwarf.h.
1872 (Output_fill_debug_info::do_minimum_hole_size): New function.
1873 (Output_fill_debug_info::do_write): New function.
1874 (Output_fill_debug_line::do_minimum_hole_size): New function.
1875 (Output_fill_debug_line::do_write): New function.
1876 (Output_section::Output_section): Initialize new data member.
1877 (Output_section::set_final_data_size): Ensure patch space is larger
1878 than minimum hole size.
1879 (Output_section::do_write): Fill holes in debug sections.
1880 * output.h (Output_fill): New class.
1881 (Output_fill_debug_info): New class.
1882 (Output_fill_debug_line): New class.
1883 (Output_section::set_free_space_fill): New function.
1884 (Output_section::free_space_fill_): New data member.
1885 * testsuite/Makefile.am (incremental_test_3): Add
1886 --incremental-patch option.
1887 (incremental_test_4): Likewise.
1888 (incremental_test_5): Likewise.
1889 (incremental_test_6): Likewise.
1890 (incremental_copy_test): Likewise.
1891 (incremental_common_test_1): Likewise.
1892 * testsuite/Makefile.in: Regenerate.
1893
1894 2011-08-26 Nick Clifton <nickc@redhat.com>
1895
1896 * po/es.po: Updated Spanish translation.
1897
1898 2011-08-01 Cary Coutant <ccoutant@google.com>
1899
1900 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1901 * gold/testsuite/Makefile.in: Regenerate.
1902 * gold/testsuite/justsyms_exec.c: New source file.
1903 * gold/testsuite/justsyms_lib.c: New source file.
1904
1905 2011-08-01 Cary Coutant <ccoutant@google.com>
1906
1907 * layout.cc (Layout::set_segment_offsets): Don't realign text
1908 segment if -Ttext was specified.
1909 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1910 file type.
1911 * object.h (Sized_relobj_file::e_type): New function.
1912 (Sized_relobj_file::e_type_): New data member.
1913 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1914 base address for ET_EXEC files.
1915 * target.cc (Target::do_make_elf_object_implementation): Allow
1916 ET_EXEC files with --just-symbols option.
1917
1918 2011-07-28 Cary Coutant <ccoutant@google.com>
1919
1920 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1921 Add thread_number parameter.
1922 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1923 * workqueue-threads.cc
1924 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1925 current thread if its thread number is greater than desired thread
1926 count.
1927 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1928 Add thread_number parameter.
1929 (Workqueue::should_cancel_thread): Likewise.
1930 (Workqueue::find_runnable_or_wait): Pass thread_number to
1931 should_cancel_thread.
1932 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1933 parameter.
1934
1935 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1936
1937 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1938 only after checking if it cannot be forced local.
1939 * symtab.h (is_externally_visible): Check if the symbol is not forced
1940 local.
1941
1942 2011-07-15 Ian Lance Taylor <iant@google.com>
1943
1944 * options.h (class General_options): Add --print-output-format.
1945 Move -EL next to -EB, for better --help output.
1946 * target-select.cc: Include <cstdio>, "options.h", and
1947 "parameters.h".
1948 (Target_selector::do_target_bfd_name): New function.
1949 (print_output_format): New function.
1950 * target-select.h (class Target_selector): Update declarations.
1951 (Target_selector::target_bfd_name): New function.
1952 (print_output_format): Declare.
1953 * main.cc: Include "target-select.h".
1954 (main): Handle --print-output-format.
1955 * gold.cc: Include "target-select.h".
1956 (queue_initial_tasks): Handle --print-output-format when there are
1957 no input files.
1958 * parameters.cc (parameters_force_valid_target): Give a better
1959 error message if -EB/-EL does not match target.
1960 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1961 function.
1962
1963 2011-07-15 Ian Lance Taylor <iant@google.com>
1964
1965 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1966 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1967 (Output_data_plt_i386::do_write): Write address of .dynamic
1968 section to first entry in .got.plt section.
1969 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1970 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1971 Initialize layout_.
1972 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1973 section to first entry in .got.plt section.
1974 * layout.h (Layout::dynamic_section): New function.
1975
1976 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1977
1978 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1979 to claim_file call.
1980 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1981 input_section_position_, and input_section_glob_.
1982 (read_layout_from_file): Call function section_ordering_specified.
1983 * layout.h (is_section_ordering_specified): New function.
1984 (section_ordering_specified): New function.
1985 (section_ordering_specified_): New boolean member.
1986 * main.cc(main): Call load_plugins after layout object is defined.
1987 * output.cc (Output_section::add_input_section): Use
1988 function section_ordering_specified to check if section ordering is
1989 needed.
1990 * output.cc (Output_section::add_relaxed_input_section): Use
1991 function section_ordering_specified to check if section ordering is
1992 needed.
1993 (Output_section::update_section_layout): New function.
1994 (Output_section::sort_attached_input_sections): Check if input section
1995 must be reordered.
1996 * output.h (Output_section::update_section_layout): New function.
1997 * plugin.cc (get_section_count): New function.
1998 (get_section_type): New function.
1999 (get_section_name): New function.
2000 (get_section_contents): New function.
2001 (update_section_order): New function.
2002 (allow_section_ordering): New function.
2003 (Plugin::load): Add the new interfaces to the transfer vector.
2004 (Plugin_manager::load_plugins): New parameter.
2005 (Plugin_manager::all_symbols_read): New parameter.
2006 (Plugin_manager::claim_file): New parameter. Save the elf object for
2007 unclaimed objects.
2008 (Plugin_manager::get_elf_object): New function.
2009 (Plugin_manager::get_view): Change to directly use the bool to check
2010 if get_view is called from claim_file_hook.
2011 * plugin.h (input_objects): New function
2012 (Plugin__manager::load_plugins): New parameter.
2013 (Plugin_manager::claim_file): New parameter.
2014 (Plugin_manager::get_elf_object): New function.
2015 (Plugin_manager::in_claim_file_handler): New function.
2016 (Plugin_manager::in_claim_file_handler_): New member.
2017 (layout): New function.
2018 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2019 handler with an extra parameter. Make the elf object before calling
2020 claim_file handler.
2021 * testsuite/plugin_test.c (get_section_count): New function pointer.
2022 (get_section_type): New function pointer.
2023 (get_section_name): New function pointer.
2024 (get_section_contents): New function pointer.
2025 (update_section_order): New function pointer.
2026 (allow_section_ordering): New function pointer.
2027 (onload): Check if the new interfaces exist.
2028
2029 2011-07-13 Ian Lance Taylor <iant@google.com>
2030
2031 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2032 relro section.
2033 * x86_64.cc (Target_x86_64::got_section): Likewise.
2034 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2035 (relro_now_test_SOURCES): New variable.
2036 (relro_now_test_DEPENDENCIES): New variable.
2037 (relro_now_test_LDFLAGS): New variable.
2038 (relro_now_test_LDADD): New variable.
2039 (relro_now_test.so): New target.
2040 * testsuite/Makefile.in: Rebuild.
2041
2042 2011-07-12 Ian Lance Taylor <iant@google.com>
2043
2044 PR gold/12980
2045 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2046 GLOB_DAT relocation rather than a RELATIVE relocation for a
2047 protected symbol when creating a shared library.
2048 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2049 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2050 * testsuite/protected_main_1.cc (main): Test that protected
2051 function has same address.
2052
2053 2011-07-11 Ian Lance Taylor <iant@google.com>
2054
2055 PR gold/12979
2056 * options.h (class General_options): Add -Bgroup.
2057 * options.cc (General_options::finalize): If -Bgroup is set,
2058 default to --unresolved-symbols=report-all.
2059 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2060 * target-reloc.h (issue_undefined_symbol_error): Handle
2061 --unresolved-symbols=report-all.
2062
2063 2011-07-08 Ian Lance Taylor <iant@google.com>
2064
2065 PR gold/11985
2066 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2067 if linker script discards key sections.
2068 (Layout::create_dynamic_symtab): Likewise.
2069 (Layout::assign_local_dynsym_offsets): Likewise.
2070 (Layout::sized_create_version_sections): Likewise.
2071 (Layout::create_interp): Likewise.
2072 (Layout::finish_dynamic_section): Likewise.
2073 (Layout::set_dynamic_symbol_size): Likewise.
2074
2075 2011-07-08 Ian Lance Taylor <iant@google.com>
2076
2077 PR gold/12386
2078 * options.h (class General_options): Add --unresolved-symbols.
2079 * target-reloc.h (issue_undefined_symbol_error): Check
2080 --unresolved-symbols. Add comments.
2081
2082 2011-07-08 Ian Lance Taylor <iant@google.com>
2083
2084 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2085 expression more complex.
2086
2087 2011-07-08 Ian Lance Taylor <iant@google.com>
2088
2089 PR gold/11317
2090 * target-reloc.h (issue_undefined_symbol_error): New inline
2091 function, broken out of relocate_section.
2092 (relocate_section): Call issue_undefined_symbol_error.
2093 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2094 there is no TLS segment if we are about to issue an undefined
2095 symbol error.
2096 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2097
2098 2011-07-08 Ian Lance Taylor <iant@google.com>
2099
2100 PR gold/12279
2101 * resolve.cc (Symbol_table::should_override): Add fromtype
2102 parameter. Change all callers. Give error when linking together
2103 TLS and non-TLS symbol.
2104 (Symbol_table::should_override_with_special): Add fromtype
2105 parameter. Change all callers.
2106 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2107 there is no TLS segment if we have reported some errors.
2108 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2109
2110 2011-07-08 Ian Lance Taylor <iant@google.com>
2111
2112 PR gold/12372
2113 * target.h (Target::plt_address_for_global): New function.
2114 (Target::plt_address_for_local): New function.
2115 (Target::plt_section_for_global): Remove.
2116 (Target::plt_section_for_local): Remove.
2117 (Target::do_plt_address_for_global): New virtual function.
2118 (Target::do_plt_address_for_local): New virtual function.
2119 (Target::do_plt_section_for_global): Remove.
2120 (Target::do_plt_section_for_local): Remove.
2121 (Target::register_global_plt_entry): Add Symbol_table and Layout
2122 parameters.
2123 * output.cc (Output_data_got::Got_entry::write): Use
2124 plt_address_for_global and plt_address_for_local.
2125 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2126 address of output section.
2127 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2128 got_irelative_, and irelative_count_ fields. Update
2129 declarations.
2130 (Output_data_plt_i386::has_irelative_section): New function.
2131 (Output_data_plt_i386::entry_count): Add irelative_count_.
2132 (Output_data_plt_i386::set_final_data_size): Likewise.
2133 (class Target_i386): Add got_irelative_ and rel_irelative_
2134 fields. Update declarations.
2135 (Target_i386::Target_i386): Initialize new fields.
2136 (Target_i386::do_plt_address_for_global): New function replacing
2137 do_plt_section_for_global.
2138 (Target_i386::do_plt_address_for_local): New function replacing
2139 do_plt_section_for_local.
2140 (Target_i386::got_section): Create got_irelative_.
2141 (Target_i386::rel_irelative_section): New function.
2142 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2143 fields. Don't define __rel_iplt_{start,end}.
2144 (Output_data_plt_i386::add_entry): Add symtab and layout
2145 parameters. Change all callers. Use different PLT and GOT for
2146 IFUNC symbols.
2147 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2148 layout parameters. Change all callers. Use different PLT and
2149 GOT.
2150 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2151 (Output_data_plt_i386::rel_irelative): New function.
2152 (Output_data_plt_i386::address_for_global): New function.
2153 (Output_data_plt_i386::address_for_local): New function.
2154 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2155 IRELATIVE GOT when changing IFUNC GOT entries.
2156 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2157 reloc.
2158 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2159 if we didn't create an IRELATIVE GOT.
2160 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2161 plt_address_for_local.
2162 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2163 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2164 got_irelative_, and irelative_count_ fields. Update
2165 declarations.
2166 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2167 Initialize new fields. Remove symtab parameter. Change all
2168 callers.
2169 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2170 irelative_count_.
2171 (Output_data_plt_x86_64::has_irelative_section): New function.
2172 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2173 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2174 fields. Update declarations.
2175 (Target_x86_64::Target_x86_64): Initialize new fields.
2176 (Target_x86_64::do_plt_address_for_global): New function replacing
2177 do_plt_section_for_global.
2178 (Target_x86_64::do_plt_address_for_local): New function replacing
2179 do_plt_section_for_local.
2180 (Target_x86_64::got_section): Create got_irelative_.
2181 (Target_x86_64::rela_irelative_section): New function.
2182 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2183 all callers. Don't create __rel_iplt_{start,end}.
2184 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2185 parameters. Change all callers. Use different PLT and GOT for
2186 IFUNC symbols.
2187 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2188 layout parameters. Change all callers. Use different PLT and
2189 GOT.
2190 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2191 parameters. Change all callers. Use different PLT and GOT for
2192 IFUNC symbols.
2193 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2194 (Output_data_plt_x86_64::rela_irelative): New function.
2195 (Output_data_plt_x86_64::address_for_global): New function.
2196 (Output_data_plt_x86_64::address_for_local): New function.
2197 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2198 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2199 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2200 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2201 parameters.
2202 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2203 reloc.
2204 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2205 symbols if we didn't create an IRELATIVE GOT.
2206 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2207 plt_address_for_local.
2208 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2209 * testsuite/ifuncvar1.c: New test file.
2210 * testsuite/ifuncvar2.c: New test file.
2211 * testsuite/ifuncvar3.c: New test file.
2212 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2213 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2214 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2215 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2216 * testsuite/Makefile.in: Rebuild.
2217
2218 2011-07-07 Cary Coutant <ccoutant@google.com>
2219
2220 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2221 (two_file_test_1_ndebug.o): Likewise.
2222 (two_file_test_1b_ndebug.o): Likewise.
2223 (two_file_test_2_ndebug.o): Likewise.
2224 (two_file_test_main_ndebug.o): Likewise.
2225 (incremental_test_2): Link with no-debug versions.
2226
2227 2011-07-06 Cary Coutant <ccoutant@google.com>
2228
2229 * gold/incremental.cc
2230 (Output_section_incremental_inputs::write_info_blocks): Check for
2231 hidden and internal symbols.
2232
2233 2011-07-06 Cary Coutant <ccoutant@google.com>
2234
2235 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2236 Check disposition for startup file.
2237 (Incremental_inputs::report_command_line): Ignore
2238 --incremental-startup-unchanged option.
2239 * options.cc (General_options::parse_incremental_startup_unchanged):
2240 New function.
2241 (General_options::General_options): Initialize new data member.
2242 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2243 (General_options): Add --incremental-startup-unchanged option.
2244 (General_options::incremental_startup_disposition): New function.
2245 (General_options::incremental_startup_disposition_): New data member.
2246
2247 2011-07-06 Cary Coutant <ccoutant@google.com>
2248
2249 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2250 input file index to Script_info ctor.
2251 (Sized_incremental_binary::do_file_has_changed): Find the
2252 command-line argument for files named in scripts.
2253 * incremental.h (Script_info::Script_info): New ctor
2254 with input file index.
2255 (Script_info::input_file_index): New function.
2256 (Script_info::input_file_index_): New data member.
2257 (Incremental_binary::get_library): Add const.
2258 (Incremental_binary::get_script_info): Add const.
2259 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2260 * testsuite/Makefile.am (incremental_test_5): New test case.
2261 (incremental_test_6): New test case.
2262 * testsuite/Makefile.in: Regenerate.
2263
2264 2011-07-06 Cary Coutant <ccoutant@google.com>
2265
2266 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2267 debug output when command lines differ.
2268
2269 2011-07-06 Cary Coutant <ccoutant@google.com>
2270
2271 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2272 --incremental-patch option.
2273 * layout.cc (Free_list::allocate): Extend allocation beyond original
2274 end if enabled.
2275 (Layout::make_output_section): Mark sections that should get
2276 patch space.
2277 * options.cc (parse_percent): New function.
2278 * options.h (parse_percent): New function.
2279 (DEFINE_percent): New macro.
2280 (General_options): Add --incremental-patch option.
2281 * output.cc (Output_section::Output_section): Initialize new data
2282 members.
2283 (Output_section::add_input_section): Print section name when out
2284 of patch space.
2285 (Output_section::add_output_section_data): Likewise.
2286 (Output_section::set_final_data_size): Add patch space when
2287 doing --incremental-full.
2288 (Output_section::do_reset_address_and_file_offset): Remove patch
2289 space.
2290 (Output_segment::set_section_list_addresses): Print debug output
2291 only if --incremental-update.
2292 * output.h (Output_section::set_is_patch_space_allowed): New function.
2293 (Output_section::is_patch_space_allowed_): New data member.
2294 (Output_section::patch_space_): New data member.
2295 * parameters.cc (Parameters::incremental_full): New function.
2296 * parameters.h (Parameters::incremental_full): New function
2297 * testsuite/Makefile.am (incremental_test_2): Add test for
2298 --incremental-patch option.
2299 * testsuite/Makefile.in: Regenerate.
2300 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2301 (t18): Remove function body.
2302
2303 2011-07-05 Doug Kwan <dougkwan@google.com>
2304
2305 PR gold/12771
2306 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2307 Arm_Address type for relocation result.
2308 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2309 overflow check.
2310 (Arm_relocate_functions::abs32): Use unaligned access.
2311 (Arm_relocate_functions::rel32): Ditto.
2312 (Arm_relocate_functions::prel31): Ditto.
2313 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2314 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2315 static data relocations.
2316 * testsuite/Makefile.in: Regnerate.
2317 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2318
2319 2011-07-05 Ian Lance Taylor <iant@google.com>
2320
2321 PR gold/12392
2322 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2323 symbols if necessary.
2324 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2325
2326 2011-07-05 Ian Lance Taylor <iant@google.com>
2327
2328 PR gold/12952
2329 * resolve.cc (Symbol::override_base_with_special): Simply override
2330 version with special symbol version, ignoring previous version.
2331
2332 2011-07-05 Ian Lance Taylor <iant@google.com>
2333
2334 * object.cc (Sized_relobj_file::include_section_group): Add
2335 information to comment about signature location.
2336
2337 2011-07-02 Ian Lance Taylor <iant@google.com>
2338
2339 PR gold/12957
2340 * options.h (class General_options): Add -f and -F.
2341 * options.cc (General_options::finalize): Fatal error if -f/-F
2342 are used without -shared.
2343 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2344
2345 2011-07-02 Ian Lance Taylor <iant@google.com>
2346
2347 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2348
2349 2011-07-01 Ian Lance Taylor <iant@google.com>
2350
2351 PR gold/12525
2352 PR gold/12952
2353 * resolve.cc (Symbol::override_base_with_special): Don't override
2354 the version if the overriding symbol has a different name.
2355 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2356 all callers. If we give an error about an undefined version,
2357 define the base version if necessary.
2358 * dynobj.h (class Versions): Update declaration.
2359 * testsuite/weak_alias_test_5.cc: New file.
2360 * testsuite/weak_alias_test.script: New file.
2361 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2362 and versioned_alias have the right value, and call t2.
2363 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2364 weak_alias_test_5.so.
2365 (weak_alias_test_LDADD): Likewise.
2366 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2367 * testsuite/Makefile.in: Rebuild.
2368
2369 2011-07-01 Ian Lance Taylor <iant@google.com>
2370
2371 PR gold/12525
2372 * options.h (class General_options): Support -z notext.
2373 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2374 -Wl,-z,notext.
2375 (two_file_shared_nonpic.so): Likewise.
2376 (two_file_shared_mixed.so): Likewise.
2377 (two_file_shared_mixed_1.so): Likewise.
2378 (weak_undef_lib_nonpic.so): Likewise.
2379 (alt/weak_undef_lib_nonpic.so): Likewise.
2380 (tls_test_shared_nonpic.so): Likewise.
2381 * testsuite/Makefile.in: Rebuild.
2382
2383 2011-07-01 Ian Lance Taylor <iant@google.com>
2384
2385 PR gold/12525
2386 * configure.ac: Test whether static linking works, setting
2387 the automake conditional HAVE_STATIC.
2388 * testsuite/Makefile.am: Disable tests using -static if
2389 HAVE_STATIC is not true.
2390 * configure, testsuite/Makefile.in: Rebuild.
2391
2392 2011-07-01 Ian Lance Taylor <iant@google.com>
2393
2394 PR gold/12525
2395 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2396 Assert if we see DW_EH_PE_indirect.
2397 * target.h (Target::ehframe_datarel_base): New function.
2398 (Target::do_ehframe_datarel_base): New target function.
2399 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2400 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2401 function.
2402
2403 2011-07-01 Ian Lance Taylor <iant@google.com>
2404
2405 PR gold/12571
2406 * options.h (class General_options): Add
2407 --ld-generated-unwind-info.
2408 * ehframe.cc (Fde::write): Add address parameter. Change all
2409 callers. If associated with PLT, fill in address and size.
2410 (Cie::set_output_offset): Only add merge mapping if there is an
2411 object.
2412 (Cie::write): Add address parameter. Change all callers.
2413 (Eh_frame::add_ehframe_for_plt): New function.
2414 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2415 input_offset_ fields into union u_, with new plt field.
2416 (Fde::Fde): Adjust for new union field.
2417 (Fde::Fde) [Output_data version]: New constructor.
2418 (Fde::add_mapping): Only add merge mapping if there is an object.
2419 (class Cie): Update declarations.
2420 (class Eh_frame): Declare add_ehframe_for_plt.
2421 * layout.cc (Layout::layout_eh_frame): Break out code into
2422 make_eh_frame_section, and call it.
2423 (Layout::make_eh_frame_section): New function.
2424 (Layout::add_eh_frame_for_plt): New function.
2425 * layout.h (class Layout): Update declarations.
2426 * merge.cc (Merge_map::add_mapping): Add assertion.
2427 * i386.cc: Include "dwarf.h".
2428 (class Output_data_plt_i386): Make first_plt_entry,
2429 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2430 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2431 and plt_eh_frame_fde.
2432 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2433 boundary. Call add_eh_frame_for_plt if appropriate.
2434 * x86_64.cc: Include "dwarf.h".
2435 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2436 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2437 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2438 and plt_eh_frame_fde.
2439 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2440 appropriate.
2441
2442 2011-06-29 Ian Lance Taylor <iant@google.com>
2443
2444 PR gold/12629
2445 * object.cc (Sized_relobj_file::layout_section): Change shdr
2446 parameter to be const.
2447 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2448 out of do_layout.
2449 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2450 appropriate. Call layout_eh_frame_section.
2451 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2452 sections.
2453 * object.h (class Sized_relobj_file): Update declarations.
2454
2455 2011-06-29 Ian Lance Taylor <iant@google.com>
2456
2457 PR gold/12652
2458 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2459 modifier.
2460 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2461
2462 2011-06-29 Ian Lance Taylor <iant@google.com>
2463
2464 PR gold/12675
2465 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2466 SHT_X86_64_UNWIND.
2467 * layout.cc (Layout::layout_eh_frame): Likewise.
2468
2469 2011-06-29 Ian Lance Taylor <iant@google.com>
2470
2471 PR gold/12695
2472 * layout.cc (Layout::symtab_section_shndx): New function.
2473 * layout.h (class Layout): Declare symtab_section_shndx.
2474 * output.cc (Output_section::write_header): Call it.
2475
2476 2011-06-29 Ian Lance Taylor <iant@google.com>
2477
2478 PR gold/12818
2479 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2480 symbols which are not used in a relocation.
2481
2482 2011-06-28 Ian Lance Taylor <iant@google.com>
2483
2484 PR gold/12898
2485 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2486 script create indistinguishable segments.
2487 (Layout::set_segment_offsets): Use stable_sort when sorting
2488 segments. Pass this to Compare_segments constructor.
2489 * layout.h (class Layout): Make segment_precedes non-static.
2490 (class Compare_segments): Change from struct to class. Add
2491 layout_ field. Add constructor.
2492 * script-sections.cc
2493 (Script_sections::attach_sections_using_phdrs_clause): Rename
2494 local orphan to is_orphan. Don't report failure to put empty
2495 section in segment. On attachment failure, report name of
2496 section, and attach to first PT_LOAD segment.
2497
2498 2011-06-28 Ian Lance Taylor <iant@google.com>
2499
2500 PR gold/12934
2501 * target-select.cc (Target_selector::Target_selector): Add
2502 emulation parameter. Change all callers.
2503 (select_target_by_bfd_name): Rename from select_target_by_name.
2504 Change all callers.
2505 (select_target_by_emulation): New function.
2506 (supported_emulation_names): New function.
2507 * target-select.h (class Target_selector): Add emulation_ field.
2508 Update declarations.
2509 (Target_selector::recognize_by_bfd_name): Rename from
2510 recognize_by_name. Change all callers.
2511 (Target_selector::supported_bfd_names): Rename from
2512 supported_names. Change all callers.
2513 (Target_selector::recognize_by_emulation): New function.
2514 (Target_selector::supported_emulations): New function.
2515 (Target_selector::emulation): New function.
2516 (Target_selector::do_recognize_by_bfd_name): Rename from
2517 do_recognize_by_name. Change all callers.
2518 (Target_selector::do_supported_bfd_names): Rename from
2519 do_supported_names. Change all callers.
2520 (Target_selector::do_recognize_by_emulation): New function.
2521 (Target_selector::do_supported_emulations): New function.
2522 (select_target_by_bfd_name): Change name in declaration.
2523 (select_target_by_emulation): Declare.
2524 (supported_emulation_names): Declare.
2525 * parameters.cc (parameters_force_valid_target): Try to find
2526 target based on emulation from -m option.
2527 * options.h (class General_options): Change doc string for -m.
2528 * options.cc (help): Print emulations.
2529 (General_options::parse_V): Likewise.
2530 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2531 Add emulation parameter. Change all callers.
2532
2533 2011-06-28 Ian Lance Taylor <iant@google.com>
2534
2535 * target.h (class Target): Add osabi_ field.
2536 (Target::osabi): New function.
2537 (Target::set_osabi): New function.
2538 (Target::Target): Initialize osabi_.
2539 (Target::do_adjust_elf_header): Make pure virtual.
2540 (Sized_target::do_adjust_elf_header): Declare.
2541 * target.cc (Sized_target::do_adjust_elf_header): New function.
2542 (class Sized_target): Instantiate all versions.
2543 * freebsd.h (class Target_freebsd): Remove.
2544 (Target_selector_freebsd::do_recognize): Call set_osabi on
2545 Target.
2546 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2547 (Target_selector_freebsd::set_osabi): Remove.
2548 * i386.cc (class Target_i386): Inherit from Sized_target rather
2549 than Target_freebsd.
2550 * x86_64.cc (class Target_x86_64): Likewise.
2551
2552 2011-06-28 Ian Lance Taylor <iant@google.com>
2553
2554 * target.h (Target::can_check_for_function_pointers): Rewrite.
2555 Make non-virtual.
2556 (Target::can_icf_inline_merge_sections): Likewise.
2557 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2558 (Target::Target_info): Add can_icf_inline_merge_sections field.
2559 (Target::do_can_check_for_function_pointers): New virtual
2560 function.
2561 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2562 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2563 from can_check_for_function_pointers, move in file.
2564 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2565 section_may_have_icf_unsafe_poineters, move in file.
2566 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2567 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2568 Rename from can_check_for_function_pointers, move in file.
2569 (Target_i386::can_icf_inline_merge_sections): Remove.
2570 (Target_i386::i386_info): Initialize
2571 can_icf_inline_merge_sections.
2572 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2573 Initialize can_icf_inline_merge_sections.
2574 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2575 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2576 Rename from can_check_for_function_pointers, move in file.
2577 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2578 (Target_x86_64::x86_64_info): Initialize
2579 can_icf_inline_merge_sections.
2580 * testsuite/testfile.cc (Target_test::test_target_info):
2581 Likewise.
2582 * icf.cc (get_section_contents): Correct formatting.
2583
2584 2011-06-27 Ian Lance Taylor <iant@google.com>
2585
2586 * symtab.cc (Symbol::versioned_name): New function.
2587 (Symbol_table::add_to_final_symtab): Use versioned_name when
2588 appropriate.
2589 (Symbol_table::sized_write_symbol): Likewise.
2590 * symtab.h (class Symbol): Declare versioned_name.
2591 * stringpool.h (class Stringpool_template): Add variant of add
2592 which takes a std::basic_string.
2593 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2594 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2595 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2596 (ver_test_12.o): New target.
2597 * testsuite/Makefile.in: Rebuild.
2598
2599 2011-06-27 Doug Kwan <dougkwan@google.com>
2600
2601 * arm.cc (Arm_relocate_functions::thm_jump8,
2602 Arm_relocate_functions::thm_jump11): Use a wider signed
2603 type to compute offset.
2604 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2605 arm_thm_jump8.
2606 * testsuite/Makefile.in: Regenerate.
2607 * testsuite/arm_branch_in_range.sh: Check test results of
2608 arm_thm_jump11 and arm_thm_jump8.
2609 * testsuite/arm_thm_jump11.s: New test source file.
2610 * testsuite/arm_thm_jump11.t: New linker script.
2611 * testsuite/arm_thm_jump8.s: New test source file.
2612 * testsuite/arm_thm_jump8.t: New linker script.
2613
2614 2011-06-24 Ian Lance Taylor <iant@google.com>
2615
2616 * layout.cc: Include "object.h".
2617 (ctors_sections_in_init_array): New static variable.
2618 (Layout::is_ctors_in_init_array): New function.
2619 (Layout::layout): Add entry to ctors_sections_in_init_array if
2620 appropriate.
2621 * layout.h (class Layout): Declare is_ctors_in_init_array.
2622 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2623 is_ctors_reverse_view is set.
2624 (Sized_relobj_file::write_sections): Add layout parameter. Change
2625 all callers. Set is_ctors_reverse_view field of View_size.
2626 (Sized_relobj_file::reverse_words): New function.
2627 * object.h (Sized_relobj_file::View_size): Add
2628 is_ctors_reverse_view field.
2629 (class Sized_relobj_file): Update declarations.
2630 * testsuite/initpri3.c: New test.
2631 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2632 initpri3b.
2633 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2634 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2635 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2636 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2637 * testsuite/Makefile.in: Rebuild.
2638
2639 2011-06-24 Cary Coutant <ccoutant@google.com>
2640
2641 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2642 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2643 (debug_msg_cdebug.err): New targets.
2644 * testsuite/Makefile.in: Regenerate.
2645 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2646 Fix checks for link with shared library.
2647
2648 2011-06-24 Doug Kwan <dougkwan@google.com>
2649
2650 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2651 skip empty text sections.
2652 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2653
2654 2011-06-22 Ian Lance Taylor <iant@google.com>
2655
2656 PR gold/12910
2657 * options.h (class General_options): Add --ctors-in-init-array.
2658 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2659 friends as SHT_PROGBITS for merging sections.
2660 (Layout::layout): Remove special handling of .init_array and
2661 friends. Don't sort if doing relocatable link. Sort for .ctors
2662 and .dtors if ctors_in_init_array.
2663 (Layout::make_output_section): Force correct section types for
2664 .init_array and friends. Don't sort if doing relocatable link,
2665 Don't sort .ctors and .dtors if ctors_in_init_array.
2666 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2667 (Layout::output_section_name): Add relobj parameter. Change all
2668 callers. Handle .ctors. and .dtors. in code rather than table.
2669 Handle .ctors and .dtors if ctors_in_init_array.
2670 (Layout::match_file_name): New function, moved from output.cc.
2671 * layout.h (class Layout): Update declarations.
2672 * output.cc: Include "layout.h".
2673 (Input_section_sort_entry::get_priority): New function.
2674 (Input_section_sort_entry::match_file_name): Just call
2675 Layout::match_file_name.
2676 (Output_section::Input_section_sort_init_fini_compare::operator()):
2677 Handle .ctors and .dtors. Sort by explicit priority rather than
2678 by name.
2679 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2680 * testsuite/initpri2.c: New test.
2681 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2682 (check_PROGRAMS): Add initpri2.
2683 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2684 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2685 * configure, testsuite/Makefile.in: Rebuild.
2686
2687 2011-06-19 Ian Lance Taylor <iant@google.com>
2688
2689 PR gold/12880
2690 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2691 .interp section to a PT_INTERP segment even if we have seen a
2692 --dynamic-linker option. Don't do it if we have seen a PHDRS
2693 clause in a linker script.
2694 (Layout::finalize): Don't create a .interp section if we've
2695 already create a PT_INTERP segment.
2696 (Layout::create_interp): Always call choose_output_section (revert
2697 patch of 2011-06-17). Don't create PT_INTERP segment.
2698 * script-sections.cc
2699 (Script_sections::create_note_and_tls_segments): Add a .interp
2700 section to a PT_INTERP segment even if we have seen a
2701 --dynamic-linker option.
2702
2703 2011-06-18 Ian Lance Taylor <iant@google.com>
2704
2705 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2706 merely because a non-PT_LOAD segment has a dynamic reloc.
2707
2708 2011-06-18 Ian Lance Taylor <iant@google.com>
2709
2710 * layout.cc (Layout::finish_dynamic_section): Don't create
2711 DT_FLAGS entry if not needed.
2712
2713 2011-06-18 Ian Lance Taylor <iant@google.com>
2714
2715 PR gold/12745
2716 * layout.cc (Layout::layout_eh_frame): Correct handling of
2717 writable .eh_frame section.
2718
2719 2011-06-17 Ian Lance Taylor <iant@google.com>
2720
2721 PR gold/12893
2722 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2723 symbol is redefined with the exact same object and value.
2724
2725 2011-06-17 Ian Lance Taylor <iant@google.com>
2726
2727 PR gold/12880
2728 * layout.h (class Layout): Add interp_segment_ field.
2729 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2730 (Layout::attach_allocated_section_to_segment): If making shared
2731 library, put .interp section in PT_INTERP segment.
2732 (Layout::finalize): Also call create_interp if -dynamic-linker
2733 option was used.
2734 (Layout::create_interp): Assert that there is no PT_INTERP
2735 segment. If not using a SECTIONS clause, use make_output_section.
2736 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2737 * script-sections.cc
2738 (Script_sections::create_note_and_tls_segments): If making shared
2739 library, put .interp section in PT_INTERP segment.
2740
2741 2011-06-17 Ian Lance Taylor <iant@google.com>
2742
2743 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2744 when making a shared library.
2745
2746 2011-06-17 Ian Lance Taylor <iant@google.com>
2747
2748 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2749 parameter. Change all callers. Don't issue warning about PC32
2750 against locally defined symbol.
2751
2752 2011-06-16 Ian Lance Taylor <iant@google.com>
2753
2754 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2755 occurs in same object.
2756
2757 2011-06-14 Alan Modra <amodra@gmail.com>
2758
2759 * po/POTFILES.in: Regenerate.
2760
2761 2011-06-09 Ian Lance Taylor <iant@google.com>
2762
2763 * script-sections.cc
2764 (Orphan_output_section::set_section_addresses): For a relocatable
2765 link set address to 0.
2766
2767 2011-06-09 Cary Coutant <ccoutant@google.com>
2768
2769 PR gold/12804
2770 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2771 used with --compress-debug-sections.
2772 * gold/object.cc (Sized_relobj_file::do_layout): Report
2773 uncompressed size of compressed input sections.
2774
2775 2011-06-08 Cary Coutant <ccoutant@google.com>
2776
2777 PR gold/12804
2778 * testsuite/two_file_test_2_v1.cc: Change initialization of
2779 v2 to keep it in .data.
2780
2781 2011-06-07 Cary Coutant <ccoutant@google.com>
2782
2783 * common.cc (Symbol_table::do_allocate_commons_list): Call
2784 gold_fallback.
2785 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2786 (Errors::fallback): New function.
2787 (gold_fallback): New function.
2788 * errors.h (Errors::fallback): New function.
2789 * gold.cc (gold_exit): Change status parameter to enum; adjust
2790 all callers.
2791 (queue_initial_tasks): Call gold_fallback.
2792 * gold.h: Include cstdlib.
2793 (Exit_status): New enum type.
2794 (gold_exit): Change status parameter to enum.
2795 (gold_fallback): New function.
2796 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2797 (Layout::create_symtab_sections): Likewise.
2798 (Layout::create_shdrs): Likewise.
2799 * main.cc (main): Adjust call to gold_exit.
2800 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2801 (Output_data_got::add_got_entry_pair): Likewise.
2802 (Output_section::add_input_section): Likewise.
2803 (Output_section::add_output_section_data): Likewise.
2804 (Output_segment::set_section_list_addresses): Likewise.
2805 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2806
2807 2011-06-07 Cary Coutant <ccoutant@google.com>
2808
2809 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2810 for incremental links.
2811 * output.cc (Output_segment::set_section_list_addresses): Remove
2812 FIXME and test for TLS or BSS.
2813
2814 2011-06-07 Cary Coutant <ccoutant@google.com>
2815
2816 * testsuite/Makefile.am: Add incremental_copy_test,
2817 incremental_common_test_1.
2818 * testsuite/Makefile.in: Regenerate.
2819 * testsuite/common_test_1_v1.c: New source file.
2820 * testsuite/common_test_1_v2.c: New source file.
2821 * testsuite/copy_test_v1.cc: New source file.
2822
2823 2011-06-07 Cary Coutant <ccoutant@google.com>
2824
2825 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2826 update, allocate common from bss section's free list.
2827 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2828 linker-defined symbols.
2829 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2830 Skip GOT and PLT entries that are no longer referenced.
2831 (Output_section_incremental_inputs::write_info_blocks): Mark
2832 linker-defined symbols.
2833 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2834 * output.cc (Output_section::allocate): New function.
2835 * output.h (Output_section::allocate): New function.
2836 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2837 linker-defined symbols.
2838 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2839 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2840 (Symbol::init_base_output_data): Likewise.
2841 (Symbol::init_base_output_segment): Likewise.
2842 (Symbol::init_base_constant): Likewise.
2843 (Sized_symbol::init_output_data): Likewise.
2844 (Sized_symbol::init_output_segment): Likewise.
2845 (Sized_symbol::init_constant): Likewise.
2846 (Symbol_table::do_define_in_output_data): Likewise.
2847 (Symbol_table::do_define_in_output_segment): Likewise.
2848 (Symbol_table::do_define_as_constant): Likewise.
2849 * symtab.h (Symbol::is_predefined): New function.
2850 (Symbol::init_base_output_data): Add is_predefined parameter.
2851 (Symbol::init_base_output_segment): Likewise.
2852 (Symbol::init_base_constant): Likewise.
2853 (Symbol::is_predefined_): New data member.
2854 (Sized_symbol::init_output_data): Add is_predefined parameter.
2855 (Sized_symbol::init_output_segment): Likewise.
2856 (Sized_symbol::init_constant): Likewise.
2857 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2858
2859 2011-06-07 Cary Coutant <ccoutant@google.com>
2860
2861 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2862 instead of emit_copy_reloc.
2863 (Copy_relocs::emit_copy_reloc): Refactor.
2864 (Copy_relocs::make_copy_reloc): New function.
2865 (Copy_relocs::add_copy_reloc): Remove.
2866 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2867 section.
2868 (Copy_relocs::make_copy_reloc): New function.
2869 (Copy_relocs::add_copy_reloc): Remove.
2870 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2871 unchanged input files.
2872 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2873 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2874 Reserve BSS space for COPY relocations.
2875 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2876 (Output_section_incremental_inputs::write_info_blocks): Record
2877 whether a symbol is copied from a shared object.
2878 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2879 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2880 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2881 (Incremental_input_entry_reader::get_output_symbol_index): Add
2882 is_copy parameter.
2883 (Incremental_binary::emit_copy_relocs): New function.
2884 (Incremental_binary::do_emit_copy_relocs): New function.
2885 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2886 new data member.
2887 (Sized_incremental_binary::add_copy_reloc): New function.
2888 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2889 (Sized_incremental_binary::Copy_reloc): New struct.
2890 (Sized_incremental_binary::Copy_relocs): New typedef.
2891 (Sized_incremental_binary::copy_relocs_): New data member.
2892 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2893 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2894 * target.h (Sized_target::emit_copy_reloc): New function.
2895 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2896
2897 2011-06-02 Cary Coutant <ccoutant@google.com>
2898
2899 PR gold/12163
2900 * gold/archive.cc (Archive::Archive): Initialize new data member.
2901 (Archive::include_all_members): Return if archive has already been
2902 included.
2903 * gold/archive.h (Archive::include_all_members_): New data member.
2904
2905 2011-06-02 Nick Clifton <nickc@redhat.com>
2906
2907 * dynobj.h: Fix spelling mistake in comment.
2908 * output.cc: Likewise.
2909
2910 2011-05-31 Doug Kwan <dougkwan@google.com>
2911 Asier Llano
2912
2913 PR gold/12826
2914 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2915 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2916 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2917 redundant arm_exidx_test.so.
2918 * testsuite/Makefile.in: Regenerate.
2919 (check_SCRIPTS): Add pr12826.sh
2920 (check_DATA): Add pr12826.stdout
2921 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2922 * testsuite/pr12826.sh: New file.
2923 * testsuite/pr12826_1.s: Ditto.
2924 * testsuite/pr12826_1.s: Ditto.
2925
2926 2011-05-30 Ian Lance Taylor <iant@google.com>
2927
2928 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2929 sections.
2930
2931 2011-05-29 Ian Lance Taylor <iant@google.com>
2932
2933 PR gold/12804
2934 * testsuite/Makefile.am: Use different file name for two_file_test
2935 temporary file for each incremental test.
2936 * testsuite/Makefile.in: Rebuild.
2937
2938 2011-05-29 Ian Lance Taylor <iant@google.com>
2939
2940 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2941 binary input file is empty.
2942
2943 2011-05-27 Ian Lance Taylor <iant@google.com>
2944
2945 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2946 (ver_test_9.so): Likewise.
2947 * testsuite/Makefile.in: Rebuild.
2948
2949 2011-05-26 Cary Coutant <ccoutant@google.com>
2950
2951 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2952 * incremental.cc (Incremental_inputs::report_input_section): Fix
2953 comment, indentation.
2954 (Incremental_inputs::report_comdat_group): New function.
2955 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2956 of data for incremental input file entry.
2957 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2958 group count, COMDAT group signatures.
2959 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2960 an unchanged input file.
2961 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2962 Initialize new data member.
2963 (Incremental_object_entry::add_comdat_group): New function.
2964 (Incremental_object_entry::get_comdat_group_count): New function.
2965 (Incremental_object_entry::get_comdat_signature_key): New function.
2966 (Incremental_object_entry::groups_): New data member.
2967 (Incremental_inputs::report_comdat_group): New function.
2968 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2969 data for incremental input file entry.
2970 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2971 (Incremental_input_entry_reader::get_input_section): Adjust size of
2972 data for incremental input file entry.
2973 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2974 (Incremental_input_entry_reader::get_comdat_group_signature): New
2975 function.
2976 * object.cc (Sized_relobj::include_section_group): Report kept
2977 COMDAT groups for incremental links.
2978
2979 2011-05-24 David Meyer <pdox@google.com>
2980
2981 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2982 with name parameter. Add found_name parameter.
2983 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2984 * dirsearch.h (class Dirsearch): Update declaration.
2985
2986 2011-05-24 Ian Lance Taylor <iant@google.com>
2987
2988 * archive.cc (Library_base::should_include_member): Pull in object
2989 from archive if it defines the entry symbol.
2990 * parameters.cc (Parameters::entry): New function.
2991 * parameters.h (class Parameters): Declare entry.
2992 * output.h (class Output_file_header): Remove entry_ field.
2993 * output.cc (Output_file_header::Output_file_header): Remove entry
2994 parameter. Change all callers.
2995 (Output_file_header::entry): Use parameters->entry.
2996 * gold.cc (queue_middle_tasks): Likewise.
2997 * plugin.cc (Plugin_hook::run): Likewise.
2998
2999 2011-05-24 Cary Coutant <ccoutant@google.com>
3000
3001 * gold.cc (queue_initial_tasks): Pass incremental base filename
3002 to Output_file::open_base_file; don't print error message.
3003 * incremental-dump.cc (main): Adjust call to
3004 Output_file::open_for_modification.
3005 * incremental-dump.cc (main): Likewise.
3006 * incremental.cc (Incremental_inputs::report_command_line):
3007 Ignore --incremental-base option when comparing command lines.
3008 Ignore parameter when given as separate argument.
3009 * options.h (class General_options): Add --incremental-base.
3010 * output.cc (Output_file::Output_file):
3011 (Output_file::open_base_file): Add base_name and writable parameters;
3012 read base file into new file; print error message here.
3013 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3014 callers.
3015 * output.h (Output_file::open_for_modification): Rename to...
3016 (Output_file::open_base_file): ...this; add base_name and
3017 writable parameters; adjust all callers.
3018 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3019 callers.
3020 * testsuite/Makefile.am (incremental_test_4): Test
3021 --incremental-base.
3022 * testsuite/Makefile.in: Regenerate.
3023
3024 2011-05-24 Cary Coutant <ccoutant@google.com>
3025
3026 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3027 incremental_test_4.
3028 * testsuite/Makefile.in: Regenerate.
3029 * testsuite/two_file_test_1_v1.cc: New test source file.
3030 * testsuite/two_file_test_1b_v1.cc: New test source file.
3031 * testsuite/two_file_test_2_v1.cc: New test source file.
3032
3033 2011-05-24 Cary Coutant <ccoutant@google.com>
3034
3035 * dynobj.h (Dynobj::do_dynobj): New function.
3036 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3037 flag and soname for shared objects.
3038 * incremental.cc (Incremental_inputs::report_object): Make
3039 either Incremental_object_entry or Incremental_dynobj_entry; add
3040 soname to string table.
3041 (Incremental_inputs::report_input_section): Add assertion.
3042 (Output_section_incremental_inputs::set_final_data_size): Adjust
3043 type of input file entry for shared libraries; adjust size of
3044 shared library info entry.
3045 (Output_section_incremental_inputs::write_input_files): Write
3046 as_needed flag for shared libraries.
3047 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3048 of input file entry for shared libraries; write soname.
3049 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3050 soname from incremental info.
3051 * incremental.h (enum Incremental_input_flags): Add
3052 INCREMENTAL_INPUT_AS_NEEDED.
3053 (Incremental_input_entry::Incremental_input_entry): Initialize new
3054 data member.
3055 (Incremental_input_entry::set_as_needed): New function.
3056 (Incremental_input_entry::as_needed): New function.
3057 (Incremental_input_entry::do_dynobj_entry): New function.
3058 (Incremental_input_entry::as_needed_): New data member.
3059 (Incremental_object_entry::Incremental_object_entry): Don't check
3060 for shared library.
3061 (Incremental_object_entry::do_type): Likewise.
3062 (class Incremental_dynobj_entry): New class.
3063 (Incremental_input_entry_reader::as_needed): New function.
3064 (Incremental_input_entry_reader::get_soname): New function.
3065 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3066 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3067 size of shared library info entry.
3068 * layout.cc (Layout::finish_dynamic_section): Don't test for
3069 incremental link when adding DT_NEEDED entries.
3070 * object.h (Object::Object): Initialize new data member.
3071 (Object::dynobj): New function.
3072 (Object::set_as_needed): New function.
3073 (Object::as_needed): New function.
3074 (Object::do_dynobj): New function.
3075 (Object::as_needed_): New data member.
3076
3077 2011-05-24 Cary Coutant <ccoutant@google.com>
3078
3079 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3080 info; adjust display of GOT entries.
3081 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3082 vector of input objects; remove file_status_.
3083 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3084 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3085 got_plt reader; call target hooks to reserve GOT entries.
3086 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3087 of input file info header and GOT info entry.
3088 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3089 relocation info.
3090 (Got_plt_view_info::got_descriptor): Remove.
3091 (Got_plt_view_info::sym_index): New data member.
3092 (Got_plt_view_info::input_index): New data member.
3093 (Local_got_offset_visitor::visit): Write input file index.
3094 (Global_got_offset_visitor::visit): Write 0 for input file index.
3095 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3096 with sym_index and input_index.
3097 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3098 incremental info GOT entry; replace got_descriptor with input_index.
3099 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3100 map from input file index to object.
3101 (Sized_relobj_incr::do_layout): Replace direct data member reference
3102 with accessor function.
3103 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3104 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3105 Adjust size of input file info header.
3106 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3107 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3108 (Incremental_input_entry_reader::get_input_section): Adjust size of
3109 input file info header.
3110 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3111 of incremental info GOT entry.
3112 (Incremental_got_plt_reader::get_got_desc): Remove.
3113 (Incremental_got_plt_reader::get_got_symndx): New function.
3114 (Incremental_got_plt_reader::get_got_input_index): New function.
3115 (Sized_incremental_binary::Sized_incremental_binary): Remove
3116 file_status_; add input_objects_.
3117 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3118 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3119 (Sized_incremental_binary::file_is_unchanged): Remove.
3120 (Sized_incremental_binary::set_input_object): New function.
3121 (Sized_incremental_binary::input_object): New function.
3122 (Sized_incremental_binary::file_status_): Remove.
3123 (Sized_incremental_binary::input_objects_): New data member.
3124 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3125 references.
3126 (Sized_relobj_incr::invalid_address): Move to base class.
3127 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3128 class.
3129 (Sized_relobj_incr::do_output_section_offset): Likewise.
3130 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3131 (Sized_relobj_incr::section_offsets_): Likewise.
3132 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3133 function.
3134 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3135 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3136 with accessor function.
3137 (Sized_relobj_file::do_layout): Likewise.
3138 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3139 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3140 (Sized_relobj_file::compute_final_local_value): Replace refs to
3141 section_offsets_ with accessor function.
3142 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3143 * object.h (Relobj::Relobj): Initialize new data members.
3144 (Relobj::add_dyn_reloc): New function.
3145 (Relobj::first_dyn_reloc): New function.
3146 (Relobj::dyn_reloc_count): New function.
3147 (Relobj::first_dyn_reloc_): New data member.
3148 (Relobj::dyn_reloc_count_): New data member.
3149 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3150 references.
3151 (Sized_relobj::Address): New typedef.
3152 (Sized_relobj::invalid_address): Move here from child class.
3153 (Sized_relobj::Sized_relobj): Initialize new data members.
3154 (Sized_relobj::sized_relobj): New function.
3155 (Sized_relobj::is_output_section_offset_invalid): Move here from
3156 child class.
3157 (Sized_relobj::get_output_section_offset): Likewise.
3158 (Sized_relobj::local_has_got_offset): Likewise.
3159 (Sized_relobj::local_got_offset): Likewise.
3160 (Sized_relobj::set_local_got_offset): Likewise.
3161 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3162 (Sized_relobj::clear_got_offsets): New function.
3163 (Sized_relobj::section_offsets): Move here from child class.
3164 (Sized_relobj::do_output_section_offset): Likewise.
3165 (Sized_relobj::do_set_section_offset): Likewise.
3166 (Sized_relobj::Local_got_offsets): Likewise.
3167 (Sized_relobj::local_got_offsets_): Likewise.
3168 (Sized_relobj::section_offsets_): Likewise.
3169 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3170 references.
3171 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3172 class.
3173 (Sized_relobj_file::sized_relobj): New function
3174 (Sized_relobj_file::local_has_got_offset): Move to base class.
3175 (Sized_relobj_file::local_got_offset): Likewise.
3176 (Sized_relobj_file::set_local_got_offset): Likewise.
3177 (Sized_relobj_file::get_output_section_offset): Likewise.
3178 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3179 (Sized_relobj_file::do_output_section_offset): Likewise.
3180 (Sized_relobj_file::do_set_section_offset): Likewise.
3181 (Sized_relobj_file::Local_got_offsets): Likewise.
3182 (Sized_relobj_file::local_got_offsets_): Likewise.
3183 (Sized_relobj_file::section_offsets_): Likewise.
3184 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3185 (all constructors).
3186 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3187 (Output_reloc::get_symbol_index): Likewise.
3188 (Output_reloc::local_section_offset): Likewise.
3189 (Output_reloc::get_address): Likewise.
3190 (Output_reloc::symbol_value): Likewise.
3191 (Output_data_got::reserve_slot): Move to class definition.
3192 (Output_data_got::reserve_local): New function.
3193 (Output_data_got::reserve_slot_for_global): Remove.
3194 (Output_data_got::reserve_global): New function.
3195 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3196 (all constructors, two instantiations).
3197 (Output_reloc::get_relobj): New function (two instantiations).
3198 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3199 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3200 (Output_data_reloc::add_global): Adjust type of relobj.
3201 (Output_data_reloc::add_global_relative): Likewise.
3202 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3203 (Output_data_reloc::add_local): Likewise.
3204 (Output_data_reloc::add_local_relative): Likewise.
3205 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3206 (Output_data_reloc::add_local_section): Likewise.
3207 (Output_data_reloc::add_output_section): Likewise.
3208 (Output_data_reloc::add_absolute): Likewise.
3209 (Output_data_reloc::add_target_specific): Likewise.
3210 (Output_data_got::reserve_slot): Move definition here.
3211 (Output_data_got::reserve_local): New function.
3212 (Output_data_got::reserve_global): New function.
3213 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3214 section_offsets_ with accessor function.
3215 (Sized_relobj_file::write_sections): Likewise.
3216 (Sized_relobj_file::do_relocate_sections): Likewise.
3217 * target.h (Sized_target::reserve_local_got_entry): New function.
3218 (Sized_target::reserve_global_got_entry): New function.
3219 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3220 (Target_x86_64::reserve_global_got_entry): New function.
3221 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3222
3223 2011-05-23 Cary Coutant <ccoutant@google.com>
3224
3225 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3226 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3227 bit when checking got_type.
3228 * incremental.cc (Sized_incremental_binary::setup_readers):
3229 Store symbol table and string table locations; initialize bit vector
3230 of file status flags.
3231 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3232 unchanged files.
3233 (Sized_incremental_binary::do_process_got_plt): New function.
3234 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3235 (Output_section_incremental_inputs::set_final_data_size): Record
3236 file index for each input file.
3237 (Output_section_incremental_inputs::write_got_plt): Store file index
3238 instead of input entry offset for each GOT entry.
3239 * incremental.h
3240 (Incremental_input_entry::Incremental_input_entry): Initialize new
3241 data member.
3242 (Incremental_input_entry::set_offset): Store file index.
3243 (Incremental_input_entry::get_file_index): New function.
3244 (Incremental_input_entry::file_index_): New data member.
3245 (Incremental_binary::process_got_plt): New function.
3246 (Incremental_binary::do_process_got_plt): New function.
3247 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3248 data members.
3249 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3250 (Sized_incremental_binary::set_file_is_unchanged): New function.
3251 (Sized_incremental_binary::file_is_unchanged): New function.
3252 (Sized_incremental_binary::do_process_got_plt): New function.
3253 (Sized_incremental_binary::file_status_): New data member.
3254 (Sized_incremental_binary::main_symtab_loc_): New data member.
3255 (Sized_incremental_binary::main_strtab_loc_): New data member.
3256 * output.cc (Output_data_got::Got_entry::write): Add case
3257 RESERVED_CODE.
3258 (Output_data_got::add_global): Call add_got_entry.
3259 (Output_data_got::add_global_plt): Likewise.
3260 (Output_data_got::add_global_with_rel): Likewise.
3261 (Output_data_got::add_global_with_rela): Likewise.
3262 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3263 (Output_data_got::add_global_pair_with_rela): Likewise.
3264 (Output_data_got::add_local): Call add_got_entry.
3265 (Output_data_got::add_local_plt): Likewise.
3266 (Output_data_got::add_local_with_rel): Likewise.
3267 (Output_data_got::add_local_with_rela): Likewise.
3268 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3269 (Output_data_got::add_local_pair_with_rela): Likewise.
3270 (Output_data_got::reserve_slot): New function.
3271 (Output_data_got::reserve_slot_for_global): New function.
3272 (Output_data_got::add_got_entry): New function.
3273 (Output_data_got::add_got_entry_pair): New function.
3274 (Output_section::add_output_section_data): Edit FIXME.
3275 * output.h
3276 (Output_section_data_build::Output_section_data_build): New
3277 constructor with size parameter.
3278 (Output_data_space::Output_data_space): Likewise.
3279 (Output_data_got::Output_data_got): Initialize new data member; new
3280 constructor with size parameter.
3281 (Output_data_got::add_constant): Call add_got_entry.
3282 (Output_data_got::reserve_slot): New function.
3283 (Output_data_got::reserve_slot_for_global): New function.
3284 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3285 (Output_data_got::add_got_entry): New function.
3286 (Output_data_got::add_got_entry_pair): New function.
3287 (Output_data_got::free_list_): New data member.
3288 * target.h (Sized_target::init_got_plt_for_update): New function.
3289 (Sized_target::register_global_plt_entry): New function.
3290 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3291 Initialize new data member; call init; add constructor with PLT count.
3292 (Output_data_plt_x86_64::init): New function.
3293 (Output_data_plt_x86_64::add_relocation): New function.
3294 (Output_data_plt_x86_64::reserve_slot): New function.
3295 (Output_data_plt_x86_64::free_list_): New data member.
3296 (Target_x86_64::init_got_plt_for_update): New function.
3297 (Target_x86_64::register_global_plt_entry): New function.
3298 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3299 incremental updates.
3300 (Output_data_plt_x86_64::add_relocation): New function.
3301 * testsuite/object_unittest.cc (Object_test): Set default options.
3302
3303 2011-05-16 Ian Lance Taylor <iant@google.com>
3304
3305 * options.h (class General_options): Make -i a synonym for -r.
3306
3307 2011-05-16 Ian Lance Taylor <iant@google.com>
3308
3309 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3310
3311 2011-05-10 Cary Coutant <ccoutant@google.com>
3312
3313 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3314 strip_all (-s).
3315
3316 2011-05-06 Ian Lance Taylor <iant@google.com>
3317
3318 * layout.cc (Layout::layout): If the output section flags change,
3319 update the ordering.
3320
3321 2011-04-25 Cary Coutant <ccoutant@google.com>
3322
3323 * incremental-dump.cc (dump_incremental_inputs): Print local
3324 symbol info for each input file.
3325 * incremental.cc
3326 (Output_section_incremental_inputs::set_final_data_size): Add local
3327 symbol info to input file entries in incremental info.
3328 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3329 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3330 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3331 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3332 implementation.
3333 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3334 (Sized_incr_relobj::do_relocate): Write the local symbols.
3335 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3336 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3337 Adjust size of input file header.
3338 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3339 (Incremental_inputs_reader::get_local_symbol_count): New function.
3340 (Incremental_inputs_reader::get_input_section): Adjust size of input
3341 file header.
3342 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3343 (Sized_incr_relobj::This): New typedef.
3344 (Sized_incr_relobj::sym_size): New const data member.
3345 (Sized_incr_relobj::Local_symbol): New struct.
3346 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3347 (Sized_incr_relobj::do_local_symbol_offset): New function.
3348 (Sized_incr_relobj::local_symbol_count_): New data member.
3349 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3350 (Sized_incr_relobj::local_symbol_index_): New data member.
3351 (Sized_incr_relobj::local_symbol_offset_): New data member.
3352 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3353 (Sized_incr_relobj::local_symbols_): New data member.
3354 * object.h (Relobj::output_local_symbol_count): New function.
3355 (Relobj::local_symbol_offset): New function.
3356 (Relobj::do_output_local_symbol_count): New function.
3357 (Relobj::do_local_symbol_offset): New function.
3358 (Sized_relobj::do_output_local_symbol_count): New function.
3359 (Sized_relobj::do_local_symbol_offset): New function.
3360
3361 2011-04-22 Vladimir Simonov <sv@sw.ru>
3362
3363 * descriptors.cc (set_close_on_exec): New function.
3364 (Descriptors::open): Use set_close_on_exec.
3365 * output.cc (S_ISLNK): Define if not defined.
3366
3367 2011-04-22 Cary Coutant <ccoutant@google.com>
3368
3369 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3370 global symbol map.
3371 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3372 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3373 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3374 relocations.
3375 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3376 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3377 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3378 * incremental.h
3379 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3380 function.
3381 (Incremental_binary::apply_incremental_relocs): New function.
3382 (Incremental_binary::do_apply_incremental_relocs): New function.
3383 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3384 data member.
3385 (Sized_incremental_binary::add_global_symbol): New function.
3386 (Sized_incremental_binary::global_symbol): New function.
3387 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3388 (Sized_incremental_binary::symbol_map_): New data member.
3389 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3390 * target.h (Sized_target::apply_relocation): New function.
3391 * target-reloc.h (apply_relocation): New function.
3392 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3393
3394 2011-04-22 Doug Kwan <dougkwan@google.com>
3395
3396 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3397 flag of a SHT_ARM_EXIDX section.
3398 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3399 * testsuite/Makefile.in: Regenerate.
3400 * testsuite/arm_exidx_test.s: New file.
3401 * testsuite/arm_exidx_test.sh: Same.
3402
3403 2011-04-20 Cary Coutant <ccoutant@google.com>
3404
3405 PR gold/12689
3406 * archive.h (Incremental_archive_entry::Archive_member):
3407 Initialize arg_serial_ (second constructor).
3408
3409 2011-04-17 Ian Lance Taylor <iant@google.com>
3410
3411 * object.cc (Relocate_info::location): Simplify location string.
3412 * errors.cc (Errors::error_at_location): Don't print program
3413 name.
3414 (Errors::warning_at_location): Likewise.
3415 (Errors::undefined_symbol): Likewise.
3416 * testsuite/debug_msg.sh: Update accordingly.
3417
3418 2011-04-14 Cary Coutant <ccoutant@google.com>
3419
3420 * gold/layout.cc (Layout::symtab_section_offset): New function.
3421 * gold/layout.h (Layout::symtab_section_offset): New function.
3422 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3423
3424 2011-04-12 Ian Lance Taylor <iant@google.com>
3425
3426 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3427 with MREMAP_MAYMOVE.
3428 * output.h (class Output_file): Add map_is_allocated_ field.
3429 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3430 not available, provide stubs. If mremap is not available, #define
3431 it to gold_mremap.
3432 (MREMAP_MAYMOVE): Define if not defined.
3433 (Output_file::Output_file): Initialize map_is_allocated_.
3434 (Output_file::resize): Check map_is_allocated_.
3435 (Output_file::map_anonymous): If mmap fails, use malloc.
3436 (Output_file::unmap): Don't do anything for an anonymous map.
3437 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3438 is not available, provide stubs.
3439 (File_read::View::~View): Use free rather than delete[].
3440 (File_read::make_view): Use malloc rather than new[]. If mmap
3441 fails, use malloc.
3442 (File_read::find_or_make_view): Use malloc rather than new[].
3443 * gold.h: Remove HAVE_REMAP code.
3444 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3445 exists. Rename mremap to gold_mremap. If mmap is not available
3446 don't do anything.
3447 * configure, config.in: Rebuild.
3448
3449 2011-04-11 Ian Lance Taylor <iant@google.com>
3450
3451 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3452 initialize local variable v.
3453
3454 2011-04-11 Cary Coutant <ccoutant@google.com>
3455
3456 * archive.cc (Archive::include_member): Adjust call to
3457 report_object.
3458 (Add_archive_symbols::run): Track argument serial numbers.
3459 (Lib_group::include_member): Likewise.
3460 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3461 * archive.h (Incremental_archive_entry::Archive_member):
3462 Initialize arg_serial_.
3463 (Archive_member::arg_serial_): New data member.
3464 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3465 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3466 incremental link.
3467 (Sized_dynobj::do_for_all_local_got_entries): New function.
3468 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3469 function.
3470 * fileread.cc (get_mtime): New function.
3471 * fileread.h (get_mtime): New function.
3472 * gold.cc (queue_initial_tasks): Check for incremental update.
3473 (process_incremental_input): New function.
3474 (queue_middle_tasks): Don't force valid target for incremental
3475 update.
3476 * incremental-dump.cc (find_input_containing_global): Adjust
3477 size of symbol info entry.
3478 (dump_incremental_inputs): Dump argument serial number and
3479 in_system_directory flag; bias shndx by 1; print symbol names
3480 when dumping per-file symbol lists; use new symbol info readers.
3481 * incremental.cc
3482 (Output_section_incremental_inputs:update_data_size): New function.
3483 (Sized_incremental_binary::setup_readers): Setup input readers
3484 for each input file; build maps for files added from libraries
3485 and scripts.
3486 (Sized_incremental_binary::check_input_args): New function.
3487 (Sized_incremental_binary::do_check_inputs): Build map of argument
3488 serial numbers to input arguments.
3489 (Sized_incremental_binary::do_file_has_changed): Rename
3490 do_file_is_unchanged to this; compare file modification times.
3491 (Sized_incremental_binary::do_init_layout): New function.
3492 (Sized_incremental_binary::do_reserve_layout): New function.
3493 (Sized_incremental_binary::do_get_input_reader): Remove.
3494 (Sized_incremental_binary::get_symtab_view): New function.
3495 (Incremental_checker::can_incrementally_link_output_file): Remove.
3496 (Incremental_inputs::report_command_line): Exclude --debug options.
3497 (Incremental_inputs::report_archive_begin): Add parameter; track
3498 argument serial numbers; don't put input file entry for archive
3499 before archive members.
3500 (Incremental_inputs::report_archive_end): Put input file entry
3501 for archive after archive members.
3502 (Incremental_inputs::report_object): Add parameter; track argument
3503 serial numbers and in_system_directory flag.
3504 (Incremental_inputs::report_script): Add parameter; track argument
3505 serial numbers.
3506 (Output_section_incremental_inputs::set_final_data_size): Adjust
3507 size of symbol info entry; check for forwarding symbols.
3508 (Output_section_incremental_inputs::write_input_files): Write
3509 in_system_directory flag and argument serial number.
3510 (Output_section_incremental_inputs::write_info_blocks): Map section
3511 indices between incremental info and original input file; store
3512 input section index for each symbol.
3513 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3514 change operator() to visit().
3515 (class Global_got_offset_visitor): Likewise.
3516 (class Global_symbol_visitor_got_plt):
3517 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3518 classes.
3519 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3520 (Sized_incr_relobj::do_read_symbols): New function.
3521 (Sized_incr_relobj::do_layout): New function.
3522 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3523 (Sized_incr_relobj::do_add_symbols): New function.
3524 (Sized_incr_relobj::do_should_include_member): New function.
3525 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3526 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3527 (Sized_incr_relobj::do_section_size): New function.
3528 (Sized_incr_relobj::do_section_name): New function.
3529 (Sized_incr_relobj::do_section_contents): New function.
3530 (Sized_incr_relobj::do_section_flags): New function.
3531 (Sized_incr_relobj::do_section_entsize): New function.
3532 (Sized_incr_relobj::do_section_address): New function.
3533 (Sized_incr_relobj::do_section_type): New function.
3534 (Sized_incr_relobj::do_section_link): New function.
3535 (Sized_incr_relobj::do_section_info): New function.
3536 (Sized_incr_relobj::do_section_addralign): New function.
3537 (Sized_incr_relobj::do_initialize_xindex): New function.
3538 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3539 (Sized_incr_relobj::do_read_relocs): New function.
3540 (Sized_incr_relobj::do_gc_process_relocs): New function.
3541 (Sized_incr_relobj::do_scan_relocs): New function.
3542 (Sized_incr_relobj::do_count_local_symbols): New function.
3543 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3544 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3545 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3546 (Sized_incr_relobj::do_relocate): New function.
3547 (Sized_incr_relobj::do_set_section_offset): New function.
3548 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3549 (Sized_incr_dynobj::do_read_symbols): New function.
3550 (Sized_incr_dynobj::do_layout): New function.
3551 (Sized_incr_dynobj::do_add_symbols): New function.
3552 (Sized_incr_dynobj::do_should_include_member): New function.
3553 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3554 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3555 (Sized_incr_dynobj::do_section_size): New function.
3556 (Sized_incr_dynobj::do_section_name): New function.
3557 (Sized_incr_dynobj::do_section_contents): New function.
3558 (Sized_incr_dynobj::do_section_flags): New function.
3559 (Sized_incr_dynobj::do_section_entsize): New function.
3560 (Sized_incr_dynobj::do_section_address): New function.
3561 (Sized_incr_dynobj::do_section_type): New function.
3562 (Sized_incr_dynobj::do_section_link): New function.
3563 (Sized_incr_dynobj::do_section_info): New function.
3564 (Sized_incr_dynobj::do_section_addralign): New function.
3565 (Sized_incr_dynobj::do_initialize_xindex): New function.
3566 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3567 (make_sized_incremental_object): New function.
3568 (Incremental_library::copy_unused_symbols): New function.
3569 (Incremental_library::do_for_all_unused_symbols): New function.
3570 * incremental.h (enum Incremental_input_flags): New type.
3571 (class Incremental_checker): Remove.
3572 (Incremental_input_entry::Incremental_input_entry): Add argument
3573 serial number.
3574 (Incremental_input_entry::arg_serial): New function.
3575 (Incremental_input_entry::set_is_in_system_directory): New function.
3576 (Incremental_input_entry::is_in_system_directory): New function.
3577 (Incremental_input_entry::arg_serial_): New data member.
3578 (Incremental_input_entry::is_in_system_directory_): New data member.
3579 (class Script_info): Move here from script.h.
3580 (Script_info::Script_info): Add filename parameter.
3581 (Script_info::filename): New function.
3582 (Script_info::filename_): New data member.
3583 (Incremental_script_entry::Incremental_script_entry): Add argument
3584 serial number.
3585 (Incremental_object_entry::Incremental_object_entry): Likewise.
3586 (Incremental_object_entry::add_input_section): Build list of input
3587 sections with map to original shndx.
3588 (Incremental_object_entry::get_input_section_index): New function.
3589 (Incremental_object_entry::shndx_): New data member.
3590 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3591 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3592 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3593 serial number.
3594 (Incremental_inputs::report_archive_begin): Likewise.
3595 (Incremental_inputs::report_object): Likewise.
3596 (Incremental_inputs::report_script): Likewise.
3597 (class Incremental_global_symbol_reader): New class.
3598 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3599 and store flags and input file type.
3600 (Incremental_input_entry_reader::arg_serial): New function.
3601 (Incremental_input_entry_reader::type): Extract type from flags.
3602 (Incremental_input_entry_reader::is_in_system_directory): New function.
3603 (Incremental_input_entry_reader::get_input_section_count): Call
3604 accessor function for type.
3605 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3606 function for type; adjust size of global symbol entry.
3607 (Incremental_input_entry_reader::get_global_symbol_count): Call
3608 accessor function for type.
3609 (Incremental_input_entry_reader::get_object_count): Likewise.
3610 (Incremental_input_entry_reader::get_object_offset): Likewise.
3611 (Incremental_input_entry_reader::get_member_count): Likewise.
3612 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3613 (Incremental_input_entry_reader::get_member_offset): Likewise.
3614 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3615 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3616 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3617 (Incremental_input_entry_reader::get_global_symbol_reader): New
3618 function.
3619 (Incremental_input_entry_reader::get_output_symbol_index): New
3620 function.
3621 (Incremental_input_entry_reader::type_): Remove.
3622 (Incremental_input_entry_reader::flags_): New data member.
3623 (Incremental_inputs_reader::input_file_offset): New function.
3624 (Incremental_inputs_reader::input_file_index): New function.
3625 (Incremental_inputs_reader::input_file): Call input_file_offset.
3626 (Incremental_inputs_reader::input_file_at_offset): New function.
3627 (Incremental_relocs_reader::get_r_type): Reformat.
3628 (Incremental_relocs_reader::get_r_shndx): Reformat.
3629 (Incremental_relocs_reader::get_r_offset): Reformat.
3630 (Incremental_relocs_reader::data): New function.
3631 (Incremental_binary::Incremental_binary): Initialize new data members.
3632 (Incremental_binary::check_inputs): Add cmdline parameter.
3633 (Incremental_binary::file_is_unchanged): Remove.
3634 (Input_reader::arg_serial): New function.
3635 (Input_reader::get_unused_symbol_count): New function.
3636 (Input_reader::get_unused_symbol): New function.
3637 (Input_reader::do_arg_serial): New function.
3638 (Input_reader::do_get_unused_symbol_count): New function.
3639 (Input_reader::do_get_unused_symbol): New function.
3640 (Incremental_binary::input_file_count): New function.
3641 (Incremental_binary::get_input_reader): Change signature to use
3642 index instead of filename.
3643 (Incremental_binary::file_has_changed): New function.
3644 (Incremental_binary::get_input_argument): New function.
3645 (Incremental_binary::get_library): New function.
3646 (Incremental_binary::get_script_info): New function.
3647 (Incremental_binary::init_layout): New function.
3648 (Incremental_binary::reserve_layout): New function.
3649 (Incremental_binary::output_file): New function.
3650 (Incremental_binary::do_check_inputs): New function.
3651 (Incremental_binary::do_file_is_unchanged): Remove.
3652 (Incremental_binary::do_file_has_changed): New function.
3653 (Incremental_binary::do_init_layout): New function.
3654 (Incremental_binary::do_reserve_layout): New function.
3655 (Incremental_binary::do_input_file_count): New function.
3656 (Incremental_binary::do_get_input_reader): Change signature.
3657 (Incremental_binary::input_args_map_): New data member.
3658 (Incremental_binary::library_map_): New data member.
3659 (Incremental_binary::script_map_): New data member.
3660 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3661 new data members.
3662 (Sized_incremental_binary::output_section): New function.
3663 (Sized_incremental_binary::inputs_reader): Add const.
3664 (Sized_incremental_binary::symtab_reader): Add const.
3665 (Sized_incremental_binary::relocs_reader): Add const.
3666 (Sized_incremental_binary::got_plt_reader): Add const.
3667 (Sized_incremental_binary::get_symtab_view): New function.
3668 (Sized_incremental_binary::Inputs_reader): New typedef.
3669 (Sized_incremental_binary::Input_entry_reader): New typedef.
3670 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3671 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3672 (Sized_incremental_binary::do_file_has_changed): New function.
3673 (Sized_incremental_binary::do_init_layout): New function.
3674 (Sized_incremental_binary::do_reserve_layout): New function.
3675 (Sized_input_reader::Inputs_reader): Remove.
3676 (Sized_input_reader::Input_entry_reader): Remove.
3677 (Sized_input_reader::do_arg_serial): New function.
3678 (Sized_input_reader::do_get_unused_symbol_count): New function.
3679 (Sized_input_reader::do_get_unused_symbol): New function.
3680 (Sized_incremental_binary::do_input_file_count): New function.
3681 (Sized_incremental_binary::do_get_input_reader): Change signature;
3682 use index instead of filename.
3683 (Sized_incremental_binary::section_map_): New data member.
3684 (Sized_incremental_binary::input_entry_readers_): New data member.
3685 (class Sized_incr_relobj): New class.
3686 (class Sized_incr_dynobj): New class.
3687 (make_sized_incremental_object): New function.
3688 (class Incremental_library): New class.
3689 * layout.cc (Free_list::num_lists): New static data member.
3690 (Free_list::num_nodes): New static data member.
3691 (Free_list::num_removes): New static data member.
3692 (Free_list::num_remove_visits): New static data member.
3693 (Free_list::num_allocates): New static data member.
3694 (Free_list::num_allocate_visits): New static data member.
3695 (Free_list::init): New function.
3696 (Free_list::remove): New function.
3697 (Free_list::allocate): New function.
3698 (Free_list::dump): New function.
3699 (Free_list::print_stats): New function.
3700 (Layout_task_runner::run): Resize output file for incremental updates.
3701 (Layout::Layout): Initialize new data members.
3702 (Layout::set_incremental_base): New function.
3703 (Layout::init_fixed_output_section): New function.
3704 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3705 incremental updates.
3706 (Layout::create_gold_note): Do not create gold note section for
3707 incremental updates.
3708 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3709 for incremental updates.
3710 (Layout::set_section_offsets): For incremental updates, allocate space
3711 from free list.
3712 (Layout::create_symtab_sections): Layout with offsets relative to
3713 start of section; for incremental updates, allocate space from free
3714 list.
3715 (Layout::create_shdrs): For incremental updates, allocate space from
3716 free list.
3717 (Layout::finish_dynamic_section): For incremental updates, do not
3718 check --as-needed (fixed in subsequent patch).
3719 * layout.h (class Free_list): New class.
3720 (Layout::set_incremental_base): New function.
3721 (Layout::incremental_base): New function.
3722 (Layout::init_fixed_output_section): New function.
3723 (Layout::allocate): New function.
3724 (Layout::incremental_base_): New data member.
3725 (Layout::free_list_): New data member.
3726 * main.cc (main): Print Free_list statistics.
3727 * object.cc (Relobj::finalize_incremental_relocs): Add
3728 clear_counts parameter; clear counts only when clear_counts is set.
3729 (Sized_relobj::Sized_relobj): Initialize new base class.
3730 (Sized_relobj::do_layout): Don't report special sections.
3731 (Sized_relobj::do_for_all_local_got_entries): New function.
3732 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3733 symtab_off to all symbol table offsets.
3734 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3735 * object.h (class Got_offset_list): Move to top of file.
3736 (Object::Object): Allow case where input_file == NULL.
3737 (Object::~Object): Likewise.
3738 (Object::input_file): Assert that input_file != NULL.
3739 (Object::lock): Allow case where input_file == NULL.
3740 (Object::unlock): Likewise.
3741 (Object::is_locked): Likewise.
3742 (Object::token): Likewise.
3743 (Object::release): Likewise.
3744 (Object::is_incremental): New function.
3745 (Object::get_mtime): New function.
3746 (Object::for_all_local_got_entries): New function.
3747 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3748 (Object::set_is_in_system_directory): New function.
3749 (Object::is_in_system_directory): New function.
3750 (Object::do_is_incremental): New function.
3751 (Object::do_get_mtime): New function.
3752 (Object::do_for_all_local_got_entries): New function.
3753 (Object::is_in_system_directory_): New data member.
3754 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3755 (class Sized_relobj_base): New class.
3756 (class Sized_relobj): Derive from Sized_relobj_base.
3757 (class Sized_relobj::Symbols): Redeclare from base class.
3758 (class Sized_relobj::local_got_offset_list): Remove.
3759 (class Sized_relobj::Output_sections): Redeclare from base class.
3760 (class Sized_relobj::do_for_all_local_got_entries): New function.
3761 (class Sized_relobj::write_local_symbols): Add offset parameter.
3762 (class Sized_relobj::local_symbol_offset_): Update comment.
3763 (class Sized_relobj::local_dynsym_offset_): Update comment.
3764 * options.cc (Input_arguments::add_file): Remove const.
3765 * options.h (Input_file_argument::Input_file_argument):
3766 Initialize arg_serial_ (all constructors).
3767 (Input_file_argument::set_arg_serial): New function.
3768 (Input_file_argument::arg_serial): New function.
3769 (Input_file_argument::arg_serial_): New data member.
3770 (Input_arguments::Input_arguments): Initialize file_count_.
3771 (Input_arguments::add_file): Remove const.
3772 (Input_arguments::number_of_input_files): New function.
3773 (Input_arguments::file_count_): New data member.
3774 (Command_line::number_of_input_files): Call
3775 Input_arguments::number_of_input_files.
3776 * output.cc (Output_segment_headers::Output_segment_headers):
3777 Set current size.
3778 (Output_section::Input_section::current_data_size): New function.
3779 (Output_section::Output_section): Initialize new data members.
3780 (Output_section::add_input_section): Don't do merge sections for
3781 an incremental link; allocate space from free list for an
3782 incremental update.
3783 (Output_section::add_output_section_data): Allocate space from
3784 free list for an incremental update.
3785 (Output_section::update_data_size): New function.
3786 (Output_section::set_fixed_layout): New function.
3787 (Output_section::reserve): New function.
3788 (Output_segment::set_section_addresses): Remove const.
3789 (Output_segment::set_section_list_addresses): Remove const; allocate
3790 space from free list for an incremental update.
3791 (Output_segment::set_offset): Adjust size of RELRO segment for an
3792 incremental update.
3793 * output.h (Output_data::current_data_size): Move here from
3794 child classes.
3795 (Output_data::pre_finalize_data_size): New function.
3796 (Output_data::update_data_size): New function.
3797 (Output_section_headers::update_data_size): new function.
3798 (Output_section_data_build::current_data_size): Move to Output_data.
3799 (Output_data_strtab::update_data_size): New function.
3800 (Output_section::current_data_size): Move to Output_data.
3801 (Output_section::set_fixed_layout): New function.
3802 (Output_section::has_fixed_layout): New function.
3803 (Output_section::reserve): New function.
3804 (Output_section::update_data_size): New function.
3805 (Output_section::has_fixed_layout_): New data member.
3806 (Output_section::free_list_): New data member.
3807 (Output_segment::set_section_addresses): Remove const.
3808 (Output_segment::set_section_list_addresses): Remove const.
3809 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3810 New function.
3811 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3812 New function.
3813 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3814 parameter when calling Add_symbols constructor; store argument
3815 serial number for members of a lib group.
3816 (Add_symbols::locks): Allow case where token == NULL.
3817 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3818 (Read_member::~Read_member): New function.
3819 (Read_member::is_runnable): New function.
3820 (Read_member::locks): New function.
3821 (Read_member::run): New function.
3822 (Check_script::~Check_script): New function.
3823 (Check_script::is_runnable): New function.
3824 (Check_script::locks): New function.
3825 (Check_script::run): New function.
3826 (Check_library::~Check_library): New function.
3827 (Check_library::is_runnable): New function.
3828 (Check_library::locks): New function.
3829 (Check_library::run): New function.
3830 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3831 (Add_symbols::library_): New data member.
3832 (class Read_member): New class.
3833 (class Check_script): New class.
3834 (class Check_library): New class.
3835 * reloc.cc (Read_relocs::is_runnable): Allow case where
3836 token == NULL.
3837 (Read_relocs::locks): Likewise.
3838 (Scan_relocs::locks): Likewise.
3839 (Relocate_task::locks): Likewise.
3840 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3841 to clear counters.
3842 (Sized_relobj::incremental_relocs_scan): Fix comment.
3843 (Sized_relobj::do_relocate): Pass output file offset to
3844 write_local_symbols.
3845 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3846 from class declaration.
3847 * script.cc (read_input_script): Allocate Script_info; pass
3848 argument serial number to report_script.
3849 * script.h (class Script_info): Move to incremental.h.
3850 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3851 * symtab.h (Symbol_table::add_from_incrobj): New function.
3852 (Symbol_table::set_file_offset): New function.
3853
3854 2011-04-05 Cary Coutant <ccoutant@google.com>
3855
3856 * incremental-dump.cc (dump_incremental_inputs): Change signature
3857 to take a Sized_incremental_binary; change caller. Use readers
3858 in Sized_incremental_binary.
3859 * incremental.cc
3860 (Sized_incremental_binary::find_incremental_inputs_sections):
3861 Rename do_find_incremental_inputs_sections to this.
3862 (Sized_incremental_binary::setup_readers): New function.
3863 (Sized_incremental_binary::do_check_inputs): Check
3864 has_incremental_info_ flag; move setup code to setup_readers;
3865 use input readers.
3866 (Sized_incremental_binary::do_file_is_unchanged): New function.
3867 (Sized_incremental_binary::do_get_input_reader): New function.
3868 * incremental.h (class Incremental_binary): Move to end of file.
3869 (Incremental_binary::file_is_unchanged): New function.
3870 (Incremental_binary::do_file_is_unchanged): New function.
3871 (Incremental_binary::Input_reader): New class.
3872 (Incremental_binary::get_input_reader): New function.
3873 (class Sized_incremental_binary): Move to end of file.
3874 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3875 input section reader classes.
3876 (Sized_incremental_binary::has_incremental_info): New function.
3877 (Sized_incremental_binary::inputs_reader): New function.
3878 (Sized_incremental_binary::symtab_reader): New function.
3879 (Sized_incremental_binary::relocs_reader): New function.
3880 (Sized_incremental_binary::got_plt_reader): New function.
3881 (Sized_incremental_binary::do_file_is_unchanged): New function.
3882 (Sized_incremental_binary::Sized_input_reader): New class.
3883 (Sized_incremental_binary::get_input_reader): New function.
3884 (Sized_incremental_binary::find_incremental_inputs_sections):
3885 Rename do_find_incremental_inputs_sections to this.
3886 (Sized_incremental_binary::setup_readers): New function.
3887 (Sized_incremental_binary::has_incremental_info_): New data member.
3888 (Sized_incremental_binary::inputs_reader_): New data member.
3889 (Sized_incremental_binary::symtab_reader_): New data member.
3890 (Sized_incremental_binary::relocs_reader_): New data member.
3891 (Sized_incremental_binary::got_plt_reader_): New data member.
3892 (Sized_incremental_binary::current_input_file_): New data member.
3893
3894 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3895
3896 PR gold/12640
3897 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3898 violation.
3899
3900 2011-03-30 Cary Coutant <ccoutant@google.com>
3901
3902 * archive.cc (Archive::include_member): Adjust call to report_object.
3903 (Add_archive_symbols::run): Add script_info to call to
3904 report_archive_begin.
3905 (Lib_group::include_member): Adjust call to report_object.
3906 (Add_lib_group_symbols::run): Adjust call to report_object.
3907 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3908 blocks. Add object count for script input files.
3909 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3910 script_info parameter; change all callers.
3911 (Incremental_inputs::report_object): Add script_info parameter;
3912 change all callers.
3913 (Incremental_inputs::report_script): Store backpointer to
3914 incremental info entry.
3915 (Output_section_incremental_inputs::set_final_data_size): Record
3916 additional information for scripts.
3917 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3918 * incremental.h (Incremental_script_entry::add_object): New function.
3919 (Incremental_script_entry::get_object_count): New function.
3920 (Incremental_script_entry::get_object): New function.
3921 (Incremental_script_entry::objects_): New data member; adjust
3922 constructor.
3923 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3924 (Incremental_inputs::report_object): Add script_info parameter.
3925 (Incremental_inputs_reader::get_object_count): New function.
3926 (Incremental_inputs_reader::get_object_offset): New function.
3927 * options.cc (Input_arguments::add_file): Return reference to
3928 new input argument.
3929 * options.h (Input_argument::set_script_info): New function.
3930 (Input_argument::script_info): New function.
3931 (Input_argument::script_info_): New data member; adjust all
3932 constructors.
3933 (Input_file_group::add_file): Return reference to new input argument.
3934 (Input_file_lib::add_file): Likewise.
3935 (Input_arguments::add_file): Likewise.
3936 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3937 * script.cc (Parser_closure::Parser_closure): Add script_info
3938 parameter; adjust all callers.
3939 (Parser_closure::script_info): New function.
3940 (Parser_closure::script_info_): New data member.
3941 (read_input_script): Report scripts earlier to incremental info.
3942 (script_add_file): Set script_info in Input_argument.
3943 (script_add_library): Likewise.
3944 * script.h (Script_options::Script_info): Rewrite class.
3945
3946 2011-03-29 Cary Coutant <ccoutant@google.com>
3947
3948 * archive.cc (Library_base::should_include_member): Move
3949 method here from class Archive.
3950 (Archive::Archive): Initialize base class.
3951 (Archive::should_include_member): Move to base class.
3952 (Archive::do_for_all_unused_symbols): New function.
3953 (Add_archive_symbols::run): Remove redundant access to
3954 incremental_inputs.
3955 (Lib_group::Lib_group): Initialize base class.
3956 (Lib_group::do_filename): New function.
3957 (Lib_group::include_member): Pass pointer to Lib_group to
3958 report_object.
3959 (Lib_group::do_for_all_unused_symbols): New function.
3960 (Add_lib_group_symbols::run): Report archive information for
3961 incremental links.
3962 * archive.h (class Library_base): New base class.
3963 (class Archive): Derive from Library_base.
3964 (Archive::filename): Move to base class.
3965 (Archive::set_incremental_info): Likewise.
3966 (Archive::incremental_info): Likewise.
3967 (Archive::Should_include): Likewise.
3968 (Archive::should_include_member): Likewise.
3969 (Archive::Armap_entry): Remove.
3970 (Archive::Unused_symbol_iterator): Remove.
3971 (Archive::unused_symbols_begin): Remove.
3972 (Archive::unused_symbols_end): Remove.
3973 (Archive::do_filename): New function.
3974 (Archive::do_get_mtime): New function.
3975 (Archive::do_for_all_unused_symbols): New function.
3976 (Archive::task_): Move to base class.
3977 (Archive::incremental_info_): Likewise.
3978 (class Lib_group): Derive from Library_base.
3979 (Lib_group::do_filename): New function.
3980 (Lib_group::do_get_mtime): New function.
3981 (Lib_group::do_for_all_unused_symbols): New function.
3982 (Lib_group::task_): Move to base class.
3983 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3984 function.
3985 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3986 function.
3987 * incremental.cc (Incremental_inputs::report_archive_begin):
3988 Use Library_base; call library's get_mtime; add incremental inputs
3989 entry before members.
3990 (class Unused_symbol_visitor): New class.
3991 (Incremental_inputs::report_archive_end): Use Library_base; use
3992 visitor class to record unused symbols; don't add incremental inputs
3993 entry after members.
3994 (Incremental_inputs::report_object): Use Library_base.
3995 * incremental.h
3996 (Incremental_archive_entry::Incremental_archive_entry): Remove
3997 unused Archive parameter.
3998 (Incremental_inputs::report_archive_begin): Use Library_base.
3999 (Incremental_inputs::report_archive_end): Likewise.
4000 (Incremental_inputs::report_object): Likewise.
4001 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4002 function.
4003 * object.h (Object::for_all_global_symbols): New function.
4004 (Object::do_for_all_global_symbols): New function.
4005 (Sized_relobj::do_for_all_global_symbols): New function.
4006 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4007 function.
4008 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4009 function.
4010
4011 2011-03-27 Ian Lance Taylor <iant@google.com>
4012
4013 * archive.cc (Archive::interpret_header): Return -1 if something
4014 goes wrong. Change callers accordingly.
4015
4016 2011-03-25 Cary Coutant <ccoutant@google.com>
4017
4018 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4019 * testsuite/Makefile.in: Regenerate.
4020
4021 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4022
4023 * plugin.cc (get_view): New.
4024 (Plugin::load): Pass get_view to the plugin.
4025 (Plugin_manager::get_view): New.
4026
4027 2011-03-21 Ian Lance Taylor <iant@google.com>
4028
4029 * testsuite/final_layout.sh: Rewrite to not use dc.
4030 * testsuite/relro_test.sh: Fail if dc is not present.
4031
4032 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4033
4034 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4035 Change == to -eq.
4036 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4037 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4038 Change == to -eq.
4039 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4040 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4041
4042 2011-03-14 Ian Lance Taylor <iant@google.com>
4043
4044 * script-sections.cc (Sort_output_sections::script_compare):
4045 Rename from is_before, change return type.
4046 (Sort_output_sections::operator()): Adjust accordingly.
4047
4048 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4049
4050 PR gold/12572
4051 * testsuite/odr_violation2.cc: Add comment to make all error line
4052 numbers double digits.
4053 * testsuite/debug_msg.sh: Adjust expected errors.
4054
4055 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4056
4057 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4058 but mark earlier ones as non-canonical
4059 (offset_to_iterator): Update search target and example
4060 (do_addr2line): Return extra lines in a vector*
4061 (format_file_lineno): Extract from do_addr2line
4062 (one_addr2line): Add vector* out-param
4063 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4064 when a lineno entry appeared last for its instruction
4065 (Dwarf_line_info): Add vector* out-param
4066 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4067 * symtab.cc (Odr_violation_compare): Include the lineno in the
4068 comparison again.
4069 (linenos_from_loc): New. Combine the canonical line for an
4070 address with its other lines.
4071 (True_if_intersect): New. Helper functor to make
4072 std::set_intersection a query.
4073 (detect_odr_violations): Compare sets of lines instead of just
4074 one line for each function. This became less deterministic, but
4075 has fewer false positives.
4076 * symtab.h: Declarations.
4077 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4078 mix an optimized and non-optimized object in the same binary
4079 (odr_violation2.so): Same.
4080 * testsuite/Makefile.in: Regenerate from Makefile.am.
4081 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4082 * testsuite/debug_msg.sh: Update line numbers and add
4083 assertions.
4084 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4085 non-optimized context.
4086 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4087 isn't inlined, and use OdrDerived in an optimized context.
4088 * testsuite/odr_header1.h: Defines OdrDerived, where
4089 optimization will change the
4090 first-instruction-in-the-destructor's file and line number.
4091 * testsuite/odr_header2.h: Defines OdrBase.
4092
4093 2011-03-09 Ian Lance Taylor <iant@google.com>
4094
4095 * fileread.cc (File_read::clear_views): Don't delete the whole
4096 file view.
4097
4098 2011-03-08 Ian Lance Taylor <iant@google.com>
4099
4100 PR gold/12525
4101 * fileread.cc: #include <climits>.
4102 (GOLD_IOV_MAX): Define.
4103 (File_read::read_multiple): Limit number of entries by iov_max.
4104 * fileread.h (class File_read): Always set max_readv_entries to
4105 128.
4106
4107 2011-03-07 Ian Lance Taylor <iant@google.com>
4108
4109 PR gold/12525
4110 * options.h (class General_options): Add -dy and -dn.
4111
4112 2011-03-02 Cary Coutant <ccoutant@google.com>
4113
4114 * testsuite/script_test_9.t: Add TLS segment.
4115
4116 2011-03-02 Simon Baldwin <simonb@google.com>
4117
4118 * configure.ac: Add check for gnu_indirect_function support in
4119 the toolchain building binutils.
4120 * configure: Rebuild.
4121
4122 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4123
4124 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4125 plugin only symbols.
4126 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4127 in plugin files as not needed in the symbol table.
4128
4129 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4130
4131 * output.cc (Output_section::add_input_section): Delay fill
4132 generation for section ordering.
4133
4134 2011-02-09 Ian Lance Taylor <iant@google.com>
4135
4136 PR gold/12316
4137 * object.h (class Sized_relobj): Remove clear_local_symbols.
4138 * reloc.cc (Sized_relobj::do_relocate): Don't call
4139 clear_local_symbols.
4140
4141 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4142
4143 * plugin.cc (is_visible_from_outside): Return true for symbols
4144 in the -u option.
4145
4146 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4147
4148 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4149 filename.
4150
4151 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4152
4153 * icf.h (is_section_foldable_candidate): Change type of parameter
4154 to std::string.
4155 * icf.cc (Icf::find_identical_sections): Change type of local variable
4156 section_name to be std::string.
4157 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4158
4159 2011-01-25 Ian Lance Taylor <iant@google.com>
4160
4161 * script.cc (script_add_extern): Rewrite to use
4162 add_symbol_reference.
4163
4164 2011-01-25 Doug Kwan <dougkwan@google.com>
4165
4166 * icf.cc (get_section_contents): Always lock section's object.
4167
4168 2011-01-24 Ian Lance Taylor <iant@google.com>
4169
4170 * options.h (class General_options): Accept
4171 --no-detect-odr-violations.
4172
4173 2011-01-24 Ian Lance Taylor <iant@google.com>
4174
4175 * version.cc (version_string): Bump to 1.11.
4176
4177 2011-01-24 Ian Lance Taylor <iant@google.com>
4178
4179 * plugin.cc (class Plugin_rescan): Define new class.
4180 (Plugin_manager::claim_file): Set any_claimed_.
4181 (Plugin_manager::save_archive): New function.
4182 (Plugin_manager::save_input_group): New function.
4183 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4184 necessary.
4185 (Plugin_manager::new_undefined_symbol): New function.
4186 (Plugin_manager::rescan): New function.
4187 (Plugin_manager::rescannable_defines): New function.
4188 (Plugin_manager::add_input_file): Set any_added_.
4189 * plugin.h (class Plugin_manager): define new fields rescannable_,
4190 undefined_symbols_, any_claimed_, and any_added_. Declare
4191 Plugin_rescan as friend. Declare new functions.
4192 (Plugin_manager::Rescannable): Define type.
4193 (Plugin_manager::Rescannable_list): Define type.
4194 (Plugin_manager::Undefined_symbol_list): Define type.
4195 (Plugin_manager::Plugin_manager): Initialize new fields.
4196 * archive.cc (Archive::defines_symbol): New function.
4197 (Add_archive_symbols::run): Pass archive to plugins if any.
4198 * archive.h (class Archive): Declare defines_symbol.
4199 * readsyms.cc (Input_group::~Input_group): New function.
4200 (Finish_group::run): Pass input_group to plugins if any.
4201 * readsyms.h (class Input_group): Declare destructor.
4202 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4203 any.
4204
4205 2011-01-10 Ian Lance Taylor <iant@google.com>
4206
4207 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4208 section as relro.
4209 (Layout::set_segment_offsets): Reset increase_relro before calling
4210 set_section_addresses a second time.
4211
4212 2011-01-04 Cary Coutant <ccoutant@google.com>
4213
4214 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4215 sections before NOBITS sections.
4216
4217 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4218
4219 * version.cc (print_version): Update copyright to 2011.
4220
4221 2010-12-23 Cary Coutant <ccoutant@google.com>
4222
4223 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4224 of OS to this->add. Add OD parameter to second form of the function.
4225
4226 2010-12-20 Ian Lance Taylor <iant@google.com>
4227
4228 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4229 second of two consecutive entries with same offset.
4230
4231 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4232
4233 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4234 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4235 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4236 to avoid unneeded links against $(LDADD).
4237 * testsuite/Makefile.in: Regenerate.
4238
4239 2010-12-15 Ian Lance Taylor <iant@google.com>
4240
4241 PR gold/12324
4242 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4243 for R_X86_64_32 and R_X86_64_PC32.
4244 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4245 ver_matching_def_pic.o.
4246 (ver_matching_def_pic.o): New target.
4247
4248 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4249
4250 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4251 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4252 Move definition before File_read::View member definitions.
4253 (File_read::View::~View): Initialize and hold lock before
4254 updating current_mapped_bytes.
4255
4256 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4257
4258 * dwarf_reader.cc: Remove outdated comment.
4259 * gold-threads.cc: Fix typo in error message.
4260 * archive.cc: Fix typos in comments.
4261 * archive.h: Likewise.
4262 * arm-reloc-property.cc: Likewise.
4263 * arm-reloc-property.h: Likewise.
4264 * arm-reloc.def: Likewise.
4265 * arm.cc: Likewise.
4266 * attributes.h: Likewise.
4267 * cref.cc: Likewise.
4268 * ehframe.cc: Likewise.
4269 * fileread.h: Likewise.
4270 * gold.h: Likewise.
4271 * i386.cc: Likewise.
4272 * icf.cc: Likewise.
4273 * incremental.h: Likewise.
4274 * int_encoding.cc: Likewise.
4275 * layout.h: Likewise.
4276 * main.cc: Likewise.
4277 * merge.h: Likewise.
4278 * object.cc: Likewise.
4279 * object.h: Likewise.
4280 * options.cc: Likewise.
4281 * readsyms.cc: Likewise.
4282 * reduced_debug_output.cc: Likewise.
4283 * reloc.cc: Likewise.
4284 * script-sections.cc: Likewise.
4285 * sparc.cc: Likewise.
4286 * symtab.h: Likewise.
4287 * target-reloc.h: Likewise.
4288 * target.cc: Likewise.
4289 * target.h: Likewise.
4290 * timer.cc: Likewise.
4291 * timer.h: Likewise.
4292 * x86_64.cc: Likewise.
4293
4294 2010-12-09 Cary Coutant <ccoutant@google.com>
4295
4296 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4297 stack.
4298 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4299 parameter; change all callers.
4300 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4301 * options.h (warn_execstack): New option.
4302
4303 2010-12-07 Doug Kwan <dougkwan@google.com>
4304
4305 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4306 like function call relocations.
4307
4308 2010-12-07 Ian Lance Taylor <iant@google.com>
4309
4310 * archive.cc (Archive::get_elf_object_for_member): Permit
4311 punconfigured to be NULL.
4312 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4313 (Archive::include_member): Pass NULL to get_elf_object_for_member
4314 if we searched for the archive and this is the first included
4315 object.
4316
4317 2010-12-01 Ian Lance Taylor <iant@google.com>
4318
4319 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4320 track_relocs_type_ field.
4321 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4322 Set track_relocs_type_.
4323 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4324 contents when using RELA relocs.
4325 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4326 reloc_map_.
4327 * reloc.cc (Track_relocs::next_addend): New function.
4328 * reloc.h (class Track_relocs): Declare next_addend.
4329
4330 2010-12-01 Ian Lance Taylor <iant@google.com>
4331
4332 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4333 virtual destructor.
4334
4335 2010-12-01 Ian Lance Taylor <iant@google.com>
4336
4337 * README: Update compilers known to work and fail.
4338
4339 2010-11-23 Matthias Klose <doko@ubuntu.com>
4340
4341 * configure.in: For --enable-gold, handle value `default' instead of
4342 `both*'. Always install ld as ld.bfd, install as ld if gold is
4343 not the default.
4344 * configure: Regenerate.
4345
4346 2010-11-18 Doug Kwan <dougkwan@google.com>
4347
4348 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4349 and right_alignment to be zero. Store result alignment only if it is
4350 greater than existing alignment.
4351
4352 2010-11-16 Cary Coutant <ccoutant@google.com>
4353
4354 PR gold/12220
4355 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4356 Check for ".zdebug_line".
4357
4358 2010-11-16 Doug Kwan <dougkwan@google.com>
4359 Cary Coutant <ccoutant@google.com>
4360
4361 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4362 by reference; adjust all callers.
4363 * output.cc (Output_segment::set_section_addresses): Adjust references
4364 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4365 list is empty.
4366 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4367 end at page boundary.
4368
4369 2010-11-16 Cary Coutant <ccoutant@google.com>
4370
4371 PR gold/12220
4372 * layout.cc (Layout::choose_output_section): Transform names of
4373 compressed sections even when using a script with a SECTIONS clause.
4374 (Layout::output_section_name): Remove code to transform
4375 compressed debug section names.
4376 * output.cc (Output_section::add_input_section): Use uncompressed
4377 section size when tracking input sections.
4378
4379 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4380
4381 * symtab.h (Symbol::NON_PIC_REF): Remove.
4382 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4383 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4384 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4385 (Symbol::use_plt_offset): Take a flags argument and pass it
4386 directly to needs_dynamic_reloc. Restrict check for undefined
4387 weak symbols to function calls.
4388 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4389 (Target_arm::Scan::global): Use it.
4390 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4391 (Target_arm::Relocate::relocate): Likewise.
4392 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4393 parameter with an r_type parameter. Use get_reference_flags
4394 to get the flags.
4395 (Target_arm::Relocate::relocate): Update accordingly.
4396 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4397 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4398 (Target_i386::Scan::global): Likewise.
4399 (Target_i386::Relocate::relocate): Likewise.
4400 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4401 parameter with an r_type parameter. Use get_reference_flags
4402 to get the flags.
4403 (Target_i386::Relocate::relocate): Update accordingly.
4404 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4405 (Target_powerpc::Scan::global): Use it.
4406 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4407 (Target_powerpc::Relocate::relocate): Likewise.
4408 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4409 (Target_sparc::Scan::global): Use it.
4410 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4411 (Target_sparc::Relocate::relocate): Likewise.
4412 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4413 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4414 (Target_x86_64::Scan::global): Likewise.
4415 (Target_x86_64::Relocate::relocate): Likewise.
4416
4417 2010-11-08 Doug Kwan <dougkwan@google.com>
4418 Cary Coutant <ccoutant@google.com>
4419
4420 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4421 (Arm_exidx_merge_section::section_contents_): New data member.
4422 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4423 (Arm_input_section::~Arm_input_section): De-allocate memory.
4424 (Arm_input_section::original_contents_): New data member.
4425 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4426 in parameters instead of calling Object::section_contents without
4427 locking.
4428 (Arm_output_section::group_section): New parameter TASK. Pass it
4429 to callees that need locking objects.
4430 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4431 to lock EXIDX input sections. Fix a formatting issue. Call
4432 Arm_exidx_merged_section::build_contents to create merged section
4433 contents.
4434 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4435 to lock object of stub table owner.
4436 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4437 TEXT_SIZE to initialize data member TEXT_SIZE_.
4438 (Arm_exidx_input_section::addralign): Fix typo in comment.
4439 (Arm_exidx_input_section::text_size): New method.
4440 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4441 that require locking objects. Lock objects before scanning for stubs
4442 and updating local symbols.
4443 (Arm_input_section<big_endian>::init): Copy contents of original
4444 input section.
4445 (Arm_input_section<big_endian>::do_write): Use saved contents of
4446 original input section instead of calling Object::section_contents
4447 without locking.
4448 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4449 size without calling Object::section_size().
4450 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4451 for size. Allocate a buffer for merged EXIDX entries.
4452 (Arm_exidx_merged_section::build_contents): New method.
4453 (Arm_exidx_merged_section::do_write): Move merge section contents
4454 building code to Arm_exidx_merged_section::build_contetns. Write
4455 out contetns in buffer instead of building it on the fly.
4456 (Arm_relobj::make_exidx_input_section): Also pass text section size
4457 to Arm_exidx_input_section constructor.
4458 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4459 (Arm_dynobj::do_read_symbols): Fix memory leak.
4460 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4461 * target.h: (class Task): Add forward declaration.
4462 (Target::relax): Add new parameter TASK and pass it to
4463 Target::do_relax().
4464 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4465
4466 2010-11-05 Cary Coutant <ccoutant@google.com>
4467
4468 PR gold/10708
4469 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4470 object when reading from the file.
4471 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4472 second layout pass.
4473 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4474 when reading section contents.
4475 (get_section_contents): Likewise.
4476 (icf::find_identical_sections): Likewise.
4477 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4478 object when reading from the file.
4479 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4480 the object when doing deferred section layout.
4481
4482 2010-11-03 Nick Clifton <nickc@redhat.com>
4483
4484 PR gold/12001
4485 * script.h (class Symbol_assignment: name): New member. Returns
4486 the name of the symbol.
4487 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4488 Returns true if the given symbol name is on the list of
4489 assignments wating to be processed.
4490 * archive.cc (should_incldue_member): If the symbol is undefined,
4491 check to see if it is on the list of symbols pending assignment.
4492
4493 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4494
4495 * script-sections.cc (Script_sections::find_memory_region): Check
4496 for a NULL output section pointer.
4497
4498 2010-10-29 Doug Kwan <dougkwan@google.com>
4499
4500 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4501 Output_section::add_relaxed_input_section.
4502 * output.cc (Output_section::add_relaxed_input_section): Add new
4503 arguments LAYOUT and NAME. Set section order index.
4504 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4505 Copy section order index.
4506 * output.h (Output_section::add_relaxed_input_section): Add new
4507 arguments LAYOUT and NAME.
4508
4509 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4510
4511 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4512 NATIVE_OR_CROSS_LINKER.
4513 * testsuite/Makefile.in: Regenerate.
4514
4515 2010-10-20 Doug Kwan <dougkwan@google.com>
4516
4517 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4518 without SHF_LINK_ORDER flags.
4519 * layout.cc (Layout::choose_output_section): Do not filter
4520 SHF_LINK_ORDER flag in a relocatable link.
4521
4522 2010-10-17 Cary Coutant <ccoutant@google.com>
4523
4524 * output.h (Output_segment::set_section_addresses): Change function
4525 signature. Update all callers.
4526 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4527 sections.
4528 (Output_segment::set_section_addresses): Align after last TLS
4529 section. Add padding before last relro section instead of after.
4530
4531 2010-10-17 Doug Kwan <dougkwan@google.com>
4532
4533 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4534 GOT output section to be writable.
4535
4536 2010-10-14 Cary Coutant <ccoutant@google.com>
4537
4538 * debug.h (DEBUG_INCREMENTAL): New flag.
4539 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4540 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4541 mode.
4542 * incremental.cc (report_command_line): Ignore all forms of
4543 --incremental.
4544 * layout.cc (Layout::Layout): Check parameters for incremental link
4545 mode.
4546 * options.cc (General_options::parse_incremental): New function.
4547 (General_options::parse_no_incremental): New function.
4548 (General_options::parse_incremental_full): New function.
4549 (General_options::parse_incremental_update): New function.
4550 (General_options::incremental_mode_): New data member.
4551 (General_options::finalize): Check incremental_mode_.
4552 * options.h (General_options): Update help text for --incremental.
4553 Add --no-incremental, --incremental-full, --incremental-update.
4554 (General_options::Incremental_mode): New enum type.
4555 (General_options::incremental_mode): New function.
4556 (General_options::incremental_mode_): New data member.
4557 * parameters.cc (Parameters::incremental_mode_): New data member.
4558 (Parameters::set_options): Set incremental_mode_.
4559 (Parameters::set_incremental_full): New function.
4560 (Parameters::incremental): New function.
4561 (Parameters::incremental_update): New function.
4562 (set_parameters_incremental_full): New function.
4563 * parameters.h (Parameters::set_incremental_full): New function.
4564 (Parameters::incremental): New function.
4565 (Parameters::incremental_update): New function.
4566 (Parameters::incremental_mode_): New data member.
4567 (set_parameters_incremental_full): New function.
4568 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4569 incremental link mode.
4570 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4571 (Sized_relobj::do_relocate_sections): Likewise.
4572 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4573 option.
4574 * testsuite/Makefile.in: Regenerate.
4575 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4576
4577 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4578
4579 * script-sections.h (class Script_sections): Make
4580 Sections_elements typedef public.
4581 * script-sections.cc (class Sort_output_sections): Add elements_
4582 field. Add constructor which sets it; change all callers.
4583 (Sort_output_sections::is_before): New function.
4584 (Sort_output_sections::operator()): Call is_before.
4585 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4586 conditional.
4587 * testsuite/script_test_10.sh: New test. Test script section
4588 order.
4589 * testsuite/script_test_10.t: Likewise.
4590 * testsuite/script_test_10.s: Likewise.
4591 * testsuite/Makefile.am: Wrap the cross linker tests and the
4592 common tests into NATIVE_OR_CROSS_LINKER.
4593 (check_SCRIPTS): Add script_test_10.sh.
4594 (check_DATA): Add script_test_10.stdout.
4595 (script_test_10.o, script_test_10): New targets.
4596 (script_test_10.stdout): New target.
4597 * configure, testsuite/Makefile.in: Regenerate.
4598
4599 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4600
4601 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4602 error for the deprecated relocations.
4603 (Target_arm::Scan::global): Likewise.
4604 (Target_arm::Relocate::relocate): Likewise.
4605
4606 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4607
4608 * fileread.cc (Input_file::find_file): Initialize *found_name
4609 and *namep when using the fallback search for case 4.
4610
4611 2010-10-11 Cary Coutant <ccoutant@google.com>
4612
4613 * options.h (class General_options): Redefine -z lazy as an alias for
4614 the negation of -z now.
4615
4616 2010-10-11 Ian Lance Taylor <iant@google.com>
4617
4618 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4619 binding.
4620
4621 2010-10-06 Nick Clifton <nickc@redhat.com>
4622
4623 * script-sections.cc(class Memory_region): Remove
4624 current_lma_offset_ field. Rename current_vma_offset_ to
4625 current_offset_. Add last_section_ field.
4626 (Memory_region::get_current_vma_address): Rename to
4627 get_current_address.
4628 (Memory_region::get_current_lma_address): Delete.
4629 (Memory_region::increment_vma_offset): Rename to
4630 increment_offset.
4631 (Memory_region::increment_lma_offset): Delete.
4632 (Memory_region::attributes_compatible): New method. Returns
4633 true if the provided section is compatible with the region.
4634 (Memory_region::get_last_section): New method. Returns the last
4635 section to use the region.
4636 (Memory_region::set_last_section): New method. Stores the last
4637 section to use the region.
4638 (Script_sections::block_in_region): New method. Returns true if
4639 a block of memory is contained within a region.
4640 (Script_sections::find_memory_region): New method. Locates a
4641 memory region to be used to set a VMA or LMA address.
4642 (Output_section_definition::set_section_addresses): Add code to
4643 check for addresses set by memory regions.
4644 (Output_segment::set_section_addresses): Remove memory region
4645 walking code.
4646 (Script_sections::create_segment): Add a warning if a header
4647 segment is created outside of any region.
4648 * script-sections.h (class Script_sections): Add prototypes for
4649 find_memory_region and block_in_region methods.
4650 * testsuite/memory_test.s: Use .long instead of .word.
4651 * testsuite/memory_test.t: Add some more output sections.
4652 * testsuite/memory_test.sh: Update expected output.
4653
4654 2010-10-02 Doug Kwan <dougkwan@google.com>
4655
4656 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4657 defintion to symtab.h
4658 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4659 declaration to defintion.
4660
4661 2010-10-01 Nick Clifton <nickc@redhat.com>
4662
4663 * expression.cc (eval): Replace dummy argument with NULL.
4664 (eval_maybe_dot): Check for a NULL result section pointer.
4665 (Symbol_expression::value): Likewise.
4666 (Dot_expression::value): Likewise.
4667 (BINARY_EXPRESSION): Likewise.
4668 (Max_expression::value): Likewise.
4669 (Min_expression::value): Likewise.
4670 (Absolute_expression::value): Likewise.
4671 (Addr_expression::value_from_output_section): Likewise.
4672 (Loaddddr_expression::value_from_output_section): Likewise.
4673 (Segment_start_expression::value): Likewise.
4674 * script-sections.cc
4675 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4676 argument with NULL.
4677 (Sections_elememt_dot_assignment::set_section_addresses):
4678 Likewise.
4679 (Output_data_expression::do_write_to_buffer): Likewise.
4680 (Output_section_definition::finalize_symbols): Likewise.
4681 (Output_section_definition::set_section_addresses): Likewise.
4682
4683 2010-09-30 Doug Kwan <dougkwan@google.com>
4684
4685 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4686
4687 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4688
4689 * target.h (Target::can_icf_inline_merge_sections): New virtual
4690 function.
4691 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4692 virtual function.
4693 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4694 virtual function.
4695 * icf.cc (get_section_contents): Inline merge sections only when
4696 target allows it.
4697
4698 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4699
4700 * configure: Regenerate.
4701
4702 2010-09-17 Ian Lance Taylor <iant@google.com>
4703
4704 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4705 * testsuite/Makefile.am (memory_test.o): New target.
4706 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4707 memory_test.t.
4708 * testsuite/Makefile.in: Rebuild.
4709
4710 2010-09-17 Doug Kwan <dougkwan@google.com>
4711
4712 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4713 defintion if relocation uses GOT entries of the symbol.
4714 * testsuite/icf_safe_test.sh: Fix test.
4715 * testsuite/icf_safe_so_test.sh: Fix test.
4716
4717 2010-09-16 Cary Coutant <ccoutant@google.com>
4718
4719 * script_sections.cc (class Memory_region): Remove "NULL" from
4720 vector initializations.
4721
4722 2010-09-15 Cary Coutant <ccoutant@google.com>
4723
4724 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4725 Resolve forwarding symbols.
4726
4727 2010-09-15 Doug Kwan <dougkwan@google.com>
4728
4729 * gold/testsuite/script_test_3.t: Add ARM special sections.
4730 * gold/testsuite/script_test_4.t: Same.
4731 * gold/testsuite/script_test_5.t: Same.
4732 * gold/testsuite/script_test_6.t: Same.
4733 * gold/testsuite/script_test_7.t: Same.
4734 * gold/testsuite/script_test_7.t: Same.
4735 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4736
4737 2010-09-14 Cary Coutant <ccoutant@google.com>
4738
4739 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4740 (Target_x86_64::Relocate::relocate_tls): Replace check for
4741 saw_tls_block_reloc_ with test for executable section.
4742
4743 2010-09-12 Cary Coutant <ccoutant@google.com>
4744
4745 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4746 position-independent executables to shared libraries need dynamic
4747 relocations.
4748 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4749 position-independent executables.
4750 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4751 * testsuite/Makefile.in: Regenerate.
4752
4753 2010-09-10 Nick Clifton <nickc@redhat.com>
4754
4755 PR gold/11997
4756 * testsuite/memory_test.t: Discard any sections that are not
4757 needed.
4758
4759 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4760
4761 PR gold/11996
4762 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4763 "This::" to work around a bug in gcc 4.2.
4764
4765 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4766
4767 2010-09-09 Rafael Espindola <espindola@google.com>
4768
4769 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4770 sections with different PF_X flags in the same segment.
4771 (Layout::find_first_load_seg): Search all segments to find the first
4772 one.
4773 * options.h (rosegment): New.
4774
4775 2010-09-08 Rafael Espindola <espindola@google.com>
4776
4777 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4778
4779 2010-09-08 Doug Kwan <dougkwan@google.com>
4780
4781 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4782 (Arm_relobj::do_relocate_sections): Add new parameter for output
4783 file to match the parent.
4784 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4785 of local symbols instead of input values. Update code to track
4786 changes in gold::relocate_section.
4787 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4788 (Sized_relobj::compute_final_local_value_internal): New methods.
4789 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4790 body into private version of Sized_relobj::compute_final_local_value.
4791 Call the inline method.
4792 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4793 merged symbol value if there is one.
4794 (Symbol_value::has_output_value): New method defintiion.
4795 (Sized_relobj::Compute_final_local_value_status): New enum type.
4796 (Sized_relobj::compute_final_local_value): New methods.
4797 (Sized_relobj::compute_final_local_value_internal): New methods.
4798 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4799 and arm_cortex_a8.sh.
4800 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4801 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4802 New tests.
4803 * Makefile.in: Regenerate.
4804 * testsuite/arm_bl_out_of_range.s: Update test.
4805 * testsuite/thumb_bl_out_of_range.s: Ditto.
4806 * testsuite/thumb_blx_out_of_range.s: Ditto.
4807 * testsuite/arm_branch_out_of_range.sh: New file.
4808 * testsuite/arm_cortex_a8.sh: Ditto.
4809 * testsuite/arm_cortex_a8_b.s: Ditto.
4810 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4811 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4812 * testsuite/arm_cortex_a8_bl.s: Ditto.
4813 * testsuite/arm_cortex_a8_blx.s: Ditto.
4814 * testsuite/arm_cortex_a8_local.s: Ditto.
4815 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4816 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4817
4818 2010-09-08 Rafael Espindola <espindola@google.com>
4819
4820 * Makefile.am (memory_test.stdout): Run readelf with -W.
4821 * Makefile.in: Regenerate.
4822 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4823 64 bit output.
4824
4825 2010-09-08 Rafael Espindola <espindola@google.com>
4826
4827 * script-sections.cc (Script_sections::add_memory_region): Convert
4828 field precision to int.
4829 * script.cc (script_set_section_region, script_set_section_region):
4830 Convert field precision to int.
4831
4832 2010-09-08 Rafael Espindola <espindola@google.com>
4833
4834 * arm.cc (do_finalize_sections): Create the __exidx_start and
4835 __exdix_end symbols even when the section is missing.
4836
4837 2010-09-08 Nick Clifton <nickc@redhat.com>
4838
4839 * README: Remove claim that MEMORY is not supported.
4840 * expression.cc (script_exp_function_origin)
4841 (script_exp_function_length): Move from here to ...
4842 * script.cc: ... here.
4843 (script_set_section_region, script_add_memory)
4844 (script_parse_memory_attr, script_include_directive): New
4845 functions.
4846 * script-sections.cc
4847 (class Memory_region): New class.
4848 (class Output_section_definition): Add set_memory_region,
4849 set_section_vma, set_section_lma and get_section_name methods.
4850 (class Script_Sections): Add add_memory_region,
4851 find_memory_region, find_memory_region_origin,
4852 find_memory_region_length and set_memory_region methods.
4853 Have set_section_addresses method walk the list of set memory
4854 regions.
4855 Extend the print methos to display memory regions.
4856 * script-sections.h: Add prototypes for new methods.
4857 Add enum for MEMORY region attributes.
4858 * yyscript.y: Add support for parsing MEMORY regions.
4859 * script-c.h: Add prototypes for new functions.
4860 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4861 * testsuite/Makefile.in: Regenerate.
4862 * testsuite/memory_test.sh: New script.
4863 * testsuite/memory_test.s: New assembler source file.
4864 * testsuite/memory_test.t: New linker script.
4865
4866 2010-08-27 Doug Kwan <dougkwan@google.com>
4867
4868 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4869 reference override an existing dynamic weak reference.
4870 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4871 * testsuite/Makefile.in: Regenerate.
4872 * testsuite/dyn_weak_ref.sh: New file.
4873 * testsuite/dyn_weak_ref_1.c: Ditto.
4874 * testsuite/dyn_weak_ref_2.c: Ditto.
4875
4876 2010-08-27 Ian Lance Taylor <iant@google.com>
4877
4878 * incremental.h (class Incremental_input_entry): Add virtual
4879 destructor.
4880
4881 2010-08-27 Ian Lance Taylor <iant@google.com>
4882
4883 * testsuite/start_lib_test_3.c: Mark t3 as used.
4884
4885 2010-08-27 Nick Clifton <nickc@redhat.com>
4886
4887 * options.cc (version_script): Fix small typo in previous
4888 whitespace tidyup.
4889
4890 2010-08-25 Nick Clifton <nickc@redhat.com>
4891
4892 * archive.cc: Formatting fixes: Remove whitespace between
4893 typename and following asterisk. Remove whitespace between
4894 function name and opening parenthesis.
4895 * archive.h: Likewise.
4896 * arm.cc: Likewise.
4897 * attributes.cc: Likewise.
4898 * attributes.h: Likewise.
4899 * common.cc: Likewise.
4900 * copy-relocs.cc: Likewise.
4901 * dirsearch.h: Likewise.
4902 * dynobj.cc: Likewise.
4903 * ehframe.cc: Likewise.
4904 * ehframe.h: Likewise.
4905 * expression.cc: Likewise.
4906 * fileread.cc: Likewise.
4907 * fileread.h: Likewise.
4908 * gc.h: Likewise.
4909 * gold-threads.cc: Likewise.
4910 * gold.cc: Likewise.
4911 * i386.cc: Likewise.
4912 * icf.h: Likewise.
4913 * incremental-dump.cc: Likewise.
4914 * incremental.cc: Likewise.
4915 * layout.cc: Likewise.
4916 * layout.h: Likewise.
4917 * main.cc: Likewise.
4918 * merge.cc: Likewise.
4919 * merge.h: Likewise.
4920 * object.cc: Likewise.
4921 * object.h: Likewise.
4922 * options.cc: Likewise.
4923 * options.h: Likewise.
4924 * output.cc: Likewise.
4925 * output.h: Likewise.
4926 * plugin.cc: Likewise.
4927 * plugin.h: Likewise.
4928 * powerpc.cc: Likewise.
4929 * reloc.cc: Likewise.
4930 * script-c.h: Likewise.
4931 * script-sections.cc: Likewise.
4932 * script.cc: Likewise.
4933 * stringpool.cc: Likewise.
4934 * symtab.cc: Likewise.
4935 * symtab.h: Likewise.
4936 * target.cc: Likewise.
4937 * timer.cc: Likewise.
4938 * timer.h: Likewise.
4939 * version.cc: Likewise.
4940 * x86_64.cc: Likewise.
4941
4942 2010-08-24 Nick Clifton <nickc@redhat.com>
4943
4944 PR 11899
4945 * layout.cc (segment_precedes): Sort segments by their physical
4946 addresses, if they have been set.
4947
4948 2010-08-23 Cary Coutant <ccoutant@google.com>
4949
4950 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4951 symbols data.
4952 (Lib_group::include_member): Unlock object after deleting its
4953 symbols data.
4954 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4955 the bug fixed here.
4956
4957 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4958 Cary Coutant <ccoutant@google.com>
4959
4960 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4961 constructor, and set_blocker.
4962 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4963 readsyms_blocker_.
4964 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4965 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4966 * testsuite/Makefile.am (start_lib_test): New test case.
4967 * testsuite/Makefile.in: Regenerate.
4968 * testsuite/start_lib_test_main.c: New file.
4969 * testsuite/start_lib_test_1.c: New file.
4970 * testsuite/start_lib_test_2.c: New file.
4971 * testsuite/start_lib_test_3.c: New file.
4972
4973 2010-08-19 Ian Lance Taylor <iant@google.com>
4974
4975 * Makefile.in: Rebuild with automake 1.11.1.
4976 * aclocal.m4: Likewise.
4977 * testsuite/Makefile.in: Likewise.
4978
4979 2010-08-19 Ian Lance Taylor <iant@google.com>
4980
4981 PR 10893
4982 * i386.cc (class Output_data_plt_i386): Update declarations.
4983 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4984 local_ifuncs_ fields.
4985 (Target_i386::do_plt_section_for_global): New function.
4986 (Target_i386::do_plt_section_for_local): New function.
4987 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4988 parameter; change all callers. Initialize global_ifuncs_ and
4989 local_ifuncs_. If doing a static link define __rel_iplt_start and
4990 __rel_iplt_end.
4991 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4992 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4993 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4994 symbols.
4995 (Target_i386::make_plt_section): New function, broken out of
4996 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4997 (Target_i386::make_plt_entry): Call make_plt_section.
4998 (Target_i386::make_local_ifunc_plt_entry): New function.
4999 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5000 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5001 R_386_IRELATIVE to switch.
5002 (Target_i386::Scan::global): Likewise.
5003 (Target_i386::Relocate::relocate): Likewise.
5004 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5005 switch.
5006 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5007 (Target_x86_64::do_plt_section_for_global): New function.
5008 (Target_x86_64::do_plt_section_for_local): New function.
5009 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5010 parameter; change all callers. If doing a static link define
5011 __rela_iplt_start and __rela_iplt_end.
5012 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5013 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5014 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5015 to point to .plt.
5016 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5017 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5018 switch.
5019 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5020 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5021 R_X86_64_IRELATIVE to switch.
5022 (Target_x86_64::Scan::global): Likewise.
5023 (Target_x86_64::Relocate::relocate): Likewise.
5024 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5025 switch.
5026 * target.h (class Target): Add plt_section_for_global and
5027 plt_section_for_local functions. Add do_plt_section_for_global
5028 and do_plt_section_for_local virtual functions.
5029 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5030 clarifying comments.
5031 (Symbol::use_plt_offset): Handle IFUNC symbol.
5032 * object.cc (Sized_relobj::Sized_relobj): Initialize
5033 local_plt_offsets_.
5034 (Sized_relobj::local_has_plt_offset): New function.
5035 (Sized_relobj::local_plt_offset): New function.
5036 (Sized_relobj::set_local_plt_offset): New function.
5037 (Sized_relobj::do_count): Handle IFUNC symbol.
5038 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5039 a bit away from input_shndx_ field. Add set_is_func_symbol and
5040 is_ifunc_symbol functions.
5041 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5042 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5043 local_plt_offsets_ field.
5044 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5045 * output.h (class Output_section_data): Add non-const
5046 output_section function.
5047 (class Output_data_got): Update declarations.
5048 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5049 Add use_plt_offset parameter to global and local constructors.
5050 Change all callers. Change local_sym_index_ field to 31 bits.
5051 Change GSYM_CODE and CONSTANT_CODE accordingly.
5052 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5053 doing a static link don't set sh_link field.
5054 (Output_data_got::Got_entry::write): Use PLT offset if
5055 appropriate.
5056 (Output_data_got::add_global_plt): New function.
5057 (Output_data_got::add_local_plt): New function.
5058 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5059 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5060 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5061 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5062 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5063 IFUNC conditional.
5064 * testsuite/ifunc-sel.h: New file.
5065 * testsuite/ifuncmain1.c: New file.
5066 * testsuite/ifuncmain1vis.c: New file.
5067 * testsuite/ifuncmod1.c: New file.
5068 * testsuite/ifuncdep2.c: New file.
5069 * testsuite/ifuncmain2.c: New file.
5070 * testsuite/ifuncmain3.c: New file.
5071 * testsuite/ifuncmod3.c: New file.
5072 * testsuite/ifuncmain4.c: New file.
5073 * testsuite/ifuncmain5.c: New file.
5074 * testsuite/ifuncmod5.c: New file.
5075 * testsuite/ifuncmain6pie.c: New file.
5076 * testsuite/ifuncmod6.c: New file.
5077 * testsuite/ifuncmain7.c: New file.
5078 * configure, testsuite/Makefile.in: Rebuild.
5079
5080 2010-08-18 Ian Lance Taylor <iant@google.com>
5081
5082 * incremental.cc
5083 (Output_section_incremental_inputs::write_input_files): Add cast
5084 to avoid signed/unsigned comparison warning.
5085 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5086
5087 2010-08-12 Cary Coutant <ccoutant@google.com>
5088
5089 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5090
5091 2010-08-13 Ian Lance Taylor <iant@google.com>
5092
5093 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5094
5095 2010-08-12 Cary Coutant <ccoutant@google.com>
5096 Doug Kwan <dougkwan@google.com>
5097
5098 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5099 defintion overrides non-weak undef, remember that the original undef
5100 is not weak.
5101 * symtab.cc (Symbol_table::sized_write_global): For undef without
5102 an original weak binding, set binding to global in output.
5103 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5104 * testsuite/Makefile.in: Regenerate.
5105 * testsuite/strong_ref_weak_def.sh: New file.
5106 * testsuite/strong_ref_weak_def_1.c: Ditto.
5107 * testsuite/strong_ref_weak_def_2.c: Ditto.
5108
5109 2010-08-12 Cary Coutant <ccoutant@google.com>
5110
5111 * testsuite/incremental_test.sh: Rewrite.
5112 * testsuite/incremental_test_1.c: Rewrite.
5113 * testsuite/incremental_test_2.c: Rewrite.
5114
5115 2010-08-12 Cary Coutant <ccoutant@google.com>
5116
5117 * arm.cc (Target_arm::got_size): Add const.
5118 (Target_arm::got_entry_count): New function.
5119 (Target_arm::plt_entry_count): New function.
5120 (Target_arm::first_plt_entry_offset): New function.
5121 (Target_arm::plt_entry_size): New function.
5122 (Output_data_plt_arm::entry_count): New function.
5123 (Output_data_plt_arm::first_plt_entry_offset): New function.
5124 (Output_data_plt_arm::get_plt_entry_size): New function.
5125 * i386.cc (Target_i386::got_size): Add const.
5126 (Target_i386::got_entry_count): New function.
5127 (Target_i386::plt_entry_count): New function.
5128 (Target_i386::first_plt_entry_offset): New function.
5129 (Target_i386::plt_entry_size): New function.
5130 (Output_data_plt_i386::entry_count): New function.
5131 (Output_data_plt_i386::first_plt_entry_offset): New function.
5132 (Output_data_plt_i386::get_plt_entry_size): New function.
5133 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5134 find_incremental_inputs_sections. Dump incremental_got_plt section.
5135 * incremental.cc: Include target.h.
5136 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5137 parameter. Adjust all callers. Find incremental_got_plt section.
5138 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5139 section.
5140 (Output_section_incremental_inputs::set_final_data_size): Calculate
5141 size of incremental_got_plt section.
5142 (Output_section_incremental_inputs::do_write): Write the
5143 incremental_got_plt section.
5144 (Got_plt_view_info): New struct.
5145 (Local_got_offset_visitor): New class.
5146 (Global_got_offset_visitor): New class.
5147 (Global_symbol_visitor_got_plt): New class.
5148 (Output_section_incremental_inputs::write_got_plt): New function.
5149 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5150 Add parameter. Adjust all callers.
5151 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5152 (Incremental_inputs::got_plt_section): New function.
5153 (Incremental_inputs::got_plt_section_): New data member.
5154 (Incremental_got_plt_reader): New class.
5155 * layout.cc (Layout::create_incremental_info_sections): Add the
5156 incremental_got_plt section.
5157 * object.h (Got_offset_list::get_list): New function.
5158 (Got offset_list::for_all_got_offsets): New function.
5159 (Sized_relobj::local_got_offset_list): New function.
5160 * powerpc.cc (Target_powerpc::got_size): Add const.
5161 (Target_powerpc::got_entry_count): New function.
5162 (Target_powerpc::plt_entry_count): New function.
5163 (Target_powerpc::first_plt_entry_offset): New function.
5164 (Target_powerpc::plt_entry_size): New function.
5165 (Output_data_plt_powerpc::entry_count): New function.
5166 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5167 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5168 * sparc.cc (Target_sparc::got_size): Add const.
5169 (Target_sparc::got_entry_count): New function.
5170 (Target_sparc::plt_entry_count): New function.
5171 (Target_sparc::first_plt_entry_offset): New function.
5172 (Target_sparc::plt_entry_size): New function.
5173 (Output_data_plt_sparc::entry_count): New function.
5174 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5175 (Output_data_plt_sparc::get_plt_entry_size): New function.
5176 * symtab.h (Symbol::got_offset_list): New function.
5177 (Symbol_table::for_all_symbols): New function.
5178 * target.h (Sized_target::got_entry_count): New function.
5179 (Sized_target::plt_entry_count): New function.
5180 (Sized_target::plt_entry_size): New function.
5181 * x86_64.cc (Target_x86_64::got_size): Add const.
5182 (Target_x86_64::got_entry_count): New function.
5183 (Target_x86_64::plt_entry_count): New function.
5184 (Target_x86_64::first_plt_entry_offset): New function.
5185 (Target_x86_64::plt_entry_size): New function.
5186 (Output_data_plt_x86_64::entry_count): New function.
5187 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5188 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5189
5190 2010-08-12 Cary Coutant <ccoutant@google.com>
5191
5192 * archive.cc: Include incremental.h.
5193 (Archive::Archive): Initialize incremental_info_.
5194 (Archive::include_member): Record archive members in incremental info.
5195 (Add_archive_symbols::run): Record begin and end of an archive in
5196 incremental info.
5197 (Lib_group::include_member): Record objects in incremental info.
5198 * archive.h (Incremental_archive_entry): Forward declaration.
5199 (Archive::set_incremental_info): New member function.
5200 (Archive::incremental_info): New member function.
5201 (Archive::Unused_symbol_iterator): New class.
5202 (Archive::unused_symbols_begin): New member function.
5203 (Archive::unused_symbols_end): New member function.
5204 (Archive::incremental_info_): New data member.
5205 * incremental-dump.cc (find_input_containing_global): New function.
5206 (dump_incremental_inputs): Dump new incremental info sections.
5207 * incremental.cc: Include symtab.h.
5208 (Output_section_incremental_inputs): New class.
5209 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5210 new incremental info sections.
5211 (Sized_incremental_binary::do_check_inputs): Likewise.
5212 (Incremental_inputs::report_archive): Remove.
5213 (Incremental_inputs::report_archive_begin): New function.
5214 (Incremental_inputs::report_archive_end): New function.
5215 (Incremental_inputs::report_object): New function.
5216 (Incremental_inputs::finalize_inputs): Remove.
5217 (Incremental_inputs::report_input_section): New function.
5218 (Incremental_inputs::report_script): Rewrite.
5219 (Incremental_inputs::finalize): Do nothing but finalize string table.
5220 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5221 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5222 (Incremental_inputs::create_data_sections): New function.
5223 (Incremental_inputs::relocs_entsize): New function.
5224 (Output_section_incremental_inputs::set_final_data_size): New function.
5225 (Output_section_incremental_inputs::do_write): New function.
5226 (Output_section_incremental_inputs::write_header): New function.
5227 (Output_section_incremental_inputs::write_input_files): New function.
5228 (Output_section_incremental_inputs::write_info_blocks): New function.
5229 (Output_section_incremental_inputs::write_symtab): New function.
5230 * incremental.h (Incremental_script_entry): Forward declaration.
5231 (Incremental_object_entry): Forward declaration.
5232 (Incremental_archive_entry): Forward declaration.
5233 (Incremental_inputs): Forward declaration.
5234 (Incremental_inputs_header_data): Remove.
5235 (Incremental_inputs_header): Remove.
5236 (Incremental_inputs_header_write): Remove.
5237 (Incremental_inputs_entry_data): Remove.
5238 (Incremental_inputs_entry): Remove.
5239 (Incremental_inputs_entry_write): Remove.
5240 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5241 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5242 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5243 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5244 Likewise.
5245 (Incremental_input_entry): New class.
5246 (Incremental_script_entry): New class.
5247 (Incremental_object_entry): New class.
5248 (Incremental_archive_entry): New class.
5249 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5250 (Incremental_inputs::report_inputs): Remove.
5251 (Incremental_inputs::report_archive): Remove.
5252 (Incremental_inputs::report_archive_begin): New function.
5253 (Incremental_inputs::report_archive_end): New function.
5254 (Incremental_inputs::report_object): Change prototype.
5255 (Incremental_inputs::report_input_section): New function.
5256 (Incremental_inputs::report_script): Change prototype.
5257 (Incremental_inputs::get_reloc_count): New function.
5258 (Incremental_inputs::set_reloc_count): New function.
5259 (Incremental_inputs::create_data_sections): New function.
5260 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5261 (Incremental_inputs::inputs_section): New function.
5262 (Incremental_inputs::symtab_section): New function.
5263 (Incremental_inputs::relocs_section): New function.
5264 (Incremental_inputs::get_stringpool): Add const.
5265 (Incremental_inputs::command_line): Add const.
5266 (Incremental_inputs::inputs): Remove.
5267 (Incremental_inputs::command_line_key): New function.
5268 (Incremental_inputs::input_file_count): New function.
5269 (Incremental_inputs::input_files): New function.
5270 (Incremental_inputs::relocs_entsize): New function.
5271 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5272 (Incremental_inputs::finalize_inputs): Remove.
5273 (Incremental_inputs::Input_info): Remove.
5274 (Incremental_inputs::lock_): Remove.
5275 (Incremental_inputs::inputs_): Change type.
5276 (Incremental_inputs::inputs_map_): Remove.
5277 (Incremental_inputs::current_object_entry_): New data member.
5278 (Incremental_inputs::inputs_section_): New data member.
5279 (Incremental_inputs::symtab_section_): New data member.
5280 (Incremental_inputs::relocs_section_): New data member.
5281 (Incremental_inputs::reloc_count_): New data member.
5282 (Incremental_inputs_reader): New class.
5283 (Incremental_symtab_reader): New class.
5284 (Incremental_relocs_reader): New class.
5285 * layout.cc (Layout::finalize): Move finalization of incremental info
5286 and creation of incremental info sections to follow finalization of
5287 symbol table. Set offsets for postprocessing sections.
5288 (Layout::create_incremental_info_sections): Call
5289 Incremental_inputs::create_data_sections. Add incremental symtab
5290 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5291 sections to layout after input sections.
5292 * layout.h (struct Timespec): Forward declaration.
5293 (Layout::incremental_inputs): Add const.
5294 (Layout::create_incremental_info_sections): Add parameter.
5295 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5296 * object.cc: Include incremental.h.
5297 (Relobj::finalize_incremental_relocs): New function.
5298 (Sized_relobj::do_layout): Record input sections in incremental info.
5299 * object.h (Object::output_section): New function.
5300 (Object::output_section_offset): Moved from Relobj.
5301 (Object::get_incremental_reloc_base): New function.
5302 (Object::get_incremental_reloc_count): New function.
5303 (Object::do_output_section): New function.
5304 (Object::do_output_section_offset): Moved from Relobj.
5305 (Object::do_get_incremental_reloc_base): New function.
5306 (Object::do_get_incremental_reloc_count): New function.
5307 (Object::Object): Initialize new data members.
5308 (Relobj::output_section): Renamed do_output_section and moved to
5309 protected.
5310 (Relobj::output_section_offset): Moved to Object.
5311 (Relobj::do_get_incremental_reloc_base): New function.
5312 (Relobj::do_get_incremental_reloc_count): New function.
5313 (Relobj::allocate_incremental_reloc_counts): New function.
5314 (Relobj::count_incremental_reloc): New function.
5315 (Relobj::finalize_incremental_relocs): New function.
5316 (Relobj::next_incremental_reloc_index): New function.
5317 (Relobj::reloc_counts_): New data member.
5318 (Relobj::reloc_bases_): New data member.
5319 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5320 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5321 (Sized_relobj::incremental_relocs_scan): New function.
5322 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5323 (Sized_relobj::incremental_relocs_write): New function.
5324 (Sized_relobj::incremental_relocs_write_reltype): New function.
5325 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5326 incremental link.
5327 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5328 archives and object files elsewhere.
5329 (Add_symbols::run): Report object files here.
5330 (Finish_group::run): Report end of archive at end of group.
5331 * reloc.cc: Include layout.h, incremental.h.
5332 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5333 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5334 (Sized_relobj::incremental_relocs_scan): New function.
5335 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5336 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5337 (Sized_relobj::incremental_relocs_write): New function.
5338 (Sized_relobj::incremental_relocs_write_reltype): New function.
5339 * script.cc (read_input_script): Rewrite test for incremental link.
5340 Change call to Incremental_inputs::report_script.
5341 * symtab.h (Symbol_table::first_global_index): New function.
5342 (Symbol_table::output_count): New function.
5343
5344 2010-08-12 Doug Kwan <dougkwan@google.com>
5345
5346 * arm.cc (Target_arm::merge_object_attributes): Check command line
5347 options --no-wchar-size-warning and --no-enum-size-warning.
5348 * options.h (General_options): Add ld-compatible options
5349 --no-enum-size-warning and --no-wchar-size-warning.
5350
5351 2010-08-04 Ian Lance Taylor <iant@google.com>
5352
5353 * x86_64.cc (Target_x86_64::Scan::local): Use
5354 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5355 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5356 (Target_x86_64::Scan::global): Likewise.
5357 (Target_x86_64::Relocate::relocate): Likewise.
5358 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5359 Likewise.
5360
5361 2010-08-03 Cary Coutant <ccoutant@google.com>
5362
5363 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5364 to reserve space in merged_strings vector. Keep total input size
5365 for stats.
5366 (Output_merge_string::do_print_merge_stats): Print total input size.
5367 * merge.h (Output_merge_string): Add input_size_ field.
5368 * stringpool.cc (Stringpool_template::string_length): Move
5369 implementations out of Stringpool_template class and place in
5370 stringpool.h.
5371 * stringpool.h (string_length): Move out of Stringpool_template.
5372
5373 2010-08-03 Ian Lance Taylor <iant@google.com>
5374
5375 PR 11712
5376 * layout.cc (relaxation_loop_body): If address of load segment is
5377 set, adjust address to include headers if possible.
5378
5379 2010-08-03 Ian Lance Taylor <iant@google.com>
5380
5381 * version.cc (version_string): Bump to 1.10.
5382
5383 2010-08-03 Ian Lance Taylor <iant@google.com>
5384
5385 PR 11805
5386 * layout.h (enum Output_section_order): Define.
5387 (class Layout): Update declarations.
5388 * layout.cc (Layout::get_output_section): Add order parameter.
5389 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5390 is_first_non_relro parameters. Change all callers.
5391 (Layout::choose_output_section): Likewise.
5392 (Layout::add_output_section_data): Likewise.
5393 (Layout::make_output_section): Likewise. Set order.
5394 (Layout::default_section_order): New function.
5395 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5396 * output.cc (Output_section::Output_section): Initialize order_.
5397 Don't initialize deleted fields.
5398 (Output_segment::Output_segment): Don't initialize deleted
5399 fields.
5400 (Output_segment::add_output_section_to_load): New function
5401 replacing add_output_section. Change all callers to call this or
5402 add_output_section_to_nonload.
5403 (Output_segment::add_output_section_to_nonload): New function.
5404 (Output_segment::remove_output_section): Rewrite.
5405 (Output_segment::add_initial_output_data): Likewise.
5406 (Output_segment::has_any_data_sections): Likewise.
5407 (Output_segment::is_first_section_relro): Likewise.
5408 (Output_segment::maximum_alignment): Likewise.
5409 (Output_segment::has_dynamic_reloc): New function replacing
5410 dynamic_reloc_count. Change all callers.
5411 (Output_segment::has_dynamic_reloc_list): New function replacing
5412 dynamic_reloc_count_list. Change all callers.
5413 (Output_segment::set_section_addresses): Rewrite.
5414 (Output_segment::set_offset): Rewrite.
5415 (Output_segment::find_first_and_last_list): Remove.
5416 (Output_segment::set_tls_offsets): Rewrite.
5417 (Output_segment::first_section_load_address): Likewise.
5418 (Output_segment::output_section_count): Likewise.
5419 (Output_segment::section_with_lowest_load_address): Likewise.
5420 (Output_segment::write_section_headers): Likewise.
5421 (Output_segment::print_sections_to_map): Likewise.
5422 * output.h (class Output_data): Remove dynamic_reloc_count_
5423 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5424 (Output_data::add_dynamic_reloc): Rewrite.
5425 (Output_data::has_dynamic_reloc): New function.
5426 (Output_data::dynamic_reloc_count): Remove.
5427 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5428 is_last_relro_, is_first_non_relro_, is_interp_,
5429 is_dynamic_linker_section_ fields. Add order and set_order
5430 functions. Remove is_relro_local, set_is_relro_local,
5431 is_last_relro, set_is_last_relro, is_first_non_relro,
5432 set_is_first_non_relro functions, is_interp, set_is_interp,
5433 is_dynamic_linker_section, and set_is_dynamic_linker_section
5434 functions.
5435 (class Output_segment): Change Output_data_list from std::list to
5436 std:;vector. Add output_lists_ field. Remove output_data_ and
5437 output_bss_ fields. Update declarations.
5438
5439 2010-08-02 Ian Lance Taylor <iant@google.com>
5440
5441 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5442 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5443 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5444
5445 2010-08-02 Ian Lance Taylor <iant@google.com>
5446
5447 PR 11855
5448 * script.cc (Script_options::Script_options): Initialize
5449 symbol_definitions_ and symbol_references_.
5450 (Script_options::add_symbol_assignment): Update
5451 symbol_definitions_ and symbol_references_.
5452 (Script_options::add_symbol_reference): New function.
5453 (script_symbol): New function.
5454 * script.h (class Script_options): Add symbol_definitions_ and
5455 symbol_references_ fields.
5456 (Script_options::referenced_const_iterator): New type.
5457 (Script_options::referenced_begin): New function.
5458 (Script_options::referenced_end): New function.
5459 (Script_options::is_referenced): New function.
5460 (Script_options::any_unreferenced): New function.
5461 * script-c.h (script_symbol): Declare.
5462 * yyscript.y (exp): Call script_symbol.
5463 * symtab.cc: Include "script.h".
5464 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5465 Change all callers. Check symbols referenced by scripts.
5466 (Symbol_table::add_undefined_symbols_from_command_line): Add
5467 layout parameter. Change all callers.
5468 (Symbol_table::do_add_undefined_symbols_from_command_line):
5469 Likewise. Break out loop body. Check symbols referenced by
5470 scripts.
5471 (Symbol_table::add_undefined_symbol_from_command_line): New
5472 function broken out of
5473 do_add_undefined_symbols_from_command_line.
5474 * symtab.h (class Symbol_table): Update declarations.
5475 * archive.cc: Include "layout.h".
5476 (Archive::should_include_member): Add layout parameter. Change
5477 all callers. Check for symbol mentioned in expression.
5478 * archive.h (class Archive): Update declaration.
5479 * object.cc (Sized_relobj::do_should_include_member): Add layout
5480 parameter.
5481 * object.h (Object::should_include_member): Add layout parameter.
5482 Change all callers.
5483 (Object::do_should_include_member): Add layout parameter.
5484 (class Sized_relobj): Update declaration.
5485 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5486 parameter.
5487 * dynobj.h (class Sized_dynobj): Update declaration.
5488 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5489 layout parameter.
5490 * plugin.h (class Sized_pluginobj): Update declaration.
5491
5492 2010-08-02 Ian Lance Taylor <iant@google.com>
5493
5494 PR 11866
5495 * output.cc (Output_segment::set_offset): Search for the first and
5496 last sections rather than assuming that the list is in order.
5497 (Output_segment::find_first_and_last_list): New function.
5498 * output.h (class Output_segment): Update declarations.
5499 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5500 (relro_strip_test_SOURCES): New variable.
5501 (relro_strip_test_DEPENDENCIES): New variable.
5502 (relro_strip_test_LDFLAGS): New variable.
5503 (relro_strip_test_LDADD): New variable.
5504 (relro_strip_test.so): New target.
5505
5506 2010-08-02 Ian Lance Taylor <iant@google.com>
5507
5508 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5509 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5510 (Target_i386::got_tlsdesc_section): New function.
5511 (Target_i386::got_section): Create space for GOT entries for
5512 TLSDESC relocations.
5513 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5514 R_386_TLS_GOTDESC.
5515 (Target_i386::Scan::global): Likewise.
5516 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5517 using TLSDESC GOT.
5518 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5519 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5520 (Target_x86_64::got_tlsdesc_section): New function.
5521 (Target_x86_64::got_section): Create space for GOT entries for
5522 TLSDESC relocations.
5523 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5524 R_386_TLS_GOTDESC.
5525 (Target_x86_64::Scan::global): Likewise.
5526 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5527 using TLSDESC GOT.
5528
5529 2010-08-02 Ian Lance Taylor <iant@google.com>
5530
5531 * testsuite/final_layout.sh: Use dc to convert from hex to
5532 decimal.
5533
5534 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5535
5536 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5537 paramter to the call to gold::gc_process_relocs.
5538 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5539 paramter to the call to gold::gc_process_relocs.
5540 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5541 parameter to the call to gold::gc_process_relocs.
5542 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5543 template parameter to the call to gold::gc_process_relocs.
5544 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5545 paramter to the call to gold::gc_process_relocs.
5546 * gc.h (get_embedded_addend_size): New function.
5547 (gc_process_relocs): Save the size of the reloc for use by ICF.
5548 * icf.cc (get_section_contents): Get the addend from the text section
5549 for SHT_REL relocation sections.
5550 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5551 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5552 * int_encoding.h (read_from_pointer): New overloaded function.
5553 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5554 * testsuite/icf_sht_rel_addend_test.sh: New file.
5555 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5556 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5557
5558 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5559
5560 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5561 * Makefile.in: Regenerate.
5562 * testsuite/Makefile.in: Regenerate.
5563
5564 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5565
5566 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5567 * gold/testsuite/debug_msg.cc: Likewise.
5568 * gold/testsuite/odr_violation1.cc
5569 * gold/testsuite/odr_violation2.cc
5570
5571 2010-07-21 Cary Coutant <ccoutant@google.com>
5572
5573 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5574 string, and length fields.
5575 (Output_merge_string::Merged_strings_list): New type.
5576 (Output_merge_string::Merged_strings_lists): New typedef.
5577 (Output_merge_string): Replace merged_strings_ with
5578 merged_strings_lists_.
5579 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5580 Merged_strings_list per input object and section. Don't store pointer
5581 to the string. Don't store length with each merged string entry.
5582 (Output_merge_string::finalize_merged_data): Loop over list of merged
5583 strings lists. Recompute length of each merged string.
5584
5585 2010-07-15 Cary Coutant <ccoutant@google.com>
5586
5587 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5588 here.
5589
5590 2010-07-14 Ian Lance Taylor <iant@google.com>
5591
5592 * descriptors.cc (Descriptors::open): Report correct name in error
5593 message.
5594
5595 2010-07-13 Doug Kwan <dougkwan@google.com>
5596
5597 * arm.cc (Arm_input_section::Arm_input_section): For a
5598 SHT_ARM_EXIDX section, always keeps the input sections.
5599 (Arm_input_section::set_exidx_section_link): New method.
5600 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5601 has_errors_ to false.
5602 (Arm_exidx_input_section::has_errors,
5603 Arm_exidx_input_section::set_has_errors): New methods.
5604 (Arm_exidx_input_section::has_errors_): New data member.
5605 (Arm_relobj::get_exidx_shndx_list): New method.
5606 (Arm_output_section::append_text_sections_to_list): Do not skip
5607 section without SHF_EXECINSTR.
5608 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5609 errors.
5610 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5611 section header. Make error messages more verbose. Check for
5612 a non-executable section linked to an EXIDX section.
5613 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5614 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5615 check that there is no deferred EXIDX section if we exit early.
5616 Instead of not making an EXIDX section in case of an error, make one
5617 and set the has_errors flag of it.
5618 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5619 in a relocatable link.
5620 (Target_arm::do_relax): Look for the EXIDX output section instead of
5621 assuming that it is called .ARM.exidx.
5622 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5623 section list. Do not check for SHF_EXECINSTR section flags but
5624 skip any input section with errors.
5625 * output.cc (Output_section::Output_section): Initialize
5626 always_keeps_input_sections_ to false.
5627 (Output_section::add_input_section): Check for
5628 always_keeps_input_sections_.
5629 * output.h (Output_section::always_keeps_input_sections,
5630 Output_section::set_always_keeps_input_sections): New methods.
5631 (Output_section::always_keeps_input_sections): New data member.
5632
5633 2010-07-13 Rafael Espindola <espindola@google.com>
5634
5635 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5636 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5637
5638 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5639 Ian Lance Taylor <iant@google.com>
5640
5641 * output.h (Output_section_lookup_maps::add_merge_section):
5642 Correct check of whether value was inserted.
5643 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5644 (Output_section_lookup_maps::add_relaxed_input_section):
5645 Likewise.
5646 * arm.cc (Target_arm::got_section): Remove used local os.
5647 * i386.cc (Target_i386::got_section): Likewise.
5648 * x86_64.cc (Target_x86_64::got_section): Likewise.
5649 * sparc.cc (Target_sparc::got_section): Likewise.
5650 (Target_sparc::relocate): Remove unused local have_got_offset.
5651 * powerpc.cc (Target_powerpc::relocate): Likewise.
5652
5653 2010-07-13 Ian Lance Taylor <iant@google.com>
5654
5655 * compressed_output.cc (zlib_decompress): Fix signature in
5656 !HAVE_ZLIB_H case.
5657
5658 * archive.cc (Archive::include_member): Unlock an external member
5659 of a thin archive. Don't bother to delete an object we know is
5660 NULL.
5661
5662 2010-07-12 Cary Coutant <ccoutant@google.com>
5663
5664 * compressed_output.cc (zlib_decompress): New function.
5665 (get_uncompressed_size): New function.
5666 (decompress_input_section): New function.
5667 * compressed_output.h (get_uncompressed_size): New function.
5668 (decompress_input_section): New function.
5669 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5670 Handle compressed debug sections.
5671 * layout.cc (is_compressed_debug_section): New function.
5672 (Layout::output_section_name): Map compressed section names to
5673 canonical names.
5674 * layout.h (is_compressed_debug_section): New function.
5675 (is_debug_info_section): Recognize compressed debug sections.
5676 * merge.cc: Include compressed_output.h.
5677 (Output_merge_data::do_add_input_section): Handle compressed
5678 debug sections.
5679 (Output_merge_string::do_add_input_section): Handle compressed
5680 debug sections.
5681 * object.cc: Include compressed_output.h.
5682 (Sized_relobj::Sized_relobj): Initialize new data members.
5683 (build_compressed_section_map): New function.
5684 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5685 * object.h (Object::section_is_compressed): New method.
5686 (Object::do_section_is_compressed): New method.
5687 (Sized_relobj::Compressed_section_map): New type.
5688 (Sized_relobj::do_section_is_compressed): New method.
5689 (Sized_relobj::compressed_sections_): New data member.
5690 * output.cc (Output_section::add_input_section): Handle compressed
5691 debug sections.
5692 * reloc.cc: Include compressed_output.h.
5693 (Sized_relobj::write_sections): Handle compressed debug sections.
5694
5695 2010-07-08 Cary Coutant <ccoutant@google.com>
5696
5697 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5698 weak when resolving to a dynamic def.
5699 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5700 for weak undef/dynamic def cases. Adjust callers.
5701 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5702 undef_binding_weak_.
5703 (Symbol_table::sized_write_globals): Adjust symbol binding.
5704 (Symbol_table::sized_write_symbol): Add binding parameter.
5705 * symtab.h (Symbol::set_undef_binding): New method.
5706 (Symbol::is_undef_binding_weak): New method.
5707 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5708 (Symbol_table::should_override): Add new parameter.
5709 (Symbol_table::sized_write_symbol): Add new parameter.
5710
5711 * testsuite/weak_undef_file1.cc: Add new test case.
5712 * testsuite/weak_undef_file2.cc: Fix header comment.
5713 * testsuite/weak_undef_test.cc: Add new test case.
5714
5715 2010-06-29 Doug Kwan <dougkwan@google.com>
5716
5717 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5718 Initialize USE_SYMBOL_.
5719 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5720 definition.
5721 (Arm_reloc_property::uses_symbol_): New data member declaration.
5722 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5723 uses symbol value and symbol is undefined but not weakly undefined.
5724
5725 2010-06-28 Rafael Espindola <espindola@google.com>
5726
5727 * plugin.cc (Plugin::load): Use dlerror.
5728
5729 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5730
5731 * symtab.cc (detect_odr_violations): When reporting an ODR
5732 violation, report an object where the symbol is defined.
5733
5734 2010-06-25 Doug Kwan <dougkwan@google.com>
5735
5736 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5737 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5738 definition.
5739 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5740 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5741 target hook to detect function points.
5742 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5743 * icf.h (Icf::check_section_for_function_pointers): Change type of
5744 parameter SECTION_NAME to const reference to std::string. Use
5745 target hook to determine if section may have unsafe pointers.
5746 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5747 method definition.
5748
5749 2010-06-21 Rafael Espindola <espindola@google.com>
5750
5751 * fileread.cc (Input_file::find_fie): New
5752 (Input_file::open): Use Input_file::find_fie.
5753 * fileread.h (Input_file::find_fie): New
5754 * plugin.cc (set_extra_library_path): New.
5755 (Plugin::load): Add set_extra_library_path to the transfer vector.
5756 (Plugin_manager::set_extra_library_path): New.
5757 (Plugin_manager::add_input_file): Use the extra search path if set.
5758 (set_extra_library_path(): New.
5759 * plugin.h (Plugin_manager): Add set_extra_library_path and
5760 extra_search_path_.
5761
5762 2010-06-19 Cary Coutant <ccoutant@google.com>
5763
5764 * layout.cc (gdb_sections): Add .debug_types.
5765 (lines_only_debug_sections): Likewise.
5766
5767 2010-06-18 Rafael Espindola <espindola@google.com>
5768
5769 * plugin.cc (add_input_file,add_input_library)
5770 (Plugin_manager::add_input_file): Make filename arguments const.
5771 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5772 const.
5773
5774 2010-06-16 Doug Kwan <dougkwan@google.com>
5775
5776 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5777 .ARM.attributes section if we have not merged any input
5778 attributes sections.
5779
5780 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5781
5782 * arm.cc: Allow combining objects with no EABI version
5783 information.
5784
5785 2010-06-15 Rafael Espindola <espindola@google.com>
5786
5787 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5788
5789 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5790
5791 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5792 (struct iovec): Correct !HAVE_READV definition.
5793
5794 2010-06-10 Cary Coutant <ccoutant@google.com>
5795
5796 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5797 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5798 reloc sections.
5799 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5800
5801 PR 11683
5802 * symtab.h (Symbol::is_placeholder): New member function.
5803 * target-reloc.h (relocate_section): Check for placeholder symbols.
5804
5805 * testsuite/Makefile.am (plugin_test_8): New test.
5806 (plugin_test_9): New test.
5807 * testsuite/Makefile.in: Regenerate.
5808
5809 2010-06-09 Nick Clifton <nickc@redhat.com>
5810
5811 * yyscript.y (input_list_element): Allow strings prefixed with
5812 the '-' character. Treat these as libraries.
5813 * script.cc (script_add_library): New function. Adds a library
5814 specified by "-l<name>" found in an input script.
5815 * script-c.h: Add prototype for script_add_library.
5816
5817 2010-06-07 Doug Kwan <dougkwan@google.com>
5818
5819 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5820 Restrict stub-group size to be within long conditional branch
5821 range when working around cortex-A8 erratum.
5822
5823 2010-06-07 Damien Diederen <dd@crosstwine.com>
5824
5825 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5826 #ifdef typo.
5827
5828 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5829
5830 PR gold/11658
5831 * output.cc
5832 (Output_section::Input_section_sort_entry::compare_section_ordering):
5833 Change to return non-zero correctly.
5834 (Output_section::Input_section_sort_section_order_index_compare
5835 ::operator()): Change to fix ambiguity in comparisons.
5836
5837 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5838
5839 * gold.h (is_wildcard_string): New function.
5840 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5841 (Layout::layout_eh_frame): Ditto.
5842 (Layout::find_section_order_index): New method.
5843 (Layout::read_layout_from_file): New method.
5844 * layout.h (Layout::find_section_order_index): New method.
5845 (Layout::read_layout_from_file): New method.
5846 (Layout::input_section_position_): New private member.
5847 (Layout::input_section_glob_): New private member.
5848 * main.cc (main): Call read_layout_from_file here.
5849 * options.h (--section-ordering-file): New option.
5850 * output.cc (Output_section::input_section_order_specified_): New
5851 member.
5852 (Output_section::Output_section): Initialize new member.
5853 (Output_section::add_input_section): Add new parameter.
5854 Keep input sections when --section-ordering-file is used.
5855 (Output_section::set_final_data_size): Sort input sections when
5856 section ordering file is specified.
5857 (Output_section::Input_section_sort_entry): Add new parameter.
5858 Check sorting type.
5859 (Output_section::Input_section_sort_entry::compare_section_ordering):
5860 New method.
5861 (Output_section::Input_section_sort_compare::operator()): Change to
5862 consider section_order_index.
5863 (Output_section::Input_section_sort_init_fini_compare::operator()):
5864 Change to consider section_order_index.
5865 (Output_section::Input_section_sort_section_order_index_compare
5866 ::operator()): New method.
5867 (Output_section::sort_attached_input_sections): Change to sort
5868 according to section order when specified.
5869 (Output_section::add_input_section<32, true>): Add new parameter.
5870 (Output_section::add_input_section<64, true>): Add new parameter.
5871 (Output_section::add_input_section<32, false>): Add new parameter.
5872 (Output_section::add_input_section<64, false>): Add new parameter.
5873 * output.h (Output_section::add_input_section): Add new parameter.
5874 (Output_section::input_section_order_specified): New
5875 method.
5876 (Output_section::set_input_section_order_specified): New method.
5877 (Input_section::Input_section): Initialize section_order_index_.
5878 (Input_section::section_order_index): New method.
5879 (Input_section::set_section_order_index): New method.
5880 (Input_section::section_order_index_): New member.
5881 (Input_section::Input_section_sort_section_order_index_compare): New
5882 struct.
5883 (Output_section::input_section_order_specified_): New member.
5884 * script-sections.cc (is_wildcard_string): Delete and move modified
5885 method to gold.h.
5886 (Output_section_element_input::Output_section_element_input): Modify
5887 call to is_wildcard_string.
5888 (Output_section_element_input::Input_section_pattern
5889 ::Input_section_pattern): Ditto.
5890 (Output_section_element_input::Output_section_element_input): Ditto.
5891 * testsuite/Makefile.am (final_layout): New test case.
5892 * testsuite/Makefile.in: Regenerate.
5893 * testsuite/final_layout.cc: New file.
5894 * testsuite/final_layout.sh: New file.
5895
5896 2010-06-01 Rafael Espindola <espindola@google.com>
5897
5898 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5899
5900 2010-06-01 Rafael Espindola <espindola@google.com>
5901
5902 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5903 visibility of symbols.
5904
5905 2010-05-27 Doug Kwan <dougkwan@google.com>
5906
5907 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5908 from start of output section instead of address for a local symbol
5909 in a merged or relaxed section when doing a relocatable link.
5910
5911 2010-05-26 Rafael Espindola <espindola@google.com>
5912
5913 PR 11604
5914 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5915 adding sections the garbage collector removed.
5916 * gold/testsuite/Makefile.am: Add test.
5917 * gold/testsuite/Makefile.in: Regenerate.
5918 * gold/testsuite/plugin_test_7.sh: New.
5919 * gold/testsuite/plugin_test_7_1.c: New.
5920 * gold/testsuite/plugin_test_7_2.c: New.
5921
5922 2010-05-26 Rafael Espindola <espindola@google.com>
5923
5924 * script-sections.cc (Output_section_definition::set_section_addresses):
5925 Check for --section-start.
5926
5927 2010-05-26 Doug Kwan <dougkwan@google.com>
5928
5929 * arm.cc (Arm_scan_relocatable_relocs): New class.
5930 (Target_arm::relocate_special_relocatable): New method.
5931 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5932 (Arm_relocate_functions::thumb_branch_common): Same.
5933 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5934 instead of Default_scan_relocatable_relocs.
5935 * target-reloc.h (relocate_for_relocatable): Let target handle
5936 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5937 * target.h (Sized_target::relocate_special_relocatable): New method.
5938
5939 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5940
5941 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5942
5943 2010-05-23 Doug Kwan <dougkwan@google.com>
5944
5945 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5946 instead of a cast.
5947 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5948 with a direct branch, not a conditional branch, to a stub.
5949 * merge.cc (Output_merge_base::record_input_section): New method
5950 defintion.
5951 (Output_merge_data::do_add_input_section): Record input section if
5952 keeps-input-sections flag is set.
5953 (Output_merge_string::do_add_input_section): Ditto.
5954 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5955 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5956 INPUT_SECTIONS_.
5957 (Output_merge_base::keeps_input_sections,
5958 Output_merge_base::set_keeps_input_sections,
5959 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5960 method definitions.
5961 (Output_merge_base::Input_sections): New type declaration.
5962 (Output_merge_base::input_sections_begin,
5963 Output_merge_base::input_sections_end,
5964 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5965 (Output_merge_base::bool keeps_input_sections_,
5966 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5967 Output_merge_base::input_sections_): New data members.
5968 (Output_merge_data::do_set_keeps_input_sections): New method
5969 defintion.
5970 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5971 * output.cc (Output_section::Input_section::relobj): Move method
5972 defintion from class declaration to here and handle merge sections.
5973 (Output_section::Input_section::shndx): Ditto.
5974 (Output_section::Output_section): Remove initializations of removed
5975 data members and initialize new data member LOOKUP_MAPS_.
5976 (Output_section::add_input_section): Set keeps-input-sections flag
5977 for a newly created merge output section as appropriate. Adjust code
5978 to use Output_section_lookup_maps class.
5979 (Output_section::add_relaxed_input_section): Adjst code for lookup
5980 maps code refactoring.
5981 (Output_section::add_merge_input_section): Add a new parameter
5982 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5983 class. If adding input section to a newly created merge output
5984 section fails, remove the new merge section.
5985 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5986 Adjust code for use of the Output_section_lookup_maps class.
5987 (Output_section::find_merge_section): Ditto.
5988 (Output_section::build_lookup_maps): New method defintion.
5989 (Output_section::find_relaxed_input_section): Adjust code to use
5990 Output_section_lookup_maps class.
5991 (Output_section::get_input_sections): Export merge sections. Adjust
5992 code to use Output_section_lookup_maps class.
5993 (Output_section:::add_script_input_section): Adjust code to use
5994 Output_section_lookup_maps class. Update lookup maps for merge
5995 sections also.
5996 (Output_section::discard_states): Use Output_section_lookup_maps.
5997 (Output_section::restore_states): Same.
5998 * output.h (Merge_section_properties): Move class defintion out of
5999 Output_section.
6000 (Output_section_lookup_maps): New class.
6001 (Output_section::Input_section::is_merge_section): New method
6002 defintion.
6003 (Output_section::Input_section::relobj): Move defintion out of class
6004 defintion. Declare method only.
6005 (Output_section::Input_section::shndx): Ditto.
6006 (Output_section::Input_section::output_merge_base): New method defintion.
6007 (Output_section::Input_section::u2_.pomb): New union field.
6008 (Output_section::Merge_section_by_properties_map,
6009 Output_section::Output_section_data_by_input_section_map,
6010 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6011 Remove types.
6012 (Output_section::add_merge_input_section): Add new parameter
6013 KEEPS_INPUT_SECTIONS.
6014 (Output_section::build_lookup_maps): New method declaration.
6015 (Output_section::merge_section_map_,
6016 Output_section::merge_section_by_properties_map_,
6017 Output_section::relaxed_input_section_map_,
6018 Output_section::is_relaxed_input_section_map_valid_): Remove data
6019 members.
6020 (Output_section::lookup_maps_): New data member.
6021
6022 2010-05-21 Doug Kwan <dougkwan@google.com>
6023
6024 PR gold/11619
6025 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6026 avoid a compilation error.
6027
6028 2010-05-19 Rafael Espindola <espindola@google.com>
6029
6030 * script-sections.cc (Output_section_definition::allocate_to_segment):
6031 Update the phdrs_list even when the output section is NULL.
6032 * testsuite/Makefile.am: Add test.
6033 * testsuite/Makefile.in: Regenerate.
6034 * testsuite/script_test_9.cc: New.
6035 * testsuite/script_test_9.sh: New.
6036 * testsuite/script_test_9.t: New.
6037
6038 2010-05-19 Doug Kwan <dougkwan@google.com>
6039
6040 * arm.cc (Arm_input_section::original_size): New method.
6041 (Arm_input_section::do_addralign): Add a cast.
6042 (Arm_input_section::do_output_offset): Remove static cast.
6043 (Arm_input_section::original_addralign,
6044 Arm_input_section::original_size_): Change type to uint32_t.
6045 (Arm_input_section::init): Add safe casts for section alignment
6046 and size.
6047 (Arm_input_section::set_final_data_size): Do not set address and
6048 offset of stub table.
6049 (Arm_output_section::fix_exidx_coverage): Change use of of
6050 Output_section::Simple_input_section to that of
6051 Output_section::Input_section.
6052 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6053 except for the first pass.
6054 * output.cc (Output_section::get_input_sections): Change type of
6055 input_sections to std::list<Input_section>.
6056 (Output_section::add_script_input_section): Rename from
6057 Output_section::add_simple_input_section. Change type of SIS
6058 parameter from Simple_input_section to Input_section.
6059 * output.h (Output_section::Simple_input_section): Remove class.
6060 (Output_section::Input_section): Change class visibility to public.
6061 (Output_section::Input_section::addralign): Use stored alignments
6062 for special input sections if set.
6063 (Output_section::Input_section::set_addralign): New method.
6064 (Output_section::get_input_sections): Change parameter type from
6065 list of Simple_input_section to list of Input_section.
6066 (Output_section::add_script_input_section): Rename from
6067 Output_section::add_simple_input_section. Change first parameter's
6068 type from Simple_input_section to Input_section and remove the
6069 second and third parameters.
6070 * script-sections.cc (Input_section::Input_section_list): Change
6071 type to list of Output_section::Input_section/
6072 (Input_section_info::Input_section_info): Change parameter type of
6073 INPUT_SECTION to Output_section::Input_section.
6074 (Input_section_info::input_section): Change return type.
6075 (Input_section_info::input_section_): Change type to
6076 Output_section::Input_section.
6077 (Output_section_element_input::set_section_addresses): Adjust code
6078 to use Output_section::Input_section instead of
6079 Output_section::Simple_input_section. Adjust code for renaming
6080 of Output_section::add_simple_input_section.
6081 (Orphan_output_section::set_section_addresses): Ditto.
6082
6083 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6084
6085 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6086 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6087
6088 2010-05-18 Rafael Espindola <espindola@google.com>
6089
6090 * options.cc (General_options::finalize): Handle -nostdlib.
6091 * options.h (nostdlib): New option.
6092 * script.cc (script_add_search_dir): Handle -nostdlib.
6093
6094 2010-05-12 Doug Kwan <dougkwan@google.com>
6095
6096 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6097 attributes section only if there no attributes section after merging.
6098 (Target_arm::merge_object_attributes): Move value of
6099 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6100 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6101 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6102 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6103 and arm_attr_merge_7.stdout.
6104 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6105 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6106 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6107 arm_attr_merge_7b.o): New rules.
6108 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6109 arm_attr_merge_7
6110 * testsuite/Makefile.in: Regenerate.
6111 * testsuite/arm_attr_merge.sh: New file.
6112 * testsuite/arm_attr_merge_[67][ab].s: Same.
6113
6114 2010-05-05 Nick Clifton <nickc@redhat.com>
6115
6116 * po/es.po: Updated Spanish translation.
6117
6118 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6119
6120 * Makefile.am (install-exec-local): Properly install gold as
6121 default cross linker.
6122 * Makefile.in: Regenerated.
6123
6124 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6125 Nick Clifton <nickc@redhat.com>
6126
6127 * configure.ac (install_as_default): Define and set to false
6128 unless --enable-gold or --enable-gold=both/gold has been
6129 specified.
6130 * configure: Regenerate.
6131
6132 * Makefile.am (install-exec-local): Install the executable as
6133 'ld.gold'. If install_as_default is true then also install it as
6134 'ld'.
6135 * Makefile.in: Regenerated.
6136
6137 2010-04-24 Ian Lance Taylor <iant@google.com>
6138
6139 * layout.cc (Layout::layout_reloc): In relocatable link don't
6140 combine reloc sections for grouped sections.
6141
6142 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6143
6144 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6145 sections that are not ordinary to icf.
6146 * icf.cc (get_section_contents): Handle relocation pointing to section
6147 with no object or shndx information.
6148 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6149 * testsuite/Makefile.in: Regenerate.
6150 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6151 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6152
6153 2010-04-22 Ian Lance Taylor <iant@google.com>
6154
6155 * expression.cc (Expression::Expression_eval_info): Add
6156 result_alignment_pointer field.
6157 (Expression::eval_with_dot): Add result_alignment_pointer
6158 parameter. Change all callers.
6159 (Expression::eval_maybe_dot): Likewise.
6160 (class Binary_expression): Add alignment_pointer parameter to
6161 left_value and right_value. Change all callers.
6162 (BINARY_EXPRESSION): Set result alignment.
6163 (class Trinary_expression): Add alignment_pointer parameter to
6164 arg2_value and arg3_value. Change all callers.
6165 (Trinary_cond::value): Set result alignment.
6166 (Max_expression::value, Min_expression::value): Likewise.
6167 (Align_expression::value): Likewise.
6168 * script-sections.cc (class Sections_element): Add dot_alignment
6169 parameter to set_section_addresses virtual function. Update
6170 instantiations.
6171 (class Output_section_element): Likewise.
6172 (Script_sections::create_segments): Add dot_alignment parameter.
6173 Change all callers.
6174 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6175 (Script_sections::set_phdrs_clause_addresses): Likewise.
6176 * script-sections.h: Update declarations.
6177 * script.h: Update declarations.
6178 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6179 min_p_align.
6180 * testsuite/script_test_3.t: Set large alignment.
6181 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6182 segment has expected alignment.
6183
6184 2010-04-22 Nick Clifton <nickc@redhat.com>
6185
6186 * po/gold.pot: Updated by the Translation project.
6187 * po/vi.po: Updated Vietnamese translation.
6188
6189 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6190
6191 * testsuite/Makefile.am (check_PROGRAMS): Add
6192 icf_virtual_function_folding_test.
6193 * testsuite/Makefile.in: Regenerated.
6194
6195 2010-04-15 Andrew Haley <aph@redhat.com>
6196
6197 * options.h (merge_exidx_entries): New option.
6198 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6199 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6200 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6201 (Target_arm::merge_exidx_entries): New function.
6202 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6203 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6204 to Arm_exidx_fixup constructor.
6205 Add new arg, merge_exidx_entries.
6206 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6207 Arm_output_section::fix_exidx_coverage.
6208
6209 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6210
6211 * icf.cc (get_section_contents): Check for preemptible functions.
6212 Ignore addend when appropriate.
6213 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6214 section folded.
6215 (add_from_relobj): Check for section folded.
6216 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6217 * symtab.h (should_add_dynsym_entry): Add new parameter.
6218 * target-reloc.h (scan_relocs): Check for section folded.
6219 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6220 Check reloc types for function pointers in shared objects.
6221 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6222 case.
6223 (icf_preemptible_functions_test): New test case.
6224 (icf_string_merge_test): New test case.
6225 * testsuite.Makefile.in: Regenerate.
6226 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6227 bar_glob. Refactor code.
6228 * testsuite/icf_preemptible_functions_test.cc: New file.
6229 * testsuite/icf_preemptible_functions_test.sh: New file.
6230 * testsuite/icf_string_merge_test.cc: New file.
6231 * testsuite/icf_string_merge_test.sh: New file.
6232 * testsuite/icf_virtual_function_folding_test.cc: New file.
6233 * testsuite/icf_virtual_function_folding_test.sh: New file.
6234
6235 2010-04-14 Doug Kwan <dougkwan@google.com>
6236
6237 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6238 for local symbol recounting if we remove a section due to ICF.
6239 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6240 there are no regular objects in input.
6241
6242 2010-04-13 Doug Kwan <dougkwan@google.com>
6243
6244 * arm.cc (Arm_input_section::set_final_data_size): Compute
6245 accurate final data size instead of using current data size.
6246
6247 2010-04-09 Doug Kwan <dougkwan@google.com>
6248
6249 * layout.cc (Layout::choose_output_section): Handle script section
6250 types.
6251 (Layout::make_output_section_for_script): Add section type parameter.
6252 Handle script section types.
6253 * layout.h (Layout::make_output_section_for_script): Add section
6254 type parameter.
6255 * output.cc (Output_section::Output_section): Initialize data member
6256 is_noload_.
6257 (Output_section::do_reset_address_and_file_offset): Do not set address
6258 to 0 if section is a NOLOAD section.
6259 * output.h (Output_section::is_noload): New method.
6260 (Output_section::set_is_noload): Ditto.
6261 (Output_section::is_noload_): New data member.
6262 * script-c.h (Script_section_type): New enum type.
6263 (struct Parser_output_section_header): Add new file section_type.
6264 * script-sections.cc (Sections_element::output_section_name): Add
6265 parameter for returning script section type.
6266 (Output_section_definition::output_section_name): Ditto.
6267 (Output_section_definition::section_type)P; New method.
6268 (Output_section_definiton::script_section_type_name): Ditto.
6269 (Output_section_definition::script_section_type_): New data member.
6270 (Output_section_definition::Output_section_definition): Initialize
6271 data member Output_section_definition::script_section_type_.
6272 (Output_section_definition::create_sections): Pass script section type
6273 to Layout::make_output_section_for_script.
6274 (Output_section_definition::output_section_name): Return script
6275 section type to caller.
6276 (Output_section_definition::set_section_address): Do not advance
6277 dot value and load address if section type is NOLOAD. Set address
6278 of NOLOAD sections regardless of section flags.
6279 (Output_section_definition::print): Print section type if it is
6280 not SCRIPT_SECTION_TYPE_NONE.
6281 (Output_section_definition::section_type): New method.
6282 (Output_section_definition::script_section_type_name): Ditto.
6283 (Script_sections::output_section_name): Add new parameter
6284 PSECTION_TYPE for returning script section type. Pass it to
6285 section elements. Handle discard sections.
6286 (Sort_output_sections::operator()): Handle NOLOAD sections.
6287 * script-sections.h (Script_sections::Section_type): New enum type.
6288 (Script_sections::output_section_name): Add a new parameter for
6289 returning script section type.
6290 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6291 INFO and NOLOAD.
6292 * yyscript.y (union): Add new field SECTION_TYPE.
6293 (COPY, DSECT, INFO, NOLOAD): New tokens.
6294 (opt_address_and_section_type): Change type to output_section_header.
6295 (section_type): New non-terminal
6296 (section_header): Handle section type.
6297 (opt_address_and_section_type): Return section type value.
6298
6299 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6300
6301 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6302 * testsuite/plugin_common_test_2.c (foo): Likewise.
6303
6304 2010-04-08 Doug Kwan <dougkwan@google.com>
6305
6306 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6307 Output_merge_data.
6308 * output.cc (Output_section::add_merge_input_section): Simplify
6309 code and return status of Output_merge_base::add_input_section.
6310 Update merge section map only if Output_merge_base::add_input_section
6311 returns true.
6312
6313 2010-04-07 Doug Kwan <dougkwan@google.com>
6314
6315 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6316 if section is marked as containing instructions but has no mapping
6317 symbols.
6318 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6319 correct section index.
6320 (Arm_relobj::find_linked_text_section): Ditto.
6321
6322 2010-04-07 Cary Coutant <ccoutant@google.com>
6323
6324 * archive.cc (include_member): Destroy Read_symbols_data object before
6325 releasing file.
6326 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6327 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6328 (Read_symbols_data::~Read_symbols_data) New destructor.
6329 (Section_relocs::Section_relocs) New constructor.
6330 (Section_relocs::~Section_relocs) New destructor.
6331 (Read_relocs_data::Read_relocs_data) New constructor.
6332 (Read_relocs_data::~Read_relocs_data) New destructor.
6333 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6334 pointers to NULL after deleting.
6335
6336 2010-04-07 Doug Kwan <dougkwan@google.com>
6337
6338 * arm.cc: Replace "endianity" with "endianness" in comments.
6339 (Arm_exidx_cantunwind): Ditto.
6340 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6341 (Arm_relobj::merge_flags_and_attributes): New method.
6342 (Arm_relobj::merge_flags_and_attributes_): New data member.
6343 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6344 (Arm_relobj::scan_sections_for_stubs): Ditto.
6345 (Arm_relobj::do_read_symbols): Check to see if we really want to
6346 merge processor-specific flags and attributes. Exit early if
6347 an object is empty except for section names and the undefined symbol.
6348 (Target_arm::do_finalize_sections): Move check for ELF format to
6349 Arm_relobj::do_read_symbols. Merge processor specific flags and
6350 attributes from a regular object only when we have determined that
6351 it is aapropriate. Do not create an .ARM.attributes section in
6352 output if there is no regular input object.
6353 (Target_arm::merge_processor_specific_flags): Check
6354 --warn-mismatch before printing any error.
6355 (Target_arm::merge_object_attributes): Ditto.
6356 * gold.cc (queue_middle_tasks): Handle the case in which there is
6357 no regular object in input.
6358 * options.cc (General_options::parse_EB): New method.
6359 (General_options::parse_EL): Same.
6360 (General_options::General_options): Initialize endianness_.
6361 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6362 New options.
6363 (General_options::Endianness): New enum.
6364 (General_options::endianness): New method.
6365 (General_options::endianness_): New data member.
6366 * parameters.cc (Parameters::set_options): Check target endianness.
6367 (Parameters::set_target_once): Ditto.
6368 (Parameters::check_target_endianness): New method.
6369 (parameters_force_valid_target): If either -EL or -EB is specified,
6370 use it to define endianness of default target.
6371 * parameters.h (Parameters::check_target_endianness): New method
6372 declaration.
6373 * target.h (class Target): Change "endianity" to "endianness"
6374 in comments.
6375
6376 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6377
6378 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6379 * configure: Regenerate.
6380 * Makefile.in: Regenerate.
6381 * testsuite/Makefile.in: Regenerate.
6382
6383 2010-04-06 Cary Coutant <ccoutant@google.com>
6384
6385 gcc PR lto/42757
6386 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6387 prevailing definitions of common symbols.
6388 * testsuite/plugin_test_6.sh: New test case.
6389 * testsuite/plugin_common_test_1.c: New test case.
6390 * testsuite/plugin_common_test_2.c: New test case.
6391 * testsuite/Makefile.am (plugin_test_6): New test case.
6392 * testsuite/Makefile.in: Regenerate.
6393
6394 2010-04-06 Nick Clifton <nickc@redhat.com>
6395
6396 * po/vi.po: New Vietnamese translation.
6397
6398 2010-03-30 Doug Kwan <dougkwan@google.com>
6399
6400 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6401
6402 2010-03-25 Doug Kwan <dougkwan@google.com>
6403
6404 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6405 to avoid a conversion warning on a 32-bit host.
6406
6407 2010-03-24 Ian Lance Taylor <iant@google.com>
6408
6409 * testsuite/script_test_3.t: Add a TLS segment.
6410 * testsuite/Makefile.am (check_PROGRAMS): Add
6411 tls_phdrs_script_test.
6412 (tls_phdrs_script_test_SOURCES): Define.
6413 (tls_phdrs_script_test_DEPENDENCIES): Define.
6414 (tls_phdrs_script_test_LDFLAGS): Define.
6415 (tls_phdrs_script_test_LDADD): Define.
6416 * testsuite/Makefile.in: Rebuild.
6417
6418 2010-03-23 Cary Coutant <ccoutant@google.com>
6419
6420 * fileread.cc (find_or_make_view): Fix comment.
6421
6422 2010-03-23 Ian Lance Taylor <iant@google.com>
6423
6424 * script-sections.cc (class Orphan_section_placement): Define
6425 PLACE_TLS and PLACE_TLS_BSS.
6426 (Orphan_section_placement::Orphan_section_placement): Initialize
6427 new places.
6428 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6429 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6430 (tls_script_test_SOURCES): Define.
6431 (tls_script_test_DEPENDENCIES): Define.
6432 (tls_script_test_LDFLAGS): Define.
6433 (tls_script_test_LDADD): Define.
6434 * testsuite/Makefile.in: Rebuild.
6435
6436 2010-03-22 Doug Kwan <dougkwan@google.com>
6437
6438 * arm.cc (Arm_relocate_functions::abs8,
6439 Arm_relocate_functions::abs16): Use correct check for overflow
6440 specified in the ARM ELF specs.
6441 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6442 target of a BLX instruction specially.
6443 (Reloc_stub::stub_type_for_reloc): Ditto.
6444 (Relocate::relocate): Use symbolic names instead of numeric relocation
6445 codes to report error.
6446 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6447 workaround.
6448 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6449 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6450 thumb2_blx_out_of_range.stdout
6451 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6452 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6453 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6454 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6455 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6456 thumb2_blx_in_range, thumb2_blx_in_range.o,
6457 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6458 thumb2_blx_out_of_range.o): New rules.
6459 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6460 thumb2_blx_in_range and thumb2_blx_out_of_range.
6461 * testsuite/Makefile.in: Regenerate.
6462 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6463 * testsuite/thumb_blx_in_range.s: New file.
6464 * testsuite/thumb_blx_out_of_range.s: New file.
6465
6466 2010-03-22 Rafael Espindola <espindola@google.com>
6467
6468 * archive.cc (Should_include): Move to archive.h.
6469 (should_include_member): Make it a member of Archive.
6470 (Lib_group): New.
6471 (Add_lib_group_symbols): New.
6472 * archive.h: Include options.h.
6473 (Archive_member): Moved from Archive.
6474 (Should_include): Moved from archive.cc.
6475 (Lib_group): New.
6476 (Add_lib_group_symbols): New.
6477 * dynobj.cc (do_should_include_member): New.
6478 * dynobj.h (do_should_include_member): New.
6479 * gold.cc (queue_initial_tasks): Update call to queue.
6480 * main.cc (main): Print lib group stats.
6481 * object.cc (do_should_include_member): New.
6482 * object.h: Include archive.h.
6483 (Object::should_include_member): New.
6484 (Object::do_should_include_member): New.
6485 (Sized_relobj::do_should_include_member): New.
6486 * options.cc (General_options::parse_start_lib): New.
6487 (General_options::parse_end_lib): New.
6488 (Input_arguments::add_file): Handle lib groups.
6489 (Input_arguments::start_group): Check we are not in a lib.
6490 (Input_arguments::start_lib): New.
6491 (Input_arguments::end_lib): New.
6492 * options.h (General_options): Add start_lib and end_lib.
6493 (Input_argument::lib_): New.
6494 (Input_argument::lib): New.
6495 (Input_argument::is_lib): New.
6496 (Input_file_lib): New.
6497 (Input_arguments::in_lib_): New.
6498 (Input_arguments::in_lib): New.
6499 (Input_arguments::start_lib): New.
6500 (Input_arguments::end_lib_): New.
6501 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6502 in unused members as preempted.
6503 (Sized_pluginobj::do_should_include_member): New.
6504 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6505 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6506 return the blocker.
6507 (Read_symbols::do_whole_lib_group): New.
6508 (Read_symbols::do_lib_group): New.
6509 (Read_symbols::do_read_symbols): Handle lib groups.
6510 (Read_symbols::get_name): Handle lib groups.
6511 * readsyms.h (Read_symbols): Add an archive member pointer.
6512 (Read_symbols::do_whole_lib_group): New.
6513 (Read_symbols::do_lib_group): New.
6514 (Read_symbols::member_): New.
6515 * script.cc (read_input_script): Update call to queue_soon.
6516
6517 2010-03-19 Doug Kwan <dougkwan@google.com>
6518
6519 * arm.cc (Stub_table::Stub_table): Initialize new data members
6520 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6521 (Stub_table::add_reloc_stub): Assign stub offset and update
6522 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6523 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6524 New data members.
6525 (Stub_table::update_data_size_and_addralign): Use
6526 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6527 instead of going over all reloc stubs.
6528 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6529 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6530 Stringpool_template::offset_ to size of Stringpool_char.
6531 (Stringpool_template::new_key_offset): Remove code to initialize
6532 Stringpool_template::offset_.
6533 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6534 Stringpool_template::offset_ to zero.
6535
6536 2010-03-15 Doug Kwan <dougkwan@google.com>
6537
6538 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6539 offset_.
6540 (Stringpool_template::new_key_offset): New method.
6541 (Stringpool_template::add_string): Assign offsets when adding new
6542 strings.
6543 (Stringpool_template::set_string_offsets): Do not set string offsets
6544 when not optimizing.
6545 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6546 member size_.
6547 (Chunked_vector::clear): Clear size_.
6548 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6549 (Chunked_vector::size): Return size_.
6550 (Chunked_vector::push_back): Use size_ to find insert position.
6551 (Chunked_vector::size_): New data member.
6552 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6553 (Stringpool_template::new_key_offset): New method declaration.
6554 (Stringpool_template::offset_): New data member.
6555
6556 2010-03-15 Rafael Espindola <espindola@google.com>
6557
6558 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6559 Add_symbols' constructor.
6560 * readsyms.h (Add_symbols): Remove the input_group member.
6561
6562 2010-03-10 Ian Lance Taylor <iant@google.com>
6563
6564 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6565 target to ask whether a reference to a symbol requires a stack
6566 split.
6567 * target.h (Target::is_call_to_non_split): New function.
6568 (Target::do_is_call_to_non_split): Declare virtual function.
6569 * target.cc: Include "symtab.h".
6570 (Target::do_is_call_to_non_split): New function.
6571 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6572
6573 2010-03-10 Cary Coutant <ccoutant@google.com>
6574
6575 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6576 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6577 (File_read::open[2]): Add whole_file_view_ to list of views.
6578 (File_read::make_view): Remove test of whole_file_view_.
6579 (File_read::find_or_make_view): Create whole_file_view_ if
6580 necessary.
6581 (File_read::clear_views): Replace bool parameter with enum;
6582 adjust all callers. Don't delete views with permanent data;
6583 do delete cached views and views from archives if
6584 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6585 if clearing the corresponding view.
6586 * fileread.h (File_read::Clear_views_mode): New enum.
6587 (File_read::View::is_permanent_view): New method.
6588 (File_read::clear_views): Replace bool parameter
6589 with enum; adjust all callers.
6590 * options.h (General_options): Change keep_files_mapped option;
6591 add map_whole_files.
6592 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6593 releasing the file.
6594 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6595 the file.
6596
6597 2010-03-10 David S. Miller <davem@davemloft.net>
6598
6599 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6600
6601 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6602
6603 * icf.cc (get_section_contents): Add '@' marker after processing the
6604 merge reloc.
6605
6606 2010-03-08 Doug Kwan <dougkwan@google.com>
6607
6608 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6609 due to a conversion warning.
6610 (Arm_relobj::update_output_local_symbol_count): Check for local
6611 symbol with unset output index.
6612
6613 2010-03-05 Ian Lance Taylor <iant@google.com>
6614
6615 * options.h (class General_options): Add --spare-dynamic-tags.
6616 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6617 --spare-dynamic-tags.
6618
6619 2010-03-05 Ian Lance Taylor <iant@google.com>
6620
6621 * incremental.cc: Include "libiberty.h".
6622
6623 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6624
6625 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6626 function, is_info_ member.
6627 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6628 (Versions::Versions): Update caller.
6629 (Versions::define_base_version): Likewise.
6630 (Versions::add_def): Likewise.
6631
6632 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6633
6634 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6635 (Scan::possible_function_pointer_reloc): New function.
6636 (Scan::local_reloc_may_be_function_pointer): Change to call
6637 possible_function_pointer_reloc.
6638 (Scan::global_reloc_may_be_function_pointer): Ditto.
6639 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6640 relocations in ".data.rel.ro._ZTV" section.
6641 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6642 * testsuite/icf_safe_so_test.cc: Ditto.
6643 * testsuite/icf_safe_test.cc: Ditto.
6644 * testsuite/icf_safe_test.sh: Ditto.
6645
6646 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6647 Ian Lance Taylor <iant@google.com>
6648
6649 * target-reloc.h (relocate_section): Check the symbol table index
6650 for -1U before setting the local symbol index.
6651 (scan_relocatable_relocs): If copying the relocation, record that
6652 the local symbol is required.
6653 * object.h (Symbol_value::is_output_symtab_index_set): New
6654 function.
6655 (Symbol_value::may_be_discarded_from_output_symtab): New
6656 function.
6657 (Symbol_value::has_output_symtab_entry): New function.
6658 (Symbol_value::needs_output_symtab_entry): Remove.
6659 (Symbol_value::output_symtab_index): Make sure the symbol index is
6660 set.
6661 (Symbol_value::set_output_symtab_index): Make sure the symbol
6662 index is not set. Make sure the new index is valid.
6663 (Symbol_value::set_must_have_output_symtab_entry): New function.
6664 (Symbol_value::has_output_dynsym_entry): New function.
6665 (Symbol_value::set_output_dynsym_index): Make sure the new index
6666 is valid.
6667 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6668 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6669 local symbol if permitted.
6670 (Sized_relobj::do_finalize_local_symbols): Call
6671 is_output_symtab_index_set rather than needs_output_symtab_entry.
6672 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6673 rather than needs_output_symtab_entry. Call
6674 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6675 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6676 is_output_symtab_index_set rather than needs_output_symtab_entry.
6677 * testsuite/discard_locals_relocatable_test.c: New file.
6678 * testsuite/discard_locals_test.sh: Test -r.
6679 * testsuite/Makefile.am (check_DATA): Add
6680 discard_locals_relocatable_test1.syms,
6681 discard_local_relocatable_test2.syms.
6682 (MOSTLYCLEANFILES): Likewise. Also add
6683 discard_locals_relocatable_test1.lout and
6684 discard_locals_relocatable_test2.out.
6685 (discard_locals_relocatable_test1.syms): New target.
6686 (discard_locals_relocatable_test.o): New target.
6687 (discard_locals_relocatable_test1.out): New target.
6688 (discard_locals_relocatable_test2.syms): New target.
6689 (discard_locals_relocatable_test2.out): New target.
6690 (various): Add missing ../ld-new dependencies.
6691 * testsuite/Makefile.in: Rebuild.
6692
6693 2010-03-03 Nick Clifton <nickc@redhat.com>
6694
6695 * po/fi.po: New Finnish translation.
6696
6697 2010-03-01 Doug Kwan <dougkwan@google.com>
6698
6699 * layout.cc (Layout::Layout): Force section types of .init_array*,
6700 .preinit_array* and .fini_array* sections.
6701 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6702 Fix check of return value of std::string::find.().
6703 (Output_section::Input_section_sort_compare::operator()): Remove
6704 comment about .init_array.
6705 (Output_section::Input_section_sort_init_fini_compare::operator()):
6706 New method.
6707 (Output_section::sort_attached_input_sections): Handle .init_array
6708 and .fini_array specially.
6709 * output.h (Output_section::Inut_section_sort_compare): Update
6710 comment.
6711 (Output_section::Input_section_sort_init_fini_compare): New struct.
6712
6713 2010-02-26 Doug Kwan <dougkwan@google.com>
6714
6715 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6716 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6717 * testsuite/debug_msg.sh: Avoid matching source line number for
6718 use of global variable undef_int.
6719
6720 2010-02-26 Doug Kwan <dougkwan@google.com>
6721
6722 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6723 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6724 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6725 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6726 * options.cc (General_options::General_options): Initialize member
6727 fix_v4bx_.
6728 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6729 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6730 and rm_no_fix_v4bx.stdout
6731 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6732 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6733 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6734 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6735 and arm_no_fix_v4bx.
6736 * Makefile.in: Regenerate.
6737 * testsuite/arm_fix_v4bx.s: New file.
6738 * testsuite/arm_fix_v4bx.sh: Ditto.
6739
6740 2010-02-24 Doug Kwan <dougkwan@google.com>
6741
6742 * arm.cc (Target_arm::got_section): Make the .got section the first
6743 non RELRO section in the data segment.
6744 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6745 suffixes of section names.
6746
6747 2010-02-24 Doug Kwan <dougkwan@google.com>
6748
6749 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6750 flags and attributes merging if an input file is a binary file.
6751 * fileread.cc (Input_file::open): Record format of original file.
6752 * fileread.h (Input_file::Format): New enum type.
6753 (Input_file::Input_file): Initialize data member format_.
6754 (Input_file::format): New method definition.
6755 (Input_file::format_):: New data member.
6756
6757 2010-02-24 Doug Kwan <dougkwan@google.com>
6758
6759 * arm.cc (Arm_output_data_got): New class.
6760 (ARM_TCB_SIZE): New constant
6761 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6762 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6763 If user uses a script with a SECTIONS clause, issue only a warning
6764 for a misplaced EXIDX input section. Otherwise, issue an error.
6765 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6766 garbage collection.
6767 (Target_arm::got_mode_index_entry): Handle static linking.
6768 (Target_arm::Scan::local): Ditto.
6769 (Target_arm::Scan::global): Ditto.
6770 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6771 all incorrectly implemented relocations.
6772 (Target_arm::fix_exidx_coverage): Pass layout to
6773 Arm_output_section::fix_exidx_coverage.
6774 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6775 from ".ARM.exidx." and ".ARM.extab.".
6776
6777 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6778
6779 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6780 section if it does not already exist.
6781 * attributes.cc (Attributes_section_data::Attributes_section_data):
6782 Don't crash if size is zero.
6783
6784 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6785 Ian Lance Taylor <iant@google.com>
6786
6787 * gold.cc (queue_middle_tasks): If no input files were opened,
6788 exit.
6789 * workqueue.h (Task_function::Task_function): Assert that there is
6790 a blocker.
6791
6792 2010-02-22 Doug Kwan <dougkwan@google.com>
6793
6794 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6795 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6796 types to avoid warnings due to different uint64_t implementations
6797 on different hosts.
6798
6799 2010-02-21 Doug Kwan <dougkwan@google.com>
6800
6801 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6802 handling of the maximum backward branch offset.
6803 (Arm_relocate_functions::thumb_branch_common): Ditto.
6804 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6805 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6806 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6807 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6808 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6809 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6810 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6811 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6812 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6813 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6814 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6815 thumb2_bl_out_of_range.o): New rules.
6816 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6817 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6818 thumb2_bl_out_of_range
6819 * testsuite/Makefile.in: Regenerate.
6820 * testsuite/arm_bl_in_range.s: New file.
6821 * testsuite/arm_bl_out_of_range.s: Ditto.
6822 * testsuite/arm_branch_in_range.sh: Ditto.
6823 * testsuite/arm_branch_range.t: Ditto.
6824 * testsuite/thumb2_branch_range.t: Ditto.
6825 * testsuite/thumb_bl_in_range.s: Ditto.
6826 * testsuite/thumb_bl_out_of_range.s: Ditto.
6827 * testsuite/thumb_branch_range.t: Ditto.
6828
6829 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6830
6831 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6832 Add reloc offset information.
6833 * icf.cc (get_section_contents): Change iterators to point to the new
6834 vectors. Add reloc offset information to the contents.
6835 * icf.h (Icf::Sections_reachable_info): New typedef.
6836 (Icf::Sections_reachable_list): New typedef.
6837 (Icf::Offset_info): New typedef.
6838 (Icf::Reloc_info): New struct typedef.
6839 (Icf::Reloc_info_list): New typedef.
6840 (Icf::symbol_reloc_list): Delete method.
6841 (Icf::addend_reloc_list): Delete method.
6842 (Icf::section_reloc_list): Delete method.
6843 (Icf::reloc_info_list): New method.
6844 (Icf::reloc_info_list_): New member.
6845
6846 2010-02-19 Doug Kwan <dougkwan@google.com>
6847
6848 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6849 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6850 * arm.cc (Arm_relocation_functions): New forward declaration.
6851 (Target_arm::Target_arm): Initialize new data members
6852 got_mod_index_offset_ and tls_base_symbol_defined_.
6853 (Target_arm::Relocate::relocate_tls): New method.
6854 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6855 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6856 New methods.
6857 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6858 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6859 (Target_arm::got_mod_index_offset_,
6860 Target_arm::tls_base_symbol_defined_): New data members.
6861 (Target_arm::Scan::local, Target::Scan::global,
6862 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6863 relocations.
6864
6865 2010-02-18 Doug Kwan <dougkwan@google.com>
6866
6867 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6868 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6869 text section as a parameter becuase some broken tools may not set
6870 the link in section header.
6871 (Target_arm::has_got_section): New method.
6872 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6873 without any mapping symbol as data only. Remove warning.
6874 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6875 link in its section header, try to discover the link by inspecting the
6876 REL31 relocation at the beginning of the section.
6877 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6878 in error message.
6879 (Target_arm::Scan::global): Treat any reference to the symbol
6880 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6881
6882 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6883
6884 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6885 (Scan::global_reloc_may_be_function_pointer): New function.
6886 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6887 (Scan::global_reloc_may_be_function_pointer): New function.
6888 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6889 (Scan::global_reloc_may_be_function_pointer): New function.
6890 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6891 (Scan::global_reloc_may_be_function_pointer): New function.
6892 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6893 (Scan::global_reloc_may_be_function_pointer): New function.
6894 (Scan::possible_function_pointer_reloc): New function.
6895 (Target_x86_64::can_check_for_function_pointers): New function.
6896 * gc.h (gc_process_relocs): Scan relocation types to determine if
6897 function pointers were taken for targets that support it.
6898 * icf.cc (Icf::find_identical_sections): Include functions for
6899 folding in safe ICF whose pointer is not taken.
6900 * icf.h (Secn_fptr_taken_set): New typedef.
6901 (fptr_section_id_): New member.
6902 (section_has_function_pointers): New function.
6903 (set_section_has_function_pointers): New function.
6904 (check_section_for_function_pointers): New function.
6905 * options.h: Fix comment for safe ICF option.
6906 * target.h (can_check_for_function_pointers): New function.
6907 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6908 Modify icf_safe_test for X86-64.
6909 * testsuite/Makefile.in: Regenerate.
6910 * testsuite/icf_safe_so_test.cc: New file.
6911 * testsuite/icf_safe_so_test.sh: New file.
6912 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6913 (main): Change to take pointer to function kept_func_3.
6914 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6915 folding is done correctly for X86-64.
6916
6917 2010-02-12 David S. Miller <davem@davemloft.net>
6918
6919 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6920 is_symbolless parameter.
6921 (Output_reloc<SHT_REL>::is_symbolless): New.
6922 (Output_reloc<SHT_REL>::is_symbolless_): New.
6923 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6924 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6925 (Output_reloc<SHT_RELA>::is_symbolless): New.
6926 (Output_data_reloc::add_global): Handle is_symbolless.
6927 (Output_data_reloc::add_global_relative): Likewise.
6928 (Output_data_reloc::add_local): Likewise.
6929 (Output_data_reloc::add_local_relative): Likewise.
6930 (Output_data_reloc::add_symbolless_global_addend): New.
6931 (Output_data_reloc::add_symbolless_local_addend): New.
6932 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6933 is_symbolless.
6934 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6935 instead of ->is_relative_
6936 (Output_reloc::write): Likewise.
6937 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6938 (Output_reloc::write_rel): Simplify.
6939
6940 * sparc.cc (Target_sparc::Scan::local): Use
6941 ->add_symbolless_local_addend as needed.
6942 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6943 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6944 based upon relocation offset.
6945
6946 2010-02-11 Doug Kwan <dougkwan@google.com>
6947
6948 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6949 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6950 beginning of function.
6951 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6952 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6953 parameter is_32bit in calls to should_apply_static_reloc.
6954 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6955 (check_DATA): Add arm_abs_global.stdout.
6956 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6957 arm_abs_global.stdout): New rules.
6958 (MOSTLLYCLEANFILES): Add arm_abs_global
6959 * Makefile.in: Regenerate.
6960 * testsuite/arm_abs_global.s: New file.
6961 * testsuite/arm_abs_global.sh: Ditto.
6962 * testsuite/arm_abs_lib.s: Ditto.
6963
6964 2010-02-11 Ian Lance Taylor <iant@google.com>
6965
6966 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6967 Read_relocs task.
6968 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6969 Allocate_commons_task first.
6970 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6971 task, rather than symtab_lock_.
6972 (Gc_process_relocs::~Gc_process_relocs): New function.
6973 (Gc_process_relocs::is_runnable): Check this_blocker_.
6974 (Gc_process_relocs::locks): Use next_blocker_ rather than
6975 blocker_.
6976 (Scan_relocs::~Scan_relocs): New function.
6977 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6978 symtab_lock_.
6979 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6980 next_blocker_.
6981 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6982 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6983 constructor accordingly.
6984 (class Gc_process_relocs): Likewise.
6985 (class Scan_relocs): Likewise.
6986 * common.h (class Allocate_commons_task): Remove symtab_lock_
6987 field, and corresponding constructor parameter.
6988 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6989 symtab_lock_.
6990 (Allocate_commons_task::locks): Likewise.
6991
6992 2010-02-11 Ian Lance Taylor <iant@google.com>
6993
6994 * gold-threads.h (class Once): Define.
6995 (class Initialize_lock): Rewrite as child of Once.
6996 * gold-threads.cc (class Once_initialize): Define.
6997 (once_pointer_control): New static variable.
6998 (once_pointer, once_arg): New static variables.
6999 (c_run_once): New static function.
7000 (Once::Once, Once::run_once, Once::internal_run): New functions.
7001 (class Initialize_lock_once): Remove.
7002 (initialize_lock_control): Remove.
7003 (initialize_lock_pointer): Remove.
7004 (initialize_lock_once): Remove.
7005 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7006 (Initialize_lock::initialize): Rewrite.
7007 (Initialize_lock::do_run_once): New function.
7008 * archive.cc (Archive::interpret_header): Only clear name if it is
7009 not already empty.
7010 * fileread.cc: Include "gold-threads.h"
7011 (file_counts_lock): New static variable.
7012 (file_counts_initialize_lock): Likewise.
7013 (File_read::release): Only increment counts when using --stats.
7014 Use a lock around the increment.
7015 * parameters.cc (class Set_parameters_target_once): Define.
7016 (set_parameters_target_once): New static variable.
7017 (Parameters::Parameters): Move here from parameters.h.
7018 (Parameters::set_target): Rewrite.
7019 (Parameters::set_target_once): New function.
7020 (Parameters::clear_target): Move here and rewrite.
7021 * parameters.h (class Parameters): Update declarations. Add
7022 set_parameters_target_once_ field.
7023 (Parameters::Parameters): Move to parameters.cc.
7024 (Parameters::clear_target): Likewise.
7025 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7026 task.
7027 (Start_group::~Start_group): New function.
7028 (Start_group::is_runnable): New function.
7029 (Start_group::locks, Start_group::run): New functions.
7030 (Finish_group::run): Change saw_undefined to size_t.
7031 * readsyms.h (class Start_group): Define.
7032 (class Finish_group): Change saw_undefined_ field to size_t.
7033 (Finish_group::Finish_group): Remove saw_undefined and
7034 this_blocker parameters. Change all callers.
7035 (Finish_group::set_saw_undefined): New function.
7036 (Finish_group::set_blocker): New function.
7037 * symtab.h (class Symbol_table): Change saw_undefined to return
7038 size_t. Change saw_undefined_ field to size_t.
7039 * target-select.cc (Set_target_once::do_run_once): New function.
7040 (Target_selector::Target_selector): Initialize set_target_once_
7041 field. Don't initialize lock_ and initialize_lock_ fields.
7042 (Target_selector::instantiate_target): Rewrite.
7043 (Target_selector::set_target): New function.
7044 * target-select.h (class Set_target_once): Define.
7045 (class Target_selector): Update declarations. Make
7046 Set_target_once a friend. Remove lock_ and initialize_lock_
7047 fields. Add set_target_once_ field.
7048
7049 2010-02-10 Ian Lance Taylor <iant@google.com>
7050
7051 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7052 queueing any tasks.
7053 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7054 (queue_middle_tasks): Add all blockers before queueing any tasks.
7055 (queue_final_tasks): Likewise.
7056 * token.h (Task_token::add_blockers): New function.
7057 * object.h (Input_objects::number_of_relobjs): New function.
7058
7059 2010-02-10 Ian Lance Taylor <iant@google.com>
7060
7061 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7062 shared, not if not position independent.
7063 * x86_64.cc (Relocate::relocate_tls): Likewise.
7064 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7065 (tls_pie_pic_test): New target.
7066 * testsuite/Makefile.in: Rebuild.
7067
7068 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7069 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7070 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7071 * testsuite/Makefile.in: Rebuild.
7072
7073 2010-02-09 David S. Miller <davem@davemloft.net>
7074
7075 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7076 R_SPARC_RELATIVE using ->add_local_relative().
7077 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7078
7079 * output.h (Output_data_dynamic::add_section_size): New method
7080 that takes two Output_data objects.
7081 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7082 entry param. Handle it in initializers.
7083 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7084 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7085 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7086 arg.
7087 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7088 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7089 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7090 for dynrel_includes_plt.
7091 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7092 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7093 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7094 before .rela.plt
7095 (Target_sparc::do_finalize_sections): Update to pass true for
7096 dynrel_includes_plt.
7097 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7098 output before .rela.plt
7099 (Target_powerpc::do_finalize_sections): Update to pass true for
7100 dynrel_includes_plt when 32-bit.
7101
7102 2010-02-08 Doug Kwan <dougkwan@google.com>
7103
7104 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7105 method.
7106 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7107 Arm_relobj::scan_section_for_cortex_a8_stubs,
7108 Arm_relobj::do_relocation_section): Instead of calling
7109 Output_section::output_address, use faster
7110 Arm_relobj::simple_input_section_output_address.
7111
7112 2010-02-08 David S. Miller <davem@davemloft.net>
7113
7114 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7115 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7116 relocation helper function.
7117
7118 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7119 just like R_SPARC_GOT{10,13,22}.
7120 (Target_sparc::Scan::local): Likewise.
7121 (Target_sparc::Relocate:relocate): Likewise.
7122
7123 2010-02-06 Ian Lance Taylor <iant@google.com>
7124
7125 * configure.ac: Rewrite targetobjs duplicate removal code to use
7126 only shell constructs.
7127 * configure: Rebuild.
7128
7129 2010-02-05 Doug Kwan <dougkwan@google.com>
7130
7131 PR 11247
7132 * arm.cc (Arm_relobj::section_is_scannable): New method.
7133 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7134 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7135
7136 2010-02-04 Doug Kwan <dougkwan@google.com>
7137
7138 PR 11247
7139 * arm-reloc-property.cc (cstdio): Include.
7140 * configure.ac (targetobjs): Remove duplicates.
7141 * configure: Regenerate.
7142 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7143 big and little endian version for a given address size.
7144
7145 2010-02-03 Doug Kwan <dougkwan@google.com>
7146
7147 * arm-reloc-property.cc
7148 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7149 definition.
7150 * arm-reloc-property.h
7151 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7152 New method definition.
7153 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7154 declaration.
7155 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7156 overflow to N.
7157 (GOT_PREL): Change implemented to Y.
7158 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7159 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7160 (Arm_relocate_functions::movw_abs_nc): Remove method.
7161 (Arm_relocate_functions::movt_abs): Ditto.
7162 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7163 (Arm_relocate_functions::thm_movt_abs): Ditto.
7164 (Arm_relocate_functions::movw_rel_nc): Ditto.
7165 (Arm_relocate_functions::movw_rel): Ditto.
7166 (Arm_relocate_functions::movt_rel): Ditto.
7167 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7168 (Arm_relocate_functions:thm_movw_rel): Ditto.
7169 (Arm_relocate_functions:thm_movt_rel): Ditto.
7170 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7171 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7172 New method definitions.
7173 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7174 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7175 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7176 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7177 (Target_arm::Relocate::relocate): Check for non-static or
7178 unimplemented relocation code and exit early. Change calls to
7179 Target_arm::reloc_uses_thumb_bit and
7180 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7181 instead. Refactor code to handle similar relocations to increase
7182 code sharing. Remove check for unsupported relocation code in switch
7183 statement.
7184 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7185 relocation property table to find out size. Change error message to
7186 print out the name of a relocation code instead of the numeric value.
7187 (Target_arm::scan_reloc_for_stub): Use relocation property table
7188 instead of calling Target_arm::reloc_uses_thumb_bit().
7189
7190 2010-02-02 Doug Kwan <dougkwan@google.com>
7191
7192 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7193 types of relaxed input section.
7194
7195 2010-02-02 Doug Kwan <dougkwan@google.com>
7196
7197 * Makefile.am (HFILES): Add arm-reloc-property.h.
7198 (DEFFILES): New.
7199 (TARGETSOURCES): Add arm-reloc-property.cc
7200 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7201 (libgold_a_SOURCES): $(DEFFILES)
7202 * Makefile.in: Regenerate.
7203 * arm-reloc-property.cc: New file.
7204 * arm-reloc-property.h: New file.
7205 * arm-reloc.def: New file.
7206 * arm.cc: Update comments.
7207 (arm-reloc-property.h): New included header.
7208 (arm_reloc_property_table): New global variable.
7209 (Target_arm::do_select_as_default_target): New method definition.
7210 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7211 arm-reloc-property to targ_extra_obj.
7212 * parameters.cc (set_parameters_target): Call
7213 Target::select_as_default_target().
7214 * target.h (Target::select_as_default_target): New method definition.
7215 (Target::do_select_as_default_target): Same.
7216
7217 2010-02-01 Doug Kwan <dougkwan@google.com>
7218
7219 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7220 first_output_text_section_.
7221 (Arm_exidx_fixup::first_output_text_section): New method definition.
7222 (Arm_exidx_fixup::first_output_text_section_): New data member.
7223 (Arm_exidx_fixup::process_exidx_section): Record the first text
7224 output section seen.
7225 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7226 and entsize in output section header.
7227
7228 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7229
7230 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7231 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7232 (Arm_relocate_functions::thm_alu11): New Method.
7233 (Arm_relocate_functions::thm_pc8): New Method.
7234 (Arm_relocate_functions::thm_pc12): New Method.
7235 (Target_arm::Scan::local): Handle the relocations.
7236 (Target_arm::Scan::global): Likewise.
7237 (Target_arm::Relocate::relocate): Likewise.
7238 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7239
7240 2010-01-29 Doug Kwan <dougkwan@google.com>
7241
7242 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7243 of relocation types as ld.
7244
7245 2010-01-29 Doug Kwan <dougkwan@google.com>
7246
7247 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7248 to public.
7249 (Arm_relocate_functions::thumb_branch_common): Ditto.
7250 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7251 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7252 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7253 Arm_relocate_functions::jump24): Remove.
7254 (Target_arm::Relocate::relocate): Adjust code to call
7255 Arm_relocation_functions::arm_branch_common and
7256 Arm_relocation_functions::thumb_branch_common instead of their removed
7257 wrappers. Merge switch-cases together to reduce source code size.
7258
7259 2010-01-29 Doug Kwan <dougkwan@google.com>
7260
7261 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7262 output_local_symbol_count_needs_update_.
7263 (Arm_relobj::output_local_symbol_count_needs_update,
7264 Arm_relobj::set_output_local_symbol_count_needs_update,
7265 Arm_relobj::update_output_local_symbol_count): New methods.
7266 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7267 member.
7268 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7269 of pointed function as in a R_ARM_PREL31 relocation.
7270 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7271 for output local symbol count updating.
7272 (Target_arm::do_relax): Update output local symbol counts in objects
7273 if necessary.
7274 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7275
7276 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7277
7278 * arm.cc: Added support for the ARM relocations:
7279 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7280 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7281 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7282 movw_prel_nc).
7283 (Arm_relocate_functions::movw_rel): New method.
7284 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7285 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7286 thm_movw_prel_nc).
7287 (Arm_relocate_functions::thm_movw_rel): New method.
7288 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7289 thm_movt_prel).
7290 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7291 relocations.
7292 (Target_arm::Scan::global): Likewise.
7293 (Target_arm::Relocate::relocate): Likewise.
7294 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7295 Likewise.
7296
7297 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7298
7299 * arm.cc: Added support for ARM group relocations.
7300 (Target_arm::reloc_needs_sym_origin): New method.
7301 (Arm_relocate_functions::calc_grp_kn): New method.
7302 (Arm_relocate_functions::calc_grp_residual): New method.
7303 (Arm_relocate_functions::calc_grp_gn): New method.
7304 (Arm_relocate_functions::arm_grp_alu): New Method.
7305 (Arm_relocate_functions::arm_grp_ldr): New Method.
7306 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7307 (Arm_relocate_functions::arm_grp_ldc): New Method.
7308 (Target_arm::Scan::local): Handle the ARM group relocations.
7309 (Target_arm::Scan::global): Likewise.
7310 (Target_arm::Relocate::relocate): Likewise.
7311 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7312 Likewise.
7313
7314 2010-01-26 Doug Kwan <dougkwan@google.com>
7315
7316 * arm.cc (set): Include.
7317 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7318 pointer type.
7319 (Arm_output_section::Text_section_list): New type.
7320 (Arm_output_section::append_text_sections_to_list): New method.
7321 (Arm_output_section::fix_exidx_coverage): Ditto.
7322 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7323 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7324 Relobj::set_section_offset() instead of
7325 Sized_relobj::invalidate_section_offset().
7326 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7327 parameter for section headers. Ignore relocation sections for
7328 unallocated sections and EXIDX sections.
7329 (Target_arm::fix_exidx_coverage): New method.
7330 (Target_arm::output_section_address_less_than): New type.
7331 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7332 linked text section instead of the EXIDX section.
7333 (Arm_output_section::create_stub_group): Add an assertion to check
7334 that this is not an EXIDX output section.
7335 (Arm_output_section::append_text_sections_to_list): New method.
7336 (Arm_output_section::fix_exidx_coverage): Ditto.
7337 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7338 Arm_relobj::section_needs_reloc_stub_scanning.
7339 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7340 first pass.
7341 (Target_arm::fix_exidx_coverage): New method.
7342 * object.h (Relobj::set_output_section): New method.
7343 (Sized_relobj::invalidate_section_offset): Remove method.
7344 (Sized_relobj::do_invalidate_section_offset): Remove method.
7345 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7346
7347 2010-01-25 Doug Kwan <dougkwan@google.com>
7348
7349 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7350 Fix warning due to signed and unsigned comparison on a 32-bit host.
7351
7352 2010-01-22 Doug Kwan <dougkwan@google.com>
7353
7354 * arm.cc (Target_arm::do_relax): Record an output section for section
7355 offset adjustment it contains any stub table that has changed.
7356 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7357 offsets in an output section if necessary.
7358 * output.cc (Output_section::Output_section): Initialize
7359 section_offsets_need_adjustments_.
7360 (Output_section::add_input_section_for_script): Renamed to
7361 Output_section::add_simple_input_section.
7362 (Output_section::save_states): Add a comment.
7363 (Output_section::discard_states): New method defintion.
7364 (Output_section::adjust_section_offsets): Same.
7365 * output.h (Output_section::add_input_section_for_script): Renamed to
7366 Output_section::add_simple_input_section.
7367 (Output_section::discard_states): New method declaration.
7368 (Output_section::adjust_section_offsets): Same.
7369 (Output_section::section_offsets_need_adjustment,
7370 Output_section::set_section_offsets_need_adjustment): New method
7371 definitions.
7372 (Output_section::section_offsets_need_adjustment_): New data member.
7373 * script-sections.cc
7374 (Output_section_element_input::set_section_address): Adjust code for
7375 renaming of Output_section::add_input_section_for_script.
7376 (Orphan_output_section::set_section_address): Same.
7377
7378 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7379
7380 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7381 Fix_v4bx enum values .
7382 * gold/options.h (General_options): New option definitions.
7383 (General_options::fix_v4bx): New method.
7384 (General_options::Fix_v4bx): New enum.
7385 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7386 (General_options::parse_fix_v4bx_interworking): New method.
7387
7388 2010-01-22 Doug Kwan <dougkwan@google.com>
7389
7390 * arm.cc (Arm_exidx_fixup): New class.
7391
7392 2010-01-21 Doug Kwan <dougkwan@google.com>
7393
7394 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7395 classes.
7396 (Arm_exidx_section_offset_map): New type.
7397
7398 2010-01-21 Doug Kwan <dougkwan@google.com>
7399
7400 * arm.cc (Arm_exidx_input_section): New class.
7401 (Arm_relobj::exidx_input_section_by_link,
7402 Arm_relobj::exidx_input_section_by_shndx,
7403 Arm_relobj::make_exidx_input_section): New methods.
7404 (read_arm_attributes_section): Remove.
7405 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7406 information about them.
7407 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7408 to here.
7409
7410 2010-01-20 Doug Kwan <dougkwan@google.com>
7411
7412 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7413 Input_section_specifier to Section_id.
7414 (Target_arm::new_arm_input_section: Adjust code for change of key
7415 type.
7416 (Target_arm::find_arm_input_section): Ditto.
7417 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7418 (Section_id): Remove.
7419 (Garbage_collection::Section_id_hash): Remove.
7420 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7421 (Section_id): Remove.
7422 (Icf::Section_id_hash): Remove.
7423 * object.h (Section_id, Const_section_id, Section_id_hash,
7424 Const_section_id_hash): New type definitions.
7425 * output.cc (Output_section::add_relaxed_input_section): Change to
7426 use Const_section_id instead of Input_section_specifier as key type.
7427 (Output_section::add_merge_input_section): Ditto.
7428 (Output_section::build_relaxation_map): Change to use Section_id
7429 instead of Input_section_specifier as key type.
7430 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7431 Ditto.
7432 (Output_section::convert_input_sections_to_relaxed_sections): Change
7433 to use Const_section_id instead of Input_section_specifier as key type.
7434 (Output_section::find_merge_section): Ditto.
7435 (Output_section::find_relaxed_input_section): Ditto.
7436 * output.h (Input_section_specifier): Remove class.
7437 (Output_section::Output_section_data_by_input_section_map): Change
7438 key type to Const_section_id.
7439 (Output_section::Output_relaxed_input_section_by_input_section_map):
7440 Ditto.
7441 (Output_section::Relaxation_map): Change key type to Section_id.
7442
7443 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7444
7445 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7446 (class Arm_v4bx_stub): New class.
7447 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7448 (Stub_factory::make_arm_v4bx_stub): New method.
7449 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7450 (Stub_table::empty): Handle v4bx stubs.
7451 (Stub_table::add_arm_v4bx_stub): New method.
7452 (Stub_table::find_arm_v4bx_stub): New method.
7453 (Arm_relocate_functions::v4bx): New method.
7454 (Target_arm::fix_v4bx): New method.
7455 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7456 (Stub_table::relocate_stubs): Likewise.
7457 (Stub_table::do_write): Likewise.
7458 (Stub_table::update_data_size_and_addralign): Likewise.
7459 (Stub_table::finalize_stubs): Likewise.
7460 (Target_arm::Scan::local): Likewise.
7461 (Target_arm::Scan::global): Likewise.
7462 (Target_arm::do_finalize_sections): Likewise.
7463 (Target_arm::Relocate::relocate): Likewise.
7464 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7465 Likewise.
7466 (Target_arm::scan_reloc_for_stub): Likewise.
7467 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7468
7469 2010-01-19 Ian Lance Taylor <iant@google.com>
7470
7471 * output.cc (Output_section_headers::do_sized_write): Write large
7472 segment count to sh_info field.
7473 (Output_file_header::do_sized_write): For large segment count,
7474 write PN_XNUM to e_phnum field.
7475
7476 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7477
7478 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7479 (Arm_relocate_functions::thm_jump8): New function.
7480 (Arm_relocate_functions::thm_jump11): New function.
7481 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7482 R_ARM_THM_JUMP11.
7483 (Target_arm::Scan::global): Likewise.
7484 (Target_arm::Relocate::relocate): Likewise.
7485 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7486 Likewise.
7487
7488 2010-01-14 Doug Kwan <dougkwan@google.com>
7489
7490 * arm.cc (map, utility): Include headers.
7491 (Target_arm::apply_cortex_a8_workaround): New method.
7492 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7493 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7494 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7495 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7496 the --[no-]fix-cortex-a8 command line options.
7497 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7498 (Target_arm::relocate_stub): Use addend in instruction template.
7499 * options.h (DEFINE_bool): Set the user-set flag.
7500 (General_options): Add --[no-]-fix-cortex options.
7501 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7502 : Update fast look-up map after conversion.
7503
7504 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7505
7506 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7507 in the first pass of do_layout.
7508
7509 2010-01-13 Doug Kwan <dougkwan@google.com>
7510
7511 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7512 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7513 apparent compiler problem of not folding static constant integral
7514 data members of elfcpp::Elf_sizes<32>.
7515
7516 2010-01-13 Doug Kwan <dougkwan@google.com>
7517
7518 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7519 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7520 Arm_relobj::scan_section_for_cortex_a8_erratum,
7521 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7522 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7523 sections to scan for relocation stubs into a new method
7524 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7525 relocation and Cortex-A8 stub scanning.
7526 (Target_arm::do_relax): Force stubs to be after stubbed sections
7527 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7528 the beginning of a new relaxation pass. Update a comment.
7529 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7530
7531 2010-01-12 Ian Lance Taylor <iant@google.com>
7532
7533 * target-reloc.h (visibility_error): New inline function.
7534 (relocate_section): Call visibility_error.
7535 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7536 (MOSTLYCLEANFILES): Likewise.
7537 (protected_4_pic.o, protected_3.err): New targets.
7538 * testsuite/protected_4.cc: New file.
7539
7540 2010-01-12 Doug Kwan <dougkwan@google.com>
7541
7542 * arm.cc (Cortex_a8_reloc): New class.
7543 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7544 and cortex_a8_relocs_info_.
7545 (Target_arm::fix_cortex_a8): New method definition.
7546 (Target_arm::Cortex_a8_relocs_info): New type.
7547 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7548 New data member declarations.
7549 (Target_arm::scan_reloc_for_stub): Record information about
7550 relocations for THUMB branches that might be exempted from the
7551 Cortex-A8 workaround.
7552 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7553 at the beginning of a relaxation pass.
7554
7555 2010-01-12 Doug Kwan <dougkwan@google.com>
7556
7557 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7558 (Arm_relobj::Mapping_symbol_position,
7559 Arm_reloj::Mapping_symbol_position_less,
7560 Arm_relobj::Mapping_symbols_info): New types.
7561 (Target_arm::is_mapping_symbol_name): New method definition.
7562 (Arm_relobj::do_count_local_symbols): Save information about mapping
7563 symbols.
7564
7565 2010-01-11 Doug Kwan <dougkwan@google.com>
7566
7567 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7568 Arm_relocate_functions::thumb32_branch_upper,
7569 Arm_relocate_functions::thumb32_branch_lower,
7570 Arm_relocate_functions::thumb32_cond_branch_offset,
7571 Arm_relocate_functions::thumb32_cond_branch_upper,
7572 Arm_relocate_functions::thumb32_cond_branch_lower,
7573 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7574 branch offset encoding.
7575 (Arm_relocate_functions::thumb_branch_common): Use new branch
7576 offset encoding methods to avoid code duplication.
7577 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7578 (Stub_addend_reader::operator()): Use new branch encoding method
7579 to avoid code duplication.
7580
7581 2010-01-11 Doug Kwan <dougkwan@google.com>
7582
7583 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7584 (Target_arm::do_finalize_sections): Define special EXIDX section
7585 symbols only if referenced.
7586 * gc.h (Garbage_collection::add_reference): New method.
7587 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7588 code duplication.
7589
7590 2010-01-11 Ian Lance Taylor <iant@google.com>
7591
7592 * script.cc (Version_script_info::build_expression_list_lookup):
7593 Change complaing about duplicate wildcard match from error to
7594 warning.
7595
7596 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7597 of 2009-12-30.
7598 (Version_script_info::Version_script_info): Initialize globs_,
7599 default_version_, default_is_global_, and exact_. Don't
7600 initialize globals_ or locals_.
7601 (Version_script_info::build_lookup_tables): Build local symbols
7602 first.
7603 (Version_script_info::unquote): New function.
7604 (Version_script_info::add_exact_match): New function.
7605 (Version_script_info::build_expression_list_lookup): Remove lookup
7606 parameter. Add is_global parameter. Change all callers. Handle
7607 wildcard pattern specially. Unquote pattern. Call
7608 add_exact_match.
7609 (Version_script_info::get_name_to_match): New function.
7610 (Version_script_info::get_symbol_version): New function.
7611 (Version_script_info::get_symbol_version_helper): Remove.
7612 (Version_script_info::check_unmatched_names): Call unquote.
7613 * script.h (class Version_script_info): Change get_symbol_version
7614 to be non-inline and add is_global parameter; change all callers.
7615 Rewrite symbol_is_local. Update declarations. Define struct
7616 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7617 Remove globals_ and locals_ members. Add exact_, globs_,
7618 default_version_, is_global_.
7619 (Version_script_info::Glob): Remove pattern, add expression and
7620 is_global. Update constructor. Change all callers.
7621 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7622 default version.
7623 (Versions::symbol_section_contents): If a symbol is undefined, or
7624 defined in a dynamic object, set the version index to
7625 VER_NDX_LOCAL.
7626 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7627 symbol_is_local.
7628 (Symbol_table::add_from_pluginobj): Likewise.
7629 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7630
7631 2010-01-11 Doug Kwan <dougkwan@google.com>
7632
7633 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7634 (incremental_dump_LDADD): Add linking option for libintl.
7635 * Makefile.in: Regenerate.
7636
7637 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7638
7639 PR gold/11144
7640 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7641 instead of -Ds.
7642 * testsuite/Makefile.in: Regenerated.
7643
7644 2010-01-10 Doug Kwan <dougkwan@google.com>
7645
7646 * options.h (DEFINE_var): Use parentheses around argument varname__
7647 in macro body to avoid any unintended subsequent substitutions.
7648
7649 2010-01-10 Ian Lance Taylor <iant@google.com>
7650
7651 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7652 candidates before doing symbol resolution.
7653
7654 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7655 ODR candidates if only one is weak.
7656
7657 2010-01-08 Ian Lance Taylor <iant@google.com>
7658
7659 * script.cc (Version_script_info::build_expression_list_lookup):
7660 Don't warn about ambiguous version, just record the ambiguity.
7661 (Version_script_info::get_symbol_version_helper): Give error if
7662 version is ambiguous.
7663
7664 2010-01-08 Doug Kwan <dougkwan@google.com>
7665
7666 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7667 prev_data_size_ and prev_addralign_. Remove initializer for
7668 deleted data member has_been_changed_.
7669 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7670 to determine if the table is empty.
7671 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7672 Remove.
7673 (Stub_table::add_reloc_stub): Define method in class definition
7674 instead of just declaring it there.
7675 (Stub_table::add_cortex_a8_stub): New method definition.
7676 (Stub_table::update_data_size_and_addralign): Ditto.
7677 (Stub_table::finalize_stubs): Ditto.
7678 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7679 (Stub_table::do_addralign_): Return address alignment in the
7680 (Stub_table::do_reset_address_and_file_offset): Define method in
7681 class definition instead of declaring it there. Set current data
7682 size to be the data size of the previous pass.
7683 (Stub_table::set_final_data_size): Use current data size as the
7684 final data size.
7685 (Stub_table::relocate_stub): Change parameter type of stub from
7686 Reloc_stub pointer to Stub pointer.
7687 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7688 (Stub_table::Cortex_a8_stub_list): New typedef.
7689 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7690 Stub_table::prev_addralign_): New data member.
7691 (Arm_relobj::Arm_relobj): Initialize data member
7692 section_has_cortex_a8_workaround_.
7693 (Arm_relobj::section_has_cortex_a8_workaround,
7694 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7695 definitions.
7696 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7697 declarations.
7698 (Target_arm::relocate_stub): Change parameter type of stub from
7699 Reloc_stub pointer to Stub pointer.
7700 (Insn_template::size, Insn_template::alignment): Handle
7701 THUMB16_SPECIAL_TYPE.
7702 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7703 Stub_table::update_data_size_and_addralign,
7704 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7705 definitions.
7706 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7707 (Stub_table::do_write): Ditto.
7708 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7709
7710 2010-01-08 Ian Lance Taylor <iant@google.com>
7711
7712 PR 11108
7713 * symtab.h (class Symbol): Remove fields is_target_special_ and
7714 has_plt_offset_. Add field is_defined_in_discarded_section_.
7715 (Symbol::is_defined_in_discarded_section): New function.
7716 (Symbol::set_is_defined_in_discarded_section): New function.
7717 (Symbol::has_plt_offset): Rewrite.
7718 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7719 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7720 Don't initialize is_target_special_ or has_plt_offset_.
7721 Initialize is_defined_in_discarded_section_.
7722 (Symbol_table::add_from_relobj): If appropriate, set
7723 is_defined_in_discarded_section.
7724 * resolve.cc (Symbol::override_base_with_special): Don't test
7725 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7726 * target-reloc.h (relocate_section): Do special handling for
7727 symbols defined in discarded sections for global symbols as well
7728 as local symbols.
7729
7730 2010-01-08 Ian Lance Taylor <iant@google.com>
7731
7732 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7733 the SHT_SYMTAB case.
7734
7735 2010-01-08 Ian Lance Taylor <iant@google.com>
7736
7737 * object.cc (Sized_relobj::do_layout): Don't get confused if
7738 layout_eh_frame returns NULL.
7739
7740 2010-01-08 Ian Lance Taylor <iant@google.com>
7741
7742 PR 11084
7743 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7744 dynamic symbol table, use the normal symbol table.
7745 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7746 symbol table.
7747
7748 2010-01-08 Ian Lance Taylor <iant@google.com>
7749
7750 PR 11072
7751 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7752 sections.
7753
7754 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7755
7756 * version.cc (print_version): Change to "Copyright 2010".
7757
7758 2010-01-08 Ian Lance Taylor <iant@google.com>
7759
7760 PR 10287
7761 PR 11063
7762 * i386.cc (class Target_i386): Change return type of plt_section
7763 to be non-const.
7764 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7765 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7766 tls_desc_rel_ field.
7767 (Output_data_plt_i386::rel_tls_desc): New function.
7768 (Target_i386::rel_tls_desc_section): New function.
7769 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7770 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7771 R_386_TLS_DESC reloc in rel_tls_desc_section.
7772 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7773 Define struct Tlsdesc_info.
7774 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7775 (Target_x86_64::do_reloc_symbol_index): New function.
7776 (Target_x86_64::add_tlsdesc_info): New function.
7777 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7778 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7779 tlsdesc_rel_ field.
7780 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7781 all callers.
7782 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7783 (Target_x86_64::rela_tlsdesc_section): New function.
7784 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7785 handling.
7786 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7787 (Target_x86_64::do_reloc_addend): New function.
7788 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7789 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7790 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7791 (Output_reloc::type): New function.
7792 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7793 (Output_reloc::is_target_specific): New function.
7794 (Output_reloc::target_arg): New function.
7795 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7796 absolute relocs and target specific relocs.
7797 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7798 add_target_specific.
7799 (class Output_data_reloc) [SHT_RELA]: Likewise.
7800 * output.cc (Output_reloc::Output_reloc): Add four new versions
7801 for absolute relocs and target specific relocs.
7802 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7803 (Output_reloc::get_symbol_index): Likewise.
7804 (Output_reloc::local_section_offset): Check that local_sym_index_
7805 is not TARGET_CODE or 0.
7806 (Output_reloc::symbol_value): Likewise.
7807 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7808 reloc.
7809 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7810 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7811 functions.
7812 * layout.cc (add_target_dynamic_tags): Use output section for
7813 DT_PLTRELSZ and DT_JMPREL.
7814
7815 2010-01-07 Ian Lance Taylor <iant@google.com>
7816
7817 PR 11061
7818 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7819 function.
7820 (class Output_data_reloc_generic): Define.
7821 (class Output_data_reloc_base): Change base class to
7822 Output_data_reloc_generic. Change add() method to call
7823 bump_relative_reloc_count for a relative reloc. Remove
7824 sort_relocs_ field.
7825 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7826 to sort_relocs().
7827 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7828 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7829 appropriate.
7830 * layout.h (class Layout): Update declaration.
7831
7832 2010-01-07 Ian Lance Taylor <iant@google.com>
7833
7834 * output.h (class Output_data): Add const version of
7835 output_section and do_output_section.
7836 (class Output_section_data): Add const version of
7837 do_output_section.
7838 (class Output_section): Likewise.
7839 * layout.cc (Layout::add_target_dynamic_tags): New function.
7840 * layout.h (class Layout): Update declarations.
7841 * arm.cc (Target_arm::do_finalize_sections): Use
7842 add_target_dynamic_tags.
7843 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7844 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7845 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7846 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7847
7848 2010-01-07 Ian Lance Taylor <iant@google.com>
7849
7850 PR 11042
7851 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7852 object as needed.
7853
7854 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7855 Ian Lance Taylor <iant@google.com>
7856
7857 PR 11019
7858 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7859 Xindex::read_symtab_xindex.
7860
7861 2010-01-07 Doug Kwan <dougkwan@google.com>
7862
7863 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7864 (Insn_template::thumb16_bcond_insn): New method declaration.
7865 (Insn_template): Fix spelling.
7866 (Stub::thumb16_special): New method declaration.
7867 (Stub::do_write): Define virtual method which was previously pure
7868 virtual.
7869 (Stub::do_thumb16_special): New method declaration.
7870 (Stub::do_fixed_endian_write): New template member.
7871 (Reloc_stub::do_write): Remove.
7872 (Reloc_stub::do_fixed_endian_write): Remove.
7873 (Cortex_a8_stub): New class definition.
7874 (Stub_factory::make_cortex_a8_stub): New method definition.
7875 (Stub_factory::Stub_factory): Add missing static storage class
7876 qualifier for elf32_arm_stub_a8_veneer_blx.
7877
7878 2010-01-07 Ian Lance Taylor <iant@google.com>
7879
7880 PR 10980
7881 * options.h (class General_options): Add --warn-unresolved-symbols
7882 and --error-unresolved-symbols.
7883 * errors.cc (Errors::undefined_symbol): Implement
7884 --warn-unresolved-symbols.
7885
7886 * options.h (class General_options): Add -z text and -z textoff.
7887 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7888
7889 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7890
7891 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7892 (Garbage_collection::cident_sections): New function.
7893 (Garbage_collection::add_cident_section): New function.
7894 (Garbage_collection::cident_sections_): New member.
7895 (gc_process_relocs): Add references to sections whose names are C
7896 identifiers.
7897 * gold.h (cident_section_start_prefix): New constant.
7898 (cident_section_stop_prefix): New constant.
7899 (is_cident): New function.
7900 * layout.cc (Layout::define_section_symbols): Replace string constants
7901 with the newly defined constants.
7902 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7903 C identifiers.
7904 * testsuite/Makefile.am: Add gc_orphan_section_test.
7905 * testsuite/Makefile.in: Regenerate.
7906 * testsuite/gc_orphan_section_test.cc: New file.
7907 * testsuite/gc_orphan_section_test.sh: New file.
7908
7909 2010-01-06 Ian Lance Taylor <iant@google.com>
7910
7911 PR 10980
7912 * options.h (class General_options): Add --warn-shared-textrel.
7913 * layout.cc (Layout::finish_dynamic_section): Implement
7914 --warn-shared-textrel.
7915
7916 PR 10980
7917 * options.h (class General_options): Add --warn-multiple-gp.
7918
7919 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7920
7921 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7922 $(THREADSLIB) and $(LIBDL).
7923 * Makefile.in: Rebuild.
7924
7925 2010-01-06 Ian Lance Taylor <iant@google.com>
7926
7927 PR 10980
7928 * options.cc (General_options::parse_section_start): New function.
7929 (General_options::section_start): New function.
7930 (General_options::General_options): Initialize all members.
7931 * options.h: Include <map>
7932 (class General_options): Add --section-start. Add section_starts_
7933 member.
7934 * layout.cc (Layout::attach_allocated_section_to_segment): If
7935 --section-start was used, set the address of the segment. Remove
7936 local sort_sections.
7937 (Layout::relaxation_loop_body): If the address of the load segment
7938 has been set by --section-start, don't use it.
7939 * output.h (Output_segment::update_flags_for_output_section): New
7940 function.
7941 * output.cc (Output_segment::add_output_section): Call
7942 update_flags_for_output_section.
7943
7944 2010-01-05 Ian Lance Taylor <iant@google.com>
7945
7946 PR 10980
7947 * options.h (class General_options): Add --undefined-version.
7948 * script.cc (struct Version_expression): Add was_matched_by_symbol
7949 field.
7950 (Version_script_info::matched_symbol): New function.
7951 (Version_script_info::get_symbol_version_helper): Call
7952 matched_symbol.
7953 (Version_script_info::check_unmatched_names): New function.
7954 * script.h (class Version_script_info): Update declarations.
7955 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7956
7957 * options.h (class General_options): Use DEFINE_bool_alias for
7958 allow_multiple_definition.
7959 * resolve.cc (Symbol_table::should_override): Don't test
7960 allow_multiple_definition.
7961
7962 PR 10980
7963 * options.h (class General_options): Add --cref.
7964 * main.cc (main): Print cref table if --cref. Don't close mapfile
7965 until after printing cref table.
7966 * cref.cc: Include "symtab.h".
7967 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7968 (Cref_table_compare::operator()): New function.
7969 (Cref_inputs::gather_cref): New function.
7970 (filecol): New static const.
7971 (Cref_inputs::print_cref): New function.
7972 (Cref::print_cref): New function.
7973 * cref.h: Include <cstdio>.
7974 (class Cref): Update declarations.
7975 * mapfile.h (Mapfile::file): New function.
7976 * object.h (class Object): Define Symbols. Declare virtual
7977 do_get_global_symbols.
7978 (Object::get_global_symbols): New function.
7979 * object.cc (Input_objects::add_object): Pass object to cref_ if
7980 --cref.
7981 (Input_objects::archive_start): Likewise.
7982 (Input_objects::archive_stop): Likewise.
7983 (Input_objects::print_cref): New function.
7984 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7985 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7986 --cref.
7987 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7988 function.
7989 * plugin.h (class Sized_pluginobj): Update declarations.
7990
7991 2010-01-05 Ian Lance Taylor <iant@google.com>
7992
7993 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7994 to is_default_version. Rename insdef to insdefault.
7995 (Symbol_table::add_from_relobj): Rename def to is_default_version
7996 and local to is_forced_local.
7997 (Symbol_table::add_from_pluginobj): Likewise.
7998 (Symbol_table::add_from_dynobj): Likewise.
7999 (Symbol_table::define_special_symbol): Rename insdef to
8000 insdefault.
8001
8002 2010-01-04 Ian Lance Taylor <iant@google.com>
8003
8004 PR 10980
8005 * options.h (class General_options): Add
8006 --allow-multiple-definition and -z muldefs.
8007 * resolve.cc (Symbol_table::should_override): Don't warn about a
8008 multiple symbol definition if --allow-multiple-definition or -z
8009 muldefs.
8010
8011 PR 10980
8012 * options.h (class General_options): Add --add-needed and
8013 --copy-dt-needed-entries. Tweak --as-needed help entry.
8014 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8015 error if --copy-dt-needed-entries aka --add-needed is used and
8016 would cause a change in behaviour.
8017
8018 PR 10980
8019 * options.h (class General_options): Add -G as a short version of
8020 --shared. Add no-op options -assert, -g, and -i.
8021
8022 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8023
8024 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8025 check for .text or .gnu.linkonce.t sections.
8026 * icf.cc (Icf::find_identical_sections): Ditto.
8027 Change the detection for mangled function name within the section
8028 name.
8029 * icf.h (is_section_foldable_candidate): New function.
8030
8031 2009-12-30 Ian Lance Taylor <iant@google.com>
8032
8033 PR 10980
8034 * options.h (class General_options): Permit two dashes with
8035 --retain-symbols-file.
8036
8037 2009-12-30 Ian Lance Taylor <iant@google.com>
8038
8039 PR 10979
8040 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8041 don't put the file header and segment headers in the text
8042 segment.
8043
8044 PR 10979
8045 * common.cc (Sort_commons::operator()): Stabilize sort when both
8046 entries are NULL.
8047 (Symbol_table::do_allocate_commons_list): When allocating common
8048 symbols, skip a symbol which is no longer common.
8049 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8050 an object before checking its type.
8051 * testsuite/common_test_2.c: New file.
8052 * testsuite/common_test_3.c: New file.
8053 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8054 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8055 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8056 (common_test_2_pic.o, common_test_2.so): New targets.
8057 (common_test_3_pic.o, common_test_3.so): New targets.
8058 * testsuite/Makefile.in: Rebuild.
8059
8060 PR 10979
8061 * script.cc (read_input_script): If we see a new SECTIONS clause,
8062 and we have added an input section, give an error.
8063 * layout.h (class Layout): Add have_added_input_section function.
8064 Add have_added_input_section_ field.
8065 * layout.cc (Layout::Layout): Initialize
8066 have_added_input_section_.
8067 (Layout::layout): Set have_added_input_section_.
8068 (Layout::layout_eh_frame): Likewise.
8069
8070 2009-12-30 Ian Lance Taylor <iant@google.com>
8071
8072 PR 10931
8073 * options.h (class General_options): Add --sort-common option.
8074 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8075 * common.cc (Sort_common): Add sort_order parameter to
8076 constructor. Add sort_order_ field.
8077 (Sort_commons::operator): Check sort_order_.
8078 (Symbol_table::allocate_commons): Determine the sort order.
8079 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8080 Change all callers.
8081 (Symbol_table::do_allocate_commons_list): Likewise.
8082
8083 2009-12-30 Ian Lance Taylor <iant@google.com>
8084
8085 PR 10916
8086 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8087 symbols from this object, don't change the visibility of an
8088 undefined symbol.
8089 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8090
8091 2009-12-30 Ian Lance Taylor <iant@google.com>
8092
8093 PR 10861
8094 * script.h (class Version_script_info): Define Language enum.
8095 Update declarations. Define Glob, Exact, and Lookup types. Add
8096 new fields globals_, locals_, and is_finalized_.
8097 * script.cc: Various formatting fixes.
8098 (class Parser_closure): Change language_stack_ from a vector of
8099 std::string to one of Version_script_info::Language. Adjust all
8100 uses accordingly.
8101 (class Lazy_demangler): Remove.
8102 (struct Version_expression): Change language from std::string to
8103 Version_script_info::Language.
8104 (Version_script_info::Version_script_info): New function.
8105 (Version_script_info::~Version_script_info): Don't call clear.
8106 (Version_script_info::finalize): New function.
8107 (Version_script_info::build_lookup_tables): New function.
8108 (Version_script_info::build_expression_list_lookup): New
8109 function.
8110 (Version_script_info::get_symbol_version_helper): Rewrite to use
8111 lookup tables.
8112 (Version_script_info::print_expression_list): Adjust to use
8113 Version_script_info::Language.
8114 (script_push_lex_into_version_mode): Check that the version script
8115 has not been finalized.
8116 (version_script_push_lang): Change language string to
8117 Version_script_info::Language.
8118 * options.cc (Command_line::version_script): New function.
8119 * options.h (class General_options): Add finalize_dynamic_list
8120 function. Change version_script from declaration to definition.
8121 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8122 * testsuite/version_script.map: Remove duplicate def of foo.
8123 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8124 version_script.map.
8125 * testsuite/Makefile.in: Rebuild.
8126
8127 2009-12-30 Ian Lance Taylor <iant@google.com>
8128
8129 PR 10843
8130 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8131 if the input symbol index is 0, make the output symbol index 0.
8132
8133 2009-12-30 Ian Lance Taylor <iant@google.com>
8134
8135 PR 10670
8136 * options.h (class General_options): Add -x/--discard-all.
8137 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8138 --discard-all. If the local symbol needs a dynamic entry, check
8139 that before handling --discard-locals.
8140
8141 2009-12-30 Ian Lance Taylor <iant@google.com>
8142
8143 PR 10450
8144 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8145 flags to PF_R.
8146 (Output_segment::add_output_section): Don't change the flags if
8147 the type is PT_TLS.
8148
8149 PR 10450
8150 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8151 GNU hash table if they need a dynamic value. Otherwise, don't add
8152 them if they are defined in a dynamic object or are forced local.
8153
8154 2009-12-29 Ian Lance Taylor <iant@google.com>
8155
8156 PR 10450
8157 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8158 .gnu.hash table for a 32-bit target.
8159
8160 PR 10450
8161 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8162 regular and a dynamic object only needs a dynamic symbol table
8163 entry if it is externally visible.
8164
8165 PR 10450
8166 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8167 constructor. Add global_offset_table_ field.
8168 (Target_i386::got_section): Set global_offset_table_.
8169 (Target_i386::do_finalize_sections): Set global_offset_table_
8170 size.
8171 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8172 in constructor. Add global_offset_table_ field.
8173 (Target_x86_64::got_section): Set global_offset_table_.
8174 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8175 size.
8176
8177 * layout.cc (Layout::Layout): Initialize increase_relro_.
8178 (Layout::get_output_section): Add is_relro, is_last_relro, and
8179 is_first_non_relro parameters. Change all callers.
8180 (Layout::choose_output_section): Likewise.
8181 (Layout::add_output_section_data): Likewise.
8182 (Layout::make_output_section): Likewise.
8183 (Layout::set_segment_offsets): Clear increase_relro when using a
8184 linker script.
8185 * layout.h (class Layout): Add increase_relro method. Add
8186 increase_relro_ field. Update declarations.
8187 * output.cc (Output_section::Output_section): Initialize
8188 is_last_relro_ and is_first_non_relro_.
8189 (Output_segment::add_output_section): Group relro sections is
8190 do_sort is true. Handle is_last_relro and is_first_non_relro.
8191 (Output_segment::maximum_alignment): Remove relro handling.
8192 (Output_segment::set_section_addresses): Add increase_relro
8193 parameter. Change all callers. Add initial alignment to align
8194 relro sections on separate page. Remove old relro handling.
8195 (Output_segment::set_section_list_addresses): Remove in_relro
8196 parameter. Change all callers.
8197 (Output_segment::set_offset): Add increase parameter. Change all
8198 callers. Remove old relro handling.
8199 * output.h (class Output_section): Add new methods: is_last_relro,
8200 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8201 Add is_last_relro_ and is_first_non_relro_ fields.
8202 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8203 Create separate .got.plt section. Call increase_relro.
8204 * x86_64.cc (Target_x86_64::got_section): Likewise.
8205 * testsuite/relro_script_test.t: Add .got.plt.
8206
8207 PR 10450
8208 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8209 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8210 (Layout::finalize): Call set_dynamic_symbol_size.
8211 (Layout::set_dynamic_symbol_size): New function.
8212 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8213 set_dynamic_symbol_size.
8214
8215 PR 10450
8216 * output.h (class Output_section): Add is_entsize_zero_ field.
8217 * output.cc (Output_section::Output_section): Initialize
8218 is_entsize_zero_.
8219 (Output_section::set_entsize): If two different entsizes are
8220 requested, force it to zero.
8221 (Output_section::add_input_section): Set flags for .debug_str
8222 before updating section flags. Set entsize.
8223 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8224 and SHF_STRING if all input sections have those flags.
8225
8226 2009-12-29 Rafael Espindola <espindola@google.com>
8227
8228 * main.cc (main): Fix the sys time reporting.
8229 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8230 reporting.
8231
8232 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8233
8234 * options.cc (General_options::parse_version): Allow -v to exit
8235 without an error if there is nothing to link.
8236
8237 2009-12-29 Ian Lance Taylor <iant@google.com>
8238
8239 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8240 using a version of gcc before 4.1.
8241 * configure: Rebuild.
8242
8243 2009-12-28 Chris Demetriou <cgd@google.com>
8244
8245 * attributes.cc (Output_attributes_section_data::do_write): Use
8246 std::vector::front rather than std::vector::data.
8247
8248 2009-12-28 Ian Lance Taylor <iant@google.com>
8249
8250 * symtab.h (class Symbol_table): Add enum Defined.
8251 * resolve.cc (Symbol_table::should_override): Add defined
8252 parameter. Change all callers. Test whether object is NULL
8253 before calling a method on it.
8254 (Symbol_table::report_resolve_problem): Add defined parameter.
8255 Change all callers.
8256 (Symbol_table::should_override_with_special): Likewise.
8257 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8258 parameter. Change all callers.
8259 (Symbol_table::do_define_in_output_data): Likewise.
8260 (Symbol_table::define_in_output_segment): Likewise.
8261 (Symbol_table::do_define_in_output_segment): Likewise.
8262 (Symbol_table::define_as_constant): Likewise.
8263 (Symbol_table::do_define_as_constant): Likewise.
8264 * script.h (class Symbol_assignment): Add is_defsym parameter to
8265 constructor; change all callers.
8266 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8267 parameter. Change all callers. Add is_defsym_ field.
8268 (class Parser_closure): Add parsing_defsym parameter to
8269 constructor; change all callers. Add parsing_defsym accessor
8270 function. Add parsing_defsym_ field.
8271
8272 2009-12-28 Ian Lance Taylor <iant@google.com>
8273
8274 * gold.cc (queue_middle_tasks): Fix formatting.
8275 * object.cc (Relobj::is_section_name_included): Likewise.
8276
8277 2009-12-23 Ian Lance Taylor <iant@google.com>
8278
8279 * i386.cc (Target_i386::do_calls_non_split): Recognize
8280 -fsplit-stack prologue for a function with a static chain.
8281 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8282 -fsplit-stack prologue when using %r11.
8283
8284 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8285
8286 * options.cc (General_options::parse_version): Make -v continue and do
8287 the link like GNU ld does.
8288
8289 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8290
8291 * Makefile.am (CCFILES): Add timer.cc.
8292 (HFILES): Add timer.h.
8293 * configure.ac: Check for sysconf and times.
8294 * main.cc: include timer.h.
8295 (main): Use Timer instead of get_run_time.
8296 * timer.cc: New.
8297 * timer.h: New.
8298 * workqueue.cc: include timer.h.
8299 (Workqueue::find_and_run_task):
8300 Report user, sys and wall time.
8301 * Makefile.in: Regenerate.
8302 * config.in: Regenerate.
8303 * configure: Regenerate.
8304
8305 2009-12-16 Doug Kwan <dougkwan@google.com>
8306
8307 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8308 sections.
8309 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8310 relaxed input sections.
8311 * output.cc (Output_section::find_relaxed_input_section): Change
8312 return type to Output_relaxed_input_section pointer. Adjust code
8313 for new type of relaxed_input_section_map_.
8314 * output.h (Output_section::find_relaxed_input_section): Change
8315 return type to Output_relaxed_input_section pointer.
8316 (Output_section::Output_relaxed_input_section_by_input_section_map):
8317 New type.
8318 (Output_section::relaxed_input_section_map_): Change type to
8319 Output_section::Output_relaxed_input_section_by_input_section_map.
8320 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8321 input section.
8322
8323 2009-12-15 Ian Lance Taylor <iant@google.com>
8324
8325 * layout.cc (Layout::create_shstrtab): Only write out after input
8326 sections if we are compressing debug sections.
8327
8328 2009-12-15 Ian Lance Taylor <iant@google.com>
8329
8330 * archive.cc (Archive::add_symbols): Only look up a symbol without
8331 a version if there is, in fact, a version.
8332
8333 2009-12-14 Ian Lance Taylor <iant@google.com>
8334
8335 Revert -Wshadow changes, all changes from:
8336 2009-12-11 Doug Kwan <dougkwan@google.com>
8337 2009-12-11 Nick Clifton <nickc@redhat.com>
8338 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8339
8340 2009-12-11 Doug Kwan <dougkwan@google.com>
8341
8342 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8343 due to -Wshadow.
8344 * attributes.cc (Object_attribute::size): Ditto.
8345 (Attributes_section_data::size): Ditto.
8346 (Attributes_section_data::Attributes_section_data): Ditto.
8347 (Output_attributes_section_data::do_write): Ditto.
8348 * attributes.h (Object_attribute::set_type): Ditto.
8349 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8350
8351 2009-12-11 Nick Clifton <nickc@redhat.com>
8352
8353 * archive.cc: Fix shadowed variable warnings.
8354 * arm.cc: Likewise.
8355 * compressed_output.cc: Likewise.
8356 * compressed_output.h: Likewise.
8357 * configure: Likewise.
8358 * dwarf_reader.cc: Likewise.
8359 * dynobj.cc: Likewise.
8360 * dynobj.h: Likewise.
8361 * ehframe.cc: Likewise.
8362 * ehframe.h: Likewise.
8363 * errors.cc: Likewise.
8364 * expression.cc: Likewise.
8365 * fileread.cc: Likewise.
8366 * fileread.h: Likewise.
8367 * freebsd.h: Likewise.
8368 * i386.cc: Likewise.
8369 * icf.cc: Likewise.
8370 * incremental.h: Likewise.
8371 * layout.cc: Likewise.
8372 * layout.h: Likewise.
8373 * mapfile.cc: Likewise.
8374 * merge.cc: Likewise.
8375 * merge.h: Likewise.
8376 * object.cc: Likewise.
8377 * object.h: Likewise.
8378 * options.h: Likewise.
8379 * output.cc: Likewise.
8380 * output.h: Likewise.
8381 * parameters.cc: Likewise.
8382 * plugin.cc: Likewise.
8383 * powerpc.cc: Likewise.
8384 * reduced_debug_output.cc: Likewise.
8385 * reduced_debug_output.h: Likewise.
8386 * reloc.cc: Likewise.
8387 * reloc.h: Likewise.
8388 * resolve.cc: Likewise.
8389 * script-sections.cc: Likewise.
8390 * script.cc: Likewise.
8391 * script.h: Likewise.
8392 * sparc.cc: Likewise.
8393 * symtab.cc: Likewise.
8394 * symtab.h: Likewise.
8395 * target-select.cc: Likewise.
8396 * target-select.h: Likewise.
8397 * token.h: Likewise.
8398 * workqueue.cc: Likewise.
8399 * workqueue.h: Likewise.
8400 * x86_64.cc: Likewise.
8401
8402 2009-12-10 Doug Kwan <dougkwan@google.com>
8403
8404 * arm.cc (attributes.h): New include.
8405 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8406 (Arm_relobj::~Arm_relobj): Delete object pointed by
8407 attributes_section_data_.
8408 (Arm_relobj::attributes_section_data): New method definition.
8409 (Arm_relobj::attributes_section_data_): New data member declaration.
8410 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8411 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8412 attributes_section_data_.
8413 (Arm_dynobj::attributes_section_data): New method definition.
8414 (Arm_dynobj::attributes_section_data_): New data member declaration.
8415 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8416 initialization value of may_use_blx_ to false.
8417 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8418 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8419 object attributes to compute results instead of hard-coding.
8420 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8421 Target_arm::get_secondary_compatible_arch,
8422 Target_arm::set_secondary_compatible_arch
8423 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8424 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8425 New method declarations.
8426 (Target_arm::get_aeabi_object_attribute): New method definition.
8427 (Target_arm::attributes_section_data_): New data member declaration.
8428 (read_arm_attributes_section): New template definition.
8429 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8430 (Arm_dynobj::do_read_symbols): Ditto.
8431 (Target_arm::do_finalize_sections): Merge attributes sections from
8432 input. Check for BLX use after attributes section merging.
8433 Fix __exidx_start and __exidx_end visibility. Create an
8434 .ARM.attributes section if necessary.
8435 (Target_arm::get_secondary_compatible_arch,
8436 Target_arm::set_secondary_compatible_arch,
8437 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8438 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8439 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8440 New method definitions.
8441
8442 2009-12-09 Ian Lance Taylor <iant@google.com>
8443
8444 * plugin.cc (Plugin::load): Don't cast from void* to a function
8445 pointer.
8446
8447 2009-12-09 Ian Lance Taylor <iant@google.com>
8448
8449 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8450 information fields.
8451
8452 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8453
8454 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8455 Replace two_file_shared_1.so with two_file_shared_2.so.
8456 * testsuite/Makefile.in: Regenerated.
8457
8458 2009-12-08 Doug Kwan <dougkwan@google.com>
8459
8460 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8461 (HFILES): Add attributes.h and int_encoding.h.
8462 * Makefile.in: Regenerate.
8463 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8464 function definitions to int_encoding.cc
8465 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8466 prototypes to int_encoding.h
8467 * reduced_debug_output.cc (int_encoding.h): New include.
8468 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8469 function definitions to int_encoding.cc
8470 (insert_into_vector, read_from_pointer): Move template definitions to
8471 int_encoding.h
8472 * attributes.cc: New file.
8473 * attributes.h: New file.
8474 * int_encoding.cc: New file.
8475 * int_encoding.h: New file.
8476
8477 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8478
8479 PR gold/11055
8480 * incremental-dump.cc (dump_incremental_inputs): New.
8481 (main): Use dump_incremental_inputs.
8482
8483 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8484
8485 PR gold/10893
8486 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8487 checking elfcpp::STT_FUNC.
8488 (Target_i386::Relocate::relocate): Likewise.
8489 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8490
8491 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8492 symbols from shared libraries into normal FUNC symbols.
8493
8494 * symtab.h (Symbol): Add is_func and use it.
8495
8496 2009-12-05 Doug Kwan <dougkwan@google.com>
8497
8498 * arm.cc (Target_arm::arm_info): Initialize new fields
8499 attributes_section and attributes_vendor.
8500 * i386.cc (Target_i386::i386_info): Same.
8501 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8502 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8503 fields attributes_section and attributes_vendor.
8504 * sparc.cc (Target_sparc::sparc_info): Same.
8505 * target.h (Target::attributes_section, Target::attributes_vendor,
8506 Target::is_attributes_section, Target::attribute_arg_type,
8507 Target::attributes_order): New method definitions.
8508 (Target::Target_info::attributes_section,
8509 Target::Target_info::attributes_vendor): New fields.
8510 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8511 virtual method definitions.
8512 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8513 attributes_section and attributes_vendor.
8514 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8515
8516 2009-12-05 Doug Kwan <dougkwan@google.com>
8517
8518 * arm.cc: Update comments about interworking and stub generation.
8519 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8520 considered as non-PIC.
8521 (Arm_relocate_functions::base_abs): Fix formatting.
8522 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8523 of function to use GOT entry address instead of offset.
8524 (Target_arm::Scan::global): Issue an error if a symbol would need a
8525 PLT does not get one because it is untyped. Remove code to create
8526 dynamic symbols for relative branches.
8527 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8528 takes unsigned integer instead of boolean.
8529
8530 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8531
8532 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8533 (two_file_test_LDADD): Likewise.
8534 (common_test_1_LDADD): Likewise.
8535 (exception_test_LDADD) Likewise.
8536 (weak_test_LDADD): Likewise.
8537 (many_sections_test_LDADD): Likewise.
8538 (initpri1_LDADD): Likewise.
8539 (script_test_1_LDADD): Likewise.
8540 (script_test_2_LDADD): Likewise.
8541 (justsyms_LDADD): Likewise.
8542 (binary_test_LDADD): Likewise.
8543 (large_LDADD): Likewise.
8544 * testsuite/Makefile.in: Regenerated.
8545
8546 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8547
8548 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8549 (Symbol_table::override_with_special): Likewise.
8550 (Symbol_table::add_from_object): Likewise.
8551
8552 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8553
8554 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8555 Don't set the data_offset twice.
8556
8557 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8558
8559 * testsuite/Makefile.in: Regenerate.
8560
8561 2009-12-03 Doug Kwan <dougkwan@google.com>
8562
8563 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8564 (Target_arm::do_finalize_sections): Add parameter for symbol table
8565 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8566 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8567 parameter for symbol table pointer.
8568 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8569 an additional parameter for a pointer to symbol table.
8570 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8571 parameter for a symbol table pointer.
8572 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8573 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8574 Ditto.
8575 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8576 parameter for a symbol table pointer.
8577
8578 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8579
8580 * incremental.cc (Incremental_inputs_header)
8581 (Incremental_inputs_header_write, Incremental_inputs_entry)
8582 (Incremental_inputs_entry_write): Move ...
8583 * incremental.h (Incremental_inputs_header)
8584 (Incremental_inputs_header_write, Incremental_inputs_entry)
8585 (Incremental_inputs_entry_write): here.
8586
8587 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8588
8589 * incremental.cc (make_sized_incremental_binary): Set the target.
8590 Error if it is incompatible.
8591 * output.h (Output_file): Add filename method.
8592
8593 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8594
8595 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8596 from the get_* methods.
8597
8598 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8599
8600 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8601 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8602 Write 0 for the data_offset of scripts.
8603
8604 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8605
8606 * testsuite/Makefile.am: Add the incremental_test.sh test.
8607 * testsuite/incremental_test.sh: New.
8608 * testsuite/incremental_test_1.c: New.
8609 * testsuite/incremental_test_2.c: New.
8610
8611 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8612
8613 * incremental-dump.cc (main): Fix typos.
8614
8615 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8616
8617 PR gold/11025
8618 * incremental-dump.cc (main): Use llu to print 64 bit values.
8619
8620 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8621 H.J. Lu <hongjiu.lu@intel.com>
8622
8623 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8624 $(LIBDL).
8625 (incremental_dump_LDADD): Likewise.
8626 * Makefile.in: Regenerated.
8627
8628 2009-11-25 Doug Kwan <dougkwan@google.com>
8629
8630 Revert:
8631
8632 2009-11-25 Doug Kwan <dougkwan@google.com>
8633
8634 * arm.cc (Target_arm::Target_arm): Move method definition
8635 outside of class definition. Add code to handle
8636 --target1-rel, --target1-abs and --target2= options.
8637 (Target_arm::get_reloc_reloc_type): Change method to be
8638 non-static and const.
8639 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8640 New data member declaration.
8641 (Target_arm::Scan::local, Target_arm::Scan::global,
8642 Target_arm::Relocate::relocate,
8643 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8644 Adjust call to Target_arm::get_real_reloc_type.
8645 (Target_arm::get_real_reloc_type): Use command line options
8646 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8647 * options.h (--target1-rel, --target1-abs, --target2): New
8648 ARM-only options.
8649
8650 2009-11-25 Doug Kwan <dougkwan@google.com>
8651
8652 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8653 class definition. Add code to handle --target1-rel, --target1-abs
8654 and --target2= options.
8655 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8656 and const.
8657 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8658 member declaration.
8659 (Target_arm::Scan::local, Target_arm::Scan::global,
8660 Target_arm::Relocate::relocate,
8661 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8662 call to Target_arm::get_real_reloc_type.
8663 (Target_arm::get_real_reloc_type): Use command line options to
8664 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8665 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8666 options.
8667
8668 2009-11-25 Doug Kwan <dougkwan@google.com>
8669
8670 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8671 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8672 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8673 formatting.
8674 (Arm_relocate_functions::thm_call): Replace body with a call to
8675 Arm_relocate_functions::thumb_branch_common.
8676 (Arm_relocate_functions::thm_jump24,
8677 Arm_relocate_functions::thm_xpc22): New method definitions.
8678 (Arm_relocate_functions::thumb_branch_common): New method definition.
8679 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8680 operator.
8681 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8682 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8683
8684 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8685
8686 * Makefile.am: Build incremental-dump
8687 * Makefile.in: Regenerate.
8688 * incremental-dump.cc: New.
8689 * incremental.cc (Incremental_inputs_header_data,
8690 Incremental_inputs_entry_data): Move to incremental.h
8691 * incremental.h: (Incremental_inputs_header_data,
8692 Incremental_inputs_entry_data): Move from incremental.cc
8693
8694 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8695
8696 * incremental.cc (Incremental_inputs_header,
8697 Incremental_inputs_header_write, Incremental_inputs_entry,
8698 Incremental_inputs_entry_write): Add a typedef with the data type.
8699
8700 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8701
8702 * incremental.cc (Incremental_inputs_header,
8703 Incremental_inputs_header_write, Incremental_inputs_entry,
8704 Incremental_inputs_entry_write): Update comment about which
8705 type has the filed descriptions.
8706
8707 2009-11-15 Doug Kwan <dougkwan@google.com>
8708
8709 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8710 (Arm_relocate_functions::arm_branch_common): Change method defintion
8711 in class definition to a method declaration and update list of formal
8712 parameters.
8713 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8714 Arm_relocation_functions::jump24): Adjust call to
8715 Arm_relocate_functions::arm_branch_common. Update list of formal
8716 parameters.
8717 (Arm_relocate_functions::xpc25): New method definition.
8718 (Arm_relocate_functions::arm_branch_common): Move method defintion
8719 out from class definition. Use stubs for mode-switching and extending
8720 branch ranges.
8721 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8722 specially. Change code to enable use of stubs in ARM branches.
8723
8724 2009-11-10 Doug Kwan <dougkwan@google.com>
8725
8726 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8727 in method declaration.
8728 (Target_arm::relocate_stub): New method declaration.
8729 (Target_arm::default_target): Change to return a pointer instead of
8730 a const reference.
8731 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8732 Target_arm::default_target.
8733 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8734 method definition.
8735 (Target_arm::relocate_section): Adjust view.
8736 (Target_arm::relocate_stub): New method definition.
8737
8738 2009-11-10 Doug Kwan <dougkwan@google.com>
8739
8740 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8741 a format warning.
8742 * incremental.cc (open_incremental_binary): Initialized local
8743 variables to avoid warnings.
8744 * object.cc (make_elf_object): Ditto.
8745 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8746 a format warning.
8747
8748 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8749
8750 PR gold/10930
8751 * testsuite/plugin_test.c: Include "config.h".
8752
8753 2009-11-09 Doug Kwan <dougkwan@google.com>
8754
8755 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8756 (arm_symbol_value): Remove.
8757 (Arm_relocate_functions::arm_branch_common,
8758 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8759 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8760 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8761 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8762 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8763 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8764 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8765 Arm_relocate_functions::thm_mobw_abs_nc,
8766 Arm_relocate_functions::thm_mov_abs,
8767 Arm_relocate_functions::movw_prel_nc,
8768 Arm_relocate_functions::thm_movt_abs,
8769 Arm_relocate_functions::movt_prel,
8770 Arm_relocate_functions::thm_movw_prel_nc,
8771 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8772 (Target_arm::Relocate::relocate): Only decompose address into two
8773 parts if relocation type uses the thumb-bit and pass the actual
8774 bit instead of a flag indicating that the thumb-bit is used. Adjust
8775 calls to methods in Arm_relocate_functions for this change.
8776
8777 2009-11-08 Ian Lance Taylor <iant@google.com>
8778
8779 PR 10925
8780 * reloc.cc: Instantiate
8781 Sized_relobj::initialize_input_to_output_maps and
8782 Sized_relobj:free_input_to_output_maps.
8783
8784 2009-11-06 Ian Lance Taylor <iant@google.com>
8785
8786 PR 10876
8787 * defstd.cc (in_segment): Set only_if_ref true for "end".
8788
8789 2009-11-06 Doug Kwan <dougkwan@google.com>
8790
8791 * arm.cc (class Reloc_stub): Correct a comment.
8792 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8793 (Target_arm::scan_section_for_stubs): New method declaration.
8794 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8795 Change methods from private to protected.
8796 (Target_arm::do_may_relax): New method definition.
8797 (Target_arm::do_relax, Target_arm::group_sections,
8798 Target_arm::scan_reloc_for_stub,
8799 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8800 (Target_arm::arm_input_section_map_): New data member declaration.
8801 (Target_arm::scan_reloc_for_stub,
8802 Target_arm::scan_reloc_section_for_stubs,
8803 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8804 Target_arm::do_relax): New method definitions.
8805
8806 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8807
8808 * configure.ac: Check for (struct stat)::st_mtim
8809 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8810 * config.in: Regenerate.
8811 * configure: Regenerate.
8812
8813 2009-11-05 Ian Lance Taylor <iant@google.com>
8814
8815 PR 10910
8816 * output.cc (Output_segment::add_output_section): Add missing
8817 return statement.
8818
8819 2009-11-04 Ian Lance Taylor <iant@google.com>
8820
8821 PR 10880
8822 * object.h (class Object): Add is_needed and set_is_needed
8823 methods. Add is_needed_ field. Make bool fields into bitfields.
8824 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8825 defined in a dynamic object and referenced by a regular object,
8826 set is_needed for the dynamic object.
8827 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8828 if the file is marked with as_needed and it is not needed.
8829
8830 2009-11-04 Ian Lance Taylor <iant@google.com>
8831
8832 PR 10887
8833 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8834 tags if data is discarded by linker script.
8835 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8836 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8837 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8838 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8839
8840 2009-11-04 Ian Lance Taylor <iant@google.com>
8841
8842 * layout.cc (Layout::get_output_section): Add is_interp and
8843 is_dynamic_linker_section parameters. Change all callers.
8844 (Layout::choose_output_section): Likewise.
8845 (Layout::make_output_section): Likewise.
8846 (Layout::add_output_section_data): Add is_dynamic_linker_section
8847 parameter. Change all callers.
8848 * layout.h (class Layout): Update declarations.
8849 * output.h (class Output_section): Add is_interp, set_is_interp,
8850 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8851 Add is_interp_, is_dynamic_linker_section_ fields. Change
8852 generate_code_fills_at_write_ to a bitfield.
8853 * output.cc (Output_section::Output_sections): Initialize new
8854 fields.
8855 (Output_segment::add_output_section): Add do_sort parameter.
8856 Change all callers.
8857
8858 2009-11-03 Ian Lance Taylor <iant@google.com>
8859
8860 PR 10860
8861 * options.h (class General_options): Add --warn-common.
8862 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8863 merging two common symbols.
8864 (Symbol_table::should_override): Handle --warn-common when merging
8865 a common symbol with a defined symbol. Use report_resolve_problem
8866 for multiple definitions.
8867 (Symbol_table::report_resolve_problem): New function.
8868 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8869
8870 2009-11-03 Doug Kwan <dougkwan@google.com>
8871
8872 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8873 stub_factory_.
8874 (Target_arm::stub_factory): New method definition.
8875 (Target_arm::new_arm_input_section,
8876 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8877 Target_arm::reloc_uses_thumb_bit): New method declarations.
8878 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8879 New type definitions.
8880 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8881 member declarations.
8882 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8883 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8884 New method definitions.
8885
8886 2009-11-03 Ian Lance Taylor <iant@google.com>
8887
8888 * options.h (class General_options): Add --warn_constructors.
8889
8890 2009-11-03 Ian Lance Taylor <iant@google.com>
8891
8892 PR 10893
8893 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8894 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8895
8896 2009-11-03 Ian Lance Taylor <iant@google.com>
8897
8898 PR 10895
8899 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8900 --msgid-bugs-address.
8901 (install-pdf): New target.
8902 (install-data_yes): Look up one directory to find mkinstalldirs.
8903
8904 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8905
8906 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8907 tree.
8908
8909 2009-10-30 Doug Kwan <dougkwan@google.com>
8910
8911 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8912
8913 2009-10-30 Doug Kwan <dougkwan@google.com>
8914
8915 * arm.cc (Stub_addend_reader): New struct template definition
8916 and partial specializations.
8917 (Stub_addend_reader::operator()): New method definition for a
8918 partially specialized template.
8919
8920 2009-10-30 Doug Kwan <dougkwan@google.com>
8921
8922 * arm.cc (Arm_relobj::processor_specific_flags): New method
8923 definition.
8924 (Arm_relobj::do_read_symbols): New method declaration.
8925 (Arm_relobj::processor_specific_flags_): New data member declaration.
8926 (Arm_dynobj): New class definition.
8927 (Target_arm::do_finalize_sections): Add input_objects parameter.
8928 (Target_arm::do_adjust_elf_header): New method declaration.
8929 (Target_arm::are_eabi_versions_compatible,
8930 (Target_arm::merge_processor_specific_flags): New method declaration.
8931 (Target_arm::do_make_elf_object): New overloaded method definitions
8932 and declaration.
8933 (Arm_relobj::do_read_symbols): New method definition.
8934 (Arm_dynobj::do_read_symbols): Ditto.
8935 (Target_arm::do_finalize_sections): Add input_objects parameters.
8936 Merge processor-specific flags from all input objects.
8937 (Target_arm::are_eabi_versions_compatible,
8938 Target_arm::merge_processor_specific_flags,
8939 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8940 New method definitions.
8941 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8942 Input_objects pointer type parameter.
8943 * layout.cc (Layout::finalize): Pass input objects to target's.
8944 finalize_sections function.
8945 * output.cc (Output_file_header::do_sized_write): Set ELF file
8946 header's processor-specific flags.
8947 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8948 Input_objects pointer type parameter.
8949 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8950 * target.h (Input_objects): New forward class declaration.
8951 (Target::processor_specific_flags,
8952 Target::are_processor_specific_flags_sect): New method definitions.
8953 (Target::finalize_sections): Add input_objects parameter.
8954 (Target::Target): Initialize processor_specific_flags_ and
8955 are_processor_specific_flags_set_.
8956 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8957 parameter.
8958 (Target::set_processor_specific_flags): New method definition.
8959 (Target::processor_specific_flags_,
8960 Target::are_processor_specific_flags_set_): New data member
8961 declarations.
8962 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8963 Input_objects pointer type parameter.
8964
8965 2009-10-30 Doug Kwan <dougkwan@google.com>
8966
8967 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8968
8969 2009-10-28 Ian Lance Taylor <iant@google.com>
8970
8971 * object.h (class Relobj): Drop options parameter from
8972 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8973 do_scan_relocs, do_relocate. Change all callers.
8974 (class Sized_relobj): Drop options parameters from
8975 do_gc_process_relocs, do_scan_relocs, do_relocate,
8976 do_relocate_sections, relocate_sections, emit_relocs_scan,
8977 emit_relocs_scan_reltype. Change all callers.
8978 (struct Relocate_info): Remove options field and all references to
8979 it.
8980 * reloc.h (class Read_relocs): Remove options constructor
8981 parameter and options_ field. Change all callers.
8982 (class Gc_process_relocs, class Scan_relocs): Likewise.
8983 (class Relocate_task): Likewise.
8984 * target-reloc.h (scan_relocs): Remove options parameter. Change
8985 all callers.
8986 (scan_relocatable_relocs): Likewise.
8987 * target.h (class Sized_target): Remove options parameter from
8988 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8989 all callers.
8990 * gc.h (gc_process_relocs): Remove options parameter. Change all
8991 callers.
8992 * arm.cc: Update functions to remove options parameters.
8993 * i386.cc: Likewise.
8994 * powerpc.cc: Likewise.
8995 * sparc.cc: Likewise.
8996 * x86_64.cc: Likewise.
8997 * testsuite/testfile.cc: Likewise.
8998
8999 2009-10-28 Doug Kwan <dougkwan@google.com>
9000
9001 * arm.cc (Arm_relobj): New class definition.
9002 (Arm_relobj::scan_sections_for_stubs,
9003 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9004 New method definitions.
9005
9006 2009-10-28 Cary Coutant <ccoutant@google.com>
9007
9008 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9009 (Plugin::cleanup_done_): New member.
9010 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9011 (Plugin_manager::cleanup_done_): Remove.
9012 (Plugin_manager::add_input_file): Edit error message.
9013 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9014 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9015
9016 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9017
9018 * fileread.cc: (File_read::View::~View): Use the new
9019 data_ownership_ filed.
9020 (File_read::~File_read): Dispose the new whole_file_view_.
9021 (File_read::open): Mmap the whole file if needed.
9022 (File_read::open): Use whole_file_view_ instead of contents_.
9023 (File_read::find_view): Use whole_file_view_ if applicable.
9024 (File_read::do_read): Use whole_file_view_ instead of contents_.
9025 (File_read::make_view): Use whole_file_view_ instead of contents_,
9026 update File_read::View::View call.
9027 (File_read::find_or_make_view): Update File_read::View::View
9028 call.
9029 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9030 remove contents_
9031 (File_read::View::Data_ownership): New enum.
9032 (File_read::View::View): Replace bool mapped_ with Data_ownership
9033 argument.
9034 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9035 (File_read::View::data_ownership_): New field.
9036 (File_read::contents_): Remove (replaced by whole_file_view_).
9037 (File_read::whole_file_view_): New field.
9038 * options.h (class General_options): Add --keep-files-mapped.
9039
9040 2009-10-27 Cary Coutant <ccoutant@google.com>
9041
9042 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9043 * testsuite/Makefile.am (plugin_test_5): New test case.
9044 * testsuite/Makefile.in: Regenerate.
9045
9046 2009-10-25 Doug Kwan <dougkwan@google.com>
9047
9048 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9049 from private to protected to allow access by child class.
9050 (Sized_relobj::do_relocate_sections): New method declaration.
9051 (Sized_relobj::relocate_sections): Virtualize.
9052 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9053 Sized_relobj::relocate_sections. Instantiate template explicitly
9054 for different target sizes and endianity.
9055
9056 2009-10-24 Doug Kwan <dougkwan@google.com>
9057
9058 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9059 (Arm_input_section::as_arm_input_section): New method.
9060 (Arm_output_section): New class definition.
9061 (Arm_output_section::create_stub_group,
9062 Arm_output_section::group_sections): New method definitions.
9063
9064 2009-10-22 Doug Kwan <dougkwan@google.com>
9065
9066 * arm.cc (Arm_input_section): New class definition.
9067 (Arm_input_section::init, Arm_input_section:do_write,
9068 Arm_input_section::set_final_data_size,
9069 Arm_input_section::do_reset_address_and_file_offset): New method
9070 definitions.
9071
9072 2009-10-21 Doug Kwan <dougkwan@google.com>
9073
9074 * arm.cc (Stub_table, Arm_input_section): New forward class
9075 declarations.
9076 (Stub_table): New class defintion.
9077 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9078 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9079 New method definition.
9080
9081 2009-10-21 Doug Kwan <dougkwan@google.com>
9082
9083 * arm.cc: Update copyright comments.
9084 (Target_arm): New forward class template declaration.
9085 (Arm_address): New type.
9086 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9087 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9088 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9089 constants.
9090 (Insn_template): Same.
9091 (DEF_STUBS): New macro.
9092 (Stub_type): New enum type.
9093 (Stub_template): New class definition.
9094 (Stub): Same.
9095 (Reloc_stub): Same.
9096 (Stub_factory): Same.
9097 (Target_arm::Target_arm): Initialize may_use_blx_ and
9098 should_force_pic_veneer_.
9099 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9100 Target_arm::should_force_pic_veneer,
9101 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9102 Target_arm::using_thumb_only, Target_arm:;default_target): New
9103 method defintions.
9104 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9105 New data member declarations.
9106 (Insn_template::size, Insn_template::alignment): New method defintions.
9107 (Stub_template::Stub_template): New method definition.
9108 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9109 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9110 (Stub_factory::Stub_factory): New method definition.
9111 * gold.h (string_hash): New template.
9112 * output.h (Input_section_specifier::hash_value): Use
9113 gold::string_hash.
9114 (Input_section_specifier::string_hash): Remove.
9115 * stringpool.cc (Stringpool_template::string_hash): Use
9116 gold::string_hash.
9117
9118 2009-10-20 Doug Kwan <dougkwan@google.com>
9119
9120 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9121 symbols of relaxed input sections.
9122 * output.h (Output_section::find_relaxed_input_section): Make
9123 method public.
9124
9125 2009-10-16 Doug Kwan <dougkwan@google.com>
9126
9127 * dynobj.cc (Versions::Versions): Initialize version_script_.
9128 Only insert base version symbol definition for a shared object
9129 if version script defines any version versions.
9130 (Versions::define_base_version): New method definition.
9131 (Versions::add_def): Check that base version is not needed.
9132 (Versions::add_need): Define base version lazily.
9133 * dynobj.h (Versions::define_base_version): New method declaration.
9134 (Versions::needs_base_version_): New data member declaration.
9135 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9136 (check_DATA): Add no_version_test.stdout.
9137 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9138 New make rules.
9139 * testsuite/Makefile.in: Regenerate.
9140 * testsuite/no_version_test.c: New file.
9141 * testsuite/no_version_test.sh: Ditto.
9142
9143 2009-10-16 Doug Kwan <dougkwan@google.com>
9144
9145 * expression.cc (class Segment_start_expression): New class definition.
9146 (Segment_start_expression::value): New method definition.
9147 (script_exp_function_segment_start): Return a new
9148 Segment_start_expression.
9149 * gold/script-c.h (script_saw_segment_start_expression): New function
9150 prototype.
9151 * script-sections.cc (Script_sections::Script_sections): Initialize
9152 SAW_SEGMENT_START_EXPRESSION_ to false.
9153 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9154 and -Tbbs options to specify section addresses if given in
9155 command line and no SEGMENT_START expression is seen in a script.
9156 * script-sections.h (Script_sections::saw_segment_start_expression,
9157 Script_sections::set_saw_segment_start_expression): New method
9158 definition.
9159 (Script_sections::saw_segment_start_expression_): New data member
9160 declaration.
9161 * script.cc (script_saw_segment_start_expression): New function.
9162 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9163 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9164 script_test_7.sh and script_test_8.sh.
9165 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9166 script_test_8.stdout.
9167 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9168 (script_test_6, script_test_6.stdout, script_test_7,
9169 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9170 * Makefile.in: Regenerate.
9171 * testsuite/script_test_6.sh: New file.
9172 * testsuite/script_test_6.t: Same.
9173 * testsuite/script_test_7.sh: Same.
9174 * testsuite/script_test_7.t: Same.
9175 * testsuite/script_test_8.sh: Same.
9176
9177 2009-10-16 Doug Kwan <dougkwan@google.com>
9178
9179 * output.cc (Output_segment::set_section_list_address): Cast
9180 expressions to unsigned long long type to avoid format warnings.
9181
9182 2009-10-15 Ian Lance Taylor <iant@google.com>
9183
9184 * script.cc (Script_options::add_symbol_assignment): Always add a
9185 dot assignment to script_sections_.
9186 * script-sections.cc (Script_sections::add_dot_assignment):
9187 Initialize if necessary.
9188
9189 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9190 program headers with no load segment if there is a linker script.
9191
9192 * layout.cc (Layout::set_segment_offsets): Align the file offset
9193 to the segment aligment for -N or -n with no load segment.
9194 * output.cc (Output_segment::add_output_section): Don't crash if
9195 the first section is a TLS section.
9196 (Output_segment::set_section_list_addresses): Print an error
9197 message if the address moves backward in a linker script.
9198 * script-sections.cc
9199 (Output_section_element_input::set_section_addresses): Don't
9200 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9201 (Orphan_output_section::set_section_addresses): Likewise.
9202
9203 2009-10-15 Doug Kwan <dougkwan@google.com>
9204
9205 * layout.cc (Layout::finish_dynamic_section): Generate tags
9206 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9207 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9208 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9209
9210 2009-10-14 Ian Lance Taylor <iant@google.com>
9211
9212 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9213 fields.
9214 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9215 data_shdr fields of relinfo.
9216 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9217 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9218 R_386_TLS_LDO_32, adjust based on section flags.
9219 (Target_i386::Relocate::fix_up_ldo): Remove.
9220
9221 2009-10-13 Ian Lance Taylor <iant@google.com>
9222
9223 Add support for -pie.
9224 * options.h (class General_options): Add -pie and
9225 --pic-executable.
9226 (General_options::output_is_position_independent): Test -pie.
9227 (General_options::output_is_executable): Return true if not shared
9228 and not relocatable.
9229 (General_options::output_is_pie): Remove.
9230 * options.cc (General_options::finalize): Reject incompatible uses
9231 of -pie.
9232 * gold.cc (queue_middle_tasks): A -pie link is not static.
9233 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9234 * symtab.cc (Symbol::final_value_is_known): Return false if
9235 output_is_position_independent.
9236 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9237 output_is_position_independent.
9238 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9239 output_is_position_independent.
9240 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9241 output_is_position_independent.
9242 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9243 two_file_pie_test.
9244 (basic_pie_test.o, basic_pie_test): New targets.
9245 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9246 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9247 (two_file_pie_test): New target.
9248 * testsuite/Makefile.in: Rebuild.
9249 * README: Remove note saying that -pie is not supported.
9250
9251 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9252
9253 * options.h (class General_options): Add -init and -fini.
9254 * layout.cc (Layout::finish_dynamic_section): Emit
9255 given init and fini functions.
9256
9257 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9258
9259 * gc.h (gc_process_relocs): Check if icf is enabled using new
9260 function.
9261 * gold.cc (queue_initial_tasks): Likewise.
9262 (queue_middle_tasks): Likewise.
9263 * object.cc (do_layout): Likewise.
9264 * symtab.cc (is_section_folded): Likewise.
9265 * main.cc (main): Likewise.
9266 * reloc.cc (Read_relocs::run): Likewise.
9267 (Sized_relobj::do_scan_relocs): Likewise.
9268 * icf.cc (is_function_ctor_or_dtor): New function.
9269 (Icf::find_identical_sections): Check if function is ctor or dtor when
9270 safe icf is chosen.
9271 * options.h (General_options::icf): Change option to be an enum.
9272 (Icf_status): New enum.
9273 (icf_enabled): New method.
9274 (icf_safe_folding): New method.
9275 (set_icf_status): New method.
9276 (icf_status_): New variable.
9277 * (options.cc) (General_options::finalize): Set icf_status_.
9278 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9279 icf_test and icf_keep_unique_test to use the --icf enum flag.
9280 * testsuite/icf_safe_test.sh: New file.
9281 * testsuite/icf_safe_test.cc: New file.
9282
9283 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9284
9285 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9286 includes to gc.h and icf.h.
9287 * arm.cc: Include gc.h.
9288 * gold.cc: Likewise.
9289 * i386.cc: Likewise.
9290 * powerpc.cc: Likewise.
9291 * sparc.cc: Likewise.
9292 * x86_64.cc: Likewise.
9293 * gc.h: Include icf.h.
9294
9295 2009-10-11 Ian Lance Taylor <iant@google.com>
9296
9297 * plugin.cc: Include "gold.h" before other header files.
9298
9299 2009-10-10 Chris Demetriou <cgd@google.com>
9300
9301 * options.h (Input_file_argument::Input_file_type): New enum.
9302 (Input_file_argument::is_lib_): Replace with...
9303 (Input_file_argument::type_): New member.
9304 (Input_file_argument::Input_file_argument): Take Input_file_type
9305 'type' rather than boolean 'is_lib' as second argument.
9306 (Input_file_argument::is_lib): Use type_.
9307 (Input_file_argument::is_searched_file): New function.
9308 (Input_file_argument::may_need_search): Handle is_searched_file.
9309 * options.cc (General_options::parse_library): Support -l:filename.
9310 (General_options::parse_just_symbols): Update for Input_file_argument
9311 changes.
9312 (Command_line::process): Likewise.
9313 * archive.cc (Archive::get_file_and_offset): Likewise.
9314 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9315 * script.cc (read_script_file, script_add_file): Likewise.
9316 * fileread.cc (Input_file::Input_file): Likewise.
9317 (Input_file::will_search_for): Handle is_searched_file.
9318 (Input_file::open): Likewise.
9319 * readsyms.cc (Read_symbols::get_name): Likewise.
9320 * testsuite/Makefile.am (searched_file_test): New test.
9321 * testsuite/Makefile.in: Regenerate.
9322 * testsuite/searched_file_test.cc: New file.
9323 * testsuite/searched_file_test_lib.cc: New file.
9324
9325 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9326 Ian Lance Taylor <iant@google.com>
9327
9328 * descriptor.cc: Include <cstdio> and "binary-io.h".
9329 (Descriptors::open): Open the files in binary mode always.
9330 * script.cc (Lex::get_token): Treat \r as whitespace.
9331
9332 2009-10-09 Ian Lance Taylor <iant@google.com>
9333
9334 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9335
9336 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9337 Ian Lance Taylor <iant@google.com>
9338
9339 * configure.ac: Check for readv function also.
9340 * fileread.cc (readv): Define if not HAVE_READV.
9341 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9342 does not exist.
9343 * config.in: Regenerate.
9344 * configure: Regenerate.
9345
9346 2009-10-09 Doug Kwan <dougkwan@google.com>
9347
9348 * layout.cc (Layout::make_output_section): Call target hook to make
9349 ordinary output section.
9350 (Layout::finalize): Adjust parameter list of call the
9351 Target::may_relax().
9352 * layout.h (class Layout::section_list): New method.
9353 * merge.h (Output_merge_base::entsize): Change visibility to public.
9354 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9355 New methods.
9356 (Output_merge_string::do_is_string): New method.
9357 * object.cc (Sized_relobj::do_setup): renamed from
9358 Sized_relobj::set_up.
9359 * object.h (Sized_relobj::adjust_shndx,
9360 Sized_relobj::initializ_input_to_output_maps,
9361 Sized_relobj::free_input_to_output_maps): Change visibilities to
9362 protected.
9363 (Sized_relobj::setup): Virtualize.
9364 (Sized_relobj::do_setup): New method declaration.
9365 (Sized_relobj::invalidate_section_offset,
9366 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9367 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9368 * options.cc (parse_int): New function.
9369 * options.h (parse_int): New declaration.
9370 (DEFINE_int): New macro.
9371 (stub_group_size): New option.
9372 * output.cc (Output_section::Output_section): Initialize memebers
9373 merge_section_map_, merge_section_by_properties_map_,
9374 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9375 (Output_section::add_input_section): Handled deferred code-fill
9376 generation and remove an old comment.
9377 (Output_section::add_relaxed_input_section): New method definition.
9378 (Output_section::add_merge_input_section): Use merge section by
9379 properties map to speed to search. Update merge section maps
9380 as appropriate.
9381 (Output_section::build_relaxation_map): New method definition.
9382 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9383 Same.
9384 (Output_section::relax_input_section): Renamed to
9385 Output_section::convert_input_sections_to_relaxed_sections and change
9386 interface to take a vector of pointers to relaxed sections.
9387 (Output_section::find_merge_section,
9388 Output_section::find_relaxed_input_section): New method definitions.
9389 (Output_section::is_input_address_mapped,
9390 Output_section::output_offset, Output_section::output_address):
9391 Use output section data maps to speed up searching.
9392 (Output_section::find_starting_output_address): Add comments.
9393 (Output_section::do_write,
9394 Output_section::write_to_postprocessing_buffer): Do code-fill
9395 generation as appropriate.
9396 (Output_section::get_input_sections): Invalidate relaxed input section
9397 map.
9398 (Output_section::restore_states): Adjust type of checkpoint .
9399 Invalidate relaxed input section map.
9400 * output.h (Output_merge_base): New class declaration.
9401 (Input_section_specifier): New class defintion.
9402 (class Output_relaxed_input_section) Change base class to
9403 Output_section_data_build.
9404 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9405 base class initializer.
9406 (Output_section::add_relaxed_input_section): New method declaration.
9407 (Output_section::Input_section): Change visibility to protected.
9408 (Output_section::Input_section::relobj,
9409 Output_section::Input_section::shndx): Handle relaxed input sections.
9410 Output_section::input_sections) Change visibility to protected. Also
9411 define overload to return a non-const pointer.
9412 (Output_section::Merge_section_properties): New class defintion.
9413 (Output_section::Merge_section_by_properties_map,
9414 Output_section::Output_section_data_by_input_section_map,
9415 Output_section::Relaxation_map): New types.
9416 (Output_section::relax_input_section): Rename method to
9417 Output_section::convert_input_sections_to_relaxed_sections and change
9418 interface to take a vector of relaxed section pointers.
9419 (Output_section::find_merge_section,
9420 Output_section::find_relaxed_input_section,
9421 Output_section::build_relaxation_map,
9422 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9423 New method declarations.
9424 (Output_section::merge_section_map_
9425 Output_section::merge_section_by_properties_map_,
9426 Output_section::relaxed_input_section_map_,
9427 Output_section::is_relaxed_input_section_map_valid_,
9428 Output_section::generate_code_fills_at_write_): New data members.
9429 * script-sections.cc
9430 (Output_section_element_input::set_section_addresses): Call
9431 current_data_size and addralign methods of relaxed input sections.
9432 (Orphan_output_section::set_section_addresses): Call current_data_size
9433 and addralign methods of relaxed input sections.
9434 * symtab.cc (Symbol_table::compute_final_value): Extract template
9435 from the body of Symbol_table::sized_finalize_symbol.
9436 (Symbol_table::sized_finalized_symbol): Call
9437 Symbol_table::compute_final_value.
9438 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9439 (Symbol_table::compute_final_value): New templated method declaration.
9440 * target.cc (Target::do_make_output_section): New method defintion.
9441 * target.h (Target::make_output_section): New method declaration.
9442 (Target::relax): Add more parameters for input objects, symbol table
9443 and layout. Adjust call to do_relax.
9444 (Target::do_make_output_section): New method declaration.
9445 (Target::do_relax): Add parameters for input objects, symbol table
9446 and layout.
9447
9448 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9449
9450 * pread.c: Include stdio.h.
9451
9452 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9453
9454 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9455 defined.
9456
9457 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9458
9459 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9460 Change read_shndx type to unsigned int.
9461 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9462 int.
9463 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9464 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9465 Change read_shndx type to unsigned int.
9466 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9467 int.
9468 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9469 * layout.cc (Layout::create_symtab_sections): Cast the result of
9470 local_symcount * symsize to off_t in the gold_assert.
9471
9472 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9473
9474 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9475 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9476 R_ARM_BASE_ABS.
9477 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9478 (Arm_relocate_functions::thm_abs5): New function.
9479 (Arm_relocate_functions::abs12): New function.
9480 (Arm_relocate_functions::abs16): New function.
9481 (Arm_relocate_functions::base_abs): New function.
9482 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9483 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9484 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9485 R_ARM_BASE_ABS.
9486 (Scan::global): Likewise.
9487 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9488 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9489 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9490 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9491 R_ARM_BASE_ABS.
9492
9493 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9494
9495 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9496 (Arm_relocate_functions::movt_prel): New function.
9497 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9498 (Arm_relocate_functions::thm_movt_prel): New function.
9499 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9500 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9501 (Scan::global, Relocate::relocate): Likewise.
9502 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9503
9504 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9505
9506 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9507 Incremental_checker.
9508 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9509 unsigned int.
9510 (class Incremental_inputs_header): New class.
9511 (Incremental_inputs_header_writer): Edit comment.
9512 (Incremental_inputs_entry): New class.
9513 (Incremental_inputs_entry_writer): Edit comment.
9514 (Sized_incremental_binary::do_find_incremental_inputs_section):
9515 Add *strtab_shndx parameter, fill it.
9516 (Sized_incremental_binary::do_check_inputs): New method.
9517 (Incremental_checker::can_incrementally_link_output_file): Use
9518 Sized_incremental_binary::check_inputs.
9519 (Incremental_inputs::report_command_line): Save command line in
9520 command_line_.
9521 * incremental.h:
9522 (Incremental_binary::find_incremental_inputs_section): New
9523 method.
9524 (Incremental_binary::do_find_incremental_inputs_section): Add
9525 strtab_shndx parameter.
9526 (Incremental_binary::do_check_inputs): New pure virtual method.
9527 (Sized_incremental_binary::do_check_inputs): Declare.
9528 (Incremental_checker::Incremental_checker): Add incremental_inputs
9529 parameter, use it to initialize incremental_inputs_.
9530 (Incremental_checker::incremental_inputs_): New field.
9531 (Incremental_checker::command_line): New method.
9532 (Incremental_checker::inputs): New method.
9533 (Incremental_checker::command_line_): New field.
9534
9535 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9536
9537 * incremental.cc: Include <cstdarg> and "target-select.h".
9538 (vexplain_no_incremental): New function.
9539 (explain_no_incremental): New function.
9540 (Incremental_binary::error): New method.
9541 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9542 method.
9543 (make_sized_incremental_binary): New function.
9544 (open_incremental_binary): New function.
9545 (can_incrementally_link_file): Add checks if output is ELF and has
9546 inputs section.
9547 * incremental.h: Include "elfcpp_file.h" and "output.h".
9548 (Incremental_binary): New class.
9549 (Sized_incremental_binary): New class.
9550 (open_incremental_binary): Declare.
9551 * object.cc (is_elf_object): Use
9552 elfcpp::Elf_recognizer::is_elf_file.
9553 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9554 * output.h (Output_file::filesize): New method.
9555
9556 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9557
9558 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9559 New function.
9560 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9561 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9562 function.
9563 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9564 function.
9565 (Arm_relocate_functions::movw_abs_nc): New function.
9566 (Arm_relocate_functions::movt_abs): New function.
9567 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9568 (Arm_relocate_functions::thm_movt_abs): New function.
9569 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9570 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9571 (Scan::global): Likewise.
9572 (Relocate::relocate): Likewise.
9573 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9574
9575 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9576
9577 * arm.cc (Arm_relocate_functions::got_prel) New function.
9578 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9579 (Relocate::relocate): Likewise.
9580 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9581
9582 2009-10-06 Ian Lance Taylor <iant@google.com>
9583
9584 * options.h (class General_options): Define
9585 split_stack_adjust_size parameter.
9586 * object.h (class Object): Add uses_split_stack_ and
9587 has_no_split_stack_ fields. Add uses_split_stack and
9588 has_no_split_stack accessor functions. Declare
9589 handle_split_stack_section.
9590 (class Reloc_symbol_changes): Define.
9591 (class Sized_relobj): Define Function_offsets. Declare
9592 split_stack_adjust, split_stack_adjust_reltype, and
9593 find_functions.
9594 * object.cc (Object::handle_split_stack_section): New function.
9595 (Sized_relobj::do_layout): Call handle_split_stack_section.
9596 * dynobj.cc (Sized_dynobj::do_layout): Call
9597 handle_split_stack_section.
9598 * reloc.cc (Sized_relobj::relocate_sections): Call
9599 split_stack_adjust for executable sections in split_stack
9600 objects. Pass reloc_map to relocate_section.
9601 (Sized_relobj::split_stack_adjust): New function.
9602 (Sized_relobj::split_stack_adjust_reltype): New function.
9603 (Sized_relobj::find_functions): New function.
9604 * target-reloc.h: Include "object.h".
9605 (relocate_section): Add reloc_symbol_changes parameter. Change
9606 all callers.
9607 * target.h (class Target): Add calls_non_split method. Declare
9608 do_calls_non_split virtual method. Declare match_view and
9609 set_view_to_nop.
9610 * target.cc: Include "elfcpp.h".
9611 (Target::do_calls_non_split): New function.
9612 (Target::match_view): New function.
9613 (Target::set_view_to_nop): New function.
9614 * gold.cc (queue_middle_tasks): Give an error if mixing
9615 split-stack and non-split-stack objects with -r.
9616 * i386.cc (Target_i386::relocate_section): Add
9617 reloc_symbol_changes parameter.
9618 (Target_i386::do_calls_non_split): New function.
9619 * x86_64.cc (Target_x86_64::relocate_section): Add
9620 reloc_symbol_changes parameter.
9621 (Target_x86_64::do_calls_non_split): New function.
9622 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9623 parameter.
9624 * powerpc.cc (Target_powerpc::relocate_section): Add
9625 reloc_symbol_changes parameter.
9626 * sparc.cc (Target_sparc::relocate_section): Add
9627 reloc_symbol_changes parameter.
9628 * configure.ac: Call AM_CONDITIONAL for the default target.
9629 * configure: Rebuild.
9630 * testsuite/Makefile.am (TEST_AS): New variable.
9631 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9632 (check_DATA): Add split_i386 and split_x86_64 files.
9633 (SPLIT_DEFSYMS): Define.
9634 (split_i386_[1234n].o): New targets.
9635 (split_i386_[124]): New targets.
9636 (split_i386_[1234r].stdout): New targets.
9637 (split_x86_64_[1234n].o): New targets.
9638 (split_x86_64_[124]): New targets.
9639 (split_x86_64_[1234r].stdout): New targets.
9640 (MOSTLYCLEANFILES): Add new executables.
9641 * testsuite/split_i386.sh: New file.
9642 * testsuite/split_x86_64.sh: New file.
9643 * testsuite/split_i386_1.s: New file.
9644 * testsuite/split_i386_2.s: New file.
9645 * testsuite/split_i386_3.s: New file.
9646 * testsuite/split_i386_4.s: New file.
9647 * testsuite/split_i386_n.s: New file.
9648 * testsuite/split_x86_64_1.s: New file.
9649 * testsuite/split_x86_64_2.s: New file.
9650 * testsuite/split_x86_64_3.s: New file.
9651 * testsuite/split_x86_64_4.s: New file.
9652 * testsuite/split_x86_64_n.s: New file.
9653 * testsuite/testfile.cc (Target_test): Update relocation_section
9654 function.
9655 * testsuite/Makefile.in: Rebuild.
9656
9657 2009-10-06 Ian Lance Taylor <iant@google.com>
9658
9659 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9660 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9661 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9662 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9663 the address on ldo_addrs_.
9664 (Target_i386::Relocate::fix_up_ldo): New function.
9665
9666 2009-10-06 Rafael Espindola <espindola@google.com>
9667
9668 * plugin.cc (add_input_library): New.
9669 (Plugin::load): Add add_input_library to tv.
9670 (Plugin_manager::add_input_file): Add the is_lib argument.
9671 (add_input_file): Update call to Plugin_manager::add_input_file.
9672 (add_input_library): New.
9673 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9674
9675 2009-09-30 Doug Kwan <dougkwan@google.com>
9676
9677 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9678 symbol and call Symbol::may_need_copy_reloc to determine if
9679 a copy reloc is needed.
9680 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9681 nocopyreloc is given in command line.
9682 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9683 given in command line.
9684 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9685 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9686 of the removed Target_i386::may_need_copy_reloc.
9687 * options.h (copyreloc): New option with default value false.
9688 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9689 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9690 instead of the removed Target_powerpc::may_need_copy_reloc.
9691 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9692 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9693 instead of the removed Target_sparc::may_need_copy_reloc.
9694 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9695 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9696 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9697 instead of the removed Target_x86_64::may_need_copy_reloc.
9698
9699 2009-09-30 Ian Lance Taylor <iant@google.com>
9700
9701 * object.h (class Object): Remove target_ field, and target,
9702 sized_target, and set_target methods.
9703 (Object::sized_target): Remove.
9704 (class Sized_relobj): Update declarations. Remove sized_target.
9705 * object.cc (Sized_relobj::setup): Remove target parameter.
9706 Change all callers.
9707 (Input_objects::add_object): Don't do anything with the target.
9708 (make_elf_sized_object): Add punconfigured parameter. Change all
9709 callers. Set or test parameter target.
9710 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9711 Change all callers.
9712 * parameters.cc (Parameters::set_target): Change parameter type to
9713 be non-const.
9714 (Parameters::default_target): Remove.
9715 (set_parameters_target): Change parameter type to be non-const.
9716 (parameters_force_valid_target): New function.
9717 (parameters_clear_target): New function.
9718 * parameters.h (class Parameters): Update declarations. Remove
9719 default_target method. Add sized_target and clear_target
9720 methods. Change target_ to be non-const.
9721 (set_parameters_target): Update declaration.
9722 (parameters_force_valid_target): Declare.
9723 (parameters_clear_target): Declare.
9724 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9725 as NULL if we aren't searching.
9726 (Add_symbols::run): Don't check for compatible target.
9727 * fileread.cc (Input_file::open_binary): Call
9728 parameters_force_valid_target.
9729 * gold.cc (queue_middle_tasks): Likewise.
9730 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9731 set_target on object.
9732 * dynobj.h (class Sized_dynobj): Update declarations.
9733 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9734 make_elf_object returns NULL.
9735 (Archive::include_member): Don't check whether object target is
9736 compatible.
9737 * output.cc (Output_section::add_input_section): Get target from
9738 parameters.
9739 (Output_section::relax_input_section): Likewise.
9740 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9741 parameters.
9742 (Sized_relobj::do_scan_relocs): Likewise.
9743 (Sized_relobj::relocate_sections): Likewise.
9744 * resolve.cc (Symbol_table::resolve): Likewise.
9745 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9746 parameter. Change all callers.
9747 (Symbol_table::add_from_object): Get target from parameters.
9748 (Symbol_table::add_from_relobj): Don't check object target.
9749 (Symbol_table::add_from_dynobj): Likewise.
9750 (Symbol_table::define_special_symbol): Get target from
9751 parameters.
9752 * symtab.h (class Symbol_table): Update declaration.
9753 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9754 parameter. Change all callers. Clear parameter target.
9755 (Binary_test): Test target here.
9756 * testsuite/object_unittest.cc (gold_testsuite): Remove
9757 target_test_pointer parameter. Change all callers.
9758 (Object_test): Test target here.
9759
9760 2009-09-26 Ian Lance Taylor <iant@google.com>
9761
9762 * testsuite/initpri1.c: Don't try to use constructor priorities if
9763 compiling with gcc before 4.3.
9764
9765 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9766
9767 * testsuite/retain_symbols_file_test.sh (check_present): Change
9768 output file name to retain_symbols_file_test.stdout.
9769 (check_absent): Likewise.
9770
9771 2009-09-18 Craig Silverstein <csilvers@google.com>
9772
9773 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9774 * options.cc: Include <cerrno> and <fstream>.
9775 (General_options::finalize): Parse -retain-symbols-file tag.
9776 * options.h: New flag.
9777 (General_options): New method should_retain_symbol, new
9778 variable symbols_to_retain.
9779 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9780 should_retain_symbol map.
9781 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9782 * testsuite/Makefile.in: Regenerate.
9783 * testsuite/retain_symbols_file_test.sh: New file.
9784
9785 2009-09-18 Nick Clifton <nickc@redhat.com>
9786
9787 * po/es.po: Updated Spanish translation.
9788
9789 2009-09-17 Doug Kwan <dougkwan@google.com>
9790
9791 * debug.h (DEBUG_RELAXATION): New constant.
9792 (DEBUG_ALL): Add DEBUG_RELAXATION.
9793 (debug_string_to_enum): Add relaxation debug option.
9794 * layout.cc
9795 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9796 Layout::Relaxation_debug_check::read_sections,
9797 Layout::Relaxation_debug_check::read_sections): New method definitions.
9798 (Layout::Layout): Initialize data members
9799 record_output_section_data_from_scrips_,
9800 script_output_section_data_list_ and relaxation_debug_check_.
9801 (Layout::save_segments, Layout::restore_segments,
9802 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9803 Layout::relaxation_loop_body): New method definitions.
9804 (Layout::finalize): Support relaxation. Move section layout code to
9805 Layout::relaxation_loop_body.
9806 (Layout::set_asection_address_from_script): Move code for orphan
9807 section placement out.
9808 (Layout::place_orphan_sections_in_script): New method definition.
9809 * layout.h (Output_segment_headers, Output_file_header):
9810 New forward class declarations.
9811 (Layout::~Layout): Define.
9812 (Layout::new_output_section_data_from_script): New method definition.
9813 (Layout::place_orphan_sections_in_script): New method declaration.
9814 (Layout::Segment_states): New type declaration.
9815 (Layout::save_segments, Layout::restore_segments,
9816 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9817 Layout::relaxation_loop_body): New method declarations.
9818 (Layout::Output_section_data_list): New type declaration.
9819 (Layout::Relaxation_debug_check): New class definition.
9820 (Layout::record_output_section_data_from_script_,
9821 Layout::script_output_section_data_list_, Layout::segment_states_,
9822 Layout::relaxation_debug_check_): New data members.
9823 * output.cc: (Output_section_headers::do_size): New method definition.
9824 (Output_section_headers::Output_section_headers): Move size
9825 computation to Output_section_headers::do_size.
9826 (Output_segment_headers::do_size): New method definition.
9827 (Output_file_header::Output_file_header): Move size computation to
9828 Output_file_header::do_size and call it.
9829 (Output_file_header::do_size): New method definition.
9830 (Output_data_group::Output_data_group): Adjust call to
9831 Output_section_data.
9832 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9833 (Output_symtab_xindex::do_write): Add array bound check.
9834 (Output_section::Input_section::print_to_mapfile): Handle
9835 RELAXED_INPUT_SECTION_CODE.
9836 (Output_section::Output_section): Initialize data member checkpoint_.
9837 (Output_section::~Output_section): Delete checkpoint object pointed
9838 by checkpoint_.
9839 (Output_section::add_input_section): Always add an Input_section if
9840 relaxing.
9841 (Output_section::add_merge_input_section): Add assert.
9842 (Output_section::relax_input_section): New method definition.
9843 (Output_section::set_final_data_size): Set load address to zero for
9844 an unallocated section.
9845 (Output_section::do_address_and_file_offset_have_reset_values):
9846 New method definition.
9847 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9848 Handle relaxed input section.
9849 (Output_section::sort_attached_input_sections): Checkpoint input
9850 section list lazily.
9851 (Output_section::get_input_sections): Change type of input_sections to
9852 list of Simple_input_section pointers. Checkpoint input section list
9853 lazily. Also handle relaxed input sections.
9854 (Output_section::add_input_section_for_script): Take a reference to
9855 a Simple_input_section object instead of Relobj pointer and section
9856 index as parameter. Handle relaxed input sections.
9857 (Output_section::save_states, Output_section::restore_states): New
9858 method definitions.
9859 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9860 (Output_data::is_data_size_fixed): New method definition.
9861 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9862 if it is fixed.
9863 (Output_data::address_and_file_offset_have_reset_values): New method
9864 definition.
9865 (Output_data::do_address_and_file_offset_have_reset_values): New method
9866 definition.
9867 (Output_data::set_data_size): Check that data size is not fixed.
9868 (Output_data::fix_data_size): New method definition.
9869 (Output_data::is_data_size_fixed_): New data member.
9870 (Output_section_headers::set_final_data_size): New method definition.
9871 (Output_section_headers::do_size): New method declaration.
9872 (Output_segment_headers::set_final_data_size): New method definition.
9873 (Output_segment_headers::do_size): New method declaration.
9874 (Output_file_header::set_final_data_size)::New method definition.
9875 (Output_file_header::do_size)::New method declaration.
9876 (Output_section_data::Output_section_data): Add new parameter
9877 is_data_size_fixed and use it to fix data size.
9878 (Output_data_const::Output_data_const): Adjust call to base class
9879 constructor and fix data size.
9880 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9881 base class constructor and fix data size.
9882 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9883 base class constructor and fix data size.
9884 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9885 class constructor and fix data size.
9886 (Output_data_group::set_final_data_size): New method definition.
9887 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9888 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9889 class constructor and fix data size.
9890 (Output_relaxed_input_section): New class definition.
9891 (Output_section::Simple_input_section): New class definition.
9892 (Output_section::get_input_sections): Adjust parameter list.
9893 (Output_section::add_input_section_for_script): Same.
9894 (Output_section::save_states, Output_section::restore_states,
9895 Output_section::do_address_and_file_offset_have_reset_values,
9896 (Output_section::Input_section::Input_section): Handle
9897 RELAXED_INPUT_SECTION_CODE. Add new overload for
9898 Output_relaxed_input_section.
9899 (Output_section::Input_section::is_input_section,
9900 Output_section::Input_section::set_output_section): Handle relaxed
9901 input section.
9902 (Output_section::Input_section::is_relaxed_input_section,
9903 Output_section::Input_section::output_section_data,
9904 Output_section::Input_section::relaxed_input_section): New method
9905 definitions.
9906 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9907 value.
9908 (Output_section::Input_section::u1_): Update comments.
9909 (Output_section::Input_section::u2_): Add new union member poris.
9910 (Output_section::Checkpoint_output_section): New classs definition.
9911 (Output_section::relax_input_section): New method declaration.
9912 (Output_section::checkpoint_): New data member.
9913 (Output_segment): Update comments.
9914 (Output_segment::Output_segment): Un-privatize copy constructor.
9915 (Output_segment::operator=): Un-privatize.
9916 * script-sections.cc (Output_section_element::Input_section_list):
9917 Change element type to Output_section::Simple_input_section.
9918 (Output_section_element_dot_assignment::set_section_addresses):
9919 Register output section data for relaxation clean up.
9920 (Output_data_exression::Output_data_expression): Adjust call to base
9921 constructor to fix data size.
9922 (Output_section_element_data::set_section_addresses): Register
9923 Output_data_expression object for relaxation clean up.
9924 (struct Input_section_info): Replace Relobj pointer and section index
9925 pair with Output_section::Simple_input_section and Convert struct to a
9926 class.
9927 (Input_section_sorter::operator()): Adjust access to
9928 Input_section_info data member to use accessors.
9929 (Output_section_element_input::set_section_addresses): Use layout
9930 parameter. Adjust code to use Output_section::Simple_input_section
9931 and Input_secction_info classes. Register filler for relaxation
9932 clean up.
9933 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9934 and section index pair with Output_section::Simple_input_section
9935 class. Adjust code accordingly.
9936 (Phdrs_element::release_segment): New method definition.
9937 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9938 segment list.
9939 (Script_sections::release_segments): New method definition.
9940 * gold/script-sections.h (Script_sections::release_segments): New
9941 method declaration.
9942 * gold/target.h (Target::may_relax, Target::relax,
9943 Target::do_may_relax, Target::do_relax): New method definitions.
9944
9945 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9946
9947 * arm.cc (has_signed_unsigned_overflow): New function.
9948 (Arm_relocate_functions::abs8): New function.
9949 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9950 (Target_arm::Scan::global): Likewise.
9951 (Target_arm::relocate::relocate): Likewise.
9952 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9953 Likewise.
9954
9955 2009-09-16 Cary Coutant <ccoutant@google.com>
9956
9957 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9958 * testsuite/Makefile.in: Regenerate.
9959
9960 2009-09-11 Nick Clifton <nickc@redhat.com>
9961
9962 * po/gold.pot: Updated by the Translation project.
9963
9964 2009-09-08 Cary Coutant <ccoutant@google.com>
9965
9966 * output.cc (Output_file::open): Add execute permission to empty file.
9967 * testsuite/Makefile.am (permission_test): New test.
9968 * testsuite/Makefile.in: Regenerate.
9969
9970 2009-09-02 Ian Lance Taylor <iant@google.com>
9971
9972 * output.cc (Output_file::resize): Call map_no_anonymous rather
9973 than map.
9974
9975 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9976
9977 * gold.cc: Include "incremental.h".
9978 (queue_initial_tasks): Call Incremental_checker methods.
9979 * incremental.cc: Include "output.h".
9980 (Incremental_checker::can_incrementally_link_output_file): New
9981 method.
9982 * incremental.h (Incremental_checker): New class.
9983
9984 * output.cc (Output_file::open_for_modification): New method.
9985 (Output_file::map_anonymous): Changed return type to bool. Record
9986 map in base_ field.
9987 (Output_file::map_no_anonymous): New method, broken out of map.
9988 (Output_file::map): Use map_no_anonymous and map_anonymous.
9989 * output.h (class Output_file): Update declarations.
9990
9991 2009-08-24 Cary Coutant <ccoutant@google.com>
9992
9993 * options.h (Command_line::Pre_options): New class.
9994 (Command_line::pre_options): New member.
9995 * options.cc (gold::options::ready_to_register): New variable.
9996 (One_option::register_option): Do nothing if not registering options.
9997 Assert if same short option registered twice.
9998 (General_options::General_options): Turn off option registration when
9999 done constructing.
10000 (Command_line::Pre_options::Pre_options): New constructor.
10001
10002 2009-08-24 Cary Coutant <ccoutant@google.com>
10003
10004 * options.h (General_options::no_keep_memory): Remove incorrect
10005 short option.
10006
10007 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10008
10009 * Makefile.am (am__skiplex, am__skipyacc): New.
10010 * Makefile.in: Regenerate.
10011
10012 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10013
10014 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10015 (INCLUDES): ... this.
10016 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10017 (AM_CPPFLAGS): Renamed from ...
10018 (INCLUDE): ... this.
10019 * Makefile.in, testsuite/Makefile.in: Regenerate.
10020
10021 * Makefile.in: Regenerate.
10022 * aclocal.m4: Likewise.
10023 * config.in: Likewise.
10024 * configure: Likewise.
10025 * testsuite/Makefile.in: Likewise.
10026
10027 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10028 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10029 * Makefile.in: Regenerate.
10030 * testsuite/Makefile.in: Regenerate.
10031
10032 2009-08-19 Cary Coutant <ccoutant@google.com>
10033
10034 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10035 symbols in shared libraries overridden by hidden or internal symbols
10036 in the main program.
10037
10038 2009-08-19 Chris Demetriou <cgd@google.com>
10039
10040 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10041 checking source file names in error messages.
10042
10043 2009-08-18 Doug Kwan <dougkwan@google.com>
10044
10045 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10046 an elcpp::Ehdr as parameter. Adjust call to set_target.
10047 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10048 an elfcpp::Ehdr as parameter.
10049 * object.cc (Object::set_target): Remove the version that looks up
10050 a target and sets it.
10051 (Sized_relobj::setup): Take a Target object instead of
10052 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10053 (make_elf_sized_object): Find target and ask target to
10054 make an ELF object.
10055 * object.h: (Object::set_target): Remove the version that looks up
10056 a target and sets it.
10057 (Sized_relobj::setup): Take a Target object instead of
10058 an elfcpp:Ehdr as parameter.
10059 * target.cc: Include dynobj.h.
10060 (Target::do_make_elf_object_implementation): New.
10061 (Target::do_make_elf_object): New.
10062 * target.h (Target::make_elf_object): New template declaration.
10063 (Target::do_make_elf_object): New method declarations.
10064 (Target::do_make_elf_object_implementation): New template declaration.
10065
10066 2009-08-14 Ian Lance Taylor <iant@google.com>
10067
10068 * gold.h (FUNCTION_NAME): Define.
10069 (gold_unreachable): Use FUNCTION_NAME.
10070
10071 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10072
10073 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10074 symbol in the --keep-unique list is not found.
10075
10076 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10077
10078 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10079 been maked as --keep-unique.
10080 (Icf::unfold_section): New function.
10081 * icf.h (Icf::unfold_section): New function.
10082 * options.h (General_options::keep_unique): New option.
10083 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10084 * testsuite/Makefile.in: Regenerate.
10085 * testsuite/icf_keep_unique_test.sh: New file.
10086 * testsuite/icf_keep_unique_test.cc: New file.
10087
10088 2009-08-12 Cary Coutant <ccoutant@google.com>
10089
10090 PR 10471
10091 * resolve.cc (Symbol_table::resolve): Check for references from
10092 dynamic objects to hidden and internal symbols.
10093 * testsuite/Makefile.am (hidden_test.sh): New test.
10094 * testsuite/Makefile.in: Regenerate.
10095 * testsuite/hidden_test.sh: New script.
10096 * testsuite/hidden_test_1.c: New test source.
10097 * testsuite/hidden_test_main.c: New test source.
10098
10099 2009-08-11 Doug Kwan <dougkwan@google.com>
10100
10101 * arm.cc: Update comments.
10102 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10103 segment to locate the .ARM.exidx section if present.
10104
10105 2009-08-09 Doug Kwan <dougkwan@google.com>
10106
10107 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10108 patch.
10109
10110 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10111 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10112 compiler warnings.
10113
10114 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10115
10116 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10117 valid tls_segment only for non-debug-section relocations.
10118 * testsuite/Makefile.am: Add gc_tls_test.
10119 * testsuite/Makefile.in: Regenerate.
10120 * testsuite/gc_tls_test.cc: New file.
10121 * testsuite/gc_tls_test.sh: New file.
10122
10123 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10124
10125 * icf.cc: New file.
10126 * icf.h: New file.
10127 * Makefile.am (CCFILES): Add icf.cc.
10128 (HFILES): Add icf.h
10129 * Makefile.in: Regenerate.
10130 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10131 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10132 section, symbol and addend information for the relocs.
10133 * gold.cc (queue_middle_tasks): Call identical code folding.
10134 * gold.h: Add defines for multimap.
10135 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10136 to the call of finalize_local_symbols.
10137 * main.cc (main): Create object of class Icf.
10138 * object.cc (Sized_relobj::do_layout): Allow this function to be
10139 called twice during icf.
10140 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10141 to sections marked as identical by icf.
10142 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10143 when available.
10144 (Sized_relobj::do_section_entsize): New function.
10145 * object.h (Object::section_entsize): New function.
10146 (Object::do_section_entsize): New pure virtual function.
10147 (Relobj::finalize_local_symbols): Add new parameter.
10148 (Relobj::do_section_entsize): New function.
10149 * options.h (General_options::icf): New option.
10150 (General_options::icf_iterations): New option.
10151 (General_options::print_icf_sections): New option.
10152 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10153 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10154 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10155 icf.
10156 * symtab.cc (Symbol_table::is_section_folded): New function.
10157 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10158 to sections marked as identical by icf.
10159 * symtab.h (Symbol_table::set_icf): New function.
10160 (Symbol_table::icf): New function.
10161 (Symbol_table::is_section_folded): New function.
10162 (Symbol_table::icf_): New data member.
10163 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10164 * testsuite/Makefile.am: Add commands to build icf_test.
10165 * testsuite/Makefile.in: Regenerate.
10166 * testsuite/icf_test.sh: New file.
10167 * testsuite/icf_test.cc: New file.
10168
10169 2009-07-24 Chris Demetriou <cgd@google.com>
10170
10171 * layout.cc (is_compressible_debug_section): Fix incorrect
10172 comment about compressed section names.
10173
10174 2009-07-20 Ian Lance Taylor <ian@airs.com>
10175
10176 PR 10419
10177 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10178
10179 2009-07-16 Ian Lance Taylor <iant@google.com>
10180
10181 PR 10400
10182 * layout.h: #include <map>.
10183 (class Kept_section): Change from struct to class. Add accessors
10184 and setters. Add section size to Comdat_group mapping. Change
10185 Comdat_group to std::map. Add is_comdat_ field. Add
10186 linkonce_size field in union.
10187 (class Layout): Update declaration of find_or_add_kept_section.
10188 Don't declare find_kept_object.
10189 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10190 parameter. Add object, shndx, is_comdat, and is_group_name
10191 parameters. Change all callers. Adjust for new Kept_section.
10192 (Layout::find_kept_object): Remove.
10193 * object.cc (Sized_relobj::include_section_group): Update use of
10194 Kept_section. Rename secnum to shndx. Only record
10195 Kept_comdat_section if sections are the same size.
10196 (Sized_relobj::include_linkonce_section): Update use of
10197 Kept_section. Only record Kept_comdat_section if sections are the
10198 same size. Set size of linkonce section.
10199 (Sized_relobj::map_to_kept_section): Update call to
10200 get_kept_comdat_section.
10201 * object.h (class Sized_relobj): Rename fields in
10202 Kept_comdat_section to drop trailing underscores; change object
10203 field to Relobj*. Change Kept_comdat_section_table to store
10204 struct rather than pointer.
10205 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10206 Add kept_object and kept_shndx parameters. Change all callers.
10207 (Sized_relobj::get_kept_comdat_section): Change return type to
10208 bool. Add kept_object and kept_shndx parameters. Change all
10209 callers.
10210 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10211 Layout::find_or_add_kept_section.
10212
10213 2009-07-09 Ian Lance Taylor <iant@google.com>
10214
10215 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10216 Reserve space in the hash table.
10217
10218 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10219
10220 * fileread.cc (File_read::get_mtime): New method.
10221 * fileread.h (Timespec): New structure.
10222 (File_read::get_mtime): New method.
10223 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10224 Renamed from timestamp_nsec.
10225 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10226 Elf_Xword.
10227 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10228 timestamp_nsec.
10229 (Incremental_inputs::report_archive): Save mtime; style fix.
10230 (Incremental_inputs::report_obejct): Save mtime; style fix.
10231 (Incremental_inputs::report_script): Save mtime; style fix.
10232 (Incremental_inputs::finalize_inputs): Style fix.
10233 (Incremental_inputs::finalize): Style fix.
10234 (Incremental_inputs::create_input_section_data): Store inputs
10235 mtime.
10236 * incremental.h (Incremental_inputs::report_script): Add mtime
10237 argument.
10238 (Incremental_inputs::Input_info::Input_info): Intialize only one
10239 union member.
10240 (Incremental_inputs::Input_info::archive): Move to nameless
10241 union.
10242 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10243 (Incremental_inputs::Input_info::script): Move to nameless union.
10244 (Incremental_inputs::mtime): New field.
10245 * script.cc (read_input_script): Pass file mtime to
10246 Incremental_input.
10247 * script.h (Script_info::inputs): Style fix.
10248
10249 2009-07-01 Ian Lance Taylor <ian@airs.com>
10250
10251 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10252 instead of 32.
10253
10254 2009-06-24 Ian Lance Taylor <iant@google.com>
10255
10256 PR 10156
10257 * layout.cc (Layout::choose_output_section): If we find an
10258 existing section, update the flags.
10259 (Layout::create_notes): New function, broken out of
10260 Layout::finalize.
10261 (Layout::finalize): Don't create note sections.
10262 (Layout::create_note): Don't crash if linker script discards
10263 section.
10264 (Layout::create_gold_note): Likewise.
10265 (Layout::create_build_id): Likewise. Don't set
10266 after_input_sections on the section.
10267 (Layout::create_executable_stack_info): Remove target parameter.
10268 Change caller.
10269 * layout.h (class Layout): Declare create_notes. Update
10270 declaration of create_executable_stack_info.
10271 * gold.cc (queue_middle_tasks): Call create_notes.
10272 * output.cc (Output_section::update_flags_for_input_section): Move
10273 here from output.h. If SHF_ALLOC flag is newly set, mark address
10274 invalid.
10275 * output.h (Output_data::mark_address_invalid): New function.
10276 (class Output_section): Only declare, not define,
10277 update_flags_for_input_section. Remove set_flags.
10278
10279 2009-06-24 Ian Lance Taylor <iant@google.com>
10280
10281 * script-sections.cc (Output_section_definition::
10282 set_section_addresses): Rename shadowing local load_address to
10283 laddr.
10284
10285 2009-06-24 Ian Lance Taylor <iant@google.com>
10286
10287 PR 10244
10288 * reloc.cc (relocate_sections): Skip empty relocation sections.
10289
10290 2009-06-23 Ian Lance Taylor <iant@google.com>
10291
10292 PR 10156
10293 * layout.cc (Layout::create_note): Use choose_output_section
10294 rather than make_output_section.
10295
10296 2009-06-23 Ian Lance Taylor <iant@google.com>
10297
10298 PR 10237
10299 * options.cc (General_options::parse_V): Set printed_version_.
10300 (General_options::General_options): Initialize printed_version_.
10301 * options.h (class General_options): Add printed_version_ field.
10302 * gold.cc (queue_initial_tasks): If there are no input files,
10303 don't give a fatal error if we printed the version information.
10304 (queue_middle_tasks): If using -r with a shared object, give a
10305 fatal error rather than an ordinary error.
10306
10307 2009-06-23 Ian Lance Taylor <iant@google.com>
10308
10309 PR 10219
10310 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10311 (Layout::make_output_section): Set have_stabstr_section_ if we see
10312 a .stab*str section.
10313 (Layout::finalize): Call link_stabs_sections.
10314 (Layout::link_stabs_sections): New file.
10315 * layout.h (class Layout): Add have_stabstr_section_ field.
10316 Declare link_stabs_sections.
10317
10318 2009-06-23 Doug Kwan <dougkwan@google.com>
10319
10320 * Makefile.am (libgold_a_LIBADD): New.
10321 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10322 * Makefile.in: Regenerate.
10323 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10324 * configure: Regenerate.
10325 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10326 * fileread.cc: Include sys/state.h
10327 * gold.h: Declare memmem and strndup if found missing.
10328 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10329
10330 2009-06-23 Ian Lance Taylor <iant@google.com>
10331
10332 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10333 * configure: Rebuild.
10334
10335 2009-06-23 Ian Lance Taylor <iant@google.com>
10336
10337 PR 10147
10338 * object.cc (Object::section_contents): Don't try to get a view if
10339 the section has length zero.
10340 (Object::handle_gnu_warning_section): If the section is empty, use
10341 the name of the section as the warning.
10342
10343 2009-06-23 Ian Lance Taylor <iant@google.com>
10344
10345 PR 10133
10346 * stringpool.h (class Stringpool_template): Add optimize_ field.
10347 (Stringpool_template::set_optimize): New function.
10348 * stringpool.cc (Stringpool_template::Stringpool_template):
10349 Initialize optimize_ field.
10350 (Stringpool_template::set_string_offsets): Test local optimize
10351 fild rather than parameter.
10352 * layout.cc (Layout::Layout): Call set_optimize on the section
10353 name stringpool.
10354
10355 2009-06-22 Ian Lance Taylor <iant@google.com>
10356
10357 PR 10030
10358 * yyscript.y: Parse TARGET.
10359 * script.cc (script_set_target): New function.
10360 * script-c.h (script_set_target): Declare.
10361 * options.cc (General_options::string_to_object_format): Rename
10362 from string_to_object_format in anonymous namespace. Change
10363 callers.
10364 * options.h (class General_options): Declare
10365 string_to_object_format.
10366
10367 2009-06-22 Ian Lance Taylor <iant@google.com>
10368
10369 * script-sections.cc (Script_sections::create_segments): Don't put
10370 program headers in a PT_LOAD segment if -n or -N.
10371
10372 2009-06-22 Ian Lance Taylor <iant@google.com>
10373
10374 PR 10141
10375 * options.h (class General_options): Add -z lazy and -z now. Sort
10376 -z options into alphabetical order.
10377 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10378
10379 2009-06-21 Ian Lance Taylor <iant@google.com>
10380
10381 * layout.cc (Layout::make_output_section): Call
10382 Target::new_output_section.
10383 (Layout::attach_allocated_section_to_segment): Put large section
10384 sections in a separate load segment with the large segment flag
10385 set.
10386 (Layout::segment_precedes): Sort large data segments after other
10387 load segments.
10388 (align_file_offset): New static function.
10389 (Layout::set_segment_offsets): Use align_file_offset.
10390 * output.h (class Output_section): Add is_small_section_ and
10391 is_large_section_ fields.
10392 (Output_section::is_small_section): New function.
10393 (Output_section::set_is_small_section): New function.
10394 (Output_section::is_large_section): New function.
10395 (Output_section::set_is_large_section): New function.
10396 (Output_section::is_large_data_section): New function.
10397 (class Output_segment): Add is_large_data_segment_ field.
10398 (Output_segment::is_large_data_segment): New function.
10399 (Output_segment::set_is_large_data_segment): New function.
10400 * output.cc (Output_section::Output_section): Initialize new
10401 fields.
10402 (Output_segment::Output_segment): Likewise.
10403 (Output_segment::add_output_section): Add assertion that large
10404 data sections always go in large data segments. Force small data
10405 sections to the end of the list of data sections. Force small BSS
10406 sections to the start of the list of BSS sections. For large BSS
10407 sections to the end of the list of BSS sections.
10408 * symtab.h (class Symbol): Declare is_common_shndx.
10409 (Symbol::is_defined): Check Symbol::is_common_shndx.
10410 (Symbol::is_common): Likewise.
10411 (class Symbol_table): Define enum Commons_section_type. Update
10412 declarations. Add small_commons_ and large_commons_ fields.
10413 * symtab.cc (Symbol::is_common_shndx): New function.
10414 (Symbol_table::Symbol_table): Initialize new fields.
10415 (Symbol_table::add_from_object): Put small and large common
10416 symbols in the right list.
10417 (Symbol_table::sized_finalized_symbol): Check
10418 Symbol::is_common_shndx.
10419 (Symbol_table::sized_write_globals): Likewise.
10420 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10421 common symbol lists. Don't call do_allocate_commons_list if the
10422 list is empty.
10423 (Symbol_table::do_allocate_commons_list): Remove is_tls
10424 parameter. Add comons_section_type parameter. Change all
10425 callers. Handle small and large common symbols.
10426 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10427 Symbol::is_common_shndx.
10428 * resolve.cc (symbol_to_bits): Likewise.
10429 * target.h (Target::small_common_shndx): New function.
10430 (Target::small_common_section_flags): New function.
10431 (Target::large_common_shndx): New function.
10432 (Target::large_common_section_flags): New function.
10433 (Target::new_output_section): New function.
10434 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10435 small_common_section_flags, and large_common_section_flags
10436 fields.
10437 (Target::do_new_output_section): New virtual function.
10438 * arm.cc (Target_arm::arm_info): Initialize new fields.
10439 * i386.cc (Target_i386::i386_info): Likewise.
10440 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10441 Likewise.
10442 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10443 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10444 (Target_x86_64::do_new_output_section): New function.
10445 * configure.ac: Define conditional MCMODEL_MEDIUM.
10446 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10447 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10448 (large_LDFLAGS): Define.
10449 * testsuite/large.c: New file.
10450 * testsuite/testfile.cc (Target_test::test_target_info):
10451 Initialize new fields.
10452 * configure, testsuite/Makefile.in: Rebuild.
10453
10454 2009-06-05 Doug Kwan <dougkwan@google.com>
10455
10456 * Makefile.am (CCFILES): Add target.cc.
10457 * Makefile.in: Regenerate.
10458 * i386.cc (class Target_i386): Define new virtual method to
10459 override do_is_local_label_name in parent.
10460 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10461 local symbols if --discard-locals or -X is given.
10462 * options.h (class General_options): Declare new options
10463 '--discard-locals' and '-X' for discarding locals.
10464 * target.h (class Target): Define new methods is_local_label_name.
10465 Declare new virtual method do_is_local_label_name.
10466 * target.cc: New file.
10467 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10468 (check_SCRIPTS): Add discard_locals_test.sh.
10469 (check_DATA): Add discard_local_tests.syms.
10470 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10471 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10472 * testsuite/Makefile.in: Regenerate.
10473 * testsuite/discard_locals_test.c: New file.
10474 * testsuite/discard_locals_test.sh: Same.
10475
10476 2009-06-05 Doug Kwan <dougkwan@google.com>
10477
10478 * object.cc (Sized_relobj::Sized_relobj): Initialize
10479 discarded_eh_frame_shndx_ to -1U.
10480 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10481 section.
10482 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10483 a discarded .eh_frame section.
10484 (Sized_relobj::do_finalize_local_symbols): Ditto.
10485 * object.h (class Sized_relobj): Declare new member
10486 discarded_eh_frame_shndx_.
10487 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10488 (local_labels_test.o, local_labels_test): New rules.
10489 * testsuite/Makefile.in: Regenerate.
10490
10491 2009-06-04 Doug Kwan <dougkwan@google.com>
10492
10493 * layout.cc (Layout::section_name_mapping): Add mapping for
10494 special ARM sections.
10495
10496 2009-06-03 Doug Kwan <dougkwan@google.com>
10497
10498 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10499 (utils::has_overflow): Same.
10500
10501 2009-06-03 Ian Lance Taylor <iant@google.com>
10502
10503 * layout.cc (Layout::section_name_mapping): New array, replacing
10504 Layout::linkonce_mapping.
10505 (Layout::section_name_mapping_count): New variable, replacing
10506 Layout::linkonce_mapping_count.
10507 (Layout::linkonce_output_name): Remove.
10508 (Layout::output_section_name): Rewrite.
10509 * layout.h (class Layout): Rename Linkonce_mapping to
10510 Section_name_mapping, linkonce_mapping to section_name_mapping,
10511 linkonce_mapping_count to section_name_mapping_count. Don't
10512 declare linkonce_output_name.
10513
10514 2009-06-03 Doug Kwan <dougkwan@google.com>
10515
10516 * gold/arm.cc (namespace utils): New.
10517 (Target_arm::reloc_is_non_pic): Define new method.
10518 (class Arm_relocate_functions): New.
10519 (Target_arm::Relocate::relocate): Handle relocation types used by
10520 Android.
10521
10522 2009-06-03 Ian Lance Taylor <iant@google.com>
10523
10524 * arm.cc (Target_arm::scan::global): Use || instead of |.
10525
10526 2009-06-02 Doug Kwan <dougkwan@google.com>
10527
10528 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10529 issued_non_pic_error_.
10530 (class Target_arm::Scan): Declare new method check_non_pic.
10531 Define new method symbol_needs_plt_entry.
10532 Declare new data member issued_non_pic_error_.
10533 (class Target_arm::Relocate): Declare new method
10534 should_apply_static_reloc.
10535 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10536 (Target_arm::Scan::check_non_pic): Define new method.
10537 (Target_arm::Scan::local): Handle a small subset of reloc types used
10538 by Android.
10539 (Target_arm::Scan::local): Same.
10540 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10541
10542 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10543
10544 * incremental.cc (Incremental_inputs::report_command_line): Filter
10545 out --incremental-* options.
10546
10547 2009-05-29 Doug Kwan <dougkwan@google.com>
10548
10549 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10550 template class.
10551 (class Target_arm): Update comment.
10552 (Target_arm::Target_arm): Initialize new data members GOT_,
10553 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10554 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10555 and Target_arm::rel_dyn_section.
10556 Declare new_enum Target_arm::Got_type.
10557 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10558 and DYNBSS_.
10559 Update commments for member do_dynsym_value.
10560 (Target_arm::got_size, Target_arm::plt_section,
10561 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10562 new methods inside class defintion.
10563 (Target_arm::got_section): Define new method.
10564 (Target_arm::rel_dyn_section): Same.
10565 (Output_data_plt_arm): New template class.
10566 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10567 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10568 (Output_data_plt_arm::add_entry): Same.
10569 (Output_data_plt_arm::first_plt_entry): Define new
10570 static data member for PLT instruction template.
10571 (Output_data_plt_arm::plt_entry): Same.
10572 (Output_data_plt_arm::do_write): Define new method.
10573 (Target_arm::make_plt_entry): Same.
10574 (Target_arm::do_finalize_sections): Same.
10575 (Target_arm::do_dynsym_value): Same.
10576
10577 2009-05-28 Doug Kwan <dougkwan@google.com>
10578
10579 * Makefile.am (TARGETSOURCES): Add arm.cc.
10580 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10581 * Makefile.in: Regenerate.
10582 * arm.cc: New file.
10583 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10584
10585 2009-05-26 Doug Kwan <dougkwan@google.com>
10586
10587 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10588 (General_options::check_excluded_libs): Strip off directories in
10589 archive name before matching like GNU ld does.
10590 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10591 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10592 (exclude_libs_test_LDFLAGS): Add linker option
10593 -Wl,--exclude-libs,libexclude_libs_test_3
10594 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10595 an explicit archive without using -l.
10596 (alt/libexclude_libs_test_3.a): New make rule.
10597 * testsuite/Makefile.in: Regenerate.
10598 * testsuite/exclude_libs_test.c : Declare lib3_default().
10599 (main): Call it.
10600 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10601 * exclude_libs_test_3.c: New file.
10602
10603 2009-05-26 Nick Clifton <nickc@redhat.com>
10604
10605 * po/id.po: New Indonesian translation.
10606 * po/gold.pot: Updated template file.
10607
10608 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10609
10610 * testsuite/Makefile.am: Add -ffunction-sections to compile
10611 gc_comdat_test files. Add -Wl,--gc-sections to build
10612 gc_comdat_test.
10613 * testsuite/Makefile.in: Regenerate.
10614 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10615
10616 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10617
10618 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10619 kept comdat section was garbage collected.
10620 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10621 * testsuite/Makefile.in: Regenerate.
10622 * testsuite/gc_comdat_test.sh: New file.
10623 * testsuite/gc_comdat_test_1.cc: New file.
10624 * testsuite/gc_comdat_test_2.cc: New file.
10625
10626 2009-05-19 Doug Kwan <dougkwan@google.com>
10627
10628 * archive.cc (Archive::Archive): Move constructor from archive.h
10629 to here. Initialize no_export_.
10630 (Archive::get_elf_object_for_member): Set no_export flag of object.
10631 * archive.h (Archive::Archive): Move constructor body to
10632 archive.cc.
10633 (Archive::no_export): New method.
10634 (Archive::no_export_): New field.
10635 * object.h (Object::Object): Initialize no_export_ to false.
10636 (Object::no_export, Object::set_no_export): New methods.
10637 (Object::no_export_): New field.
10638 * options.cc (General_options::parse_exclude_libs): New method.
10639 (General_options::check_excluded_libs) Same.
10640 * options.h (exclude_libs): New option.
10641 (General_options::check_excluded_libs): New method declaration.
10642 (General_options::excluded_libs_): New field.
10643 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10644 default or protected visibility if an object has no-export flag set.
10645 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10646 (check_SCRIPTS): Add exclude_libs_test.sh.
10647 (check_DATA): Add exclude_libs_test.syms.
10648 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10649 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10650 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10651 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10652 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10653 libexclude_libs_test_2.a): New rules.
10654 * testsuite/Makefile.in: Regenerate.
10655 * testsuite/exclude_libs_test.c: New file.
10656 * testsuite/exclude_libs_test.sh: Ditto.
10657 * testsuite/exclude_libs_test_1.c: Ditto.
10658 * testsuite/exclude_libs_test_2.c: Ditto.
10659
10660 2009-05-15 Ian Lance Taylor <iant@google.com>
10661
10662 * configure.ac: Check for declarations for cases where libiberty.h
10663 checks HAVE_DECL_xxx.
10664 * configure, config.in: Rebuild.
10665
10666 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10667
10668 * gold.h (Incremental_argument_list): Remove (invalid) forward
10669 declaration.
10670 * incremental.cc (Incremental_inputs::report_achive): New method.
10671 (Incremental_inputs::report_object): New method.
10672 (Incremental_inputs::report_script): New method.
10673 (Incremental_inputs::finalize_inputs): New method.
10674 (Incremental_inputs::finalize): Call finalize_inputs().
10675 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10676 Create inputs entries.
10677 * incremental.h (Incremental_input_type): New enum.
10678 (Incremental_inputs::Incremental_input): Initialize new fields.
10679 (Incremental_inputs::report_inputs): New method.
10680 (Incremental_inputs::report_achive): New method.
10681 (Incremental_inputs::report_object): New method.
10682 (Incremental_inputs::report_script): New method.
10683 (Incremental_inputs::finalize_inputs): New method.
10684 (Incremental_inputs::Input_info): New struct.
10685 (Incremental_inputs::Input_info_map): New typedef.
10686 (Incremental_inputs::lock_): New field.
10687 (Incremental_inputs::Inputs_): New field.
10688 (Incremental_inputs::Inputs_map): New field.
10689 * main.cc (main): Call Incremental_input::report_inputs.
10690 * options.h (Input_argument_list): Typedef moved from
10691 Input_arguments.
10692 (Input_file_group::Files): Remove, use ::Input_argument_list.
10693 (Input_file_group::Input_argument_list): Remove, use
10694 ::Input_argument_list.
10695 * plugin.cc (Plugin_manager::add_input_file): Add error in
10696 incremental build.
10697 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10698 functions.
10699 * script.cc (read_input_script): Call
10700 Incremental_input::report_script.
10701 * script.h (Script_info): New class.
10702
10703 2009-04-27 Ian Lance Taylor <iant@google.com>
10704
10705 * x86_64.cc (do_adjust_output_section): Set entsize to
10706 plt_entry_size.
10707
10708 2009-04-23 Elliott Hughes <enh@google.com>
10709
10710 * output.cc (Output_file::close): After short writes, continue
10711 writing from the correct offset in the buffer being written.
10712
10713 2009-04-23 Chris Demetriou <cgd@google.com>
10714
10715 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10716 * configure: Regenerate.
10717 * config.in: Regenerate.
10718 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10719 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10720
10721 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10722
10723 * incremental.cc (Incremental_inputs_header_data): Renamed from
10724 Incremental_input_header_data.
10725 (Incremental_inputs_header_data::data_size): New field.
10726 (Incremental_inputs_header_data::put_input_file_count): Renamed
10727 from input_file_count.
10728 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10729 from command_line_offset.
10730 (Incremental_inputs_header_data::put_reserved): Renamed from
10731 put_reserved.
10732 (Incremental_inputs_entry_data): Renamed from
10733 Incremental_input_entry_data.
10734 (Incremental_inputs_entry_data::data_size): New field.
10735 (Incremental_inputs::report_command_line): New method.
10736 (Incremental_inputs::finalize): New method.
10737 (Incremental_inputs::create_incremental_inputs_data): New method.
10738 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10739 * incremental.h: New file.
10740 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10741 (Layout::finalize): Create incremental inputs section in
10742 incremental builds.
10743 (Layout::create_incremental_info_sections): New method.
10744 * layout.h (Layout::incremental_inputs): New method.
10745 (Layout::create_incremental_info_sections): New method.
10746 (Layout::incremental_inputs_): New field.
10747 * main.cc (main): Notify Incremental_input of the command line.
10748
10749 2009-04-01 Ian Lance Taylor <iant@google.com>
10750 Mikolaj Zalewski <mikolajz@google.com>
10751
10752 * gold.h (reserve_unordered_map): Define, three versions, one for
10753 each version of Unordered_map.
10754 * layout.cc (Layout::Layout): Remove options parameter. Add
10755 number_of_input_files parameter. Don't initialize options_.
10756 Initialize number_of_input_files_ and resized_signatures_. Move
10757 sections_are_attached_.
10758 (Layout::layout_group): Reserve space for group_signatures_.
10759 (Layout::find_or_add_kept_section): Change name parameter to be a
10760 reference. Resize signatures_ map when it gets large enough.
10761 (Layout::layout_eh_frame): Use parameters->options() instead of
10762 this->options_.
10763 (Layout::make_output_section): Likewise.
10764 (Layout::attach_allocated_section_to_segment): Likewise.
10765 (Layout::finalize, Layout::create_executable_stack): Likewise.
10766 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10767 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10768 * layout.h (class Layout): Update declarations. Remove options_
10769 field. Add number_of_input_files_ and resized_signatures_
10770 fields. Move sections_are_attached_ field.
10771 * main.cc (main): Pass number of input files to Layout
10772 constructor. Don't pass options.
10773
10774 2009-03-30 Ian Lance Taylor <iant@google.com>
10775
10776 * ffsll.c (ffsll): Correct implementation.
10777
10778 2009-03-27 Ian Lance Taylor <iant@google.com>
10779
10780 * ffsll.c: New file.
10781 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10782 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10783 * ftruncate.c (ftruncate): Declare before definition.
10784 * mremap.c (mremap): Likewise.
10785 * pread.c (pread): Likewise.
10786 * configure, Makefile.in, config.in: Rebuild.
10787
10788 * mremap.c: New file.
10789 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10790 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10791 (mremap): Declare if HAVE_MREMAP is not defined.
10792 * configure, Makefile.in, config.in: Rebuild.
10793
10794 2009-03-27 Cary Coutant <ccoutant@google.com>
10795
10796 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10797 position independent.
10798 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10799 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10800
10801 2009-03-24 Cary Coutant <ccoutant@google.com>
10802
10803 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10804 an executable.
10805 (needs_dynamic_reloc): Likewise.
10806
10807 2009-03-24 Ian Lance Taylor <iant@google.com>
10808
10809 * yyscript.y (file_cmd): Recognize EXTERN.
10810 (extern_name_list, extern_name_list_body): New nonterminals.
10811 * script.cc (script_add_extern): Define.
10812 * script-c.h (script_add_extern): Declare.
10813
10814 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10815
10816 * object.cc (is_elf_object): Define.
10817 * object.h (is_elf_object): Declare.
10818 * archive.cc (Archive::get_elf_object_for_member): Call
10819 is_elf_object.
10820 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10821
10822 2009-03-24 Elliott Hughes <enh@google.com>
10823
10824 * output.cc (Output_file::map_anonymous): Define.
10825 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10826 try an anonymous one. Report the size if the mmap fails.
10827 * output.h (class Output_file): Declare map_anonymous.
10828
10829 2009-03-24 Ian Lance Taylor <iant@google.com>
10830
10831 * target-select.cc (instantiate_target): Don't acquire the lock if
10832 the instantiated_target_ field has already been set.
10833
10834 2009-03-23 Ian Lance Taylor <iant@google.com>
10835
10836 * gold-threads.h (class Initialize_lock): Define.
10837 * gold-threads.cc (class Initialize_lock_once): Define.
10838 (initialize_lock_control): New static variable.
10839 (initialize_lock_pointer): New static variable.
10840 (initialize_lock_once): New static function.
10841 (Initialize_lock::Initialize_lock): Define.
10842 (Initialize_lock::initialize): Define.
10843 * target-select.h: Include "gold-threads.h".
10844 (class Target_selector): Add lock_ and initialize_lock_ fields.
10845 Don't define instantiate_target, just declare it.
10846 * target-select.cc (Target_selector::Target_selector): Initialize
10847 new fields.
10848 (Target_selector::instantiate_target): Define.
10849 * descriptors.h: Include "gold-threads.h".
10850 (class Descriptors): Add initialize_lock_ field.
10851 * descriptors.cc (Descriptors::Descriptors): Initialize new
10852 field.
10853 (Descriptors::open): Use initialize_lock_ field
10854 * errors.h (class Errors): Add initialize_lock_ field.
10855 * errors.cc (Errors::Errors): Initialize new field.
10856 (Errors::initialize_lock): Use initialize_lock_ field.
10857 * powerpc.cc (class Target_selector_powerpc): Remove
10858 instantiated_target_ field. In do_recognize call
10859 instantiate_target rather than do_instantiate_target. In
10860 do_instantiate_target just allocate a new target.
10861 * sparc.cc (class Target_selector_sparc): Likewise.
10862
10863 * freebsd.h: New file.
10864 * i386.cc: Include "freebsd.h".
10865 (Target_i386): Derive from Target_freebsd rather than
10866 Sized_target.
10867 (Target_selector_i386): Derive from Target_selector_freebsd rather
10868 than Target_selector.
10869 * x86_64.cc: Include "freebsd.h".
10870 (Target_x86_64): Derive from Target_freebsd rather than
10871 Sized_target.
10872 (Target_selector_x86_64): Derive from Target_selector_freebsd
10873 rather than Target_selector.
10874 * target.h (class Target): Add adjust_elf_header and
10875 do_adjust_elf_header.
10876 * output.cc (Output_file_header:: do_sized_write): Call target
10877 adjust_elf_header routine.
10878 * configure.tgt: Set targ_osabi.
10879 * configure.ac: Define GOLD_DEFAULT_OSABI.
10880 * parameters.cc (Parameters::default_target): Pass
10881 GOLD_DEFAULT_OSABI to select_target.
10882 * target-select.h (class Target_selector): Make instantiate_target
10883 protected rather than private.
10884 * Makefile.am (HFILES): Add freebsd.h.
10885 * configure, Makefile.in, config.in: Rebuild.
10886
10887 * merge.cc (do_add_input_section): Correct pend value. Change
10888 message about last entry not being null terminated from error to
10889 warning.
10890
10891 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10892
10893 * incremental.cc: New file.
10894 * Makefile.am (CCFILES): Add incremental.cc.
10895 * Makefile.in: Rebuild.
10896
10897 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10898
10899 * layout.cc (Layout::output_section_name): Preserve names
10900 of '.note.' sections.
10901
10902 2009-03-19 Ian Lance Taylor <iant@google.com>
10903
10904 * descriptors.cc (Descriptors::open): Check that the options are
10905 valid before using them.
10906
10907 2009-03-18 Ian Lance Taylor <iant@google.com>
10908
10909 * script-sections.h: Include <list>.
10910 (class Script_sections): Change Sections_elements from std::vector
10911 to std::list. Typedef public Elements_iterator. Add
10912 orphan_section_placement_, data_segment_align_start_, and
10913 saw_data_segment_align_ fields. Remove data_segment_align_index_
10914 field.
10915 * script-sections.cc (class Orphan_section_placement): New class.
10916 (class Sections_element): Add virtual functions is_relro and
10917 orphan_section_init. Remove virtual function place_orphan_here.
10918 (class Output_section_definition): Add is_relro and
10919 orphan_section_init. Remove place_orphan_here.
10920 (class Orphan_output_section): Likewise.
10921 (Script_sections::Script_sections): Update for field changes.
10922 (Script_sections::data_segment_align): Set saw_data_segment_align_
10923 and data_segment_align_start_, not data_segment_align_index.
10924 (Script_sections::data_segment_relro_end): Check
10925 saw_data_segment_align_. Use data_segment_align_start_ rather
10926 than data_segment_align_index_.
10927 (Script_sections::place_orphan): Rewrite to use
10928 Orphan_section_placement.
10929
10930 2009-03-17 Ian Lance Taylor <iant@google.com>
10931
10932 * archive.cc (Archive::add_symbols): Check for a version attached
10933 to the symbol name in the archive map.
10934 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10935 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10936 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10937 (ver_test_11.a): New target.
10938 * testsuite/Makefile.in: Rebuild.
10939
10940 * configure.ac: Check for chsize and posix_fallocate. Replace
10941 ftruncate.
10942 * ftruncate.c: New file, from gnulib.
10943 * output.cc (posix_fallocate): Define dummy version if not
10944 HAVE_POSIX_FALLOCATE.
10945 (Output_file::map): Call posix_fallocate rather than lseek and
10946 write.
10947 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10948 * configure, Makefile.in, config.in: Rebuild.
10949
10950 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10951
10952 * layout.h (Layout::create_note): Add section_name parameter.
10953 * layout.cc (Layout::create_note): Likewise.
10954 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10955
10956 2009-03-17 Ian Lance Taylor <iant@google.com>
10957
10958 * descriptors.cc: Include "options.h".
10959 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10960 (Descriptors::open): Always use O_CLOEXEC when opening a new
10961 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10962 then set FD_CLOEXEC.
10963
10964 * sparc.cc (class Target_sparc): Add has_got_section.
10965 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10966 make sure we have a GOT section.
10967
10968 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10969 (Target_sparc::Scan::local): Likewise.
10970 (Target_sparc::Scan::global): Likewise.
10971 (Target_sparc::Relocate::relocate): Likewise.
10972 (Target_sparc::Relocate::relocate_tls): Likewise.
10973
10974 * symtab.cc (Symbol_table::define_default_version): New function,
10975 broken out of add_from_object.
10976 (Symbol_table::add_from_object): Call define_default_version.
10977 (Symbol_table::define_special_symbol): Add resolve_oldsym
10978 parameter. Change all callers. If the version for a symbol comes
10979 from a version script, resolve it with the symbol with the same
10980 name with no version. Also add the symbol without a version if
10981 appropriate.
10982 (do_define_in_output_data): If resolving with oldsym, don't delete
10983 sym.
10984 (do_define_in_output_segment): Likewise.
10985 (do_define_as_constant): Likewise.
10986 * symtab.h (class Symbol_table): Update declarations.
10987
10988 2009-03-13 Ian Lance Taylor <iant@google.com>
10989
10990 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10991 (Read_symbols::requeue): New function.
10992 (Read_symbols::do_read_symbols): If make_elf_object fails because
10993 the target type is not configured, and the file was searched for,
10994 issue a warning and retry with the next directory.
10995 (Add_symbols::run): If the file has an incompatible format, and
10996 it was searched for, requeue the Read_symbols task. On error,
10997 release the object.
10998 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10999 dirindex parameter to constructor. Change all callers. Declare
11000 incompatible_warning and requeue.
11001 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11002 input_argument_ and input_group_ fields. Add them to
11003 constructor. Change all callers.
11004 (class Read_script): Add dirindex_ field. Add it to constructor.
11005 Change all callers.
11006 * archive.cc (Archive::setup): Remove input_objects parameter.
11007 Change all callers.
11008 (Archive::get_file_and_offset): Likewise.
11009 (Archive::read_all_symbols): Likewise.
11010 (Archive::read_symbols): Likewise.
11011 (Archive::get_elf_object_for_member): Remove input_objects
11012 parameter. Add punconfigured parameter. Change all callers.
11013 (Archive::add_symbols): Change return type to bool. Check return
11014 value of include_member.
11015 (Archive::include_all_members): Likewise.
11016 (Archive::include_member): Change return type to bool. Return
11017 false if first included object has incompatible target. Set
11018 included_member_ field.
11019 (Add_archive_symbols::run): If add_symbols returns false, requeue
11020 Read_symbols task.
11021 * archive.h (class Archive): Add included_member_ field.
11022 Initialize it in constructor. Add input_file and searched_for
11023 methods. Update declarations.
11024 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11025 input_argument_ fields. Add them to constructor. Change all
11026 callers.
11027 * script.cc: Include "target-select.h".
11028 (class Parser_closure): Add skip_on_incompatible_target_ and
11029 found_incompatible_target_ fields. Add
11030 skip_on_incompatible_target parameter to constructor. Change all
11031 callers. Add methods skip_on_incompatible_target,
11032 clear_skip_on_incompatible_target, found_incompatible_target, and
11033 set_found_incompatible_target.
11034 (read_input_script): Add dirindex parameter. Change all callers.
11035 If parser finds an incompatible target, requeue Read_symbols
11036 task.
11037 (script_set_symbol): Clear skip_on_incompatible_target in
11038 closure.
11039 (script_add_assertion, script_parse_option): Likewise.
11040 (script_start_sections, script_add_phdr): Likewise.
11041 (script_check_output_format): New function.
11042 * script.h (read_input_script): Update declaration.
11043 * script-c.h (script_check_output_format): Declare.
11044 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11045 (ignore_cmd): Remove OUTPUT_FORMAT.
11046 * fileread.cc (Input_file::Input_file): Add explicit this.
11047 (Input_file::will_search_for): New function.
11048 (Input_file::open): Add pindex parameter. Change all callers.
11049 * fileread.h (class Input_file): Add input_file_argument method.
11050 Declare will_search_for. Update declarations.
11051 * object.cc (make_elf_object): Add punconfigured parameter.
11052 Change all callers.
11053 * object.h (class Object): Make input_file public. Add
11054 searched_for method.
11055 (make_elf_object): Update declaration.
11056 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11057 restart search.
11058 * dirsearch.h (class Dirsearch): Update declaration.
11059 * options.h (class General_options): Add --warn-search-mismatch.
11060 * parameters.cc (Parameters::is_compatible_target): New function.
11061 * parameters.h (class Parameters): Declare is_compatible_target.
11062 * workqueue.cc (Workqueue::add_blocker): New function.
11063 * workqueue.h (class Workqueue): Declare add_blocker.
11064
11065 * fileread.cc (Input_file::open): Remove options parameter.
11066 Change all callers.
11067 (Input_file::open_binary): Likewise.
11068 * script.cc (read_input_script): Likewise.
11069 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11070 options parameter from constructor. Change all callers.
11071 (class Read_script): Likewise.
11072 * fileread.h (class Input_file): Update declarations.
11073 * script.h (read_input_script): Update declaration.
11074
11075 2009-03-10 Nick Clifton <nickc@redhat.com>
11076
11077 * po/es.po: New Spanish translation.
11078
11079 2009-03-06 Cary Coutant <ccoutant@google.com>
11080
11081 * options.cc (parse_short_option): Keep dash_z from registering itself.
11082
11083 2009-03-03 Ian Lance Taylor <iant@google.com>
11084
11085 PR 9918
11086 * target-reloc.h (relocate_section): Pass output_section to
11087 relocate.
11088 * i386.cc (Target_i386::should_apply_static_reloc): Add
11089 output_section parameter. Change all callers.
11090 (Target_i386::Relocate::relocate): Add output_section parameter.
11091 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11092 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11093 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11094 * testsuite/two_file_shared.sh: New script.
11095 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11096 (check_DATA): Add two_file_shared.dbg.
11097 (two_file_shared.dbg): New target.
11098 * testsuite/Makefile.in: Rebuild.
11099
11100 2009-03-01 Ian Lance Taylor <iant@google.com>
11101
11102 * configure.ac: Check for byteswap.h.
11103 * configure: Rebuild.
11104 * config.in: Rebuild.
11105
11106 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11107
11108 * layout.cc (Layout::find_or_add_kept_section): New function.
11109 (Layout::add_comdat): Removed.
11110 * layout.h (struct Kept_section): Move out of class Layout.
11111 Remove trailing underscores from field names. Add group_sections
11112 field. Rename group_ field to is_group. Change all uses.
11113 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11114 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11115 comdat_groups_ field.
11116 (Sized_relobj::include_section_group): Use
11117 find_or_add_kept_section and Kept_section::group_sections.
11118 (Sized_relobj::include_linkonce_section): Likewise.
11119 * object.cc (class Sized_relobj): Don't define Comdat_group or
11120 Comdat_group_table. Remove find_comdat_group and
11121 add_comdat_group. Remove comdat_groups_ field.
11122 * plugin.cc (include_comdat_group): Use
11123 Layout::find_or_add_kept_section.
11124
11125 2009-02-28 Ian Lance Taylor <iant@google.com>
11126
11127 * README: --gc-sections and map files are now supported. Document
11128 some build requirements.
11129
11130 PR 6992
11131 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11132 relocatable link set the value of the section symbol to zero.
11133 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11134 relocatable link don't include the section address in the local
11135 symbol value.
11136
11137 2009-02-27 Ian Lance Taylor <iant@google.com>
11138
11139 PR 6811
11140 * options.h (class Search_directory): Add is_system_directory.
11141 (class General_options): Declare is_in_system_directory.
11142 * options.cc (get_relative_sysroot): Make static.
11143 (get_default_sysroot): Make static.
11144 (General_optoins::is_in_system_directory): New function.
11145 * fileread.cc (Input_file::is_in_system_directory): New function.
11146 * fileread.h (class Input_file): Declare is_in_system_directory.
11147 * object.h (class Object): Add is_in_system_directory.
11148 (class Input_objects): Remove system_library_directory_ field.
11149 * object.cc (Input_objects::add_object): Don't set
11150 system_library_directory_.
11151 (input_objects::found_in_system_library_directory): Remove.
11152 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11153 parameter. Change all callers.
11154 (Symbol_table::sized_write_globals): Likewise.
11155 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11156 Call Object::is_in_system_directory.
11157 * symtab.h (class Symbol_table): Update declarations.
11158
11159 PR 5990
11160 * descriptors.h (Open_descriptor): Add is_on_stack field.
11161 * descriptors.cc (Descriptors::open): If the descriptor is on the
11162 top of the stack, remove it. Initialize is_on_stack field.
11163 (Descriptors::release): Only add pod to stack if it is not on the
11164 stack already.
11165 (Descriptors::close_some_descriptor): Clear stack_next and
11166 is_on_stack fields.
11167
11168 PR 7091
11169 * output.cc (Output_section::find_starting_output_address): Rename
11170 from starting_output_address; add PADDR parameter; change return
11171 type.
11172 * output.h (class Output_section): Declare
11173 find_starting_output_address instead of starting_output_address.
11174 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11175 section symbol for which we can't find a merge section.
11176
11177 PR 9836
11178 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11179 hidden or internal, force the symbol to be local.
11180 * resolve.cc (Symbol::override_visibility): Define.
11181 (Symbol::override_base): Use override_visibility.
11182 (Symbol_table::resolve): Likewise.
11183 (Symbol::override_base_with_special): Likewise.
11184 (Symbol_table::override_with_special): If the visibility is hidden
11185 or internal, force the symbol to be local.
11186 * symtab.h (class Symbol): Add set_visibility and
11187 override_visibility.
11188 * testsuite/ver_test_1.sh: New file.
11189 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11190 (check_DATA): Add ver_test_1.syms.
11191 (ver_test_1.syms): New target.
11192 * testsuite/Makefile.in: Rebuild.
11193
11194 2009-02-25 Cary Coutant <ccoutant@google.com>
11195
11196 * layout.cc (Layout::choose_output_section): Don't rename sections
11197 when using a linker script that has a SECTIONS clause.
11198 * Makefile.in: Regenerate.
11199
11200 * testsuite/Makefile.am (script_test_5.sh): New test case.
11201 * testsuite/Makefile.in: Regenerate.
11202 * testsuite/script_test_5.cc: New file.
11203 * testsuite/script_test_5.sh: New file.
11204 * testsuite/script_test_5.t: New file.
11205
11206 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11207
11208 * archive.cc (Archive::include_member): Update calls to add_symbols.
11209 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11210 the Layout argument.
11211 * dynobj.h (do_add_symbols): Add the Layout argument.
11212 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11213 Layout argument.
11214 * object.h (Object::add_symbols): Add the Layout argument.
11215 (Object::do_add_symbols): Add the Layout argument.
11216 (Sized_relobj::do_add_symbols): Add the Layout argument.
11217 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11218 Unify the two versions.
11219 (Add_plugin_symbols): Remove.
11220 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11221 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11222 (Add_plugin_symbols): Remove.
11223 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11224 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11225 (Add_symbols::run): Make it work with Pulginobj.
11226
11227 2009-02-06 Ian Lance Taylor <iant@google.com>
11228
11229 * object.cc (Sized_relobj::do_layout): Make info message start
11230 with lower case letter.
11231
11232 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11233
11234 * binary.cc: Fix file comment.
11235
11236 * options.h (enum Incremental_disposition): Define.
11237 (class General_options): Add new options: --incremental,
11238 --incremental_changed, --incremental_unchanged,
11239 --incremental_unknown. Add incremental_disposition_ and
11240 implicit_incremental_ fields.
11241 (General_options::incremental_disposition): New function.
11242 (class Position_dependent_options): Add incremental_disposition
11243 option.
11244 (Position_dependent_options::copy_from_options): Set incremental
11245 dispositions.
11246 * options.cc (General_options::parse_incremental_changed): New
11247 function.
11248 (General_options::parse_incremental_unchanged): New function.
11249 (General_options::parse_incremental_unknown): New function.
11250 (General_options::General_options): Initialize new fields
11251 incremental_disposition_ and implicit_incremental_.
11252 (General_options::finalize): Check for uasge of --incremental-*
11253 without --incremental.
11254
11255 2009-02-06 Chris Demetriou <cgd@google.com>
11256
11257 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11258 pointer and to report location as the file name associated with
11259 the symbol.
11260 (gold_undefined_symbol_at_location): New function to replace the
11261 old gold_undefined_symbol functionality.
11262 * target-reloc.h (relocate_section): Update to use
11263 gold_undefined_symbol_at_location.
11264 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11265 Call gold_undefined_symbol function rather than gold_error.
11266 * errors.h (Errors::undefined_symbol): Take location as a
11267 string, rather than calculating it from a relocation.
11268 * errors.cc (Errors::fatal): Print "fatal error:" before the
11269 formatted message.
11270 (Errors::error, Errors::error_at_location): Print "error: "
11271 before the formatted message.
11272 (Errors::undefined_symbol): Take location as a string, rather
11273 than calculating it from a relocation.
11274 (gold_undefined_symbol_at_location): New function akin to
11275 old gold_undefined_symbol, calculates location from relocation.
11276 (gold_undefined_symbol): Change to take only a Symbol pointer
11277 and to report location as the file name associated with the symbol.
11278 * testsuite/debug_msg.sh: Update for changed error messages.
11279 * testsuite/undef_symbol.sh: Likewise.
11280
11281 2009-02-04 Duncan Sands <baldrick@free.fr>
11282
11283 PR 9812
11284 * reduced_debug_output.h
11285 (Output_reduced_debug_abbrev_section::failed): Use format for
11286 gold_warning.
11287 (Output_reduced_debug_info_section::faild): Likewise.
11288
11289 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11290
11291 * script.cc (Lazy_demangler): New class.
11292 (Version_script_info::get_symbol_version_helper): Demangle a
11293 symbol only once.
11294
11295 2009-01-29 Cary Coutant <ccoutant@google.com>
11296
11297 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11298 to __tls_get_addr.
11299 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11300
11301 2009-01-28 Ian Lance Taylor <iant@google.com>
11302
11303 * version.cc (version_string): Bump to 1.9.
11304
11305 * gold.h: Include <cstring> and <stdint.h>.
11306 * version.cc: Include <cstdio>.
11307 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11308 warning.
11309 * reduced_debug_output.cc (insert_into_vector): Rename from
11310 Insert_into_vector; change all callers. Use Swap_unaligned to
11311 avoid aliasing issue; remove union since it is unnecessary.
11312
11313 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11314
11315 * Makefile.am (CCFILES): Add gc.cc.
11316 (HFILES): Add gc.h.
11317 * Makefile.in: Regenerate.
11318 * gold.cc (Gc_runner): New class.
11319 (queue_initial_tasks): Call garbage collection related tasks
11320 when corresponding options are invoked.
11321 (queue_middle_gc_tasks): New function.
11322 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11323 processed early before laying out sections during garbage collection.
11324 * gold.h (queue_middle_gc_tasks): New function.
11325 (is_prefix_of): Move from "layout.cc".
11326 * i386.cc (Target_i386::gc_process_relocs): New function.
11327 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11328 * main.cc (main): Create object of class "Garbage_collection".
11329 * object.cc (Relobj::copy_symbols_data): New function.
11330 (Relobj::is_section_name_included): New function.
11331 (Sized_relobj::do_layout): Allow this function to be called twice
11332 during garbage collection and defer layout of section during the
11333 first call.
11334 * object.h (Relobj::get_symbols_data): New function.
11335 (Relobj::is_section_name_included): New function.
11336 (Relobj::copy_symbols_data): New function.
11337 (Relobj::set_symbols_data): New function.
11338 (Relobj::get_relocs_data): New function.
11339 (Relobj::set_relocs_data): New function.
11340 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11341 (Relobj::gc_process_relocs): New function.
11342 (Relobj::do_gc_process_relocs): New pure virtual function.
11343 (Relobj::sd_): New data member.
11344 (Sized_relobj::is_output_section_offset_invalid): New function.
11345 (Sized_relobj::do_gc_process_relocs): New function.
11346 * options.h (General_options::gc_sections): Modify to not be a no-op.
11347 (General_options::print_gc_sections): New option.
11348 * plugin.cc (Plugin_finish::run): Remove function call to
11349 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11350 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11351 * reloc.cc (Read_relocs::run): Add task to process relocs and
11352 determine unreferenced sections when doing garbage collection.
11353 (Gc_process_relocs): New class.
11354 (Sized_relobj::do_gc_process_relocs): New function.
11355 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11356 sections that are garbage collected.
11357 * reloc.h (Gc_process_relocs): New class.
11358 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11359 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11360 symbols whose corresponding sections are garbage collected.
11361 (Symbol_table::Symbol_table): Add new parameter for the garbage
11362 collection object.
11363 (Symbol_table::gc_mark_undef_symbols): New function.
11364 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11365 (Symbol_table::gc_mark_dyn_syms): New function.
11366 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11367 as garbage.
11368 (Symbol_table::add_from_object): Likewise.
11369 (Symbol_table::add_from_relobj): When building shared objects, do not
11370 treat externally visible symbols as garbage.
11371 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11372 table information for static and relocatable links.
11373 * symtab.h (Symbol_table::set_gc): New function.
11374 (Symbol_table::gc): New function.
11375 (Symbol_table::gc_mark_undef_symbols): New function.
11376 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11377 (Symbol_table::gc_mark_dyn_syms): New function.
11378 (Symbol_table::gc_): New data member.
11379 * target.h (Sized_target::gc_process_relocs): New pure virtual
11380 function.
11381 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11382 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11383
11384 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11385
11386 * options.h (General_options::gc_sections): Define as a no-op for now.
11387 (General_options::no_keep_memory): Ditto.
11388 (General_options::Bshareable): Define.
11389 * options.cc (General_options::finalize): Honor -Bshareable.
11390
11391 2009-01-20 Andreas Schwab <schwab@suse.de>
11392
11393 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11394 read the value in the contents, since we don't use it. Use the
11395 template endianness when writing.
11396 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11397
11398 2009-01-19 Andreas Schwab <schwab@suse.de>
11399
11400 * configure.tgt (powerpc64-*): Fix targ_obj.
11401
11402 2009-01-15 Ian Lance Taylor <iant@google.com>
11403
11404 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11405 local symbols when stripping all symbols.
11406
11407 2009-01-14 Cary Coutant <ccoutant@google.com>
11408
11409 * output.cc (Output_reloc): Add explicit instantiations.
11410
11411 2009-01-14 Cary Coutant <ccoutant@google.com>
11412
11413 * archive.cc (Archive::get_elf_object_for_member): Remove call
11414 to File_read::claim_for_plugin.
11415 * descriptors.cc (Descriptors::open): Remove reference to
11416 is_claimed.
11417 (Descriptors::claim_for_plugin): Remove.
11418 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11419 (Descriptors::is_claimed): Remove.
11420 (claim_descriptor_for_plugin): Remove.
11421 * fileread.cc (File_read::claim_for_plugin): Remove.
11422 * fileread.h (File_read::claim_for_plugin): Remove.
11423 (File_read::descriptor): Reopen descriptor if necessary.
11424 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11425 (Plugin_manager::all_symbols_read): Add task parameter. Change
11426 all callers.
11427 (Plugin_manager::get_input_file): New function.
11428 (Plugin_manager::release_input_file): New function.
11429 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11430 corresponding data member.
11431 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11432 and pass to base constructor. Change all callers.
11433 (get_input_file, release_input_file): New functions.
11434 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11435 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11436 (Plugin_manager::all_symbols_read): Add task parameter.
11437 (Plugin_manager::get_input_file): New function.
11438 (Plugin_manager::release_input_file): New function.
11439 (Plugin_manager::task_): New data member.
11440 (Pluginobj::Pluginobj): Add filesize parameter.
11441 (Pluginobj::filename): New function.
11442 (Pluginobj::descriptor): New function.
11443 (Pluginobj::filesize): New function.
11444 (Pluginobj::filesize_): New data member.
11445 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11446 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11447 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11448
11449 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11450 with archive libraries.
11451 * testsuite/Makefile.in: Regenerate.
11452 * testsuite/plugin_test.c (struct sym_info): New type.
11453 (get_input_file, release_input_file): New static variables.
11454 (onload): Capture new transfer vector entries.
11455 (claim_file_hook): Stop reading at end of file according to filesize.
11456 Factor out parsing of readelf output into separate function.
11457 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11458 APIs and get the source file name from the symbol table. Convert
11459 source file name to corresponding object file name. Print info
11460 message when adding new input files.
11461 (parse_readelf_line): New function.
11462 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11463 * testsuite/plugin_test_2.sh: Likewise.
11464 * testsuite/plugin_test_3.sh: Likewise.
11465 * testsuite/plugin_test_4.sh: New test case.
11466
11467 2009-01-07 Ian Lance Taylor <iant@google.com>
11468
11469 * version.cc (version_string): Bump to 1.8.
11470
11471 2008-12-23 Cary Coutant <ccoutant@google.com>
11472
11473 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11474 * plugin.cc (Plugin_manager::finish): Rename as
11475 layout_deferred_objects. Move cleanup to separate function.
11476 (Plugin_manager::cleanup): New function.
11477 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11478 separately.
11479 * plugin.h (Plugin_manager::finish): Rename as
11480 layout_deferred_objects.
11481 (Plugin_manager::cleanup): New function.
11482 (Plugin_manager::cleanup_done): New field.
11483
11484 2008-12-23 Cary Coutant <ccoutant@google.com>
11485
11486 * plugin.cc (is_visible_from_outside): New function.
11487 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11488 so we don't return "IR only" status for exported symbols or -r links.
11489
11490 * testsuite/Makefile.am (plugin_test_3): New test case.
11491 * testsuite/Makefile.in: Regenerate.
11492 * testsuite/plugin_test_3.sh: New file.
11493
11494 2008-12-22 Cary Coutant <ccoutant@google.com>
11495
11496 * object.cc (Sized_relobj::layout_section): New function.
11497 (Sized_relobj::do_layout): Defer layout of input sections until after
11498 plugin has provided replacement files.
11499 (Sized_relobj::do_layout_deferred_sections): New function.
11500 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11501 (Relobj::layout_deferred_sections): New function.
11502 (Relobj::do_layout_deferred_sections): New function.
11503 (Sized_relobj::do_layout_deferred_sections): New function.
11504 (Sized_relobj::layout_section): New function.
11505 (Sized_relobj::Deferred_layout): New structure.
11506 (Sized_relobj::deferred_layout_): New field.
11507 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11508 Change all callers. Layout deferred sections.
11509 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11510 references.
11511 (Plugin_hook::run): Move code from do_plugin_hook inline.
11512 (Plugin_hook::do_plugin_hook): Remove.
11513 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11514 (Plugin_manager::finish): Renamed, was cleanup.
11515 (Plugin_manager::should_defer_layout): New function.
11516 (Plugin_manager::add_deferred_layout_object): New function.
11517 (Plugin_manager::Deferred_layout_list): New type.
11518 (Plugin_manager::deferred_layout_objects_): New field.
11519 (Plugin_hook::do_plugin_hook): Remove.
11520
11521 2008-12-17 Ian Lance Taylor <iant@google.com>
11522
11523 * options.h (class General_options): Add --no case for
11524 --export-dynamic.
11525
11526 2008-12-16 Cary Coutant <ccoutant@google.com>
11527
11528 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11529 vector.
11530 (Plugin_manager::claim_file): Create plugin object even if
11531 plugin did not call the add_symbols callback.
11532 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11533 asking for more symbols than were added.
11534 * testsuite/Makefile.am (plugin_test_1): Add test case with
11535 no global symbols.
11536 (empty.syms): New target.
11537 * testsuite/Makefile.in: Regenerate.
11538 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11539 message. Don't call add_symbols if no globals.
11540 (all_symbols_read_hook): Don't provide replacement for empty
11541 claimed file.
11542
11543 2008-12-12 Ian Lance Taylor <iant@google.com>
11544
11545 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11546 r_type == 0 for a local symbol with r_sym == 0.
11547 (scan_relocatable_relocs): Pass r_sym to
11548 local_non_section_strategy.
11549 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11550 r_sym parameter.
11551
11552 * configure.ac: Update test for TLS descriptors: they are
11553 supported as of glibc 2.9.
11554 * configure: Rebuild.
11555
11556 2008-12-11 Ian Lance Taylor <iant@google.com>
11557
11558 PR 7091
11559 * target-reloc.h (Default_scan_relocatable_relocs): For each
11560 function, map r_type == 0 to RELOC_DISCARD.
11561
11562 2008-12-10 Cary Coutant <ccoutant@google.com>
11563
11564 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11565 object to override a kept COMDAT group from a plugin object.
11566
11567 2008-12-09 Ian Lance Taylor <iant@google.com>
11568
11569 PR 7088
11570 * yyscript.y (file_cmd): Handle INPUT.
11571
11572 * testsuite/initpri1.c: Change all declarations to be full
11573 prototypes by adding void, to avoid compiler warnings.
11574
11575 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11576
11577 * options.cc (General_options::parse_plugin_opt): New.
11578 (General_options::add_plugin): The argument now is just the filename.
11579 (General_options::add_plugin_option): New.
11580 * options.h (plugin_opt): New.
11581 (add_plugin): Change argument name.
11582 (add_plugin_option): New.
11583 * plugin.cc (Plugin::load): Don't parse the plugin option.
11584 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11585 (Plugin::add_option): New.
11586 (Plugin::args_): Change type.
11587 (Plugin::filename_): New.
11588 (Plugin_manager::add_plugin_option): New.
11589 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11590 * testsuite/Makefile.in: Regenerate.
11591
11592 2008-12-05 Cary Coutant <ccoutant@google.com>
11593
11594 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11595 Handle --strip-lto-sections option.
11596 * options.h (strip_lto_sections): New option.
11597
11598 2008-12-01 Cary Coutant <ccoutant@google.com>
11599
11600 * plugin.cc (ld_plugin_message): Change format parameter to const.
11601 Fix mismatch between new[] and delete.
11602
11603 2008-11-14 Cary Coutant <ccoutant@google.com>
11604
11605 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11606 instead of -1U.
11607
11608 2008-11-05 Craig Silverstein <csilvers@google.com>
11609
11610 * options.cc (General_options::parse_dynamic_list): New function.
11611 * options.h (General_options): New flags dynamic_list,
11612 dynamic_list_data, dynamic_list_cpp_new, and
11613 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11614 (General_options::in_dynamic_list): New function.
11615 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11616 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11617 (Lex::can_continue_name): Likewise.
11618 (yylex): Likewise.
11619 (read_script_file): New parameter script_options.
11620 (read_dynamic_list): New function.
11621 (Script_options::define_dynamic_list): New function.
11622 (dynamic_list_keyword_parsecodes): New variable.
11623 (dynamic_list_keywords): New variable.
11624 * script.h (Script_options::define_dynamic_list): New function
11625 prototype.
11626 (read_dynamic_list): New function prototype.
11627 * symtab.cc (strprefix): New macro.
11628 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11629 dynamic_list_data, dynamic_list_cpp_new, and
11630 dynamic_list_cpp_typeinfo.
11631 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11632 (dynamic_list_expr): New rule.
11633 (dynamic_list_nodes): Likewise.
11634 (dynamic_list_node): Likewise.
11635 * testsuite/Makefile.am (dynamic_list): New test.
11636 * testsuite/Makefile.in: Regenerated.
11637 * testsuite/dynamic_list.t: New file.
11638 * testsuite/dynamic_list.sh: New file.
11639
11640 2008-11-05 Craig Silverstein <csilvers@google.com>
11641
11642 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11643 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11644 (t11_last): Likewise.
11645 * testsuite/ver_test_6.c (main): Likewise.
11646
11647 2008-10-07 Cary Coutant <ccoutant@google.com>
11648
11649 * options.c (General_options::finalize): Add check for -static and
11650 -shared.
11651 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11652 is not empty.
11653
11654 2008-10-02 Cary Coutant <ccoutant@google.com>
11655
11656 * plugin.cc (make_sized_plugin_object): Fix conditional
11657 compilation to work when not all targets are enabled.
11658
11659 2008-09-29 Cary Coutant <ccoutant@google.com>
11660
11661 * archive.cc (Archive::get_file_and_offset): Use filename instead
11662 of name to get library path.
11663 (Archive::include_member): Unlock external member of a thin archive.
11664
11665 * testsuite/Makefile.am (TEST_AR): New variable.
11666 (thin_archive_test_1): New test.
11667 (thin_archive_test_2): New test.
11668 * testsuite/Makefile.in: Regenerate.
11669 * testsuite/thin_archive_main.cc: New file.
11670 * testsuite/thin_archive_test_1.cc: New file.
11671 * testsuite/thin_archive_test_2.cc: New file.
11672 * testsuite/thin_archive_test_3.cc: New file.
11673 * testsuite/thin_archive_test_4.cc: New file.
11674
11675 2008-09-29 Cary Coutant <ccoutant@google.com>
11676
11677 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11678 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11679 instead of -1U.
11680 (Sized_relobj::do_finalize_local_symbols): Likewise.
11681 (Sized_relobj::map_to_kept_section): Likewise.
11682 * object.h (Sized_relobj::invalid_address): New constant.
11683 (Sized_relobj::do_output_section_offset): Check for invalid_address
11684 and return -1ULL.
11685 * output.cc (Output_reloc::local_section_offset): Use constant
11686 invalid_address instead of -1U.
11687 (Output_reloc::get_address): Likewise.
11688 (Output_section::output_address): Change -1U to -1ULL.
11689 * output.h (Output_reloc::invalid_address): New constant.
11690 * reloc.cc (Sized_relobj::write_sections): Use constant
11691 invalid_address instead of -1U.
11692 (Sized_relobj::relocate_sections): Likewise.
11693 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11694 values for merge sections.
11695 * target-reloc.h (relocate_for_relocatable): Use constant
11696 invalid_address instead of -1U.
11697
11698 2008-09-19 Cary Coutant <ccoutant@google.com>
11699
11700 Add plugin functionality for link-time optimization (LTO).
11701 * configure.ac (plugins): Add --enable-plugins option.
11702 * configure: Regenerate.
11703 * config.in: Regenerate.
11704 * Makefile.am (LIBDL): New variable.
11705 (CCFILES): Add plugin.cc.
11706 (HFILES): Add plugin.h.
11707 (ldadd_var): Add LIBDL.
11708 * Makefile.in: Regenerate.
11709
11710 * archive.cc: Include "plugin.h".
11711 (Archive::setup): Don't preread archive symbols when using a plugin.
11712 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11713 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11714 files.
11715 (Archive::include_member): Add symbols from plugin objects.
11716 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11717 * descriptors.cc (Descriptors::open): Check for file descriptors
11718 abandoned by plugins.
11719 (Descriptors::claim_for_plugin): New function.
11720 * descriptors.h (Descriptors::claim_for_plugin): New function.
11721 (Open_descriptor::is_claimed): New field.
11722 (claim_descriptor_for_plugin): New function.
11723 * fileread.cc (File_read::claim_for_plugin): New function.
11724 * fileread.h (File_read::claim_for_plugin): New function.
11725 (File_read::descriptor): New function.
11726 * gold.cc: Include "plugin.h".
11727 (queue_initial_tasks): Add task to call plugin hooks for generating
11728 new object files.
11729 * main.cc: Include "plugin.h".
11730 (main): Load plugin libraries.
11731 * object.h (Pluginobj): Declare.
11732 (Object::pluginobj): New function.
11733 (Object::do_pluginobj): New function.
11734 (Object::set_target): New function.
11735 * options.cc: Include "plugin.h".
11736 (General_options::parse_plugin): New function.
11737 (General_options::General_options): Initialize plugins_ field.
11738 (General_options::add_plugin): New function.
11739 * options.h (Plugin_manager): Declare.
11740 (General_options): Add --plugin option.
11741 (General_options::has_plugins): New function.
11742 (General_options::plugins): New function.
11743 (General_options::add_plugin): New function.
11744 (General_options::plugins_): New field.
11745 * plugin.cc: New file.
11746 * plugin.h: New file.
11747 * readsyms.cc: Include "plugin.h".
11748 (Read_symbols::do_read_symbols): Check for archive before checking
11749 for ELF file. Call plugin hooks to claim files.
11750 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11751 from a real object file; force override when processing replacement
11752 files.
11753 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11754 (Symbol::init_base_object): Likewise.
11755 (Symbol::init_base_output_data): Likewise.
11756 (Symbol::init_base_output_segment): Likewise.
11757 (Symbol::init_base_constant): Likewise.
11758 (Symbol::init_base_undefined): Likewise.
11759 (Symbol::output_section): Assert that object is not a plugin.
11760 (Symbol_table::add_from_pluginobj): New function.
11761 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11762 undefined.
11763 (Symbol_table::sized_write_globals): Likewise.
11764 (Symbol_table::add_from_pluginobj): Instantiate template.
11765 * symtab.h (Sized_pluginobj): Declare.
11766 (Symbol::in_real_elf): New function.
11767 (Symbol::set_in_real_elf): New function.
11768 (Symbol::in_real_elf_): New field.
11769 (Symbol_table::add_from_pluginobj): New function.
11770
11771 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11772 (LIBDL): New variable.
11773 (LDADD): Add LIBDL.
11774 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11775 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11776 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11777 (MOSTLYCLEANFILES): Likewise.
11778 * testsuite/Makefile.in: Regenerate.
11779 * testsuite/plugin_test.c: New file.
11780 * testsuite/plugin_test_1.sh: New file.
11781 * testsuite/plugin_test_2.sh: New file.
11782
11783 2008-09-16 Ian Lance Taylor <iant@google.com>
11784
11785 * target-reloc.h (relocate_section): Check whether a symbol is
11786 defined by the ABI before reporting an undefined symbol error.
11787 * target.h (Target::is_defined_by_abi): Make parameter const.
11788 (Target::do_is_defined_by_abi): Likewise.
11789 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11790 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11791 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11792 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11793 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11794 * testsuite/Makefile.in: Rebuild.
11795
11796 * fileread.cc (make_view): Add casts to avoid warning.
11797
11798 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11799
11800 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11801 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11802
11803 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11804
11805 * options.h (General_options::output_is_executable): New.
11806 (General_options::output_is_pie): New.
11807 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11808 for shared libraries.
11809 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11810
11811 2008-09-11 Chris Demetriou <cgd@google.com>
11812
11813 * options.h (origin): New -z option.
11814 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11815 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11816 in DT_FLAGS_1.
11817
11818 2008-09-05 Cary Coutant <ccoutant@google.com>
11819
11820 * fileread.cc (File_read::make_view): Add check for attempt to map
11821 beyond end of file.
11822
11823 2008-09-05 Cary Coutant <ccoutant@google.com>
11824
11825 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11826 explicit instantiations.
11827
11828 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11829
11830 PR gold/6858
11831 * options.cc (General_options::finalize): Allow undefined symbols
11832 in shlibs if linking -shared.
11833
11834 PR gold/6859
11835 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11836 symbols as not needing a dynsym entry.
11837
11838 2008-08-20 Craig Silverstein <csilvers@google.com>
11839
11840 * fileread.cc (File_read::open): Do not lock the file unless it
11841 was successfully opened.
11842
11843 2008-08-14 Cary Coutant <ccoutant@google.com>
11844
11845 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11846 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11847 * testsuite/tls_test.cc (struct int128): 128-bit struct
11848 for testing TLS relocs with non-zero addend.
11849 (v12): New TLS variable.
11850 (t12): New test.
11851 (t_last): Add check for v12.
11852 * testsuite/tls_test.h (t12): New function.
11853 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11854
11855 2008-08-13 Ian Lance Taylor <iant@google.com>
11856
11857 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11858 set tls_segment_ or relro_segment_.
11859 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11860 when appropriate.
11861 * output.h (Output_section::clear_is_relro): New function.
11862 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11863 sections specially even when output_data_ is empty.
11864 (Output_segment::maximum_alignment): When first section is relro,
11865 only force alignment for PT_LOAD segments.
11866 * script.cc (script_data_segment_align): New function.
11867 (script_data_segment_relro_end): New function.
11868 * script-c.h (script_data_segment_align): Declare.
11869 (script_data_segment_relro_end): Declare.
11870 * script-sections.h (class Script_sections): Declare
11871 data_segment_align and data_segment_relro_end. Add fields
11872 segment_align_index_ and saw_relro_end_.
11873 * script-sections.cc (class Sections_element): Add set_is_relro
11874 virtual function. Add new bool* parameter to place_orphan_here.
11875 Add get_output_section virtual function.
11876 (class Output_section_definition): Add set_is_relro. Add new
11877 bool* parameter to place_orphan_here. Add get_output_section.
11878 Add is_relro_ field.
11879 (Output_section_definition::Output_section_definition): Initialize
11880 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11881 and is_relro_ fields.
11882 (Output_section_definition::place_orphan_here): Add is_relro
11883 parameter.
11884 (Output_section_definition::set_section_addresses): Set relro for
11885 output section.
11886 (Output_section_definition::alternate_constraint): Likewise.
11887 (class Orphan_output_section): Add new bool* parameter to
11888 place_orphan_here. Add get_output_section.
11889 (Orphan_output_section::place_orphan_here): Add is_relro
11890 parameter.
11891 (Script_sections::Script_sections): Initialize
11892 data_segment_align_index_ and saw_relro_end_.
11893 (Script_sections::data_segment_align): New function.
11894 (Script_sections::data_segment_relro_end): New function.
11895 (Script_sections::place_orphan): Set or clear is_relro.
11896 (Script_sections::set_section_addresses): Force alignment of first
11897 TLS section.
11898 * yyscript.y (exp): Call script_data_segment_align and
11899 script_data_segment_relro_end.
11900 * testsuite/relro_script_test.t: New file.
11901 * testsuite/relro_test.cc (using_script): Declare.
11902 (t1, t2): Test using_script.
11903 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11904 (relro_script_test_SOURCES): Define.
11905 (relro_script_test_DEPENDENCIES): Define.
11906 (relro_script_test_LDFLAGS): Define.
11907 (relro_script_test_LDADD): Define.
11908 (relro_script_test.so): New target.
11909 * testsuite/Makefile.in: Rebuild.
11910
11911 2008-08-06 Cary Coutant <ccoutant@google.com>
11912
11913 * archive.cc (Archive::total_archives, Archive::total_members)
11914 (Archive::total_members_loaded): New variables.
11915 (Archive::setup): Add parameter. Add option to preread
11916 archive symbols.
11917 (Archive::read_armap): Add counter.
11918 (Archive::get_file_and_offset): New function.
11919 (Archive::get_elf_object_for_member): New function.
11920 (Archive::read_all_symbols): New function.
11921 (Archive::read_symbols): New function.
11922 (Archive::add_symbols): Add counters.
11923 (Archive::include_all_members): Use armap to find members if it's
11924 already built.
11925 (Archive::include_member): Skip reading symbols if already read.
11926 Factored code into Archive::get_file_and_offset and
11927 Archive::get_elf_object_for_member. Changed call to
11928 Mapfile::report_include_archive_member.
11929 (Archive::print_stats): New function.
11930 * archive.h: Declare Object and Read_symbols_data classes.
11931 (Archive::Archive): Add initializers for new members.
11932 (Archive::setup): Add parameter.
11933 (Archive::print_stats): New function.
11934 (Archive::total_archives, Archive::total_members)
11935 (Archive::total_members_loaded): New variables.
11936 (Archive::get_file_and_offset): New function.
11937 (Archive::get_elf_object_for_member): New function.
11938 (Archive::read_all_symbols): New function.
11939 (Archive::read_symbols): New function.
11940 (Archive::Archive_member): New class.
11941 (Archive::members_): New member.
11942 (Archive::num_members_): New member.
11943 * main.cc: Include archive.h.
11944 (main): Call Archive::print_stats.
11945 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11946 archive parameter; member_name is now the fully-decorated name.
11947 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11948 * options.h: (General_options): Add --preread-archive-symbols option.
11949 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11950 Archive::setup.
11951
11952 2008-08-04 Ian Lance Taylor <iant@google.com>
11953
11954 * symtab.h (Symbol::use_plt_offset): New function.
11955 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11956 * powerpc.cc (Relocate::relocate): Likewise.
11957 * sparc.cc (Relocate::relocate): Likewise.
11958 * x86_64.cc (Relocate::relocate): Likewise.
11959 * testsuite/weak_plt.sh: New test.
11960 * testsuite/weak_plt_main.cc: New test.
11961 * testsuite/weak_plt_shared.cc: New test.
11962 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11963 (check_PROGRAMS): Add weak_plt.
11964 (check_DATA): Add weak_plt_shared.so.
11965 (weak_plt_main_pic.o, weak_plt): New targets.
11966 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11967 * testsuite/Makefile.in: Rebuild.
11968
11969 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11970 gcctestdir/ld.
11971 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11972 * testsuite/Makefile.in: Rebuild.
11973
11974 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11975
11976 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11977 * Makefile.in: Regenerate.
11978 * po/POTFILES.in: Regenerate.
11979
11980 2008-07-29 Ian Lance Taylor <iant@google.com>
11981
11982 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11983 symbols before other symbols.
11984 * testsuite/script_test_2.cc (test_addr): Declare.
11985 (test_addr_alias): Declare.
11986 (main): Check that test_addr and test_addr_alias have the right
11987 values.
11988 * testsuite/script_test_2.t: Define test_addr_alias and
11989 test_addr.
11990
11991 2008-07-24 Ian Lance Taylor <iant@google.com>
11992
11993 PR 5990
11994 * descriptors.cc: New file.
11995 * descriptors.h: New file.
11996 * gold-threads.h (class Hold_optional_lock): New class.
11997 * fileread.cc: Include "descriptors.h".
11998 (File_read::~File_read): Release descriptor rather than closing
11999 it.
12000 (File_read::open) [file]: Call open_descriptor rather than open.
12001 Set is_descriptor_opened_.
12002 (File_read::open) [memory]: Assert that descriptor is not open.
12003 (File_read::reopen_descriptor): New function.
12004 (File_read::release): Release descriptor.
12005 (File_read::do_read): Make non-const. Reopen descriptor.
12006 (File_read::read): Make non-const.
12007 (File_read::make_view): Reopen descriptor.
12008 (File_read::do_readv): Likewise.
12009 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12010 Update declarations.
12011 * layout.cc: Include "descriptors.h".
12012 (Layout::create_build_id): Use open_descriptor rather than open.
12013 * output.cc: Include "descriptors.h".
12014 (Output_file::open): Use open_descriptor rather than open.
12015 * archive.cc (Archive::const_iterator): Change Archive to be
12016 non-const.
12017 (Archive::begin, Archive::end): Make non-const.
12018 (Archive::count_members): Likewise.
12019 * archive.h (class Archive): Update declarations.
12020 * object.h (Object::read): Make non-const.
12021 * Makefile.am (CCFILES): Add descriptors.cc.
12022 (HFILES): Add descriptors.h.
12023 * Makefile.in: Rebuild.
12024
12025 PR 6716
12026 * gold.h: Always include <clocale>. Add Solaris workarounds
12027 following code in binutils/sysdep.h.
12028
12029 PR 6048
12030 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12031 this->eh_frame_hdr_ is NULL before using it.
12032
12033 * dynobj.cc (Versions::Versions): Update comment.
12034
12035 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12036 the base version name.
12037
12038 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12039 array size plus one.
12040 (Stringpool_template::set_string_offsets): Subtract one from key
12041 before using it as an array index.
12042 (Stringpool_template::get_offset_with_length): Likewise.
12043 (Stringpool_template::write_to_buffer): Likewise.
12044 * stringpool.h (Stringpool_template::get_offset_from_key):
12045 Likewise.
12046
12047 2008-07-23 Ian Lance Taylor <iant@google.com>
12048
12049 PR 6658
12050 * object.h (Merged_symbol_value::value): Do our best to handle a
12051 negative addend.
12052
12053 PR 6647
12054 * script.cc (Version_script_info::get_versions): Don't add empty
12055 version tag to return value.
12056 (Version_script_info::get_symbol_version_helper): Change return
12057 type to bool. Add pversion parameter. Change all callers.
12058 (script_register_vers_node): Don't require a non-NULL tag.
12059 * script.h (class Version_script_info): Update declarations.
12060 (Version_script_info::get_symbol_version): Change return type to
12061 bool. Add version parameter. Change all callers.
12062 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12063 handling. Handle an empty version from a version script.
12064 (Symbol_table::define_special_symbol): Likewise.
12065 * testsuite/ver_test_10.script: New file.
12066 * testsuite/ver_test_10.sh: New file.
12067 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12068 (check_DATA): Add ver_test_10.syms.
12069 (ver_test_10.syms, ver_test_10.so): New target.
12070 * testsuite/Makefile.in: Rebuild.
12071
12072 2008-07-23 Simon Baldwin <simonb@google.com>
12073
12074 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12075 to zero for undefined symbols from dynamic libraries.
12076
12077 2008-07-23 Ian Lance Taylor <iant@google.com>
12078
12079 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12080 Change all callers.
12081 * symtab.h (class Symbol_table): Update declaration.
12082 * testsuite/ver_test_9.cc: New file.
12083 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12084 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12085 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12086 (ver_test_9.so, ver_test_9.o): New targets.
12087 * testsuite/Makefile.in: Rebuild.
12088
12089 2008-07-22 Ian Lance Taylor <iant@google.com>
12090
12091 * options.h (class General_options): Define --check-sections.
12092 * layout.cc (Layout::set_segment_offsets): Handle
12093 --check-sections.
12094
12095 * options.h (class General_options): Define -n/--nmagic and
12096 -N/--omagic.
12097 * options.cc (General_options::finalize): For -n/--nmagic or
12098 -N/--omagic, set -static.
12099 * layout.cc (Layout::attach_allocated_section_to_segment): If
12100 -N/--omagic, don't put read-only and read-write sections in
12101 different segments.
12102 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12103 finding a read-only segment.
12104 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12105 don't set the minimum segment alignment to the common page size,
12106 and don't set the file offset to the address modulo the page size.
12107 * script-sections.cc (Script_sections::create_segments): If
12108 -n/--omagic, don't put read-only and read-write sections in
12109 different segments.
12110
12111 * cref.cc: New file.
12112 * cref.h: New file.
12113 * options.h (class General_options): Add --print-symbol-counts.
12114 * main.cc (main): Issue defined symbol report if requested.
12115 * archive.cc (Archive::interpret_header): Make into a const member
12116 function.
12117 (Archive::add_symbols): Call Input_objects::archive_start and
12118 archive_stop.
12119 (Archive::const_iterator): Define new class.
12120 (Archive::begin, Archive::end): New functions.
12121 (Archive::include_all_members): Rewrite to use iterator.
12122 (Archive::count_members): New function.
12123 * archive.h (class Archive): Update declarations.
12124 (Archive::filename): New function.
12125 * object.cc: Include "cref.h".
12126 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12127 (Sized_relobj::do_get_global_symbol_counts): New function.
12128 (Input_objects::add_object): Add object to cross-referencer.
12129 (Input_objects::archive_start): New function.
12130 (Input_objects::archive_stop): New function.
12131 (Input_objects::print_symbol_counts): New function.
12132 * object.h: Declare Cref and Archive.
12133 (Object::get_global_symbol_counts): New function.
12134 (Object::do_get_global_symbol_counts): New pure virtual function.
12135 (class Sized_relobj): Add defined_count_ field. Update
12136 declarations.
12137 (class Input_objects): Add cref_ field. Update constructor.
12138 Update declarations.
12139 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12140 defined_count_.
12141 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12142 symbol counts.
12143 (Sized_dynobj::do_get_global_symbol_counts): New function.
12144 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12145 defined_count_. Update declarations. Define Symbols typedef.
12146 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12147 parameter. Change all callers.
12148 (Symbol_table::add_from_dynobj): Add sympointers and defined
12149 parameters. Change all callers.
12150 * symtab.h (class Symbol_table): Update declarations.
12151 * Makefile.am (CCFILES): Add cref.cc.
12152 (HFILES): Add cref.h.
12153 * Makefile.in: Rebuild.
12154
12155 2008-07-22 Simon Baldwin <simonb@google.com>
12156
12157 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12158 to zero when writing undefined symbols.
12159
12160 2008-07-22 Ian Lance Taylor <iant@google.com>
12161
12162 * output.cc (Output_section::add_input_section): Don't try to
12163 merge empty merge sections.
12164
12165 2008-07-21 Craig Silverstein <csilvers@google.com>
12166
12167 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12168 Include symbol version in error message.
12169
12170 2008-07-20 Chris Demetriou <cgd@google.com>
12171
12172 * configure.ac (gold_cv_c_random_seed): New configured variable.
12173 (RANDOM_SEED_CFLAGS): New substituted variable.
12174 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12175 * configure: Rebuild.
12176 * Makefile.in: Likewise.
12177 * testsuite/Makefile.in: Likewise.
12178
12179 2008-07-18 Ian Lance Taylor <iant@google.com>
12180
12181 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12182 where we see NAME/NULL and NAME/VERSION as separate symbols.
12183 * testsuite/ver_test_main.cc (main): Call t4.
12184 (t4, t4_2a): Define.
12185 * testsuite/ver_test_2.cc (t4_2): Define.
12186 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12187 * testsuite/ver_test_4.cc (t4_2a): Define.
12188 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12189 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12190
12191 2008-07-17 Ian Lance Taylor <iant@google.com>
12192
12193 * dynobj.cc (Versions::add_def): If we give an error about a
12194 missing version, go ahead and create the version anyhow.
12195
12196 2008-07-10 Ian Lance Taylor <iant@google.com>
12197
12198 Handle output sections with more than 0x7fffffff bytes.
12199 * object.h (class Relobj): Change map_to_output_ to
12200 output_sections_, and just keep a section pointer. Change all
12201 uses. Move comdat group support to Sized_relobj.
12202 (Relobj::is_section_specially_mapped): Remove.
12203 (Relobj::output_section): Remove poff parameter. Change all
12204 callers.
12205 (Relobj::output_section_offset): New function.
12206 (Relobj::set_section_offset): Rewrite.
12207 (Relobj::map_to_output): Remove.
12208 (Relobj::output_sections): New function.
12209 (Relobj::do_output_section_offset): New pure virtual function.
12210 (Relobj::do_set_section_offset): Likewise.
12211 (class Sized_relobj): Add section_offsets_ field. Add comdat
12212 group support from Relobj. Update declarations.
12213 (Sized_relobj::get_output_section_offset): New function.
12214 (Sized_relobj::do_output_section_offset): New function.
12215 (Sized_relobj::do_set_section_offset): New function.
12216 * object.cc (Relobj::output_section_address): Remove.
12217 (Sized_relobj::Sized_relobj): Initialize new fields.
12218 (Sized_relobj::include_section_group): Cast find_kept_object to
12219 Sized_relobj.
12220 (Sized_relobj::include_linkonce_section): Likewise.
12221 (Sized_relobj::do_layout): Use separate arrays for output section
12222 and output offset.
12223 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12224 output_sections.
12225 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12226 output_sections and section_offsets.
12227 (Sized_relobj::write_local_symbols): Likewise.
12228 (map_to_kept_section): Compute output address directly.
12229 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12230 output_sections and section_offsets.
12231 (Sized_relobj::write_sections): Likewise.
12232 (Sized_relobj::relocate_sections): Likewise.
12233 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12234 * output.h (class Output_reloc): Update declarations. Change
12235 u2_.relobj to Sized_relobj*.
12236 (class Output_data_reloc): Change add functions to use
12237 Sized_relobj*.
12238 * output.cc (Output_reloc::Output_reloc): Change relobj to
12239 Sized_relobj*.
12240 (Output_reloc::local_section_offset): Change return type to
12241 Elf_Addr. Use get_output_section_offset.
12242 (Output_reloc::get_address): Likewise.
12243 (Output_section::is_input_address_mapped): Don't call
12244 is_section_specially_mapped.
12245 (Output_section::output_offset): Likewise.
12246 (Output_section::output_address): Likewise.
12247 (Output_section::starting_output_address): Likewise.
12248 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12249 parameter to Sized_relobj*.
12250 (Copy_relocs::need_copy_reloc): Likewise.
12251 (Copy_relocs::save): Likewise.
12252 * copy-relocs.h (class Copy_relocs): Update declarations.
12253 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12254 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12255 * target-reloc.h (relocate_for_relocatable): Change
12256 offset_in_output_section type to Elf_Addr. Change code that uses
12257 it as well.
12258 * layout.cc (Layout::layout): Always set *off.
12259 * mapfile.cc (Mapfile::print_input_section): Use
12260 output_section_offset.
12261 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12262 Sized_relobj*.
12263 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12264 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12265 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12266
12267 2008-07-03 Ian Lance Taylor <iant@google.com>
12268
12269 * layout.cc (Layout::include_section): Do not discard unrecognized
12270 SHT_STRTAB sections.
12271
12272 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12273
12274 * script.cc (Lex::can_continue_name): Make '?' allowable in
12275 version-script names.
12276 * testsuite/version_script.map: Change glob pattern to use '?'
12277
12278 2008-06-30 Manish Singh <yosh@gimp.org>
12279
12280 PR 6585
12281 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12282 Correct typo.
12283
12284 2008-06-30 Ian Lance Taylor <iant@google.com>
12285
12286 PR 6660
12287 PR 6682
12288 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12289 versions]: Don't try to read the value in the contents, since we
12290 don't use it. Use the template endianness when writing.
12291
12292 2008-06-25 Cary Coutant <ccoutant@google.com>
12293
12294 * fileread.cc (File_read::make_view): Assert on zero-length view.
12295 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12296 symbol table when there are no symbols to read.
12297
12298 2008-06-23 Craig Silverstein <csilvers@google.com>
12299
12300 * version.cc (version_string): Bump to 1.7
12301
12302 2008-06-18 Craig Silverstein <csilvers@google.com>
12303
12304 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12305 constant 0xFFFF to type Valtype.
12306 (Powerpc_relocate_functions::rel16_ha): Likewise.
12307
12308 2008-06-17 Ian Lance Taylor <iant@google.com>
12309
12310 * output.h (Output_section::Input_section): Initialize p2align_ to
12311 zero for Output_section_data constructors.
12312 (Output_section::Input_section::addralign): If not an input
12313 section, return the alignment of the Output_section_data.
12314 * testsuite/copy_test.cc: New file.
12315 * testsuite/copy_test_1.cc: New file.
12316 * testsuite/copy_test_2.cc: New file.
12317 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12318 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12319 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12320 (copy_test_1_pic.o, copy_test_1.so): New targets.
12321 (copy_test_2_pic.o, copy_test_2.so): New targets.
12322 * testsuite/Makefile.in: Rebuild.
12323
12324 * script-sections.cc (Script_sections::place_orphan): Initialize
12325 local variable exact.
12326
12327 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12328
12329 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12330
12331 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12332 David S. Miller <davem@davemloft.net>
12333
12334 * powerpc.cc: New file.
12335 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12336 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12337 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12338 * Makefile.in: Rebuild.
12339
12340 2008-06-09 Ian Lance Taylor <iant@google.com>
12341
12342 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12343 <exception>.
12344 (throwing, orig_terminate): New static variables.
12345 (terminate_handler): New static function.
12346 (t2): Set terminate handler.
12347
12348 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12349
12350 PR 6584
12351 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12352 alignment.
12353
12354 2008-05-30 Cary Coutant <ccoutant@google.com>
12355
12356 * archive.cc (Archive::include_all_members) Correct to step
12357 over symbol table and extended name table in thin archives.
12358
12359 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12360
12361 PR 6407
12362 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12363 calculation.
12364
12365 2008-05-28 Caleb Howe <cshowe@google.com>
12366
12367 * reduced_debug_output.cc: New file.
12368 * reduced_debug_output.h: New file.
12369 * options.h (class General_options): Add --strip-debug-non-line.
12370 * options.cc (General_options::finalize): Add strip_debug_non_line
12371 to the strip heirarchy.
12372 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12373 fields.
12374 * layout.cc: Include "reduced_debug_output.h".
12375 (Layout::Layout): Initialize new fields.
12376 (line_only_debug_sections): New static array.
12377 (is_lines_only_debug_sections): New static inline function.
12378 (Layout::include_section): Handle --strip-debug-non-line.
12379 (Layout::make_output_section): If --strip-debug-non-line, build
12380 new output sections for .debug_abbrev and .debug_info.
12381 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12382 gold. Warn about possible overflow.
12383 (read_signed_LEB_128): Likewise.
12384 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12385 (read_signed_LEB_128): Declare.
12386 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12387 (HFILES): Add reduced_debug_output.h.
12388 * Makefile.in: Rebuild.
12389
12390 2008-05-21 Ian Lance Taylor <iant@google.com>
12391
12392 * mapfile.cc: New file.
12393 * mapfile.h: New file.
12394 * options.h (class General_options): Add -M/--print-map and -Map.
12395 * options.cc (General_options::finalize): Make -M equivalent to
12396 -Map -.
12397 * main.cc: Include <cstdio> and "mapfile.h".
12398 (main): Open mapfile if requested.
12399 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12400 constructor. Change caller.
12401 (queue_initial_tasks): Add mapfile parameter. Change caller.
12402 (queue_middle_tasks): Likewise.
12403 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12404 declarations.
12405 * archive.cc: Include "mapfile.h".
12406 (Archive::add_symbols): Add mapfile parameter. Change all
12407 callers. Pass mapfile, symbol, and reason to include_member.
12408 (Archive::include_all_members): Add mapfile parameter. Change all
12409 callers.
12410 (Archive::include_member): Add mapfile, sym, and why parameters.
12411 Change all callers. Report inclusion to map file.
12412 * archive.h: Include "fileread.h".
12413 (class Archive): Update declarations.
12414 (Archive::file): New const method.
12415 (class Add_archive_symbols): Add mapfile_ field. Update
12416 constructor. Change all callers.
12417 * readsyms.h (class Read_symbols): Likewise.
12418 (class Finish_group): Likewise.
12419 (class Read_script): Likewise.
12420 * common.cc: Include "mapfile.h".
12421 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12422 all callers.
12423 (Symbol_table::do_allocate_commons): Likewise.
12424 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12425 symbol allocation to mapfile.
12426 * common.h (class Allocate_commons_task): Add mapfile_ field.
12427 Update constructor. Change all callers.
12428 * symtab.h (class Symbol_table): Update declarations.
12429 * layout.cc: Include "mapfile.h".
12430 (Layout_task_runner::run): Print information to mapfile.
12431 (Layout::create_gold_note): Change Output_data_fixed_space to
12432 Output_data_zero_fill.
12433 (Layout::create_build_id): Likewise.
12434 (Layout::print_to_mapfile): New function.
12435 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12436 constructor. Change caller.
12437 (class Layout): Declare print_to_mapfile.
12438 * output.cc (Output_section::Input_section::print_to_mapfile): New
12439 function.
12440 (Output_section::add_input_section): If producing a map, always
12441 add to input_sections_ list.
12442 (Output_section::do_print_to_mapfile): New function.
12443 (Output_segment::print_sections_to_mapfile): New function.
12444 (Output_segment::print_section_list_to_mapfile): New function.
12445 * output.h: Include "mapfile.h".
12446 (Output_data::print_to_mapfile): New function.
12447 (Output_data::do_print_to_mapfile): New virtual function.
12448 (Output_segment_headers::do_print_to_mapfile): New function.
12449 (Output_file_header::do_print_to_mapfile): New function.
12450 (Output_data_const::do_print_to_mapfile): New function.
12451 (class Output_data_const_buffer): Add map_name_ field. Update
12452 constructor. Change all callers. Add do_print_to_mapfile
12453 function.
12454 (class Output_data_fixed_space): Likewise.
12455 (class Output_data_space): Likewise.
12456 (class Output_data_zero_fill): New class.
12457 (Output_data_strtab::do_print_to_mapfile): New function.
12458 (Output_data_reloc_base::do_print_to_mapfile): New function.
12459 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12460 (Output_data_group::do_print_to_mapfile): New function.
12461 (Output_data_got::do_print_to_mapfile): New function.
12462 (Output_data_dynamic::do_print_to_mapfile): New function.
12463 (Output_symtab_xindex::do_print_to_mapfile): New function.
12464 (class Output_section): Declare do_print_to_mapflie. Declare
12465 print_to_mapfile in Input_section.
12466 (class Output_segment): Declare new functions.
12467 * object.h (Sized_relobj::symbol_count): New function.
12468 * script-sections.cc
12469 (Output_section_element_dot_assignment::set_section_addresses):
12470 Change Output_data_fixed_space to Output_data_zero_fill.
12471 (Output_data_expression::do_print_to_mapfile): New function.
12472 * script.cc (read_input_script): Add mapfile parameter. Change
12473 all callers.
12474 * script.h (read_input_script): Update declaration.
12475 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12476 (Eh_frame::do_print_to_mapfile): New function.
12477 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12478 (Output_merge_string::do_print_to_mapfile): New function.
12479 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12480 function.
12481 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12482 function.
12483 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12484 function.
12485 * Makefile.am (CCFILES): Add mapfile.cc.
12486 (HFILES): Add mapfile.h.
12487 * Makefile.in: Rebuild.
12488
12489 2008-05-19 Ian Lance Taylor <iant@google.com>
12490
12491 * options.h (class General_options): Add -z relro.
12492 * layout.cc (Layout::Layout): Initialize relro_segment_.
12493 (Layout::add_output_section_data): Return the output section.
12494 (Layout::make_output_section): Rcognize relro sections and mark
12495 them appropriately.
12496 (Layout::attach_allocated_section_to_segment): Put relro sections
12497 in a PT_GNU_RELRO segment.
12498 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12499 section as relro.
12500 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12501 PT_TLS segments.
12502 (Layout::linkonce_mapping): Map d.rel.ro.local to
12503 .data.rel.ro.local.
12504 (Layout::output_section_name): Us .data.rel.ro.local for any
12505 section which begins with that.
12506 * layout.h (class Layout): Update add_output_section_data
12507 declaration. Add relro_segment_ field.
12508 * output.cc (Output_section::Output_section): Initialize is_relro_
12509 and is_relro_local_ fields.
12510 (Output_segment::add_output_section): Group relro sections.
12511 (Output_segment::is_first_section_relro): New function.
12512 (Output_segment::maximum_alignment): If there is a relro section,
12513 align the segment to the common page size.
12514 (Output_segment::set_section_addresses): Track whether we are
12515 looking at relro sections. If the last section is a relro
12516 section, align to the common page size.
12517 (Output_segment::set_section_list_addresses): Add in_relro
12518 parameter. Change all callers. Align to the page size when
12519 moving from relro to non-relro section.
12520 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12521 segment.
12522 * output.h (class Output_section): Add is_relro_ and
12523 is_relro_local_ fields.
12524 (Output_section::is_relro): New function.
12525 (Output_section::set_is_relro): New function.
12526 (Output_section::is_relro_local): New function.
12527 (Output_section::set_is_relro_local): New function.
12528 (class Output_segment): Update declarations.
12529 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12530 * sparc.cc (Target_sparc::got_section): Likewise.
12531 * x86_64.cc (Target_x86_64::got_section): Likewise.
12532 * testsuite/relro_test_main.cc: New file.
12533 * testsuite/relro_test.cc: New file.
12534 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12535 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12536 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12537 (relro_test.so, relro_test_pic.o): New targets.
12538 * testsuite/Makefile.in: Rebuild.
12539
12540 2008-05-16 Ian Lance Taylor <iant@google.com>
12541
12542 * output.cc (Output_segment::add_output_section): Remove front
12543 parameter.
12544 * output.h (class Output_segment): Remove
12545 add_initial_output_section and overloaded add_output_section.
12546 Update declaration of remaining add_output_section.
12547 * layout.cc (Layout::create_interp): Call add_output_section
12548 rather than add_initial_output_section.
12549 (Layout::finish_dynamic_section): Likewise.
12550
12551 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12552 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12553 know the dynamic type.
12554 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12555 field. Initialize it in constructor.
12556 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12557 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12558 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12559 reloc.
12560
12561 * output.cc (Output_reloc::get_address): Change return type to
12562 Elf_Addr.
12563 * output.h (class Output_reloc): Update get_address declaration.
12564 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12565 for section addresses.
12566
12567 2008-05-09 Ian Lance Taylor <iant@google.com>
12568
12569 PR 6493
12570 * gold.cc (gold_nomem): Use return value of write.
12571
12572 2008-05-08 Ian Lance Taylor <iant@google.com>
12573
12574 * symtab.c (Symbol::init_base_output_data): Add version
12575 parameter. Change all callers.
12576 (Symbol::init_base_output_segment): Likewise.
12577 (Symbol::init_base_constant): Likewise.
12578 (Symbol::init_base_undefined): Likewise.
12579 (Sized_symbol::init_output_data): Likewise.
12580 (Sized_symbol::init_output_segment): Likewise.
12581 (Sized_symbol::init_constant): Likewise.
12582 (Sized_symbol::init_undefined): Likewise.
12583 (Symbol_table::do_define_in_output_data): If the new symbol has a
12584 version, mark it as the default.
12585 (Symbol_table::do_define_in_output_segment): Likewise.
12586 (Symbol_table::do_define_as_constant): Likewise.
12587 * symtab.h (class Symbol): Update declarations.
12588 (class Sized_symbol): Likewise.
12589 * resolve.cc (Symbol::override_version): New function.
12590 (Symbol::override_base): Call override_version.
12591 (Symbol::override_base_with_special): Likewise.
12592 * testsuite/ver_script_8.script: New file.
12593 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12594 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12595 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12596 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12597
12598 2008-05-06 Ian Lance Taylor <iant@google.com>
12599
12600 PR 6049
12601 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12602 functions.
12603 (class General_options): Remove existing --undefined, and add
12604 --no-undefined instead. Add new --undefined as synonym for -u.
12605 * archive.cc (Archive::add_symbols): Check whether symbol was
12606 named with -u.
12607 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12608 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12609 all uses. Add IS_UNDEFINED. Update declarations to split
12610 different versions of init_base. Declare init_base_undefined.
12611 (Symbol::is_defined): Handle IS_UNDEFINED.
12612 (Symbol::is_undefined): Likewise.
12613 (Symbol::is_weak_undefined): Call is_undefined.
12614 (Symbol::is_absolute): Handle IS_CONSTANT.
12615 (class Sized_symbol): Update declarations to split different
12616 versions of init. Declare init_undefined.
12617 (class Symbol_table): Declare new functions.
12618 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12619 Change all callers.
12620 (Symbol::init_base_output_data): Likewise.
12621 (Symbol::init_base_output_segment): Likewise.
12622 (Symbol::init_base_constant): Likewise.
12623 (Symbol::init_base_undefined): New function.
12624 (Sized_symbol::init_object): Rename from init. Change all
12625 callers.
12626 (Sized_symbol::init_output_data): Likewise.
12627 (Sized_symbol::init_output_segment): Likewise.
12628 (Sized_symbol::init_constant): Likewise.
12629 (Sized_symbol::init_undefined): New function.
12630 (Symbol_table::add_undefined_symbols_from_command_line): New
12631 function.
12632 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12633 function.
12634 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12635 (Symbol::output_section): Likewise.
12636 (Symbol::set_output_section): Likewise.
12637 (Symbol_table::sized_finalize_symbol): Likewise.
12638 (Symbol_table::sized_write_globals): Likewise.
12639 * resolve.cc (Symbol_table::should_override): Likewise.
12640 (Symbol::override_base_with_special): Likewise.
12641
12642 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12643 symbol, change it to have default visibility.
12644 * testsuite/protected_1.cc: New file.
12645 * testsuite/protected_2.cc: New file.
12646 * testsuite/protected_3.cc: New file.
12647 * testsuite/protected_main_1.cc: New file.
12648 * testsuite/protected_main_2.cc: New file.
12649 * testsuite/protected_main_3.cc: New file.
12650 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12651 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12652 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12653 (protected_1.so): New target.
12654 (protected_1_pic.o, protected_2_pic.o): New targets.
12655 (protected_3_pic.o): New target.
12656 (check_PROGRAMS): Add protected_2.
12657 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12658 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12659 * testsuite/Makefile.in: Rebuild.
12660
12661 * options.h (DEFINE_var): Add set_user_set_##varname__.
12662 (DEFINE_bool_alias): New macro.
12663 (class General_options): Define -Bstatic using DEFINE_bool_alias
12664 rather than DEFINE_special. Add --undefined as an alias for -z
12665 defs.
12666 * options.cc (General_options::parse_Bstatic): Remove.
12667
12668 * options.h (class General_options): Add --fatal-warnings.
12669 * main.cc (main): Implement --fatal-warnings.
12670 * errors.h (Errors::warning_count): New function.
12671
12672 * options.h (class General_options): Add -Bsymbolic-functions.
12673 * symtab.h (Symbol::is_preemptible): Check for
12674 -Bsymbolic-functions.
12675
12676 2008-05-05 Ian Lance Taylor <iant@google.com>
12677
12678 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12679 as noVARNAME rather than no-VARNAME.
12680 (class General_options): Add option -z combreloc.
12681 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12682 get_address.
12683 (Output_reloc::sort_before) [SHT_REL]: New function.
12684 (Output_reloc::sort_before) [SHT_RELA]: New function.
12685 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12686 Sort_relocs_comparison.
12687 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12688 parameter. Change all callers.
12689 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12690 sort_relocs parameter. Change all callers.
12691 * output.cc (Output_reloc::get_address): New function, broken out
12692 of write_rel.
12693 (Output_reloc::write_rel): Call it.
12694 (Output_reloc::compare): New function.
12695 (Output_data_reloc_base::do_write): Optionally sort relocs.
12696
12697 * configure.ac: If targ_extra_obj is set, link it in.
12698 * configure.tgt: Initialize all variables.
12699 (x86_64*): Set targ_extra_obj and targ_extra_size.
12700 * configure: Rebuild.
12701
12702 * object.cc (Sized_relobj::include_section_group): Adjust section
12703 indexes read from group data. Build vector to pass to
12704 layout_group.
12705 * layout.cc (Layout::layout_group): Add flags and shndxes
12706 parameters. Remove contents parameter. Change caller. Update
12707 explicit instantiations.
12708 * layout.h (class Layout): Update layout_group declaration.
12709 * output.cc (Output_data_group::Output_data_group): Add flags and
12710 input_shndxes parameters. Remove contents parameter. Change
12711 caller.
12712 (Output_data_group::do_write): Change input_sections_ to
12713 input_shndxes_.
12714 * output.h (class Output_data_group): Update constructor
12715 declaration. Rename input_sections_ to input_shndxes_.
12716 * testsuite/many_sections_test.cc: Add template.
12717
12718 2008-04-30 Cary Coutant <ccoutant@google.com>
12719
12720 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12721
12722 * layout.cc (Layout::include_section): Refactored check for debug
12723 info section.
12724 (Layout::add_comdat): Add new parameters. Change type
12725 of signature parameter. Add object and shndx to signatures table.
12726 (Layout::find_kept_object): New function.
12727 * layout.h: Include <cstring>.
12728 (Layout::is_debug_info_section): New function.
12729 (Layout::add_comdat): Add new parameters.
12730 (Layout::find_kept_object): New function.
12731 (Layout::Kept_section): New struct.
12732 (Layout::Signatures): Change type of map range.
12733 * object.cc (Relobj::output_section_address): New function.
12734 (Sized_relobj::include_section_group): Add new parameters. Change
12735 calls to Layout::add_comdat. Change to build table of kept comdat
12736 groups and table mapping discarded sections to kept sections.
12737 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12738 (Sized_relobj::do_layout): Change calls to include_section_group and
12739 include_linkonce_section.
12740 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12741 value to zero when section is discarded.
12742 (Sized_relobj::map_to_kept_section): New function.
12743 * object.h (Relobj::output_section_address): New function.
12744 (Relobj::Comdat_group): New type.
12745 (Relobj::find_comdat_group): New function.
12746 (Relobj::Comdat_group_table): New type.
12747 (Relobj::Kept_comdat_section): New type.
12748 (Relobj::Kept_comdat_section_table): New type.
12749 (Relobj::add_comdat_group): New function.
12750 (Relobj::set_kept_comdat_section): New function.
12751 (Relobj::get_kept_comdat_section): New function.
12752 (Relobj::comdat_groups_): New field.
12753 (Relobj::kept_comdat_sections_): New field.
12754 (Symbol_value::input_value): Update comment.
12755 (Sized_relobj::map_to_kept_section) New function.
12756 (Sized_relobj::include_linkonce_section): Add new parameter.
12757 * target-reloc.h (Comdat_behavior): New type.
12758 (get_comdat_behavior): New function.
12759 (relocate_section): Add code to map a discarded section to the
12760 corresponding kept section when applying a relocation.
12761
12762 2008-04-30 Craig Silverstein <csilvers@google.com>
12763
12764 * dwarf_reader.cc (next_generation_count): New static var.
12765 (Addr2line_cache_entry): New struct.
12766 (addr2line_cache): New static var.
12767 (Dwarf_line_info::one_addr2line): Added caching.
12768 (Dwarf_line_info::clear_addr2line_cache): New function.
12769 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12770 cache-size parameter.
12771 (Dwarf_line_info::one_addr2line_cache): New function.
12772 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12773 new cache-size argument to one_addr2line(), and clear cache.
12774
12775 2008-04-28 Cary Coutant <ccoutant@google.com>
12776
12777 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12778 R_386_PC8 relocations.
12779
12780 2008-04-23 Ian Lance Taylor <iant@google.com>
12781
12782 * object.cc (Sized_relobj::include_section_group): Check for
12783 invalid section group.
12784
12785 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12786 header size.
12787
12788 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12789 than read for file header.
12790 * archive.cc (Archive::include_member): Likewise.
12791
12792 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12793
12794 * aclocal.m4: Regenerate.
12795 * configure: Regenerate.
12796
12797 2008-04-19 Ian Lance Taylor <iant@google.com>
12798
12799 * version.cc (version_string): Bump to 1.6.
12800
12801 * testsuite/Makefile.am (many_sections_r_test): New target.
12802 (many_sections_r_test_SOURCES): Remove.
12803 (many_sections_r_test_DEPENDENCIES): Remove.
12804 (many_sections_r_test_LDFLAGS): Remove.
12805 (many_sections_r_test_LDADD): Remove.
12806
12807 * object.cc (Sized_relobj::do_add_symbols): Always pass
12808 local_symbol_count_ to add_from_relobj.
12809
12810 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12811 every thousand variables.
12812 * testsuite/Makefile.in: Rebuild.
12813
12814 * object.cc (Xindex::initialize_symtab_xindex): New function.
12815 (Xindex::read_symtab_xindex): New function.
12816 (Xindex::sym_xindex_to_shndx): New function.
12817 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12818 available.
12819 (Sized_relobj::do_initialize_xindex): New function.
12820 (Sized_relobj::do_read_symbols): Adjust section links.
12821 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12822 parameter. Change all callers.
12823 (Sized_relobj::include_section_group): Adjust section links and
12824 symbol section indexes.
12825 (Sized_relobj::do_layout): Adjust section links.
12826 (Sized_relobj::do_count_local_symbols): Adjust section links and
12827 symbol section indexes.
12828 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12829 ordinary and special symbols.
12830 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12831 dynsym_xindex parameters. Change all callers. Adjust section
12832 links. Use SHN_XINDEX when needed.
12833 (Sized_relobj::get_symbol_location_info): Adjust section links.
12834 Don't get fooled by special symbols.
12835 * object.h (class Xindex): Define.
12836 (class Object): Add xindex_ parameter. Declare virtual functoin
12837 do_initialize_xindex.
12838 (Object::adjust_sym_shndx): New function.
12839 (Object::set_xindex): New protected function.
12840 (class Symbol_value): Add is_ordinary_shndx_ field.
12841 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12842 (Symbol_value::value): Assert ordinary section.
12843 (Symbol_value::initialize_input_to_output_map): Likewise.
12844 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12845 Change all callers.
12846 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12847 all callers.
12848 (class Sized_relobj): Update declarations.
12849 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12850 parameter. Change all callers.
12851 (Sized_relobj::adjust_shndx): New function.
12852 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12853 field.
12854 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12855 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12856 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12857 (Sized_dynobj::read_dynsym_section): Adjust section links.
12858 (Sized_dynobj::read_dynamic): Likewise.
12859 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12860 section links.
12861 (Sized_dynobj::do_initialize_xindex): New function.
12862 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12863 do_initialize_xindex.
12864 (Sized_dynobj::adjust_shndx): New function.
12865 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12866 dynsym_xindex_ fields.
12867 (Layout::finalize): Add a call to set_section_indexes before
12868 creating the symtab sections.
12869 (Layout::set_section_indexes): Don't do anything if the section
12870 already has a section index.
12871 (Layout::create_symtab_sections): Add shnum parameter. Change
12872 caller. Create .symtab_shndx section if needed.
12873 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12874 caller.
12875 (Layout::allocated_output_section_count): New function.
12876 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12877 needed.
12878 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12879 fields. Update declarations.
12880 (Layout::symtab_xindex): New function.
12881 (Layout::dynsym_xindex): New function.
12882 (class Write_symbols_task): Add layout_ field.
12883 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12884 Change caller.
12885 * output.cc (Output_section_headers::Output_section_headers): Add
12886 shstrtab_section parameter. Change all callers.
12887 (Output_section_headers::do_sized_write): Store overflow values
12888 for section count and section string table section index in
12889 section header zero.
12890 (Output_file_header::do_sized_write): Check for overflow of
12891 section count and section string table section index.
12892 (Output_symtab_xindex::do_write): New function.
12893 (Output_symtab_xindex::endian_do_write): New function.
12894 * output.h (class Output_section_headers): Add shstrtab_section_.
12895 Update declarations.
12896 (class Output_symtab_xindex): Define.
12897 (Output_section::has_out_shndx): New function.
12898 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12899 field.
12900 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12901 Change all callers.
12902 (Sized_symbol::init): Likewise.
12903 (Symbol::output_section): Check for ordinary symbol.
12904 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12905 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12906 callers.
12907 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12908 Change all callers. Simplify handling of symbols from sections
12909 not included in the link.
12910 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12911 distinction.
12912 (Weak_alias_sorter::operator()): Assert that symbols are
12913 ordinary.
12914 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12915 distinction.
12916 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12917 parameters. Change all callers.
12918 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12919 symbol distinction. Use SHN_XINDEX when needed.
12920 (Symbol_table::write_section_symbol): Add symtab_xindex
12921 parameter. Change all callers.
12922 (Symbol_table::sized_write_section_symbol): Likewise. Use
12923 SHN_XINDEX when needed.
12924 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12925 declarations.
12926 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12927 (Symbol::is_defined): Check is_ordinary.
12928 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12929 (Symbol::is_absolute, Symbol::is_common): Likewise.
12930 (class Sized_symbol): Update declarations.
12931 (class Symbol_table): Update declarations.
12932 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12933 parameters. Change all callers.
12934 (Sized_symbol::override): Likewise.
12935 (Symbol_table::override): Likewise.
12936 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12937 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12938 is_ordinary, and orig_st_shndx parameters. Change all callers.
12939 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12940 to be in an ordinary section.
12941 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12942 object and is_ordinary parameters. Change all callers.
12943 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12944 Change all callers. Don't add undefined or non-ordinary symbols
12945 to reloc_map_.
12946 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12947 Change all callers.
12948 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12949 declarations.
12950 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12951 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12952 (Sized_relobj::relocate_sections): Likewise.
12953 * target-reloc.h (scan_relocs): Adjust section symbol index.
12954 (scan_relocatable_relocs): Likewise.
12955 * i386.cc (Scan::local): Check for ordinary symbols.
12956 * sparc.cc (Scan::local): Likewise.
12957 * x86_64.cc (Scan::local): Likewise.
12958 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12959 to symbol_section_and_value.
12960 * testsuite/many_sections_test.cc: New file.
12961 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12962 (check_PROGRAMS): Add many_sections_test.
12963 (many_sections_test_SOURCES): Define.
12964 (many_sections_test_DEPENDENCIES): Define.
12965 (many_sections_test_LDFLAGS): Define.
12966 (BUILT_SOURCES): Add many_sections_define.h.
12967 (many_sections_define.h): New target.
12968 (BUILT_SOURCES): Add many_sections_check.h.
12969 (many_sections_check.h): New target.
12970 (check_PROGRAMS): Add many_sections_r_test.
12971 (many_sections_r_test_SOURCES): Define.
12972 (many_sections_r_test_DEPENDENCIES): Define.
12973 (many_sections_r_test_LDFLAGS): Define.
12974 (many_sections_r_test_LDADD): Define.
12975 (many_sections_r_test.o): New target.
12976 * testsuite/Makefile.in: Rebuild.
12977
12978 2008-04-17 Cary Coutant <ccoutant@google.com>
12979
12980 * errors.cc (Errors::info): New function.
12981 (gold_info): New function.
12982 * errors.h (Errors::info): New function.
12983 * gold.h (gold_info): New function.
12984 * object.cc (Input_objects::add_object): Print trace output.
12985 * options.cc (options::parse_set): New function.
12986 (General_options::parse_wrap): Deleted.
12987 (General_options::General_options): Deleted initializer.
12988 * options.h (options::String_set): New typedef.
12989 (options::parse_set): New function.
12990 (DEFINE_set): New macro.
12991 (General_options::wrap): Changed to use DEFINE_set. Changed
12992 callers of any_wrap_symbols and is_wrap_symbol.
12993 (General_options::trace, General_options::trace_symbol):
12994 New options.
12995 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12996 (General_options::wrap_symbols_): Deleted.
12997 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12998
12999 2008-04-17 David S. Miller <davem@davemloft.net>
13000
13001 * options.cc (General_options::parse_V): New function.
13002 * options.h: Add entries for -V and -Qy.
13003
13004 2008-04-17 Ian Lance Taylor <iant@google.com>
13005
13006 * common.cc (Symbol_table::allocate_commons): Remove options
13007 parameter. Change caller.
13008 (Symbol_table::do_allocate_commons): Remove options parameter.
13009 Change caller. Just call do_allocate_commons_list twice.
13010 (Symbol_table::do_allocate_commons_list): New function, broken out
13011 of do_allocate_commons.
13012 * common.h (class Allocate_commons_task): Remove options_ field.
13013 Update constructor.
13014 * symtab.cc (Symbol_table::Symbol_table): Initialize
13015 tls_commons_.
13016 (Symbol_table::add_from_object): Put TLS common symbols on
13017 tls_commons_ list.
13018 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13019 which are IN_OUTPUT_DATA.
13020 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13021 allocate_commons and do_allocate_commons declarations. Declare
13022 do_allocate_commons_list.
13023 * gold.cc (queue_middle_tasks): Update creation of
13024 Allocate_commons_task to not pass options.
13025 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13026 (TLS_TEST_C_FLAGS): New variable.
13027 (tls_test_c_pic.o): New target.
13028 (tls_test_shared.so): Link in tls_test_c_pic.o.
13029 (tls_test_c_pic_ie.o): New target.
13030 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13031 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13032 (tls_test_c.o): New target.
13033 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13034 (tls_pic_test_LDADD): Likewise.
13035 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13036 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13037 (tls_test_c_gnu2.o): New target.
13038 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13039 tls_test_c_gnu2.o.
13040 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13041 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13042 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13043 * testsuite/tls_test.cc: Include "config.h".
13044 (t_last): Call t11_last.
13045 * testsuite/tls_test.h (t11, t11_last): Declare.
13046 * testsuite/tls_test_c.c: New file.
13047 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13048 * configure.ac: Check for OpenMP support.
13049 * configure, config.in, Makefile.in: Rebuild.
13050 * testsuite/Makefile.in: Rebuild.
13051
13052 2008-04-16 Cary Coutant <ccoutant@google.com>
13053
13054 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13055 (Target_i386::tls_base_symbol_defined_): New field.
13056 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13057 (Target_i386::Scan::global): Likewise.
13058 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13059 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13060 (Target_x86_64::tls_base_symbol_defined_): New field.
13061 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13062 (Target_x86_64::Scan::global): Likewise.
13063
13064 2008-04-16 Cary Coutant <ccoutant@google.com>
13065
13066 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13067 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13068 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13069 building shared libraries.
13070 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13071 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13072 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13073 * testsuite/Makefile.in: Rebuild.
13074 * testsuite/weak_undef.h: New file.
13075 * testsuite/weak_undef_file1.cc: Add extra test cases.
13076 * testsuite/weak_undef_file2.cc: Likewise.
13077 * testsuite/weak_undef_test.cc: Likewise.
13078
13079 2008-04-16 David S. Miller <davem@davemloft.net>
13080
13081 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13082 Add issued_non_pic_error_ field. Declare check_non_pic.
13083 (Target_sparc::Scan::check_non_pic): New function.
13084 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13085 (Target_sparc::Scan::global): Likewise.
13086
13087 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13088 * configure: Rebuild.
13089
13090 * options.h (DEFINE_enable): New macro.
13091 (new_dtags): New enable option.
13092 (initfirst, interpose, loadfltr, nodefaultlib,
13093 nodelete, nodlopen, nodump): New -z options.
13094 * layout.cc (Layout:finish_dynamic_section): If new
13095 dtags enabled, emit DT_RUNPATH. Also, emit a
13096 DT_FLAGS_1 containing any specified -z flags.
13097
13098 2008-04-16 Ian Lance Taylor <iant@google.com>
13099
13100 * copy-relocs.cc: New file.
13101 * copy-relocs.h: New file.
13102 * reloc.cc: Remove Copy_relocs code.
13103 * reloc.h: Likewise.
13104 * reloc-types.h (struct Reloc_types) [both versions]: Add
13105 get_reloc_addend_noerror.
13106 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13107 variants of add_global which take an addend which must be zero.
13108 * i386.cc: Include "copy-relocs.h".
13109 (class Target_i386): Change type of copy_relocs_ to variable,
13110 update initializer.
13111 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13112 Change all callers.
13113 (Target_i386::do_finalize_sections): Change handling of
13114 copy_relocs_.
13115 * sparc.cc: Include "copy-relocs.h".
13116 (class Target_sparc): Change type of copy_relocs_ to variable,
13117 update initializer.
13118 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13119 Change all callers.
13120 (Target_sparc::do_finalize_sections): Change handling of
13121 copy_relocs_.
13122 * x86_64.cc: Include "copy-relocs.h".
13123 (class Target_x86_64): Change type of copy_relocs_ to variable,
13124 update initializer.
13125 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13126 class. Change all callers.
13127 (Target_x86_64::do_finalize_sections): Change handling of
13128 copy_relocs_.
13129 * Makefile.am (CCFILES): Add copy-relocs.cc.
13130 (HFILES): Add copy-relocs.h.
13131
13132 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13133
13134 * testsuite/script_test_4.sh: Permit leading zeroes.
13135
13136 2008-04-15 Ian Lance Taylor <iant@google.com>
13137
13138 * script-sections.cc (Script_sections::create_segments): Use
13139 header_size_adjustment even when there is enough room for the
13140 headers.
13141 * testsuite/script_test_4.sh: New file.
13142 * testsuite/script_test_4.t: New file.
13143 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13144 (check_DATA): Add script_test_4.stdout.
13145 (MOSTLYCLEANFILES): Likewise.
13146 (script_test_4): New target.
13147 (script_test_4.stdout): New target.
13148 * testsuite/Makefile.in: Rebuild.
13149
13150 * sparc.cc: Add definitions for Output_data_plt_sparc class
13151 constants.
13152
13153 2008-04-14 David S. Miller <davem@davemloft.net>
13154
13155 * sparc.cc: New file.
13156 * Makefile.am (TARGETSOURCES): Add sparc.cc
13157 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13158 * configure.tgt: Document targ_extra_size and
13159 targ_extra_big_endian. Add entries for sparc-* and
13160 sparc64-*.
13161 * configure.ac: Handle targ_extra_size and
13162 targ_extra_big_endian.
13163 * Makefile.in: Rebuild.
13164 * configure: Likewise.
13165 * po/POTFILES.in: Likewise.
13166 * po/gold.pot: Likewise.
13167
13168 2008-04-14 Ian Lance Taylor <iant@google.com>
13169
13170 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13171 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13172 in the name/type/flags to section mapping. Don't call
13173 allocate_output_section.
13174 (Layout::choose_output_section): Change parameter from adjust_name
13175 to is_input_section. Don't permit input sections after sections
13176 are attached to segments. Don't call allocate_output_section.
13177 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13178 not write_enable_output_section.
13179 (Layout::make_output_section): Don't push to
13180 unattached_section_list_ nor call attach_to_segment. Call
13181 attach_section_to_segment if sections are attached.
13182 (Layout::attach_sections_to_segments): New function.
13183 (Layout::attach_section_to_segment): New function.
13184 (Layout::attach_allocated_section_to_segment): Rename from
13185 attach_to_segment. Remove flags parameter.
13186 (Layout::allocate_output_section): Remove function.
13187 (Layout::write_enable_output_section): Remove function.
13188 * layout.h (class Layout): Update for above changes. Add new
13189 field sections_are_attached_.
13190 * output.h (Output_section::update_flags_for_input_section): New
13191 function.
13192 * output.cc (Output_section::add_input_section): Call
13193 update_flags_for_input_section.
13194 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13195
13196 2008-04-11 Cary Coutant <ccoutant@google.com>
13197
13198 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13199 thought unnecessary.
13200 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13201
13202 2008-04-11 Ian Lance Taylor <iant@google.com>
13203
13204 * output.h (class Output_section_data): Remove inline definition
13205 of set_addralign.
13206 * output.cc (Output_section_data::set_addralign): New function.
13207
13208 2008-04-11 Cary Coutant <ccoutant@google.com>
13209
13210 Add support for TLS descriptors for i386 and x86_64.
13211 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13212 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13213 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13214 GOT_TYPE_TLS_DESC.
13215 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13216 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13217 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13218 relocations.
13219 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13220 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13221 Fix problem with initial-exec relocations.
13222 (Target_i386::Relocate::relocate_tls): Likewise.
13223 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13224 relaxation.
13225 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13226 support for section-plus-offset dynamic table entries.
13227 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13228 (Output_data_dynamic::Dynamic_entry): Add support for
13229 section-plus-offset dynamic table entries.
13230 (Output_data_dynamic::Classification): Likewise.
13231 (Output_data_dynamic::classification_): Renamed offset_.
13232 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13233 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13234 (Target_x86_64::make_plt_section): New function.
13235 (Target_x86_64::reserve_tlsdesc_entries): New function.
13236 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13237 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13238 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13239 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13240 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13241 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13242 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13243 add extra PLT entry for TLS descriptors.
13244 (Output_data_plt_x86_64::got_): New field.
13245 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13246 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13247 fields.
13248 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13249 descriptors.
13250 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13251 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13252 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13253 R_386_TLS_DESC_CALL relocations.
13254 (Target_x86_64::Scan::global): Likewise.
13255 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13256 for TLS descriptors.
13257 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13258 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13259 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13260 GD-to-IE relaxation.
13261 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13262 and TLS_DESCRIPTORS.
13263 * Makefile.in: Rebuild.
13264 * configure: Rebuild.
13265 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13266 (tls_test_shared2.so): New target.
13267 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13268 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13269 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13270 (tls_shared_gd_to_ie_test_LDADD): New variable.
13271 (tls_shared_gnu2_gd_to_ie_test): New target.
13272 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13273 New targets.
13274 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13275 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13276 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13277 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13278 (tls_shared_gnu2_test): New target.
13279 (tls_test_gnu2_shared.so): New target.
13280 (tls_shared_gnu2_test_SOURCES): New variable.
13281 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13282 (tls_shared_gnu2_test_LDFLAGS): New variable.
13283 (tls_shared_gnu2_test_LDADD): New variable.
13284 * testsuite/Makefile.in: Rebuild.
13285 * testsuite/Makefile.
13286
13287 2008-04-11 Ian Lance Taylor <iant@google.com>
13288
13289 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13290 justsyms.t.
13291 * testsuite/Makefile.in: Rebuild.
13292
13293 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13294 long.
13295 * testsuite/script_test_2.cc (main): Adjust test.
13296
13297 2008-04-11 David S. Miller <davem@davemloft.net>
13298 Ian Lance Taylor <iant@google.com>
13299
13300 * options.h (General_options): Add entries for '-Y' and
13301 '-relax'.
13302 * options.cc (General_options:finalize): If -Y was used, add those
13303 entries to the library path instead of the default "/lib" and
13304 "/usr/lib".
13305
13306 2008-04-11 David S. Miller <davem@davemloft.net>
13307
13308 * testsuite/justsyms.t: Start at 0x100.
13309 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13310 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13311 long.
13312 * testsuite/script_test_2.cc: Adjust string and section length
13313 checks.
13314
13315 2008-04-09 Ian Lance Taylor <iant@google.com>
13316
13317 PR gold/5996
13318 * script-sections.cc (Sections_element::allocate_to_segment): Add
13319 orphan parameter.
13320 (Output_section_definition::allocate_to_segment): Likewise.
13321 (Orphan_output_section::allocate_to_segment): Likewise.
13322 (Script_sections::attach_sections_using_phdrs_clause): Don't
13323 propagate non-PT_LOAD segments to orphan sections.
13324 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13325 readelf rather than objdump.
13326 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13327 .interp section and PT_INTERP segment are the same size.
13328 * testsuite/Makefile.in: Rebuild.
13329
13330 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13331 aliases for symbols defined in the same object.
13332 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13333 (weak_alias_test_SOURCES): New variable.
13334 (weak_alias_test_DEPENDENCIES): New variable.
13335 (weak_alias_test_LDFLAGS): New variable.
13336 (weak_alias_test_LDADD): New variable.
13337 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13338 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13339 (weak_alias_test_3.o): New target.
13340 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13341 * testsuite/weak_alias_test_main.cc: New file.
13342 * testsuite/weak_alias_test_1.cc: New file.
13343 * testsuite/weak_alias_test_2.cc: New file.
13344 * testsuite/weak_alias_test_3.cc: New file.
13345
13346 2008-04-08 Ian Lance Taylor <iant@google.com>
13347
13348 * options.h (class General_options): Add --noinhibit-exec option.
13349 * main.cc (main): Check --noinhibit-exec.
13350
13351 * options.h (class General_options): Define --wrap as a special
13352 option. Add wrap_symbols_ field.
13353 (General_options::any_wrap_symbols): New function.
13354 (General_options::is_wrap_symbol): New function.
13355 * options.cc (General_options::parse_wrap): New function.
13356 (General_options::General_options): Initialize wrap_symbols_.
13357 * symtab.cc (Symbol_table::wrap_symbol): New function.
13358 (Symbol_table::add_from_object): Handle --wrap.
13359 * symtab.h (class Symbol_table): Declare wrap_symbol.
13360 * target.h (Target::wrap_char): New function.
13361 (Target::Target_info): Add wrap_char field.
13362 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13363 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13364 * testsuite/testfile.cc (Target_test::test_target_info):
13365 Likewise.
13366
13367 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13368 there is one.
13369
13370 * layout.h (class Layout): Add added_eh_frame_data_ field.
13371 * layout.cc (Layout::Layout): Initialize new field.
13372 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13373 output section until we find a section we merged successfully.
13374 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13375 that the size be non-zero.
13376
13377 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13378 qualifier.
13379
13380 2008-04-08 Craig Silverstein <csilvers@google.com>
13381
13382 * configure.ac: Export new conditional variable HAVE_ZLIB.
13383 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13384 on HAVE_ZLIB.
13385 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13386 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13387
13388 2008-04-07 Ian Lance Taylor <iant@google.com>
13389
13390 * version.cc (version_string): Set to "1.5".
13391
13392 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13393 Add issued_non_pic_error_ field. Declare check_non_pic.
13394 (Target_x86_64::Scan::check_non_pic): New function.
13395 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13396 (Target_x86_64::Scan::global): Likewise.
13397
13398 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13399 addend parameter. Change caller. Handle merge sections.
13400 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13401 Address to Addend. Don't add in the result of
13402 local_section_offset, pass down the addend and use the returned
13403 value.
13404 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13405 Update declarations of local_section_offset and symbol_value.
13406 * testsuite/two_file_test_1.cc (t18): New function.
13407 * testsuite/two_file_test_2.cc (f18): New function.
13408 * testsuite/two_file_test_main.cc (main): Call t18.
13409 * testsuite/two_file_test.h (t18, f18): Declare.
13410
13411 * configure.ac: Don't test for objdump, c++filt, or readelf.
13412 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13413 conditionals.
13414 (TEST_READELF): New variable.
13415 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13416 (check_PROGRAMS): Add two_file_strip_test.
13417 (two_file_strip_test): New target.
13418 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13419 (two_file_same_shared_strip_test_SOURCES): New variable.
13420 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13421 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13422 (two_file_same_shared_strip_test_LDADD): New variable.
13423 (two_file_shared_strip.so): New target.
13424 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13425 (ver_test_5.syms, ver_test_7.syms): Likewise.
13426 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13427 (strip_test_3.stdout): Use TEST_OBJDUMP.
13428 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13429
13430 2008-04-04 Cary Coutant <ccoutant@google.com>
13431
13432 * symtab.h (Symbol::is_weak_undefined): New function.
13433 (Symbol::is_strong_undefined): New function.
13434 (Symbol::is_absolute): New function.
13435 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13436 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13437 absolute symbols.
13438 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13439 (weak_undef_test): New target.
13440 * testsuite/Makefile.in: Rebuild.
13441 * testsuite/weak_undef_file1.cc: New file.
13442 * testsuite/weak_undef_file2.cc: New file.
13443 * testsuite/weak_undef_test.cc: New file.
13444
13445 2008-04-03 Craig Silverstein <csilvers@google.com>
13446
13447 * compressed_output.h (class Output_compressed_section): Use
13448 unsigned buffer.
13449 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13450 add zlib header.
13451 (zlib_compressed_suffix): Removed.
13452 (Output_compressed_section::set_final_data_size): Use unsigned
13453 buffers.
13454 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13455 Fix linker invocation.
13456 (flagstest_o_specialfile_and_compress_debug_sections):
13457 Likewise.
13458 * testsuite/Makefile.in: Regenerated.
13459
13460 2008-04-02 David S. Miller <davem@davemloft.net>
13461
13462 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13463 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13464
13465 2008-04-02 Craig Silverstein <csilvers@google.com>
13466
13467 * TODO: New file.
13468
13469 2008-04-02 Ian Lance Taylor <iant@google.com>
13470
13471 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13472 parameters. Update for new key type to views_. Change all
13473 callers.
13474 (File_read::read): Adjust for byteshift in returned view.
13475 (File_read::add_view): New function, broken out of
13476 find_and_make_view.
13477 (File_read::make_view): New function, broken out of
13478 find_and_make_view.
13479 (File_read::find_or_make_view): Add offset and aligned
13480 parameters. Rewrite accordingly. Change all callers.
13481 (File_read::get_view): Add offset and aligned parameters. Adjust
13482 for byteshift in return value.
13483 (File_read::get_lasting_view): Likewise.
13484 * fileread.h (class File_read): Update declarations.
13485 (class File_read::View): Add byteshift_ field. Add byteshift to
13486 constructor. Add byteshift method.
13487 * archive.h (Archive::clear_uncached_views): New function.
13488 (Archive::get_view): Add aligned parameter. Change all callers.
13489 * object.h (Object::get_view): Add aligned parameter. Change all
13490 callers.
13491 (Object::get_lasting_view): Likewise.
13492
13493 * fileread.cc (File_read::release): Don't call clear_views if
13494 there are multiple objects.
13495 * fileread.h (File_read::clear_uncached_views): New function.
13496 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13497 on the archive.
13498
13499 2008-03-31 Cary Coutant <ccoutant@google.com>
13500
13501 Add thin archive support.
13502 * archive.cc (Archive::armagt): New const.
13503 (Archive::setup): Remove task parameter and calls to unlock.
13504 (Archive::unlock_nested_archives): New function.
13505 (Archive::read_header): Add nested_off parameter. Change
13506 all callers.
13507 (Archive::interpret_header): Likewise.
13508 (Archive::include_all_members): Change to handle thin
13509 archives.
13510 (Archive::include_member): Likewise.
13511 * archive.h (Archive::Archive): Add new parameters and
13512 initializers.
13513 (Archive::armagt): New const.
13514 (Archive::setup): Remove task parameter.
13515 (Archive::unlock_nested_archives): New function.
13516 (Archive::read_header): Add nested_off parameter.
13517 (Archive::interpret_header): Likewise.
13518 (Archive::Nested_archive_table): New typedef.
13519 (Archive::is_thin_archive_): New field.
13520 (Archive::nested_archives_): New field.
13521 (Archive::options_): New field.
13522 (Archive::dirpath_): New field.
13523 (Archive::task_): New field.
13524 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13525 for thin archives. Pass additional parameters to
13526 Archive::Archive. Unlock the archive file after calling
13527 Archive::setup.
13528
13529 2008-03-29 Ian Lance Taylor <iant@google.com>
13530
13531 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13532 version symbol to be local.
13533 * testsuite/ver_test_4.sh: New file.
13534 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13535 (check_DATA): Add ver_test_4.syms.
13536 (ver_test_4.syms): New target.
13537 * testsuite/Makefile.in: Rebuild.
13538
13539 * output.cc
13540 (Output_section::Input_section_sort_entry::has_priority): New
13541 function.
13542 (Output_section::Input_section_sort_entry::match_file_name): New
13543 function.
13544 (Output_section::Input_section_sort_entry::match_section_name):
13545 Remove.
13546 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13547 Remove.
13548 (Output_section::Input_section_sort_entry::match_section_file):
13549 Remove.
13550 (Output_section::Input_section_sort_compare::operator()): Rewrite
13551 using new Input_section_sort_entry functions. Sort crtbegin and
13552 crtend first. Sort sections with no priority before sections with
13553 a priority.
13554 * testsuite/initpri1.c (d3): Check j != 4.
13555 (cd5): New constructor/destructor function.
13556 (main): Check j != 2.
13557
13558 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13559 new symbol when resolving, don't call set_is_default.
13560 * testsuite/ver_test_7.cc: New file.
13561 * testsuite/ver_test_7.sh: New file.
13562 * testsuite/Makefile.am (ver_test_7.so): New target.
13563 (ver_test_7.o): New target.
13564 (check_SCRIPTS): Add ver_test_7.sh.
13565 (check_DATA): Add ver_test_7.syms.
13566 (ver_test_7.syms): New target.
13567
13568 2008-03-28 Ian Lance Taylor <iant@google.com>
13569
13570 * layout.cc (Layout::layout): If we see an input section with a
13571 name that needs sorting, set the must_sort flag for the output
13572 section.
13573 (Layout::make_output_section): If the name of the output section
13574 indicates that it might require sorting, set the may_sort flag.
13575 * output.h (Output_section::may_sort_attached_input_sections): New
13576 function.
13577 (Output_section::set_may_sort_attached_input_sections): New
13578 function.
13579 (Output_section::must_sort_attached_input_sections): New
13580 function.
13581 (Output_section::set_must_sort_attached_input_sections): New
13582 function.
13583 (class Output_section): Declare Input_section_sort_entry. Define
13584 Input_section_sort_compare. Declare
13585 sort_attached_input_sections. Add new fields:
13586 may_sort_attached_input_sections_,
13587 must_sort_attached_input_sections_,
13588 attached_input_sections_are_sorted_.
13589 * output.cc (Output_section::Output_section): Initialize new
13590 fields.
13591 (Output_section::add_input_section): Add an entry to
13592 input_sections_ if may_sort or must_sort are true.
13593 (Output_section::set_final_data_size): Call
13594 sort_attached_input_sections if necessary.
13595 (Output_section::Input_section_sort_entry): Define new class.
13596 (Output_section::Input_section_sort_compare::operator()): New
13597 function.
13598 (Output_section::sort_attached_input_sections): New function.
13599 * configure.ac: Check whether the compiler supports constructor
13600 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13601 * testsuite/initpri1.c: New file.
13602 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13603 CONSTRUCTOR_PRIORITY.
13604 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13605 (initpri1_LDFLAGS): New variable.
13606 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13607
13608 2008-03-27 Ian Lance Taylor <iant@google.com>
13609
13610 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13611 * testsuite/common_test_1.c: New file.
13612 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13613 (common_test_1_SOURCES): New variable.
13614 (common_test_1_DEPENDENCIES): New variable.
13615 (common_test_1_LDFLAGS): New variable.
13616
13617 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13618 and commons_ correctly when NAME/VERSION does not override
13619 NAME/NULL.
13620 * testsuite/ver_test_6.c: New file.
13621 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13622 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13623 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13624
13625 2008-03-26 Ian Lance Taylor <iant@google.com>
13626
13627 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13628 of an undefined symbol from a version script.
13629 * testsuite/Makefile.am (ver_test_5.so): New target.
13630 (ver_test_5.o): New target.
13631 (check_SCRIPTS): Add ver_test_5.sh.
13632 (check_DATA): Add ver_test_5.syms.
13633 (ver_test_5.syms): New target.
13634 * testsuite/ver_test_5.cc: New file.
13635 * testsuite/ver_test_5.script: New file.
13636 * testsuite/ver_test_5.sh: New file.
13637 * Makefile.in, testsuite/Makefile.in: Rebuild.
13638
13639 PR gold/5986
13640 Fix problems building gold with gcc 4.3.0.
13641 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13642 (gold_error_at_location, gold_warning_at_location): Use it.
13643 * configure.ac: Check whether we can compile and use a template
13644 function with a printf attribute.
13645 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13646 when jumping over bytes.
13647 * object.cc: Instantiate Object::read_section_data.
13648 * debug.h: Include <cstring>
13649 * dwarf_reader.cc: Include <algorithm>
13650 * main.cc: Include <cstring>.
13651 * options.cc: Include <cstring>.
13652 * output.cc: Include <cstring>.
13653 * script.cc: Include <cstring>.
13654 * script.h: Include <string>.
13655 * symtab.cc: Include <cstring> and <algorithm>.
13656 * target-select.cc: Include <cstring>.
13657 * version.cc: Include <string>.
13658 * testsuite/testmain.cc: Include <cstdlib>.
13659 * configure, config.in: Rebuild.
13660
13661 2008-03-25 Ian Lance Taylor <iant@google.com>
13662
13663 * options.cc: Include "../bfd/bfdver.h".
13664 (options::help): Print bug reporting address.
13665
13666 * version.cc (print_version): Adjust output for current value of
13667 BFD_VERSION_STRING.
13668
13669 * NEWS: New file.
13670
13671 * options.cc (options::help): Print list of supported targets.
13672 * target-select.h: Include <vector>.
13673 (class Target_selector): Make machine_, size_, and is_big_endian_
13674 fields const. Add bfd_name_ and instantiated_target_ fields.
13675 (Target_selector::Target_selector): Add bfd_name parameter.
13676 (Target_selector::recognize): Make non-virtual, call
13677 do_recognize.
13678 (Target_selector::recognize_by_name): Make non-virtual, call
13679 do_recognize_by_name.
13680 (Target_selector::supported_names): New function.
13681 (Target_selector::bfd_name): New function.
13682 (Target_selector::do_instantiate_target): New pure virtual
13683 function.
13684 (Target_selector::do_recognize): New virtual function.
13685 (Target_selector::do_recognize_by_name): New virtual function.
13686 (Target_selector::instantiate_target): New private function.
13687 (supported_target_names): Declare.
13688 * target-select.cc (Target_selector::Target_selector): Update for
13689 new parameter and fields.
13690 (select_target_by_name): Check that the name matches before
13691 calling recognize_by_name.
13692 (supported_target_names): New function.
13693 * i386.cc (class Target_selector_i386): Update Target_selector
13694 constructor call. Remove recognize and recognize_by_name. Add
13695 do_instantiate_target.
13696 * x86_64.cc (class Target_selector_x86_64): Likewise.
13697 * testsuite/testfile.cc (class Target_selector_test): Update for
13698 changes to Target_selector.
13699
13700 * README: Rewrite, with some notes on unsupported features.
13701
13702 2008-03-24 Cary Coutant <ccoutant@google.com>
13703
13704 * i386.cc (Target_i386::Got_type): New enum declaration.
13705 (Target_i386::Scan::local): Updated callers of Output_data_got
13706 member functions.
13707 (Target_i386::Scan::global): Likewise.
13708 (Target_i386::Relocate::relocate): Likewise.
13709 (Target_i386::Relocate::relocate_tls): Likewise.
13710 * object.h (Got_offset_list): New class.
13711 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13712 (Sized_relobj::local_got_offset): Likewise.
13713 (Sized_relobj::set_local_got_offset): Likewise.
13714 (Sized_relobj::local_has_tls_got_offset): Removed.
13715 (Sized_relobj::local_tls_got_offset): Removed.
13716 (Sized_relobj::set_local_tls_got_offset): Removed.
13717 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13718 * output.cc (Output_data_got::add_global): Added got_type parameter.
13719 (Output_data_got::add_global_with_rel): Likewise.
13720 (Output_data_got::add_global_with_rela): Likewise.
13721 (Output_data_got::add_global_pair_with_rel): New function.
13722 (Output_data_got::add_global_pair_with_rela): New function.
13723 (Output_data_got::add_local): Added got_type parameter.
13724 (Output_data_got::add_local_with_rel): Likewise.
13725 (Output_data_got::add_local_with_rela): Likewise.
13726 (Output_data_got::add_local_pair_with_rel): New function.
13727 (Output_data_got::add_local_pair_with_rela): New function.
13728 (Output_data_got::add_global_tls): Removed.
13729 (Output_data_got::add_global_tls_with_rel): Removed.
13730 (Output_data_got::add_global_tls_with_rela): Removed.
13731 (Output_data_got::add_local_tls): Removed.
13732 (Output_data_got::add_local_tls_with_rel): Removed.
13733 (Output_data_got::add_local_tls_with_rela): Removed.
13734 * output.h (Output_data_got::add_global): Added got_type parameter.
13735 (Output_data_got::add_global_with_rel): Likewise.
13736 (Output_data_got::add_global_with_rela): Likewise.
13737 (Output_data_got::add_global_pair_with_rel): New function.
13738 (Output_data_got::add_global_pair_with_rela): New function.
13739 (Output_data_got::add_local): Added got_type parameter.
13740 (Output_data_got::add_local_with_rel): Likewise.
13741 (Output_data_got::add_local_with_rela): Likewise.
13742 (Output_data_got::add_local_pair_with_rel): New function.
13743 (Output_data_got::add_local_pair_with_rela): New function.
13744 (Output_data_got::add_global_tls): Removed.
13745 (Output_data_got::add_global_tls_with_rel): Removed.
13746 (Output_data_got::add_global_tls_with_rela): Removed.
13747 (Output_data_got::add_local_tls): Removed.
13748 (Output_data_got::add_local_tls_with_rel): Removed.
13749 (Output_data_got::add_local_tls_with_rela): Removed.
13750 * resolve.cc (Symbol::override_base_with_special): Removed
13751 reference to has_got_offset_ field.
13752 * symtab.cc (Symbol::init_fields): Replaced initialization
13753 of got_offset_ with got_offsets_. Removed initialization
13754 of has_got_offset_
13755 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13756 (Symbol::got_offset): Likewise.
13757 (Symbol::set_got_offset): Likewise.
13758 (Symbol::has_tls_got_offset): Removed.
13759 (Symbol::tls_got_offset): Removed.
13760 (Symbol::set_tls_got_offset): Removed.
13761 (Symbol::got_offset_): Removed.
13762 (Symbol::tls_mod_got_offset_): Removed.
13763 (Symbol::tls_pair_got_offset_): Removed.
13764 (Symbol::got_offsets_): New field.
13765 (Symbol::has_got_offset): Removed.
13766 (Symbol::has_tls_mod_got_offset): Removed.
13767 (Symbol::has_tls_pair_got_offset): Removed.
13768 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13769 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13770 member functions.
13771 (Target_x86_64::Scan::global): Likewise.
13772 (Target_x86_64::Relocate::relocate): Likewise.
13773 (Target_x86_64::Relocate::relocate_tls): Likewise.
13774
13775 2008-03-25 Ben Elliston <bje@au.ibm.com>
13776
13777 * yyscript.y: Fix spelling error in comment.
13778
13779 2008-03-24 Ian Lance Taylor <iant@google.com>
13780
13781 * options.h (class General_options): Define build_id option.
13782 * layout.h (class Layout): Declare write_build_id, create_note,
13783 create_build_id. Add build_id_note_ member.
13784 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13785 "libiberty.h", "md5.h", "sha1.h".
13786 (Layout::Layout): Initialize eh_frame_data_,
13787 eh_frame_hdr_section_, and build_id_note_.
13788 (Layout::finalize): Call create_build_id.
13789 (Layout::create_note): New function, broken out of
13790 Layout::create_gold_note.
13791 (Layout::create_gold_note): Call create_note.
13792 (Layout::create_build_id): New function.
13793 (Layout::write_build_id): New function.
13794 (Close_task_runner::run): Call write_build_id.
13795
13796 * x86_64.cc: Correct license to GPLv3.
13797
13798 2008-03-23 Ian Lance Taylor <iant@google.com>
13799
13800 * options.cc: Include "demangle.h".
13801 (parse_optional_string): New function.
13802 (parse_long_option): Handle takes_optional_argument.
13803 (parse_short_option): Update dash_z initializer. Handle
13804 takes_optional_argument.
13805 (General_options::General_options): Initialize do_demangle_.
13806 (General_options::finalize): Set do_demangle_. Handle demangling
13807 style.
13808 * options.h (parse_optional_string): Declare.
13809 (struct One_option): Add optional_arg field. Update constructor.
13810 Update call constructor calls. Add takes_optional_argument
13811 function.
13812 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13813 (DEFINE_optional_string): Define.
13814 (General_options::demangle): Change from DEFINE_bool to
13815 DEFINE_optional_string.
13816 (General_options::no_demangle): New function.
13817 (General_options::do_demangle): New function.
13818 (General_options::set_do_demangle): New function.
13819 (General_options::execstack_status_): Move definition to end of
13820 class definition.
13821 (General_options::static_): Likewise.
13822 (General_options::do_demangle_): New field.
13823 * object.cc (big_endian>::get_symbol_location_info): Call
13824 Options::do_demangle, not Options::demangle.
13825 * symtab.cc (demangle): Likewise.
13826
13827 2008-03-22 Ian Lance Taylor <iant@google.com>
13828
13829 * gold.h: Include <cstddef> and <sys/types.h>
13830 * options.h: Include <cstring>.
13831
13832 2008-03-21 Ian Lance Taylor <iant@google.com>
13833
13834 * Added source code to GNU binutils.