2012-10-16 Sriraman Tallam <tmsriram@google.com>
[binutils-gdb.git] / gold / ChangeLog
1 2012-10-16 Sriraman Tallam <tmsriram@google.com>
2
3 * layout.cc (Layout::include_section): Keep sections marked
4 SHF_EXCLUDE when doing relocatable links.
5
6 2012-10-16 Alan Modra <amodra@gmail.com>
7
8 * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
9 (Target_powerpc::do_finalize_sections): Call it.
10 (Output_data_save_res): New class and supporting functions.
11 (Target_powerpc::symval_for_branch): Only look up .opd entry for
12 normal symbols defined in object files.
13
14 2012-10-12 Alan Modra <amodra@gmail.com>
15
16 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
17 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
18 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
19 section if scan_opd_relocs not yet called.
20 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
21
22 2012-10-12 Alan Modra <amodra@gmail.com>
23
24 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
25 add_local_ifunc_entry): Revert last change.
26 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
27
28 2012-10-05 Alan Modra <amodra@gmail.com>
29
30 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
31 do_plt_address_for_global): New functions.
32 (Output_data_got_powerpc::do_write): Don't segfault when linking
33 statically.
34 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
35 add_local_ifunc_entry): Return true on adding entry..
36 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
37 glink->add_entry call. Remove unused symtab param. Adjust calls.
38 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
39 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
40 set up symbols here.
41 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
42 syms here. Do so even when no .iplt. Don't segfault when linking
43 statically.
44 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
45 new variants without reloc param.
46 (Glink_sym_ent::Glink_sym_ent): Likewise.
47 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
48 reloc when refs will resolve to plt call stub.
49 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
50 R_PPC_PLTREL24 to resolve locally.
51 (Target_powerpc::Scan::global): Correct ifunc handling.
52 (Target_powerpc::Relocate::relocate): Correct local sym glink
53 lookup. Don't destroy "value" when we have a plt call stub,
54 and when checking plt call validity.
55 (Target_powerpc::do_dynsym_value): Simplify.
56
57 2012-10-05 Alan Modra <amodra@gmail.com>
58
59 * i386.cc (Output_data_plt_i386::address_for_global,
60 address_for_local): Add plt offset to returned value. Adjust uses.
61 * sparc.cc (Output_data_plt_sparc::address_for_global,
62 address_for_local): Likewise.
63 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
64 address_for_local): Likewise.
65 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
66 address_for_local): Likewise.
67 * target.h (Target::plt_address_for_global, plt_address_for_local):
68 Update comment.
69 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
70 (Output_data_got::Got_entry::write): Nor here.
71 * output.h: Comment fix.
72
73 2012-10-02 Jiong Wang <jiwang@tilera.com>
74
75 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
76 global_offset_table_ value for larget got.
77 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
78
79 2012-09-29 Alan Modra <amodra@gmail.com>
80
81 * powerpc.cc (Target_powerpc::iplt_): New output section.
82 (Target_powerpc::iplt_section, make_iplt_section,
83 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
84 (Target_powerpc::make_plt_entry): Handle ifunc syms.
85 Target_powerpc::plt_entry_count): Count iplt entries too.
86 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
87 reloc section in constructor. New params.
88 (Target_powerpc::make_plt_section): Create reloc section here instead.
89 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
90 functions.
91 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
92 (Output_data_glink::add_entry, find_entry): New functions to
93 deal with local syms.
94 (Glink_sym_ent): Add support for local syms.
95 (Output_data_glink::do_write): Handle ifunc plt entries.
96 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
97 (Target_powerpc::Scan::local, global): Handle ifunc syms.
98 (Target_powerpc::Relocate::relocate): Likewise.
99 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
100
101 2012-09-25 Alan Modra <amodra@gmail.com>
102
103 * object.h (Sized_relobj_file::adjust_local_symbol,
104 do_adjust_local_symbol): New functions.
105 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
106 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
107 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
108 and irregular opd entry spacing.
109 (Powerpc_relobj::do_read_relocs): Add opd size checks.
110 (Global_symbol_visitor_opd): New functor.
111 (Target_powerpc::do_finalize_sections): Omit global symbols defined
112 on deleted opd entries.
113
114 2012-09-15 Jiong Wang <jiwang@tilera.com>
115
116 * tilegx.cc: New file.
117 * Makefile.am (TARGETSOURCES): Add tilegx.cc
118 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
119 * configure.tgt: Add entries for tilegx*.
120 * configure.ac: Likewise.
121 * Makefile.in: Rebuild.
122 * configure: Likewise.
123 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
124 tilegx.
125
126 2012-09-13 Alan Modra <amodra@gmail.com>
127
128 * target-reloc.h (scan_relocs): Call scan.local for relocs
129 against symbols in discarded sections. Pass is_discarded
130 param.
131 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
132 Add is_discarded param.
133 * powerpc (Target_powerpc::Scan::local): Likewise. Use
134 is_discarded to flag opd entry as discarded. Don't emit dyn
135 relocs on such entries.
136 (Target_powerpc::Scan::global): Similarly detect and handle
137 such opd entries.
138 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
139 opd_ent_. Update all uses.
140 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
141 (Target_powerpc::relocate_section): Zero out discarded opd
142 entry relocs.
143
144 2012-09-12 Ian Lance Taylor <iant@google.com>
145
146 PR gold/14570
147 * output.cc: Rename Output_data_got template parameter from size
148 to got_size for all functions. Compile all variants of
149 Output_data_got.
150 (Output_data_got::Got_entry::write): Correct use of size for
151 symbol value. Use local_is_tls rather than casting to
152 Sized_relobj_file.
153 * object.h (class Object): Add local_is_tls and do_local_is_tls.
154 (class Sized_relobj_file): Add do_local_is_tls.
155 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
156
157 2012-09-11 Alan Modra <amodra@gmail.com>
158
159 PR gold/14566
160 * layout.cc (Layout::set_segment_offsets): When using
161 common-page-size alignment, ensure we are on a new max-page-size
162 page.
163 * output.cc (Output_segment::set_section_addresses): Use
164 abi_pagesize, not common_pagesize for relro boundary.
165 (Output_segment::set_offset): Likewise.
166
167 2012-09-11 Alan Modra <amodra@gmail.com>
168
169 * output.h (Output_data_got::add_global_tls, add_local_tls,
170 add_local_tls_pair): New functions.
171 (Output_data_got::add_local_pair_with_rel): Remove second
172 reloc param. Expand comment.
173 (Output_data_got::Got_entry): Rename use_plt_offset_ to
174 use_plt_or_tls_offset_, similarly for constructor param.
175 (Output_data_got::Got_entry::write): Add got_index param.
176 * output.cc (Output_data_got::add_global_tls, add_local_tls,
177 add_local_tls_pair): New functions.
178 (Output_data_got::Got_entry::write): Handle tls symbols
179 with use_plt_or_tls_offset_ set specially.
180 (Output_data_got::add_local_pair_with_rel): Only one reloc.
181 (Output_data_got::do_write): Replace iterator with index, pass
182 index to entry write function.
183 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
184 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
185 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
186 call.
187 * i386.cc (Target_i386::Scan::local): Likewise.
188 * sparc.cc (Target_sparc::Scan::local): Likewise.
189 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
190 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
191 do_tls_offset_for_global): New functions.
192 (Target_powerpc::Scan::local): Correct TLS relocations and got
193 entry values.
194 (Target_powerpc::Scan::global): Don't emit unnecessary
195 dynamic relocations on TLS GOT entries.
196
197 2012-09-10 Matthias Klose <doko@ubuntu.com>
198
199 * config.in: Disable sanity check for kfreebsd.
200
201 2012-09-10 Sterling Augustine <saugustine@google.com>
202
203 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
204 (Gdb_index::pubtypes_read): New parameter.
205 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
206 to calls.
207 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
208 pubtypes_object_.
209
210 2012-09-09 Alan Modra <amodra@gmail.com>
211
212 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
213 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
214 * gc.h (gc_process_relocs): Call target gc_add_reference.
215 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
216 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
217 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
218 unnecessary cast.
219 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
220 to cater for when we don't need code offset. Update use.
221 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
222 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
223 set_opd_valid): New functions.
224 (Target_powerpc::do_gc_add_reference): New function.
225 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
226 stashed refs.
227 (Target_powerpc::do_gc_mark_symbol): New function.
228
229 2012-09-06 Cary Coutant <ccoutant@google.com>
230
231 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
232 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
233 (Dwarf_die::skip_attributes): Likewise.
234 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
235 * testsuite/gdb_index_test.cc (inline_func_1): New function.
236 (main): Call it.
237 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
238
239 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
240
241 * testsuite/script_test_3.t: Add .got.plt output section
242 statement.
243 * testsuite/script_test_4.t: Likewise.
244
245 2012-09-05 Alan Modra <amodra@gmail.com>
246
247 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
248 update all uses and lose "enum" when using type.
249
250 2012-09-05 Alan Modra <amodra@gmail.com>
251
252 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
253 * configure: Regenerate.
254 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
255 (plugin_final_layout.stdout): Likewise.
256 (memory_test): Set page sizes to 0x1000.
257 * testsuite/Makefile.in: Regenerate.
258 * testsuite/discard_locals_test.sh: Add FIXME comment.
259 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
260 * testsuite/pr14265.t: Add .got output section statement.
261 * testsuite/script_test_2.t: Likewise.
262 * testsuite/script_test_3.t: Likewise.
263 * testsuite/script_test_4.t: Likewise.
264 * testsuite/script_test_5.t: Likewise.
265 * testsuite/script_test_6.t: Likewise.
266 * testsuite/script_test_7.t: Likewise.
267 * testsuite/script_test_9.t: Likewise.
268
269 2012-09-05 Alan Modra <amodra@gmail.com>
270
271 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
272 (Powerpc_relocate_functions::Status): New typedef.
273 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
274 (Target_powerpc::Scan::local): Handle REL64.
275 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
276 for REL32 and REL64.
277 (Target_powerpc::symval_for_branch): New function, extracted from..
278 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
279 checks. Report overflow errors.
280
281 2012-09-05 Alan Modra <amodra@gmail.com>
282
283 * object.h (Sized_relobj_file::emit_relocs): Delete.
284 (Sized_relobj_file::emit_relocs_reltype): Delete.
285 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
286 relocate_relocs for --emit-relocs.
287 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
288 * output.h: Update comment.
289 (Output_segment::first_section): New function.
290 (Output_segment::first_section_load_address): Use first_section.
291 * output.cc (Output_segment::first_section): New function extracted..
292 (Output_segment::first_section_load_address): ..from here. Delete.
293 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
294 * target.h (Sized_target::relocate_for_relocatable): Likewise.
295 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
296 adjust call to target.h function.
297 * i386.cc (Target_i386): Likewise.
298 * sparc.cc (Target_sparc): Likewise.
299 * x86_64.cc (Target_x86_64): Likewise.
300 * powerpc.cc (Target_powerpc): Likewise.
301 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
302 first tls section has section symbol for optimised local dynamic
303 output relocs.
304 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
305 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
306 optimised tls code.
307 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
308 Rename to relocate_relocs. Update error message.
309
310 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
311
312 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
313 --just-symbols.
314
315 2012-08-31 Alan Modra <amodra@gmail.com>
316
317 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
318 (Powerpc_relobj::toc_base_offset): New stub function.
319 (Target_powerpc): Add tp_offset, dtp_offset. Rename
320 got_mod_index_offset to tlsld_got_offset. Update all refs.
321 (Target_powerpc::Relocate::enum skip_tls): New.
322 (Target_powerpc::call_tls_get_addr_): New var.
323 (Target_powerpc::is_branch_reloc): Move to file scope.
324 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
325 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
326 New functions.
327 (Target_powerpc::enum Got_type): Delete old values, add new ones.
328 (powerpc_info): Correct common_pagesize for ppc64.
329 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
330 (Powerpc_relocate_functions): Add overflow check enums and functions.
331 Add non-shift version of rela, rela_ua. Delete all rel public
332 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
333 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
334 addr16_ha3, addr14 functions.
335 (Output_data_got_powerpc::add_constant_pair): New function.
336 (Output_data_got_powerpc::got_base_offset): Likewise.
337 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
338 (instruction constants): Sort, add some more.
339 (Output_data_glink::do_write): Add and use Address typedef. Use
340 object->toc_base_offset() stub for 64-bit.
341 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
342 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
343 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
344 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
345 Always treat .opd relocs as against locally defined symbol.
346 Correct condition for RELATIVE relocs.
347 (Target_powerpc::do_finalize_sections): Test for NULL sections.
348 (Target_powerpc::Relocate::relocate): Use plt call stub as value
349 for 32-bit syms with a plt entry. Correct ppc64 toc base
350 calculations. Handle TLS relocs, and more. Add overflow
351 checking and adjust for Powerpc_relocate_functions changes.
352 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
353 Reinstate --emit-relocs code with FIXME.
354
355 2012-08-30 Alan Modra <amodra@gmail.com>
356
357 * layout.cc (Layout::set_segment_offsets): Set p_align to
358 abi_pagesize, not common_pagesize.
359 (Layout::relaxation_loop_body): Similarly use abi_pagesize
360 to determine whether file header can go in segment.
361
362 2012-08-30 Alan Modra <amodra@gmail.com>
363
364 * output.h (Output_reloc::Output_reloc <output section>): Add
365 is_relative param. Adjust calls.
366 (Output_reloc::add_output_section_relative): New functions.
367 * output.cc (Output_reloc::Output_reloc <output section>): Handle
368 is_relative.
369 (Output_reloc::symbol_value): Handle SECTION_CODE.
370
371 2012-08-24 Sriraman Tallam <tmsriram@google.com>
372
373 * gold.cc (queue_middle_tasks): Call layout again when unique
374 segments for sections is desired.
375 * layout.cc (Layout::Layout): Initialize new members.
376 (Layout::get_output_section_flags): New function.
377 (Layout::choose_output_section): Call get_output_section_flags.
378 (Layout::layout): Make output section for mapping to a unique segment.
379 (Layout::insert_section_segment_map): New function.
380 (Layout::attach_allocated_section_to_segment): Make unique segment for
381 output sections marked so.
382 (Layout::segment_precedes): Check for unique segments when sorting.
383 * layout.h (Layout::Unique_segment_info): New struct.
384 (Layout::Section_segment_map): New typedef.
385 (Layout::insert_section_segment_map): New function.
386 (Layout::get_output_section_flags): New function.
387 (Layout::is_unique_segment_for_sections_specified): New function.
388 (Layout::set_unique_segment_for_sections_specified): New function.
389 (Layout::unique_segment_for_sections_specified_): New member.
390 (Layout::section_segment_map_): New member.
391 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
392 Rename is_gc_pass_one to is_pass_one.
393 Rename is_gc_pass_two to is_pass_two.
394 Rename is_gc_or_icf to is_two_pass.
395 Check for which pass based on whether symbols data is present.
396 Make it two pass when unique segments for sections is desired.
397 * output.cc (Output_section::Output_section): Initialize new
398 members.
399 * output.h (Output_section::is_unique_segment): New function.
400 (Output_section::set_is_unique_segment): New function.
401 (Output_section::is_unique_segment_): New member.
402 (Output_section::extra_segment_flags): New function.
403 (Output_section::set_extra_segment_flags): New function.
404 (Output_section::extra_segment_flags_): New member.
405 (Output_section::segment_alignment): New function.
406 (Output_section::set_segment_alignment): New function.
407 (Output_section::segment_alignment_): New member.
408 (Output_segment::Output_segment): Initialize is_unique_segment_.
409 (Output_segment::is_unique_segment): New function.
410 (Output_segment::set_is_unique_segment): New function.
411 (Output_segment::is_unique_segment_): New member.
412 * plugin.cc (allow_unique_segment_for_sections): New function.
413 (unique_segment_for_sections): New function.
414 (Plugin::load): Add new functions to transfer vector.
415 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
416 * Makefile.in: Regenerate.
417 * testsuite/plugin_final_layout.sh: Check if unique segment
418 functionality works.
419 * testsuite/plugin_section_order.c (onload): Check if new interfaces
420 are available.
421 (allow_unique_segment_for_sections): New global.
422 (unique_segment_for_sections): New global.
423 (claim_file_hook): Call allow_unique_segment_for_sections.
424 (all_symbols_read_hook): Call unique_segment_for_sections.
425
426 2012-08-22 Cary Coutant <ccoutant@google.com>
427
428 * layout.cc (Layout::include_section): Don't assert on GROUP
429 sections with --emit-relocs.
430
431 2012-08-21 Cary Coutant <ccoutant@google.com>
432
433 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
434 if --export-dynamic-symbol names an undef symbol.
435
436 2012-08-18 Alan Modra <amodra@gmail.com>
437
438 * powerpc.cc: Formatting and white space.
439 (Powerpc_relobj): Rename got2_section_ to special_.
440 Add opd_ent_shndx_ and opd_ent_off_ vectors.
441 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
442 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
443 (Target_powerpc): Add Address typedef and invalid_address. Use
444 throughout.
445 (Target_powerpc::is_branch_reloc): New function.
446 (Powerpc_relocate_functions): Add Address typedef, use throughout.
447 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
448 for dst_mask, value and addend.
449 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
450 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
451 (Output_data_glink::do_write): Correct toc base. Don't try to use
452 uint16_t for 24-bit offset. Use get_output_section_offset and
453 check return.
454 (Target_powerpc::Scan::local): Handle more relocs.
455 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
456 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
457 Plug in toc restoring insn after plt calls. Translate branches
458 to function descriptor symbols to corresponding entry point.
459 (Target_powerpc::relocate_for_relocatable): Check return from
460 get_output_section_offset.
461 * symtab.h: Comment typo.
462
463 2012-08-14 Ian Lance Taylor <iant@google.com>
464
465 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
466 unsupported_relocal_local to call unsupported_reloc_global.
467
468 2012-08-14 Nick Clifton <nickc@redhat.com>
469
470 PR ld/14265
471 * script-sections.cc (Sections_element::output_section_name): Add
472 keep return parameter.
473 (Output_section_element::match_name): Add keep return parameter.
474 Return the value of the keep_ member.
475 * script-sections.h (class Output_section): Update
476 output_section_name prototype.
477 * layout.cc (Layout::keep_input_section): New public member
478 function.
479 (Layout::choose_output_section): Pass keep parameter to
480 output_section_name.
481 * layout.h (class Layout): Add keep_input_section.
482 * object.cc (Sized_relobj_file::do_layout): Check for kept input
483 sections.
484 * testsuite/Makefile.am: Add a test.
485 * testsuite/Makefile.in: Regenerate.
486 * testsuite/pr14265.c: Source file for the test.
487 * testsuite/pr14265.t: Linker script for the test.
488 * testsuite/pr14265.sh: Shell script for the test.
489
490 2012-08-14 Alan Modra <amodra@gmail.com>
491
492 * target.h (Target::output_section_name): New function.
493 (Target::do_output_section_name): New function.
494 * layout.cc (Layout::choose_output_section): Call the above.
495 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
496
497 2012-08-14 Alan Modra <amodra@gmail.com>
498
499 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
500 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
501 for replace_constant call.
502 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
503 (Output_data_glink::do_print_to_mapfile): New function.
504 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
505 (Target_powerpc::Relocate::relocate): Likewise.
506
507 2012-08-14 Alan Modra <amodra@gmail.com>
508
509 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
510 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
511 (Output_data_glink::add_entry,find_entry): Remove shndx param.
512 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
513 all references to shndx_. Handle special case for R_PPC_PLTREL24
514 here.
515 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
516 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
517 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
518 here.
519 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
520 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
521
522 2012-08-12 Alan Modra <amodra@gmail.com>
523
524 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
525 (glink insn constants): Use uint32_t.
526 (Output_data_glink::add_entry): Use insert, not [] operator.
527
528 2012-08-11 Alan Modra <amodra@gmail.com>
529
530 * object.h (Sized_relobj_file::find_shdr): New function.
531 (Sized_relobj_file::find_special_sections): New function.
532 * object.cc (Sized_relobj_file::find_shdr): New function.
533 (Sized_relobj_file::find_eh_frame): Use find_shdr.
534 (Sized_relobj_file::find_special_sections): New function, split out..
535 (Sized_relobj_file::do_read_symbols): ..from here.
536 * output.h (Output_data_got::replace_constant): New function.
537 (Output_data_got::num_entries): New function.
538 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
539 (Output_data_got::got_offset): Protected rather than private.
540 (Output_data_got::replace_got_entry): New function.
541 * output.cc (Output_data_got::replace_got_entry): New function.
542 * powerpc.cc (class Powerpc_relobj): New.
543 (class Powerpc_relocate_functions): Delete all psymval variants or
544 convert to value,addend type. Delete pcrela, pcrela_unaligned.
545 Implement _ha functions using corresponding _hi function.
546 (Powerpc_relobj::find_special_sections): New function.
547 (Target_powerpc::do_make_elf_object): New function.
548 (class Output_data_got_powerpc): New.
549 (class Output_data_glink): New.
550 (class Powerpc_scan_relocatable_reloc): New.
551 Many more changes througout file.
552
553 2012-08-09 Nick Clifton <nickc@redhat.com>
554
555 * po/vi.po: Updated Vietnamese translation.
556
557 2012-08-07 Ian Lance Taylor <iant@google.com>
558
559 * layout.cc (Layout::add_target_dynamic_tags): If
560 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
561 plt_rel.
562
563 2012-07-30 Nick Clifton <nickc@redhat.com>
564
565 * po/gold.pot: Updated template.
566 * po/es.po: Updated Spanish translation.
567
568 2012-07-18 Cary Coutant <ccoutant@google.com>
569
570 PR gold/14344
571 * configure.ac: Add check for -gpubnames support.
572 * configure: Regenerate.
573 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
574 support; force -gno-pubnames.
575 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
576 support.
577 (gdb_index_test_4): New test.
578 * testsuite/Makefile.in: Regenerate.
579 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
580 * testsuite/gdb_index_test_2.sh: Likewise.
581 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
582 * testsuite/gdb_index_test_4.sh: New script.
583 * testsuite/gdb_index_test_comm.sh: New script with common code;
584 don't look for space after colon.
585
586 2012-07-16 Sriraman Tallam <tmsriram@google.com>
587
588 * gold.cc (queue_middle_tasks): Update function order only after
589 deferred objects due to plugins are processed.
590
591 2012-07-11 Ian Lance Taylor <iant@google.com>
592
593 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
594 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
595 (Target_arm::scan_reloc_for_stub): Likewise.
596 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
597 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
598 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
599 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
600 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
601
602 2012-07-10 Dodji Seketeli <dodji@redhat.com>
603 Ian Lance Taylor <iant@google.com>
604
605 PR gold/14309
606 * configure.ac: Test whether std::tr1::hash<off_t> works.
607 * gold.h: Add a specialization for std::tr1::hash<off_t> if
608 needed.
609 * output.h (class Output_fill): Add virtual destructor.
610 * configure, config.in: Rebuild.
611
612 2012-06-22 Roland McGrath <mcgrathr@google.com>
613
614 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
615
616 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
617
618 * plugin.cc (Plugin::load): Handle position independent executables.
619
620 2012-06-06 Cary Coutant <ccoutant@google.com>
621
622 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
623 add .debug_macro.
624 (lines_only_debug_sections): Likewise.
625 (gdb_fast_lookup_sections): New static array.
626 (is_gdb_debug_section): Rename formal parameter.
627 (is_lines_only_debug_section): Likewise.
628 (is_gdb_fast_lookup_section): New function.
629 (Layout::include_section): Check for ".zdebug_" prefix; pass
630 section name suffix to is_gdb_debug_section, et al.; check for
631 fast-lookup sections when building .gdb_index.
632 * options.h (--strip-debug-gdb): Update GDB version number.
633
634 2012-06-06 Cary Coutant <ccoutant@google.com>
635
636 * configure.ac: Add check for fallocate.
637 * configure: Regenerate.
638 * config.in: Regenerate.
639
640 * options.h (class General_options): Add --mmap-output-file and
641 --posix-fallocate options.
642 * output.cc: (posix_fallocate): Remove; replace with...
643 (gold_fallocate): New function.
644 (Output_file::map_no_anonymous): Call gold_fallocate.
645 (Output_file::map): Check --mmap-output-file option.
646
647 2012-06-05 Jing Yu <jingyu@google.com>
648
649 * gold.h (textdomain): Add do {} to empty while(0).
650 (bindtextdomain): Likewise.
651
652 2012-06-04 Cary Coutant <ccoutant@google.com>
653
654 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
655 has_dynsym_index.
656
657 2012-05-25 Sriraman Tallam <tmsriram@google.com>
658
659 * symtab.cc (Symbol_table::define_special_symbol):
660 Initialize *poldsym to prevent uninitialized variable errors.
661
662 2012-05-23 Cary Coutant <ccoutant@google.com>
663
664 * layout.cc (Layout::section_name_mapping): Add rules to handle
665 exact match on .data.rel.ro.local or .data.rel.ro.
666 (Layout::output_section_name): Check for exact matches.
667
668 2012-05-23 Cary Coutant <ccoutant@google.com>
669
670 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
671 more carefully.
672
673 2012-05-22 Cary Coutant <ccoutant@google.com>
674
675 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
676 object before exporting symbol.
677
678 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
679
680 * testsuite/tls_test.cc: Include "config.h" first.
681 * testsuite/tls_test_c.c: Likewise.
682
683 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
684 Nick Clifton <nickc@redhat.com>
685
686 PR 14072
687 * configure.in: Add check that sysdep.h has been included before
688 any system header files.
689 * configure: Regenerate.
690 * config.in: Regenerate.
691
692 2012-05-14 Cary Coutant <ccoutant@google.com>
693
694 * layout.cc (Layout::make_output_section): Mark .tdata section
695 as RELRO.
696 * testsuite/relro_test.cc: Add a TLS variable.
697
698 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
699
700 PR gold/14091
701 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
702 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
703 R_X86_64_64.
704
705 2012-05-08 Cary Coutant <ccoutant@google.com>
706
707 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
708 (lines_only_debug_sections): Likewise.
709
710 2012-05-02 Roland McGrath <mcgrathr@google.com>
711
712 * nacl.cc: New file.
713 * nacl.h: New file.
714 * Makefile.am (CCFILES, HFILES): Add them.
715 * Makefile.in: Regenerate.
716 * i386.cc (Output_data_plt_i386_nacl): New class.
717 (Output_data_plt_i386_nacl_exec): New class.
718 (Output_data_plt_i386_nacl_dyn): New class.
719 (Target_i386_nacl): New class.
720 (Target_selector_i386_nacl): New class.
721 (target_selector_i386): Use it instead of Target_selector_i386.
722 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
723 (Target_x86_64_nacl): New class.
724 (Target_selector_x86_64_nacl): New class.
725 (target_selector_x86_64, target_selector_x32): Use it instead of
726 Target_selector_x86_64.
727 * arm.cc (Output_data_plt_arm_nacl): New class.
728 (Target_arm_nacl): New class.
729 (Target_selector_arm_nacl): New class.
730 (target_selector_arm, target_selector_armbe): Use it instead of
731 Target_selector_arm.
732
733 * target-select.cc (select_target): Take new Input_file* and off_t
734 arguments, pass them on to recognize method of selector.
735 * object.cc (make_elf_sized_object): Update caller.
736 * parameters.cc (parameters_force_valid_target): Likewise.
737 * incremental.cc (make_sized_incremental_binary): Likewise.
738 * target-select.h: Update decl.
739 (Target_selector::recognize): Take new Input_file* argument,
740 pass it on to do_recognize.
741 (Target_selector::do_recognize): Take new Input_file* argument.
742 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
743 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
744 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
745 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
746
747 * target.h (Target::Target_info): New members isolate_execinstr
748 and rosegment_gap.
749 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
750 * arm.cc (Target_arm::arm_info): Update initializer.
751 * i386.cc (Target_i386::i386_info): Likewise.
752 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
753 * sparc.cc (Target_sparc::sparc_info): Likewise.
754 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
755 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
756 * layout.cc (Layout::attach_allocated_section_to_segment):
757 Take new const Target* argument. If target->isolate_execinstr(), act
758 like --rosegment.
759 (Layout::find_first_load_seg): Take new const Target* argument;
760 if target->isolate_execinstr(), reject PF_X segments.
761 (Layout::relaxation_loop_body): Update caller.
762 (Layout::set_segment_offsets): If target->isolate_execinstr(),
763 reset file offset to zero when we hit LOAD_SEG, and then do a second
764 loop over the segments before LOAD_SEG to reassign offsets after
765 addresses have been determined. Handle target->rosegment_gap().
766 (Layout::attach_section_to_segment): Take new const Target* argument;
767 pass it to attach_allocated_section_to_segment.
768 (Layout::make_output_section): Update caller.
769 (Layout::attach_sections_to_segments): Take new const Target* argument;
770 pass it to attach_section_to_segment.
771 * gold.cc (queue_middle_tasks): Update caller.
772 * layout.h (Layout): Update method decls with new arguments.
773
774 * arm.cc (Target_arm::Target_arm): Take optional argument for the
775 Target_info pointer to use.
776 (Target_arm::do_make_data_plt): New virtual method.
777 (Target_arm::make_data_plt): New method that calls it.
778 (Target_arm::make_plt_entry): Use it.
779 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
780 for the section alignment.
781 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
782 method.
783 (Output_data_plt_arm::first_plt_entry_offset): Call it.
784 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
785 method.
786 (Output_data_plt_arm::get_plt_entry_size): Call it.
787 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
788 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
789 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
790 method.
791 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
792 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
793 method instead of sizeof(plt_entry).
794 (Output_data_plt_arm::add_entry): Likewise.
795 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
796 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
797 than static method.
798 (Target_arm::plt_entry_size): Likewise.
799 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
800 Move to ...
801 (Output_data_plt_arm_standard): ... here, new class.
802 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
803 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
804 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
805
806 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
807 Take additional argument for the PLT entry size.
808 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
809 Use get_plt_entry_size method rather than plt_entry_size variable.
810 (Output_data_plt_x86_64::reserve_slot): Likewise.
811 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
812 (Output_data_plt_x86_64::add_entry): Likewise.
813 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
814 (Output_data_plt_x86_64::address_for_global): Likewise.
815 (Output_data_plt_x86_64::address_for_local): Likewise.
816 (Output_data_plt_x86_64::set_final_data_size): Likewise.
817 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
818 Make method non-static.
819 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
820 method.
821 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
822 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
823 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
824 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
825 virtual method.
826 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
827 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
828 virtual method.
829 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
830 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
831 virtual method.
832 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
833 (Output_data_plt_x86_64::plt_entry_size)
834 (Output_data_plt_x86_64::first_plt_entry)
835 (Output_data_plt_x86_64::plt_entry)
836 (Output_data_plt_x86_64::tlsdesc_plt_entry)
837 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
838 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
839 (Output_data_plt_x86_64_standard): ... here, new class.
840 (Target_x86_64::Target_x86_64): Take optional argument for the
841 Target_info pointer to use.
842 (Target_x86_64::do_make_data_plt): New virtual method.
843 (Target_x86_64::make_data_plt): New method to call it.
844 (Target_x86_64::init_got_plt_for_update): Use that.
845 Call this->plt_->add_eh_frame method here.
846 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
847 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
848 rather than static method.
849 (Target_x86_64::plt_entry_size): Likewise.
850 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
851 rather than plt_entry_size variable. Move guts of PLT filling to...
852 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
853 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
854 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
855
856 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
857 additional argument for the section alignment.
858 Don't do add_eh_frame_for_plt here.
859 (Output_data_plt_i386::first_plt_entry_offset): Make the method
860 non-static. Use get_plt_entry_size method rather than plt_entry_size
861 variable.
862 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
863 method.
864 (Output_data_plt_i386::get_plt_entry_size): Call it.
865 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
866 (Output_data_plt_i386::add_eh_frame): New method to call it.
867 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
868 method.
869 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
870 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
871 method.
872 (Output_data_plt_i386::fill_plt_entry): New method to call it.
873 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
874 method instead of plt_entry_size.
875 (Output_data_plt_i386::plt_entry_size)
876 (Output_data_plt_i386::plt_eh_frame_fde_size)
877 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
878 (Output_data_plt_i386_standard): ... here, new class.
879 (Output_data_plt_i386_exec): New class.
880 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
881 (Output_data_plt_i386_exec::first_plt_entry): ... here.
882 (Output_data_plt_i386::exec_plt_entry): Move to ...
883 (Output_data_plt_i386_exec::plt_entry): ... here.
884 (Output_data_plt_i386_dyn): New class.
885 (Output_data_plt_i386::first_plt_entry): Move to ...
886 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
887 (Output_data_plt_i386::dyn_plt_entry): Move to ...
888 (Output_data_plt_i386_dyn::plt_entry): ... here.
889 (Target_i386::Target_i386): Take optional argument for the Target_info
890 pointer to use.
891 (Target_i386::do_make_data_plt): New virtual method.
892 (Target_i386::make_data_plt): New method to call it.
893 (Target_i386::make_plt_section): Use that.
894 Call this->plt_->add_eh_frame method here.
895 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
896 rather than plt_entry_size variable.
897 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
898 (Output_data_plt_i386::address_for_local): Likewise.
899 (Output_data_plt_i386::do_write): Likewise.
900 Move guts of PLT filling to...
901 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
902 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
903 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
904 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
905
906 2012-05-01 Cary Coutant <ccoutant@google.com>
907
908 * dwarf_reader.cc (Dwarf_die::read_attributes)
909 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
910 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
911 * reduced_debug_output.cc
912 (Output_reduced_debug_info_section::get_die_end): Remove
913 DW_FORM_GNU_ref_index. Add default case.
914
915 2012-04-26 Mark Wielaard <mjw@redhat.com>
916
917 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
918 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
919 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
920 DW_AT_high_pc as offset from DW_AT_low_pc.
921
922 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
923 * testsuite/Makefile.in: Regenerate.
924 * testsuite/gdb_index_test_3.c: New test source file.
925 * testsuite/gdb_index_test_3.sh: New test source file.
926
927 2012-04-25 Ian Lance Taylor <iant@google.com>
928
929 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
930 pointer.
931 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
932 as a class, not a struct.
933 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
934 (Target_arm::apply_cortex_a8_workaround): Likewise.
935 * gc.h: Declare Reloc_types as a struct, not a class.
936 * object.h: Declare Symbols_data as a struct.
937 * reloc.h: Declare Read_relocs_data as a struct.
938 * target.h: Declare Relocate_info as a struct.
939
940 2012-04-24 David S. Miller <davem@davemloft.net>
941
942 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
943 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
944 and R_SPARC_WPLT30.
945
946 2012-04-24 Cary Coutant <ccoutant@google.com>
947
948 * incremental-dump.cc (find_input_containing_global): Replace
949 magic number with symbolic constant.
950 (dump_incremental_inputs): Update version number.
951 * incremental.cc (Output_section_incremental_inputs): Update version
952 number; import symbolic constants from Incremental_inputs_reader.
953 (Incremental_inputs::create_data_sections): Align relocations
954 section correctly for 64-bit targets.
955 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
956 constants; add padding.
957 (Output_section_incremental_inputs::write_header): Add assert for
958 header_size.
959 (Output_section_incremental_inputs::write_input_files): Add assert
960 for input_entry_size.
961 (Output_section_incremental_inputs::write_info_blocks): Add padding;
962 add assert for object_info_size, input_section_entry_size,
963 global_sym_entry_size.
964 * incremental.h (Incremental_inputs_reader): Add symbolic constants
965 for data structure sizes; use them.
966 (Incremental_input_entry_reader): Import symbolic constants from
967 Incremental_inputs_reader; use them.
968
969 2012-04-23 David S. Miller <davem@davemloft.net>
970
971 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
972 and elf_flags_set_.
973 (Target_sparc::Target_sparc): Initialize new fields.
974 (Target_sparc::do_make_elf_object): New function.
975 (Target_sparc::do_adjust_elf_header): New function.
976
977 2012-04-23 Cary Coutant <ccoutant@google.com>
978
979 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
980 CU range table of gdb index.
981
982 2012-04-20 David S. Miller <davem@davemloft.net>
983
984 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
985 instead of false.
986
987 2012-04-16 David S. Miller <davem@davemloft.net>
988
989 * sparc.cc (Target_sparc::got_address): New function.
990 (Sparc_relocate_functions::gdop_hix22): New function.
991 (Sparc_relocate_functions::gdop_lox10): New function.
992 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
993 relocs.
994 (Target_sparc::Scan::local): Likewise if the global symbol is not
995 preemptible and is not IFUNC.
996 (Target_sparc::Relocate::relocate): Perform GOTDATA code
997 transformations for local and non-preemptible non-IFUNC global
998 symbols.
999
1000 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1001 writing out 64-bit part of ranges.
1002
1003 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1004 -fpic and -fpie respectively.
1005 * Makefile.in: Regenerate.
1006
1007 * sparc.cc (class Target_sparc): Add rela_ifunc_.
1008 (Target_sparc::Target_sparc): Initialize new field.
1009 (Target_sparc::do_plt_section_for_global): New function.
1010 (Target_sparc::do_plt_section_for_local): New function.
1011 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1012 (Target_sparc::make_plt_section): New function, broken out of
1013 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1014 (Target_sparc::make_plt_entry): Call make_plt_section.
1015 (Target_sparc::make_local_ifunc_plt_entry): New function.
1016 (Target_sparc::rela_ifunc_section): New function.
1017 (Target_sparc::plt_section): Remove const.
1018 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1019 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1020 and ifunc_count_ fields.
1021 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1022 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1023 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1024 (Output_data_plt_sparc::rela_ifunc): New function.
1025 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1026 (Output_data_plt_sparc::has_ifunc_section): New function.
1027 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1028 (Output_data_plt_sparc::address_for_global): New function.
1029 (Output_data_plt_sparc::address_for_local): New function.
1030 (Output_data_plt_sparc::plt_index_to_offset): New function.
1031 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1032 and entry_count.
1033 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1034 entry_count.
1035 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1036 R_SPARC_JMP_IREL to switch.
1037 (Target_sparc::Scan::check_non_pic): Likewise.
1038 (Target_sparc::Scan::local): Handle IFUNC symbols.
1039 (Target_sparc::Scan::local): Likewise.
1040 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1041 and plt_address_for_local.
1042 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1043 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1044
1045 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1046 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1047 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1048 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1049 global relocs too.
1050 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1051 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1052 calls.
1053 * sparc.cc (Target_sparc::Scan::global): Likewise.
1054 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1055
1056 2012-04-16 Cary Coutant <ccoutant@google.com>
1057
1058 * archive.cc (Library_base::should_include_member): Check for
1059 --export-dynamic-symbol.
1060 * options.h (class General_options): Add --export-dynamic-symbol.
1061 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1062 --export-dynamic-symbol.
1063 (Symbol_table::gc_mark_undef_symbols): Likewise.
1064 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1065
1066 2012-04-12 David S. Miller <davem@davemloft.net>
1067
1068 * sparc.cc (Reloc::wdisp10): New relocation method.
1069 (Reloc::h34): Likewise.
1070 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1071 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1072 R_SPARC_WDISP10.
1073 (Target_sparc::Scan::local): Likewise.
1074 (Target_sparc::Scan::global): Likewise.
1075 (Target_sparc::Relocate::relocate): Likewise.
1076
1077 2012-04-09 Cary Coutant <ccoutant@google.com>
1078
1079 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1080 low_pc == 0.
1081
1082 2012-04-06 Ian Lance Taylor <iant@google.com>
1083
1084 * timer.cc: #include <unistd.h>.
1085
1086 2012-04-06 Roland McGrath <mcgrathr@google.com>
1087
1088 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1089 * config.in: Regenerate.
1090 * configure: Regenerate.
1091
1092 2012-04-05 Nick Clifton <nickc@redhat.com>
1093
1094 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1095 (AM_LC_MESSAGES): Add.
1096 * aclocal.m4: Regenerate.
1097 * config.in: Regenerate.
1098 * configure: Regenerate.
1099
1100 2012-03-21 Cary Coutant <ccoutant@google.com>
1101
1102 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1103 * Makefile.in: Regenerate.
1104 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1105 (Sized_elf_reloc_mapper::symbol_section): New function.
1106 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1107 (make_elf_reloc_mapper): New function.
1108 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1109 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1110 (Dwarf_abbrev_table::do_get_abbrev): New function.
1111 (Dwarf_ranges_table::read_ranges_table): New function.
1112 (Dwarf_ranges_table::read_range_list): New function.
1113 (Dwarf_pubnames_table::read_section): New function.
1114 (Dwarf_pubnames_table::read_header): New function.
1115 (Dwarf_pubnames_table::next_name): New function.
1116 (Dwarf_die::Dwarf_die): New function.
1117 (Dwarf_die::read_attributes): New function.
1118 (Dwarf_die::skip_attributes): New function.
1119 (Dwarf_die::set_name): New function.
1120 (Dwarf_die::set_linkage_name): New function.
1121 (Dwarf_die::attribute): New function.
1122 (Dwarf_die::string_attribute): New function.
1123 (Dwarf_die::int_attribute): New function.
1124 (Dwarf_die::uint_attribute): New function.
1125 (Dwarf_die::ref_attribute): New function.
1126 (Dwarf_die::child_offset): New function.
1127 (Dwarf_die::sibling_offset): New function.
1128 (Dwarf_info_reader::check_buffer): New function.
1129 (Dwarf_info_reader::parse): New function.
1130 (Dwarf_info_reader::do_parse): New function.
1131 (Dwarf_info_reader::do_read_string_table): New function.
1132 (Dwarf_info_reader::lookup_reloc): New function.
1133 (Dwarf_info_reader::get_string): New function.
1134 (Dwarf_info_reader::visit_compilation_unit): New function.
1135 (Dwarf_info_reader::visit_type_unit): New function.
1136 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1137 Sized_elf_reloc_mapper.
1138 (Sized_dwarf_line_info::symbol_section): Remove function.
1139 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1140 (Sized_dwarf_line_info::read_line_mappings): Remove object
1141 parameter, adjust callers.
1142 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1143 * dwarf_reader.h: Include <sys/types.h>.
1144 (class Track_relocs): Remove forward declaration.
1145 (class Elf_reloc_mapper): New class.
1146 (class Sized_elf_reloc_mapper): New class.
1147 (class Dwarf_abbrev_table): New class.
1148 (class Dwarf_range_list): New class.
1149 (class Dwarf_ranges_table): New class.
1150 (class Dwarf_pubnames_table): New class.
1151 (class Dwarf_die): New class.
1152 (class Dwarf_info_reader): New class.
1153 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1154 (Sized_dwarf_line_info::symbol_section): Remove member function.
1155 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1156 base class.
1157 * gdb-index.cc: New source file.
1158 * gdb-index.h: New source file.
1159 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1160 and .debug_types sections, call Layout::add_to_gdb_index.
1161 (Sized_relobj_incr::do_section_name): Implement.
1162 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1163 return type; Implement.
1164 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1165 return type.
1166 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1167 parameter list and return type.
1168 (Sized_incr_dynobj::do_section_contents): Likewise.
1169 * layout.cc: Include gdb-index.h.
1170 (Layout::Layout): Initialize gdb_index_data_.
1171 (Layout::init_fixed_output_section): Check for .gdb_index section.
1172 (Layout::add_to_gdb_index): New function. Instantiate.
1173 * layout.h: Add forward declaration for class Gdb_index.
1174 (Layout::add_to_gdb_index): New member function.
1175 (Layout::gdb_index_data_): New data member.
1176 * main.cc: Include gdb-index.h.
1177 (main): Print statistics for gdb index.
1178 * object.cc (Object::section_contents): Move code into
1179 do_section_contents.
1180 (need_decompressed_section): Check for sections needed when building
1181 gdb index.
1182 (build_compressed_section_map): Likewise.
1183 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1184 gdb index.
1185 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1186 sections; call Layout::add_to_gdb_index.
1187 (Sized_relobj_file::do_decompressed_section_contents): Call
1188 do_section_contents directly.
1189 * object.h (Object::do_section_contents): Adjust parameter list and
1190 return type.
1191 (Object::do_decompressed_section_contents): Call do_section_contents
1192 directly.
1193 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1194 return type.
1195 * options.h (class General_options): Add --gdb-index option.
1196 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1197 list and return type.
1198 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1199 * reloc.h (Track_relocs::checkpoint): New function.
1200 (Track_relocs::reset): New function.
1201
1202 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1203 New test cases.
1204 * testsuite/Makefile.in: Regenerate.
1205 * testsuite/gdb_index_test.cc: New test source file.
1206 * testsuite/gdb_index_test_1.sh: New test source file.
1207 * testsuite/gdb_index_test_2.sh: New test source file.
1208
1209 2012-03-19 Doug Kwan <dougkwan@google.com>
1210
1211 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1212 (Target_arm::do_finalize_sections): Remove code which defines
1213 __exidx_start and __exidx_end. Make symbol table parameter
1214 anonymous as it is not used.
1215 * gold.cc (queue_middle_tasks): Call target hook to define any
1216 target-specific symbols.
1217 * target.h (Target::define_standard_symbols): New method.
1218 (Target::do_define_standard_symbols): Same.
1219 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1220 * testsuite/Makefile.in: Regenerate.
1221 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1222 and __exidx_end.
1223 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1224 relocations are generated for __exidx_start and __exidx_end.
1225
1226 2012-03-16 Doug Kwan <dougkwan@google.com>
1227
1228 * testsuite/Makefile.am: Disable test initpri3b.
1229 * testsuite/Makefile.in: Regenerate.
1230
1231 2012-03-15 Doug Kwan <dougkwan@google.com>
1232
1233 * arm.cc (Target_arm::got_section): Make .got section read-only
1234 if -z now is given.
1235
1236 2012-03-15 Ian Lance Taylor <iant@google.com>
1237
1238 PR gold/13850
1239 * layout.cc (Layout::make_output_section): Correctly mark
1240 SHT_INIT_ARRAY, et. al., as relro.
1241
1242 2012-03-14 Doug Kwan <dougkwan@google.com>
1243
1244 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1245 dynamic relocations for protected symbols in shared objects.
1246
1247 2012-03-13 Ian Lance Taylor <iant@google.com>
1248
1249 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1250 keep the larger alignment.
1251
1252 2012-03-12 Cary Coutant <ccoutant@google.com>
1253
1254 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1255 handling of DW_LNE_define_file.
1256
1257 2012-03-12 Cary Coutant <ccoutant@google.com>
1258
1259 * reduced_debug_output.cc
1260 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1261 codes to switch.
1262
1263 2012-02-29 Cary Coutant <ccoutant@google.com>
1264
1265 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1266
1267 2012-02-29 Cary Coutant <ccoutant@google.com>
1268
1269 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1270 Call Object::decompressed_section_contents.
1271 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1272 New dtor.
1273 (Sized_dwarf_line_info::buffer_start_): New data member.
1274 * merge.cc (Output_merge_data::do_add_input_section): Call
1275 Object::decompressed_section_contents.
1276 (Output_merge_string::do_add_input_section): Likewise.
1277 * object.cc (need_decompressed_section): New function.
1278 (build_compressed_section_map): Decompress sections needed later.
1279 (Sized_relobj_file::do_decompressed_section_contents): New function.
1280 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1281 * object.h (Object::decompressed_section_contents): New function.
1282 (Object::discard_decompressed_sections): New function.
1283 (Object::do_decompressed_section_contents): New function.
1284 (Object::do_discard_decompressed_sections): New function.
1285 (Compressed_section_info): New type.
1286 (Compressed_section_map): Include decompressed section contents.
1287 (Sized_relobj_file::do_decompressed_section_contents): New function.
1288 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1289
1290 2012-02-16 Cary Coutant <ccoutant@google.com>
1291
1292 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1293 * testsuite/Makefile.in: Regenerate.
1294
1295 2012-02-14 Cary Coutant <ccoutant@google.com>
1296
1297 * options.cc (General_options::finalize): Disallow -pie and -static.
1298
1299 2012-02-03 Doug Kwan <dougkwan@google.com>
1300
1301 * arm.cc (Arm_relocate_functions::abs8,
1302 Arm_relocate_functions::abs16): Use
1303 Bits::has_signed_unsigned_overflow32.
1304 (Arm_relocate_functions::thm_abs8): Correct range of
1305 overflow check.
1306 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1307 in assertions.
1308
1309 2012-02-02 Doug Kwan <dougkwan@google.com>
1310
1311 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1312 position independent outputs, not just shared objects.
1313
1314 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1315
1316 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1317 * configure: Regenerated.
1318
1319 2012-01-27 Ian Lance Taylor <iant@google.com>
1320
1321 * reloc.h (Bits): New class with static functions, copied from
1322 namespace utils in arm.cc.
1323 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1324 instead.
1325
1326 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1327
1328 * incremental.cc (write_info_blocks): Correct relocation offset.
1329
1330 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1331
1332 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1333 (Relocate::tls_gd_to_le): Likewise.
1334
1335 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1336
1337 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1338
1339 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1340
1341 * configure.ac: Check if -mcmodel=medium works.
1342 * configure: Regenerated.
1343
1344 2012-01-24 Cary Coutant <ccoutant@google.com>
1345
1346 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1347 definition and ...
1348 (read_unsigned_LEB_128_x): ... this new function.
1349 (read_signed_LEB_128): Replaced with inline definition and ...
1350 (read_signed_LEB_128_x): ... this new function.
1351 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1352 (read_unsigned_LEB_128): Add inline definition.
1353 (read_signed_LEB_128_x): New function.
1354 (read_signed_LEB_128): Add inline definition.
1355 * testsuite/Makefile.am (leb128_unittest): New unit test.
1356 * testsuite/Makefile.in: Regenerate.
1357 * testsuite/leb128_unittest.cc: New unit test.
1358
1359 2012-01-23 Ian Lance Taylor <iant@google.com>
1360
1361 PR gold/13617
1362 * i386.cc (Target_i386::do_code_fill): When using a jmp
1363 instruction, pad with nop instructions.
1364 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1365
1366 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1367
1368 * x86_64.cc (gc_process_relocs): Add typename on types used in
1369 template.
1370 (scan_relocs): Likewise.
1371 (relocate_section): Likewise.
1372 (apply_relocation): Likewise.
1373
1374 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1375
1376 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1377 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1378 under x32.
1379
1380 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1381
1382 * x86_64.cc: Initial support for x32.
1383
1384 2012-01-03 Cary Coutant <ccoutant@google.com>
1385
1386 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1387 Use abstract base class for GOT.
1388 * gold/output.h (class Output_data_got_base): New abstract base class.
1389 (class Output_data_got): Derive from new base class, adjust ctors.
1390 (Output_data_got::reserve_slot): Make virtual; rename to
1391 do_reserve_slot; Adjust callers.
1392 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1393 pointer to abstract base class.
1394 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1395
1396 2011-12-18 Ian Lance Taylor <iant@google.com>
1397
1398 * object.h (Relobj::local_symbol_value): New function.
1399 (Relobj::local_plt_offset): New function.
1400 (Relobj::local_has_got_offset): New function.
1401 (Relobj::local_got_offset): New function.
1402 (Relobj::set_local_got_offset): New function.
1403 (Relobj::do_local_symbol_value): New pure virtual function.
1404 (Relobj::do_local_plt_offset): Likewise.
1405 (Relobj::do_local_has_got_offset): Likewise.
1406 (Relobj::do_local_got_offset): Likewise.
1407 (Relobj::do_set_local_got_offset): Likewise.
1408 (Sized_relobj::do_local_has_got_offset): Rename from
1409 local_has_got_offset.
1410 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1411 (Sized_relobj::do_set_local_got_offset): Rename from
1412 set_local_got_offset.
1413 (Sized_relobj_file::do_local_plt_offset): Rename from
1414 local_plt_offset.
1415 (Sized_relobj_file::do_local_symbol_value): New function.
1416 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1417 local_plt_offset.
1418 * output.cc (Output_data_got::Got_entry::write): Change object to
1419 Relobj. Use local_symbol_value.
1420 (Output_data_got::add_global_with_rel): Change rel_dyn to
1421 Output_data_reloc_generic*. Use add_global_generic.
1422 (Output_data_got::add_global_with_rela): Remove. Change all
1423 callers to use add_global_with_rel.
1424 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1425 Output_data_reloc_generic*. Use add_global_generic.
1426 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1427 callers to use add_global_pair_with_rel.
1428 (Output_data_got::add_local): Change object to Relobj*.
1429 (Output_data_got::add_local_plt): Likewise.
1430 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1431 change rel_dyn to Output_data_reloc_generic*. Use
1432 add_local_generic.
1433 (Output_data_got::add_local_with_rela): Remove. Change all
1434 callers to use all_local_with_rel.
1435 (Output_data_got::add_local_pair_with_rel): Change object to
1436 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1437 add_output_section_generic.
1438 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1439 callers to use add_local_pair_with_rel.
1440 (Output_data_got::reserve_local): Change object to Relobj*.
1441 * output.h: (class Output_data_reloc_generic): Add pure virtual
1442 declarations for add_global_generic, add_local_generic,
1443 add_output_section_generic.
1444 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1445 functions for Output_data_reloc_generic. Update declarations for
1446 changes listed in output.cc.
1447 (class Output_data_got): Change template parameter to got_size.
1448 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1449 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1450 function.
1451 (Sized_relobj_incr::do_local_plt_offset): New function.
1452 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1453 add_global_generic.
1454
1455 2011-12-17 Cary Coutant <ccoutant@google.com>
1456
1457 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1458 * resolve.cc (Symbol_table::resolve): Likewise.
1459 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1460 arrays.
1461 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1462
1463 2011-12-16 Ian Lance Taylor <iant@google.com>
1464
1465 * output.h (Output_data_reloc_generic::add): Only call
1466 add_dynamic_reloc if this is a dynamic reloc section.
1467
1468 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1469
1470 PR gold/13505
1471 * target-reloc.h (apply_relocation): Replace <64, false> with
1472 <size, big_endian>.
1473
1474 2011-11-25 Nick Clifton <nickc@redhat.com>
1475
1476 * po/it.po: New Italian translation.
1477
1478 2011-11-17 Sterling Augustine <saugustine@google.com>
1479
1480 * script.cc (script_include_directive): Implement.
1481 (read_script_file): New local variables name and search_path. Update
1482 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1483 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1484 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1485
1486 2011-11-11 Sterling Augustine <saugustine@google.com>
1487
1488 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1489 (file_or_sections_cmd): Likewise.
1490
1491 2011-11-11 Doug Kwan <dougkwan@google.com>
1492
1493 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1494 if --just-symbols is given.
1495
1496 2011-11-10 Doug Kwan <dougkwan@google.com>
1497
1498 PR gold/13362
1499 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1500 when processing data relocs.
1501 * reloc.h (Relocate_functions::rel_unaligned): New method.
1502 (Relocate_functions::pcrel_unaligned): Ditto.
1503 (Relocate_functions::rel32_unaligned): Ditto.
1504 (Relocate_functions::pcrel32_unaligned): Ditto.
1505
1506 2011-11-09 Doug Kwan <dougkwan@google.com>
1507
1508 PR gold/13362
1509 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1510 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1511 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1512 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1513 (Relocate_functions::rel_unaligned): New.
1514 (Relocate_functions::rel32_unaligned): New.
1515 * target-reloc.h (relocate_for_relocatable): Add code to handle
1516 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1517 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1518 arm_unaligned_reloc_r): New targets.
1519 * testsuite/Makefile.in: Regenerate.
1520 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1521 linking.
1522
1523 2011-11-02 Ian Lance Taylor <iant@google.com>
1524
1525 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1526 NATIVE_LINKER.
1527 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1528 * options.cc (General_options::finalize): Use library search path
1529 from configure script if specified. If not native and no sysroot,
1530 only search TOOLLIBDIR.
1531 * options.h (Search_directory::Search_directory): Change name to
1532 const std::string&.
1533 (General_options::add_to_library_path_with_sysroot): Change arg to
1534 const std::string&.
1535 * configure, Makefile.in, config.in: Rebuild.
1536
1537 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1538
1539 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1540 we are working around the ARM1176 Erratum.
1541 * options.h (General_options::fix_arm1176): Add option.
1542 * testsuite/Makefile.am: Add testcases, and keep current ones
1543 working.
1544 * testsuite/Makefile.in: Regenerate.
1545 * testsuite/arm_fix_1176.s: New file.
1546 * testsuite/arm_fix_1176.sh: Likewise.
1547
1548 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1549
1550 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1551 may_use_blx_.
1552 (Target_arm::may_use_blx): Remove method.
1553 (Target_arm::set_may_use_blx): Likewise.
1554 (Target_arm::may_use_v4t_interworking): New method.
1555 (Target_arm::may_use_v5t_interworking): Likewise.
1556 (Target_arm::may_use_blx_): Remove member variable.
1557 (Arm_relocate_functions::arm_branch_common): Check for v5T
1558 interworking.
1559 (Arm_relocate_functions::thumb_branch_common): Likewise.
1560 (Reloc_stub::stub_type_for_reloc): Likewise.
1561 (Target_arm::do_finalize_sections): Correct interworking checks.
1562 * testsuite/Makefile.am: Add new tests.
1563 * testsuite/Makefile.in: Regenerate.
1564 * testsuite/arm_farcall_arm_arm.s: New test.
1565 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1566 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1567 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1568 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1569 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1570 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1571 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1572
1573 2011-10-31 Cary Coutant <ccoutant@google.com>
1574
1575 PR gold/13023
1576 * expression.cc (Expression::eval_with_dot): Add
1577 is_section_dot_assignment parameter.
1578 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1579 absolute and assigning to dot within a section.
1580 * script-sections.cc
1581 (Output_section_element_assignment::set_section_addresses): Pass
1582 dot_section to set_if_absolute.
1583 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1584 as is_section_dot_assignment flag to eval_with_dot.
1585 (Output_section_element_dot_assignment::set_section_addresses):
1586 Likewise.
1587 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1588 parameter. Also set value if relative to dot_section; set the
1589 symbol's output_section.
1590 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1591 parameter. Adjust all callers.
1592 (Expression::eval_maybe_dot): Likewise.
1593 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1594 Adjust all callers.
1595 * testsuite/script_test_2.t: Test assignment of an absolute value
1596 to dot within an output section element.
1597
1598 2011-10-31 Cary Coutant <ccoutant@google.com>
1599
1600 * options.h (class General_options): Add --[no-]gnu-unique options.
1601 * symtab.cc (Symbol_table::sized_write_globals): Convert
1602 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1603
1604 2011-10-31 Cary Coutant <ccoutant@google.com>
1605
1606 PR gold/13359
1607 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1608 unnecessary assertion.
1609 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1610
1611 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1612
1613 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1614 gc_mark_symbol.
1615 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1616 gc_mark_symbol.
1617 Change to just keep the section associated with symbol.
1618 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1619 they are externally visible and --export-dynamic is turned on.
1620 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1621
1622 2011-10-19 Ian Lance Taylor <iant@google.com>
1623
1624 PR gold/13163
1625 * script-sections.cc
1626 (Output_section_element_dot_assignment::needs_output_section): New
1627 function.
1628
1629 2011-10-19 Ian Lance Taylor <iant@google.com>
1630
1631 PR gold/13204
1632 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1633 --section-start option was seen.
1634 * options.h (General_options::any_section_start): New function.
1635
1636 2011-10-18 David S. Miller <davem@davemloft.net>
1637
1638 PR binutils/13301
1639 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1640 member to track relocation locations that have moved during TLS
1641 reloc optimizations.
1642 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1643 (Target_sparc::Relocate::relocate): Adjust view down by 4
1644 bytes if it matches reloc_adjust_addr_.
1645 (Target_sparc::Relocate::relocate_tls): Always move the
1646 __tls_get_addr call delay slot instruction forward 4 bytes when
1647 performing relaxation.
1648
1649 2011-10-18 Cary Coutant <ccoutant@google.com>
1650
1651 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1652 (Output_file::map_no_anonymous): Check for non-zero
1653 return code from posix_fallocate.
1654
1655 2011-10-17 Cary Coutant <ccoutant@google.com>
1656
1657 PR gold/13245
1658 * plugin.cc (is_visible_from_outside): Check for symbols
1659 referenced from dynamic objects.
1660 * resolve.cc (Symbol_table::resolve): Don't count references
1661 from dynamic objects as references from real ELF files.
1662 * testsuite/plugin_test_2.sh: Adjust expected result.
1663
1664 2011-10-17 Cary Coutant <ccoutant@google.com>
1665
1666 * gold.cc: Include timer.h.
1667 (queue_middle_tasks): Stamp time.
1668 (queue_final_tasks): Likewise.
1669 * main.cc (main): Store timer in parameters. Print timers
1670 for each pass.
1671 * parameters.cc (Parameters::Parameters): Initialize timer_.
1672 (Parameters::set_timer): New function.
1673 (set_parameters_timer): New function.
1674 * parameters.h (Parameters::set_timer): New function.
1675 (Parameters::timer): New function.
1676 (Parameters::timer_): New data member.
1677 (set_parameters_timer): New function.
1678 * timer.cc (Timer::stamp): New function.
1679 (Timer::get_pass_time): New function.
1680 * timer.h (Timer::stamp): New function.
1681 (Timer::get_pass_time): New function.
1682 (Timer::pass_times_): New data member.
1683
1684 2011-10-17 Cary Coutant <ccoutant@google.com>
1685
1686 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1687 task for members of lib groups.
1688
1689 2011-10-17 Cary Coutant <ccoutant@google.com>
1690
1691 PR gold/13288
1692 * fileread.cc (File_read::find_view): Add assert.
1693 (File_read::make_view): Move bounds check (replace with assert)...
1694 (File_read::find_or_make_view): ... to here.
1695
1696 2011-10-12 Cary Coutant <ccoutant@google.com>
1697
1698 * output.cc (Output_file::open_base_file): Handle case where
1699 ::read returns less than requested size.
1700
1701 2011-10-10 Cary Coutant <ccoutant@google.com>
1702
1703 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1704 Initialize defined_count_.
1705 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1706 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1707 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1708 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1709 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1710 * incremental.h (Sized_relobj_incr::defined_count_): New data
1711 member.
1712 (Sized_incr_dynobj::defined_count_): New data member.
1713 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1714 Return zeroes instead of internal error.
1715
1716 2011-10-10 Cary Coutant <ccoutant@google.com>
1717
1718 PR gold/13249
1719 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1720 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1721 * output.h (class Output_reloc): Add use_plt_offset flag.
1722 (Output_reloc::type_): Adjust size of bit field.
1723 (Output_reloc::use_plt_offset_): New bit field.
1724 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1725 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1726 flag. Adjust all callers.
1727 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1728 creating RELATIVE relocations.
1729
1730 2011-10-10 Nick Clifton <nickc@redhat.com>
1731
1732 * po/es.po: Updated Spanish translation.
1733 * po/fi.po: Updated Finnish translation.
1734
1735 2011-10-03 Diego Novillo <dnovillo@google.com>
1736
1737 * options.cc (parse_uint): Fix dereference of RETVAL.
1738
1739 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1740
1741 * layout.h (section_order_map_): New member.
1742 (get_section_order_map): New member function.
1743 * output.cc (Output_section::add_input_section): Check for patterns
1744 only when --section-ordering-file is specified.
1745 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1746 output_sections have been formed.
1747 * layout.cc (Layout_Layout): Initialize section_order_map_.
1748 * plugin.cc (update_section_order): Store order in order_map. Do not
1749 update the order.
1750 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1751 * testsuite/Makefile.in: Regenerate.
1752 * testsuite/plugin_section_order.c: New file.
1753 * testsuite/plugin_final_layout.cc: New file.
1754 * testsuite/plugin_final_layout.sh: New file.
1755
1756 2011-09-29 Cary Coutant <ccoutant@google.com>
1757
1758 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1759 Check for NULL.
1760 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1761 symbols during incremental update.
1762 (Symbol_table::add_from_dynobj): Likewise.
1763
1764 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1765 Ian Lance Taylor <iant@google.com>
1766
1767 * symtab.cc (Symbol_table::define_special_symbol): Always
1768 canonicalize version string.
1769
1770 2011-09-26 Cary Coutant <ccoutant@google.com>
1771
1772 * gold.cc (queue_initial_tasks): Move option checks ...
1773 * options.cc (General_options::finalize): ... to here. Disable
1774 some options; make others fatal.
1775
1776 2011-09-26 Cary Coutant <ccoutant@google.com>
1777
1778 gcc PR lto/47247
1779 * plugin.cc (get_symbols_v2): New function.
1780 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1781 (is_referenced_from_outside): New function.
1782 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1783 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1784 (get_symbols): Pass version parameter.
1785 (get_symbols_v2): New function.
1786 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1787 parameter.
1788 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1789 (onload): Add LDPT_GET_SYMBOLS_V2.
1790 (all_symbols_read_hook): Use get_symbols_v2; check for
1791 LDPR_PREVAILING_DEF_IRONLY_EXP.
1792 * testsuite/plugin_test_3.sh: Update expected results.
1793
1794 2011-09-23 Simon Baldwin <simonb@google.com>
1795
1796 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1797 configuration options.
1798 * configure: Regenerate.
1799 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1800 * Makefile.in: Regenerate.
1801 * testsuite/Makefile.in: Regenerate.
1802
1803 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1804
1805 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1806
1807 2011-09-19 Cary Coutant <ccoutant@google.com>
1808
1809 * incremental.cc (can_incremental_update): Fix typo in comment.
1810 * incremental.h (can_incremental_update): Likewise.
1811
1812 2011-09-18 Cary Coutant <ccoutant@google.com>
1813
1814 * incremental.cc (can_incremental_update): New function.
1815 * incremental.h (can_incremental_update): New function.
1816 * layout.cc (Layout::init_fixed_output_section): Call it.
1817 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1818 * object.cc (Sized_relobj_file::do_layout): Call
1819 can_incremental_update.
1820
1821 2011-09-13 Cary Coutant <ccoutant@google.com>
1822
1823 * configure.ac: Check for glibc support for gnu_indirect_function
1824 support with static linking, setting automake conditional
1825 IFUNC_STATIC.
1826 * Makefile.in: Regenerate.
1827 * configure: Regenerate.
1828
1829 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1830 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1831 for IFUNC_STATIC.
1832 * testsuite/Makefile.in: Regenerate.
1833
1834 2011-09-13 Cary Coutant <ccoutant@google.com>
1835
1836 * incremental.cc (Sized_relobj_incr::do_layout): Call
1837 report_comdat_group for kept comdat sections.
1838 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1839 * testsuite/Makefile.in: Regenerate.
1840 * testsuite/incr_comdat_test_1.cc: New source file.
1841 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1842 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1843 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1844
1845 2011-09-13 Ian Lance Taylor <iant@google.com>
1846
1847 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1848 variable external_symbols_offset.
1849
1850 2011-09-12 Ian Lance Taylor <iant@google.com>
1851
1852 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1853 triggered if object has no symbols.
1854
1855 2011-09-09 David S. Miller <davem@davemloft.net>
1856
1857 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1858 (Output_fill_debug_line::do_write): Likewise.
1859
1860 2011-08-29 Cary Coutant <ccoutant@google.com>
1861
1862 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1863 casts to match formatting specs.
1864 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1865
1866 2011-08-26 Cary Coutant <ccoutant@google.com>
1867
1868 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1869 remaining hole size when allocating.
1870 (Layout::make_output_section): Set fill methods for debug sections.
1871 * layout.h (Free_list::Free_list_node): Move from private to
1872 public.
1873 (Free_list::set_min_hole_size): New function.
1874 (Free_list::begin, Free_list::end): New functions.
1875 (Free_list::min_hole_): New data member.
1876 * output.cc: Include dwarf.h.
1877 (Output_fill_debug_info::do_minimum_hole_size): New function.
1878 (Output_fill_debug_info::do_write): New function.
1879 (Output_fill_debug_line::do_minimum_hole_size): New function.
1880 (Output_fill_debug_line::do_write): New function.
1881 (Output_section::Output_section): Initialize new data member.
1882 (Output_section::set_final_data_size): Ensure patch space is larger
1883 than minimum hole size.
1884 (Output_section::do_write): Fill holes in debug sections.
1885 * output.h (Output_fill): New class.
1886 (Output_fill_debug_info): New class.
1887 (Output_fill_debug_line): New class.
1888 (Output_section::set_free_space_fill): New function.
1889 (Output_section::free_space_fill_): New data member.
1890 * testsuite/Makefile.am (incremental_test_3): Add
1891 --incremental-patch option.
1892 (incremental_test_4): Likewise.
1893 (incremental_test_5): Likewise.
1894 (incremental_test_6): Likewise.
1895 (incremental_copy_test): Likewise.
1896 (incremental_common_test_1): Likewise.
1897 * testsuite/Makefile.in: Regenerate.
1898
1899 2011-08-26 Nick Clifton <nickc@redhat.com>
1900
1901 * po/es.po: Updated Spanish translation.
1902
1903 2011-08-01 Cary Coutant <ccoutant@google.com>
1904
1905 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1906 * gold/testsuite/Makefile.in: Regenerate.
1907 * gold/testsuite/justsyms_exec.c: New source file.
1908 * gold/testsuite/justsyms_lib.c: New source file.
1909
1910 2011-08-01 Cary Coutant <ccoutant@google.com>
1911
1912 * layout.cc (Layout::set_segment_offsets): Don't realign text
1913 segment if -Ttext was specified.
1914 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1915 file type.
1916 * object.h (Sized_relobj_file::e_type): New function.
1917 (Sized_relobj_file::e_type_): New data member.
1918 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1919 base address for ET_EXEC files.
1920 * target.cc (Target::do_make_elf_object_implementation): Allow
1921 ET_EXEC files with --just-symbols option.
1922
1923 2011-07-28 Cary Coutant <ccoutant@google.com>
1924
1925 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1926 Add thread_number parameter.
1927 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1928 * workqueue-threads.cc
1929 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1930 current thread if its thread number is greater than desired thread
1931 count.
1932 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1933 Add thread_number parameter.
1934 (Workqueue::should_cancel_thread): Likewise.
1935 (Workqueue::find_runnable_or_wait): Pass thread_number to
1936 should_cancel_thread.
1937 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1938 parameter.
1939
1940 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1941
1942 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1943 only after checking if it cannot be forced local.
1944 * symtab.h (is_externally_visible): Check if the symbol is not forced
1945 local.
1946
1947 2011-07-15 Ian Lance Taylor <iant@google.com>
1948
1949 * options.h (class General_options): Add --print-output-format.
1950 Move -EL next to -EB, for better --help output.
1951 * target-select.cc: Include <cstdio>, "options.h", and
1952 "parameters.h".
1953 (Target_selector::do_target_bfd_name): New function.
1954 (print_output_format): New function.
1955 * target-select.h (class Target_selector): Update declarations.
1956 (Target_selector::target_bfd_name): New function.
1957 (print_output_format): Declare.
1958 * main.cc: Include "target-select.h".
1959 (main): Handle --print-output-format.
1960 * gold.cc: Include "target-select.h".
1961 (queue_initial_tasks): Handle --print-output-format when there are
1962 no input files.
1963 * parameters.cc (parameters_force_valid_target): Give a better
1964 error message if -EB/-EL does not match target.
1965 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1966 function.
1967
1968 2011-07-15 Ian Lance Taylor <iant@google.com>
1969
1970 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1971 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1972 (Output_data_plt_i386::do_write): Write address of .dynamic
1973 section to first entry in .got.plt section.
1974 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1975 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1976 Initialize layout_.
1977 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1978 section to first entry in .got.plt section.
1979 * layout.h (Layout::dynamic_section): New function.
1980
1981 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1982
1983 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1984 to claim_file call.
1985 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1986 input_section_position_, and input_section_glob_.
1987 (read_layout_from_file): Call function section_ordering_specified.
1988 * layout.h (is_section_ordering_specified): New function.
1989 (section_ordering_specified): New function.
1990 (section_ordering_specified_): New boolean member.
1991 * main.cc(main): Call load_plugins after layout object is defined.
1992 * output.cc (Output_section::add_input_section): Use
1993 function section_ordering_specified to check if section ordering is
1994 needed.
1995 * output.cc (Output_section::add_relaxed_input_section): Use
1996 function section_ordering_specified to check if section ordering is
1997 needed.
1998 (Output_section::update_section_layout): New function.
1999 (Output_section::sort_attached_input_sections): Check if input section
2000 must be reordered.
2001 * output.h (Output_section::update_section_layout): New function.
2002 * plugin.cc (get_section_count): New function.
2003 (get_section_type): New function.
2004 (get_section_name): New function.
2005 (get_section_contents): New function.
2006 (update_section_order): New function.
2007 (allow_section_ordering): New function.
2008 (Plugin::load): Add the new interfaces to the transfer vector.
2009 (Plugin_manager::load_plugins): New parameter.
2010 (Plugin_manager::all_symbols_read): New parameter.
2011 (Plugin_manager::claim_file): New parameter. Save the elf object for
2012 unclaimed objects.
2013 (Plugin_manager::get_elf_object): New function.
2014 (Plugin_manager::get_view): Change to directly use the bool to check
2015 if get_view is called from claim_file_hook.
2016 * plugin.h (input_objects): New function
2017 (Plugin__manager::load_plugins): New parameter.
2018 (Plugin_manager::claim_file): New parameter.
2019 (Plugin_manager::get_elf_object): New function.
2020 (Plugin_manager::in_claim_file_handler): New function.
2021 (Plugin_manager::in_claim_file_handler_): New member.
2022 (layout): New function.
2023 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2024 handler with an extra parameter. Make the elf object before calling
2025 claim_file handler.
2026 * testsuite/plugin_test.c (get_section_count): New function pointer.
2027 (get_section_type): New function pointer.
2028 (get_section_name): New function pointer.
2029 (get_section_contents): New function pointer.
2030 (update_section_order): New function pointer.
2031 (allow_section_ordering): New function pointer.
2032 (onload): Check if the new interfaces exist.
2033
2034 2011-07-13 Ian Lance Taylor <iant@google.com>
2035
2036 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2037 relro section.
2038 * x86_64.cc (Target_x86_64::got_section): Likewise.
2039 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2040 (relro_now_test_SOURCES): New variable.
2041 (relro_now_test_DEPENDENCIES): New variable.
2042 (relro_now_test_LDFLAGS): New variable.
2043 (relro_now_test_LDADD): New variable.
2044 (relro_now_test.so): New target.
2045 * testsuite/Makefile.in: Rebuild.
2046
2047 2011-07-12 Ian Lance Taylor <iant@google.com>
2048
2049 PR gold/12980
2050 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2051 GLOB_DAT relocation rather than a RELATIVE relocation for a
2052 protected symbol when creating a shared library.
2053 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2054 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2055 * testsuite/protected_main_1.cc (main): Test that protected
2056 function has same address.
2057
2058 2011-07-11 Ian Lance Taylor <iant@google.com>
2059
2060 PR gold/12979
2061 * options.h (class General_options): Add -Bgroup.
2062 * options.cc (General_options::finalize): If -Bgroup is set,
2063 default to --unresolved-symbols=report-all.
2064 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2065 * target-reloc.h (issue_undefined_symbol_error): Handle
2066 --unresolved-symbols=report-all.
2067
2068 2011-07-08 Ian Lance Taylor <iant@google.com>
2069
2070 PR gold/11985
2071 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2072 if linker script discards key sections.
2073 (Layout::create_dynamic_symtab): Likewise.
2074 (Layout::assign_local_dynsym_offsets): Likewise.
2075 (Layout::sized_create_version_sections): Likewise.
2076 (Layout::create_interp): Likewise.
2077 (Layout::finish_dynamic_section): Likewise.
2078 (Layout::set_dynamic_symbol_size): Likewise.
2079
2080 2011-07-08 Ian Lance Taylor <iant@google.com>
2081
2082 PR gold/12386
2083 * options.h (class General_options): Add --unresolved-symbols.
2084 * target-reloc.h (issue_undefined_symbol_error): Check
2085 --unresolved-symbols. Add comments.
2086
2087 2011-07-08 Ian Lance Taylor <iant@google.com>
2088
2089 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2090 expression more complex.
2091
2092 2011-07-08 Ian Lance Taylor <iant@google.com>
2093
2094 PR gold/11317
2095 * target-reloc.h (issue_undefined_symbol_error): New inline
2096 function, broken out of relocate_section.
2097 (relocate_section): Call issue_undefined_symbol_error.
2098 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2099 there is no TLS segment if we are about to issue an undefined
2100 symbol error.
2101 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2102
2103 2011-07-08 Ian Lance Taylor <iant@google.com>
2104
2105 PR gold/12279
2106 * resolve.cc (Symbol_table::should_override): Add fromtype
2107 parameter. Change all callers. Give error when linking together
2108 TLS and non-TLS symbol.
2109 (Symbol_table::should_override_with_special): Add fromtype
2110 parameter. Change all callers.
2111 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2112 there is no TLS segment if we have reported some errors.
2113 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2114
2115 2011-07-08 Ian Lance Taylor <iant@google.com>
2116
2117 PR gold/12372
2118 * target.h (Target::plt_address_for_global): New function.
2119 (Target::plt_address_for_local): New function.
2120 (Target::plt_section_for_global): Remove.
2121 (Target::plt_section_for_local): Remove.
2122 (Target::do_plt_address_for_global): New virtual function.
2123 (Target::do_plt_address_for_local): New virtual function.
2124 (Target::do_plt_section_for_global): Remove.
2125 (Target::do_plt_section_for_local): Remove.
2126 (Target::register_global_plt_entry): Add Symbol_table and Layout
2127 parameters.
2128 * output.cc (Output_data_got::Got_entry::write): Use
2129 plt_address_for_global and plt_address_for_local.
2130 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2131 address of output section.
2132 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2133 got_irelative_, and irelative_count_ fields. Update
2134 declarations.
2135 (Output_data_plt_i386::has_irelative_section): New function.
2136 (Output_data_plt_i386::entry_count): Add irelative_count_.
2137 (Output_data_plt_i386::set_final_data_size): Likewise.
2138 (class Target_i386): Add got_irelative_ and rel_irelative_
2139 fields. Update declarations.
2140 (Target_i386::Target_i386): Initialize new fields.
2141 (Target_i386::do_plt_address_for_global): New function replacing
2142 do_plt_section_for_global.
2143 (Target_i386::do_plt_address_for_local): New function replacing
2144 do_plt_section_for_local.
2145 (Target_i386::got_section): Create got_irelative_.
2146 (Target_i386::rel_irelative_section): New function.
2147 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2148 fields. Don't define __rel_iplt_{start,end}.
2149 (Output_data_plt_i386::add_entry): Add symtab and layout
2150 parameters. Change all callers. Use different PLT and GOT for
2151 IFUNC symbols.
2152 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2153 layout parameters. Change all callers. Use different PLT and
2154 GOT.
2155 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2156 (Output_data_plt_i386::rel_irelative): New function.
2157 (Output_data_plt_i386::address_for_global): New function.
2158 (Output_data_plt_i386::address_for_local): New function.
2159 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2160 IRELATIVE GOT when changing IFUNC GOT entries.
2161 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2162 reloc.
2163 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2164 if we didn't create an IRELATIVE GOT.
2165 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2166 plt_address_for_local.
2167 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2168 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2169 got_irelative_, and irelative_count_ fields. Update
2170 declarations.
2171 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2172 Initialize new fields. Remove symtab parameter. Change all
2173 callers.
2174 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2175 irelative_count_.
2176 (Output_data_plt_x86_64::has_irelative_section): New function.
2177 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2178 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2179 fields. Update declarations.
2180 (Target_x86_64::Target_x86_64): Initialize new fields.
2181 (Target_x86_64::do_plt_address_for_global): New function replacing
2182 do_plt_section_for_global.
2183 (Target_x86_64::do_plt_address_for_local): New function replacing
2184 do_plt_section_for_local.
2185 (Target_x86_64::got_section): Create got_irelative_.
2186 (Target_x86_64::rela_irelative_section): New function.
2187 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2188 all callers. Don't create __rel_iplt_{start,end}.
2189 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2190 parameters. Change all callers. Use different PLT and GOT for
2191 IFUNC symbols.
2192 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2193 layout parameters. Change all callers. Use different PLT and
2194 GOT.
2195 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2196 parameters. Change all callers. Use different PLT and GOT for
2197 IFUNC symbols.
2198 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2199 (Output_data_plt_x86_64::rela_irelative): New function.
2200 (Output_data_plt_x86_64::address_for_global): New function.
2201 (Output_data_plt_x86_64::address_for_local): New function.
2202 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2203 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2204 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2205 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2206 parameters.
2207 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2208 reloc.
2209 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2210 symbols if we didn't create an IRELATIVE GOT.
2211 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2212 plt_address_for_local.
2213 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2214 * testsuite/ifuncvar1.c: New test file.
2215 * testsuite/ifuncvar2.c: New test file.
2216 * testsuite/ifuncvar3.c: New test file.
2217 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2218 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2219 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2220 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2221 * testsuite/Makefile.in: Rebuild.
2222
2223 2011-07-07 Cary Coutant <ccoutant@google.com>
2224
2225 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2226 (two_file_test_1_ndebug.o): Likewise.
2227 (two_file_test_1b_ndebug.o): Likewise.
2228 (two_file_test_2_ndebug.o): Likewise.
2229 (two_file_test_main_ndebug.o): Likewise.
2230 (incremental_test_2): Link with no-debug versions.
2231
2232 2011-07-06 Cary Coutant <ccoutant@google.com>
2233
2234 * gold/incremental.cc
2235 (Output_section_incremental_inputs::write_info_blocks): Check for
2236 hidden and internal symbols.
2237
2238 2011-07-06 Cary Coutant <ccoutant@google.com>
2239
2240 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2241 Check disposition for startup file.
2242 (Incremental_inputs::report_command_line): Ignore
2243 --incremental-startup-unchanged option.
2244 * options.cc (General_options::parse_incremental_startup_unchanged):
2245 New function.
2246 (General_options::General_options): Initialize new data member.
2247 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2248 (General_options): Add --incremental-startup-unchanged option.
2249 (General_options::incremental_startup_disposition): New function.
2250 (General_options::incremental_startup_disposition_): New data member.
2251
2252 2011-07-06 Cary Coutant <ccoutant@google.com>
2253
2254 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2255 input file index to Script_info ctor.
2256 (Sized_incremental_binary::do_file_has_changed): Find the
2257 command-line argument for files named in scripts.
2258 * incremental.h (Script_info::Script_info): New ctor
2259 with input file index.
2260 (Script_info::input_file_index): New function.
2261 (Script_info::input_file_index_): New data member.
2262 (Incremental_binary::get_library): Add const.
2263 (Incremental_binary::get_script_info): Add const.
2264 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2265 * testsuite/Makefile.am (incremental_test_5): New test case.
2266 (incremental_test_6): New test case.
2267 * testsuite/Makefile.in: Regenerate.
2268
2269 2011-07-06 Cary Coutant <ccoutant@google.com>
2270
2271 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2272 debug output when command lines differ.
2273
2274 2011-07-06 Cary Coutant <ccoutant@google.com>
2275
2276 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2277 --incremental-patch option.
2278 * layout.cc (Free_list::allocate): Extend allocation beyond original
2279 end if enabled.
2280 (Layout::make_output_section): Mark sections that should get
2281 patch space.
2282 * options.cc (parse_percent): New function.
2283 * options.h (parse_percent): New function.
2284 (DEFINE_percent): New macro.
2285 (General_options): Add --incremental-patch option.
2286 * output.cc (Output_section::Output_section): Initialize new data
2287 members.
2288 (Output_section::add_input_section): Print section name when out
2289 of patch space.
2290 (Output_section::add_output_section_data): Likewise.
2291 (Output_section::set_final_data_size): Add patch space when
2292 doing --incremental-full.
2293 (Output_section::do_reset_address_and_file_offset): Remove patch
2294 space.
2295 (Output_segment::set_section_list_addresses): Print debug output
2296 only if --incremental-update.
2297 * output.h (Output_section::set_is_patch_space_allowed): New function.
2298 (Output_section::is_patch_space_allowed_): New data member.
2299 (Output_section::patch_space_): New data member.
2300 * parameters.cc (Parameters::incremental_full): New function.
2301 * parameters.h (Parameters::incremental_full): New function
2302 * testsuite/Makefile.am (incremental_test_2): Add test for
2303 --incremental-patch option.
2304 * testsuite/Makefile.in: Regenerate.
2305 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2306 (t18): Remove function body.
2307
2308 2011-07-05 Doug Kwan <dougkwan@google.com>
2309
2310 PR gold/12771
2311 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2312 Arm_Address type for relocation result.
2313 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2314 overflow check.
2315 (Arm_relocate_functions::abs32): Use unaligned access.
2316 (Arm_relocate_functions::rel32): Ditto.
2317 (Arm_relocate_functions::prel31): Ditto.
2318 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2319 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2320 static data relocations.
2321 * testsuite/Makefile.in: Regnerate.
2322 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2323
2324 2011-07-05 Ian Lance Taylor <iant@google.com>
2325
2326 PR gold/12392
2327 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2328 symbols if necessary.
2329 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2330
2331 2011-07-05 Ian Lance Taylor <iant@google.com>
2332
2333 PR gold/12952
2334 * resolve.cc (Symbol::override_base_with_special): Simply override
2335 version with special symbol version, ignoring previous version.
2336
2337 2011-07-05 Ian Lance Taylor <iant@google.com>
2338
2339 * object.cc (Sized_relobj_file::include_section_group): Add
2340 information to comment about signature location.
2341
2342 2011-07-02 Ian Lance Taylor <iant@google.com>
2343
2344 PR gold/12957
2345 * options.h (class General_options): Add -f and -F.
2346 * options.cc (General_options::finalize): Fatal error if -f/-F
2347 are used without -shared.
2348 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2349
2350 2011-07-02 Ian Lance Taylor <iant@google.com>
2351
2352 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2353
2354 2011-07-01 Ian Lance Taylor <iant@google.com>
2355
2356 PR gold/12525
2357 PR gold/12952
2358 * resolve.cc (Symbol::override_base_with_special): Don't override
2359 the version if the overriding symbol has a different name.
2360 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2361 all callers. If we give an error about an undefined version,
2362 define the base version if necessary.
2363 * dynobj.h (class Versions): Update declaration.
2364 * testsuite/weak_alias_test_5.cc: New file.
2365 * testsuite/weak_alias_test.script: New file.
2366 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2367 and versioned_alias have the right value, and call t2.
2368 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2369 weak_alias_test_5.so.
2370 (weak_alias_test_LDADD): Likewise.
2371 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2372 * testsuite/Makefile.in: Rebuild.
2373
2374 2011-07-01 Ian Lance Taylor <iant@google.com>
2375
2376 PR gold/12525
2377 * options.h (class General_options): Support -z notext.
2378 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2379 -Wl,-z,notext.
2380 (two_file_shared_nonpic.so): Likewise.
2381 (two_file_shared_mixed.so): Likewise.
2382 (two_file_shared_mixed_1.so): Likewise.
2383 (weak_undef_lib_nonpic.so): Likewise.
2384 (alt/weak_undef_lib_nonpic.so): Likewise.
2385 (tls_test_shared_nonpic.so): Likewise.
2386 * testsuite/Makefile.in: Rebuild.
2387
2388 2011-07-01 Ian Lance Taylor <iant@google.com>
2389
2390 PR gold/12525
2391 * configure.ac: Test whether static linking works, setting
2392 the automake conditional HAVE_STATIC.
2393 * testsuite/Makefile.am: Disable tests using -static if
2394 HAVE_STATIC is not true.
2395 * configure, testsuite/Makefile.in: Rebuild.
2396
2397 2011-07-01 Ian Lance Taylor <iant@google.com>
2398
2399 PR gold/12525
2400 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2401 Assert if we see DW_EH_PE_indirect.
2402 * target.h (Target::ehframe_datarel_base): New function.
2403 (Target::do_ehframe_datarel_base): New target function.
2404 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2405 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2406 function.
2407
2408 2011-07-01 Ian Lance Taylor <iant@google.com>
2409
2410 PR gold/12571
2411 * options.h (class General_options): Add
2412 --ld-generated-unwind-info.
2413 * ehframe.cc (Fde::write): Add address parameter. Change all
2414 callers. If associated with PLT, fill in address and size.
2415 (Cie::set_output_offset): Only add merge mapping if there is an
2416 object.
2417 (Cie::write): Add address parameter. Change all callers.
2418 (Eh_frame::add_ehframe_for_plt): New function.
2419 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2420 input_offset_ fields into union u_, with new plt field.
2421 (Fde::Fde): Adjust for new union field.
2422 (Fde::Fde) [Output_data version]: New constructor.
2423 (Fde::add_mapping): Only add merge mapping if there is an object.
2424 (class Cie): Update declarations.
2425 (class Eh_frame): Declare add_ehframe_for_plt.
2426 * layout.cc (Layout::layout_eh_frame): Break out code into
2427 make_eh_frame_section, and call it.
2428 (Layout::make_eh_frame_section): New function.
2429 (Layout::add_eh_frame_for_plt): New function.
2430 * layout.h (class Layout): Update declarations.
2431 * merge.cc (Merge_map::add_mapping): Add assertion.
2432 * i386.cc: Include "dwarf.h".
2433 (class Output_data_plt_i386): Make first_plt_entry,
2434 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2435 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2436 and plt_eh_frame_fde.
2437 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2438 boundary. Call add_eh_frame_for_plt if appropriate.
2439 * x86_64.cc: Include "dwarf.h".
2440 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2441 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2442 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2443 and plt_eh_frame_fde.
2444 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2445 appropriate.
2446
2447 2011-06-29 Ian Lance Taylor <iant@google.com>
2448
2449 PR gold/12629
2450 * object.cc (Sized_relobj_file::layout_section): Change shdr
2451 parameter to be const.
2452 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2453 out of do_layout.
2454 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2455 appropriate. Call layout_eh_frame_section.
2456 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2457 sections.
2458 * object.h (class Sized_relobj_file): Update declarations.
2459
2460 2011-06-29 Ian Lance Taylor <iant@google.com>
2461
2462 PR gold/12652
2463 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2464 modifier.
2465 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2466
2467 2011-06-29 Ian Lance Taylor <iant@google.com>
2468
2469 PR gold/12675
2470 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2471 SHT_X86_64_UNWIND.
2472 * layout.cc (Layout::layout_eh_frame): Likewise.
2473
2474 2011-06-29 Ian Lance Taylor <iant@google.com>
2475
2476 PR gold/12695
2477 * layout.cc (Layout::symtab_section_shndx): New function.
2478 * layout.h (class Layout): Declare symtab_section_shndx.
2479 * output.cc (Output_section::write_header): Call it.
2480
2481 2011-06-29 Ian Lance Taylor <iant@google.com>
2482
2483 PR gold/12818
2484 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2485 symbols which are not used in a relocation.
2486
2487 2011-06-28 Ian Lance Taylor <iant@google.com>
2488
2489 PR gold/12898
2490 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2491 script create indistinguishable segments.
2492 (Layout::set_segment_offsets): Use stable_sort when sorting
2493 segments. Pass this to Compare_segments constructor.
2494 * layout.h (class Layout): Make segment_precedes non-static.
2495 (class Compare_segments): Change from struct to class. Add
2496 layout_ field. Add constructor.
2497 * script-sections.cc
2498 (Script_sections::attach_sections_using_phdrs_clause): Rename
2499 local orphan to is_orphan. Don't report failure to put empty
2500 section in segment. On attachment failure, report name of
2501 section, and attach to first PT_LOAD segment.
2502
2503 2011-06-28 Ian Lance Taylor <iant@google.com>
2504
2505 PR gold/12934
2506 * target-select.cc (Target_selector::Target_selector): Add
2507 emulation parameter. Change all callers.
2508 (select_target_by_bfd_name): Rename from select_target_by_name.
2509 Change all callers.
2510 (select_target_by_emulation): New function.
2511 (supported_emulation_names): New function.
2512 * target-select.h (class Target_selector): Add emulation_ field.
2513 Update declarations.
2514 (Target_selector::recognize_by_bfd_name): Rename from
2515 recognize_by_name. Change all callers.
2516 (Target_selector::supported_bfd_names): Rename from
2517 supported_names. Change all callers.
2518 (Target_selector::recognize_by_emulation): New function.
2519 (Target_selector::supported_emulations): New function.
2520 (Target_selector::emulation): New function.
2521 (Target_selector::do_recognize_by_bfd_name): Rename from
2522 do_recognize_by_name. Change all callers.
2523 (Target_selector::do_supported_bfd_names): Rename from
2524 do_supported_names. Change all callers.
2525 (Target_selector::do_recognize_by_emulation): New function.
2526 (Target_selector::do_supported_emulations): New function.
2527 (select_target_by_bfd_name): Change name in declaration.
2528 (select_target_by_emulation): Declare.
2529 (supported_emulation_names): Declare.
2530 * parameters.cc (parameters_force_valid_target): Try to find
2531 target based on emulation from -m option.
2532 * options.h (class General_options): Change doc string for -m.
2533 * options.cc (help): Print emulations.
2534 (General_options::parse_V): Likewise.
2535 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2536 Add emulation parameter. Change all callers.
2537
2538 2011-06-28 Ian Lance Taylor <iant@google.com>
2539
2540 * target.h (class Target): Add osabi_ field.
2541 (Target::osabi): New function.
2542 (Target::set_osabi): New function.
2543 (Target::Target): Initialize osabi_.
2544 (Target::do_adjust_elf_header): Make pure virtual.
2545 (Sized_target::do_adjust_elf_header): Declare.
2546 * target.cc (Sized_target::do_adjust_elf_header): New function.
2547 (class Sized_target): Instantiate all versions.
2548 * freebsd.h (class Target_freebsd): Remove.
2549 (Target_selector_freebsd::do_recognize): Call set_osabi on
2550 Target.
2551 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2552 (Target_selector_freebsd::set_osabi): Remove.
2553 * i386.cc (class Target_i386): Inherit from Sized_target rather
2554 than Target_freebsd.
2555 * x86_64.cc (class Target_x86_64): Likewise.
2556
2557 2011-06-28 Ian Lance Taylor <iant@google.com>
2558
2559 * target.h (Target::can_check_for_function_pointers): Rewrite.
2560 Make non-virtual.
2561 (Target::can_icf_inline_merge_sections): Likewise.
2562 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2563 (Target::Target_info): Add can_icf_inline_merge_sections field.
2564 (Target::do_can_check_for_function_pointers): New virtual
2565 function.
2566 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2567 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2568 from can_check_for_function_pointers, move in file.
2569 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2570 section_may_have_icf_unsafe_poineters, move in file.
2571 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2572 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2573 Rename from can_check_for_function_pointers, move in file.
2574 (Target_i386::can_icf_inline_merge_sections): Remove.
2575 (Target_i386::i386_info): Initialize
2576 can_icf_inline_merge_sections.
2577 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2578 Initialize can_icf_inline_merge_sections.
2579 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2580 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2581 Rename from can_check_for_function_pointers, move in file.
2582 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2583 (Target_x86_64::x86_64_info): Initialize
2584 can_icf_inline_merge_sections.
2585 * testsuite/testfile.cc (Target_test::test_target_info):
2586 Likewise.
2587 * icf.cc (get_section_contents): Correct formatting.
2588
2589 2011-06-27 Ian Lance Taylor <iant@google.com>
2590
2591 * symtab.cc (Symbol::versioned_name): New function.
2592 (Symbol_table::add_to_final_symtab): Use versioned_name when
2593 appropriate.
2594 (Symbol_table::sized_write_symbol): Likewise.
2595 * symtab.h (class Symbol): Declare versioned_name.
2596 * stringpool.h (class Stringpool_template): Add variant of add
2597 which takes a std::basic_string.
2598 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2599 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2600 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2601 (ver_test_12.o): New target.
2602 * testsuite/Makefile.in: Rebuild.
2603
2604 2011-06-27 Doug Kwan <dougkwan@google.com>
2605
2606 * arm.cc (Arm_relocate_functions::thm_jump8,
2607 Arm_relocate_functions::thm_jump11): Use a wider signed
2608 type to compute offset.
2609 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2610 arm_thm_jump8.
2611 * testsuite/Makefile.in: Regenerate.
2612 * testsuite/arm_branch_in_range.sh: Check test results of
2613 arm_thm_jump11 and arm_thm_jump8.
2614 * testsuite/arm_thm_jump11.s: New test source file.
2615 * testsuite/arm_thm_jump11.t: New linker script.
2616 * testsuite/arm_thm_jump8.s: New test source file.
2617 * testsuite/arm_thm_jump8.t: New linker script.
2618
2619 2011-06-24 Ian Lance Taylor <iant@google.com>
2620
2621 * layout.cc: Include "object.h".
2622 (ctors_sections_in_init_array): New static variable.
2623 (Layout::is_ctors_in_init_array): New function.
2624 (Layout::layout): Add entry to ctors_sections_in_init_array if
2625 appropriate.
2626 * layout.h (class Layout): Declare is_ctors_in_init_array.
2627 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2628 is_ctors_reverse_view is set.
2629 (Sized_relobj_file::write_sections): Add layout parameter. Change
2630 all callers. Set is_ctors_reverse_view field of View_size.
2631 (Sized_relobj_file::reverse_words): New function.
2632 * object.h (Sized_relobj_file::View_size): Add
2633 is_ctors_reverse_view field.
2634 (class Sized_relobj_file): Update declarations.
2635 * testsuite/initpri3.c: New test.
2636 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2637 initpri3b.
2638 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2639 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2640 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2641 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2642 * testsuite/Makefile.in: Rebuild.
2643
2644 2011-06-24 Cary Coutant <ccoutant@google.com>
2645
2646 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2647 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2648 (debug_msg_cdebug.err): New targets.
2649 * testsuite/Makefile.in: Regenerate.
2650 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2651 Fix checks for link with shared library.
2652
2653 2011-06-24 Doug Kwan <dougkwan@google.com>
2654
2655 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2656 skip empty text sections.
2657 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2658
2659 2011-06-22 Ian Lance Taylor <iant@google.com>
2660
2661 PR gold/12910
2662 * options.h (class General_options): Add --ctors-in-init-array.
2663 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2664 friends as SHT_PROGBITS for merging sections.
2665 (Layout::layout): Remove special handling of .init_array and
2666 friends. Don't sort if doing relocatable link. Sort for .ctors
2667 and .dtors if ctors_in_init_array.
2668 (Layout::make_output_section): Force correct section types for
2669 .init_array and friends. Don't sort if doing relocatable link,
2670 Don't sort .ctors and .dtors if ctors_in_init_array.
2671 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2672 (Layout::output_section_name): Add relobj parameter. Change all
2673 callers. Handle .ctors. and .dtors. in code rather than table.
2674 Handle .ctors and .dtors if ctors_in_init_array.
2675 (Layout::match_file_name): New function, moved from output.cc.
2676 * layout.h (class Layout): Update declarations.
2677 * output.cc: Include "layout.h".
2678 (Input_section_sort_entry::get_priority): New function.
2679 (Input_section_sort_entry::match_file_name): Just call
2680 Layout::match_file_name.
2681 (Output_section::Input_section_sort_init_fini_compare::operator()):
2682 Handle .ctors and .dtors. Sort by explicit priority rather than
2683 by name.
2684 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2685 * testsuite/initpri2.c: New test.
2686 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2687 (check_PROGRAMS): Add initpri2.
2688 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2689 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2690 * configure, testsuite/Makefile.in: Rebuild.
2691
2692 2011-06-19 Ian Lance Taylor <iant@google.com>
2693
2694 PR gold/12880
2695 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2696 .interp section to a PT_INTERP segment even if we have seen a
2697 --dynamic-linker option. Don't do it if we have seen a PHDRS
2698 clause in a linker script.
2699 (Layout::finalize): Don't create a .interp section if we've
2700 already create a PT_INTERP segment.
2701 (Layout::create_interp): Always call choose_output_section (revert
2702 patch of 2011-06-17). Don't create PT_INTERP segment.
2703 * script-sections.cc
2704 (Script_sections::create_note_and_tls_segments): Add a .interp
2705 section to a PT_INTERP segment even if we have seen a
2706 --dynamic-linker option.
2707
2708 2011-06-18 Ian Lance Taylor <iant@google.com>
2709
2710 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2711 merely because a non-PT_LOAD segment has a dynamic reloc.
2712
2713 2011-06-18 Ian Lance Taylor <iant@google.com>
2714
2715 * layout.cc (Layout::finish_dynamic_section): Don't create
2716 DT_FLAGS entry if not needed.
2717
2718 2011-06-18 Ian Lance Taylor <iant@google.com>
2719
2720 PR gold/12745
2721 * layout.cc (Layout::layout_eh_frame): Correct handling of
2722 writable .eh_frame section.
2723
2724 2011-06-17 Ian Lance Taylor <iant@google.com>
2725
2726 PR gold/12893
2727 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2728 symbol is redefined with the exact same object and value.
2729
2730 2011-06-17 Ian Lance Taylor <iant@google.com>
2731
2732 PR gold/12880
2733 * layout.h (class Layout): Add interp_segment_ field.
2734 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2735 (Layout::attach_allocated_section_to_segment): If making shared
2736 library, put .interp section in PT_INTERP segment.
2737 (Layout::finalize): Also call create_interp if -dynamic-linker
2738 option was used.
2739 (Layout::create_interp): Assert that there is no PT_INTERP
2740 segment. If not using a SECTIONS clause, use make_output_section.
2741 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2742 * script-sections.cc
2743 (Script_sections::create_note_and_tls_segments): If making shared
2744 library, put .interp section in PT_INTERP segment.
2745
2746 2011-06-17 Ian Lance Taylor <iant@google.com>
2747
2748 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2749 when making a shared library.
2750
2751 2011-06-17 Ian Lance Taylor <iant@google.com>
2752
2753 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2754 parameter. Change all callers. Don't issue warning about PC32
2755 against locally defined symbol.
2756
2757 2011-06-16 Ian Lance Taylor <iant@google.com>
2758
2759 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2760 occurs in same object.
2761
2762 2011-06-14 Alan Modra <amodra@gmail.com>
2763
2764 * po/POTFILES.in: Regenerate.
2765
2766 2011-06-09 Ian Lance Taylor <iant@google.com>
2767
2768 * script-sections.cc
2769 (Orphan_output_section::set_section_addresses): For a relocatable
2770 link set address to 0.
2771
2772 2011-06-09 Cary Coutant <ccoutant@google.com>
2773
2774 PR gold/12804
2775 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2776 used with --compress-debug-sections.
2777 * gold/object.cc (Sized_relobj_file::do_layout): Report
2778 uncompressed size of compressed input sections.
2779
2780 2011-06-08 Cary Coutant <ccoutant@google.com>
2781
2782 PR gold/12804
2783 * testsuite/two_file_test_2_v1.cc: Change initialization of
2784 v2 to keep it in .data.
2785
2786 2011-06-07 Cary Coutant <ccoutant@google.com>
2787
2788 * common.cc (Symbol_table::do_allocate_commons_list): Call
2789 gold_fallback.
2790 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2791 (Errors::fallback): New function.
2792 (gold_fallback): New function.
2793 * errors.h (Errors::fallback): New function.
2794 * gold.cc (gold_exit): Change status parameter to enum; adjust
2795 all callers.
2796 (queue_initial_tasks): Call gold_fallback.
2797 * gold.h: Include cstdlib.
2798 (Exit_status): New enum type.
2799 (gold_exit): Change status parameter to enum.
2800 (gold_fallback): New function.
2801 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2802 (Layout::create_symtab_sections): Likewise.
2803 (Layout::create_shdrs): Likewise.
2804 * main.cc (main): Adjust call to gold_exit.
2805 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2806 (Output_data_got::add_got_entry_pair): Likewise.
2807 (Output_section::add_input_section): Likewise.
2808 (Output_section::add_output_section_data): Likewise.
2809 (Output_segment::set_section_list_addresses): Likewise.
2810 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2811
2812 2011-06-07 Cary Coutant <ccoutant@google.com>
2813
2814 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2815 for incremental links.
2816 * output.cc (Output_segment::set_section_list_addresses): Remove
2817 FIXME and test for TLS or BSS.
2818
2819 2011-06-07 Cary Coutant <ccoutant@google.com>
2820
2821 * testsuite/Makefile.am: Add incremental_copy_test,
2822 incremental_common_test_1.
2823 * testsuite/Makefile.in: Regenerate.
2824 * testsuite/common_test_1_v1.c: New source file.
2825 * testsuite/common_test_1_v2.c: New source file.
2826 * testsuite/copy_test_v1.cc: New source file.
2827
2828 2011-06-07 Cary Coutant <ccoutant@google.com>
2829
2830 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2831 update, allocate common from bss section's free list.
2832 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2833 linker-defined symbols.
2834 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2835 Skip GOT and PLT entries that are no longer referenced.
2836 (Output_section_incremental_inputs::write_info_blocks): Mark
2837 linker-defined symbols.
2838 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2839 * output.cc (Output_section::allocate): New function.
2840 * output.h (Output_section::allocate): New function.
2841 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2842 linker-defined symbols.
2843 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2844 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2845 (Symbol::init_base_output_data): Likewise.
2846 (Symbol::init_base_output_segment): Likewise.
2847 (Symbol::init_base_constant): Likewise.
2848 (Sized_symbol::init_output_data): Likewise.
2849 (Sized_symbol::init_output_segment): Likewise.
2850 (Sized_symbol::init_constant): Likewise.
2851 (Symbol_table::do_define_in_output_data): Likewise.
2852 (Symbol_table::do_define_in_output_segment): Likewise.
2853 (Symbol_table::do_define_as_constant): Likewise.
2854 * symtab.h (Symbol::is_predefined): New function.
2855 (Symbol::init_base_output_data): Add is_predefined parameter.
2856 (Symbol::init_base_output_segment): Likewise.
2857 (Symbol::init_base_constant): Likewise.
2858 (Symbol::is_predefined_): New data member.
2859 (Sized_symbol::init_output_data): Add is_predefined parameter.
2860 (Sized_symbol::init_output_segment): Likewise.
2861 (Sized_symbol::init_constant): Likewise.
2862 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2863
2864 2011-06-07 Cary Coutant <ccoutant@google.com>
2865
2866 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2867 instead of emit_copy_reloc.
2868 (Copy_relocs::emit_copy_reloc): Refactor.
2869 (Copy_relocs::make_copy_reloc): New function.
2870 (Copy_relocs::add_copy_reloc): Remove.
2871 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2872 section.
2873 (Copy_relocs::make_copy_reloc): New function.
2874 (Copy_relocs::add_copy_reloc): Remove.
2875 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2876 unchanged input files.
2877 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2878 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2879 Reserve BSS space for COPY relocations.
2880 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2881 (Output_section_incremental_inputs::write_info_blocks): Record
2882 whether a symbol is copied from a shared object.
2883 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2884 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2885 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2886 (Incremental_input_entry_reader::get_output_symbol_index): Add
2887 is_copy parameter.
2888 (Incremental_binary::emit_copy_relocs): New function.
2889 (Incremental_binary::do_emit_copy_relocs): New function.
2890 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2891 new data member.
2892 (Sized_incremental_binary::add_copy_reloc): New function.
2893 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2894 (Sized_incremental_binary::Copy_reloc): New struct.
2895 (Sized_incremental_binary::Copy_relocs): New typedef.
2896 (Sized_incremental_binary::copy_relocs_): New data member.
2897 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2898 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2899 * target.h (Sized_target::emit_copy_reloc): New function.
2900 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2901
2902 2011-06-02 Cary Coutant <ccoutant@google.com>
2903
2904 PR gold/12163
2905 * gold/archive.cc (Archive::Archive): Initialize new data member.
2906 (Archive::include_all_members): Return if archive has already been
2907 included.
2908 * gold/archive.h (Archive::include_all_members_): New data member.
2909
2910 2011-06-02 Nick Clifton <nickc@redhat.com>
2911
2912 * dynobj.h: Fix spelling mistake in comment.
2913 * output.cc: Likewise.
2914
2915 2011-05-31 Doug Kwan <dougkwan@google.com>
2916 Asier Llano
2917
2918 PR gold/12826
2919 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2920 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2921 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2922 redundant arm_exidx_test.so.
2923 * testsuite/Makefile.in: Regenerate.
2924 (check_SCRIPTS): Add pr12826.sh
2925 (check_DATA): Add pr12826.stdout
2926 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2927 * testsuite/pr12826.sh: New file.
2928 * testsuite/pr12826_1.s: Ditto.
2929 * testsuite/pr12826_1.s: Ditto.
2930
2931 2011-05-30 Ian Lance Taylor <iant@google.com>
2932
2933 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2934 sections.
2935
2936 2011-05-29 Ian Lance Taylor <iant@google.com>
2937
2938 PR gold/12804
2939 * testsuite/Makefile.am: Use different file name for two_file_test
2940 temporary file for each incremental test.
2941 * testsuite/Makefile.in: Rebuild.
2942
2943 2011-05-29 Ian Lance Taylor <iant@google.com>
2944
2945 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2946 binary input file is empty.
2947
2948 2011-05-27 Ian Lance Taylor <iant@google.com>
2949
2950 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2951 (ver_test_9.so): Likewise.
2952 * testsuite/Makefile.in: Rebuild.
2953
2954 2011-05-26 Cary Coutant <ccoutant@google.com>
2955
2956 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2957 * incremental.cc (Incremental_inputs::report_input_section): Fix
2958 comment, indentation.
2959 (Incremental_inputs::report_comdat_group): New function.
2960 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2961 of data for incremental input file entry.
2962 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2963 group count, COMDAT group signatures.
2964 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2965 an unchanged input file.
2966 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2967 Initialize new data member.
2968 (Incremental_object_entry::add_comdat_group): New function.
2969 (Incremental_object_entry::get_comdat_group_count): New function.
2970 (Incremental_object_entry::get_comdat_signature_key): New function.
2971 (Incremental_object_entry::groups_): New data member.
2972 (Incremental_inputs::report_comdat_group): New function.
2973 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2974 data for incremental input file entry.
2975 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2976 (Incremental_input_entry_reader::get_input_section): Adjust size of
2977 data for incremental input file entry.
2978 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2979 (Incremental_input_entry_reader::get_comdat_group_signature): New
2980 function.
2981 * object.cc (Sized_relobj::include_section_group): Report kept
2982 COMDAT groups for incremental links.
2983
2984 2011-05-24 David Meyer <pdox@google.com>
2985
2986 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2987 with name parameter. Add found_name parameter.
2988 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2989 * dirsearch.h (class Dirsearch): Update declaration.
2990
2991 2011-05-24 Ian Lance Taylor <iant@google.com>
2992
2993 * archive.cc (Library_base::should_include_member): Pull in object
2994 from archive if it defines the entry symbol.
2995 * parameters.cc (Parameters::entry): New function.
2996 * parameters.h (class Parameters): Declare entry.
2997 * output.h (class Output_file_header): Remove entry_ field.
2998 * output.cc (Output_file_header::Output_file_header): Remove entry
2999 parameter. Change all callers.
3000 (Output_file_header::entry): Use parameters->entry.
3001 * gold.cc (queue_middle_tasks): Likewise.
3002 * plugin.cc (Plugin_hook::run): Likewise.
3003
3004 2011-05-24 Cary Coutant <ccoutant@google.com>
3005
3006 * gold.cc (queue_initial_tasks): Pass incremental base filename
3007 to Output_file::open_base_file; don't print error message.
3008 * incremental-dump.cc (main): Adjust call to
3009 Output_file::open_for_modification.
3010 * incremental-dump.cc (main): Likewise.
3011 * incremental.cc (Incremental_inputs::report_command_line):
3012 Ignore --incremental-base option when comparing command lines.
3013 Ignore parameter when given as separate argument.
3014 * options.h (class General_options): Add --incremental-base.
3015 * output.cc (Output_file::Output_file):
3016 (Output_file::open_base_file): Add base_name and writable parameters;
3017 read base file into new file; print error message here.
3018 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3019 callers.
3020 * output.h (Output_file::open_for_modification): Rename to...
3021 (Output_file::open_base_file): ...this; add base_name and
3022 writable parameters; adjust all callers.
3023 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3024 callers.
3025 * testsuite/Makefile.am (incremental_test_4): Test
3026 --incremental-base.
3027 * testsuite/Makefile.in: Regenerate.
3028
3029 2011-05-24 Cary Coutant <ccoutant@google.com>
3030
3031 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3032 incremental_test_4.
3033 * testsuite/Makefile.in: Regenerate.
3034 * testsuite/two_file_test_1_v1.cc: New test source file.
3035 * testsuite/two_file_test_1b_v1.cc: New test source file.
3036 * testsuite/two_file_test_2_v1.cc: New test source file.
3037
3038 2011-05-24 Cary Coutant <ccoutant@google.com>
3039
3040 * dynobj.h (Dynobj::do_dynobj): New function.
3041 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3042 flag and soname for shared objects.
3043 * incremental.cc (Incremental_inputs::report_object): Make
3044 either Incremental_object_entry or Incremental_dynobj_entry; add
3045 soname to string table.
3046 (Incremental_inputs::report_input_section): Add assertion.
3047 (Output_section_incremental_inputs::set_final_data_size): Adjust
3048 type of input file entry for shared libraries; adjust size of
3049 shared library info entry.
3050 (Output_section_incremental_inputs::write_input_files): Write
3051 as_needed flag for shared libraries.
3052 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3053 of input file entry for shared libraries; write soname.
3054 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3055 soname from incremental info.
3056 * incremental.h (enum Incremental_input_flags): Add
3057 INCREMENTAL_INPUT_AS_NEEDED.
3058 (Incremental_input_entry::Incremental_input_entry): Initialize new
3059 data member.
3060 (Incremental_input_entry::set_as_needed): New function.
3061 (Incremental_input_entry::as_needed): New function.
3062 (Incremental_input_entry::do_dynobj_entry): New function.
3063 (Incremental_input_entry::as_needed_): New data member.
3064 (Incremental_object_entry::Incremental_object_entry): Don't check
3065 for shared library.
3066 (Incremental_object_entry::do_type): Likewise.
3067 (class Incremental_dynobj_entry): New class.
3068 (Incremental_input_entry_reader::as_needed): New function.
3069 (Incremental_input_entry_reader::get_soname): New function.
3070 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3071 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3072 size of shared library info entry.
3073 * layout.cc (Layout::finish_dynamic_section): Don't test for
3074 incremental link when adding DT_NEEDED entries.
3075 * object.h (Object::Object): Initialize new data member.
3076 (Object::dynobj): New function.
3077 (Object::set_as_needed): New function.
3078 (Object::as_needed): New function.
3079 (Object::do_dynobj): New function.
3080 (Object::as_needed_): New data member.
3081
3082 2011-05-24 Cary Coutant <ccoutant@google.com>
3083
3084 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3085 info; adjust display of GOT entries.
3086 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3087 vector of input objects; remove file_status_.
3088 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3089 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3090 got_plt reader; call target hooks to reserve GOT entries.
3091 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3092 of input file info header and GOT info entry.
3093 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3094 relocation info.
3095 (Got_plt_view_info::got_descriptor): Remove.
3096 (Got_plt_view_info::sym_index): New data member.
3097 (Got_plt_view_info::input_index): New data member.
3098 (Local_got_offset_visitor::visit): Write input file index.
3099 (Global_got_offset_visitor::visit): Write 0 for input file index.
3100 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3101 with sym_index and input_index.
3102 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3103 incremental info GOT entry; replace got_descriptor with input_index.
3104 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3105 map from input file index to object.
3106 (Sized_relobj_incr::do_layout): Replace direct data member reference
3107 with accessor function.
3108 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3109 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3110 Adjust size of input file info header.
3111 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3112 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3113 (Incremental_input_entry_reader::get_input_section): Adjust size of
3114 input file info header.
3115 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3116 of incremental info GOT entry.
3117 (Incremental_got_plt_reader::get_got_desc): Remove.
3118 (Incremental_got_plt_reader::get_got_symndx): New function.
3119 (Incremental_got_plt_reader::get_got_input_index): New function.
3120 (Sized_incremental_binary::Sized_incremental_binary): Remove
3121 file_status_; add input_objects_.
3122 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3123 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3124 (Sized_incremental_binary::file_is_unchanged): Remove.
3125 (Sized_incremental_binary::set_input_object): New function.
3126 (Sized_incremental_binary::input_object): New function.
3127 (Sized_incremental_binary::file_status_): Remove.
3128 (Sized_incremental_binary::input_objects_): New data member.
3129 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3130 references.
3131 (Sized_relobj_incr::invalid_address): Move to base class.
3132 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3133 class.
3134 (Sized_relobj_incr::do_output_section_offset): Likewise.
3135 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3136 (Sized_relobj_incr::section_offsets_): Likewise.
3137 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3138 function.
3139 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3140 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3141 with accessor function.
3142 (Sized_relobj_file::do_layout): Likewise.
3143 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3144 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3145 (Sized_relobj_file::compute_final_local_value): Replace refs to
3146 section_offsets_ with accessor function.
3147 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3148 * object.h (Relobj::Relobj): Initialize new data members.
3149 (Relobj::add_dyn_reloc): New function.
3150 (Relobj::first_dyn_reloc): New function.
3151 (Relobj::dyn_reloc_count): New function.
3152 (Relobj::first_dyn_reloc_): New data member.
3153 (Relobj::dyn_reloc_count_): New data member.
3154 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3155 references.
3156 (Sized_relobj::Address): New typedef.
3157 (Sized_relobj::invalid_address): Move here from child class.
3158 (Sized_relobj::Sized_relobj): Initialize new data members.
3159 (Sized_relobj::sized_relobj): New function.
3160 (Sized_relobj::is_output_section_offset_invalid): Move here from
3161 child class.
3162 (Sized_relobj::get_output_section_offset): Likewise.
3163 (Sized_relobj::local_has_got_offset): Likewise.
3164 (Sized_relobj::local_got_offset): Likewise.
3165 (Sized_relobj::set_local_got_offset): Likewise.
3166 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3167 (Sized_relobj::clear_got_offsets): New function.
3168 (Sized_relobj::section_offsets): Move here from child class.
3169 (Sized_relobj::do_output_section_offset): Likewise.
3170 (Sized_relobj::do_set_section_offset): Likewise.
3171 (Sized_relobj::Local_got_offsets): Likewise.
3172 (Sized_relobj::local_got_offsets_): Likewise.
3173 (Sized_relobj::section_offsets_): Likewise.
3174 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3175 references.
3176 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3177 class.
3178 (Sized_relobj_file::sized_relobj): New function
3179 (Sized_relobj_file::local_has_got_offset): Move to base class.
3180 (Sized_relobj_file::local_got_offset): Likewise.
3181 (Sized_relobj_file::set_local_got_offset): Likewise.
3182 (Sized_relobj_file::get_output_section_offset): Likewise.
3183 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3184 (Sized_relobj_file::do_output_section_offset): Likewise.
3185 (Sized_relobj_file::do_set_section_offset): Likewise.
3186 (Sized_relobj_file::Local_got_offsets): Likewise.
3187 (Sized_relobj_file::local_got_offsets_): Likewise.
3188 (Sized_relobj_file::section_offsets_): Likewise.
3189 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3190 (all constructors).
3191 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3192 (Output_reloc::get_symbol_index): Likewise.
3193 (Output_reloc::local_section_offset): Likewise.
3194 (Output_reloc::get_address): Likewise.
3195 (Output_reloc::symbol_value): Likewise.
3196 (Output_data_got::reserve_slot): Move to class definition.
3197 (Output_data_got::reserve_local): New function.
3198 (Output_data_got::reserve_slot_for_global): Remove.
3199 (Output_data_got::reserve_global): New function.
3200 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3201 (all constructors, two instantiations).
3202 (Output_reloc::get_relobj): New function (two instantiations).
3203 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3204 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3205 (Output_data_reloc::add_global): Adjust type of relobj.
3206 (Output_data_reloc::add_global_relative): Likewise.
3207 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3208 (Output_data_reloc::add_local): Likewise.
3209 (Output_data_reloc::add_local_relative): Likewise.
3210 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3211 (Output_data_reloc::add_local_section): Likewise.
3212 (Output_data_reloc::add_output_section): Likewise.
3213 (Output_data_reloc::add_absolute): Likewise.
3214 (Output_data_reloc::add_target_specific): Likewise.
3215 (Output_data_got::reserve_slot): Move definition here.
3216 (Output_data_got::reserve_local): New function.
3217 (Output_data_got::reserve_global): New function.
3218 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3219 section_offsets_ with accessor function.
3220 (Sized_relobj_file::write_sections): Likewise.
3221 (Sized_relobj_file::do_relocate_sections): Likewise.
3222 * target.h (Sized_target::reserve_local_got_entry): New function.
3223 (Sized_target::reserve_global_got_entry): New function.
3224 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3225 (Target_x86_64::reserve_global_got_entry): New function.
3226 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3227
3228 2011-05-23 Cary Coutant <ccoutant@google.com>
3229
3230 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3231 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3232 bit when checking got_type.
3233 * incremental.cc (Sized_incremental_binary::setup_readers):
3234 Store symbol table and string table locations; initialize bit vector
3235 of file status flags.
3236 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3237 unchanged files.
3238 (Sized_incremental_binary::do_process_got_plt): New function.
3239 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3240 (Output_section_incremental_inputs::set_final_data_size): Record
3241 file index for each input file.
3242 (Output_section_incremental_inputs::write_got_plt): Store file index
3243 instead of input entry offset for each GOT entry.
3244 * incremental.h
3245 (Incremental_input_entry::Incremental_input_entry): Initialize new
3246 data member.
3247 (Incremental_input_entry::set_offset): Store file index.
3248 (Incremental_input_entry::get_file_index): New function.
3249 (Incremental_input_entry::file_index_): New data member.
3250 (Incremental_binary::process_got_plt): New function.
3251 (Incremental_binary::do_process_got_plt): New function.
3252 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3253 data members.
3254 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3255 (Sized_incremental_binary::set_file_is_unchanged): New function.
3256 (Sized_incremental_binary::file_is_unchanged): New function.
3257 (Sized_incremental_binary::do_process_got_plt): New function.
3258 (Sized_incremental_binary::file_status_): New data member.
3259 (Sized_incremental_binary::main_symtab_loc_): New data member.
3260 (Sized_incremental_binary::main_strtab_loc_): New data member.
3261 * output.cc (Output_data_got::Got_entry::write): Add case
3262 RESERVED_CODE.
3263 (Output_data_got::add_global): Call add_got_entry.
3264 (Output_data_got::add_global_plt): Likewise.
3265 (Output_data_got::add_global_with_rel): Likewise.
3266 (Output_data_got::add_global_with_rela): Likewise.
3267 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3268 (Output_data_got::add_global_pair_with_rela): Likewise.
3269 (Output_data_got::add_local): Call add_got_entry.
3270 (Output_data_got::add_local_plt): Likewise.
3271 (Output_data_got::add_local_with_rel): Likewise.
3272 (Output_data_got::add_local_with_rela): Likewise.
3273 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3274 (Output_data_got::add_local_pair_with_rela): Likewise.
3275 (Output_data_got::reserve_slot): New function.
3276 (Output_data_got::reserve_slot_for_global): New function.
3277 (Output_data_got::add_got_entry): New function.
3278 (Output_data_got::add_got_entry_pair): New function.
3279 (Output_section::add_output_section_data): Edit FIXME.
3280 * output.h
3281 (Output_section_data_build::Output_section_data_build): New
3282 constructor with size parameter.
3283 (Output_data_space::Output_data_space): Likewise.
3284 (Output_data_got::Output_data_got): Initialize new data member; new
3285 constructor with size parameter.
3286 (Output_data_got::add_constant): Call add_got_entry.
3287 (Output_data_got::reserve_slot): New function.
3288 (Output_data_got::reserve_slot_for_global): New function.
3289 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3290 (Output_data_got::add_got_entry): New function.
3291 (Output_data_got::add_got_entry_pair): New function.
3292 (Output_data_got::free_list_): New data member.
3293 * target.h (Sized_target::init_got_plt_for_update): New function.
3294 (Sized_target::register_global_plt_entry): New function.
3295 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3296 Initialize new data member; call init; add constructor with PLT count.
3297 (Output_data_plt_x86_64::init): New function.
3298 (Output_data_plt_x86_64::add_relocation): New function.
3299 (Output_data_plt_x86_64::reserve_slot): New function.
3300 (Output_data_plt_x86_64::free_list_): New data member.
3301 (Target_x86_64::init_got_plt_for_update): New function.
3302 (Target_x86_64::register_global_plt_entry): New function.
3303 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3304 incremental updates.
3305 (Output_data_plt_x86_64::add_relocation): New function.
3306 * testsuite/object_unittest.cc (Object_test): Set default options.
3307
3308 2011-05-16 Ian Lance Taylor <iant@google.com>
3309
3310 * options.h (class General_options): Make -i a synonym for -r.
3311
3312 2011-05-16 Ian Lance Taylor <iant@google.com>
3313
3314 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3315
3316 2011-05-10 Cary Coutant <ccoutant@google.com>
3317
3318 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3319 strip_all (-s).
3320
3321 2011-05-06 Ian Lance Taylor <iant@google.com>
3322
3323 * layout.cc (Layout::layout): If the output section flags change,
3324 update the ordering.
3325
3326 2011-04-25 Cary Coutant <ccoutant@google.com>
3327
3328 * incremental-dump.cc (dump_incremental_inputs): Print local
3329 symbol info for each input file.
3330 * incremental.cc
3331 (Output_section_incremental_inputs::set_final_data_size): Add local
3332 symbol info to input file entries in incremental info.
3333 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3334 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3335 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3336 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3337 implementation.
3338 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3339 (Sized_incr_relobj::do_relocate): Write the local symbols.
3340 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3341 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3342 Adjust size of input file header.
3343 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3344 (Incremental_inputs_reader::get_local_symbol_count): New function.
3345 (Incremental_inputs_reader::get_input_section): Adjust size of input
3346 file header.
3347 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3348 (Sized_incr_relobj::This): New typedef.
3349 (Sized_incr_relobj::sym_size): New const data member.
3350 (Sized_incr_relobj::Local_symbol): New struct.
3351 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3352 (Sized_incr_relobj::do_local_symbol_offset): New function.
3353 (Sized_incr_relobj::local_symbol_count_): New data member.
3354 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3355 (Sized_incr_relobj::local_symbol_index_): New data member.
3356 (Sized_incr_relobj::local_symbol_offset_): New data member.
3357 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3358 (Sized_incr_relobj::local_symbols_): New data member.
3359 * object.h (Relobj::output_local_symbol_count): New function.
3360 (Relobj::local_symbol_offset): New function.
3361 (Relobj::do_output_local_symbol_count): New function.
3362 (Relobj::do_local_symbol_offset): New function.
3363 (Sized_relobj::do_output_local_symbol_count): New function.
3364 (Sized_relobj::do_local_symbol_offset): New function.
3365
3366 2011-04-22 Vladimir Simonov <sv@sw.ru>
3367
3368 * descriptors.cc (set_close_on_exec): New function.
3369 (Descriptors::open): Use set_close_on_exec.
3370 * output.cc (S_ISLNK): Define if not defined.
3371
3372 2011-04-22 Cary Coutant <ccoutant@google.com>
3373
3374 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3375 global symbol map.
3376 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3377 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3378 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3379 relocations.
3380 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3381 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3382 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3383 * incremental.h
3384 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3385 function.
3386 (Incremental_binary::apply_incremental_relocs): New function.
3387 (Incremental_binary::do_apply_incremental_relocs): New function.
3388 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3389 data member.
3390 (Sized_incremental_binary::add_global_symbol): New function.
3391 (Sized_incremental_binary::global_symbol): New function.
3392 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3393 (Sized_incremental_binary::symbol_map_): New data member.
3394 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3395 * target.h (Sized_target::apply_relocation): New function.
3396 * target-reloc.h (apply_relocation): New function.
3397 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3398
3399 2011-04-22 Doug Kwan <dougkwan@google.com>
3400
3401 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3402 flag of a SHT_ARM_EXIDX section.
3403 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3404 * testsuite/Makefile.in: Regenerate.
3405 * testsuite/arm_exidx_test.s: New file.
3406 * testsuite/arm_exidx_test.sh: Same.
3407
3408 2011-04-20 Cary Coutant <ccoutant@google.com>
3409
3410 PR gold/12689
3411 * archive.h (Incremental_archive_entry::Archive_member):
3412 Initialize arg_serial_ (second constructor).
3413
3414 2011-04-17 Ian Lance Taylor <iant@google.com>
3415
3416 * object.cc (Relocate_info::location): Simplify location string.
3417 * errors.cc (Errors::error_at_location): Don't print program
3418 name.
3419 (Errors::warning_at_location): Likewise.
3420 (Errors::undefined_symbol): Likewise.
3421 * testsuite/debug_msg.sh: Update accordingly.
3422
3423 2011-04-14 Cary Coutant <ccoutant@google.com>
3424
3425 * gold/layout.cc (Layout::symtab_section_offset): New function.
3426 * gold/layout.h (Layout::symtab_section_offset): New function.
3427 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3428
3429 2011-04-12 Ian Lance Taylor <iant@google.com>
3430
3431 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3432 with MREMAP_MAYMOVE.
3433 * output.h (class Output_file): Add map_is_allocated_ field.
3434 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3435 not available, provide stubs. If mremap is not available, #define
3436 it to gold_mremap.
3437 (MREMAP_MAYMOVE): Define if not defined.
3438 (Output_file::Output_file): Initialize map_is_allocated_.
3439 (Output_file::resize): Check map_is_allocated_.
3440 (Output_file::map_anonymous): If mmap fails, use malloc.
3441 (Output_file::unmap): Don't do anything for an anonymous map.
3442 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3443 is not available, provide stubs.
3444 (File_read::View::~View): Use free rather than delete[].
3445 (File_read::make_view): Use malloc rather than new[]. If mmap
3446 fails, use malloc.
3447 (File_read::find_or_make_view): Use malloc rather than new[].
3448 * gold.h: Remove HAVE_REMAP code.
3449 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3450 exists. Rename mremap to gold_mremap. If mmap is not available
3451 don't do anything.
3452 * configure, config.in: Rebuild.
3453
3454 2011-04-11 Ian Lance Taylor <iant@google.com>
3455
3456 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3457 initialize local variable v.
3458
3459 2011-04-11 Cary Coutant <ccoutant@google.com>
3460
3461 * archive.cc (Archive::include_member): Adjust call to
3462 report_object.
3463 (Add_archive_symbols::run): Track argument serial numbers.
3464 (Lib_group::include_member): Likewise.
3465 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3466 * archive.h (Incremental_archive_entry::Archive_member):
3467 Initialize arg_serial_.
3468 (Archive_member::arg_serial_): New data member.
3469 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3470 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3471 incremental link.
3472 (Sized_dynobj::do_for_all_local_got_entries): New function.
3473 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3474 function.
3475 * fileread.cc (get_mtime): New function.
3476 * fileread.h (get_mtime): New function.
3477 * gold.cc (queue_initial_tasks): Check for incremental update.
3478 (process_incremental_input): New function.
3479 (queue_middle_tasks): Don't force valid target for incremental
3480 update.
3481 * incremental-dump.cc (find_input_containing_global): Adjust
3482 size of symbol info entry.
3483 (dump_incremental_inputs): Dump argument serial number and
3484 in_system_directory flag; bias shndx by 1; print symbol names
3485 when dumping per-file symbol lists; use new symbol info readers.
3486 * incremental.cc
3487 (Output_section_incremental_inputs:update_data_size): New function.
3488 (Sized_incremental_binary::setup_readers): Setup input readers
3489 for each input file; build maps for files added from libraries
3490 and scripts.
3491 (Sized_incremental_binary::check_input_args): New function.
3492 (Sized_incremental_binary::do_check_inputs): Build map of argument
3493 serial numbers to input arguments.
3494 (Sized_incremental_binary::do_file_has_changed): Rename
3495 do_file_is_unchanged to this; compare file modification times.
3496 (Sized_incremental_binary::do_init_layout): New function.
3497 (Sized_incremental_binary::do_reserve_layout): New function.
3498 (Sized_incremental_binary::do_get_input_reader): Remove.
3499 (Sized_incremental_binary::get_symtab_view): New function.
3500 (Incremental_checker::can_incrementally_link_output_file): Remove.
3501 (Incremental_inputs::report_command_line): Exclude --debug options.
3502 (Incremental_inputs::report_archive_begin): Add parameter; track
3503 argument serial numbers; don't put input file entry for archive
3504 before archive members.
3505 (Incremental_inputs::report_archive_end): Put input file entry
3506 for archive after archive members.
3507 (Incremental_inputs::report_object): Add parameter; track argument
3508 serial numbers and in_system_directory flag.
3509 (Incremental_inputs::report_script): Add parameter; track argument
3510 serial numbers.
3511 (Output_section_incremental_inputs::set_final_data_size): Adjust
3512 size of symbol info entry; check for forwarding symbols.
3513 (Output_section_incremental_inputs::write_input_files): Write
3514 in_system_directory flag and argument serial number.
3515 (Output_section_incremental_inputs::write_info_blocks): Map section
3516 indices between incremental info and original input file; store
3517 input section index for each symbol.
3518 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3519 change operator() to visit().
3520 (class Global_got_offset_visitor): Likewise.
3521 (class Global_symbol_visitor_got_plt):
3522 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3523 classes.
3524 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3525 (Sized_incr_relobj::do_read_symbols): New function.
3526 (Sized_incr_relobj::do_layout): New function.
3527 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3528 (Sized_incr_relobj::do_add_symbols): New function.
3529 (Sized_incr_relobj::do_should_include_member): New function.
3530 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3531 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3532 (Sized_incr_relobj::do_section_size): New function.
3533 (Sized_incr_relobj::do_section_name): New function.
3534 (Sized_incr_relobj::do_section_contents): New function.
3535 (Sized_incr_relobj::do_section_flags): New function.
3536 (Sized_incr_relobj::do_section_entsize): New function.
3537 (Sized_incr_relobj::do_section_address): New function.
3538 (Sized_incr_relobj::do_section_type): New function.
3539 (Sized_incr_relobj::do_section_link): New function.
3540 (Sized_incr_relobj::do_section_info): New function.
3541 (Sized_incr_relobj::do_section_addralign): New function.
3542 (Sized_incr_relobj::do_initialize_xindex): New function.
3543 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3544 (Sized_incr_relobj::do_read_relocs): New function.
3545 (Sized_incr_relobj::do_gc_process_relocs): New function.
3546 (Sized_incr_relobj::do_scan_relocs): New function.
3547 (Sized_incr_relobj::do_count_local_symbols): New function.
3548 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3549 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3550 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3551 (Sized_incr_relobj::do_relocate): New function.
3552 (Sized_incr_relobj::do_set_section_offset): New function.
3553 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3554 (Sized_incr_dynobj::do_read_symbols): New function.
3555 (Sized_incr_dynobj::do_layout): New function.
3556 (Sized_incr_dynobj::do_add_symbols): New function.
3557 (Sized_incr_dynobj::do_should_include_member): New function.
3558 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3559 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3560 (Sized_incr_dynobj::do_section_size): New function.
3561 (Sized_incr_dynobj::do_section_name): New function.
3562 (Sized_incr_dynobj::do_section_contents): New function.
3563 (Sized_incr_dynobj::do_section_flags): New function.
3564 (Sized_incr_dynobj::do_section_entsize): New function.
3565 (Sized_incr_dynobj::do_section_address): New function.
3566 (Sized_incr_dynobj::do_section_type): New function.
3567 (Sized_incr_dynobj::do_section_link): New function.
3568 (Sized_incr_dynobj::do_section_info): New function.
3569 (Sized_incr_dynobj::do_section_addralign): New function.
3570 (Sized_incr_dynobj::do_initialize_xindex): New function.
3571 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3572 (make_sized_incremental_object): New function.
3573 (Incremental_library::copy_unused_symbols): New function.
3574 (Incremental_library::do_for_all_unused_symbols): New function.
3575 * incremental.h (enum Incremental_input_flags): New type.
3576 (class Incremental_checker): Remove.
3577 (Incremental_input_entry::Incremental_input_entry): Add argument
3578 serial number.
3579 (Incremental_input_entry::arg_serial): New function.
3580 (Incremental_input_entry::set_is_in_system_directory): New function.
3581 (Incremental_input_entry::is_in_system_directory): New function.
3582 (Incremental_input_entry::arg_serial_): New data member.
3583 (Incremental_input_entry::is_in_system_directory_): New data member.
3584 (class Script_info): Move here from script.h.
3585 (Script_info::Script_info): Add filename parameter.
3586 (Script_info::filename): New function.
3587 (Script_info::filename_): New data member.
3588 (Incremental_script_entry::Incremental_script_entry): Add argument
3589 serial number.
3590 (Incremental_object_entry::Incremental_object_entry): Likewise.
3591 (Incremental_object_entry::add_input_section): Build list of input
3592 sections with map to original shndx.
3593 (Incremental_object_entry::get_input_section_index): New function.
3594 (Incremental_object_entry::shndx_): New data member.
3595 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3596 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3597 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3598 serial number.
3599 (Incremental_inputs::report_archive_begin): Likewise.
3600 (Incremental_inputs::report_object): Likewise.
3601 (Incremental_inputs::report_script): Likewise.
3602 (class Incremental_global_symbol_reader): New class.
3603 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3604 and store flags and input file type.
3605 (Incremental_input_entry_reader::arg_serial): New function.
3606 (Incremental_input_entry_reader::type): Extract type from flags.
3607 (Incremental_input_entry_reader::is_in_system_directory): New function.
3608 (Incremental_input_entry_reader::get_input_section_count): Call
3609 accessor function for type.
3610 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3611 function for type; adjust size of global symbol entry.
3612 (Incremental_input_entry_reader::get_global_symbol_count): Call
3613 accessor function for type.
3614 (Incremental_input_entry_reader::get_object_count): Likewise.
3615 (Incremental_input_entry_reader::get_object_offset): Likewise.
3616 (Incremental_input_entry_reader::get_member_count): Likewise.
3617 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3618 (Incremental_input_entry_reader::get_member_offset): Likewise.
3619 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3620 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3621 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3622 (Incremental_input_entry_reader::get_global_symbol_reader): New
3623 function.
3624 (Incremental_input_entry_reader::get_output_symbol_index): New
3625 function.
3626 (Incremental_input_entry_reader::type_): Remove.
3627 (Incremental_input_entry_reader::flags_): New data member.
3628 (Incremental_inputs_reader::input_file_offset): New function.
3629 (Incremental_inputs_reader::input_file_index): New function.
3630 (Incremental_inputs_reader::input_file): Call input_file_offset.
3631 (Incremental_inputs_reader::input_file_at_offset): New function.
3632 (Incremental_relocs_reader::get_r_type): Reformat.
3633 (Incremental_relocs_reader::get_r_shndx): Reformat.
3634 (Incremental_relocs_reader::get_r_offset): Reformat.
3635 (Incremental_relocs_reader::data): New function.
3636 (Incremental_binary::Incremental_binary): Initialize new data members.
3637 (Incremental_binary::check_inputs): Add cmdline parameter.
3638 (Incremental_binary::file_is_unchanged): Remove.
3639 (Input_reader::arg_serial): New function.
3640 (Input_reader::get_unused_symbol_count): New function.
3641 (Input_reader::get_unused_symbol): New function.
3642 (Input_reader::do_arg_serial): New function.
3643 (Input_reader::do_get_unused_symbol_count): New function.
3644 (Input_reader::do_get_unused_symbol): New function.
3645 (Incremental_binary::input_file_count): New function.
3646 (Incremental_binary::get_input_reader): Change signature to use
3647 index instead of filename.
3648 (Incremental_binary::file_has_changed): New function.
3649 (Incremental_binary::get_input_argument): New function.
3650 (Incremental_binary::get_library): New function.
3651 (Incremental_binary::get_script_info): New function.
3652 (Incremental_binary::init_layout): New function.
3653 (Incremental_binary::reserve_layout): New function.
3654 (Incremental_binary::output_file): New function.
3655 (Incremental_binary::do_check_inputs): New function.
3656 (Incremental_binary::do_file_is_unchanged): Remove.
3657 (Incremental_binary::do_file_has_changed): New function.
3658 (Incremental_binary::do_init_layout): New function.
3659 (Incremental_binary::do_reserve_layout): New function.
3660 (Incremental_binary::do_input_file_count): New function.
3661 (Incremental_binary::do_get_input_reader): Change signature.
3662 (Incremental_binary::input_args_map_): New data member.
3663 (Incremental_binary::library_map_): New data member.
3664 (Incremental_binary::script_map_): New data member.
3665 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3666 new data members.
3667 (Sized_incremental_binary::output_section): New function.
3668 (Sized_incremental_binary::inputs_reader): Add const.
3669 (Sized_incremental_binary::symtab_reader): Add const.
3670 (Sized_incremental_binary::relocs_reader): Add const.
3671 (Sized_incremental_binary::got_plt_reader): Add const.
3672 (Sized_incremental_binary::get_symtab_view): New function.
3673 (Sized_incremental_binary::Inputs_reader): New typedef.
3674 (Sized_incremental_binary::Input_entry_reader): New typedef.
3675 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3676 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3677 (Sized_incremental_binary::do_file_has_changed): New function.
3678 (Sized_incremental_binary::do_init_layout): New function.
3679 (Sized_incremental_binary::do_reserve_layout): New function.
3680 (Sized_input_reader::Inputs_reader): Remove.
3681 (Sized_input_reader::Input_entry_reader): Remove.
3682 (Sized_input_reader::do_arg_serial): New function.
3683 (Sized_input_reader::do_get_unused_symbol_count): New function.
3684 (Sized_input_reader::do_get_unused_symbol): New function.
3685 (Sized_incremental_binary::do_input_file_count): New function.
3686 (Sized_incremental_binary::do_get_input_reader): Change signature;
3687 use index instead of filename.
3688 (Sized_incremental_binary::section_map_): New data member.
3689 (Sized_incremental_binary::input_entry_readers_): New data member.
3690 (class Sized_incr_relobj): New class.
3691 (class Sized_incr_dynobj): New class.
3692 (make_sized_incremental_object): New function.
3693 (class Incremental_library): New class.
3694 * layout.cc (Free_list::num_lists): New static data member.
3695 (Free_list::num_nodes): New static data member.
3696 (Free_list::num_removes): New static data member.
3697 (Free_list::num_remove_visits): New static data member.
3698 (Free_list::num_allocates): New static data member.
3699 (Free_list::num_allocate_visits): New static data member.
3700 (Free_list::init): New function.
3701 (Free_list::remove): New function.
3702 (Free_list::allocate): New function.
3703 (Free_list::dump): New function.
3704 (Free_list::print_stats): New function.
3705 (Layout_task_runner::run): Resize output file for incremental updates.
3706 (Layout::Layout): Initialize new data members.
3707 (Layout::set_incremental_base): New function.
3708 (Layout::init_fixed_output_section): New function.
3709 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3710 incremental updates.
3711 (Layout::create_gold_note): Do not create gold note section for
3712 incremental updates.
3713 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3714 for incremental updates.
3715 (Layout::set_section_offsets): For incremental updates, allocate space
3716 from free list.
3717 (Layout::create_symtab_sections): Layout with offsets relative to
3718 start of section; for incremental updates, allocate space from free
3719 list.
3720 (Layout::create_shdrs): For incremental updates, allocate space from
3721 free list.
3722 (Layout::finish_dynamic_section): For incremental updates, do not
3723 check --as-needed (fixed in subsequent patch).
3724 * layout.h (class Free_list): New class.
3725 (Layout::set_incremental_base): New function.
3726 (Layout::incremental_base): New function.
3727 (Layout::init_fixed_output_section): New function.
3728 (Layout::allocate): New function.
3729 (Layout::incremental_base_): New data member.
3730 (Layout::free_list_): New data member.
3731 * main.cc (main): Print Free_list statistics.
3732 * object.cc (Relobj::finalize_incremental_relocs): Add
3733 clear_counts parameter; clear counts only when clear_counts is set.
3734 (Sized_relobj::Sized_relobj): Initialize new base class.
3735 (Sized_relobj::do_layout): Don't report special sections.
3736 (Sized_relobj::do_for_all_local_got_entries): New function.
3737 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3738 symtab_off to all symbol table offsets.
3739 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3740 * object.h (class Got_offset_list): Move to top of file.
3741 (Object::Object): Allow case where input_file == NULL.
3742 (Object::~Object): Likewise.
3743 (Object::input_file): Assert that input_file != NULL.
3744 (Object::lock): Allow case where input_file == NULL.
3745 (Object::unlock): Likewise.
3746 (Object::is_locked): Likewise.
3747 (Object::token): Likewise.
3748 (Object::release): Likewise.
3749 (Object::is_incremental): New function.
3750 (Object::get_mtime): New function.
3751 (Object::for_all_local_got_entries): New function.
3752 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3753 (Object::set_is_in_system_directory): New function.
3754 (Object::is_in_system_directory): New function.
3755 (Object::do_is_incremental): New function.
3756 (Object::do_get_mtime): New function.
3757 (Object::do_for_all_local_got_entries): New function.
3758 (Object::is_in_system_directory_): New data member.
3759 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3760 (class Sized_relobj_base): New class.
3761 (class Sized_relobj): Derive from Sized_relobj_base.
3762 (class Sized_relobj::Symbols): Redeclare from base class.
3763 (class Sized_relobj::local_got_offset_list): Remove.
3764 (class Sized_relobj::Output_sections): Redeclare from base class.
3765 (class Sized_relobj::do_for_all_local_got_entries): New function.
3766 (class Sized_relobj::write_local_symbols): Add offset parameter.
3767 (class Sized_relobj::local_symbol_offset_): Update comment.
3768 (class Sized_relobj::local_dynsym_offset_): Update comment.
3769 * options.cc (Input_arguments::add_file): Remove const.
3770 * options.h (Input_file_argument::Input_file_argument):
3771 Initialize arg_serial_ (all constructors).
3772 (Input_file_argument::set_arg_serial): New function.
3773 (Input_file_argument::arg_serial): New function.
3774 (Input_file_argument::arg_serial_): New data member.
3775 (Input_arguments::Input_arguments): Initialize file_count_.
3776 (Input_arguments::add_file): Remove const.
3777 (Input_arguments::number_of_input_files): New function.
3778 (Input_arguments::file_count_): New data member.
3779 (Command_line::number_of_input_files): Call
3780 Input_arguments::number_of_input_files.
3781 * output.cc (Output_segment_headers::Output_segment_headers):
3782 Set current size.
3783 (Output_section::Input_section::current_data_size): New function.
3784 (Output_section::Output_section): Initialize new data members.
3785 (Output_section::add_input_section): Don't do merge sections for
3786 an incremental link; allocate space from free list for an
3787 incremental update.
3788 (Output_section::add_output_section_data): Allocate space from
3789 free list for an incremental update.
3790 (Output_section::update_data_size): New function.
3791 (Output_section::set_fixed_layout): New function.
3792 (Output_section::reserve): New function.
3793 (Output_segment::set_section_addresses): Remove const.
3794 (Output_segment::set_section_list_addresses): Remove const; allocate
3795 space from free list for an incremental update.
3796 (Output_segment::set_offset): Adjust size of RELRO segment for an
3797 incremental update.
3798 * output.h (Output_data::current_data_size): Move here from
3799 child classes.
3800 (Output_data::pre_finalize_data_size): New function.
3801 (Output_data::update_data_size): New function.
3802 (Output_section_headers::update_data_size): new function.
3803 (Output_section_data_build::current_data_size): Move to Output_data.
3804 (Output_data_strtab::update_data_size): New function.
3805 (Output_section::current_data_size): Move to Output_data.
3806 (Output_section::set_fixed_layout): New function.
3807 (Output_section::has_fixed_layout): New function.
3808 (Output_section::reserve): New function.
3809 (Output_section::update_data_size): New function.
3810 (Output_section::has_fixed_layout_): New data member.
3811 (Output_section::free_list_): New data member.
3812 (Output_segment::set_section_addresses): Remove const.
3813 (Output_segment::set_section_list_addresses): Remove const.
3814 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3815 New function.
3816 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3817 New function.
3818 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3819 parameter when calling Add_symbols constructor; store argument
3820 serial number for members of a lib group.
3821 (Add_symbols::locks): Allow case where token == NULL.
3822 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3823 (Read_member::~Read_member): New function.
3824 (Read_member::is_runnable): New function.
3825 (Read_member::locks): New function.
3826 (Read_member::run): New function.
3827 (Check_script::~Check_script): New function.
3828 (Check_script::is_runnable): New function.
3829 (Check_script::locks): New function.
3830 (Check_script::run): New function.
3831 (Check_library::~Check_library): New function.
3832 (Check_library::is_runnable): New function.
3833 (Check_library::locks): New function.
3834 (Check_library::run): New function.
3835 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3836 (Add_symbols::library_): New data member.
3837 (class Read_member): New class.
3838 (class Check_script): New class.
3839 (class Check_library): New class.
3840 * reloc.cc (Read_relocs::is_runnable): Allow case where
3841 token == NULL.
3842 (Read_relocs::locks): Likewise.
3843 (Scan_relocs::locks): Likewise.
3844 (Relocate_task::locks): Likewise.
3845 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3846 to clear counters.
3847 (Sized_relobj::incremental_relocs_scan): Fix comment.
3848 (Sized_relobj::do_relocate): Pass output file offset to
3849 write_local_symbols.
3850 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3851 from class declaration.
3852 * script.cc (read_input_script): Allocate Script_info; pass
3853 argument serial number to report_script.
3854 * script.h (class Script_info): Move to incremental.h.
3855 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3856 * symtab.h (Symbol_table::add_from_incrobj): New function.
3857 (Symbol_table::set_file_offset): New function.
3858
3859 2011-04-05 Cary Coutant <ccoutant@google.com>
3860
3861 * incremental-dump.cc (dump_incremental_inputs): Change signature
3862 to take a Sized_incremental_binary; change caller. Use readers
3863 in Sized_incremental_binary.
3864 * incremental.cc
3865 (Sized_incremental_binary::find_incremental_inputs_sections):
3866 Rename do_find_incremental_inputs_sections to this.
3867 (Sized_incremental_binary::setup_readers): New function.
3868 (Sized_incremental_binary::do_check_inputs): Check
3869 has_incremental_info_ flag; move setup code to setup_readers;
3870 use input readers.
3871 (Sized_incremental_binary::do_file_is_unchanged): New function.
3872 (Sized_incremental_binary::do_get_input_reader): New function.
3873 * incremental.h (class Incremental_binary): Move to end of file.
3874 (Incremental_binary::file_is_unchanged): New function.
3875 (Incremental_binary::do_file_is_unchanged): New function.
3876 (Incremental_binary::Input_reader): New class.
3877 (Incremental_binary::get_input_reader): New function.
3878 (class Sized_incremental_binary): Move to end of file.
3879 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3880 input section reader classes.
3881 (Sized_incremental_binary::has_incremental_info): New function.
3882 (Sized_incremental_binary::inputs_reader): New function.
3883 (Sized_incremental_binary::symtab_reader): New function.
3884 (Sized_incremental_binary::relocs_reader): New function.
3885 (Sized_incremental_binary::got_plt_reader): New function.
3886 (Sized_incremental_binary::do_file_is_unchanged): New function.
3887 (Sized_incremental_binary::Sized_input_reader): New class.
3888 (Sized_incremental_binary::get_input_reader): New function.
3889 (Sized_incremental_binary::find_incremental_inputs_sections):
3890 Rename do_find_incremental_inputs_sections to this.
3891 (Sized_incremental_binary::setup_readers): New function.
3892 (Sized_incremental_binary::has_incremental_info_): New data member.
3893 (Sized_incremental_binary::inputs_reader_): New data member.
3894 (Sized_incremental_binary::symtab_reader_): New data member.
3895 (Sized_incremental_binary::relocs_reader_): New data member.
3896 (Sized_incremental_binary::got_plt_reader_): New data member.
3897 (Sized_incremental_binary::current_input_file_): New data member.
3898
3899 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3900
3901 PR gold/12640
3902 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3903 violation.
3904
3905 2011-03-30 Cary Coutant <ccoutant@google.com>
3906
3907 * archive.cc (Archive::include_member): Adjust call to report_object.
3908 (Add_archive_symbols::run): Add script_info to call to
3909 report_archive_begin.
3910 (Lib_group::include_member): Adjust call to report_object.
3911 (Add_lib_group_symbols::run): Adjust call to report_object.
3912 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3913 blocks. Add object count for script input files.
3914 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3915 script_info parameter; change all callers.
3916 (Incremental_inputs::report_object): Add script_info parameter;
3917 change all callers.
3918 (Incremental_inputs::report_script): Store backpointer to
3919 incremental info entry.
3920 (Output_section_incremental_inputs::set_final_data_size): Record
3921 additional information for scripts.
3922 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3923 * incremental.h (Incremental_script_entry::add_object): New function.
3924 (Incremental_script_entry::get_object_count): New function.
3925 (Incremental_script_entry::get_object): New function.
3926 (Incremental_script_entry::objects_): New data member; adjust
3927 constructor.
3928 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3929 (Incremental_inputs::report_object): Add script_info parameter.
3930 (Incremental_inputs_reader::get_object_count): New function.
3931 (Incremental_inputs_reader::get_object_offset): New function.
3932 * options.cc (Input_arguments::add_file): Return reference to
3933 new input argument.
3934 * options.h (Input_argument::set_script_info): New function.
3935 (Input_argument::script_info): New function.
3936 (Input_argument::script_info_): New data member; adjust all
3937 constructors.
3938 (Input_file_group::add_file): Return reference to new input argument.
3939 (Input_file_lib::add_file): Likewise.
3940 (Input_arguments::add_file): Likewise.
3941 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3942 * script.cc (Parser_closure::Parser_closure): Add script_info
3943 parameter; adjust all callers.
3944 (Parser_closure::script_info): New function.
3945 (Parser_closure::script_info_): New data member.
3946 (read_input_script): Report scripts earlier to incremental info.
3947 (script_add_file): Set script_info in Input_argument.
3948 (script_add_library): Likewise.
3949 * script.h (Script_options::Script_info): Rewrite class.
3950
3951 2011-03-29 Cary Coutant <ccoutant@google.com>
3952
3953 * archive.cc (Library_base::should_include_member): Move
3954 method here from class Archive.
3955 (Archive::Archive): Initialize base class.
3956 (Archive::should_include_member): Move to base class.
3957 (Archive::do_for_all_unused_symbols): New function.
3958 (Add_archive_symbols::run): Remove redundant access to
3959 incremental_inputs.
3960 (Lib_group::Lib_group): Initialize base class.
3961 (Lib_group::do_filename): New function.
3962 (Lib_group::include_member): Pass pointer to Lib_group to
3963 report_object.
3964 (Lib_group::do_for_all_unused_symbols): New function.
3965 (Add_lib_group_symbols::run): Report archive information for
3966 incremental links.
3967 * archive.h (class Library_base): New base class.
3968 (class Archive): Derive from Library_base.
3969 (Archive::filename): Move to base class.
3970 (Archive::set_incremental_info): Likewise.
3971 (Archive::incremental_info): Likewise.
3972 (Archive::Should_include): Likewise.
3973 (Archive::should_include_member): Likewise.
3974 (Archive::Armap_entry): Remove.
3975 (Archive::Unused_symbol_iterator): Remove.
3976 (Archive::unused_symbols_begin): Remove.
3977 (Archive::unused_symbols_end): Remove.
3978 (Archive::do_filename): New function.
3979 (Archive::do_get_mtime): New function.
3980 (Archive::do_for_all_unused_symbols): New function.
3981 (Archive::task_): Move to base class.
3982 (Archive::incremental_info_): Likewise.
3983 (class Lib_group): Derive from Library_base.
3984 (Lib_group::do_filename): New function.
3985 (Lib_group::do_get_mtime): New function.
3986 (Lib_group::do_for_all_unused_symbols): New function.
3987 (Lib_group::task_): Move to base class.
3988 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3989 function.
3990 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3991 function.
3992 * incremental.cc (Incremental_inputs::report_archive_begin):
3993 Use Library_base; call library's get_mtime; add incremental inputs
3994 entry before members.
3995 (class Unused_symbol_visitor): New class.
3996 (Incremental_inputs::report_archive_end): Use Library_base; use
3997 visitor class to record unused symbols; don't add incremental inputs
3998 entry after members.
3999 (Incremental_inputs::report_object): Use Library_base.
4000 * incremental.h
4001 (Incremental_archive_entry::Incremental_archive_entry): Remove
4002 unused Archive parameter.
4003 (Incremental_inputs::report_archive_begin): Use Library_base.
4004 (Incremental_inputs::report_archive_end): Likewise.
4005 (Incremental_inputs::report_object): Likewise.
4006 * object.cc (Sized_relobj::do_for_all_global_symbols): New
4007 function.
4008 * object.h (Object::for_all_global_symbols): New function.
4009 (Object::do_for_all_global_symbols): New function.
4010 (Sized_relobj::do_for_all_global_symbols): New function.
4011 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
4012 function.
4013 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4014 function.
4015
4016 2011-03-27 Ian Lance Taylor <iant@google.com>
4017
4018 * archive.cc (Archive::interpret_header): Return -1 if something
4019 goes wrong. Change callers accordingly.
4020
4021 2011-03-25 Cary Coutant <ccoutant@google.com>
4022
4023 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4024 * testsuite/Makefile.in: Regenerate.
4025
4026 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4027
4028 * plugin.cc (get_view): New.
4029 (Plugin::load): Pass get_view to the plugin.
4030 (Plugin_manager::get_view): New.
4031
4032 2011-03-21 Ian Lance Taylor <iant@google.com>
4033
4034 * testsuite/final_layout.sh: Rewrite to not use dc.
4035 * testsuite/relro_test.sh: Fail if dc is not present.
4036
4037 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4038
4039 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4040 Change == to -eq.
4041 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4042 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4043 Change == to -eq.
4044 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4045 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4046
4047 2011-03-14 Ian Lance Taylor <iant@google.com>
4048
4049 * script-sections.cc (Sort_output_sections::script_compare):
4050 Rename from is_before, change return type.
4051 (Sort_output_sections::operator()): Adjust accordingly.
4052
4053 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4054
4055 PR gold/12572
4056 * testsuite/odr_violation2.cc: Add comment to make all error line
4057 numbers double digits.
4058 * testsuite/debug_msg.sh: Adjust expected errors.
4059
4060 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4061
4062 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4063 but mark earlier ones as non-canonical
4064 (offset_to_iterator): Update search target and example
4065 (do_addr2line): Return extra lines in a vector*
4066 (format_file_lineno): Extract from do_addr2line
4067 (one_addr2line): Add vector* out-param
4068 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4069 when a lineno entry appeared last for its instruction
4070 (Dwarf_line_info): Add vector* out-param
4071 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4072 * symtab.cc (Odr_violation_compare): Include the lineno in the
4073 comparison again.
4074 (linenos_from_loc): New. Combine the canonical line for an
4075 address with its other lines.
4076 (True_if_intersect): New. Helper functor to make
4077 std::set_intersection a query.
4078 (detect_odr_violations): Compare sets of lines instead of just
4079 one line for each function. This became less deterministic, but
4080 has fewer false positives.
4081 * symtab.h: Declarations.
4082 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4083 mix an optimized and non-optimized object in the same binary
4084 (odr_violation2.so): Same.
4085 * testsuite/Makefile.in: Regenerate from Makefile.am.
4086 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4087 * testsuite/debug_msg.sh: Update line numbers and add
4088 assertions.
4089 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4090 non-optimized context.
4091 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4092 isn't inlined, and use OdrDerived in an optimized context.
4093 * testsuite/odr_header1.h: Defines OdrDerived, where
4094 optimization will change the
4095 first-instruction-in-the-destructor's file and line number.
4096 * testsuite/odr_header2.h: Defines OdrBase.
4097
4098 2011-03-09 Ian Lance Taylor <iant@google.com>
4099
4100 * fileread.cc (File_read::clear_views): Don't delete the whole
4101 file view.
4102
4103 2011-03-08 Ian Lance Taylor <iant@google.com>
4104
4105 PR gold/12525
4106 * fileread.cc: #include <climits>.
4107 (GOLD_IOV_MAX): Define.
4108 (File_read::read_multiple): Limit number of entries by iov_max.
4109 * fileread.h (class File_read): Always set max_readv_entries to
4110 128.
4111
4112 2011-03-07 Ian Lance Taylor <iant@google.com>
4113
4114 PR gold/12525
4115 * options.h (class General_options): Add -dy and -dn.
4116
4117 2011-03-02 Cary Coutant <ccoutant@google.com>
4118
4119 * testsuite/script_test_9.t: Add TLS segment.
4120
4121 2011-03-02 Simon Baldwin <simonb@google.com>
4122
4123 * configure.ac: Add check for gnu_indirect_function support in
4124 the toolchain building binutils.
4125 * configure: Rebuild.
4126
4127 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4128
4129 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4130 plugin only symbols.
4131 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4132 in plugin files as not needed in the symbol table.
4133
4134 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4135
4136 * output.cc (Output_section::add_input_section): Delay fill
4137 generation for section ordering.
4138
4139 2011-02-09 Ian Lance Taylor <iant@google.com>
4140
4141 PR gold/12316
4142 * object.h (class Sized_relobj): Remove clear_local_symbols.
4143 * reloc.cc (Sized_relobj::do_relocate): Don't call
4144 clear_local_symbols.
4145
4146 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4147
4148 * plugin.cc (is_visible_from_outside): Return true for symbols
4149 in the -u option.
4150
4151 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4152
4153 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4154 filename.
4155
4156 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4157
4158 * icf.h (is_section_foldable_candidate): Change type of parameter
4159 to std::string.
4160 * icf.cc (Icf::find_identical_sections): Change type of local variable
4161 section_name to be std::string.
4162 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4163
4164 2011-01-25 Ian Lance Taylor <iant@google.com>
4165
4166 * script.cc (script_add_extern): Rewrite to use
4167 add_symbol_reference.
4168
4169 2011-01-25 Doug Kwan <dougkwan@google.com>
4170
4171 * icf.cc (get_section_contents): Always lock section's object.
4172
4173 2011-01-24 Ian Lance Taylor <iant@google.com>
4174
4175 * options.h (class General_options): Accept
4176 --no-detect-odr-violations.
4177
4178 2011-01-24 Ian Lance Taylor <iant@google.com>
4179
4180 * version.cc (version_string): Bump to 1.11.
4181
4182 2011-01-24 Ian Lance Taylor <iant@google.com>
4183
4184 * plugin.cc (class Plugin_rescan): Define new class.
4185 (Plugin_manager::claim_file): Set any_claimed_.
4186 (Plugin_manager::save_archive): New function.
4187 (Plugin_manager::save_input_group): New function.
4188 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4189 necessary.
4190 (Plugin_manager::new_undefined_symbol): New function.
4191 (Plugin_manager::rescan): New function.
4192 (Plugin_manager::rescannable_defines): New function.
4193 (Plugin_manager::add_input_file): Set any_added_.
4194 * plugin.h (class Plugin_manager): define new fields rescannable_,
4195 undefined_symbols_, any_claimed_, and any_added_. Declare
4196 Plugin_rescan as friend. Declare new functions.
4197 (Plugin_manager::Rescannable): Define type.
4198 (Plugin_manager::Rescannable_list): Define type.
4199 (Plugin_manager::Undefined_symbol_list): Define type.
4200 (Plugin_manager::Plugin_manager): Initialize new fields.
4201 * archive.cc (Archive::defines_symbol): New function.
4202 (Add_archive_symbols::run): Pass archive to plugins if any.
4203 * archive.h (class Archive): Declare defines_symbol.
4204 * readsyms.cc (Input_group::~Input_group): New function.
4205 (Finish_group::run): Pass input_group to plugins if any.
4206 * readsyms.h (class Input_group): Declare destructor.
4207 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4208 any.
4209
4210 2011-01-10 Ian Lance Taylor <iant@google.com>
4211
4212 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4213 section as relro.
4214 (Layout::set_segment_offsets): Reset increase_relro before calling
4215 set_section_addresses a second time.
4216
4217 2011-01-04 Cary Coutant <ccoutant@google.com>
4218
4219 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4220 sections before NOBITS sections.
4221
4222 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4223
4224 * version.cc (print_version): Update copyright to 2011.
4225
4226 2010-12-23 Cary Coutant <ccoutant@google.com>
4227
4228 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4229 of OS to this->add. Add OD parameter to second form of the function.
4230
4231 2010-12-20 Ian Lance Taylor <iant@google.com>
4232
4233 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4234 second of two consecutive entries with same offset.
4235
4236 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4237
4238 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4239 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4240 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4241 to avoid unneeded links against $(LDADD).
4242 * testsuite/Makefile.in: Regenerate.
4243
4244 2010-12-15 Ian Lance Taylor <iant@google.com>
4245
4246 PR gold/12324
4247 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4248 for R_X86_64_32 and R_X86_64_PC32.
4249 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4250 ver_matching_def_pic.o.
4251 (ver_matching_def_pic.o): New target.
4252
4253 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4254
4255 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4256 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4257 Move definition before File_read::View member definitions.
4258 (File_read::View::~View): Initialize and hold lock before
4259 updating current_mapped_bytes.
4260
4261 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4262
4263 * dwarf_reader.cc: Remove outdated comment.
4264 * gold-threads.cc: Fix typo in error message.
4265 * archive.cc: Fix typos in comments.
4266 * archive.h: Likewise.
4267 * arm-reloc-property.cc: Likewise.
4268 * arm-reloc-property.h: Likewise.
4269 * arm-reloc.def: Likewise.
4270 * arm.cc: Likewise.
4271 * attributes.h: Likewise.
4272 * cref.cc: Likewise.
4273 * ehframe.cc: Likewise.
4274 * fileread.h: Likewise.
4275 * gold.h: Likewise.
4276 * i386.cc: Likewise.
4277 * icf.cc: Likewise.
4278 * incremental.h: Likewise.
4279 * int_encoding.cc: Likewise.
4280 * layout.h: Likewise.
4281 * main.cc: Likewise.
4282 * merge.h: Likewise.
4283 * object.cc: Likewise.
4284 * object.h: Likewise.
4285 * options.cc: Likewise.
4286 * readsyms.cc: Likewise.
4287 * reduced_debug_output.cc: Likewise.
4288 * reloc.cc: Likewise.
4289 * script-sections.cc: Likewise.
4290 * sparc.cc: Likewise.
4291 * symtab.h: Likewise.
4292 * target-reloc.h: Likewise.
4293 * target.cc: Likewise.
4294 * target.h: Likewise.
4295 * timer.cc: Likewise.
4296 * timer.h: Likewise.
4297 * x86_64.cc: Likewise.
4298
4299 2010-12-09 Cary Coutant <ccoutant@google.com>
4300
4301 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4302 stack.
4303 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4304 parameter; change all callers.
4305 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4306 * options.h (warn_execstack): New option.
4307
4308 2010-12-07 Doug Kwan <dougkwan@google.com>
4309
4310 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4311 like function call relocations.
4312
4313 2010-12-07 Ian Lance Taylor <iant@google.com>
4314
4315 * archive.cc (Archive::get_elf_object_for_member): Permit
4316 punconfigured to be NULL.
4317 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4318 (Archive::include_member): Pass NULL to get_elf_object_for_member
4319 if we searched for the archive and this is the first included
4320 object.
4321
4322 2010-12-01 Ian Lance Taylor <iant@google.com>
4323
4324 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4325 track_relocs_type_ field.
4326 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4327 Set track_relocs_type_.
4328 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4329 contents when using RELA relocs.
4330 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4331 reloc_map_.
4332 * reloc.cc (Track_relocs::next_addend): New function.
4333 * reloc.h (class Track_relocs): Declare next_addend.
4334
4335 2010-12-01 Ian Lance Taylor <iant@google.com>
4336
4337 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4338 virtual destructor.
4339
4340 2010-12-01 Ian Lance Taylor <iant@google.com>
4341
4342 * README: Update compilers known to work and fail.
4343
4344 2010-11-23 Matthias Klose <doko@ubuntu.com>
4345
4346 * configure.in: For --enable-gold, handle value `default' instead of
4347 `both*'. Always install ld as ld.bfd, install as ld if gold is
4348 not the default.
4349 * configure: Regenerate.
4350
4351 2010-11-18 Doug Kwan <dougkwan@google.com>
4352
4353 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4354 and right_alignment to be zero. Store result alignment only if it is
4355 greater than existing alignment.
4356
4357 2010-11-16 Cary Coutant <ccoutant@google.com>
4358
4359 PR gold/12220
4360 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4361 Check for ".zdebug_line".
4362
4363 2010-11-16 Doug Kwan <dougkwan@google.com>
4364 Cary Coutant <ccoutant@google.com>
4365
4366 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4367 by reference; adjust all callers.
4368 * output.cc (Output_segment::set_section_addresses): Adjust references
4369 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4370 list is empty.
4371 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4372 end at page boundary.
4373
4374 2010-11-16 Cary Coutant <ccoutant@google.com>
4375
4376 PR gold/12220
4377 * layout.cc (Layout::choose_output_section): Transform names of
4378 compressed sections even when using a script with a SECTIONS clause.
4379 (Layout::output_section_name): Remove code to transform
4380 compressed debug section names.
4381 * output.cc (Output_section::add_input_section): Use uncompressed
4382 section size when tracking input sections.
4383
4384 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4385
4386 * symtab.h (Symbol::NON_PIC_REF): Remove.
4387 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4388 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4389 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4390 (Symbol::use_plt_offset): Take a flags argument and pass it
4391 directly to needs_dynamic_reloc. Restrict check for undefined
4392 weak symbols to function calls.
4393 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4394 (Target_arm::Scan::global): Use it.
4395 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4396 (Target_arm::Relocate::relocate): Likewise.
4397 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4398 parameter with an r_type parameter. Use get_reference_flags
4399 to get the flags.
4400 (Target_arm::Relocate::relocate): Update accordingly.
4401 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4402 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4403 (Target_i386::Scan::global): Likewise.
4404 (Target_i386::Relocate::relocate): Likewise.
4405 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4406 parameter with an r_type parameter. Use get_reference_flags
4407 to get the flags.
4408 (Target_i386::Relocate::relocate): Update accordingly.
4409 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4410 (Target_powerpc::Scan::global): Use it.
4411 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4412 (Target_powerpc::Relocate::relocate): Likewise.
4413 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4414 (Target_sparc::Scan::global): Use it.
4415 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4416 (Target_sparc::Relocate::relocate): Likewise.
4417 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4418 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4419 (Target_x86_64::Scan::global): Likewise.
4420 (Target_x86_64::Relocate::relocate): Likewise.
4421
4422 2010-11-08 Doug Kwan <dougkwan@google.com>
4423 Cary Coutant <ccoutant@google.com>
4424
4425 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4426 (Arm_exidx_merge_section::section_contents_): New data member.
4427 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4428 (Arm_input_section::~Arm_input_section): De-allocate memory.
4429 (Arm_input_section::original_contents_): New data member.
4430 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4431 in parameters instead of calling Object::section_contents without
4432 locking.
4433 (Arm_output_section::group_section): New parameter TASK. Pass it
4434 to callees that need locking objects.
4435 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4436 to lock EXIDX input sections. Fix a formatting issue. Call
4437 Arm_exidx_merged_section::build_contents to create merged section
4438 contents.
4439 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4440 to lock object of stub table owner.
4441 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4442 TEXT_SIZE to initialize data member TEXT_SIZE_.
4443 (Arm_exidx_input_section::addralign): Fix typo in comment.
4444 (Arm_exidx_input_section::text_size): New method.
4445 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4446 that require locking objects. Lock objects before scanning for stubs
4447 and updating local symbols.
4448 (Arm_input_section<big_endian>::init): Copy contents of original
4449 input section.
4450 (Arm_input_section<big_endian>::do_write): Use saved contents of
4451 original input section instead of calling Object::section_contents
4452 without locking.
4453 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4454 size without calling Object::section_size().
4455 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4456 for size. Allocate a buffer for merged EXIDX entries.
4457 (Arm_exidx_merged_section::build_contents): New method.
4458 (Arm_exidx_merged_section::do_write): Move merge section contents
4459 building code to Arm_exidx_merged_section::build_contetns. Write
4460 out contetns in buffer instead of building it on the fly.
4461 (Arm_relobj::make_exidx_input_section): Also pass text section size
4462 to Arm_exidx_input_section constructor.
4463 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4464 (Arm_dynobj::do_read_symbols): Fix memory leak.
4465 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4466 * target.h: (class Task): Add forward declaration.
4467 (Target::relax): Add new parameter TASK and pass it to
4468 Target::do_relax().
4469 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4470
4471 2010-11-05 Cary Coutant <ccoutant@google.com>
4472
4473 PR gold/10708
4474 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4475 object when reading from the file.
4476 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4477 second layout pass.
4478 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4479 when reading section contents.
4480 (get_section_contents): Likewise.
4481 (icf::find_identical_sections): Likewise.
4482 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4483 object when reading from the file.
4484 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4485 the object when doing deferred section layout.
4486
4487 2010-11-03 Nick Clifton <nickc@redhat.com>
4488
4489 PR gold/12001
4490 * script.h (class Symbol_assignment: name): New member. Returns
4491 the name of the symbol.
4492 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4493 Returns true if the given symbol name is on the list of
4494 assignments wating to be processed.
4495 * archive.cc (should_incldue_member): If the symbol is undefined,
4496 check to see if it is on the list of symbols pending assignment.
4497
4498 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4499
4500 * script-sections.cc (Script_sections::find_memory_region): Check
4501 for a NULL output section pointer.
4502
4503 2010-10-29 Doug Kwan <dougkwan@google.com>
4504
4505 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4506 Output_section::add_relaxed_input_section.
4507 * output.cc (Output_section::add_relaxed_input_section): Add new
4508 arguments LAYOUT and NAME. Set section order index.
4509 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4510 Copy section order index.
4511 * output.h (Output_section::add_relaxed_input_section): Add new
4512 arguments LAYOUT and NAME.
4513
4514 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4515
4516 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4517 NATIVE_OR_CROSS_LINKER.
4518 * testsuite/Makefile.in: Regenerate.
4519
4520 2010-10-20 Doug Kwan <dougkwan@google.com>
4521
4522 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4523 without SHF_LINK_ORDER flags.
4524 * layout.cc (Layout::choose_output_section): Do not filter
4525 SHF_LINK_ORDER flag in a relocatable link.
4526
4527 2010-10-17 Cary Coutant <ccoutant@google.com>
4528
4529 * output.h (Output_segment::set_section_addresses): Change function
4530 signature. Update all callers.
4531 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4532 sections.
4533 (Output_segment::set_section_addresses): Align after last TLS
4534 section. Add padding before last relro section instead of after.
4535
4536 2010-10-17 Doug Kwan <dougkwan@google.com>
4537
4538 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4539 GOT output section to be writable.
4540
4541 2010-10-14 Cary Coutant <ccoutant@google.com>
4542
4543 * debug.h (DEBUG_INCREMENTAL): New flag.
4544 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4545 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4546 mode.
4547 * incremental.cc (report_command_line): Ignore all forms of
4548 --incremental.
4549 * layout.cc (Layout::Layout): Check parameters for incremental link
4550 mode.
4551 * options.cc (General_options::parse_incremental): New function.
4552 (General_options::parse_no_incremental): New function.
4553 (General_options::parse_incremental_full): New function.
4554 (General_options::parse_incremental_update): New function.
4555 (General_options::incremental_mode_): New data member.
4556 (General_options::finalize): Check incremental_mode_.
4557 * options.h (General_options): Update help text for --incremental.
4558 Add --no-incremental, --incremental-full, --incremental-update.
4559 (General_options::Incremental_mode): New enum type.
4560 (General_options::incremental_mode): New function.
4561 (General_options::incremental_mode_): New data member.
4562 * parameters.cc (Parameters::incremental_mode_): New data member.
4563 (Parameters::set_options): Set incremental_mode_.
4564 (Parameters::set_incremental_full): New function.
4565 (Parameters::incremental): New function.
4566 (Parameters::incremental_update): New function.
4567 (set_parameters_incremental_full): New function.
4568 * parameters.h (Parameters::set_incremental_full): New function.
4569 (Parameters::incremental): New function.
4570 (Parameters::incremental_update): New function.
4571 (Parameters::incremental_mode_): New data member.
4572 (set_parameters_incremental_full): New function.
4573 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4574 incremental link mode.
4575 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4576 (Sized_relobj::do_relocate_sections): Likewise.
4577 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4578 option.
4579 * testsuite/Makefile.in: Regenerate.
4580 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4581
4582 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4583
4584 * script-sections.h (class Script_sections): Make
4585 Sections_elements typedef public.
4586 * script-sections.cc (class Sort_output_sections): Add elements_
4587 field. Add constructor which sets it; change all callers.
4588 (Sort_output_sections::is_before): New function.
4589 (Sort_output_sections::operator()): Call is_before.
4590 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4591 conditional.
4592 * testsuite/script_test_10.sh: New test. Test script section
4593 order.
4594 * testsuite/script_test_10.t: Likewise.
4595 * testsuite/script_test_10.s: Likewise.
4596 * testsuite/Makefile.am: Wrap the cross linker tests and the
4597 common tests into NATIVE_OR_CROSS_LINKER.
4598 (check_SCRIPTS): Add script_test_10.sh.
4599 (check_DATA): Add script_test_10.stdout.
4600 (script_test_10.o, script_test_10): New targets.
4601 (script_test_10.stdout): New target.
4602 * configure, testsuite/Makefile.in: Regenerate.
4603
4604 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4605
4606 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4607 error for the deprecated relocations.
4608 (Target_arm::Scan::global): Likewise.
4609 (Target_arm::Relocate::relocate): Likewise.
4610
4611 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4612
4613 * fileread.cc (Input_file::find_file): Initialize *found_name
4614 and *namep when using the fallback search for case 4.
4615
4616 2010-10-11 Cary Coutant <ccoutant@google.com>
4617
4618 * options.h (class General_options): Redefine -z lazy as an alias for
4619 the negation of -z now.
4620
4621 2010-10-11 Ian Lance Taylor <iant@google.com>
4622
4623 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4624 binding.
4625
4626 2010-10-06 Nick Clifton <nickc@redhat.com>
4627
4628 * script-sections.cc(class Memory_region): Remove
4629 current_lma_offset_ field. Rename current_vma_offset_ to
4630 current_offset_. Add last_section_ field.
4631 (Memory_region::get_current_vma_address): Rename to
4632 get_current_address.
4633 (Memory_region::get_current_lma_address): Delete.
4634 (Memory_region::increment_vma_offset): Rename to
4635 increment_offset.
4636 (Memory_region::increment_lma_offset): Delete.
4637 (Memory_region::attributes_compatible): New method. Returns
4638 true if the provided section is compatible with the region.
4639 (Memory_region::get_last_section): New method. Returns the last
4640 section to use the region.
4641 (Memory_region::set_last_section): New method. Stores the last
4642 section to use the region.
4643 (Script_sections::block_in_region): New method. Returns true if
4644 a block of memory is contained within a region.
4645 (Script_sections::find_memory_region): New method. Locates a
4646 memory region to be used to set a VMA or LMA address.
4647 (Output_section_definition::set_section_addresses): Add code to
4648 check for addresses set by memory regions.
4649 (Output_segment::set_section_addresses): Remove memory region
4650 walking code.
4651 (Script_sections::create_segment): Add a warning if a header
4652 segment is created outside of any region.
4653 * script-sections.h (class Script_sections): Add prototypes for
4654 find_memory_region and block_in_region methods.
4655 * testsuite/memory_test.s: Use .long instead of .word.
4656 * testsuite/memory_test.t: Add some more output sections.
4657 * testsuite/memory_test.sh: Update expected output.
4658
4659 2010-10-02 Doug Kwan <dougkwan@google.com>
4660
4661 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4662 defintion to symtab.h
4663 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4664 declaration to defintion.
4665
4666 2010-10-01 Nick Clifton <nickc@redhat.com>
4667
4668 * expression.cc (eval): Replace dummy argument with NULL.
4669 (eval_maybe_dot): Check for a NULL result section pointer.
4670 (Symbol_expression::value): Likewise.
4671 (Dot_expression::value): Likewise.
4672 (BINARY_EXPRESSION): Likewise.
4673 (Max_expression::value): Likewise.
4674 (Min_expression::value): Likewise.
4675 (Absolute_expression::value): Likewise.
4676 (Addr_expression::value_from_output_section): Likewise.
4677 (Loaddddr_expression::value_from_output_section): Likewise.
4678 (Segment_start_expression::value): Likewise.
4679 * script-sections.cc
4680 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4681 argument with NULL.
4682 (Sections_elememt_dot_assignment::set_section_addresses):
4683 Likewise.
4684 (Output_data_expression::do_write_to_buffer): Likewise.
4685 (Output_section_definition::finalize_symbols): Likewise.
4686 (Output_section_definition::set_section_addresses): Likewise.
4687
4688 2010-09-30 Doug Kwan <dougkwan@google.com>
4689
4690 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4691
4692 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4693
4694 * target.h (Target::can_icf_inline_merge_sections): New virtual
4695 function.
4696 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4697 virtual function.
4698 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4699 virtual function.
4700 * icf.cc (get_section_contents): Inline merge sections only when
4701 target allows it.
4702
4703 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4704
4705 * configure: Regenerate.
4706
4707 2010-09-17 Ian Lance Taylor <iant@google.com>
4708
4709 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4710 * testsuite/Makefile.am (memory_test.o): New target.
4711 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4712 memory_test.t.
4713 * testsuite/Makefile.in: Rebuild.
4714
4715 2010-09-17 Doug Kwan <dougkwan@google.com>
4716
4717 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4718 defintion if relocation uses GOT entries of the symbol.
4719 * testsuite/icf_safe_test.sh: Fix test.
4720 * testsuite/icf_safe_so_test.sh: Fix test.
4721
4722 2010-09-16 Cary Coutant <ccoutant@google.com>
4723
4724 * script_sections.cc (class Memory_region): Remove "NULL" from
4725 vector initializations.
4726
4727 2010-09-15 Cary Coutant <ccoutant@google.com>
4728
4729 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4730 Resolve forwarding symbols.
4731
4732 2010-09-15 Doug Kwan <dougkwan@google.com>
4733
4734 * gold/testsuite/script_test_3.t: Add ARM special sections.
4735 * gold/testsuite/script_test_4.t: Same.
4736 * gold/testsuite/script_test_5.t: Same.
4737 * gold/testsuite/script_test_6.t: Same.
4738 * gold/testsuite/script_test_7.t: Same.
4739 * gold/testsuite/script_test_7.t: Same.
4740 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4741
4742 2010-09-14 Cary Coutant <ccoutant@google.com>
4743
4744 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4745 (Target_x86_64::Relocate::relocate_tls): Replace check for
4746 saw_tls_block_reloc_ with test for executable section.
4747
4748 2010-09-12 Cary Coutant <ccoutant@google.com>
4749
4750 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4751 position-independent executables to shared libraries need dynamic
4752 relocations.
4753 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4754 position-independent executables.
4755 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4756 * testsuite/Makefile.in: Regenerate.
4757
4758 2010-09-10 Nick Clifton <nickc@redhat.com>
4759
4760 PR gold/11997
4761 * testsuite/memory_test.t: Discard any sections that are not
4762 needed.
4763
4764 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4765
4766 PR gold/11996
4767 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4768 "This::" to work around a bug in gcc 4.2.
4769
4770 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4771
4772 2010-09-09 Rafael Espindola <espindola@google.com>
4773
4774 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4775 sections with different PF_X flags in the same segment.
4776 (Layout::find_first_load_seg): Search all segments to find the first
4777 one.
4778 * options.h (rosegment): New.
4779
4780 2010-09-08 Rafael Espindola <espindola@google.com>
4781
4782 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4783
4784 2010-09-08 Doug Kwan <dougkwan@google.com>
4785
4786 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4787 (Arm_relobj::do_relocate_sections): Add new parameter for output
4788 file to match the parent.
4789 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4790 of local symbols instead of input values. Update code to track
4791 changes in gold::relocate_section.
4792 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4793 (Sized_relobj::compute_final_local_value_internal): New methods.
4794 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4795 body into private version of Sized_relobj::compute_final_local_value.
4796 Call the inline method.
4797 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4798 merged symbol value if there is one.
4799 (Symbol_value::has_output_value): New method defintiion.
4800 (Sized_relobj::Compute_final_local_value_status): New enum type.
4801 (Sized_relobj::compute_final_local_value): New methods.
4802 (Sized_relobj::compute_final_local_value_internal): New methods.
4803 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4804 and arm_cortex_a8.sh.
4805 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4806 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4807 New tests.
4808 * Makefile.in: Regenerate.
4809 * testsuite/arm_bl_out_of_range.s: Update test.
4810 * testsuite/thumb_bl_out_of_range.s: Ditto.
4811 * testsuite/thumb_blx_out_of_range.s: Ditto.
4812 * testsuite/arm_branch_out_of_range.sh: New file.
4813 * testsuite/arm_cortex_a8.sh: Ditto.
4814 * testsuite/arm_cortex_a8_b.s: Ditto.
4815 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4816 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4817 * testsuite/arm_cortex_a8_bl.s: Ditto.
4818 * testsuite/arm_cortex_a8_blx.s: Ditto.
4819 * testsuite/arm_cortex_a8_local.s: Ditto.
4820 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4821 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4822
4823 2010-09-08 Rafael Espindola <espindola@google.com>
4824
4825 * Makefile.am (memory_test.stdout): Run readelf with -W.
4826 * Makefile.in: Regenerate.
4827 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4828 64 bit output.
4829
4830 2010-09-08 Rafael Espindola <espindola@google.com>
4831
4832 * script-sections.cc (Script_sections::add_memory_region): Convert
4833 field precision to int.
4834 * script.cc (script_set_section_region, script_set_section_region):
4835 Convert field precision to int.
4836
4837 2010-09-08 Rafael Espindola <espindola@google.com>
4838
4839 * arm.cc (do_finalize_sections): Create the __exidx_start and
4840 __exdix_end symbols even when the section is missing.
4841
4842 2010-09-08 Nick Clifton <nickc@redhat.com>
4843
4844 * README: Remove claim that MEMORY is not supported.
4845 * expression.cc (script_exp_function_origin)
4846 (script_exp_function_length): Move from here to ...
4847 * script.cc: ... here.
4848 (script_set_section_region, script_add_memory)
4849 (script_parse_memory_attr, script_include_directive): New
4850 functions.
4851 * script-sections.cc
4852 (class Memory_region): New class.
4853 (class Output_section_definition): Add set_memory_region,
4854 set_section_vma, set_section_lma and get_section_name methods.
4855 (class Script_Sections): Add add_memory_region,
4856 find_memory_region, find_memory_region_origin,
4857 find_memory_region_length and set_memory_region methods.
4858 Have set_section_addresses method walk the list of set memory
4859 regions.
4860 Extend the print methos to display memory regions.
4861 * script-sections.h: Add prototypes for new methods.
4862 Add enum for MEMORY region attributes.
4863 * yyscript.y: Add support for parsing MEMORY regions.
4864 * script-c.h: Add prototypes for new functions.
4865 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4866 * testsuite/Makefile.in: Regenerate.
4867 * testsuite/memory_test.sh: New script.
4868 * testsuite/memory_test.s: New assembler source file.
4869 * testsuite/memory_test.t: New linker script.
4870
4871 2010-08-27 Doug Kwan <dougkwan@google.com>
4872
4873 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4874 reference override an existing dynamic weak reference.
4875 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4876 * testsuite/Makefile.in: Regenerate.
4877 * testsuite/dyn_weak_ref.sh: New file.
4878 * testsuite/dyn_weak_ref_1.c: Ditto.
4879 * testsuite/dyn_weak_ref_2.c: Ditto.
4880
4881 2010-08-27 Ian Lance Taylor <iant@google.com>
4882
4883 * incremental.h (class Incremental_input_entry): Add virtual
4884 destructor.
4885
4886 2010-08-27 Ian Lance Taylor <iant@google.com>
4887
4888 * testsuite/start_lib_test_3.c: Mark t3 as used.
4889
4890 2010-08-27 Nick Clifton <nickc@redhat.com>
4891
4892 * options.cc (version_script): Fix small typo in previous
4893 whitespace tidyup.
4894
4895 2010-08-25 Nick Clifton <nickc@redhat.com>
4896
4897 * archive.cc: Formatting fixes: Remove whitespace between
4898 typename and following asterisk. Remove whitespace between
4899 function name and opening parenthesis.
4900 * archive.h: Likewise.
4901 * arm.cc: Likewise.
4902 * attributes.cc: Likewise.
4903 * attributes.h: Likewise.
4904 * common.cc: Likewise.
4905 * copy-relocs.cc: Likewise.
4906 * dirsearch.h: Likewise.
4907 * dynobj.cc: Likewise.
4908 * ehframe.cc: Likewise.
4909 * ehframe.h: Likewise.
4910 * expression.cc: Likewise.
4911 * fileread.cc: Likewise.
4912 * fileread.h: Likewise.
4913 * gc.h: Likewise.
4914 * gold-threads.cc: Likewise.
4915 * gold.cc: Likewise.
4916 * i386.cc: Likewise.
4917 * icf.h: Likewise.
4918 * incremental-dump.cc: Likewise.
4919 * incremental.cc: Likewise.
4920 * layout.cc: Likewise.
4921 * layout.h: Likewise.
4922 * main.cc: Likewise.
4923 * merge.cc: Likewise.
4924 * merge.h: Likewise.
4925 * object.cc: Likewise.
4926 * object.h: Likewise.
4927 * options.cc: Likewise.
4928 * options.h: Likewise.
4929 * output.cc: Likewise.
4930 * output.h: Likewise.
4931 * plugin.cc: Likewise.
4932 * plugin.h: Likewise.
4933 * powerpc.cc: Likewise.
4934 * reloc.cc: Likewise.
4935 * script-c.h: Likewise.
4936 * script-sections.cc: Likewise.
4937 * script.cc: Likewise.
4938 * stringpool.cc: Likewise.
4939 * symtab.cc: Likewise.
4940 * symtab.h: Likewise.
4941 * target.cc: Likewise.
4942 * timer.cc: Likewise.
4943 * timer.h: Likewise.
4944 * version.cc: Likewise.
4945 * x86_64.cc: Likewise.
4946
4947 2010-08-24 Nick Clifton <nickc@redhat.com>
4948
4949 PR 11899
4950 * layout.cc (segment_precedes): Sort segments by their physical
4951 addresses, if they have been set.
4952
4953 2010-08-23 Cary Coutant <ccoutant@google.com>
4954
4955 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4956 symbols data.
4957 (Lib_group::include_member): Unlock object after deleting its
4958 symbols data.
4959 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4960 the bug fixed here.
4961
4962 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4963 Cary Coutant <ccoutant@google.com>
4964
4965 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4966 constructor, and set_blocker.
4967 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4968 readsyms_blocker_.
4969 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4970 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4971 * testsuite/Makefile.am (start_lib_test): New test case.
4972 * testsuite/Makefile.in: Regenerate.
4973 * testsuite/start_lib_test_main.c: New file.
4974 * testsuite/start_lib_test_1.c: New file.
4975 * testsuite/start_lib_test_2.c: New file.
4976 * testsuite/start_lib_test_3.c: New file.
4977
4978 2010-08-19 Ian Lance Taylor <iant@google.com>
4979
4980 * Makefile.in: Rebuild with automake 1.11.1.
4981 * aclocal.m4: Likewise.
4982 * testsuite/Makefile.in: Likewise.
4983
4984 2010-08-19 Ian Lance Taylor <iant@google.com>
4985
4986 PR 10893
4987 * i386.cc (class Output_data_plt_i386): Update declarations.
4988 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4989 local_ifuncs_ fields.
4990 (Target_i386::do_plt_section_for_global): New function.
4991 (Target_i386::do_plt_section_for_local): New function.
4992 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4993 parameter; change all callers. Initialize global_ifuncs_ and
4994 local_ifuncs_. If doing a static link define __rel_iplt_start and
4995 __rel_iplt_end.
4996 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4997 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4998 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4999 symbols.
5000 (Target_i386::make_plt_section): New function, broken out of
5001 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
5002 (Target_i386::make_plt_entry): Call make_plt_section.
5003 (Target_i386::make_local_ifunc_plt_entry): New function.
5004 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5005 (Target_i386::Scan::local): Handle IFUNC symbols. Add
5006 R_386_IRELATIVE to switch.
5007 (Target_i386::Scan::global): Likewise.
5008 (Target_i386::Relocate::relocate): Likewise.
5009 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5010 switch.
5011 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5012 (Target_x86_64::do_plt_section_for_global): New function.
5013 (Target_x86_64::do_plt_section_for_local): New function.
5014 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5015 parameter; change all callers. If doing a static link define
5016 __rela_iplt_start and __rela_iplt_end.
5017 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5018 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5019 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5020 to point to .plt.
5021 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5022 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5023 switch.
5024 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5025 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5026 R_X86_64_IRELATIVE to switch.
5027 (Target_x86_64::Scan::global): Likewise.
5028 (Target_x86_64::Relocate::relocate): Likewise.
5029 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5030 switch.
5031 * target.h (class Target): Add plt_section_for_global and
5032 plt_section_for_local functions. Add do_plt_section_for_global
5033 and do_plt_section_for_local virtual functions.
5034 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5035 clarifying comments.
5036 (Symbol::use_plt_offset): Handle IFUNC symbol.
5037 * object.cc (Sized_relobj::Sized_relobj): Initialize
5038 local_plt_offsets_.
5039 (Sized_relobj::local_has_plt_offset): New function.
5040 (Sized_relobj::local_plt_offset): New function.
5041 (Sized_relobj::set_local_plt_offset): New function.
5042 (Sized_relobj::do_count): Handle IFUNC symbol.
5043 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5044 a bit away from input_shndx_ field. Add set_is_func_symbol and
5045 is_ifunc_symbol functions.
5046 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5047 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5048 local_plt_offsets_ field.
5049 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5050 * output.h (class Output_section_data): Add non-const
5051 output_section function.
5052 (class Output_data_got): Update declarations.
5053 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5054 Add use_plt_offset parameter to global and local constructors.
5055 Change all callers. Change local_sym_index_ field to 31 bits.
5056 Change GSYM_CODE and CONSTANT_CODE accordingly.
5057 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5058 doing a static link don't set sh_link field.
5059 (Output_data_got::Got_entry::write): Use PLT offset if
5060 appropriate.
5061 (Output_data_got::add_global_plt): New function.
5062 (Output_data_got::add_local_plt): New function.
5063 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5064 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5065 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5066 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5067 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5068 IFUNC conditional.
5069 * testsuite/ifunc-sel.h: New file.
5070 * testsuite/ifuncmain1.c: New file.
5071 * testsuite/ifuncmain1vis.c: New file.
5072 * testsuite/ifuncmod1.c: New file.
5073 * testsuite/ifuncdep2.c: New file.
5074 * testsuite/ifuncmain2.c: New file.
5075 * testsuite/ifuncmain3.c: New file.
5076 * testsuite/ifuncmod3.c: New file.
5077 * testsuite/ifuncmain4.c: New file.
5078 * testsuite/ifuncmain5.c: New file.
5079 * testsuite/ifuncmod5.c: New file.
5080 * testsuite/ifuncmain6pie.c: New file.
5081 * testsuite/ifuncmod6.c: New file.
5082 * testsuite/ifuncmain7.c: New file.
5083 * configure, testsuite/Makefile.in: Rebuild.
5084
5085 2010-08-18 Ian Lance Taylor <iant@google.com>
5086
5087 * incremental.cc
5088 (Output_section_incremental_inputs::write_input_files): Add cast
5089 to avoid signed/unsigned comparison warning.
5090 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5091
5092 2010-08-12 Cary Coutant <ccoutant@google.com>
5093
5094 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5095
5096 2010-08-13 Ian Lance Taylor <iant@google.com>
5097
5098 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5099
5100 2010-08-12 Cary Coutant <ccoutant@google.com>
5101 Doug Kwan <dougkwan@google.com>
5102
5103 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5104 defintion overrides non-weak undef, remember that the original undef
5105 is not weak.
5106 * symtab.cc (Symbol_table::sized_write_global): For undef without
5107 an original weak binding, set binding to global in output.
5108 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5109 * testsuite/Makefile.in: Regenerate.
5110 * testsuite/strong_ref_weak_def.sh: New file.
5111 * testsuite/strong_ref_weak_def_1.c: Ditto.
5112 * testsuite/strong_ref_weak_def_2.c: Ditto.
5113
5114 2010-08-12 Cary Coutant <ccoutant@google.com>
5115
5116 * testsuite/incremental_test.sh: Rewrite.
5117 * testsuite/incremental_test_1.c: Rewrite.
5118 * testsuite/incremental_test_2.c: Rewrite.
5119
5120 2010-08-12 Cary Coutant <ccoutant@google.com>
5121
5122 * arm.cc (Target_arm::got_size): Add const.
5123 (Target_arm::got_entry_count): New function.
5124 (Target_arm::plt_entry_count): New function.
5125 (Target_arm::first_plt_entry_offset): New function.
5126 (Target_arm::plt_entry_size): New function.
5127 (Output_data_plt_arm::entry_count): New function.
5128 (Output_data_plt_arm::first_plt_entry_offset): New function.
5129 (Output_data_plt_arm::get_plt_entry_size): New function.
5130 * i386.cc (Target_i386::got_size): Add const.
5131 (Target_i386::got_entry_count): New function.
5132 (Target_i386::plt_entry_count): New function.
5133 (Target_i386::first_plt_entry_offset): New function.
5134 (Target_i386::plt_entry_size): New function.
5135 (Output_data_plt_i386::entry_count): New function.
5136 (Output_data_plt_i386::first_plt_entry_offset): New function.
5137 (Output_data_plt_i386::get_plt_entry_size): New function.
5138 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5139 find_incremental_inputs_sections. Dump incremental_got_plt section.
5140 * incremental.cc: Include target.h.
5141 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5142 parameter. Adjust all callers. Find incremental_got_plt section.
5143 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5144 section.
5145 (Output_section_incremental_inputs::set_final_data_size): Calculate
5146 size of incremental_got_plt section.
5147 (Output_section_incremental_inputs::do_write): Write the
5148 incremental_got_plt section.
5149 (Got_plt_view_info): New struct.
5150 (Local_got_offset_visitor): New class.
5151 (Global_got_offset_visitor): New class.
5152 (Global_symbol_visitor_got_plt): New class.
5153 (Output_section_incremental_inputs::write_got_plt): New function.
5154 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5155 Add parameter. Adjust all callers.
5156 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5157 (Incremental_inputs::got_plt_section): New function.
5158 (Incremental_inputs::got_plt_section_): New data member.
5159 (Incremental_got_plt_reader): New class.
5160 * layout.cc (Layout::create_incremental_info_sections): Add the
5161 incremental_got_plt section.
5162 * object.h (Got_offset_list::get_list): New function.
5163 (Got offset_list::for_all_got_offsets): New function.
5164 (Sized_relobj::local_got_offset_list): New function.
5165 * powerpc.cc (Target_powerpc::got_size): Add const.
5166 (Target_powerpc::got_entry_count): New function.
5167 (Target_powerpc::plt_entry_count): New function.
5168 (Target_powerpc::first_plt_entry_offset): New function.
5169 (Target_powerpc::plt_entry_size): New function.
5170 (Output_data_plt_powerpc::entry_count): New function.
5171 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5172 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5173 * sparc.cc (Target_sparc::got_size): Add const.
5174 (Target_sparc::got_entry_count): New function.
5175 (Target_sparc::plt_entry_count): New function.
5176 (Target_sparc::first_plt_entry_offset): New function.
5177 (Target_sparc::plt_entry_size): New function.
5178 (Output_data_plt_sparc::entry_count): New function.
5179 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5180 (Output_data_plt_sparc::get_plt_entry_size): New function.
5181 * symtab.h (Symbol::got_offset_list): New function.
5182 (Symbol_table::for_all_symbols): New function.
5183 * target.h (Sized_target::got_entry_count): New function.
5184 (Sized_target::plt_entry_count): New function.
5185 (Sized_target::plt_entry_size): New function.
5186 * x86_64.cc (Target_x86_64::got_size): Add const.
5187 (Target_x86_64::got_entry_count): New function.
5188 (Target_x86_64::plt_entry_count): New function.
5189 (Target_x86_64::first_plt_entry_offset): New function.
5190 (Target_x86_64::plt_entry_size): New function.
5191 (Output_data_plt_x86_64::entry_count): New function.
5192 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5193 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5194
5195 2010-08-12 Cary Coutant <ccoutant@google.com>
5196
5197 * archive.cc: Include incremental.h.
5198 (Archive::Archive): Initialize incremental_info_.
5199 (Archive::include_member): Record archive members in incremental info.
5200 (Add_archive_symbols::run): Record begin and end of an archive in
5201 incremental info.
5202 (Lib_group::include_member): Record objects in incremental info.
5203 * archive.h (Incremental_archive_entry): Forward declaration.
5204 (Archive::set_incremental_info): New member function.
5205 (Archive::incremental_info): New member function.
5206 (Archive::Unused_symbol_iterator): New class.
5207 (Archive::unused_symbols_begin): New member function.
5208 (Archive::unused_symbols_end): New member function.
5209 (Archive::incremental_info_): New data member.
5210 * incremental-dump.cc (find_input_containing_global): New function.
5211 (dump_incremental_inputs): Dump new incremental info sections.
5212 * incremental.cc: Include symtab.h.
5213 (Output_section_incremental_inputs): New class.
5214 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5215 new incremental info sections.
5216 (Sized_incremental_binary::do_check_inputs): Likewise.
5217 (Incremental_inputs::report_archive): Remove.
5218 (Incremental_inputs::report_archive_begin): New function.
5219 (Incremental_inputs::report_archive_end): New function.
5220 (Incremental_inputs::report_object): New function.
5221 (Incremental_inputs::finalize_inputs): Remove.
5222 (Incremental_inputs::report_input_section): New function.
5223 (Incremental_inputs::report_script): Rewrite.
5224 (Incremental_inputs::finalize): Do nothing but finalize string table.
5225 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5226 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5227 (Incremental_inputs::create_data_sections): New function.
5228 (Incremental_inputs::relocs_entsize): New function.
5229 (Output_section_incremental_inputs::set_final_data_size): New function.
5230 (Output_section_incremental_inputs::do_write): New function.
5231 (Output_section_incremental_inputs::write_header): New function.
5232 (Output_section_incremental_inputs::write_input_files): New function.
5233 (Output_section_incremental_inputs::write_info_blocks): New function.
5234 (Output_section_incremental_inputs::write_symtab): New function.
5235 * incremental.h (Incremental_script_entry): Forward declaration.
5236 (Incremental_object_entry): Forward declaration.
5237 (Incremental_archive_entry): Forward declaration.
5238 (Incremental_inputs): Forward declaration.
5239 (Incremental_inputs_header_data): Remove.
5240 (Incremental_inputs_header): Remove.
5241 (Incremental_inputs_header_write): Remove.
5242 (Incremental_inputs_entry_data): Remove.
5243 (Incremental_inputs_entry): Remove.
5244 (Incremental_inputs_entry_write): Remove.
5245 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5246 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5247 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5248 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5249 Likewise.
5250 (Incremental_input_entry): New class.
5251 (Incremental_script_entry): New class.
5252 (Incremental_object_entry): New class.
5253 (Incremental_archive_entry): New class.
5254 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5255 (Incremental_inputs::report_inputs): Remove.
5256 (Incremental_inputs::report_archive): Remove.
5257 (Incremental_inputs::report_archive_begin): New function.
5258 (Incremental_inputs::report_archive_end): New function.
5259 (Incremental_inputs::report_object): Change prototype.
5260 (Incremental_inputs::report_input_section): New function.
5261 (Incremental_inputs::report_script): Change prototype.
5262 (Incremental_inputs::get_reloc_count): New function.
5263 (Incremental_inputs::set_reloc_count): New function.
5264 (Incremental_inputs::create_data_sections): New function.
5265 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5266 (Incremental_inputs::inputs_section): New function.
5267 (Incremental_inputs::symtab_section): New function.
5268 (Incremental_inputs::relocs_section): New function.
5269 (Incremental_inputs::get_stringpool): Add const.
5270 (Incremental_inputs::command_line): Add const.
5271 (Incremental_inputs::inputs): Remove.
5272 (Incremental_inputs::command_line_key): New function.
5273 (Incremental_inputs::input_file_count): New function.
5274 (Incremental_inputs::input_files): New function.
5275 (Incremental_inputs::relocs_entsize): New function.
5276 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5277 (Incremental_inputs::finalize_inputs): Remove.
5278 (Incremental_inputs::Input_info): Remove.
5279 (Incremental_inputs::lock_): Remove.
5280 (Incremental_inputs::inputs_): Change type.
5281 (Incremental_inputs::inputs_map_): Remove.
5282 (Incremental_inputs::current_object_entry_): New data member.
5283 (Incremental_inputs::inputs_section_): New data member.
5284 (Incremental_inputs::symtab_section_): New data member.
5285 (Incremental_inputs::relocs_section_): New data member.
5286 (Incremental_inputs::reloc_count_): New data member.
5287 (Incremental_inputs_reader): New class.
5288 (Incremental_symtab_reader): New class.
5289 (Incremental_relocs_reader): New class.
5290 * layout.cc (Layout::finalize): Move finalization of incremental info
5291 and creation of incremental info sections to follow finalization of
5292 symbol table. Set offsets for postprocessing sections.
5293 (Layout::create_incremental_info_sections): Call
5294 Incremental_inputs::create_data_sections. Add incremental symtab
5295 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5296 sections to layout after input sections.
5297 * layout.h (struct Timespec): Forward declaration.
5298 (Layout::incremental_inputs): Add const.
5299 (Layout::create_incremental_info_sections): Add parameter.
5300 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5301 * object.cc: Include incremental.h.
5302 (Relobj::finalize_incremental_relocs): New function.
5303 (Sized_relobj::do_layout): Record input sections in incremental info.
5304 * object.h (Object::output_section): New function.
5305 (Object::output_section_offset): Moved from Relobj.
5306 (Object::get_incremental_reloc_base): New function.
5307 (Object::get_incremental_reloc_count): New function.
5308 (Object::do_output_section): New function.
5309 (Object::do_output_section_offset): Moved from Relobj.
5310 (Object::do_get_incremental_reloc_base): New function.
5311 (Object::do_get_incremental_reloc_count): New function.
5312 (Object::Object): Initialize new data members.
5313 (Relobj::output_section): Renamed do_output_section and moved to
5314 protected.
5315 (Relobj::output_section_offset): Moved to Object.
5316 (Relobj::do_get_incremental_reloc_base): New function.
5317 (Relobj::do_get_incremental_reloc_count): New function.
5318 (Relobj::allocate_incremental_reloc_counts): New function.
5319 (Relobj::count_incremental_reloc): New function.
5320 (Relobj::finalize_incremental_relocs): New function.
5321 (Relobj::next_incremental_reloc_index): New function.
5322 (Relobj::reloc_counts_): New data member.
5323 (Relobj::reloc_bases_): New data member.
5324 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5325 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5326 (Sized_relobj::incremental_relocs_scan): New function.
5327 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5328 (Sized_relobj::incremental_relocs_write): New function.
5329 (Sized_relobj::incremental_relocs_write_reltype): New function.
5330 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5331 incremental link.
5332 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5333 archives and object files elsewhere.
5334 (Add_symbols::run): Report object files here.
5335 (Finish_group::run): Report end of archive at end of group.
5336 * reloc.cc: Include layout.h, incremental.h.
5337 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5338 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5339 (Sized_relobj::incremental_relocs_scan): New function.
5340 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5341 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5342 (Sized_relobj::incremental_relocs_write): New function.
5343 (Sized_relobj::incremental_relocs_write_reltype): New function.
5344 * script.cc (read_input_script): Rewrite test for incremental link.
5345 Change call to Incremental_inputs::report_script.
5346 * symtab.h (Symbol_table::first_global_index): New function.
5347 (Symbol_table::output_count): New function.
5348
5349 2010-08-12 Doug Kwan <dougkwan@google.com>
5350
5351 * arm.cc (Target_arm::merge_object_attributes): Check command line
5352 options --no-wchar-size-warning and --no-enum-size-warning.
5353 * options.h (General_options): Add ld-compatible options
5354 --no-enum-size-warning and --no-wchar-size-warning.
5355
5356 2010-08-04 Ian Lance Taylor <iant@google.com>
5357
5358 * x86_64.cc (Target_x86_64::Scan::local): Use
5359 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5360 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5361 (Target_x86_64::Scan::global): Likewise.
5362 (Target_x86_64::Relocate::relocate): Likewise.
5363 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5364 Likewise.
5365
5366 2010-08-03 Cary Coutant <ccoutant@google.com>
5367
5368 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5369 to reserve space in merged_strings vector. Keep total input size
5370 for stats.
5371 (Output_merge_string::do_print_merge_stats): Print total input size.
5372 * merge.h (Output_merge_string): Add input_size_ field.
5373 * stringpool.cc (Stringpool_template::string_length): Move
5374 implementations out of Stringpool_template class and place in
5375 stringpool.h.
5376 * stringpool.h (string_length): Move out of Stringpool_template.
5377
5378 2010-08-03 Ian Lance Taylor <iant@google.com>
5379
5380 PR 11712
5381 * layout.cc (relaxation_loop_body): If address of load segment is
5382 set, adjust address to include headers if possible.
5383
5384 2010-08-03 Ian Lance Taylor <iant@google.com>
5385
5386 * version.cc (version_string): Bump to 1.10.
5387
5388 2010-08-03 Ian Lance Taylor <iant@google.com>
5389
5390 PR 11805
5391 * layout.h (enum Output_section_order): Define.
5392 (class Layout): Update declarations.
5393 * layout.cc (Layout::get_output_section): Add order parameter.
5394 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5395 is_first_non_relro parameters. Change all callers.
5396 (Layout::choose_output_section): Likewise.
5397 (Layout::add_output_section_data): Likewise.
5398 (Layout::make_output_section): Likewise. Set order.
5399 (Layout::default_section_order): New function.
5400 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5401 * output.cc (Output_section::Output_section): Initialize order_.
5402 Don't initialize deleted fields.
5403 (Output_segment::Output_segment): Don't initialize deleted
5404 fields.
5405 (Output_segment::add_output_section_to_load): New function
5406 replacing add_output_section. Change all callers to call this or
5407 add_output_section_to_nonload.
5408 (Output_segment::add_output_section_to_nonload): New function.
5409 (Output_segment::remove_output_section): Rewrite.
5410 (Output_segment::add_initial_output_data): Likewise.
5411 (Output_segment::has_any_data_sections): Likewise.
5412 (Output_segment::is_first_section_relro): Likewise.
5413 (Output_segment::maximum_alignment): Likewise.
5414 (Output_segment::has_dynamic_reloc): New function replacing
5415 dynamic_reloc_count. Change all callers.
5416 (Output_segment::has_dynamic_reloc_list): New function replacing
5417 dynamic_reloc_count_list. Change all callers.
5418 (Output_segment::set_section_addresses): Rewrite.
5419 (Output_segment::set_offset): Rewrite.
5420 (Output_segment::find_first_and_last_list): Remove.
5421 (Output_segment::set_tls_offsets): Rewrite.
5422 (Output_segment::first_section_load_address): Likewise.
5423 (Output_segment::output_section_count): Likewise.
5424 (Output_segment::section_with_lowest_load_address): Likewise.
5425 (Output_segment::write_section_headers): Likewise.
5426 (Output_segment::print_sections_to_map): Likewise.
5427 * output.h (class Output_data): Remove dynamic_reloc_count_
5428 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5429 (Output_data::add_dynamic_reloc): Rewrite.
5430 (Output_data::has_dynamic_reloc): New function.
5431 (Output_data::dynamic_reloc_count): Remove.
5432 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5433 is_last_relro_, is_first_non_relro_, is_interp_,
5434 is_dynamic_linker_section_ fields. Add order and set_order
5435 functions. Remove is_relro_local, set_is_relro_local,
5436 is_last_relro, set_is_last_relro, is_first_non_relro,
5437 set_is_first_non_relro functions, is_interp, set_is_interp,
5438 is_dynamic_linker_section, and set_is_dynamic_linker_section
5439 functions.
5440 (class Output_segment): Change Output_data_list from std::list to
5441 std:;vector. Add output_lists_ field. Remove output_data_ and
5442 output_bss_ fields. Update declarations.
5443
5444 2010-08-02 Ian Lance Taylor <iant@google.com>
5445
5446 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5447 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5448 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5449
5450 2010-08-02 Ian Lance Taylor <iant@google.com>
5451
5452 PR 11855
5453 * script.cc (Script_options::Script_options): Initialize
5454 symbol_definitions_ and symbol_references_.
5455 (Script_options::add_symbol_assignment): Update
5456 symbol_definitions_ and symbol_references_.
5457 (Script_options::add_symbol_reference): New function.
5458 (script_symbol): New function.
5459 * script.h (class Script_options): Add symbol_definitions_ and
5460 symbol_references_ fields.
5461 (Script_options::referenced_const_iterator): New type.
5462 (Script_options::referenced_begin): New function.
5463 (Script_options::referenced_end): New function.
5464 (Script_options::is_referenced): New function.
5465 (Script_options::any_unreferenced): New function.
5466 * script-c.h (script_symbol): Declare.
5467 * yyscript.y (exp): Call script_symbol.
5468 * symtab.cc: Include "script.h".
5469 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5470 Change all callers. Check symbols referenced by scripts.
5471 (Symbol_table::add_undefined_symbols_from_command_line): Add
5472 layout parameter. Change all callers.
5473 (Symbol_table::do_add_undefined_symbols_from_command_line):
5474 Likewise. Break out loop body. Check symbols referenced by
5475 scripts.
5476 (Symbol_table::add_undefined_symbol_from_command_line): New
5477 function broken out of
5478 do_add_undefined_symbols_from_command_line.
5479 * symtab.h (class Symbol_table): Update declarations.
5480 * archive.cc: Include "layout.h".
5481 (Archive::should_include_member): Add layout parameter. Change
5482 all callers. Check for symbol mentioned in expression.
5483 * archive.h (class Archive): Update declaration.
5484 * object.cc (Sized_relobj::do_should_include_member): Add layout
5485 parameter.
5486 * object.h (Object::should_include_member): Add layout parameter.
5487 Change all callers.
5488 (Object::do_should_include_member): Add layout parameter.
5489 (class Sized_relobj): Update declaration.
5490 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5491 parameter.
5492 * dynobj.h (class Sized_dynobj): Update declaration.
5493 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5494 layout parameter.
5495 * plugin.h (class Sized_pluginobj): Update declaration.
5496
5497 2010-08-02 Ian Lance Taylor <iant@google.com>
5498
5499 PR 11866
5500 * output.cc (Output_segment::set_offset): Search for the first and
5501 last sections rather than assuming that the list is in order.
5502 (Output_segment::find_first_and_last_list): New function.
5503 * output.h (class Output_segment): Update declarations.
5504 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5505 (relro_strip_test_SOURCES): New variable.
5506 (relro_strip_test_DEPENDENCIES): New variable.
5507 (relro_strip_test_LDFLAGS): New variable.
5508 (relro_strip_test_LDADD): New variable.
5509 (relro_strip_test.so): New target.
5510
5511 2010-08-02 Ian Lance Taylor <iant@google.com>
5512
5513 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5514 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5515 (Target_i386::got_tlsdesc_section): New function.
5516 (Target_i386::got_section): Create space for GOT entries for
5517 TLSDESC relocations.
5518 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5519 R_386_TLS_GOTDESC.
5520 (Target_i386::Scan::global): Likewise.
5521 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5522 using TLSDESC GOT.
5523 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5524 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5525 (Target_x86_64::got_tlsdesc_section): New function.
5526 (Target_x86_64::got_section): Create space for GOT entries for
5527 TLSDESC relocations.
5528 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5529 R_386_TLS_GOTDESC.
5530 (Target_x86_64::Scan::global): Likewise.
5531 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5532 using TLSDESC GOT.
5533
5534 2010-08-02 Ian Lance Taylor <iant@google.com>
5535
5536 * testsuite/final_layout.sh: Use dc to convert from hex to
5537 decimal.
5538
5539 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5540
5541 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5542 paramter to the call to gold::gc_process_relocs.
5543 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5544 paramter to the call to gold::gc_process_relocs.
5545 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5546 parameter to the call to gold::gc_process_relocs.
5547 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5548 template parameter to the call to gold::gc_process_relocs.
5549 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5550 paramter to the call to gold::gc_process_relocs.
5551 * gc.h (get_embedded_addend_size): New function.
5552 (gc_process_relocs): Save the size of the reloc for use by ICF.
5553 * icf.cc (get_section_contents): Get the addend from the text section
5554 for SHT_REL relocation sections.
5555 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5556 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5557 * int_encoding.h (read_from_pointer): New overloaded function.
5558 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5559 * testsuite/icf_sht_rel_addend_test.sh: New file.
5560 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5561 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5562
5563 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5564
5565 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5566 * Makefile.in: Regenerate.
5567 * testsuite/Makefile.in: Regenerate.
5568
5569 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5570
5571 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5572 * gold/testsuite/debug_msg.cc: Likewise.
5573 * gold/testsuite/odr_violation1.cc
5574 * gold/testsuite/odr_violation2.cc
5575
5576 2010-07-21 Cary Coutant <ccoutant@google.com>
5577
5578 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5579 string, and length fields.
5580 (Output_merge_string::Merged_strings_list): New type.
5581 (Output_merge_string::Merged_strings_lists): New typedef.
5582 (Output_merge_string): Replace merged_strings_ with
5583 merged_strings_lists_.
5584 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5585 Merged_strings_list per input object and section. Don't store pointer
5586 to the string. Don't store length with each merged string entry.
5587 (Output_merge_string::finalize_merged_data): Loop over list of merged
5588 strings lists. Recompute length of each merged string.
5589
5590 2010-07-15 Cary Coutant <ccoutant@google.com>
5591
5592 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5593 here.
5594
5595 2010-07-14 Ian Lance Taylor <iant@google.com>
5596
5597 * descriptors.cc (Descriptors::open): Report correct name in error
5598 message.
5599
5600 2010-07-13 Doug Kwan <dougkwan@google.com>
5601
5602 * arm.cc (Arm_input_section::Arm_input_section): For a
5603 SHT_ARM_EXIDX section, always keeps the input sections.
5604 (Arm_input_section::set_exidx_section_link): New method.
5605 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5606 has_errors_ to false.
5607 (Arm_exidx_input_section::has_errors,
5608 Arm_exidx_input_section::set_has_errors): New methods.
5609 (Arm_exidx_input_section::has_errors_): New data member.
5610 (Arm_relobj::get_exidx_shndx_list): New method.
5611 (Arm_output_section::append_text_sections_to_list): Do not skip
5612 section without SHF_EXECINSTR.
5613 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5614 errors.
5615 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5616 section header. Make error messages more verbose. Check for
5617 a non-executable section linked to an EXIDX section.
5618 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5619 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5620 check that there is no deferred EXIDX section if we exit early.
5621 Instead of not making an EXIDX section in case of an error, make one
5622 and set the has_errors flag of it.
5623 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5624 in a relocatable link.
5625 (Target_arm::do_relax): Look for the EXIDX output section instead of
5626 assuming that it is called .ARM.exidx.
5627 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5628 section list. Do not check for SHF_EXECINSTR section flags but
5629 skip any input section with errors.
5630 * output.cc (Output_section::Output_section): Initialize
5631 always_keeps_input_sections_ to false.
5632 (Output_section::add_input_section): Check for
5633 always_keeps_input_sections_.
5634 * output.h (Output_section::always_keeps_input_sections,
5635 Output_section::set_always_keeps_input_sections): New methods.
5636 (Output_section::always_keeps_input_sections): New data member.
5637
5638 2010-07-13 Rafael Espindola <espindola@google.com>
5639
5640 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5641 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5642
5643 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5644 Ian Lance Taylor <iant@google.com>
5645
5646 * output.h (Output_section_lookup_maps::add_merge_section):
5647 Correct check of whether value was inserted.
5648 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5649 (Output_section_lookup_maps::add_relaxed_input_section):
5650 Likewise.
5651 * arm.cc (Target_arm::got_section): Remove used local os.
5652 * i386.cc (Target_i386::got_section): Likewise.
5653 * x86_64.cc (Target_x86_64::got_section): Likewise.
5654 * sparc.cc (Target_sparc::got_section): Likewise.
5655 (Target_sparc::relocate): Remove unused local have_got_offset.
5656 * powerpc.cc (Target_powerpc::relocate): Likewise.
5657
5658 2010-07-13 Ian Lance Taylor <iant@google.com>
5659
5660 * compressed_output.cc (zlib_decompress): Fix signature in
5661 !HAVE_ZLIB_H case.
5662
5663 * archive.cc (Archive::include_member): Unlock an external member
5664 of a thin archive. Don't bother to delete an object we know is
5665 NULL.
5666
5667 2010-07-12 Cary Coutant <ccoutant@google.com>
5668
5669 * compressed_output.cc (zlib_decompress): New function.
5670 (get_uncompressed_size): New function.
5671 (decompress_input_section): New function.
5672 * compressed_output.h (get_uncompressed_size): New function.
5673 (decompress_input_section): New function.
5674 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5675 Handle compressed debug sections.
5676 * layout.cc (is_compressed_debug_section): New function.
5677 (Layout::output_section_name): Map compressed section names to
5678 canonical names.
5679 * layout.h (is_compressed_debug_section): New function.
5680 (is_debug_info_section): Recognize compressed debug sections.
5681 * merge.cc: Include compressed_output.h.
5682 (Output_merge_data::do_add_input_section): Handle compressed
5683 debug sections.
5684 (Output_merge_string::do_add_input_section): Handle compressed
5685 debug sections.
5686 * object.cc: Include compressed_output.h.
5687 (Sized_relobj::Sized_relobj): Initialize new data members.
5688 (build_compressed_section_map): New function.
5689 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5690 * object.h (Object::section_is_compressed): New method.
5691 (Object::do_section_is_compressed): New method.
5692 (Sized_relobj::Compressed_section_map): New type.
5693 (Sized_relobj::do_section_is_compressed): New method.
5694 (Sized_relobj::compressed_sections_): New data member.
5695 * output.cc (Output_section::add_input_section): Handle compressed
5696 debug sections.
5697 * reloc.cc: Include compressed_output.h.
5698 (Sized_relobj::write_sections): Handle compressed debug sections.
5699
5700 2010-07-08 Cary Coutant <ccoutant@google.com>
5701
5702 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5703 weak when resolving to a dynamic def.
5704 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5705 for weak undef/dynamic def cases. Adjust callers.
5706 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5707 undef_binding_weak_.
5708 (Symbol_table::sized_write_globals): Adjust symbol binding.
5709 (Symbol_table::sized_write_symbol): Add binding parameter.
5710 * symtab.h (Symbol::set_undef_binding): New method.
5711 (Symbol::is_undef_binding_weak): New method.
5712 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5713 (Symbol_table::should_override): Add new parameter.
5714 (Symbol_table::sized_write_symbol): Add new parameter.
5715
5716 * testsuite/weak_undef_file1.cc: Add new test case.
5717 * testsuite/weak_undef_file2.cc: Fix header comment.
5718 * testsuite/weak_undef_test.cc: Add new test case.
5719
5720 2010-06-29 Doug Kwan <dougkwan@google.com>
5721
5722 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5723 Initialize USE_SYMBOL_.
5724 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5725 definition.
5726 (Arm_reloc_property::uses_symbol_): New data member declaration.
5727 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5728 uses symbol value and symbol is undefined but not weakly undefined.
5729
5730 2010-06-28 Rafael Espindola <espindola@google.com>
5731
5732 * plugin.cc (Plugin::load): Use dlerror.
5733
5734 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5735
5736 * symtab.cc (detect_odr_violations): When reporting an ODR
5737 violation, report an object where the symbol is defined.
5738
5739 2010-06-25 Doug Kwan <dougkwan@google.com>
5740
5741 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5742 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5743 definition.
5744 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5745 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5746 target hook to detect function points.
5747 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5748 * icf.h (Icf::check_section_for_function_pointers): Change type of
5749 parameter SECTION_NAME to const reference to std::string. Use
5750 target hook to determine if section may have unsafe pointers.
5751 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5752 method definition.
5753
5754 2010-06-21 Rafael Espindola <espindola@google.com>
5755
5756 * fileread.cc (Input_file::find_fie): New
5757 (Input_file::open): Use Input_file::find_fie.
5758 * fileread.h (Input_file::find_fie): New
5759 * plugin.cc (set_extra_library_path): New.
5760 (Plugin::load): Add set_extra_library_path to the transfer vector.
5761 (Plugin_manager::set_extra_library_path): New.
5762 (Plugin_manager::add_input_file): Use the extra search path if set.
5763 (set_extra_library_path(): New.
5764 * plugin.h (Plugin_manager): Add set_extra_library_path and
5765 extra_search_path_.
5766
5767 2010-06-19 Cary Coutant <ccoutant@google.com>
5768
5769 * layout.cc (gdb_sections): Add .debug_types.
5770 (lines_only_debug_sections): Likewise.
5771
5772 2010-06-18 Rafael Espindola <espindola@google.com>
5773
5774 * plugin.cc (add_input_file,add_input_library)
5775 (Plugin_manager::add_input_file): Make filename arguments const.
5776 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5777 const.
5778
5779 2010-06-16 Doug Kwan <dougkwan@google.com>
5780
5781 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5782 .ARM.attributes section if we have not merged any input
5783 attributes sections.
5784
5785 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5786
5787 * arm.cc: Allow combining objects with no EABI version
5788 information.
5789
5790 2010-06-15 Rafael Espindola <espindola@google.com>
5791
5792 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5793
5794 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5795
5796 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5797 (struct iovec): Correct !HAVE_READV definition.
5798
5799 2010-06-10 Cary Coutant <ccoutant@google.com>
5800
5801 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5802 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5803 reloc sections.
5804 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5805
5806 PR 11683
5807 * symtab.h (Symbol::is_placeholder): New member function.
5808 * target-reloc.h (relocate_section): Check for placeholder symbols.
5809
5810 * testsuite/Makefile.am (plugin_test_8): New test.
5811 (plugin_test_9): New test.
5812 * testsuite/Makefile.in: Regenerate.
5813
5814 2010-06-09 Nick Clifton <nickc@redhat.com>
5815
5816 * yyscript.y (input_list_element): Allow strings prefixed with
5817 the '-' character. Treat these as libraries.
5818 * script.cc (script_add_library): New function. Adds a library
5819 specified by "-l<name>" found in an input script.
5820 * script-c.h: Add prototype for script_add_library.
5821
5822 2010-06-07 Doug Kwan <dougkwan@google.com>
5823
5824 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5825 Restrict stub-group size to be within long conditional branch
5826 range when working around cortex-A8 erratum.
5827
5828 2010-06-07 Damien Diederen <dd@crosstwine.com>
5829
5830 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5831 #ifdef typo.
5832
5833 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5834
5835 PR gold/11658
5836 * output.cc
5837 (Output_section::Input_section_sort_entry::compare_section_ordering):
5838 Change to return non-zero correctly.
5839 (Output_section::Input_section_sort_section_order_index_compare
5840 ::operator()): Change to fix ambiguity in comparisons.
5841
5842 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5843
5844 * gold.h (is_wildcard_string): New function.
5845 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5846 (Layout::layout_eh_frame): Ditto.
5847 (Layout::find_section_order_index): New method.
5848 (Layout::read_layout_from_file): New method.
5849 * layout.h (Layout::find_section_order_index): New method.
5850 (Layout::read_layout_from_file): New method.
5851 (Layout::input_section_position_): New private member.
5852 (Layout::input_section_glob_): New private member.
5853 * main.cc (main): Call read_layout_from_file here.
5854 * options.h (--section-ordering-file): New option.
5855 * output.cc (Output_section::input_section_order_specified_): New
5856 member.
5857 (Output_section::Output_section): Initialize new member.
5858 (Output_section::add_input_section): Add new parameter.
5859 Keep input sections when --section-ordering-file is used.
5860 (Output_section::set_final_data_size): Sort input sections when
5861 section ordering file is specified.
5862 (Output_section::Input_section_sort_entry): Add new parameter.
5863 Check sorting type.
5864 (Output_section::Input_section_sort_entry::compare_section_ordering):
5865 New method.
5866 (Output_section::Input_section_sort_compare::operator()): Change to
5867 consider section_order_index.
5868 (Output_section::Input_section_sort_init_fini_compare::operator()):
5869 Change to consider section_order_index.
5870 (Output_section::Input_section_sort_section_order_index_compare
5871 ::operator()): New method.
5872 (Output_section::sort_attached_input_sections): Change to sort
5873 according to section order when specified.
5874 (Output_section::add_input_section<32, true>): Add new parameter.
5875 (Output_section::add_input_section<64, true>): Add new parameter.
5876 (Output_section::add_input_section<32, false>): Add new parameter.
5877 (Output_section::add_input_section<64, false>): Add new parameter.
5878 * output.h (Output_section::add_input_section): Add new parameter.
5879 (Output_section::input_section_order_specified): New
5880 method.
5881 (Output_section::set_input_section_order_specified): New method.
5882 (Input_section::Input_section): Initialize section_order_index_.
5883 (Input_section::section_order_index): New method.
5884 (Input_section::set_section_order_index): New method.
5885 (Input_section::section_order_index_): New member.
5886 (Input_section::Input_section_sort_section_order_index_compare): New
5887 struct.
5888 (Output_section::input_section_order_specified_): New member.
5889 * script-sections.cc (is_wildcard_string): Delete and move modified
5890 method to gold.h.
5891 (Output_section_element_input::Output_section_element_input): Modify
5892 call to is_wildcard_string.
5893 (Output_section_element_input::Input_section_pattern
5894 ::Input_section_pattern): Ditto.
5895 (Output_section_element_input::Output_section_element_input): Ditto.
5896 * testsuite/Makefile.am (final_layout): New test case.
5897 * testsuite/Makefile.in: Regenerate.
5898 * testsuite/final_layout.cc: New file.
5899 * testsuite/final_layout.sh: New file.
5900
5901 2010-06-01 Rafael Espindola <espindola@google.com>
5902
5903 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5904
5905 2010-06-01 Rafael Espindola <espindola@google.com>
5906
5907 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5908 visibility of symbols.
5909
5910 2010-05-27 Doug Kwan <dougkwan@google.com>
5911
5912 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5913 from start of output section instead of address for a local symbol
5914 in a merged or relaxed section when doing a relocatable link.
5915
5916 2010-05-26 Rafael Espindola <espindola@google.com>
5917
5918 PR 11604
5919 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5920 adding sections the garbage collector removed.
5921 * gold/testsuite/Makefile.am: Add test.
5922 * gold/testsuite/Makefile.in: Regenerate.
5923 * gold/testsuite/plugin_test_7.sh: New.
5924 * gold/testsuite/plugin_test_7_1.c: New.
5925 * gold/testsuite/plugin_test_7_2.c: New.
5926
5927 2010-05-26 Rafael Espindola <espindola@google.com>
5928
5929 * script-sections.cc (Output_section_definition::set_section_addresses):
5930 Check for --section-start.
5931
5932 2010-05-26 Doug Kwan <dougkwan@google.com>
5933
5934 * arm.cc (Arm_scan_relocatable_relocs): New class.
5935 (Target_arm::relocate_special_relocatable): New method.
5936 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5937 (Arm_relocate_functions::thumb_branch_common): Same.
5938 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5939 instead of Default_scan_relocatable_relocs.
5940 * target-reloc.h (relocate_for_relocatable): Let target handle
5941 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5942 * target.h (Sized_target::relocate_special_relocatable): New method.
5943
5944 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5945
5946 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5947
5948 2010-05-23 Doug Kwan <dougkwan@google.com>
5949
5950 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5951 instead of a cast.
5952 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5953 with a direct branch, not a conditional branch, to a stub.
5954 * merge.cc (Output_merge_base::record_input_section): New method
5955 defintion.
5956 (Output_merge_data::do_add_input_section): Record input section if
5957 keeps-input-sections flag is set.
5958 (Output_merge_string::do_add_input_section): Ditto.
5959 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5960 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5961 INPUT_SECTIONS_.
5962 (Output_merge_base::keeps_input_sections,
5963 Output_merge_base::set_keeps_input_sections,
5964 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5965 method definitions.
5966 (Output_merge_base::Input_sections): New type declaration.
5967 (Output_merge_base::input_sections_begin,
5968 Output_merge_base::input_sections_end,
5969 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5970 (Output_merge_base::bool keeps_input_sections_,
5971 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5972 Output_merge_base::input_sections_): New data members.
5973 (Output_merge_data::do_set_keeps_input_sections): New method
5974 defintion.
5975 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5976 * output.cc (Output_section::Input_section::relobj): Move method
5977 defintion from class declaration to here and handle merge sections.
5978 (Output_section::Input_section::shndx): Ditto.
5979 (Output_section::Output_section): Remove initializations of removed
5980 data members and initialize new data member LOOKUP_MAPS_.
5981 (Output_section::add_input_section): Set keeps-input-sections flag
5982 for a newly created merge output section as appropriate. Adjust code
5983 to use Output_section_lookup_maps class.
5984 (Output_section::add_relaxed_input_section): Adjst code for lookup
5985 maps code refactoring.
5986 (Output_section::add_merge_input_section): Add a new parameter
5987 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5988 class. If adding input section to a newly created merge output
5989 section fails, remove the new merge section.
5990 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5991 Adjust code for use of the Output_section_lookup_maps class.
5992 (Output_section::find_merge_section): Ditto.
5993 (Output_section::build_lookup_maps): New method defintion.
5994 (Output_section::find_relaxed_input_section): Adjust code to use
5995 Output_section_lookup_maps class.
5996 (Output_section::get_input_sections): Export merge sections. Adjust
5997 code to use Output_section_lookup_maps class.
5998 (Output_section:::add_script_input_section): Adjust code to use
5999 Output_section_lookup_maps class. Update lookup maps for merge
6000 sections also.
6001 (Output_section::discard_states): Use Output_section_lookup_maps.
6002 (Output_section::restore_states): Same.
6003 * output.h (Merge_section_properties): Move class defintion out of
6004 Output_section.
6005 (Output_section_lookup_maps): New class.
6006 (Output_section::Input_section::is_merge_section): New method
6007 defintion.
6008 (Output_section::Input_section::relobj): Move defintion out of class
6009 defintion. Declare method only.
6010 (Output_section::Input_section::shndx): Ditto.
6011 (Output_section::Input_section::output_merge_base): New method defintion.
6012 (Output_section::Input_section::u2_.pomb): New union field.
6013 (Output_section::Merge_section_by_properties_map,
6014 Output_section::Output_section_data_by_input_section_map,
6015 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6016 Remove types.
6017 (Output_section::add_merge_input_section): Add new parameter
6018 KEEPS_INPUT_SECTIONS.
6019 (Output_section::build_lookup_maps): New method declaration.
6020 (Output_section::merge_section_map_,
6021 Output_section::merge_section_by_properties_map_,
6022 Output_section::relaxed_input_section_map_,
6023 Output_section::is_relaxed_input_section_map_valid_): Remove data
6024 members.
6025 (Output_section::lookup_maps_): New data member.
6026
6027 2010-05-21 Doug Kwan <dougkwan@google.com>
6028
6029 PR gold/11619
6030 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6031 avoid a compilation error.
6032
6033 2010-05-19 Rafael Espindola <espindola@google.com>
6034
6035 * script-sections.cc (Output_section_definition::allocate_to_segment):
6036 Update the phdrs_list even when the output section is NULL.
6037 * testsuite/Makefile.am: Add test.
6038 * testsuite/Makefile.in: Regenerate.
6039 * testsuite/script_test_9.cc: New.
6040 * testsuite/script_test_9.sh: New.
6041 * testsuite/script_test_9.t: New.
6042
6043 2010-05-19 Doug Kwan <dougkwan@google.com>
6044
6045 * arm.cc (Arm_input_section::original_size): New method.
6046 (Arm_input_section::do_addralign): Add a cast.
6047 (Arm_input_section::do_output_offset): Remove static cast.
6048 (Arm_input_section::original_addralign,
6049 Arm_input_section::original_size_): Change type to uint32_t.
6050 (Arm_input_section::init): Add safe casts for section alignment
6051 and size.
6052 (Arm_input_section::set_final_data_size): Do not set address and
6053 offset of stub table.
6054 (Arm_output_section::fix_exidx_coverage): Change use of of
6055 Output_section::Simple_input_section to that of
6056 Output_section::Input_section.
6057 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6058 except for the first pass.
6059 * output.cc (Output_section::get_input_sections): Change type of
6060 input_sections to std::list<Input_section>.
6061 (Output_section::add_script_input_section): Rename from
6062 Output_section::add_simple_input_section. Change type of SIS
6063 parameter from Simple_input_section to Input_section.
6064 * output.h (Output_section::Simple_input_section): Remove class.
6065 (Output_section::Input_section): Change class visibility to public.
6066 (Output_section::Input_section::addralign): Use stored alignments
6067 for special input sections if set.
6068 (Output_section::Input_section::set_addralign): New method.
6069 (Output_section::get_input_sections): Change parameter type from
6070 list of Simple_input_section to list of Input_section.
6071 (Output_section::add_script_input_section): Rename from
6072 Output_section::add_simple_input_section. Change first parameter's
6073 type from Simple_input_section to Input_section and remove the
6074 second and third parameters.
6075 * script-sections.cc (Input_section::Input_section_list): Change
6076 type to list of Output_section::Input_section/
6077 (Input_section_info::Input_section_info): Change parameter type of
6078 INPUT_SECTION to Output_section::Input_section.
6079 (Input_section_info::input_section): Change return type.
6080 (Input_section_info::input_section_): Change type to
6081 Output_section::Input_section.
6082 (Output_section_element_input::set_section_addresses): Adjust code
6083 to use Output_section::Input_section instead of
6084 Output_section::Simple_input_section. Adjust code for renaming
6085 of Output_section::add_simple_input_section.
6086 (Orphan_output_section::set_section_addresses): Ditto.
6087
6088 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6089
6090 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6091 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6092
6093 2010-05-18 Rafael Espindola <espindola@google.com>
6094
6095 * options.cc (General_options::finalize): Handle -nostdlib.
6096 * options.h (nostdlib): New option.
6097 * script.cc (script_add_search_dir): Handle -nostdlib.
6098
6099 2010-05-12 Doug Kwan <dougkwan@google.com>
6100
6101 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6102 attributes section only if there no attributes section after merging.
6103 (Target_arm::merge_object_attributes): Move value of
6104 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6105 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6106 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6107 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6108 and arm_attr_merge_7.stdout.
6109 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6110 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6111 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6112 arm_attr_merge_7b.o): New rules.
6113 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6114 arm_attr_merge_7
6115 * testsuite/Makefile.in: Regenerate.
6116 * testsuite/arm_attr_merge.sh: New file.
6117 * testsuite/arm_attr_merge_[67][ab].s: Same.
6118
6119 2010-05-05 Nick Clifton <nickc@redhat.com>
6120
6121 * po/es.po: Updated Spanish translation.
6122
6123 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6124
6125 * Makefile.am (install-exec-local): Properly install gold as
6126 default cross linker.
6127 * Makefile.in: Regenerated.
6128
6129 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6130 Nick Clifton <nickc@redhat.com>
6131
6132 * configure.ac (install_as_default): Define and set to false
6133 unless --enable-gold or --enable-gold=both/gold has been
6134 specified.
6135 * configure: Regenerate.
6136
6137 * Makefile.am (install-exec-local): Install the executable as
6138 'ld.gold'. If install_as_default is true then also install it as
6139 'ld'.
6140 * Makefile.in: Regenerated.
6141
6142 2010-04-24 Ian Lance Taylor <iant@google.com>
6143
6144 * layout.cc (Layout::layout_reloc): In relocatable link don't
6145 combine reloc sections for grouped sections.
6146
6147 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6148
6149 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6150 sections that are not ordinary to icf.
6151 * icf.cc (get_section_contents): Handle relocation pointing to section
6152 with no object or shndx information.
6153 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6154 * testsuite/Makefile.in: Regenerate.
6155 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6156 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6157
6158 2010-04-22 Ian Lance Taylor <iant@google.com>
6159
6160 * expression.cc (Expression::Expression_eval_info): Add
6161 result_alignment_pointer field.
6162 (Expression::eval_with_dot): Add result_alignment_pointer
6163 parameter. Change all callers.
6164 (Expression::eval_maybe_dot): Likewise.
6165 (class Binary_expression): Add alignment_pointer parameter to
6166 left_value and right_value. Change all callers.
6167 (BINARY_EXPRESSION): Set result alignment.
6168 (class Trinary_expression): Add alignment_pointer parameter to
6169 arg2_value and arg3_value. Change all callers.
6170 (Trinary_cond::value): Set result alignment.
6171 (Max_expression::value, Min_expression::value): Likewise.
6172 (Align_expression::value): Likewise.
6173 * script-sections.cc (class Sections_element): Add dot_alignment
6174 parameter to set_section_addresses virtual function. Update
6175 instantiations.
6176 (class Output_section_element): Likewise.
6177 (Script_sections::create_segments): Add dot_alignment parameter.
6178 Change all callers.
6179 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6180 (Script_sections::set_phdrs_clause_addresses): Likewise.
6181 * script-sections.h: Update declarations.
6182 * script.h: Update declarations.
6183 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6184 min_p_align.
6185 * testsuite/script_test_3.t: Set large alignment.
6186 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6187 segment has expected alignment.
6188
6189 2010-04-22 Nick Clifton <nickc@redhat.com>
6190
6191 * po/gold.pot: Updated by the Translation project.
6192 * po/vi.po: Updated Vietnamese translation.
6193
6194 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6195
6196 * testsuite/Makefile.am (check_PROGRAMS): Add
6197 icf_virtual_function_folding_test.
6198 * testsuite/Makefile.in: Regenerated.
6199
6200 2010-04-15 Andrew Haley <aph@redhat.com>
6201
6202 * options.h (merge_exidx_entries): New option.
6203 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6204 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6205 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6206 (Target_arm::merge_exidx_entries): New function.
6207 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6208 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6209 to Arm_exidx_fixup constructor.
6210 Add new arg, merge_exidx_entries.
6211 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6212 Arm_output_section::fix_exidx_coverage.
6213
6214 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6215
6216 * icf.cc (get_section_contents): Check for preemptible functions.
6217 Ignore addend when appropriate.
6218 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6219 section folded.
6220 (add_from_relobj): Check for section folded.
6221 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6222 * symtab.h (should_add_dynsym_entry): Add new parameter.
6223 * target-reloc.h (scan_relocs): Check for section folded.
6224 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6225 Check reloc types for function pointers in shared objects.
6226 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6227 case.
6228 (icf_preemptible_functions_test): New test case.
6229 (icf_string_merge_test): New test case.
6230 * testsuite.Makefile.in: Regenerate.
6231 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6232 bar_glob. Refactor code.
6233 * testsuite/icf_preemptible_functions_test.cc: New file.
6234 * testsuite/icf_preemptible_functions_test.sh: New file.
6235 * testsuite/icf_string_merge_test.cc: New file.
6236 * testsuite/icf_string_merge_test.sh: New file.
6237 * testsuite/icf_virtual_function_folding_test.cc: New file.
6238 * testsuite/icf_virtual_function_folding_test.sh: New file.
6239
6240 2010-04-14 Doug Kwan <dougkwan@google.com>
6241
6242 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6243 for local symbol recounting if we remove a section due to ICF.
6244 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6245 there are no regular objects in input.
6246
6247 2010-04-13 Doug Kwan <dougkwan@google.com>
6248
6249 * arm.cc (Arm_input_section::set_final_data_size): Compute
6250 accurate final data size instead of using current data size.
6251
6252 2010-04-09 Doug Kwan <dougkwan@google.com>
6253
6254 * layout.cc (Layout::choose_output_section): Handle script section
6255 types.
6256 (Layout::make_output_section_for_script): Add section type parameter.
6257 Handle script section types.
6258 * layout.h (Layout::make_output_section_for_script): Add section
6259 type parameter.
6260 * output.cc (Output_section::Output_section): Initialize data member
6261 is_noload_.
6262 (Output_section::do_reset_address_and_file_offset): Do not set address
6263 to 0 if section is a NOLOAD section.
6264 * output.h (Output_section::is_noload): New method.
6265 (Output_section::set_is_noload): Ditto.
6266 (Output_section::is_noload_): New data member.
6267 * script-c.h (Script_section_type): New enum type.
6268 (struct Parser_output_section_header): Add new file section_type.
6269 * script-sections.cc (Sections_element::output_section_name): Add
6270 parameter for returning script section type.
6271 (Output_section_definition::output_section_name): Ditto.
6272 (Output_section_definition::section_type)P; New method.
6273 (Output_section_definiton::script_section_type_name): Ditto.
6274 (Output_section_definition::script_section_type_): New data member.
6275 (Output_section_definition::Output_section_definition): Initialize
6276 data member Output_section_definition::script_section_type_.
6277 (Output_section_definition::create_sections): Pass script section type
6278 to Layout::make_output_section_for_script.
6279 (Output_section_definition::output_section_name): Return script
6280 section type to caller.
6281 (Output_section_definition::set_section_address): Do not advance
6282 dot value and load address if section type is NOLOAD. Set address
6283 of NOLOAD sections regardless of section flags.
6284 (Output_section_definition::print): Print section type if it is
6285 not SCRIPT_SECTION_TYPE_NONE.
6286 (Output_section_definition::section_type): New method.
6287 (Output_section_definition::script_section_type_name): Ditto.
6288 (Script_sections::output_section_name): Add new parameter
6289 PSECTION_TYPE for returning script section type. Pass it to
6290 section elements. Handle discard sections.
6291 (Sort_output_sections::operator()): Handle NOLOAD sections.
6292 * script-sections.h (Script_sections::Section_type): New enum type.
6293 (Script_sections::output_section_name): Add a new parameter for
6294 returning script section type.
6295 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6296 INFO and NOLOAD.
6297 * yyscript.y (union): Add new field SECTION_TYPE.
6298 (COPY, DSECT, INFO, NOLOAD): New tokens.
6299 (opt_address_and_section_type): Change type to output_section_header.
6300 (section_type): New non-terminal
6301 (section_header): Handle section type.
6302 (opt_address_and_section_type): Return section type value.
6303
6304 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6305
6306 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6307 * testsuite/plugin_common_test_2.c (foo): Likewise.
6308
6309 2010-04-08 Doug Kwan <dougkwan@google.com>
6310
6311 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6312 Output_merge_data.
6313 * output.cc (Output_section::add_merge_input_section): Simplify
6314 code and return status of Output_merge_base::add_input_section.
6315 Update merge section map only if Output_merge_base::add_input_section
6316 returns true.
6317
6318 2010-04-07 Doug Kwan <dougkwan@google.com>
6319
6320 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6321 if section is marked as containing instructions but has no mapping
6322 symbols.
6323 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6324 correct section index.
6325 (Arm_relobj::find_linked_text_section): Ditto.
6326
6327 2010-04-07 Cary Coutant <ccoutant@google.com>
6328
6329 * archive.cc (include_member): Destroy Read_symbols_data object before
6330 releasing file.
6331 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6332 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6333 (Read_symbols_data::~Read_symbols_data) New destructor.
6334 (Section_relocs::Section_relocs) New constructor.
6335 (Section_relocs::~Section_relocs) New destructor.
6336 (Read_relocs_data::Read_relocs_data) New constructor.
6337 (Read_relocs_data::~Read_relocs_data) New destructor.
6338 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6339 pointers to NULL after deleting.
6340
6341 2010-04-07 Doug Kwan <dougkwan@google.com>
6342
6343 * arm.cc: Replace "endianity" with "endianness" in comments.
6344 (Arm_exidx_cantunwind): Ditto.
6345 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6346 (Arm_relobj::merge_flags_and_attributes): New method.
6347 (Arm_relobj::merge_flags_and_attributes_): New data member.
6348 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6349 (Arm_relobj::scan_sections_for_stubs): Ditto.
6350 (Arm_relobj::do_read_symbols): Check to see if we really want to
6351 merge processor-specific flags and attributes. Exit early if
6352 an object is empty except for section names and the undefined symbol.
6353 (Target_arm::do_finalize_sections): Move check for ELF format to
6354 Arm_relobj::do_read_symbols. Merge processor specific flags and
6355 attributes from a regular object only when we have determined that
6356 it is aapropriate. Do not create an .ARM.attributes section in
6357 output if there is no regular input object.
6358 (Target_arm::merge_processor_specific_flags): Check
6359 --warn-mismatch before printing any error.
6360 (Target_arm::merge_object_attributes): Ditto.
6361 * gold.cc (queue_middle_tasks): Handle the case in which there is
6362 no regular object in input.
6363 * options.cc (General_options::parse_EB): New method.
6364 (General_options::parse_EL): Same.
6365 (General_options::General_options): Initialize endianness_.
6366 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6367 New options.
6368 (General_options::Endianness): New enum.
6369 (General_options::endianness): New method.
6370 (General_options::endianness_): New data member.
6371 * parameters.cc (Parameters::set_options): Check target endianness.
6372 (Parameters::set_target_once): Ditto.
6373 (Parameters::check_target_endianness): New method.
6374 (parameters_force_valid_target): If either -EL or -EB is specified,
6375 use it to define endianness of default target.
6376 * parameters.h (Parameters::check_target_endianness): New method
6377 declaration.
6378 * target.h (class Target): Change "endianity" to "endianness"
6379 in comments.
6380
6381 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6382
6383 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6384 * configure: Regenerate.
6385 * Makefile.in: Regenerate.
6386 * testsuite/Makefile.in: Regenerate.
6387
6388 2010-04-06 Cary Coutant <ccoutant@google.com>
6389
6390 gcc PR lto/42757
6391 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6392 prevailing definitions of common symbols.
6393 * testsuite/plugin_test_6.sh: New test case.
6394 * testsuite/plugin_common_test_1.c: New test case.
6395 * testsuite/plugin_common_test_2.c: New test case.
6396 * testsuite/Makefile.am (plugin_test_6): New test case.
6397 * testsuite/Makefile.in: Regenerate.
6398
6399 2010-04-06 Nick Clifton <nickc@redhat.com>
6400
6401 * po/vi.po: New Vietnamese translation.
6402
6403 2010-03-30 Doug Kwan <dougkwan@google.com>
6404
6405 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6406
6407 2010-03-25 Doug Kwan <dougkwan@google.com>
6408
6409 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6410 to avoid a conversion warning on a 32-bit host.
6411
6412 2010-03-24 Ian Lance Taylor <iant@google.com>
6413
6414 * testsuite/script_test_3.t: Add a TLS segment.
6415 * testsuite/Makefile.am (check_PROGRAMS): Add
6416 tls_phdrs_script_test.
6417 (tls_phdrs_script_test_SOURCES): Define.
6418 (tls_phdrs_script_test_DEPENDENCIES): Define.
6419 (tls_phdrs_script_test_LDFLAGS): Define.
6420 (tls_phdrs_script_test_LDADD): Define.
6421 * testsuite/Makefile.in: Rebuild.
6422
6423 2010-03-23 Cary Coutant <ccoutant@google.com>
6424
6425 * fileread.cc (find_or_make_view): Fix comment.
6426
6427 2010-03-23 Ian Lance Taylor <iant@google.com>
6428
6429 * script-sections.cc (class Orphan_section_placement): Define
6430 PLACE_TLS and PLACE_TLS_BSS.
6431 (Orphan_section_placement::Orphan_section_placement): Initialize
6432 new places.
6433 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6434 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6435 (tls_script_test_SOURCES): Define.
6436 (tls_script_test_DEPENDENCIES): Define.
6437 (tls_script_test_LDFLAGS): Define.
6438 (tls_script_test_LDADD): Define.
6439 * testsuite/Makefile.in: Rebuild.
6440
6441 2010-03-22 Doug Kwan <dougkwan@google.com>
6442
6443 * arm.cc (Arm_relocate_functions::abs8,
6444 Arm_relocate_functions::abs16): Use correct check for overflow
6445 specified in the ARM ELF specs.
6446 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6447 target of a BLX instruction specially.
6448 (Reloc_stub::stub_type_for_reloc): Ditto.
6449 (Relocate::relocate): Use symbolic names instead of numeric relocation
6450 codes to report error.
6451 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6452 workaround.
6453 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6454 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6455 thumb2_blx_out_of_range.stdout
6456 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6457 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6458 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6459 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6460 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6461 thumb2_blx_in_range, thumb2_blx_in_range.o,
6462 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6463 thumb2_blx_out_of_range.o): New rules.
6464 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6465 thumb2_blx_in_range and thumb2_blx_out_of_range.
6466 * testsuite/Makefile.in: Regenerate.
6467 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6468 * testsuite/thumb_blx_in_range.s: New file.
6469 * testsuite/thumb_blx_out_of_range.s: New file.
6470
6471 2010-03-22 Rafael Espindola <espindola@google.com>
6472
6473 * archive.cc (Should_include): Move to archive.h.
6474 (should_include_member): Make it a member of Archive.
6475 (Lib_group): New.
6476 (Add_lib_group_symbols): New.
6477 * archive.h: Include options.h.
6478 (Archive_member): Moved from Archive.
6479 (Should_include): Moved from archive.cc.
6480 (Lib_group): New.
6481 (Add_lib_group_symbols): New.
6482 * dynobj.cc (do_should_include_member): New.
6483 * dynobj.h (do_should_include_member): New.
6484 * gold.cc (queue_initial_tasks): Update call to queue.
6485 * main.cc (main): Print lib group stats.
6486 * object.cc (do_should_include_member): New.
6487 * object.h: Include archive.h.
6488 (Object::should_include_member): New.
6489 (Object::do_should_include_member): New.
6490 (Sized_relobj::do_should_include_member): New.
6491 * options.cc (General_options::parse_start_lib): New.
6492 (General_options::parse_end_lib): New.
6493 (Input_arguments::add_file): Handle lib groups.
6494 (Input_arguments::start_group): Check we are not in a lib.
6495 (Input_arguments::start_lib): New.
6496 (Input_arguments::end_lib): New.
6497 * options.h (General_options): Add start_lib and end_lib.
6498 (Input_argument::lib_): New.
6499 (Input_argument::lib): New.
6500 (Input_argument::is_lib): New.
6501 (Input_file_lib): New.
6502 (Input_arguments::in_lib_): New.
6503 (Input_arguments::in_lib): New.
6504 (Input_arguments::start_lib): New.
6505 (Input_arguments::end_lib_): New.
6506 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6507 in unused members as preempted.
6508 (Sized_pluginobj::do_should_include_member): New.
6509 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6510 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6511 return the blocker.
6512 (Read_symbols::do_whole_lib_group): New.
6513 (Read_symbols::do_lib_group): New.
6514 (Read_symbols::do_read_symbols): Handle lib groups.
6515 (Read_symbols::get_name): Handle lib groups.
6516 * readsyms.h (Read_symbols): Add an archive member pointer.
6517 (Read_symbols::do_whole_lib_group): New.
6518 (Read_symbols::do_lib_group): New.
6519 (Read_symbols::member_): New.
6520 * script.cc (read_input_script): Update call to queue_soon.
6521
6522 2010-03-19 Doug Kwan <dougkwan@google.com>
6523
6524 * arm.cc (Stub_table::Stub_table): Initialize new data members
6525 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6526 (Stub_table::add_reloc_stub): Assign stub offset and update
6527 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6528 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6529 New data members.
6530 (Stub_table::update_data_size_and_addralign): Use
6531 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6532 instead of going over all reloc stubs.
6533 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6534 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6535 Stringpool_template::offset_ to size of Stringpool_char.
6536 (Stringpool_template::new_key_offset): Remove code to initialize
6537 Stringpool_template::offset_.
6538 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6539 Stringpool_template::offset_ to zero.
6540
6541 2010-03-15 Doug Kwan <dougkwan@google.com>
6542
6543 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6544 offset_.
6545 (Stringpool_template::new_key_offset): New method.
6546 (Stringpool_template::add_string): Assign offsets when adding new
6547 strings.
6548 (Stringpool_template::set_string_offsets): Do not set string offsets
6549 when not optimizing.
6550 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6551 member size_.
6552 (Chunked_vector::clear): Clear size_.
6553 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6554 (Chunked_vector::size): Return size_.
6555 (Chunked_vector::push_back): Use size_ to find insert position.
6556 (Chunked_vector::size_): New data member.
6557 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6558 (Stringpool_template::new_key_offset): New method declaration.
6559 (Stringpool_template::offset_): New data member.
6560
6561 2010-03-15 Rafael Espindola <espindola@google.com>
6562
6563 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6564 Add_symbols' constructor.
6565 * readsyms.h (Add_symbols): Remove the input_group member.
6566
6567 2010-03-10 Ian Lance Taylor <iant@google.com>
6568
6569 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6570 target to ask whether a reference to a symbol requires a stack
6571 split.
6572 * target.h (Target::is_call_to_non_split): New function.
6573 (Target::do_is_call_to_non_split): Declare virtual function.
6574 * target.cc: Include "symtab.h".
6575 (Target::do_is_call_to_non_split): New function.
6576 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6577
6578 2010-03-10 Cary Coutant <ccoutant@google.com>
6579
6580 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6581 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6582 (File_read::open[2]): Add whole_file_view_ to list of views.
6583 (File_read::make_view): Remove test of whole_file_view_.
6584 (File_read::find_or_make_view): Create whole_file_view_ if
6585 necessary.
6586 (File_read::clear_views): Replace bool parameter with enum;
6587 adjust all callers. Don't delete views with permanent data;
6588 do delete cached views and views from archives if
6589 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6590 if clearing the corresponding view.
6591 * fileread.h (File_read::Clear_views_mode): New enum.
6592 (File_read::View::is_permanent_view): New method.
6593 (File_read::clear_views): Replace bool parameter
6594 with enum; adjust all callers.
6595 * options.h (General_options): Change keep_files_mapped option;
6596 add map_whole_files.
6597 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6598 releasing the file.
6599 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6600 the file.
6601
6602 2010-03-10 David S. Miller <davem@davemloft.net>
6603
6604 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6605
6606 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6607
6608 * icf.cc (get_section_contents): Add '@' marker after processing the
6609 merge reloc.
6610
6611 2010-03-08 Doug Kwan <dougkwan@google.com>
6612
6613 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6614 due to a conversion warning.
6615 (Arm_relobj::update_output_local_symbol_count): Check for local
6616 symbol with unset output index.
6617
6618 2010-03-05 Ian Lance Taylor <iant@google.com>
6619
6620 * options.h (class General_options): Add --spare-dynamic-tags.
6621 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6622 --spare-dynamic-tags.
6623
6624 2010-03-05 Ian Lance Taylor <iant@google.com>
6625
6626 * incremental.cc: Include "libiberty.h".
6627
6628 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6629
6630 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6631 function, is_info_ member.
6632 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6633 (Versions::Versions): Update caller.
6634 (Versions::define_base_version): Likewise.
6635 (Versions::add_def): Likewise.
6636
6637 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6638
6639 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6640 (Scan::possible_function_pointer_reloc): New function.
6641 (Scan::local_reloc_may_be_function_pointer): Change to call
6642 possible_function_pointer_reloc.
6643 (Scan::global_reloc_may_be_function_pointer): Ditto.
6644 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6645 relocations in ".data.rel.ro._ZTV" section.
6646 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6647 * testsuite/icf_safe_so_test.cc: Ditto.
6648 * testsuite/icf_safe_test.cc: Ditto.
6649 * testsuite/icf_safe_test.sh: Ditto.
6650
6651 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6652 Ian Lance Taylor <iant@google.com>
6653
6654 * target-reloc.h (relocate_section): Check the symbol table index
6655 for -1U before setting the local symbol index.
6656 (scan_relocatable_relocs): If copying the relocation, record that
6657 the local symbol is required.
6658 * object.h (Symbol_value::is_output_symtab_index_set): New
6659 function.
6660 (Symbol_value::may_be_discarded_from_output_symtab): New
6661 function.
6662 (Symbol_value::has_output_symtab_entry): New function.
6663 (Symbol_value::needs_output_symtab_entry): Remove.
6664 (Symbol_value::output_symtab_index): Make sure the symbol index is
6665 set.
6666 (Symbol_value::set_output_symtab_index): Make sure the symbol
6667 index is not set. Make sure the new index is valid.
6668 (Symbol_value::set_must_have_output_symtab_entry): New function.
6669 (Symbol_value::has_output_dynsym_entry): New function.
6670 (Symbol_value::set_output_dynsym_index): Make sure the new index
6671 is valid.
6672 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6673 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6674 local symbol if permitted.
6675 (Sized_relobj::do_finalize_local_symbols): Call
6676 is_output_symtab_index_set rather than needs_output_symtab_entry.
6677 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6678 rather than needs_output_symtab_entry. Call
6679 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6680 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6681 is_output_symtab_index_set rather than needs_output_symtab_entry.
6682 * testsuite/discard_locals_relocatable_test.c: New file.
6683 * testsuite/discard_locals_test.sh: Test -r.
6684 * testsuite/Makefile.am (check_DATA): Add
6685 discard_locals_relocatable_test1.syms,
6686 discard_local_relocatable_test2.syms.
6687 (MOSTLYCLEANFILES): Likewise. Also add
6688 discard_locals_relocatable_test1.lout and
6689 discard_locals_relocatable_test2.out.
6690 (discard_locals_relocatable_test1.syms): New target.
6691 (discard_locals_relocatable_test.o): New target.
6692 (discard_locals_relocatable_test1.out): New target.
6693 (discard_locals_relocatable_test2.syms): New target.
6694 (discard_locals_relocatable_test2.out): New target.
6695 (various): Add missing ../ld-new dependencies.
6696 * testsuite/Makefile.in: Rebuild.
6697
6698 2010-03-03 Nick Clifton <nickc@redhat.com>
6699
6700 * po/fi.po: New Finnish translation.
6701
6702 2010-03-01 Doug Kwan <dougkwan@google.com>
6703
6704 * layout.cc (Layout::Layout): Force section types of .init_array*,
6705 .preinit_array* and .fini_array* sections.
6706 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6707 Fix check of return value of std::string::find.().
6708 (Output_section::Input_section_sort_compare::operator()): Remove
6709 comment about .init_array.
6710 (Output_section::Input_section_sort_init_fini_compare::operator()):
6711 New method.
6712 (Output_section::sort_attached_input_sections): Handle .init_array
6713 and .fini_array specially.
6714 * output.h (Output_section::Inut_section_sort_compare): Update
6715 comment.
6716 (Output_section::Input_section_sort_init_fini_compare): New struct.
6717
6718 2010-02-26 Doug Kwan <dougkwan@google.com>
6719
6720 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6721 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6722 * testsuite/debug_msg.sh: Avoid matching source line number for
6723 use of global variable undef_int.
6724
6725 2010-02-26 Doug Kwan <dougkwan@google.com>
6726
6727 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6728 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6729 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6730 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6731 * options.cc (General_options::General_options): Initialize member
6732 fix_v4bx_.
6733 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6734 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6735 and rm_no_fix_v4bx.stdout
6736 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6737 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6738 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6739 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6740 and arm_no_fix_v4bx.
6741 * Makefile.in: Regenerate.
6742 * testsuite/arm_fix_v4bx.s: New file.
6743 * testsuite/arm_fix_v4bx.sh: Ditto.
6744
6745 2010-02-24 Doug Kwan <dougkwan@google.com>
6746
6747 * arm.cc (Target_arm::got_section): Make the .got section the first
6748 non RELRO section in the data segment.
6749 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6750 suffixes of section names.
6751
6752 2010-02-24 Doug Kwan <dougkwan@google.com>
6753
6754 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6755 flags and attributes merging if an input file is a binary file.
6756 * fileread.cc (Input_file::open): Record format of original file.
6757 * fileread.h (Input_file::Format): New enum type.
6758 (Input_file::Input_file): Initialize data member format_.
6759 (Input_file::format): New method definition.
6760 (Input_file::format_):: New data member.
6761
6762 2010-02-24 Doug Kwan <dougkwan@google.com>
6763
6764 * arm.cc (Arm_output_data_got): New class.
6765 (ARM_TCB_SIZE): New constant
6766 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6767 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6768 If user uses a script with a SECTIONS clause, issue only a warning
6769 for a misplaced EXIDX input section. Otherwise, issue an error.
6770 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6771 garbage collection.
6772 (Target_arm::got_mode_index_entry): Handle static linking.
6773 (Target_arm::Scan::local): Ditto.
6774 (Target_arm::Scan::global): Ditto.
6775 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6776 all incorrectly implemented relocations.
6777 (Target_arm::fix_exidx_coverage): Pass layout to
6778 Arm_output_section::fix_exidx_coverage.
6779 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6780 from ".ARM.exidx." and ".ARM.extab.".
6781
6782 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6783
6784 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6785 section if it does not already exist.
6786 * attributes.cc (Attributes_section_data::Attributes_section_data):
6787 Don't crash if size is zero.
6788
6789 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6790 Ian Lance Taylor <iant@google.com>
6791
6792 * gold.cc (queue_middle_tasks): If no input files were opened,
6793 exit.
6794 * workqueue.h (Task_function::Task_function): Assert that there is
6795 a blocker.
6796
6797 2010-02-22 Doug Kwan <dougkwan@google.com>
6798
6799 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6800 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6801 types to avoid warnings due to different uint64_t implementations
6802 on different hosts.
6803
6804 2010-02-21 Doug Kwan <dougkwan@google.com>
6805
6806 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6807 handling of the maximum backward branch offset.
6808 (Arm_relocate_functions::thumb_branch_common): Ditto.
6809 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6810 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6811 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6812 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6813 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6814 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6815 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6816 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6817 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6818 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6819 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6820 thumb2_bl_out_of_range.o): New rules.
6821 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6822 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6823 thumb2_bl_out_of_range
6824 * testsuite/Makefile.in: Regenerate.
6825 * testsuite/arm_bl_in_range.s: New file.
6826 * testsuite/arm_bl_out_of_range.s: Ditto.
6827 * testsuite/arm_branch_in_range.sh: Ditto.
6828 * testsuite/arm_branch_range.t: Ditto.
6829 * testsuite/thumb2_branch_range.t: Ditto.
6830 * testsuite/thumb_bl_in_range.s: Ditto.
6831 * testsuite/thumb_bl_out_of_range.s: Ditto.
6832 * testsuite/thumb_branch_range.t: Ditto.
6833
6834 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6835
6836 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6837 Add reloc offset information.
6838 * icf.cc (get_section_contents): Change iterators to point to the new
6839 vectors. Add reloc offset information to the contents.
6840 * icf.h (Icf::Sections_reachable_info): New typedef.
6841 (Icf::Sections_reachable_list): New typedef.
6842 (Icf::Offset_info): New typedef.
6843 (Icf::Reloc_info): New struct typedef.
6844 (Icf::Reloc_info_list): New typedef.
6845 (Icf::symbol_reloc_list): Delete method.
6846 (Icf::addend_reloc_list): Delete method.
6847 (Icf::section_reloc_list): Delete method.
6848 (Icf::reloc_info_list): New method.
6849 (Icf::reloc_info_list_): New member.
6850
6851 2010-02-19 Doug Kwan <dougkwan@google.com>
6852
6853 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6854 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6855 * arm.cc (Arm_relocation_functions): New forward declaration.
6856 (Target_arm::Target_arm): Initialize new data members
6857 got_mod_index_offset_ and tls_base_symbol_defined_.
6858 (Target_arm::Relocate::relocate_tls): New method.
6859 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6860 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6861 New methods.
6862 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6863 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6864 (Target_arm::got_mod_index_offset_,
6865 Target_arm::tls_base_symbol_defined_): New data members.
6866 (Target_arm::Scan::local, Target::Scan::global,
6867 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6868 relocations.
6869
6870 2010-02-18 Doug Kwan <dougkwan@google.com>
6871
6872 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6873 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6874 text section as a parameter becuase some broken tools may not set
6875 the link in section header.
6876 (Target_arm::has_got_section): New method.
6877 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6878 without any mapping symbol as data only. Remove warning.
6879 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6880 link in its section header, try to discover the link by inspecting the
6881 REL31 relocation at the beginning of the section.
6882 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6883 in error message.
6884 (Target_arm::Scan::global): Treat any reference to the symbol
6885 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6886
6887 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6888
6889 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6890 (Scan::global_reloc_may_be_function_pointer): New function.
6891 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6892 (Scan::global_reloc_may_be_function_pointer): New function.
6893 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6894 (Scan::global_reloc_may_be_function_pointer): New function.
6895 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6896 (Scan::global_reloc_may_be_function_pointer): New function.
6897 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6898 (Scan::global_reloc_may_be_function_pointer): New function.
6899 (Scan::possible_function_pointer_reloc): New function.
6900 (Target_x86_64::can_check_for_function_pointers): New function.
6901 * gc.h (gc_process_relocs): Scan relocation types to determine if
6902 function pointers were taken for targets that support it.
6903 * icf.cc (Icf::find_identical_sections): Include functions for
6904 folding in safe ICF whose pointer is not taken.
6905 * icf.h (Secn_fptr_taken_set): New typedef.
6906 (fptr_section_id_): New member.
6907 (section_has_function_pointers): New function.
6908 (set_section_has_function_pointers): New function.
6909 (check_section_for_function_pointers): New function.
6910 * options.h: Fix comment for safe ICF option.
6911 * target.h (can_check_for_function_pointers): New function.
6912 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6913 Modify icf_safe_test for X86-64.
6914 * testsuite/Makefile.in: Regenerate.
6915 * testsuite/icf_safe_so_test.cc: New file.
6916 * testsuite/icf_safe_so_test.sh: New file.
6917 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6918 (main): Change to take pointer to function kept_func_3.
6919 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6920 folding is done correctly for X86-64.
6921
6922 2010-02-12 David S. Miller <davem@davemloft.net>
6923
6924 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6925 is_symbolless parameter.
6926 (Output_reloc<SHT_REL>::is_symbolless): New.
6927 (Output_reloc<SHT_REL>::is_symbolless_): New.
6928 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6929 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6930 (Output_reloc<SHT_RELA>::is_symbolless): New.
6931 (Output_data_reloc::add_global): Handle is_symbolless.
6932 (Output_data_reloc::add_global_relative): Likewise.
6933 (Output_data_reloc::add_local): Likewise.
6934 (Output_data_reloc::add_local_relative): Likewise.
6935 (Output_data_reloc::add_symbolless_global_addend): New.
6936 (Output_data_reloc::add_symbolless_local_addend): New.
6937 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6938 is_symbolless.
6939 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6940 instead of ->is_relative_
6941 (Output_reloc::write): Likewise.
6942 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6943 (Output_reloc::write_rel): Simplify.
6944
6945 * sparc.cc (Target_sparc::Scan::local): Use
6946 ->add_symbolless_local_addend as needed.
6947 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6948 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6949 based upon relocation offset.
6950
6951 2010-02-11 Doug Kwan <dougkwan@google.com>
6952
6953 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6954 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6955 beginning of function.
6956 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6957 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6958 parameter is_32bit in calls to should_apply_static_reloc.
6959 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6960 (check_DATA): Add arm_abs_global.stdout.
6961 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6962 arm_abs_global.stdout): New rules.
6963 (MOSTLLYCLEANFILES): Add arm_abs_global
6964 * Makefile.in: Regenerate.
6965 * testsuite/arm_abs_global.s: New file.
6966 * testsuite/arm_abs_global.sh: Ditto.
6967 * testsuite/arm_abs_lib.s: Ditto.
6968
6969 2010-02-11 Ian Lance Taylor <iant@google.com>
6970
6971 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6972 Read_relocs task.
6973 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6974 Allocate_commons_task first.
6975 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6976 task, rather than symtab_lock_.
6977 (Gc_process_relocs::~Gc_process_relocs): New function.
6978 (Gc_process_relocs::is_runnable): Check this_blocker_.
6979 (Gc_process_relocs::locks): Use next_blocker_ rather than
6980 blocker_.
6981 (Scan_relocs::~Scan_relocs): New function.
6982 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6983 symtab_lock_.
6984 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6985 next_blocker_.
6986 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6987 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6988 constructor accordingly.
6989 (class Gc_process_relocs): Likewise.
6990 (class Scan_relocs): Likewise.
6991 * common.h (class Allocate_commons_task): Remove symtab_lock_
6992 field, and corresponding constructor parameter.
6993 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6994 symtab_lock_.
6995 (Allocate_commons_task::locks): Likewise.
6996
6997 2010-02-11 Ian Lance Taylor <iant@google.com>
6998
6999 * gold-threads.h (class Once): Define.
7000 (class Initialize_lock): Rewrite as child of Once.
7001 * gold-threads.cc (class Once_initialize): Define.
7002 (once_pointer_control): New static variable.
7003 (once_pointer, once_arg): New static variables.
7004 (c_run_once): New static function.
7005 (Once::Once, Once::run_once, Once::internal_run): New functions.
7006 (class Initialize_lock_once): Remove.
7007 (initialize_lock_control): Remove.
7008 (initialize_lock_pointer): Remove.
7009 (initialize_lock_once): Remove.
7010 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7011 (Initialize_lock::initialize): Rewrite.
7012 (Initialize_lock::do_run_once): New function.
7013 * archive.cc (Archive::interpret_header): Only clear name if it is
7014 not already empty.
7015 * fileread.cc: Include "gold-threads.h"
7016 (file_counts_lock): New static variable.
7017 (file_counts_initialize_lock): Likewise.
7018 (File_read::release): Only increment counts when using --stats.
7019 Use a lock around the increment.
7020 * parameters.cc (class Set_parameters_target_once): Define.
7021 (set_parameters_target_once): New static variable.
7022 (Parameters::Parameters): Move here from parameters.h.
7023 (Parameters::set_target): Rewrite.
7024 (Parameters::set_target_once): New function.
7025 (Parameters::clear_target): Move here and rewrite.
7026 * parameters.h (class Parameters): Update declarations. Add
7027 set_parameters_target_once_ field.
7028 (Parameters::Parameters): Move to parameters.cc.
7029 (Parameters::clear_target): Likewise.
7030 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7031 task.
7032 (Start_group::~Start_group): New function.
7033 (Start_group::is_runnable): New function.
7034 (Start_group::locks, Start_group::run): New functions.
7035 (Finish_group::run): Change saw_undefined to size_t.
7036 * readsyms.h (class Start_group): Define.
7037 (class Finish_group): Change saw_undefined_ field to size_t.
7038 (Finish_group::Finish_group): Remove saw_undefined and
7039 this_blocker parameters. Change all callers.
7040 (Finish_group::set_saw_undefined): New function.
7041 (Finish_group::set_blocker): New function.
7042 * symtab.h (class Symbol_table): Change saw_undefined to return
7043 size_t. Change saw_undefined_ field to size_t.
7044 * target-select.cc (Set_target_once::do_run_once): New function.
7045 (Target_selector::Target_selector): Initialize set_target_once_
7046 field. Don't initialize lock_ and initialize_lock_ fields.
7047 (Target_selector::instantiate_target): Rewrite.
7048 (Target_selector::set_target): New function.
7049 * target-select.h (class Set_target_once): Define.
7050 (class Target_selector): Update declarations. Make
7051 Set_target_once a friend. Remove lock_ and initialize_lock_
7052 fields. Add set_target_once_ field.
7053
7054 2010-02-10 Ian Lance Taylor <iant@google.com>
7055
7056 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7057 queueing any tasks.
7058 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7059 (queue_middle_tasks): Add all blockers before queueing any tasks.
7060 (queue_final_tasks): Likewise.
7061 * token.h (Task_token::add_blockers): New function.
7062 * object.h (Input_objects::number_of_relobjs): New function.
7063
7064 2010-02-10 Ian Lance Taylor <iant@google.com>
7065
7066 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7067 shared, not if not position independent.
7068 * x86_64.cc (Relocate::relocate_tls): Likewise.
7069 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7070 (tls_pie_pic_test): New target.
7071 * testsuite/Makefile.in: Rebuild.
7072
7073 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7074 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7075 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7076 * testsuite/Makefile.in: Rebuild.
7077
7078 2010-02-09 David S. Miller <davem@davemloft.net>
7079
7080 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7081 R_SPARC_RELATIVE using ->add_local_relative().
7082 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7083
7084 * output.h (Output_data_dynamic::add_section_size): New method
7085 that takes two Output_data objects.
7086 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7087 entry param. Handle it in initializers.
7088 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7089 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7090 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7091 arg.
7092 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7093 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7094 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7095 for dynrel_includes_plt.
7096 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7097 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7098 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7099 before .rela.plt
7100 (Target_sparc::do_finalize_sections): Update to pass true for
7101 dynrel_includes_plt.
7102 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7103 output before .rela.plt
7104 (Target_powerpc::do_finalize_sections): Update to pass true for
7105 dynrel_includes_plt when 32-bit.
7106
7107 2010-02-08 Doug Kwan <dougkwan@google.com>
7108
7109 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7110 method.
7111 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7112 Arm_relobj::scan_section_for_cortex_a8_stubs,
7113 Arm_relobj::do_relocation_section): Instead of calling
7114 Output_section::output_address, use faster
7115 Arm_relobj::simple_input_section_output_address.
7116
7117 2010-02-08 David S. Miller <davem@davemloft.net>
7118
7119 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7120 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7121 relocation helper function.
7122
7123 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7124 just like R_SPARC_GOT{10,13,22}.
7125 (Target_sparc::Scan::local): Likewise.
7126 (Target_sparc::Relocate:relocate): Likewise.
7127
7128 2010-02-06 Ian Lance Taylor <iant@google.com>
7129
7130 * configure.ac: Rewrite targetobjs duplicate removal code to use
7131 only shell constructs.
7132 * configure: Rebuild.
7133
7134 2010-02-05 Doug Kwan <dougkwan@google.com>
7135
7136 PR 11247
7137 * arm.cc (Arm_relobj::section_is_scannable): New method.
7138 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7139 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7140
7141 2010-02-04 Doug Kwan <dougkwan@google.com>
7142
7143 PR 11247
7144 * arm-reloc-property.cc (cstdio): Include.
7145 * configure.ac (targetobjs): Remove duplicates.
7146 * configure: Regenerate.
7147 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7148 big and little endian version for a given address size.
7149
7150 2010-02-03 Doug Kwan <dougkwan@google.com>
7151
7152 * arm-reloc-property.cc
7153 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7154 definition.
7155 * arm-reloc-property.h
7156 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7157 New method definition.
7158 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7159 declaration.
7160 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7161 overflow to N.
7162 (GOT_PREL): Change implemented to Y.
7163 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7164 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7165 (Arm_relocate_functions::movw_abs_nc): Remove method.
7166 (Arm_relocate_functions::movt_abs): Ditto.
7167 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7168 (Arm_relocate_functions::thm_movt_abs): Ditto.
7169 (Arm_relocate_functions::movw_rel_nc): Ditto.
7170 (Arm_relocate_functions::movw_rel): Ditto.
7171 (Arm_relocate_functions::movt_rel): Ditto.
7172 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7173 (Arm_relocate_functions:thm_movw_rel): Ditto.
7174 (Arm_relocate_functions:thm_movt_rel): Ditto.
7175 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7176 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7177 New method definitions.
7178 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7179 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7180 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7181 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7182 (Target_arm::Relocate::relocate): Check for non-static or
7183 unimplemented relocation code and exit early. Change calls to
7184 Target_arm::reloc_uses_thumb_bit and
7185 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7186 instead. Refactor code to handle similar relocations to increase
7187 code sharing. Remove check for unsupported relocation code in switch
7188 statement.
7189 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7190 relocation property table to find out size. Change error message to
7191 print out the name of a relocation code instead of the numeric value.
7192 (Target_arm::scan_reloc_for_stub): Use relocation property table
7193 instead of calling Target_arm::reloc_uses_thumb_bit().
7194
7195 2010-02-02 Doug Kwan <dougkwan@google.com>
7196
7197 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7198 types of relaxed input section.
7199
7200 2010-02-02 Doug Kwan <dougkwan@google.com>
7201
7202 * Makefile.am (HFILES): Add arm-reloc-property.h.
7203 (DEFFILES): New.
7204 (TARGETSOURCES): Add arm-reloc-property.cc
7205 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7206 (libgold_a_SOURCES): $(DEFFILES)
7207 * Makefile.in: Regenerate.
7208 * arm-reloc-property.cc: New file.
7209 * arm-reloc-property.h: New file.
7210 * arm-reloc.def: New file.
7211 * arm.cc: Update comments.
7212 (arm-reloc-property.h): New included header.
7213 (arm_reloc_property_table): New global variable.
7214 (Target_arm::do_select_as_default_target): New method definition.
7215 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7216 arm-reloc-property to targ_extra_obj.
7217 * parameters.cc (set_parameters_target): Call
7218 Target::select_as_default_target().
7219 * target.h (Target::select_as_default_target): New method definition.
7220 (Target::do_select_as_default_target): Same.
7221
7222 2010-02-01 Doug Kwan <dougkwan@google.com>
7223
7224 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7225 first_output_text_section_.
7226 (Arm_exidx_fixup::first_output_text_section): New method definition.
7227 (Arm_exidx_fixup::first_output_text_section_): New data member.
7228 (Arm_exidx_fixup::process_exidx_section): Record the first text
7229 output section seen.
7230 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7231 and entsize in output section header.
7232
7233 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7234
7235 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7236 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7237 (Arm_relocate_functions::thm_alu11): New Method.
7238 (Arm_relocate_functions::thm_pc8): New Method.
7239 (Arm_relocate_functions::thm_pc12): New Method.
7240 (Target_arm::Scan::local): Handle the relocations.
7241 (Target_arm::Scan::global): Likewise.
7242 (Target_arm::Relocate::relocate): Likewise.
7243 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7244
7245 2010-01-29 Doug Kwan <dougkwan@google.com>
7246
7247 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7248 of relocation types as ld.
7249
7250 2010-01-29 Doug Kwan <dougkwan@google.com>
7251
7252 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7253 to public.
7254 (Arm_relocate_functions::thumb_branch_common): Ditto.
7255 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7256 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7257 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7258 Arm_relocate_functions::jump24): Remove.
7259 (Target_arm::Relocate::relocate): Adjust code to call
7260 Arm_relocation_functions::arm_branch_common and
7261 Arm_relocation_functions::thumb_branch_common instead of their removed
7262 wrappers. Merge switch-cases together to reduce source code size.
7263
7264 2010-01-29 Doug Kwan <dougkwan@google.com>
7265
7266 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7267 output_local_symbol_count_needs_update_.
7268 (Arm_relobj::output_local_symbol_count_needs_update,
7269 Arm_relobj::set_output_local_symbol_count_needs_update,
7270 Arm_relobj::update_output_local_symbol_count): New methods.
7271 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7272 member.
7273 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7274 of pointed function as in a R_ARM_PREL31 relocation.
7275 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7276 for output local symbol count updating.
7277 (Target_arm::do_relax): Update output local symbol counts in objects
7278 if necessary.
7279 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7280
7281 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7282
7283 * arm.cc: Added support for the ARM relocations:
7284 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7285 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7286 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7287 movw_prel_nc).
7288 (Arm_relocate_functions::movw_rel): New method.
7289 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7290 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7291 thm_movw_prel_nc).
7292 (Arm_relocate_functions::thm_movw_rel): New method.
7293 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7294 thm_movt_prel).
7295 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7296 relocations.
7297 (Target_arm::Scan::global): Likewise.
7298 (Target_arm::Relocate::relocate): Likewise.
7299 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7300 Likewise.
7301
7302 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7303
7304 * arm.cc: Added support for ARM group relocations.
7305 (Target_arm::reloc_needs_sym_origin): New method.
7306 (Arm_relocate_functions::calc_grp_kn): New method.
7307 (Arm_relocate_functions::calc_grp_residual): New method.
7308 (Arm_relocate_functions::calc_grp_gn): New method.
7309 (Arm_relocate_functions::arm_grp_alu): New Method.
7310 (Arm_relocate_functions::arm_grp_ldr): New Method.
7311 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7312 (Arm_relocate_functions::arm_grp_ldc): New Method.
7313 (Target_arm::Scan::local): Handle the ARM group relocations.
7314 (Target_arm::Scan::global): Likewise.
7315 (Target_arm::Relocate::relocate): Likewise.
7316 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7317 Likewise.
7318
7319 2010-01-26 Doug Kwan <dougkwan@google.com>
7320
7321 * arm.cc (set): Include.
7322 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7323 pointer type.
7324 (Arm_output_section::Text_section_list): New type.
7325 (Arm_output_section::append_text_sections_to_list): New method.
7326 (Arm_output_section::fix_exidx_coverage): Ditto.
7327 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7328 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7329 Relobj::set_section_offset() instead of
7330 Sized_relobj::invalidate_section_offset().
7331 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7332 parameter for section headers. Ignore relocation sections for
7333 unallocated sections and EXIDX sections.
7334 (Target_arm::fix_exidx_coverage): New method.
7335 (Target_arm::output_section_address_less_than): New type.
7336 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7337 linked text section instead of the EXIDX section.
7338 (Arm_output_section::create_stub_group): Add an assertion to check
7339 that this is not an EXIDX output section.
7340 (Arm_output_section::append_text_sections_to_list): New method.
7341 (Arm_output_section::fix_exidx_coverage): Ditto.
7342 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7343 Arm_relobj::section_needs_reloc_stub_scanning.
7344 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7345 first pass.
7346 (Target_arm::fix_exidx_coverage): New method.
7347 * object.h (Relobj::set_output_section): New method.
7348 (Sized_relobj::invalidate_section_offset): Remove method.
7349 (Sized_relobj::do_invalidate_section_offset): Remove method.
7350 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7351
7352 2010-01-25 Doug Kwan <dougkwan@google.com>
7353
7354 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7355 Fix warning due to signed and unsigned comparison on a 32-bit host.
7356
7357 2010-01-22 Doug Kwan <dougkwan@google.com>
7358
7359 * arm.cc (Target_arm::do_relax): Record an output section for section
7360 offset adjustment it contains any stub table that has changed.
7361 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7362 offsets in an output section if necessary.
7363 * output.cc (Output_section::Output_section): Initialize
7364 section_offsets_need_adjustments_.
7365 (Output_section::add_input_section_for_script): Renamed to
7366 Output_section::add_simple_input_section.
7367 (Output_section::save_states): Add a comment.
7368 (Output_section::discard_states): New method defintion.
7369 (Output_section::adjust_section_offsets): Same.
7370 * output.h (Output_section::add_input_section_for_script): Renamed to
7371 Output_section::add_simple_input_section.
7372 (Output_section::discard_states): New method declaration.
7373 (Output_section::adjust_section_offsets): Same.
7374 (Output_section::section_offsets_need_adjustment,
7375 Output_section::set_section_offsets_need_adjustment): New method
7376 definitions.
7377 (Output_section::section_offsets_need_adjustment_): New data member.
7378 * script-sections.cc
7379 (Output_section_element_input::set_section_address): Adjust code for
7380 renaming of Output_section::add_input_section_for_script.
7381 (Orphan_output_section::set_section_address): Same.
7382
7383 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7384
7385 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7386 Fix_v4bx enum values .
7387 * gold/options.h (General_options): New option definitions.
7388 (General_options::fix_v4bx): New method.
7389 (General_options::Fix_v4bx): New enum.
7390 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7391 (General_options::parse_fix_v4bx_interworking): New method.
7392
7393 2010-01-22 Doug Kwan <dougkwan@google.com>
7394
7395 * arm.cc (Arm_exidx_fixup): New class.
7396
7397 2010-01-21 Doug Kwan <dougkwan@google.com>
7398
7399 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7400 classes.
7401 (Arm_exidx_section_offset_map): New type.
7402
7403 2010-01-21 Doug Kwan <dougkwan@google.com>
7404
7405 * arm.cc (Arm_exidx_input_section): New class.
7406 (Arm_relobj::exidx_input_section_by_link,
7407 Arm_relobj::exidx_input_section_by_shndx,
7408 Arm_relobj::make_exidx_input_section): New methods.
7409 (read_arm_attributes_section): Remove.
7410 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7411 information about them.
7412 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7413 to here.
7414
7415 2010-01-20 Doug Kwan <dougkwan@google.com>
7416
7417 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7418 Input_section_specifier to Section_id.
7419 (Target_arm::new_arm_input_section: Adjust code for change of key
7420 type.
7421 (Target_arm::find_arm_input_section): Ditto.
7422 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7423 (Section_id): Remove.
7424 (Garbage_collection::Section_id_hash): Remove.
7425 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7426 (Section_id): Remove.
7427 (Icf::Section_id_hash): Remove.
7428 * object.h (Section_id, Const_section_id, Section_id_hash,
7429 Const_section_id_hash): New type definitions.
7430 * output.cc (Output_section::add_relaxed_input_section): Change to
7431 use Const_section_id instead of Input_section_specifier as key type.
7432 (Output_section::add_merge_input_section): Ditto.
7433 (Output_section::build_relaxation_map): Change to use Section_id
7434 instead of Input_section_specifier as key type.
7435 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7436 Ditto.
7437 (Output_section::convert_input_sections_to_relaxed_sections): Change
7438 to use Const_section_id instead of Input_section_specifier as key type.
7439 (Output_section::find_merge_section): Ditto.
7440 (Output_section::find_relaxed_input_section): Ditto.
7441 * output.h (Input_section_specifier): Remove class.
7442 (Output_section::Output_section_data_by_input_section_map): Change
7443 key type to Const_section_id.
7444 (Output_section::Output_relaxed_input_section_by_input_section_map):
7445 Ditto.
7446 (Output_section::Relaxation_map): Change key type to Section_id.
7447
7448 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7449
7450 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7451 (class Arm_v4bx_stub): New class.
7452 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7453 (Stub_factory::make_arm_v4bx_stub): New method.
7454 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7455 (Stub_table::empty): Handle v4bx stubs.
7456 (Stub_table::add_arm_v4bx_stub): New method.
7457 (Stub_table::find_arm_v4bx_stub): New method.
7458 (Arm_relocate_functions::v4bx): New method.
7459 (Target_arm::fix_v4bx): New method.
7460 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7461 (Stub_table::relocate_stubs): Likewise.
7462 (Stub_table::do_write): Likewise.
7463 (Stub_table::update_data_size_and_addralign): Likewise.
7464 (Stub_table::finalize_stubs): Likewise.
7465 (Target_arm::Scan::local): Likewise.
7466 (Target_arm::Scan::global): Likewise.
7467 (Target_arm::do_finalize_sections): Likewise.
7468 (Target_arm::Relocate::relocate): Likewise.
7469 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7470 Likewise.
7471 (Target_arm::scan_reloc_for_stub): Likewise.
7472 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7473
7474 2010-01-19 Ian Lance Taylor <iant@google.com>
7475
7476 * output.cc (Output_section_headers::do_sized_write): Write large
7477 segment count to sh_info field.
7478 (Output_file_header::do_sized_write): For large segment count,
7479 write PN_XNUM to e_phnum field.
7480
7481 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7482
7483 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7484 (Arm_relocate_functions::thm_jump8): New function.
7485 (Arm_relocate_functions::thm_jump11): New function.
7486 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7487 R_ARM_THM_JUMP11.
7488 (Target_arm::Scan::global): Likewise.
7489 (Target_arm::Relocate::relocate): Likewise.
7490 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7491 Likewise.
7492
7493 2010-01-14 Doug Kwan <dougkwan@google.com>
7494
7495 * arm.cc (map, utility): Include headers.
7496 (Target_arm::apply_cortex_a8_workaround): New method.
7497 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7498 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7499 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7500 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7501 the --[no-]fix-cortex-a8 command line options.
7502 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7503 (Target_arm::relocate_stub): Use addend in instruction template.
7504 * options.h (DEFINE_bool): Set the user-set flag.
7505 (General_options): Add --[no-]-fix-cortex options.
7506 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7507 : Update fast look-up map after conversion.
7508
7509 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7510
7511 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7512 in the first pass of do_layout.
7513
7514 2010-01-13 Doug Kwan <dougkwan@google.com>
7515
7516 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7517 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7518 apparent compiler problem of not folding static constant integral
7519 data members of elfcpp::Elf_sizes<32>.
7520
7521 2010-01-13 Doug Kwan <dougkwan@google.com>
7522
7523 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7524 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7525 Arm_relobj::scan_section_for_cortex_a8_erratum,
7526 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7527 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7528 sections to scan for relocation stubs into a new method
7529 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7530 relocation and Cortex-A8 stub scanning.
7531 (Target_arm::do_relax): Force stubs to be after stubbed sections
7532 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7533 the beginning of a new relaxation pass. Update a comment.
7534 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7535
7536 2010-01-12 Ian Lance Taylor <iant@google.com>
7537
7538 * target-reloc.h (visibility_error): New inline function.
7539 (relocate_section): Call visibility_error.
7540 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7541 (MOSTLYCLEANFILES): Likewise.
7542 (protected_4_pic.o, protected_3.err): New targets.
7543 * testsuite/protected_4.cc: New file.
7544
7545 2010-01-12 Doug Kwan <dougkwan@google.com>
7546
7547 * arm.cc (Cortex_a8_reloc): New class.
7548 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7549 and cortex_a8_relocs_info_.
7550 (Target_arm::fix_cortex_a8): New method definition.
7551 (Target_arm::Cortex_a8_relocs_info): New type.
7552 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7553 New data member declarations.
7554 (Target_arm::scan_reloc_for_stub): Record information about
7555 relocations for THUMB branches that might be exempted from the
7556 Cortex-A8 workaround.
7557 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7558 at the beginning of a relaxation pass.
7559
7560 2010-01-12 Doug Kwan <dougkwan@google.com>
7561
7562 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7563 (Arm_relobj::Mapping_symbol_position,
7564 Arm_reloj::Mapping_symbol_position_less,
7565 Arm_relobj::Mapping_symbols_info): New types.
7566 (Target_arm::is_mapping_symbol_name): New method definition.
7567 (Arm_relobj::do_count_local_symbols): Save information about mapping
7568 symbols.
7569
7570 2010-01-11 Doug Kwan <dougkwan@google.com>
7571
7572 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7573 Arm_relocate_functions::thumb32_branch_upper,
7574 Arm_relocate_functions::thumb32_branch_lower,
7575 Arm_relocate_functions::thumb32_cond_branch_offset,
7576 Arm_relocate_functions::thumb32_cond_branch_upper,
7577 Arm_relocate_functions::thumb32_cond_branch_lower,
7578 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7579 branch offset encoding.
7580 (Arm_relocate_functions::thumb_branch_common): Use new branch
7581 offset encoding methods to avoid code duplication.
7582 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7583 (Stub_addend_reader::operator()): Use new branch encoding method
7584 to avoid code duplication.
7585
7586 2010-01-11 Doug Kwan <dougkwan@google.com>
7587
7588 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7589 (Target_arm::do_finalize_sections): Define special EXIDX section
7590 symbols only if referenced.
7591 * gc.h (Garbage_collection::add_reference): New method.
7592 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7593 code duplication.
7594
7595 2010-01-11 Ian Lance Taylor <iant@google.com>
7596
7597 * script.cc (Version_script_info::build_expression_list_lookup):
7598 Change complaing about duplicate wildcard match from error to
7599 warning.
7600
7601 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7602 of 2009-12-30.
7603 (Version_script_info::Version_script_info): Initialize globs_,
7604 default_version_, default_is_global_, and exact_. Don't
7605 initialize globals_ or locals_.
7606 (Version_script_info::build_lookup_tables): Build local symbols
7607 first.
7608 (Version_script_info::unquote): New function.
7609 (Version_script_info::add_exact_match): New function.
7610 (Version_script_info::build_expression_list_lookup): Remove lookup
7611 parameter. Add is_global parameter. Change all callers. Handle
7612 wildcard pattern specially. Unquote pattern. Call
7613 add_exact_match.
7614 (Version_script_info::get_name_to_match): New function.
7615 (Version_script_info::get_symbol_version): New function.
7616 (Version_script_info::get_symbol_version_helper): Remove.
7617 (Version_script_info::check_unmatched_names): Call unquote.
7618 * script.h (class Version_script_info): Change get_symbol_version
7619 to be non-inline and add is_global parameter; change all callers.
7620 Rewrite symbol_is_local. Update declarations. Define struct
7621 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7622 Remove globals_ and locals_ members. Add exact_, globs_,
7623 default_version_, is_global_.
7624 (Version_script_info::Glob): Remove pattern, add expression and
7625 is_global. Update constructor. Change all callers.
7626 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7627 default version.
7628 (Versions::symbol_section_contents): If a symbol is undefined, or
7629 defined in a dynamic object, set the version index to
7630 VER_NDX_LOCAL.
7631 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7632 symbol_is_local.
7633 (Symbol_table::add_from_pluginobj): Likewise.
7634 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7635
7636 2010-01-11 Doug Kwan <dougkwan@google.com>
7637
7638 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7639 (incremental_dump_LDADD): Add linking option for libintl.
7640 * Makefile.in: Regenerate.
7641
7642 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7643
7644 PR gold/11144
7645 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7646 instead of -Ds.
7647 * testsuite/Makefile.in: Regenerated.
7648
7649 2010-01-10 Doug Kwan <dougkwan@google.com>
7650
7651 * options.h (DEFINE_var): Use parentheses around argument varname__
7652 in macro body to avoid any unintended subsequent substitutions.
7653
7654 2010-01-10 Ian Lance Taylor <iant@google.com>
7655
7656 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7657 candidates before doing symbol resolution.
7658
7659 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7660 ODR candidates if only one is weak.
7661
7662 2010-01-08 Ian Lance Taylor <iant@google.com>
7663
7664 * script.cc (Version_script_info::build_expression_list_lookup):
7665 Don't warn about ambiguous version, just record the ambiguity.
7666 (Version_script_info::get_symbol_version_helper): Give error if
7667 version is ambiguous.
7668
7669 2010-01-08 Doug Kwan <dougkwan@google.com>
7670
7671 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7672 prev_data_size_ and prev_addralign_. Remove initializer for
7673 deleted data member has_been_changed_.
7674 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7675 to determine if the table is empty.
7676 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7677 Remove.
7678 (Stub_table::add_reloc_stub): Define method in class definition
7679 instead of just declaring it there.
7680 (Stub_table::add_cortex_a8_stub): New method definition.
7681 (Stub_table::update_data_size_and_addralign): Ditto.
7682 (Stub_table::finalize_stubs): Ditto.
7683 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7684 (Stub_table::do_addralign_): Return address alignment in the
7685 (Stub_table::do_reset_address_and_file_offset): Define method in
7686 class definition instead of declaring it there. Set current data
7687 size to be the data size of the previous pass.
7688 (Stub_table::set_final_data_size): Use current data size as the
7689 final data size.
7690 (Stub_table::relocate_stub): Change parameter type of stub from
7691 Reloc_stub pointer to Stub pointer.
7692 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7693 (Stub_table::Cortex_a8_stub_list): New typedef.
7694 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7695 Stub_table::prev_addralign_): New data member.
7696 (Arm_relobj::Arm_relobj): Initialize data member
7697 section_has_cortex_a8_workaround_.
7698 (Arm_relobj::section_has_cortex_a8_workaround,
7699 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7700 definitions.
7701 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7702 declarations.
7703 (Target_arm::relocate_stub): Change parameter type of stub from
7704 Reloc_stub pointer to Stub pointer.
7705 (Insn_template::size, Insn_template::alignment): Handle
7706 THUMB16_SPECIAL_TYPE.
7707 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7708 Stub_table::update_data_size_and_addralign,
7709 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7710 definitions.
7711 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7712 (Stub_table::do_write): Ditto.
7713 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7714
7715 2010-01-08 Ian Lance Taylor <iant@google.com>
7716
7717 PR 11108
7718 * symtab.h (class Symbol): Remove fields is_target_special_ and
7719 has_plt_offset_. Add field is_defined_in_discarded_section_.
7720 (Symbol::is_defined_in_discarded_section): New function.
7721 (Symbol::set_is_defined_in_discarded_section): New function.
7722 (Symbol::has_plt_offset): Rewrite.
7723 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7724 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7725 Don't initialize is_target_special_ or has_plt_offset_.
7726 Initialize is_defined_in_discarded_section_.
7727 (Symbol_table::add_from_relobj): If appropriate, set
7728 is_defined_in_discarded_section.
7729 * resolve.cc (Symbol::override_base_with_special): Don't test
7730 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7731 * target-reloc.h (relocate_section): Do special handling for
7732 symbols defined in discarded sections for global symbols as well
7733 as local symbols.
7734
7735 2010-01-08 Ian Lance Taylor <iant@google.com>
7736
7737 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7738 the SHT_SYMTAB case.
7739
7740 2010-01-08 Ian Lance Taylor <iant@google.com>
7741
7742 * object.cc (Sized_relobj::do_layout): Don't get confused if
7743 layout_eh_frame returns NULL.
7744
7745 2010-01-08 Ian Lance Taylor <iant@google.com>
7746
7747 PR 11084
7748 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7749 dynamic symbol table, use the normal symbol table.
7750 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7751 symbol table.
7752
7753 2010-01-08 Ian Lance Taylor <iant@google.com>
7754
7755 PR 11072
7756 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7757 sections.
7758
7759 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7760
7761 * version.cc (print_version): Change to "Copyright 2010".
7762
7763 2010-01-08 Ian Lance Taylor <iant@google.com>
7764
7765 PR 10287
7766 PR 11063
7767 * i386.cc (class Target_i386): Change return type of plt_section
7768 to be non-const.
7769 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7770 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7771 tls_desc_rel_ field.
7772 (Output_data_plt_i386::rel_tls_desc): New function.
7773 (Target_i386::rel_tls_desc_section): New function.
7774 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7775 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7776 R_386_TLS_DESC reloc in rel_tls_desc_section.
7777 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7778 Define struct Tlsdesc_info.
7779 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7780 (Target_x86_64::do_reloc_symbol_index): New function.
7781 (Target_x86_64::add_tlsdesc_info): New function.
7782 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7783 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7784 tlsdesc_rel_ field.
7785 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7786 all callers.
7787 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7788 (Target_x86_64::rela_tlsdesc_section): New function.
7789 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7790 handling.
7791 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7792 (Target_x86_64::do_reloc_addend): New function.
7793 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7794 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7795 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7796 (Output_reloc::type): New function.
7797 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7798 (Output_reloc::is_target_specific): New function.
7799 (Output_reloc::target_arg): New function.
7800 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7801 absolute relocs and target specific relocs.
7802 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7803 add_target_specific.
7804 (class Output_data_reloc) [SHT_RELA]: Likewise.
7805 * output.cc (Output_reloc::Output_reloc): Add four new versions
7806 for absolute relocs and target specific relocs.
7807 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7808 (Output_reloc::get_symbol_index): Likewise.
7809 (Output_reloc::local_section_offset): Check that local_sym_index_
7810 is not TARGET_CODE or 0.
7811 (Output_reloc::symbol_value): Likewise.
7812 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7813 reloc.
7814 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7815 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7816 functions.
7817 * layout.cc (add_target_dynamic_tags): Use output section for
7818 DT_PLTRELSZ and DT_JMPREL.
7819
7820 2010-01-07 Ian Lance Taylor <iant@google.com>
7821
7822 PR 11061
7823 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7824 function.
7825 (class Output_data_reloc_generic): Define.
7826 (class Output_data_reloc_base): Change base class to
7827 Output_data_reloc_generic. Change add() method to call
7828 bump_relative_reloc_count for a relative reloc. Remove
7829 sort_relocs_ field.
7830 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7831 to sort_relocs().
7832 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7833 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7834 appropriate.
7835 * layout.h (class Layout): Update declaration.
7836
7837 2010-01-07 Ian Lance Taylor <iant@google.com>
7838
7839 * output.h (class Output_data): Add const version of
7840 output_section and do_output_section.
7841 (class Output_section_data): Add const version of
7842 do_output_section.
7843 (class Output_section): Likewise.
7844 * layout.cc (Layout::add_target_dynamic_tags): New function.
7845 * layout.h (class Layout): Update declarations.
7846 * arm.cc (Target_arm::do_finalize_sections): Use
7847 add_target_dynamic_tags.
7848 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7849 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7850 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7851 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7852
7853 2010-01-07 Ian Lance Taylor <iant@google.com>
7854
7855 PR 11042
7856 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7857 object as needed.
7858
7859 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7860 Ian Lance Taylor <iant@google.com>
7861
7862 PR 11019
7863 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7864 Xindex::read_symtab_xindex.
7865
7866 2010-01-07 Doug Kwan <dougkwan@google.com>
7867
7868 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7869 (Insn_template::thumb16_bcond_insn): New method declaration.
7870 (Insn_template): Fix spelling.
7871 (Stub::thumb16_special): New method declaration.
7872 (Stub::do_write): Define virtual method which was previously pure
7873 virtual.
7874 (Stub::do_thumb16_special): New method declaration.
7875 (Stub::do_fixed_endian_write): New template member.
7876 (Reloc_stub::do_write): Remove.
7877 (Reloc_stub::do_fixed_endian_write): Remove.
7878 (Cortex_a8_stub): New class definition.
7879 (Stub_factory::make_cortex_a8_stub): New method definition.
7880 (Stub_factory::Stub_factory): Add missing static storage class
7881 qualifier for elf32_arm_stub_a8_veneer_blx.
7882
7883 2010-01-07 Ian Lance Taylor <iant@google.com>
7884
7885 PR 10980
7886 * options.h (class General_options): Add --warn-unresolved-symbols
7887 and --error-unresolved-symbols.
7888 * errors.cc (Errors::undefined_symbol): Implement
7889 --warn-unresolved-symbols.
7890
7891 * options.h (class General_options): Add -z text and -z textoff.
7892 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7893
7894 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7895
7896 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7897 (Garbage_collection::cident_sections): New function.
7898 (Garbage_collection::add_cident_section): New function.
7899 (Garbage_collection::cident_sections_): New member.
7900 (gc_process_relocs): Add references to sections whose names are C
7901 identifiers.
7902 * gold.h (cident_section_start_prefix): New constant.
7903 (cident_section_stop_prefix): New constant.
7904 (is_cident): New function.
7905 * layout.cc (Layout::define_section_symbols): Replace string constants
7906 with the newly defined constants.
7907 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7908 C identifiers.
7909 * testsuite/Makefile.am: Add gc_orphan_section_test.
7910 * testsuite/Makefile.in: Regenerate.
7911 * testsuite/gc_orphan_section_test.cc: New file.
7912 * testsuite/gc_orphan_section_test.sh: New file.
7913
7914 2010-01-06 Ian Lance Taylor <iant@google.com>
7915
7916 PR 10980
7917 * options.h (class General_options): Add --warn-shared-textrel.
7918 * layout.cc (Layout::finish_dynamic_section): Implement
7919 --warn-shared-textrel.
7920
7921 PR 10980
7922 * options.h (class General_options): Add --warn-multiple-gp.
7923
7924 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7925
7926 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7927 $(THREADSLIB) and $(LIBDL).
7928 * Makefile.in: Rebuild.
7929
7930 2010-01-06 Ian Lance Taylor <iant@google.com>
7931
7932 PR 10980
7933 * options.cc (General_options::parse_section_start): New function.
7934 (General_options::section_start): New function.
7935 (General_options::General_options): Initialize all members.
7936 * options.h: Include <map>
7937 (class General_options): Add --section-start. Add section_starts_
7938 member.
7939 * layout.cc (Layout::attach_allocated_section_to_segment): If
7940 --section-start was used, set the address of the segment. Remove
7941 local sort_sections.
7942 (Layout::relaxation_loop_body): If the address of the load segment
7943 has been set by --section-start, don't use it.
7944 * output.h (Output_segment::update_flags_for_output_section): New
7945 function.
7946 * output.cc (Output_segment::add_output_section): Call
7947 update_flags_for_output_section.
7948
7949 2010-01-05 Ian Lance Taylor <iant@google.com>
7950
7951 PR 10980
7952 * options.h (class General_options): Add --undefined-version.
7953 * script.cc (struct Version_expression): Add was_matched_by_symbol
7954 field.
7955 (Version_script_info::matched_symbol): New function.
7956 (Version_script_info::get_symbol_version_helper): Call
7957 matched_symbol.
7958 (Version_script_info::check_unmatched_names): New function.
7959 * script.h (class Version_script_info): Update declarations.
7960 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7961
7962 * options.h (class General_options): Use DEFINE_bool_alias for
7963 allow_multiple_definition.
7964 * resolve.cc (Symbol_table::should_override): Don't test
7965 allow_multiple_definition.
7966
7967 PR 10980
7968 * options.h (class General_options): Add --cref.
7969 * main.cc (main): Print cref table if --cref. Don't close mapfile
7970 until after printing cref table.
7971 * cref.cc: Include "symtab.h".
7972 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7973 (Cref_table_compare::operator()): New function.
7974 (Cref_inputs::gather_cref): New function.
7975 (filecol): New static const.
7976 (Cref_inputs::print_cref): New function.
7977 (Cref::print_cref): New function.
7978 * cref.h: Include <cstdio>.
7979 (class Cref): Update declarations.
7980 * mapfile.h (Mapfile::file): New function.
7981 * object.h (class Object): Define Symbols. Declare virtual
7982 do_get_global_symbols.
7983 (Object::get_global_symbols): New function.
7984 * object.cc (Input_objects::add_object): Pass object to cref_ if
7985 --cref.
7986 (Input_objects::archive_start): Likewise.
7987 (Input_objects::archive_stop): Likewise.
7988 (Input_objects::print_cref): New function.
7989 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7990 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7991 --cref.
7992 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7993 function.
7994 * plugin.h (class Sized_pluginobj): Update declarations.
7995
7996 2010-01-05 Ian Lance Taylor <iant@google.com>
7997
7998 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7999 to is_default_version. Rename insdef to insdefault.
8000 (Symbol_table::add_from_relobj): Rename def to is_default_version
8001 and local to is_forced_local.
8002 (Symbol_table::add_from_pluginobj): Likewise.
8003 (Symbol_table::add_from_dynobj): Likewise.
8004 (Symbol_table::define_special_symbol): Rename insdef to
8005 insdefault.
8006
8007 2010-01-04 Ian Lance Taylor <iant@google.com>
8008
8009 PR 10980
8010 * options.h (class General_options): Add
8011 --allow-multiple-definition and -z muldefs.
8012 * resolve.cc (Symbol_table::should_override): Don't warn about a
8013 multiple symbol definition if --allow-multiple-definition or -z
8014 muldefs.
8015
8016 PR 10980
8017 * options.h (class General_options): Add --add-needed and
8018 --copy-dt-needed-entries. Tweak --as-needed help entry.
8019 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8020 error if --copy-dt-needed-entries aka --add-needed is used and
8021 would cause a change in behaviour.
8022
8023 PR 10980
8024 * options.h (class General_options): Add -G as a short version of
8025 --shared. Add no-op options -assert, -g, and -i.
8026
8027 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8028
8029 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8030 check for .text or .gnu.linkonce.t sections.
8031 * icf.cc (Icf::find_identical_sections): Ditto.
8032 Change the detection for mangled function name within the section
8033 name.
8034 * icf.h (is_section_foldable_candidate): New function.
8035
8036 2009-12-30 Ian Lance Taylor <iant@google.com>
8037
8038 PR 10980
8039 * options.h (class General_options): Permit two dashes with
8040 --retain-symbols-file.
8041
8042 2009-12-30 Ian Lance Taylor <iant@google.com>
8043
8044 PR 10979
8045 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8046 don't put the file header and segment headers in the text
8047 segment.
8048
8049 PR 10979
8050 * common.cc (Sort_commons::operator()): Stabilize sort when both
8051 entries are NULL.
8052 (Symbol_table::do_allocate_commons_list): When allocating common
8053 symbols, skip a symbol which is no longer common.
8054 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8055 an object before checking its type.
8056 * testsuite/common_test_2.c: New file.
8057 * testsuite/common_test_3.c: New file.
8058 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8059 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8060 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8061 (common_test_2_pic.o, common_test_2.so): New targets.
8062 (common_test_3_pic.o, common_test_3.so): New targets.
8063 * testsuite/Makefile.in: Rebuild.
8064
8065 PR 10979
8066 * script.cc (read_input_script): If we see a new SECTIONS clause,
8067 and we have added an input section, give an error.
8068 * layout.h (class Layout): Add have_added_input_section function.
8069 Add have_added_input_section_ field.
8070 * layout.cc (Layout::Layout): Initialize
8071 have_added_input_section_.
8072 (Layout::layout): Set have_added_input_section_.
8073 (Layout::layout_eh_frame): Likewise.
8074
8075 2009-12-30 Ian Lance Taylor <iant@google.com>
8076
8077 PR 10931
8078 * options.h (class General_options): Add --sort-common option.
8079 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8080 * common.cc (Sort_common): Add sort_order parameter to
8081 constructor. Add sort_order_ field.
8082 (Sort_commons::operator): Check sort_order_.
8083 (Symbol_table::allocate_commons): Determine the sort order.
8084 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8085 Change all callers.
8086 (Symbol_table::do_allocate_commons_list): Likewise.
8087
8088 2009-12-30 Ian Lance Taylor <iant@google.com>
8089
8090 PR 10916
8091 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8092 symbols from this object, don't change the visibility of an
8093 undefined symbol.
8094 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8095
8096 2009-12-30 Ian Lance Taylor <iant@google.com>
8097
8098 PR 10861
8099 * script.h (class Version_script_info): Define Language enum.
8100 Update declarations. Define Glob, Exact, and Lookup types. Add
8101 new fields globals_, locals_, and is_finalized_.
8102 * script.cc: Various formatting fixes.
8103 (class Parser_closure): Change language_stack_ from a vector of
8104 std::string to one of Version_script_info::Language. Adjust all
8105 uses accordingly.
8106 (class Lazy_demangler): Remove.
8107 (struct Version_expression): Change language from std::string to
8108 Version_script_info::Language.
8109 (Version_script_info::Version_script_info): New function.
8110 (Version_script_info::~Version_script_info): Don't call clear.
8111 (Version_script_info::finalize): New function.
8112 (Version_script_info::build_lookup_tables): New function.
8113 (Version_script_info::build_expression_list_lookup): New
8114 function.
8115 (Version_script_info::get_symbol_version_helper): Rewrite to use
8116 lookup tables.
8117 (Version_script_info::print_expression_list): Adjust to use
8118 Version_script_info::Language.
8119 (script_push_lex_into_version_mode): Check that the version script
8120 has not been finalized.
8121 (version_script_push_lang): Change language string to
8122 Version_script_info::Language.
8123 * options.cc (Command_line::version_script): New function.
8124 * options.h (class General_options): Add finalize_dynamic_list
8125 function. Change version_script from declaration to definition.
8126 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8127 * testsuite/version_script.map: Remove duplicate def of foo.
8128 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8129 version_script.map.
8130 * testsuite/Makefile.in: Rebuild.
8131
8132 2009-12-30 Ian Lance Taylor <iant@google.com>
8133
8134 PR 10843
8135 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8136 if the input symbol index is 0, make the output symbol index 0.
8137
8138 2009-12-30 Ian Lance Taylor <iant@google.com>
8139
8140 PR 10670
8141 * options.h (class General_options): Add -x/--discard-all.
8142 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8143 --discard-all. If the local symbol needs a dynamic entry, check
8144 that before handling --discard-locals.
8145
8146 2009-12-30 Ian Lance Taylor <iant@google.com>
8147
8148 PR 10450
8149 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8150 flags to PF_R.
8151 (Output_segment::add_output_section): Don't change the flags if
8152 the type is PT_TLS.
8153
8154 PR 10450
8155 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8156 GNU hash table if they need a dynamic value. Otherwise, don't add
8157 them if they are defined in a dynamic object or are forced local.
8158
8159 2009-12-29 Ian Lance Taylor <iant@google.com>
8160
8161 PR 10450
8162 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8163 .gnu.hash table for a 32-bit target.
8164
8165 PR 10450
8166 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8167 regular and a dynamic object only needs a dynamic symbol table
8168 entry if it is externally visible.
8169
8170 PR 10450
8171 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8172 constructor. Add global_offset_table_ field.
8173 (Target_i386::got_section): Set global_offset_table_.
8174 (Target_i386::do_finalize_sections): Set global_offset_table_
8175 size.
8176 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8177 in constructor. Add global_offset_table_ field.
8178 (Target_x86_64::got_section): Set global_offset_table_.
8179 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8180 size.
8181
8182 * layout.cc (Layout::Layout): Initialize increase_relro_.
8183 (Layout::get_output_section): Add is_relro, is_last_relro, and
8184 is_first_non_relro parameters. Change all callers.
8185 (Layout::choose_output_section): Likewise.
8186 (Layout::add_output_section_data): Likewise.
8187 (Layout::make_output_section): Likewise.
8188 (Layout::set_segment_offsets): Clear increase_relro when using a
8189 linker script.
8190 * layout.h (class Layout): Add increase_relro method. Add
8191 increase_relro_ field. Update declarations.
8192 * output.cc (Output_section::Output_section): Initialize
8193 is_last_relro_ and is_first_non_relro_.
8194 (Output_segment::add_output_section): Group relro sections is
8195 do_sort is true. Handle is_last_relro and is_first_non_relro.
8196 (Output_segment::maximum_alignment): Remove relro handling.
8197 (Output_segment::set_section_addresses): Add increase_relro
8198 parameter. Change all callers. Add initial alignment to align
8199 relro sections on separate page. Remove old relro handling.
8200 (Output_segment::set_section_list_addresses): Remove in_relro
8201 parameter. Change all callers.
8202 (Output_segment::set_offset): Add increase parameter. Change all
8203 callers. Remove old relro handling.
8204 * output.h (class Output_section): Add new methods: is_last_relro,
8205 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8206 Add is_last_relro_ and is_first_non_relro_ fields.
8207 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8208 Create separate .got.plt section. Call increase_relro.
8209 * x86_64.cc (Target_x86_64::got_section): Likewise.
8210 * testsuite/relro_script_test.t: Add .got.plt.
8211
8212 PR 10450
8213 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8214 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8215 (Layout::finalize): Call set_dynamic_symbol_size.
8216 (Layout::set_dynamic_symbol_size): New function.
8217 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8218 set_dynamic_symbol_size.
8219
8220 PR 10450
8221 * output.h (class Output_section): Add is_entsize_zero_ field.
8222 * output.cc (Output_section::Output_section): Initialize
8223 is_entsize_zero_.
8224 (Output_section::set_entsize): If two different entsizes are
8225 requested, force it to zero.
8226 (Output_section::add_input_section): Set flags for .debug_str
8227 before updating section flags. Set entsize.
8228 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8229 and SHF_STRING if all input sections have those flags.
8230
8231 2009-12-29 Rafael Espindola <espindola@google.com>
8232
8233 * main.cc (main): Fix the sys time reporting.
8234 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8235 reporting.
8236
8237 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8238
8239 * options.cc (General_options::parse_version): Allow -v to exit
8240 without an error if there is nothing to link.
8241
8242 2009-12-29 Ian Lance Taylor <iant@google.com>
8243
8244 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8245 using a version of gcc before 4.1.
8246 * configure: Rebuild.
8247
8248 2009-12-28 Chris Demetriou <cgd@google.com>
8249
8250 * attributes.cc (Output_attributes_section_data::do_write): Use
8251 std::vector::front rather than std::vector::data.
8252
8253 2009-12-28 Ian Lance Taylor <iant@google.com>
8254
8255 * symtab.h (class Symbol_table): Add enum Defined.
8256 * resolve.cc (Symbol_table::should_override): Add defined
8257 parameter. Change all callers. Test whether object is NULL
8258 before calling a method on it.
8259 (Symbol_table::report_resolve_problem): Add defined parameter.
8260 Change all callers.
8261 (Symbol_table::should_override_with_special): Likewise.
8262 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8263 parameter. Change all callers.
8264 (Symbol_table::do_define_in_output_data): Likewise.
8265 (Symbol_table::define_in_output_segment): Likewise.
8266 (Symbol_table::do_define_in_output_segment): Likewise.
8267 (Symbol_table::define_as_constant): Likewise.
8268 (Symbol_table::do_define_as_constant): Likewise.
8269 * script.h (class Symbol_assignment): Add is_defsym parameter to
8270 constructor; change all callers.
8271 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8272 parameter. Change all callers. Add is_defsym_ field.
8273 (class Parser_closure): Add parsing_defsym parameter to
8274 constructor; change all callers. Add parsing_defsym accessor
8275 function. Add parsing_defsym_ field.
8276
8277 2009-12-28 Ian Lance Taylor <iant@google.com>
8278
8279 * gold.cc (queue_middle_tasks): Fix formatting.
8280 * object.cc (Relobj::is_section_name_included): Likewise.
8281
8282 2009-12-23 Ian Lance Taylor <iant@google.com>
8283
8284 * i386.cc (Target_i386::do_calls_non_split): Recognize
8285 -fsplit-stack prologue for a function with a static chain.
8286 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8287 -fsplit-stack prologue when using %r11.
8288
8289 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8290
8291 * options.cc (General_options::parse_version): Make -v continue and do
8292 the link like GNU ld does.
8293
8294 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8295
8296 * Makefile.am (CCFILES): Add timer.cc.
8297 (HFILES): Add timer.h.
8298 * configure.ac: Check for sysconf and times.
8299 * main.cc: include timer.h.
8300 (main): Use Timer instead of get_run_time.
8301 * timer.cc: New.
8302 * timer.h: New.
8303 * workqueue.cc: include timer.h.
8304 (Workqueue::find_and_run_task):
8305 Report user, sys and wall time.
8306 * Makefile.in: Regenerate.
8307 * config.in: Regenerate.
8308 * configure: Regenerate.
8309
8310 2009-12-16 Doug Kwan <dougkwan@google.com>
8311
8312 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8313 sections.
8314 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8315 relaxed input sections.
8316 * output.cc (Output_section::find_relaxed_input_section): Change
8317 return type to Output_relaxed_input_section pointer. Adjust code
8318 for new type of relaxed_input_section_map_.
8319 * output.h (Output_section::find_relaxed_input_section): Change
8320 return type to Output_relaxed_input_section pointer.
8321 (Output_section::Output_relaxed_input_section_by_input_section_map):
8322 New type.
8323 (Output_section::relaxed_input_section_map_): Change type to
8324 Output_section::Output_relaxed_input_section_by_input_section_map.
8325 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8326 input section.
8327
8328 2009-12-15 Ian Lance Taylor <iant@google.com>
8329
8330 * layout.cc (Layout::create_shstrtab): Only write out after input
8331 sections if we are compressing debug sections.
8332
8333 2009-12-15 Ian Lance Taylor <iant@google.com>
8334
8335 * archive.cc (Archive::add_symbols): Only look up a symbol without
8336 a version if there is, in fact, a version.
8337
8338 2009-12-14 Ian Lance Taylor <iant@google.com>
8339
8340 Revert -Wshadow changes, all changes from:
8341 2009-12-11 Doug Kwan <dougkwan@google.com>
8342 2009-12-11 Nick Clifton <nickc@redhat.com>
8343 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8344
8345 2009-12-11 Doug Kwan <dougkwan@google.com>
8346
8347 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8348 due to -Wshadow.
8349 * attributes.cc (Object_attribute::size): Ditto.
8350 (Attributes_section_data::size): Ditto.
8351 (Attributes_section_data::Attributes_section_data): Ditto.
8352 (Output_attributes_section_data::do_write): Ditto.
8353 * attributes.h (Object_attribute::set_type): Ditto.
8354 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8355
8356 2009-12-11 Nick Clifton <nickc@redhat.com>
8357
8358 * archive.cc: Fix shadowed variable warnings.
8359 * arm.cc: Likewise.
8360 * compressed_output.cc: Likewise.
8361 * compressed_output.h: Likewise.
8362 * configure: Likewise.
8363 * dwarf_reader.cc: Likewise.
8364 * dynobj.cc: Likewise.
8365 * dynobj.h: Likewise.
8366 * ehframe.cc: Likewise.
8367 * ehframe.h: Likewise.
8368 * errors.cc: Likewise.
8369 * expression.cc: Likewise.
8370 * fileread.cc: Likewise.
8371 * fileread.h: Likewise.
8372 * freebsd.h: Likewise.
8373 * i386.cc: Likewise.
8374 * icf.cc: Likewise.
8375 * incremental.h: Likewise.
8376 * layout.cc: Likewise.
8377 * layout.h: Likewise.
8378 * mapfile.cc: Likewise.
8379 * merge.cc: Likewise.
8380 * merge.h: Likewise.
8381 * object.cc: Likewise.
8382 * object.h: Likewise.
8383 * options.h: Likewise.
8384 * output.cc: Likewise.
8385 * output.h: Likewise.
8386 * parameters.cc: Likewise.
8387 * plugin.cc: Likewise.
8388 * powerpc.cc: Likewise.
8389 * reduced_debug_output.cc: Likewise.
8390 * reduced_debug_output.h: Likewise.
8391 * reloc.cc: Likewise.
8392 * reloc.h: Likewise.
8393 * resolve.cc: Likewise.
8394 * script-sections.cc: Likewise.
8395 * script.cc: Likewise.
8396 * script.h: Likewise.
8397 * sparc.cc: Likewise.
8398 * symtab.cc: Likewise.
8399 * symtab.h: Likewise.
8400 * target-select.cc: Likewise.
8401 * target-select.h: Likewise.
8402 * token.h: Likewise.
8403 * workqueue.cc: Likewise.
8404 * workqueue.h: Likewise.
8405 * x86_64.cc: Likewise.
8406
8407 2009-12-10 Doug Kwan <dougkwan@google.com>
8408
8409 * arm.cc (attributes.h): New include.
8410 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8411 (Arm_relobj::~Arm_relobj): Delete object pointed by
8412 attributes_section_data_.
8413 (Arm_relobj::attributes_section_data): New method definition.
8414 (Arm_relobj::attributes_section_data_): New data member declaration.
8415 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8416 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8417 attributes_section_data_.
8418 (Arm_dynobj::attributes_section_data): New method definition.
8419 (Arm_dynobj::attributes_section_data_): New data member declaration.
8420 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8421 initialization value of may_use_blx_ to false.
8422 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8423 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8424 object attributes to compute results instead of hard-coding.
8425 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8426 Target_arm::get_secondary_compatible_arch,
8427 Target_arm::set_secondary_compatible_arch
8428 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8429 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8430 New method declarations.
8431 (Target_arm::get_aeabi_object_attribute): New method definition.
8432 (Target_arm::attributes_section_data_): New data member declaration.
8433 (read_arm_attributes_section): New template definition.
8434 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8435 (Arm_dynobj::do_read_symbols): Ditto.
8436 (Target_arm::do_finalize_sections): Merge attributes sections from
8437 input. Check for BLX use after attributes section merging.
8438 Fix __exidx_start and __exidx_end visibility. Create an
8439 .ARM.attributes section if necessary.
8440 (Target_arm::get_secondary_compatible_arch,
8441 Target_arm::set_secondary_compatible_arch,
8442 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8443 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8444 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8445 New method definitions.
8446
8447 2009-12-09 Ian Lance Taylor <iant@google.com>
8448
8449 * plugin.cc (Plugin::load): Don't cast from void* to a function
8450 pointer.
8451
8452 2009-12-09 Ian Lance Taylor <iant@google.com>
8453
8454 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8455 information fields.
8456
8457 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8458
8459 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8460 Replace two_file_shared_1.so with two_file_shared_2.so.
8461 * testsuite/Makefile.in: Regenerated.
8462
8463 2009-12-08 Doug Kwan <dougkwan@google.com>
8464
8465 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8466 (HFILES): Add attributes.h and int_encoding.h.
8467 * Makefile.in: Regenerate.
8468 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8469 function definitions to int_encoding.cc
8470 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8471 prototypes to int_encoding.h
8472 * reduced_debug_output.cc (int_encoding.h): New include.
8473 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8474 function definitions to int_encoding.cc
8475 (insert_into_vector, read_from_pointer): Move template definitions to
8476 int_encoding.h
8477 * attributes.cc: New file.
8478 * attributes.h: New file.
8479 * int_encoding.cc: New file.
8480 * int_encoding.h: New file.
8481
8482 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8483
8484 PR gold/11055
8485 * incremental-dump.cc (dump_incremental_inputs): New.
8486 (main): Use dump_incremental_inputs.
8487
8488 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8489
8490 PR gold/10893
8491 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8492 checking elfcpp::STT_FUNC.
8493 (Target_i386::Relocate::relocate): Likewise.
8494 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8495
8496 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8497 symbols from shared libraries into normal FUNC symbols.
8498
8499 * symtab.h (Symbol): Add is_func and use it.
8500
8501 2009-12-05 Doug Kwan <dougkwan@google.com>
8502
8503 * arm.cc (Target_arm::arm_info): Initialize new fields
8504 attributes_section and attributes_vendor.
8505 * i386.cc (Target_i386::i386_info): Same.
8506 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8507 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8508 fields attributes_section and attributes_vendor.
8509 * sparc.cc (Target_sparc::sparc_info): Same.
8510 * target.h (Target::attributes_section, Target::attributes_vendor,
8511 Target::is_attributes_section, Target::attribute_arg_type,
8512 Target::attributes_order): New method definitions.
8513 (Target::Target_info::attributes_section,
8514 Target::Target_info::attributes_vendor): New fields.
8515 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8516 virtual method definitions.
8517 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8518 attributes_section and attributes_vendor.
8519 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8520
8521 2009-12-05 Doug Kwan <dougkwan@google.com>
8522
8523 * arm.cc: Update comments about interworking and stub generation.
8524 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8525 considered as non-PIC.
8526 (Arm_relocate_functions::base_abs): Fix formatting.
8527 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8528 of function to use GOT entry address instead of offset.
8529 (Target_arm::Scan::global): Issue an error if a symbol would need a
8530 PLT does not get one because it is untyped. Remove code to create
8531 dynamic symbols for relative branches.
8532 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8533 takes unsigned integer instead of boolean.
8534
8535 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8536
8537 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8538 (two_file_test_LDADD): Likewise.
8539 (common_test_1_LDADD): Likewise.
8540 (exception_test_LDADD) Likewise.
8541 (weak_test_LDADD): Likewise.
8542 (many_sections_test_LDADD): Likewise.
8543 (initpri1_LDADD): Likewise.
8544 (script_test_1_LDADD): Likewise.
8545 (script_test_2_LDADD): Likewise.
8546 (justsyms_LDADD): Likewise.
8547 (binary_test_LDADD): Likewise.
8548 (large_LDADD): Likewise.
8549 * testsuite/Makefile.in: Regenerated.
8550
8551 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8552
8553 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8554 (Symbol_table::override_with_special): Likewise.
8555 (Symbol_table::add_from_object): Likewise.
8556
8557 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8558
8559 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8560 Don't set the data_offset twice.
8561
8562 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8563
8564 * testsuite/Makefile.in: Regenerate.
8565
8566 2009-12-03 Doug Kwan <dougkwan@google.com>
8567
8568 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8569 (Target_arm::do_finalize_sections): Add parameter for symbol table
8570 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8571 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8572 parameter for symbol table pointer.
8573 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8574 an additional parameter for a pointer to symbol table.
8575 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8576 parameter for a symbol table pointer.
8577 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8578 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8579 Ditto.
8580 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8581 parameter for a symbol table pointer.
8582
8583 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8584
8585 * incremental.cc (Incremental_inputs_header)
8586 (Incremental_inputs_header_write, Incremental_inputs_entry)
8587 (Incremental_inputs_entry_write): Move ...
8588 * incremental.h (Incremental_inputs_header)
8589 (Incremental_inputs_header_write, Incremental_inputs_entry)
8590 (Incremental_inputs_entry_write): here.
8591
8592 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8593
8594 * incremental.cc (make_sized_incremental_binary): Set the target.
8595 Error if it is incompatible.
8596 * output.h (Output_file): Add filename method.
8597
8598 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8599
8600 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8601 from the get_* methods.
8602
8603 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8604
8605 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8606 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8607 Write 0 for the data_offset of scripts.
8608
8609 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8610
8611 * testsuite/Makefile.am: Add the incremental_test.sh test.
8612 * testsuite/incremental_test.sh: New.
8613 * testsuite/incremental_test_1.c: New.
8614 * testsuite/incremental_test_2.c: New.
8615
8616 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8617
8618 * incremental-dump.cc (main): Fix typos.
8619
8620 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8621
8622 PR gold/11025
8623 * incremental-dump.cc (main): Use llu to print 64 bit values.
8624
8625 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8626 H.J. Lu <hongjiu.lu@intel.com>
8627
8628 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8629 $(LIBDL).
8630 (incremental_dump_LDADD): Likewise.
8631 * Makefile.in: Regenerated.
8632
8633 2009-11-25 Doug Kwan <dougkwan@google.com>
8634
8635 Revert:
8636
8637 2009-11-25 Doug Kwan <dougkwan@google.com>
8638
8639 * arm.cc (Target_arm::Target_arm): Move method definition
8640 outside of class definition. Add code to handle
8641 --target1-rel, --target1-abs and --target2= options.
8642 (Target_arm::get_reloc_reloc_type): Change method to be
8643 non-static and const.
8644 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8645 New data member declaration.
8646 (Target_arm::Scan::local, Target_arm::Scan::global,
8647 Target_arm::Relocate::relocate,
8648 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8649 Adjust call to Target_arm::get_real_reloc_type.
8650 (Target_arm::get_real_reloc_type): Use command line options
8651 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8652 * options.h (--target1-rel, --target1-abs, --target2): New
8653 ARM-only options.
8654
8655 2009-11-25 Doug Kwan <dougkwan@google.com>
8656
8657 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8658 class definition. Add code to handle --target1-rel, --target1-abs
8659 and --target2= options.
8660 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8661 and const.
8662 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8663 member declaration.
8664 (Target_arm::Scan::local, Target_arm::Scan::global,
8665 Target_arm::Relocate::relocate,
8666 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8667 call to Target_arm::get_real_reloc_type.
8668 (Target_arm::get_real_reloc_type): Use command line options to
8669 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8670 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8671 options.
8672
8673 2009-11-25 Doug Kwan <dougkwan@google.com>
8674
8675 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8676 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8677 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8678 formatting.
8679 (Arm_relocate_functions::thm_call): Replace body with a call to
8680 Arm_relocate_functions::thumb_branch_common.
8681 (Arm_relocate_functions::thm_jump24,
8682 Arm_relocate_functions::thm_xpc22): New method definitions.
8683 (Arm_relocate_functions::thumb_branch_common): New method definition.
8684 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8685 operator.
8686 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8687 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8688
8689 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8690
8691 * Makefile.am: Build incremental-dump
8692 * Makefile.in: Regenerate.
8693 * incremental-dump.cc: New.
8694 * incremental.cc (Incremental_inputs_header_data,
8695 Incremental_inputs_entry_data): Move to incremental.h
8696 * incremental.h: (Incremental_inputs_header_data,
8697 Incremental_inputs_entry_data): Move from incremental.cc
8698
8699 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8700
8701 * incremental.cc (Incremental_inputs_header,
8702 Incremental_inputs_header_write, Incremental_inputs_entry,
8703 Incremental_inputs_entry_write): Add a typedef with the data type.
8704
8705 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8706
8707 * incremental.cc (Incremental_inputs_header,
8708 Incremental_inputs_header_write, Incremental_inputs_entry,
8709 Incremental_inputs_entry_write): Update comment about which
8710 type has the filed descriptions.
8711
8712 2009-11-15 Doug Kwan <dougkwan@google.com>
8713
8714 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8715 (Arm_relocate_functions::arm_branch_common): Change method defintion
8716 in class definition to a method declaration and update list of formal
8717 parameters.
8718 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8719 Arm_relocation_functions::jump24): Adjust call to
8720 Arm_relocate_functions::arm_branch_common. Update list of formal
8721 parameters.
8722 (Arm_relocate_functions::xpc25): New method definition.
8723 (Arm_relocate_functions::arm_branch_common): Move method defintion
8724 out from class definition. Use stubs for mode-switching and extending
8725 branch ranges.
8726 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8727 specially. Change code to enable use of stubs in ARM branches.
8728
8729 2009-11-10 Doug Kwan <dougkwan@google.com>
8730
8731 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8732 in method declaration.
8733 (Target_arm::relocate_stub): New method declaration.
8734 (Target_arm::default_target): Change to return a pointer instead of
8735 a const reference.
8736 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8737 Target_arm::default_target.
8738 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8739 method definition.
8740 (Target_arm::relocate_section): Adjust view.
8741 (Target_arm::relocate_stub): New method definition.
8742
8743 2009-11-10 Doug Kwan <dougkwan@google.com>
8744
8745 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8746 a format warning.
8747 * incremental.cc (open_incremental_binary): Initialized local
8748 variables to avoid warnings.
8749 * object.cc (make_elf_object): Ditto.
8750 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8751 a format warning.
8752
8753 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8754
8755 PR gold/10930
8756 * testsuite/plugin_test.c: Include "config.h".
8757
8758 2009-11-09 Doug Kwan <dougkwan@google.com>
8759
8760 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8761 (arm_symbol_value): Remove.
8762 (Arm_relocate_functions::arm_branch_common,
8763 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8764 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8765 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8766 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8767 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8768 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8769 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8770 Arm_relocate_functions::thm_mobw_abs_nc,
8771 Arm_relocate_functions::thm_mov_abs,
8772 Arm_relocate_functions::movw_prel_nc,
8773 Arm_relocate_functions::thm_movt_abs,
8774 Arm_relocate_functions::movt_prel,
8775 Arm_relocate_functions::thm_movw_prel_nc,
8776 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8777 (Target_arm::Relocate::relocate): Only decompose address into two
8778 parts if relocation type uses the thumb-bit and pass the actual
8779 bit instead of a flag indicating that the thumb-bit is used. Adjust
8780 calls to methods in Arm_relocate_functions for this change.
8781
8782 2009-11-08 Ian Lance Taylor <iant@google.com>
8783
8784 PR 10925
8785 * reloc.cc: Instantiate
8786 Sized_relobj::initialize_input_to_output_maps and
8787 Sized_relobj:free_input_to_output_maps.
8788
8789 2009-11-06 Ian Lance Taylor <iant@google.com>
8790
8791 PR 10876
8792 * defstd.cc (in_segment): Set only_if_ref true for "end".
8793
8794 2009-11-06 Doug Kwan <dougkwan@google.com>
8795
8796 * arm.cc (class Reloc_stub): Correct a comment.
8797 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8798 (Target_arm::scan_section_for_stubs): New method declaration.
8799 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8800 Change methods from private to protected.
8801 (Target_arm::do_may_relax): New method definition.
8802 (Target_arm::do_relax, Target_arm::group_sections,
8803 Target_arm::scan_reloc_for_stub,
8804 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8805 (Target_arm::arm_input_section_map_): New data member declaration.
8806 (Target_arm::scan_reloc_for_stub,
8807 Target_arm::scan_reloc_section_for_stubs,
8808 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8809 Target_arm::do_relax): New method definitions.
8810
8811 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8812
8813 * configure.ac: Check for (struct stat)::st_mtim
8814 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8815 * config.in: Regenerate.
8816 * configure: Regenerate.
8817
8818 2009-11-05 Ian Lance Taylor <iant@google.com>
8819
8820 PR 10910
8821 * output.cc (Output_segment::add_output_section): Add missing
8822 return statement.
8823
8824 2009-11-04 Ian Lance Taylor <iant@google.com>
8825
8826 PR 10880
8827 * object.h (class Object): Add is_needed and set_is_needed
8828 methods. Add is_needed_ field. Make bool fields into bitfields.
8829 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8830 defined in a dynamic object and referenced by a regular object,
8831 set is_needed for the dynamic object.
8832 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8833 if the file is marked with as_needed and it is not needed.
8834
8835 2009-11-04 Ian Lance Taylor <iant@google.com>
8836
8837 PR 10887
8838 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8839 tags if data is discarded by linker script.
8840 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8841 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8842 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8843 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8844
8845 2009-11-04 Ian Lance Taylor <iant@google.com>
8846
8847 * layout.cc (Layout::get_output_section): Add is_interp and
8848 is_dynamic_linker_section parameters. Change all callers.
8849 (Layout::choose_output_section): Likewise.
8850 (Layout::make_output_section): Likewise.
8851 (Layout::add_output_section_data): Add is_dynamic_linker_section
8852 parameter. Change all callers.
8853 * layout.h (class Layout): Update declarations.
8854 * output.h (class Output_section): Add is_interp, set_is_interp,
8855 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8856 Add is_interp_, is_dynamic_linker_section_ fields. Change
8857 generate_code_fills_at_write_ to a bitfield.
8858 * output.cc (Output_section::Output_sections): Initialize new
8859 fields.
8860 (Output_segment::add_output_section): Add do_sort parameter.
8861 Change all callers.
8862
8863 2009-11-03 Ian Lance Taylor <iant@google.com>
8864
8865 PR 10860
8866 * options.h (class General_options): Add --warn-common.
8867 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8868 merging two common symbols.
8869 (Symbol_table::should_override): Handle --warn-common when merging
8870 a common symbol with a defined symbol. Use report_resolve_problem
8871 for multiple definitions.
8872 (Symbol_table::report_resolve_problem): New function.
8873 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8874
8875 2009-11-03 Doug Kwan <dougkwan@google.com>
8876
8877 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8878 stub_factory_.
8879 (Target_arm::stub_factory): New method definition.
8880 (Target_arm::new_arm_input_section,
8881 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8882 Target_arm::reloc_uses_thumb_bit): New method declarations.
8883 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8884 New type definitions.
8885 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8886 member declarations.
8887 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8888 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8889 New method definitions.
8890
8891 2009-11-03 Ian Lance Taylor <iant@google.com>
8892
8893 * options.h (class General_options): Add --warn_constructors.
8894
8895 2009-11-03 Ian Lance Taylor <iant@google.com>
8896
8897 PR 10893
8898 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8899 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8900
8901 2009-11-03 Ian Lance Taylor <iant@google.com>
8902
8903 PR 10895
8904 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8905 --msgid-bugs-address.
8906 (install-pdf): New target.
8907 (install-data_yes): Look up one directory to find mkinstalldirs.
8908
8909 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8910
8911 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8912 tree.
8913
8914 2009-10-30 Doug Kwan <dougkwan@google.com>
8915
8916 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8917
8918 2009-10-30 Doug Kwan <dougkwan@google.com>
8919
8920 * arm.cc (Stub_addend_reader): New struct template definition
8921 and partial specializations.
8922 (Stub_addend_reader::operator()): New method definition for a
8923 partially specialized template.
8924
8925 2009-10-30 Doug Kwan <dougkwan@google.com>
8926
8927 * arm.cc (Arm_relobj::processor_specific_flags): New method
8928 definition.
8929 (Arm_relobj::do_read_symbols): New method declaration.
8930 (Arm_relobj::processor_specific_flags_): New data member declaration.
8931 (Arm_dynobj): New class definition.
8932 (Target_arm::do_finalize_sections): Add input_objects parameter.
8933 (Target_arm::do_adjust_elf_header): New method declaration.
8934 (Target_arm::are_eabi_versions_compatible,
8935 (Target_arm::merge_processor_specific_flags): New method declaration.
8936 (Target_arm::do_make_elf_object): New overloaded method definitions
8937 and declaration.
8938 (Arm_relobj::do_read_symbols): New method definition.
8939 (Arm_dynobj::do_read_symbols): Ditto.
8940 (Target_arm::do_finalize_sections): Add input_objects parameters.
8941 Merge processor-specific flags from all input objects.
8942 (Target_arm::are_eabi_versions_compatible,
8943 Target_arm::merge_processor_specific_flags,
8944 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8945 New method definitions.
8946 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8947 Input_objects pointer type parameter.
8948 * layout.cc (Layout::finalize): Pass input objects to target's.
8949 finalize_sections function.
8950 * output.cc (Output_file_header::do_sized_write): Set ELF file
8951 header's processor-specific flags.
8952 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8953 Input_objects pointer type parameter.
8954 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8955 * target.h (Input_objects): New forward class declaration.
8956 (Target::processor_specific_flags,
8957 Target::are_processor_specific_flags_sect): New method definitions.
8958 (Target::finalize_sections): Add input_objects parameter.
8959 (Target::Target): Initialize processor_specific_flags_ and
8960 are_processor_specific_flags_set_.
8961 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8962 parameter.
8963 (Target::set_processor_specific_flags): New method definition.
8964 (Target::processor_specific_flags_,
8965 Target::are_processor_specific_flags_set_): New data member
8966 declarations.
8967 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8968 Input_objects pointer type parameter.
8969
8970 2009-10-30 Doug Kwan <dougkwan@google.com>
8971
8972 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8973
8974 2009-10-28 Ian Lance Taylor <iant@google.com>
8975
8976 * object.h (class Relobj): Drop options parameter from
8977 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8978 do_scan_relocs, do_relocate. Change all callers.
8979 (class Sized_relobj): Drop options parameters from
8980 do_gc_process_relocs, do_scan_relocs, do_relocate,
8981 do_relocate_sections, relocate_sections, emit_relocs_scan,
8982 emit_relocs_scan_reltype. Change all callers.
8983 (struct Relocate_info): Remove options field and all references to
8984 it.
8985 * reloc.h (class Read_relocs): Remove options constructor
8986 parameter and options_ field. Change all callers.
8987 (class Gc_process_relocs, class Scan_relocs): Likewise.
8988 (class Relocate_task): Likewise.
8989 * target-reloc.h (scan_relocs): Remove options parameter. Change
8990 all callers.
8991 (scan_relocatable_relocs): Likewise.
8992 * target.h (class Sized_target): Remove options parameter from
8993 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8994 all callers.
8995 * gc.h (gc_process_relocs): Remove options parameter. Change all
8996 callers.
8997 * arm.cc: Update functions to remove options parameters.
8998 * i386.cc: Likewise.
8999 * powerpc.cc: Likewise.
9000 * sparc.cc: Likewise.
9001 * x86_64.cc: Likewise.
9002 * testsuite/testfile.cc: Likewise.
9003
9004 2009-10-28 Doug Kwan <dougkwan@google.com>
9005
9006 * arm.cc (Arm_relobj): New class definition.
9007 (Arm_relobj::scan_sections_for_stubs,
9008 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9009 New method definitions.
9010
9011 2009-10-28 Cary Coutant <ccoutant@google.com>
9012
9013 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9014 (Plugin::cleanup_done_): New member.
9015 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9016 (Plugin_manager::cleanup_done_): Remove.
9017 (Plugin_manager::add_input_file): Edit error message.
9018 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9019 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9020
9021 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9022
9023 * fileread.cc: (File_read::View::~View): Use the new
9024 data_ownership_ filed.
9025 (File_read::~File_read): Dispose the new whole_file_view_.
9026 (File_read::open): Mmap the whole file if needed.
9027 (File_read::open): Use whole_file_view_ instead of contents_.
9028 (File_read::find_view): Use whole_file_view_ if applicable.
9029 (File_read::do_read): Use whole_file_view_ instead of contents_.
9030 (File_read::make_view): Use whole_file_view_ instead of contents_,
9031 update File_read::View::View call.
9032 (File_read::find_or_make_view): Update File_read::View::View
9033 call.
9034 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9035 remove contents_
9036 (File_read::View::Data_ownership): New enum.
9037 (File_read::View::View): Replace bool mapped_ with Data_ownership
9038 argument.
9039 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9040 (File_read::View::data_ownership_): New field.
9041 (File_read::contents_): Remove (replaced by whole_file_view_).
9042 (File_read::whole_file_view_): New field.
9043 * options.h (class General_options): Add --keep-files-mapped.
9044
9045 2009-10-27 Cary Coutant <ccoutant@google.com>
9046
9047 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9048 * testsuite/Makefile.am (plugin_test_5): New test case.
9049 * testsuite/Makefile.in: Regenerate.
9050
9051 2009-10-25 Doug Kwan <dougkwan@google.com>
9052
9053 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9054 from private to protected to allow access by child class.
9055 (Sized_relobj::do_relocate_sections): New method declaration.
9056 (Sized_relobj::relocate_sections): Virtualize.
9057 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9058 Sized_relobj::relocate_sections. Instantiate template explicitly
9059 for different target sizes and endianity.
9060
9061 2009-10-24 Doug Kwan <dougkwan@google.com>
9062
9063 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9064 (Arm_input_section::as_arm_input_section): New method.
9065 (Arm_output_section): New class definition.
9066 (Arm_output_section::create_stub_group,
9067 Arm_output_section::group_sections): New method definitions.
9068
9069 2009-10-22 Doug Kwan <dougkwan@google.com>
9070
9071 * arm.cc (Arm_input_section): New class definition.
9072 (Arm_input_section::init, Arm_input_section:do_write,
9073 Arm_input_section::set_final_data_size,
9074 Arm_input_section::do_reset_address_and_file_offset): New method
9075 definitions.
9076
9077 2009-10-21 Doug Kwan <dougkwan@google.com>
9078
9079 * arm.cc (Stub_table, Arm_input_section): New forward class
9080 declarations.
9081 (Stub_table): New class defintion.
9082 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9083 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9084 New method definition.
9085
9086 2009-10-21 Doug Kwan <dougkwan@google.com>
9087
9088 * arm.cc: Update copyright comments.
9089 (Target_arm): New forward class template declaration.
9090 (Arm_address): New type.
9091 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9092 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9093 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9094 constants.
9095 (Insn_template): Same.
9096 (DEF_STUBS): New macro.
9097 (Stub_type): New enum type.
9098 (Stub_template): New class definition.
9099 (Stub): Same.
9100 (Reloc_stub): Same.
9101 (Stub_factory): Same.
9102 (Target_arm::Target_arm): Initialize may_use_blx_ and
9103 should_force_pic_veneer_.
9104 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9105 Target_arm::should_force_pic_veneer,
9106 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9107 Target_arm::using_thumb_only, Target_arm:;default_target): New
9108 method defintions.
9109 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9110 New data member declarations.
9111 (Insn_template::size, Insn_template::alignment): New method defintions.
9112 (Stub_template::Stub_template): New method definition.
9113 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9114 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9115 (Stub_factory::Stub_factory): New method definition.
9116 * gold.h (string_hash): New template.
9117 * output.h (Input_section_specifier::hash_value): Use
9118 gold::string_hash.
9119 (Input_section_specifier::string_hash): Remove.
9120 * stringpool.cc (Stringpool_template::string_hash): Use
9121 gold::string_hash.
9122
9123 2009-10-20 Doug Kwan <dougkwan@google.com>
9124
9125 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9126 symbols of relaxed input sections.
9127 * output.h (Output_section::find_relaxed_input_section): Make
9128 method public.
9129
9130 2009-10-16 Doug Kwan <dougkwan@google.com>
9131
9132 * dynobj.cc (Versions::Versions): Initialize version_script_.
9133 Only insert base version symbol definition for a shared object
9134 if version script defines any version versions.
9135 (Versions::define_base_version): New method definition.
9136 (Versions::add_def): Check that base version is not needed.
9137 (Versions::add_need): Define base version lazily.
9138 * dynobj.h (Versions::define_base_version): New method declaration.
9139 (Versions::needs_base_version_): New data member declaration.
9140 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9141 (check_DATA): Add no_version_test.stdout.
9142 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9143 New make rules.
9144 * testsuite/Makefile.in: Regenerate.
9145 * testsuite/no_version_test.c: New file.
9146 * testsuite/no_version_test.sh: Ditto.
9147
9148 2009-10-16 Doug Kwan <dougkwan@google.com>
9149
9150 * expression.cc (class Segment_start_expression): New class definition.
9151 (Segment_start_expression::value): New method definition.
9152 (script_exp_function_segment_start): Return a new
9153 Segment_start_expression.
9154 * gold/script-c.h (script_saw_segment_start_expression): New function
9155 prototype.
9156 * script-sections.cc (Script_sections::Script_sections): Initialize
9157 SAW_SEGMENT_START_EXPRESSION_ to false.
9158 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9159 and -Tbbs options to specify section addresses if given in
9160 command line and no SEGMENT_START expression is seen in a script.
9161 * script-sections.h (Script_sections::saw_segment_start_expression,
9162 Script_sections::set_saw_segment_start_expression): New method
9163 definition.
9164 (Script_sections::saw_segment_start_expression_): New data member
9165 declaration.
9166 * script.cc (script_saw_segment_start_expression): New function.
9167 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9168 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9169 script_test_7.sh and script_test_8.sh.
9170 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9171 script_test_8.stdout.
9172 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9173 (script_test_6, script_test_6.stdout, script_test_7,
9174 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9175 * Makefile.in: Regenerate.
9176 * testsuite/script_test_6.sh: New file.
9177 * testsuite/script_test_6.t: Same.
9178 * testsuite/script_test_7.sh: Same.
9179 * testsuite/script_test_7.t: Same.
9180 * testsuite/script_test_8.sh: Same.
9181
9182 2009-10-16 Doug Kwan <dougkwan@google.com>
9183
9184 * output.cc (Output_segment::set_section_list_address): Cast
9185 expressions to unsigned long long type to avoid format warnings.
9186
9187 2009-10-15 Ian Lance Taylor <iant@google.com>
9188
9189 * script.cc (Script_options::add_symbol_assignment): Always add a
9190 dot assignment to script_sections_.
9191 * script-sections.cc (Script_sections::add_dot_assignment):
9192 Initialize if necessary.
9193
9194 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9195 program headers with no load segment if there is a linker script.
9196
9197 * layout.cc (Layout::set_segment_offsets): Align the file offset
9198 to the segment aligment for -N or -n with no load segment.
9199 * output.cc (Output_segment::add_output_section): Don't crash if
9200 the first section is a TLS section.
9201 (Output_segment::set_section_list_addresses): Print an error
9202 message if the address moves backward in a linker script.
9203 * script-sections.cc
9204 (Output_section_element_input::set_section_addresses): Don't
9205 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9206 (Orphan_output_section::set_section_addresses): Likewise.
9207
9208 2009-10-15 Doug Kwan <dougkwan@google.com>
9209
9210 * layout.cc (Layout::finish_dynamic_section): Generate tags
9211 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9212 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9213 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9214
9215 2009-10-14 Ian Lance Taylor <iant@google.com>
9216
9217 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9218 fields.
9219 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9220 data_shdr fields of relinfo.
9221 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9222 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9223 R_386_TLS_LDO_32, adjust based on section flags.
9224 (Target_i386::Relocate::fix_up_ldo): Remove.
9225
9226 2009-10-13 Ian Lance Taylor <iant@google.com>
9227
9228 Add support for -pie.
9229 * options.h (class General_options): Add -pie and
9230 --pic-executable.
9231 (General_options::output_is_position_independent): Test -pie.
9232 (General_options::output_is_executable): Return true if not shared
9233 and not relocatable.
9234 (General_options::output_is_pie): Remove.
9235 * options.cc (General_options::finalize): Reject incompatible uses
9236 of -pie.
9237 * gold.cc (queue_middle_tasks): A -pie link is not static.
9238 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9239 * symtab.cc (Symbol::final_value_is_known): Return false if
9240 output_is_position_independent.
9241 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9242 output_is_position_independent.
9243 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9244 output_is_position_independent.
9245 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9246 output_is_position_independent.
9247 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9248 two_file_pie_test.
9249 (basic_pie_test.o, basic_pie_test): New targets.
9250 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9251 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9252 (two_file_pie_test): New target.
9253 * testsuite/Makefile.in: Rebuild.
9254 * README: Remove note saying that -pie is not supported.
9255
9256 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9257
9258 * options.h (class General_options): Add -init and -fini.
9259 * layout.cc (Layout::finish_dynamic_section): Emit
9260 given init and fini functions.
9261
9262 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9263
9264 * gc.h (gc_process_relocs): Check if icf is enabled using new
9265 function.
9266 * gold.cc (queue_initial_tasks): Likewise.
9267 (queue_middle_tasks): Likewise.
9268 * object.cc (do_layout): Likewise.
9269 * symtab.cc (is_section_folded): Likewise.
9270 * main.cc (main): Likewise.
9271 * reloc.cc (Read_relocs::run): Likewise.
9272 (Sized_relobj::do_scan_relocs): Likewise.
9273 * icf.cc (is_function_ctor_or_dtor): New function.
9274 (Icf::find_identical_sections): Check if function is ctor or dtor when
9275 safe icf is chosen.
9276 * options.h (General_options::icf): Change option to be an enum.
9277 (Icf_status): New enum.
9278 (icf_enabled): New method.
9279 (icf_safe_folding): New method.
9280 (set_icf_status): New method.
9281 (icf_status_): New variable.
9282 * (options.cc) (General_options::finalize): Set icf_status_.
9283 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9284 icf_test and icf_keep_unique_test to use the --icf enum flag.
9285 * testsuite/icf_safe_test.sh: New file.
9286 * testsuite/icf_safe_test.cc: New file.
9287
9288 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9289
9290 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9291 includes to gc.h and icf.h.
9292 * arm.cc: Include gc.h.
9293 * gold.cc: Likewise.
9294 * i386.cc: Likewise.
9295 * powerpc.cc: Likewise.
9296 * sparc.cc: Likewise.
9297 * x86_64.cc: Likewise.
9298 * gc.h: Include icf.h.
9299
9300 2009-10-11 Ian Lance Taylor <iant@google.com>
9301
9302 * plugin.cc: Include "gold.h" before other header files.
9303
9304 2009-10-10 Chris Demetriou <cgd@google.com>
9305
9306 * options.h (Input_file_argument::Input_file_type): New enum.
9307 (Input_file_argument::is_lib_): Replace with...
9308 (Input_file_argument::type_): New member.
9309 (Input_file_argument::Input_file_argument): Take Input_file_type
9310 'type' rather than boolean 'is_lib' as second argument.
9311 (Input_file_argument::is_lib): Use type_.
9312 (Input_file_argument::is_searched_file): New function.
9313 (Input_file_argument::may_need_search): Handle is_searched_file.
9314 * options.cc (General_options::parse_library): Support -l:filename.
9315 (General_options::parse_just_symbols): Update for Input_file_argument
9316 changes.
9317 (Command_line::process): Likewise.
9318 * archive.cc (Archive::get_file_and_offset): Likewise.
9319 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9320 * script.cc (read_script_file, script_add_file): Likewise.
9321 * fileread.cc (Input_file::Input_file): Likewise.
9322 (Input_file::will_search_for): Handle is_searched_file.
9323 (Input_file::open): Likewise.
9324 * readsyms.cc (Read_symbols::get_name): Likewise.
9325 * testsuite/Makefile.am (searched_file_test): New test.
9326 * testsuite/Makefile.in: Regenerate.
9327 * testsuite/searched_file_test.cc: New file.
9328 * testsuite/searched_file_test_lib.cc: New file.
9329
9330 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9331 Ian Lance Taylor <iant@google.com>
9332
9333 * descriptor.cc: Include <cstdio> and "binary-io.h".
9334 (Descriptors::open): Open the files in binary mode always.
9335 * script.cc (Lex::get_token): Treat \r as whitespace.
9336
9337 2009-10-09 Ian Lance Taylor <iant@google.com>
9338
9339 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9340
9341 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9342 Ian Lance Taylor <iant@google.com>
9343
9344 * configure.ac: Check for readv function also.
9345 * fileread.cc (readv): Define if not HAVE_READV.
9346 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9347 does not exist.
9348 * config.in: Regenerate.
9349 * configure: Regenerate.
9350
9351 2009-10-09 Doug Kwan <dougkwan@google.com>
9352
9353 * layout.cc (Layout::make_output_section): Call target hook to make
9354 ordinary output section.
9355 (Layout::finalize): Adjust parameter list of call the
9356 Target::may_relax().
9357 * layout.h (class Layout::section_list): New method.
9358 * merge.h (Output_merge_base::entsize): Change visibility to public.
9359 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9360 New methods.
9361 (Output_merge_string::do_is_string): New method.
9362 * object.cc (Sized_relobj::do_setup): renamed from
9363 Sized_relobj::set_up.
9364 * object.h (Sized_relobj::adjust_shndx,
9365 Sized_relobj::initializ_input_to_output_maps,
9366 Sized_relobj::free_input_to_output_maps): Change visibilities to
9367 protected.
9368 (Sized_relobj::setup): Virtualize.
9369 (Sized_relobj::do_setup): New method declaration.
9370 (Sized_relobj::invalidate_section_offset,
9371 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9372 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9373 * options.cc (parse_int): New function.
9374 * options.h (parse_int): New declaration.
9375 (DEFINE_int): New macro.
9376 (stub_group_size): New option.
9377 * output.cc (Output_section::Output_section): Initialize memebers
9378 merge_section_map_, merge_section_by_properties_map_,
9379 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9380 (Output_section::add_input_section): Handled deferred code-fill
9381 generation and remove an old comment.
9382 (Output_section::add_relaxed_input_section): New method definition.
9383 (Output_section::add_merge_input_section): Use merge section by
9384 properties map to speed to search. Update merge section maps
9385 as appropriate.
9386 (Output_section::build_relaxation_map): New method definition.
9387 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9388 Same.
9389 (Output_section::relax_input_section): Renamed to
9390 Output_section::convert_input_sections_to_relaxed_sections and change
9391 interface to take a vector of pointers to relaxed sections.
9392 (Output_section::find_merge_section,
9393 Output_section::find_relaxed_input_section): New method definitions.
9394 (Output_section::is_input_address_mapped,
9395 Output_section::output_offset, Output_section::output_address):
9396 Use output section data maps to speed up searching.
9397 (Output_section::find_starting_output_address): Add comments.
9398 (Output_section::do_write,
9399 Output_section::write_to_postprocessing_buffer): Do code-fill
9400 generation as appropriate.
9401 (Output_section::get_input_sections): Invalidate relaxed input section
9402 map.
9403 (Output_section::restore_states): Adjust type of checkpoint .
9404 Invalidate relaxed input section map.
9405 * output.h (Output_merge_base): New class declaration.
9406 (Input_section_specifier): New class defintion.
9407 (class Output_relaxed_input_section) Change base class to
9408 Output_section_data_build.
9409 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9410 base class initializer.
9411 (Output_section::add_relaxed_input_section): New method declaration.
9412 (Output_section::Input_section): Change visibility to protected.
9413 (Output_section::Input_section::relobj,
9414 Output_section::Input_section::shndx): Handle relaxed input sections.
9415 Output_section::input_sections) Change visibility to protected. Also
9416 define overload to return a non-const pointer.
9417 (Output_section::Merge_section_properties): New class defintion.
9418 (Output_section::Merge_section_by_properties_map,
9419 Output_section::Output_section_data_by_input_section_map,
9420 Output_section::Relaxation_map): New types.
9421 (Output_section::relax_input_section): Rename method to
9422 Output_section::convert_input_sections_to_relaxed_sections and change
9423 interface to take a vector of relaxed section pointers.
9424 (Output_section::find_merge_section,
9425 Output_section::find_relaxed_input_section,
9426 Output_section::build_relaxation_map,
9427 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9428 New method declarations.
9429 (Output_section::merge_section_map_
9430 Output_section::merge_section_by_properties_map_,
9431 Output_section::relaxed_input_section_map_,
9432 Output_section::is_relaxed_input_section_map_valid_,
9433 Output_section::generate_code_fills_at_write_): New data members.
9434 * script-sections.cc
9435 (Output_section_element_input::set_section_addresses): Call
9436 current_data_size and addralign methods of relaxed input sections.
9437 (Orphan_output_section::set_section_addresses): Call current_data_size
9438 and addralign methods of relaxed input sections.
9439 * symtab.cc (Symbol_table::compute_final_value): Extract template
9440 from the body of Symbol_table::sized_finalize_symbol.
9441 (Symbol_table::sized_finalized_symbol): Call
9442 Symbol_table::compute_final_value.
9443 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9444 (Symbol_table::compute_final_value): New templated method declaration.
9445 * target.cc (Target::do_make_output_section): New method defintion.
9446 * target.h (Target::make_output_section): New method declaration.
9447 (Target::relax): Add more parameters for input objects, symbol table
9448 and layout. Adjust call to do_relax.
9449 (Target::do_make_output_section): New method declaration.
9450 (Target::do_relax): Add parameters for input objects, symbol table
9451 and layout.
9452
9453 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9454
9455 * pread.c: Include stdio.h.
9456
9457 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9458
9459 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9460 defined.
9461
9462 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9463
9464 * dwarf_reader.cc (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 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9470 Change read_shndx type to unsigned int.
9471 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9472 int.
9473 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9474 * layout.cc (Layout::create_symtab_sections): Cast the result of
9475 local_symcount * symsize to off_t in the gold_assert.
9476
9477 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9478
9479 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9480 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9481 R_ARM_BASE_ABS.
9482 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9483 (Arm_relocate_functions::thm_abs5): New function.
9484 (Arm_relocate_functions::abs12): New function.
9485 (Arm_relocate_functions::abs16): New function.
9486 (Arm_relocate_functions::base_abs): New function.
9487 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9488 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9489 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9490 R_ARM_BASE_ABS.
9491 (Scan::global): Likewise.
9492 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9493 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9494 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9495 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9496 R_ARM_BASE_ABS.
9497
9498 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9499
9500 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9501 (Arm_relocate_functions::movt_prel): New function.
9502 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9503 (Arm_relocate_functions::thm_movt_prel): New function.
9504 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9505 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9506 (Scan::global, Relocate::relocate): Likewise.
9507 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9508
9509 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9510
9511 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9512 Incremental_checker.
9513 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9514 unsigned int.
9515 (class Incremental_inputs_header): New class.
9516 (Incremental_inputs_header_writer): Edit comment.
9517 (Incremental_inputs_entry): New class.
9518 (Incremental_inputs_entry_writer): Edit comment.
9519 (Sized_incremental_binary::do_find_incremental_inputs_section):
9520 Add *strtab_shndx parameter, fill it.
9521 (Sized_incremental_binary::do_check_inputs): New method.
9522 (Incremental_checker::can_incrementally_link_output_file): Use
9523 Sized_incremental_binary::check_inputs.
9524 (Incremental_inputs::report_command_line): Save command line in
9525 command_line_.
9526 * incremental.h:
9527 (Incremental_binary::find_incremental_inputs_section): New
9528 method.
9529 (Incremental_binary::do_find_incremental_inputs_section): Add
9530 strtab_shndx parameter.
9531 (Incremental_binary::do_check_inputs): New pure virtual method.
9532 (Sized_incremental_binary::do_check_inputs): Declare.
9533 (Incremental_checker::Incremental_checker): Add incremental_inputs
9534 parameter, use it to initialize incremental_inputs_.
9535 (Incremental_checker::incremental_inputs_): New field.
9536 (Incremental_checker::command_line): New method.
9537 (Incremental_checker::inputs): New method.
9538 (Incremental_checker::command_line_): New field.
9539
9540 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9541
9542 * incremental.cc: Include <cstdarg> and "target-select.h".
9543 (vexplain_no_incremental): New function.
9544 (explain_no_incremental): New function.
9545 (Incremental_binary::error): New method.
9546 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9547 method.
9548 (make_sized_incremental_binary): New function.
9549 (open_incremental_binary): New function.
9550 (can_incrementally_link_file): Add checks if output is ELF and has
9551 inputs section.
9552 * incremental.h: Include "elfcpp_file.h" and "output.h".
9553 (Incremental_binary): New class.
9554 (Sized_incremental_binary): New class.
9555 (open_incremental_binary): Declare.
9556 * object.cc (is_elf_object): Use
9557 elfcpp::Elf_recognizer::is_elf_file.
9558 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9559 * output.h (Output_file::filesize): New method.
9560
9561 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9562
9563 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9564 New function.
9565 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9566 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9567 function.
9568 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9569 function.
9570 (Arm_relocate_functions::movw_abs_nc): New function.
9571 (Arm_relocate_functions::movt_abs): New function.
9572 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9573 (Arm_relocate_functions::thm_movt_abs): New function.
9574 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9575 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9576 (Scan::global): Likewise.
9577 (Relocate::relocate): Likewise.
9578 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9579
9580 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9581
9582 * arm.cc (Arm_relocate_functions::got_prel) New function.
9583 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9584 (Relocate::relocate): Likewise.
9585 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9586
9587 2009-10-06 Ian Lance Taylor <iant@google.com>
9588
9589 * options.h (class General_options): Define
9590 split_stack_adjust_size parameter.
9591 * object.h (class Object): Add uses_split_stack_ and
9592 has_no_split_stack_ fields. Add uses_split_stack and
9593 has_no_split_stack accessor functions. Declare
9594 handle_split_stack_section.
9595 (class Reloc_symbol_changes): Define.
9596 (class Sized_relobj): Define Function_offsets. Declare
9597 split_stack_adjust, split_stack_adjust_reltype, and
9598 find_functions.
9599 * object.cc (Object::handle_split_stack_section): New function.
9600 (Sized_relobj::do_layout): Call handle_split_stack_section.
9601 * dynobj.cc (Sized_dynobj::do_layout): Call
9602 handle_split_stack_section.
9603 * reloc.cc (Sized_relobj::relocate_sections): Call
9604 split_stack_adjust for executable sections in split_stack
9605 objects. Pass reloc_map to relocate_section.
9606 (Sized_relobj::split_stack_adjust): New function.
9607 (Sized_relobj::split_stack_adjust_reltype): New function.
9608 (Sized_relobj::find_functions): New function.
9609 * target-reloc.h: Include "object.h".
9610 (relocate_section): Add reloc_symbol_changes parameter. Change
9611 all callers.
9612 * target.h (class Target): Add calls_non_split method. Declare
9613 do_calls_non_split virtual method. Declare match_view and
9614 set_view_to_nop.
9615 * target.cc: Include "elfcpp.h".
9616 (Target::do_calls_non_split): New function.
9617 (Target::match_view): New function.
9618 (Target::set_view_to_nop): New function.
9619 * gold.cc (queue_middle_tasks): Give an error if mixing
9620 split-stack and non-split-stack objects with -r.
9621 * i386.cc (Target_i386::relocate_section): Add
9622 reloc_symbol_changes parameter.
9623 (Target_i386::do_calls_non_split): New function.
9624 * x86_64.cc (Target_x86_64::relocate_section): Add
9625 reloc_symbol_changes parameter.
9626 (Target_x86_64::do_calls_non_split): New function.
9627 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9628 parameter.
9629 * powerpc.cc (Target_powerpc::relocate_section): Add
9630 reloc_symbol_changes parameter.
9631 * sparc.cc (Target_sparc::relocate_section): Add
9632 reloc_symbol_changes parameter.
9633 * configure.ac: Call AM_CONDITIONAL for the default target.
9634 * configure: Rebuild.
9635 * testsuite/Makefile.am (TEST_AS): New variable.
9636 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9637 (check_DATA): Add split_i386 and split_x86_64 files.
9638 (SPLIT_DEFSYMS): Define.
9639 (split_i386_[1234n].o): New targets.
9640 (split_i386_[124]): New targets.
9641 (split_i386_[1234r].stdout): New targets.
9642 (split_x86_64_[1234n].o): New targets.
9643 (split_x86_64_[124]): New targets.
9644 (split_x86_64_[1234r].stdout): New targets.
9645 (MOSTLYCLEANFILES): Add new executables.
9646 * testsuite/split_i386.sh: New file.
9647 * testsuite/split_x86_64.sh: New file.
9648 * testsuite/split_i386_1.s: New file.
9649 * testsuite/split_i386_2.s: New file.
9650 * testsuite/split_i386_3.s: New file.
9651 * testsuite/split_i386_4.s: New file.
9652 * testsuite/split_i386_n.s: New file.
9653 * testsuite/split_x86_64_1.s: New file.
9654 * testsuite/split_x86_64_2.s: New file.
9655 * testsuite/split_x86_64_3.s: New file.
9656 * testsuite/split_x86_64_4.s: New file.
9657 * testsuite/split_x86_64_n.s: New file.
9658 * testsuite/testfile.cc (Target_test): Update relocation_section
9659 function.
9660 * testsuite/Makefile.in: Rebuild.
9661
9662 2009-10-06 Ian Lance Taylor <iant@google.com>
9663
9664 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9665 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9666 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9667 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9668 the address on ldo_addrs_.
9669 (Target_i386::Relocate::fix_up_ldo): New function.
9670
9671 2009-10-06 Rafael Espindola <espindola@google.com>
9672
9673 * plugin.cc (add_input_library): New.
9674 (Plugin::load): Add add_input_library to tv.
9675 (Plugin_manager::add_input_file): Add the is_lib argument.
9676 (add_input_file): Update call to Plugin_manager::add_input_file.
9677 (add_input_library): New.
9678 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9679
9680 2009-09-30 Doug Kwan <dougkwan@google.com>
9681
9682 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9683 symbol and call Symbol::may_need_copy_reloc to determine if
9684 a copy reloc is needed.
9685 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9686 nocopyreloc is given in command line.
9687 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9688 given in command line.
9689 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9690 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9691 of the removed Target_i386::may_need_copy_reloc.
9692 * options.h (copyreloc): New option with default value false.
9693 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9694 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9695 instead of the removed Target_powerpc::may_need_copy_reloc.
9696 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9697 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9698 instead of the removed Target_sparc::may_need_copy_reloc.
9699 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9700 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9701 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9702 instead of the removed Target_x86_64::may_need_copy_reloc.
9703
9704 2009-09-30 Ian Lance Taylor <iant@google.com>
9705
9706 * object.h (class Object): Remove target_ field, and target,
9707 sized_target, and set_target methods.
9708 (Object::sized_target): Remove.
9709 (class Sized_relobj): Update declarations. Remove sized_target.
9710 * object.cc (Sized_relobj::setup): Remove target parameter.
9711 Change all callers.
9712 (Input_objects::add_object): Don't do anything with the target.
9713 (make_elf_sized_object): Add punconfigured parameter. Change all
9714 callers. Set or test parameter target.
9715 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9716 Change all callers.
9717 * parameters.cc (Parameters::set_target): Change parameter type to
9718 be non-const.
9719 (Parameters::default_target): Remove.
9720 (set_parameters_target): Change parameter type to be non-const.
9721 (parameters_force_valid_target): New function.
9722 (parameters_clear_target): New function.
9723 * parameters.h (class Parameters): Update declarations. Remove
9724 default_target method. Add sized_target and clear_target
9725 methods. Change target_ to be non-const.
9726 (set_parameters_target): Update declaration.
9727 (parameters_force_valid_target): Declare.
9728 (parameters_clear_target): Declare.
9729 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9730 as NULL if we aren't searching.
9731 (Add_symbols::run): Don't check for compatible target.
9732 * fileread.cc (Input_file::open_binary): Call
9733 parameters_force_valid_target.
9734 * gold.cc (queue_middle_tasks): Likewise.
9735 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9736 set_target on object.
9737 * dynobj.h (class Sized_dynobj): Update declarations.
9738 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9739 make_elf_object returns NULL.
9740 (Archive::include_member): Don't check whether object target is
9741 compatible.
9742 * output.cc (Output_section::add_input_section): Get target from
9743 parameters.
9744 (Output_section::relax_input_section): Likewise.
9745 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9746 parameters.
9747 (Sized_relobj::do_scan_relocs): Likewise.
9748 (Sized_relobj::relocate_sections): Likewise.
9749 * resolve.cc (Symbol_table::resolve): Likewise.
9750 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9751 parameter. Change all callers.
9752 (Symbol_table::add_from_object): Get target from parameters.
9753 (Symbol_table::add_from_relobj): Don't check object target.
9754 (Symbol_table::add_from_dynobj): Likewise.
9755 (Symbol_table::define_special_symbol): Get target from
9756 parameters.
9757 * symtab.h (class Symbol_table): Update declaration.
9758 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9759 parameter. Change all callers. Clear parameter target.
9760 (Binary_test): Test target here.
9761 * testsuite/object_unittest.cc (gold_testsuite): Remove
9762 target_test_pointer parameter. Change all callers.
9763 (Object_test): Test target here.
9764
9765 2009-09-26 Ian Lance Taylor <iant@google.com>
9766
9767 * testsuite/initpri1.c: Don't try to use constructor priorities if
9768 compiling with gcc before 4.3.
9769
9770 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9771
9772 * testsuite/retain_symbols_file_test.sh (check_present): Change
9773 output file name to retain_symbols_file_test.stdout.
9774 (check_absent): Likewise.
9775
9776 2009-09-18 Craig Silverstein <csilvers@google.com>
9777
9778 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9779 * options.cc: Include <cerrno> and <fstream>.
9780 (General_options::finalize): Parse -retain-symbols-file tag.
9781 * options.h: New flag.
9782 (General_options): New method should_retain_symbol, new
9783 variable symbols_to_retain.
9784 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9785 should_retain_symbol map.
9786 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9787 * testsuite/Makefile.in: Regenerate.
9788 * testsuite/retain_symbols_file_test.sh: New file.
9789
9790 2009-09-18 Nick Clifton <nickc@redhat.com>
9791
9792 * po/es.po: Updated Spanish translation.
9793
9794 2009-09-17 Doug Kwan <dougkwan@google.com>
9795
9796 * debug.h (DEBUG_RELAXATION): New constant.
9797 (DEBUG_ALL): Add DEBUG_RELAXATION.
9798 (debug_string_to_enum): Add relaxation debug option.
9799 * layout.cc
9800 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9801 Layout::Relaxation_debug_check::read_sections,
9802 Layout::Relaxation_debug_check::read_sections): New method definitions.
9803 (Layout::Layout): Initialize data members
9804 record_output_section_data_from_scrips_,
9805 script_output_section_data_list_ and relaxation_debug_check_.
9806 (Layout::save_segments, Layout::restore_segments,
9807 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9808 Layout::relaxation_loop_body): New method definitions.
9809 (Layout::finalize): Support relaxation. Move section layout code to
9810 Layout::relaxation_loop_body.
9811 (Layout::set_asection_address_from_script): Move code for orphan
9812 section placement out.
9813 (Layout::place_orphan_sections_in_script): New method definition.
9814 * layout.h (Output_segment_headers, Output_file_header):
9815 New forward class declarations.
9816 (Layout::~Layout): Define.
9817 (Layout::new_output_section_data_from_script): New method definition.
9818 (Layout::place_orphan_sections_in_script): New method declaration.
9819 (Layout::Segment_states): New type declaration.
9820 (Layout::save_segments, Layout::restore_segments,
9821 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9822 Layout::relaxation_loop_body): New method declarations.
9823 (Layout::Output_section_data_list): New type declaration.
9824 (Layout::Relaxation_debug_check): New class definition.
9825 (Layout::record_output_section_data_from_script_,
9826 Layout::script_output_section_data_list_, Layout::segment_states_,
9827 Layout::relaxation_debug_check_): New data members.
9828 * output.cc: (Output_section_headers::do_size): New method definition.
9829 (Output_section_headers::Output_section_headers): Move size
9830 computation to Output_section_headers::do_size.
9831 (Output_segment_headers::do_size): New method definition.
9832 (Output_file_header::Output_file_header): Move size computation to
9833 Output_file_header::do_size and call it.
9834 (Output_file_header::do_size): New method definition.
9835 (Output_data_group::Output_data_group): Adjust call to
9836 Output_section_data.
9837 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9838 (Output_symtab_xindex::do_write): Add array bound check.
9839 (Output_section::Input_section::print_to_mapfile): Handle
9840 RELAXED_INPUT_SECTION_CODE.
9841 (Output_section::Output_section): Initialize data member checkpoint_.
9842 (Output_section::~Output_section): Delete checkpoint object pointed
9843 by checkpoint_.
9844 (Output_section::add_input_section): Always add an Input_section if
9845 relaxing.
9846 (Output_section::add_merge_input_section): Add assert.
9847 (Output_section::relax_input_section): New method definition.
9848 (Output_section::set_final_data_size): Set load address to zero for
9849 an unallocated section.
9850 (Output_section::do_address_and_file_offset_have_reset_values):
9851 New method definition.
9852 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9853 Handle relaxed input section.
9854 (Output_section::sort_attached_input_sections): Checkpoint input
9855 section list lazily.
9856 (Output_section::get_input_sections): Change type of input_sections to
9857 list of Simple_input_section pointers. Checkpoint input section list
9858 lazily. Also handle relaxed input sections.
9859 (Output_section::add_input_section_for_script): Take a reference to
9860 a Simple_input_section object instead of Relobj pointer and section
9861 index as parameter. Handle relaxed input sections.
9862 (Output_section::save_states, Output_section::restore_states): New
9863 method definitions.
9864 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9865 (Output_data::is_data_size_fixed): New method definition.
9866 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9867 if it is fixed.
9868 (Output_data::address_and_file_offset_have_reset_values): New method
9869 definition.
9870 (Output_data::do_address_and_file_offset_have_reset_values): New method
9871 definition.
9872 (Output_data::set_data_size): Check that data size is not fixed.
9873 (Output_data::fix_data_size): New method definition.
9874 (Output_data::is_data_size_fixed_): New data member.
9875 (Output_section_headers::set_final_data_size): New method definition.
9876 (Output_section_headers::do_size): New method declaration.
9877 (Output_segment_headers::set_final_data_size): New method definition.
9878 (Output_segment_headers::do_size): New method declaration.
9879 (Output_file_header::set_final_data_size)::New method definition.
9880 (Output_file_header::do_size)::New method declaration.
9881 (Output_section_data::Output_section_data): Add new parameter
9882 is_data_size_fixed and use it to fix data size.
9883 (Output_data_const::Output_data_const): Adjust call to base class
9884 constructor and fix data size.
9885 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9886 base class constructor and fix data size.
9887 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9888 base class constructor and fix data size.
9889 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9890 class constructor and fix data size.
9891 (Output_data_group::set_final_data_size): New method definition.
9892 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9893 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9894 class constructor and fix data size.
9895 (Output_relaxed_input_section): New class definition.
9896 (Output_section::Simple_input_section): New class definition.
9897 (Output_section::get_input_sections): Adjust parameter list.
9898 (Output_section::add_input_section_for_script): Same.
9899 (Output_section::save_states, Output_section::restore_states,
9900 Output_section::do_address_and_file_offset_have_reset_values,
9901 (Output_section::Input_section::Input_section): Handle
9902 RELAXED_INPUT_SECTION_CODE. Add new overload for
9903 Output_relaxed_input_section.
9904 (Output_section::Input_section::is_input_section,
9905 Output_section::Input_section::set_output_section): Handle relaxed
9906 input section.
9907 (Output_section::Input_section::is_relaxed_input_section,
9908 Output_section::Input_section::output_section_data,
9909 Output_section::Input_section::relaxed_input_section): New method
9910 definitions.
9911 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9912 value.
9913 (Output_section::Input_section::u1_): Update comments.
9914 (Output_section::Input_section::u2_): Add new union member poris.
9915 (Output_section::Checkpoint_output_section): New classs definition.
9916 (Output_section::relax_input_section): New method declaration.
9917 (Output_section::checkpoint_): New data member.
9918 (Output_segment): Update comments.
9919 (Output_segment::Output_segment): Un-privatize copy constructor.
9920 (Output_segment::operator=): Un-privatize.
9921 * script-sections.cc (Output_section_element::Input_section_list):
9922 Change element type to Output_section::Simple_input_section.
9923 (Output_section_element_dot_assignment::set_section_addresses):
9924 Register output section data for relaxation clean up.
9925 (Output_data_exression::Output_data_expression): Adjust call to base
9926 constructor to fix data size.
9927 (Output_section_element_data::set_section_addresses): Register
9928 Output_data_expression object for relaxation clean up.
9929 (struct Input_section_info): Replace Relobj pointer and section index
9930 pair with Output_section::Simple_input_section and Convert struct to a
9931 class.
9932 (Input_section_sorter::operator()): Adjust access to
9933 Input_section_info data member to use accessors.
9934 (Output_section_element_input::set_section_addresses): Use layout
9935 parameter. Adjust code to use Output_section::Simple_input_section
9936 and Input_secction_info classes. Register filler for relaxation
9937 clean up.
9938 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9939 and section index pair with Output_section::Simple_input_section
9940 class. Adjust code accordingly.
9941 (Phdrs_element::release_segment): New method definition.
9942 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9943 segment list.
9944 (Script_sections::release_segments): New method definition.
9945 * gold/script-sections.h (Script_sections::release_segments): New
9946 method declaration.
9947 * gold/target.h (Target::may_relax, Target::relax,
9948 Target::do_may_relax, Target::do_relax): New method definitions.
9949
9950 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9951
9952 * arm.cc (has_signed_unsigned_overflow): New function.
9953 (Arm_relocate_functions::abs8): New function.
9954 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9955 (Target_arm::Scan::global): Likewise.
9956 (Target_arm::relocate::relocate): Likewise.
9957 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9958 Likewise.
9959
9960 2009-09-16 Cary Coutant <ccoutant@google.com>
9961
9962 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9963 * testsuite/Makefile.in: Regenerate.
9964
9965 2009-09-11 Nick Clifton <nickc@redhat.com>
9966
9967 * po/gold.pot: Updated by the Translation project.
9968
9969 2009-09-08 Cary Coutant <ccoutant@google.com>
9970
9971 * output.cc (Output_file::open): Add execute permission to empty file.
9972 * testsuite/Makefile.am (permission_test): New test.
9973 * testsuite/Makefile.in: Regenerate.
9974
9975 2009-09-02 Ian Lance Taylor <iant@google.com>
9976
9977 * output.cc (Output_file::resize): Call map_no_anonymous rather
9978 than map.
9979
9980 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9981
9982 * gold.cc: Include "incremental.h".
9983 (queue_initial_tasks): Call Incremental_checker methods.
9984 * incremental.cc: Include "output.h".
9985 (Incremental_checker::can_incrementally_link_output_file): New
9986 method.
9987 * incremental.h (Incremental_checker): New class.
9988
9989 * output.cc (Output_file::open_for_modification): New method.
9990 (Output_file::map_anonymous): Changed return type to bool. Record
9991 map in base_ field.
9992 (Output_file::map_no_anonymous): New method, broken out of map.
9993 (Output_file::map): Use map_no_anonymous and map_anonymous.
9994 * output.h (class Output_file): Update declarations.
9995
9996 2009-08-24 Cary Coutant <ccoutant@google.com>
9997
9998 * options.h (Command_line::Pre_options): New class.
9999 (Command_line::pre_options): New member.
10000 * options.cc (gold::options::ready_to_register): New variable.
10001 (One_option::register_option): Do nothing if not registering options.
10002 Assert if same short option registered twice.
10003 (General_options::General_options): Turn off option registration when
10004 done constructing.
10005 (Command_line::Pre_options::Pre_options): New constructor.
10006
10007 2009-08-24 Cary Coutant <ccoutant@google.com>
10008
10009 * options.h (General_options::no_keep_memory): Remove incorrect
10010 short option.
10011
10012 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10013
10014 * Makefile.am (am__skiplex, am__skipyacc): New.
10015 * Makefile.in: Regenerate.
10016
10017 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10018
10019 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10020 (INCLUDES): ... this.
10021 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10022 (AM_CPPFLAGS): Renamed from ...
10023 (INCLUDE): ... this.
10024 * Makefile.in, testsuite/Makefile.in: Regenerate.
10025
10026 * Makefile.in: Regenerate.
10027 * aclocal.m4: Likewise.
10028 * config.in: Likewise.
10029 * configure: Likewise.
10030 * testsuite/Makefile.in: Likewise.
10031
10032 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10033 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10034 * Makefile.in: Regenerate.
10035 * testsuite/Makefile.in: Regenerate.
10036
10037 2009-08-19 Cary Coutant <ccoutant@google.com>
10038
10039 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10040 symbols in shared libraries overridden by hidden or internal symbols
10041 in the main program.
10042
10043 2009-08-19 Chris Demetriou <cgd@google.com>
10044
10045 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10046 checking source file names in error messages.
10047
10048 2009-08-18 Doug Kwan <dougkwan@google.com>
10049
10050 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10051 an elcpp::Ehdr as parameter. Adjust call to set_target.
10052 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10053 an elfcpp::Ehdr as parameter.
10054 * object.cc (Object::set_target): Remove the version that looks up
10055 a target and sets it.
10056 (Sized_relobj::setup): Take a Target object instead of
10057 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10058 (make_elf_sized_object): Find target and ask target to
10059 make an ELF object.
10060 * object.h: (Object::set_target): Remove the version that looks up
10061 a target and sets it.
10062 (Sized_relobj::setup): Take a Target object instead of
10063 an elfcpp:Ehdr as parameter.
10064 * target.cc: Include dynobj.h.
10065 (Target::do_make_elf_object_implementation): New.
10066 (Target::do_make_elf_object): New.
10067 * target.h (Target::make_elf_object): New template declaration.
10068 (Target::do_make_elf_object): New method declarations.
10069 (Target::do_make_elf_object_implementation): New template declaration.
10070
10071 2009-08-14 Ian Lance Taylor <iant@google.com>
10072
10073 * gold.h (FUNCTION_NAME): Define.
10074 (gold_unreachable): Use FUNCTION_NAME.
10075
10076 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10077
10078 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10079 symbol in the --keep-unique list is not found.
10080
10081 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10082
10083 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10084 been maked as --keep-unique.
10085 (Icf::unfold_section): New function.
10086 * icf.h (Icf::unfold_section): New function.
10087 * options.h (General_options::keep_unique): New option.
10088 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10089 * testsuite/Makefile.in: Regenerate.
10090 * testsuite/icf_keep_unique_test.sh: New file.
10091 * testsuite/icf_keep_unique_test.cc: New file.
10092
10093 2009-08-12 Cary Coutant <ccoutant@google.com>
10094
10095 PR 10471
10096 * resolve.cc (Symbol_table::resolve): Check for references from
10097 dynamic objects to hidden and internal symbols.
10098 * testsuite/Makefile.am (hidden_test.sh): New test.
10099 * testsuite/Makefile.in: Regenerate.
10100 * testsuite/hidden_test.sh: New script.
10101 * testsuite/hidden_test_1.c: New test source.
10102 * testsuite/hidden_test_main.c: New test source.
10103
10104 2009-08-11 Doug Kwan <dougkwan@google.com>
10105
10106 * arm.cc: Update comments.
10107 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10108 segment to locate the .ARM.exidx section if present.
10109
10110 2009-08-09 Doug Kwan <dougkwan@google.com>
10111
10112 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10113 patch.
10114
10115 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10116 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10117 compiler warnings.
10118
10119 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10120
10121 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10122 valid tls_segment only for non-debug-section relocations.
10123 * testsuite/Makefile.am: Add gc_tls_test.
10124 * testsuite/Makefile.in: Regenerate.
10125 * testsuite/gc_tls_test.cc: New file.
10126 * testsuite/gc_tls_test.sh: New file.
10127
10128 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10129
10130 * icf.cc: New file.
10131 * icf.h: New file.
10132 * Makefile.am (CCFILES): Add icf.cc.
10133 (HFILES): Add icf.h
10134 * Makefile.in: Regenerate.
10135 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10136 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10137 section, symbol and addend information for the relocs.
10138 * gold.cc (queue_middle_tasks): Call identical code folding.
10139 * gold.h: Add defines for multimap.
10140 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10141 to the call of finalize_local_symbols.
10142 * main.cc (main): Create object of class Icf.
10143 * object.cc (Sized_relobj::do_layout): Allow this function to be
10144 called twice during icf.
10145 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10146 to sections marked as identical by icf.
10147 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10148 when available.
10149 (Sized_relobj::do_section_entsize): New function.
10150 * object.h (Object::section_entsize): New function.
10151 (Object::do_section_entsize): New pure virtual function.
10152 (Relobj::finalize_local_symbols): Add new parameter.
10153 (Relobj::do_section_entsize): New function.
10154 * options.h (General_options::icf): New option.
10155 (General_options::icf_iterations): New option.
10156 (General_options::print_icf_sections): New option.
10157 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10158 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10159 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10160 icf.
10161 * symtab.cc (Symbol_table::is_section_folded): New function.
10162 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10163 to sections marked as identical by icf.
10164 * symtab.h (Symbol_table::set_icf): New function.
10165 (Symbol_table::icf): New function.
10166 (Symbol_table::is_section_folded): New function.
10167 (Symbol_table::icf_): New data member.
10168 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10169 * testsuite/Makefile.am: Add commands to build icf_test.
10170 * testsuite/Makefile.in: Regenerate.
10171 * testsuite/icf_test.sh: New file.
10172 * testsuite/icf_test.cc: New file.
10173
10174 2009-07-24 Chris Demetriou <cgd@google.com>
10175
10176 * layout.cc (is_compressible_debug_section): Fix incorrect
10177 comment about compressed section names.
10178
10179 2009-07-20 Ian Lance Taylor <ian@airs.com>
10180
10181 PR 10419
10182 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10183
10184 2009-07-16 Ian Lance Taylor <iant@google.com>
10185
10186 PR 10400
10187 * layout.h: #include <map>.
10188 (class Kept_section): Change from struct to class. Add accessors
10189 and setters. Add section size to Comdat_group mapping. Change
10190 Comdat_group to std::map. Add is_comdat_ field. Add
10191 linkonce_size field in union.
10192 (class Layout): Update declaration of find_or_add_kept_section.
10193 Don't declare find_kept_object.
10194 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10195 parameter. Add object, shndx, is_comdat, and is_group_name
10196 parameters. Change all callers. Adjust for new Kept_section.
10197 (Layout::find_kept_object): Remove.
10198 * object.cc (Sized_relobj::include_section_group): Update use of
10199 Kept_section. Rename secnum to shndx. Only record
10200 Kept_comdat_section if sections are the same size.
10201 (Sized_relobj::include_linkonce_section): Update use of
10202 Kept_section. Only record Kept_comdat_section if sections are the
10203 same size. Set size of linkonce section.
10204 (Sized_relobj::map_to_kept_section): Update call to
10205 get_kept_comdat_section.
10206 * object.h (class Sized_relobj): Rename fields in
10207 Kept_comdat_section to drop trailing underscores; change object
10208 field to Relobj*. Change Kept_comdat_section_table to store
10209 struct rather than pointer.
10210 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10211 Add kept_object and kept_shndx parameters. Change all callers.
10212 (Sized_relobj::get_kept_comdat_section): Change return type to
10213 bool. Add kept_object and kept_shndx parameters. Change all
10214 callers.
10215 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10216 Layout::find_or_add_kept_section.
10217
10218 2009-07-09 Ian Lance Taylor <iant@google.com>
10219
10220 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10221 Reserve space in the hash table.
10222
10223 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10224
10225 * fileread.cc (File_read::get_mtime): New method.
10226 * fileread.h (Timespec): New structure.
10227 (File_read::get_mtime): New method.
10228 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10229 Renamed from timestamp_nsec.
10230 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10231 Elf_Xword.
10232 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10233 timestamp_nsec.
10234 (Incremental_inputs::report_archive): Save mtime; style fix.
10235 (Incremental_inputs::report_obejct): Save mtime; style fix.
10236 (Incremental_inputs::report_script): Save mtime; style fix.
10237 (Incremental_inputs::finalize_inputs): Style fix.
10238 (Incremental_inputs::finalize): Style fix.
10239 (Incremental_inputs::create_input_section_data): Store inputs
10240 mtime.
10241 * incremental.h (Incremental_inputs::report_script): Add mtime
10242 argument.
10243 (Incremental_inputs::Input_info::Input_info): Intialize only one
10244 union member.
10245 (Incremental_inputs::Input_info::archive): Move to nameless
10246 union.
10247 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10248 (Incremental_inputs::Input_info::script): Move to nameless union.
10249 (Incremental_inputs::mtime): New field.
10250 * script.cc (read_input_script): Pass file mtime to
10251 Incremental_input.
10252 * script.h (Script_info::inputs): Style fix.
10253
10254 2009-07-01 Ian Lance Taylor <ian@airs.com>
10255
10256 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10257 instead of 32.
10258
10259 2009-06-24 Ian Lance Taylor <iant@google.com>
10260
10261 PR 10156
10262 * layout.cc (Layout::choose_output_section): If we find an
10263 existing section, update the flags.
10264 (Layout::create_notes): New function, broken out of
10265 Layout::finalize.
10266 (Layout::finalize): Don't create note sections.
10267 (Layout::create_note): Don't crash if linker script discards
10268 section.
10269 (Layout::create_gold_note): Likewise.
10270 (Layout::create_build_id): Likewise. Don't set
10271 after_input_sections on the section.
10272 (Layout::create_executable_stack_info): Remove target parameter.
10273 Change caller.
10274 * layout.h (class Layout): Declare create_notes. Update
10275 declaration of create_executable_stack_info.
10276 * gold.cc (queue_middle_tasks): Call create_notes.
10277 * output.cc (Output_section::update_flags_for_input_section): Move
10278 here from output.h. If SHF_ALLOC flag is newly set, mark address
10279 invalid.
10280 * output.h (Output_data::mark_address_invalid): New function.
10281 (class Output_section): Only declare, not define,
10282 update_flags_for_input_section. Remove set_flags.
10283
10284 2009-06-24 Ian Lance Taylor <iant@google.com>
10285
10286 * script-sections.cc (Output_section_definition::
10287 set_section_addresses): Rename shadowing local load_address to
10288 laddr.
10289
10290 2009-06-24 Ian Lance Taylor <iant@google.com>
10291
10292 PR 10244
10293 * reloc.cc (relocate_sections): Skip empty relocation sections.
10294
10295 2009-06-23 Ian Lance Taylor <iant@google.com>
10296
10297 PR 10156
10298 * layout.cc (Layout::create_note): Use choose_output_section
10299 rather than make_output_section.
10300
10301 2009-06-23 Ian Lance Taylor <iant@google.com>
10302
10303 PR 10237
10304 * options.cc (General_options::parse_V): Set printed_version_.
10305 (General_options::General_options): Initialize printed_version_.
10306 * options.h (class General_options): Add printed_version_ field.
10307 * gold.cc (queue_initial_tasks): If there are no input files,
10308 don't give a fatal error if we printed the version information.
10309 (queue_middle_tasks): If using -r with a shared object, give a
10310 fatal error rather than an ordinary error.
10311
10312 2009-06-23 Ian Lance Taylor <iant@google.com>
10313
10314 PR 10219
10315 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10316 (Layout::make_output_section): Set have_stabstr_section_ if we see
10317 a .stab*str section.
10318 (Layout::finalize): Call link_stabs_sections.
10319 (Layout::link_stabs_sections): New file.
10320 * layout.h (class Layout): Add have_stabstr_section_ field.
10321 Declare link_stabs_sections.
10322
10323 2009-06-23 Doug Kwan <dougkwan@google.com>
10324
10325 * Makefile.am (libgold_a_LIBADD): New.
10326 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10327 * Makefile.in: Regenerate.
10328 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10329 * configure: Regenerate.
10330 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10331 * fileread.cc: Include sys/state.h
10332 * gold.h: Declare memmem and strndup if found missing.
10333 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10334
10335 2009-06-23 Ian Lance Taylor <iant@google.com>
10336
10337 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10338 * configure: Rebuild.
10339
10340 2009-06-23 Ian Lance Taylor <iant@google.com>
10341
10342 PR 10147
10343 * object.cc (Object::section_contents): Don't try to get a view if
10344 the section has length zero.
10345 (Object::handle_gnu_warning_section): If the section is empty, use
10346 the name of the section as the warning.
10347
10348 2009-06-23 Ian Lance Taylor <iant@google.com>
10349
10350 PR 10133
10351 * stringpool.h (class Stringpool_template): Add optimize_ field.
10352 (Stringpool_template::set_optimize): New function.
10353 * stringpool.cc (Stringpool_template::Stringpool_template):
10354 Initialize optimize_ field.
10355 (Stringpool_template::set_string_offsets): Test local optimize
10356 fild rather than parameter.
10357 * layout.cc (Layout::Layout): Call set_optimize on the section
10358 name stringpool.
10359
10360 2009-06-22 Ian Lance Taylor <iant@google.com>
10361
10362 PR 10030
10363 * yyscript.y: Parse TARGET.
10364 * script.cc (script_set_target): New function.
10365 * script-c.h (script_set_target): Declare.
10366 * options.cc (General_options::string_to_object_format): Rename
10367 from string_to_object_format in anonymous namespace. Change
10368 callers.
10369 * options.h (class General_options): Declare
10370 string_to_object_format.
10371
10372 2009-06-22 Ian Lance Taylor <iant@google.com>
10373
10374 * script-sections.cc (Script_sections::create_segments): Don't put
10375 program headers in a PT_LOAD segment if -n or -N.
10376
10377 2009-06-22 Ian Lance Taylor <iant@google.com>
10378
10379 PR 10141
10380 * options.h (class General_options): Add -z lazy and -z now. Sort
10381 -z options into alphabetical order.
10382 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10383
10384 2009-06-21 Ian Lance Taylor <iant@google.com>
10385
10386 * layout.cc (Layout::make_output_section): Call
10387 Target::new_output_section.
10388 (Layout::attach_allocated_section_to_segment): Put large section
10389 sections in a separate load segment with the large segment flag
10390 set.
10391 (Layout::segment_precedes): Sort large data segments after other
10392 load segments.
10393 (align_file_offset): New static function.
10394 (Layout::set_segment_offsets): Use align_file_offset.
10395 * output.h (class Output_section): Add is_small_section_ and
10396 is_large_section_ fields.
10397 (Output_section::is_small_section): New function.
10398 (Output_section::set_is_small_section): New function.
10399 (Output_section::is_large_section): New function.
10400 (Output_section::set_is_large_section): New function.
10401 (Output_section::is_large_data_section): New function.
10402 (class Output_segment): Add is_large_data_segment_ field.
10403 (Output_segment::is_large_data_segment): New function.
10404 (Output_segment::set_is_large_data_segment): New function.
10405 * output.cc (Output_section::Output_section): Initialize new
10406 fields.
10407 (Output_segment::Output_segment): Likewise.
10408 (Output_segment::add_output_section): Add assertion that large
10409 data sections always go in large data segments. Force small data
10410 sections to the end of the list of data sections. Force small BSS
10411 sections to the start of the list of BSS sections. For large BSS
10412 sections to the end of the list of BSS sections.
10413 * symtab.h (class Symbol): Declare is_common_shndx.
10414 (Symbol::is_defined): Check Symbol::is_common_shndx.
10415 (Symbol::is_common): Likewise.
10416 (class Symbol_table): Define enum Commons_section_type. Update
10417 declarations. Add small_commons_ and large_commons_ fields.
10418 * symtab.cc (Symbol::is_common_shndx): New function.
10419 (Symbol_table::Symbol_table): Initialize new fields.
10420 (Symbol_table::add_from_object): Put small and large common
10421 symbols in the right list.
10422 (Symbol_table::sized_finalized_symbol): Check
10423 Symbol::is_common_shndx.
10424 (Symbol_table::sized_write_globals): Likewise.
10425 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10426 common symbol lists. Don't call do_allocate_commons_list if the
10427 list is empty.
10428 (Symbol_table::do_allocate_commons_list): Remove is_tls
10429 parameter. Add comons_section_type parameter. Change all
10430 callers. Handle small and large common symbols.
10431 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10432 Symbol::is_common_shndx.
10433 * resolve.cc (symbol_to_bits): Likewise.
10434 * target.h (Target::small_common_shndx): New function.
10435 (Target::small_common_section_flags): New function.
10436 (Target::large_common_shndx): New function.
10437 (Target::large_common_section_flags): New function.
10438 (Target::new_output_section): New function.
10439 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10440 small_common_section_flags, and large_common_section_flags
10441 fields.
10442 (Target::do_new_output_section): New virtual function.
10443 * arm.cc (Target_arm::arm_info): Initialize new fields.
10444 * i386.cc (Target_i386::i386_info): Likewise.
10445 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10446 Likewise.
10447 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10448 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10449 (Target_x86_64::do_new_output_section): New function.
10450 * configure.ac: Define conditional MCMODEL_MEDIUM.
10451 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10452 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10453 (large_LDFLAGS): Define.
10454 * testsuite/large.c: New file.
10455 * testsuite/testfile.cc (Target_test::test_target_info):
10456 Initialize new fields.
10457 * configure, testsuite/Makefile.in: Rebuild.
10458
10459 2009-06-05 Doug Kwan <dougkwan@google.com>
10460
10461 * Makefile.am (CCFILES): Add target.cc.
10462 * Makefile.in: Regenerate.
10463 * i386.cc (class Target_i386): Define new virtual method to
10464 override do_is_local_label_name in parent.
10465 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10466 local symbols if --discard-locals or -X is given.
10467 * options.h (class General_options): Declare new options
10468 '--discard-locals' and '-X' for discarding locals.
10469 * target.h (class Target): Define new methods is_local_label_name.
10470 Declare new virtual method do_is_local_label_name.
10471 * target.cc: New file.
10472 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10473 (check_SCRIPTS): Add discard_locals_test.sh.
10474 (check_DATA): Add discard_local_tests.syms.
10475 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10476 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10477 * testsuite/Makefile.in: Regenerate.
10478 * testsuite/discard_locals_test.c: New file.
10479 * testsuite/discard_locals_test.sh: Same.
10480
10481 2009-06-05 Doug Kwan <dougkwan@google.com>
10482
10483 * object.cc (Sized_relobj::Sized_relobj): Initialize
10484 discarded_eh_frame_shndx_ to -1U.
10485 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10486 section.
10487 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10488 a discarded .eh_frame section.
10489 (Sized_relobj::do_finalize_local_symbols): Ditto.
10490 * object.h (class Sized_relobj): Declare new member
10491 discarded_eh_frame_shndx_.
10492 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10493 (local_labels_test.o, local_labels_test): New rules.
10494 * testsuite/Makefile.in: Regenerate.
10495
10496 2009-06-04 Doug Kwan <dougkwan@google.com>
10497
10498 * layout.cc (Layout::section_name_mapping): Add mapping for
10499 special ARM sections.
10500
10501 2009-06-03 Doug Kwan <dougkwan@google.com>
10502
10503 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10504 (utils::has_overflow): Same.
10505
10506 2009-06-03 Ian Lance Taylor <iant@google.com>
10507
10508 * layout.cc (Layout::section_name_mapping): New array, replacing
10509 Layout::linkonce_mapping.
10510 (Layout::section_name_mapping_count): New variable, replacing
10511 Layout::linkonce_mapping_count.
10512 (Layout::linkonce_output_name): Remove.
10513 (Layout::output_section_name): Rewrite.
10514 * layout.h (class Layout): Rename Linkonce_mapping to
10515 Section_name_mapping, linkonce_mapping to section_name_mapping,
10516 linkonce_mapping_count to section_name_mapping_count. Don't
10517 declare linkonce_output_name.
10518
10519 2009-06-03 Doug Kwan <dougkwan@google.com>
10520
10521 * gold/arm.cc (namespace utils): New.
10522 (Target_arm::reloc_is_non_pic): Define new method.
10523 (class Arm_relocate_functions): New.
10524 (Target_arm::Relocate::relocate): Handle relocation types used by
10525 Android.
10526
10527 2009-06-03 Ian Lance Taylor <iant@google.com>
10528
10529 * arm.cc (Target_arm::scan::global): Use || instead of |.
10530
10531 2009-06-02 Doug Kwan <dougkwan@google.com>
10532
10533 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10534 issued_non_pic_error_.
10535 (class Target_arm::Scan): Declare new method check_non_pic.
10536 Define new method symbol_needs_plt_entry.
10537 Declare new data member issued_non_pic_error_.
10538 (class Target_arm::Relocate): Declare new method
10539 should_apply_static_reloc.
10540 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10541 (Target_arm::Scan::check_non_pic): Define new method.
10542 (Target_arm::Scan::local): Handle a small subset of reloc types used
10543 by Android.
10544 (Target_arm::Scan::local): Same.
10545 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10546
10547 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10548
10549 * incremental.cc (Incremental_inputs::report_command_line): Filter
10550 out --incremental-* options.
10551
10552 2009-05-29 Doug Kwan <dougkwan@google.com>
10553
10554 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10555 template class.
10556 (class Target_arm): Update comment.
10557 (Target_arm::Target_arm): Initialize new data members GOT_,
10558 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10559 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10560 and Target_arm::rel_dyn_section.
10561 Declare new_enum Target_arm::Got_type.
10562 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10563 and DYNBSS_.
10564 Update commments for member do_dynsym_value.
10565 (Target_arm::got_size, Target_arm::plt_section,
10566 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10567 new methods inside class defintion.
10568 (Target_arm::got_section): Define new method.
10569 (Target_arm::rel_dyn_section): Same.
10570 (Output_data_plt_arm): New template class.
10571 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10572 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10573 (Output_data_plt_arm::add_entry): Same.
10574 (Output_data_plt_arm::first_plt_entry): Define new
10575 static data member for PLT instruction template.
10576 (Output_data_plt_arm::plt_entry): Same.
10577 (Output_data_plt_arm::do_write): Define new method.
10578 (Target_arm::make_plt_entry): Same.
10579 (Target_arm::do_finalize_sections): Same.
10580 (Target_arm::do_dynsym_value): Same.
10581
10582 2009-05-28 Doug Kwan <dougkwan@google.com>
10583
10584 * Makefile.am (TARGETSOURCES): Add arm.cc.
10585 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10586 * Makefile.in: Regenerate.
10587 * arm.cc: New file.
10588 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10589
10590 2009-05-26 Doug Kwan <dougkwan@google.com>
10591
10592 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10593 (General_options::check_excluded_libs): Strip off directories in
10594 archive name before matching like GNU ld does.
10595 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10596 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10597 (exclude_libs_test_LDFLAGS): Add linker option
10598 -Wl,--exclude-libs,libexclude_libs_test_3
10599 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10600 an explicit archive without using -l.
10601 (alt/libexclude_libs_test_3.a): New make rule.
10602 * testsuite/Makefile.in: Regenerate.
10603 * testsuite/exclude_libs_test.c : Declare lib3_default().
10604 (main): Call it.
10605 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10606 * exclude_libs_test_3.c: New file.
10607
10608 2009-05-26 Nick Clifton <nickc@redhat.com>
10609
10610 * po/id.po: New Indonesian translation.
10611 * po/gold.pot: Updated template file.
10612
10613 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10614
10615 * testsuite/Makefile.am: Add -ffunction-sections to compile
10616 gc_comdat_test files. Add -Wl,--gc-sections to build
10617 gc_comdat_test.
10618 * testsuite/Makefile.in: Regenerate.
10619 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10620
10621 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10622
10623 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10624 kept comdat section was garbage collected.
10625 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10626 * testsuite/Makefile.in: Regenerate.
10627 * testsuite/gc_comdat_test.sh: New file.
10628 * testsuite/gc_comdat_test_1.cc: New file.
10629 * testsuite/gc_comdat_test_2.cc: New file.
10630
10631 2009-05-19 Doug Kwan <dougkwan@google.com>
10632
10633 * archive.cc (Archive::Archive): Move constructor from archive.h
10634 to here. Initialize no_export_.
10635 (Archive::get_elf_object_for_member): Set no_export flag of object.
10636 * archive.h (Archive::Archive): Move constructor body to
10637 archive.cc.
10638 (Archive::no_export): New method.
10639 (Archive::no_export_): New field.
10640 * object.h (Object::Object): Initialize no_export_ to false.
10641 (Object::no_export, Object::set_no_export): New methods.
10642 (Object::no_export_): New field.
10643 * options.cc (General_options::parse_exclude_libs): New method.
10644 (General_options::check_excluded_libs) Same.
10645 * options.h (exclude_libs): New option.
10646 (General_options::check_excluded_libs): New method declaration.
10647 (General_options::excluded_libs_): New field.
10648 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10649 default or protected visibility if an object has no-export flag set.
10650 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10651 (check_SCRIPTS): Add exclude_libs_test.sh.
10652 (check_DATA): Add exclude_libs_test.syms.
10653 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10654 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10655 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10656 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10657 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10658 libexclude_libs_test_2.a): New rules.
10659 * testsuite/Makefile.in: Regenerate.
10660 * testsuite/exclude_libs_test.c: New file.
10661 * testsuite/exclude_libs_test.sh: Ditto.
10662 * testsuite/exclude_libs_test_1.c: Ditto.
10663 * testsuite/exclude_libs_test_2.c: Ditto.
10664
10665 2009-05-15 Ian Lance Taylor <iant@google.com>
10666
10667 * configure.ac: Check for declarations for cases where libiberty.h
10668 checks HAVE_DECL_xxx.
10669 * configure, config.in: Rebuild.
10670
10671 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10672
10673 * gold.h (Incremental_argument_list): Remove (invalid) forward
10674 declaration.
10675 * incremental.cc (Incremental_inputs::report_achive): New method.
10676 (Incremental_inputs::report_object): New method.
10677 (Incremental_inputs::report_script): New method.
10678 (Incremental_inputs::finalize_inputs): New method.
10679 (Incremental_inputs::finalize): Call finalize_inputs().
10680 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10681 Create inputs entries.
10682 * incremental.h (Incremental_input_type): New enum.
10683 (Incremental_inputs::Incremental_input): Initialize new fields.
10684 (Incremental_inputs::report_inputs): New method.
10685 (Incremental_inputs::report_achive): New method.
10686 (Incremental_inputs::report_object): New method.
10687 (Incremental_inputs::report_script): New method.
10688 (Incremental_inputs::finalize_inputs): New method.
10689 (Incremental_inputs::Input_info): New struct.
10690 (Incremental_inputs::Input_info_map): New typedef.
10691 (Incremental_inputs::lock_): New field.
10692 (Incremental_inputs::Inputs_): New field.
10693 (Incremental_inputs::Inputs_map): New field.
10694 * main.cc (main): Call Incremental_input::report_inputs.
10695 * options.h (Input_argument_list): Typedef moved from
10696 Input_arguments.
10697 (Input_file_group::Files): Remove, use ::Input_argument_list.
10698 (Input_file_group::Input_argument_list): Remove, use
10699 ::Input_argument_list.
10700 * plugin.cc (Plugin_manager::add_input_file): Add error in
10701 incremental build.
10702 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10703 functions.
10704 * script.cc (read_input_script): Call
10705 Incremental_input::report_script.
10706 * script.h (Script_info): New class.
10707
10708 2009-04-27 Ian Lance Taylor <iant@google.com>
10709
10710 * x86_64.cc (do_adjust_output_section): Set entsize to
10711 plt_entry_size.
10712
10713 2009-04-23 Elliott Hughes <enh@google.com>
10714
10715 * output.cc (Output_file::close): After short writes, continue
10716 writing from the correct offset in the buffer being written.
10717
10718 2009-04-23 Chris Demetriou <cgd@google.com>
10719
10720 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10721 * configure: Regenerate.
10722 * config.in: Regenerate.
10723 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10724 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10725
10726 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10727
10728 * incremental.cc (Incremental_inputs_header_data): Renamed from
10729 Incremental_input_header_data.
10730 (Incremental_inputs_header_data::data_size): New field.
10731 (Incremental_inputs_header_data::put_input_file_count): Renamed
10732 from input_file_count.
10733 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10734 from command_line_offset.
10735 (Incremental_inputs_header_data::put_reserved): Renamed from
10736 put_reserved.
10737 (Incremental_inputs_entry_data): Renamed from
10738 Incremental_input_entry_data.
10739 (Incremental_inputs_entry_data::data_size): New field.
10740 (Incremental_inputs::report_command_line): New method.
10741 (Incremental_inputs::finalize): New method.
10742 (Incremental_inputs::create_incremental_inputs_data): New method.
10743 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10744 * incremental.h: New file.
10745 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10746 (Layout::finalize): Create incremental inputs section in
10747 incremental builds.
10748 (Layout::create_incremental_info_sections): New method.
10749 * layout.h (Layout::incremental_inputs): New method.
10750 (Layout::create_incremental_info_sections): New method.
10751 (Layout::incremental_inputs_): New field.
10752 * main.cc (main): Notify Incremental_input of the command line.
10753
10754 2009-04-01 Ian Lance Taylor <iant@google.com>
10755 Mikolaj Zalewski <mikolajz@google.com>
10756
10757 * gold.h (reserve_unordered_map): Define, three versions, one for
10758 each version of Unordered_map.
10759 * layout.cc (Layout::Layout): Remove options parameter. Add
10760 number_of_input_files parameter. Don't initialize options_.
10761 Initialize number_of_input_files_ and resized_signatures_. Move
10762 sections_are_attached_.
10763 (Layout::layout_group): Reserve space for group_signatures_.
10764 (Layout::find_or_add_kept_section): Change name parameter to be a
10765 reference. Resize signatures_ map when it gets large enough.
10766 (Layout::layout_eh_frame): Use parameters->options() instead of
10767 this->options_.
10768 (Layout::make_output_section): Likewise.
10769 (Layout::attach_allocated_section_to_segment): Likewise.
10770 (Layout::finalize, Layout::create_executable_stack): Likewise.
10771 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10772 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10773 * layout.h (class Layout): Update declarations. Remove options_
10774 field. Add number_of_input_files_ and resized_signatures_
10775 fields. Move sections_are_attached_ field.
10776 * main.cc (main): Pass number of input files to Layout
10777 constructor. Don't pass options.
10778
10779 2009-03-30 Ian Lance Taylor <iant@google.com>
10780
10781 * ffsll.c (ffsll): Correct implementation.
10782
10783 2009-03-27 Ian Lance Taylor <iant@google.com>
10784
10785 * ffsll.c: New file.
10786 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10787 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10788 * ftruncate.c (ftruncate): Declare before definition.
10789 * mremap.c (mremap): Likewise.
10790 * pread.c (pread): Likewise.
10791 * configure, Makefile.in, config.in: Rebuild.
10792
10793 * mremap.c: New file.
10794 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10795 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10796 (mremap): Declare if HAVE_MREMAP is not defined.
10797 * configure, Makefile.in, config.in: Rebuild.
10798
10799 2009-03-27 Cary Coutant <ccoutant@google.com>
10800
10801 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10802 position independent.
10803 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10804 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10805
10806 2009-03-24 Cary Coutant <ccoutant@google.com>
10807
10808 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10809 an executable.
10810 (needs_dynamic_reloc): Likewise.
10811
10812 2009-03-24 Ian Lance Taylor <iant@google.com>
10813
10814 * yyscript.y (file_cmd): Recognize EXTERN.
10815 (extern_name_list, extern_name_list_body): New nonterminals.
10816 * script.cc (script_add_extern): Define.
10817 * script-c.h (script_add_extern): Declare.
10818
10819 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10820
10821 * object.cc (is_elf_object): Define.
10822 * object.h (is_elf_object): Declare.
10823 * archive.cc (Archive::get_elf_object_for_member): Call
10824 is_elf_object.
10825 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10826
10827 2009-03-24 Elliott Hughes <enh@google.com>
10828
10829 * output.cc (Output_file::map_anonymous): Define.
10830 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10831 try an anonymous one. Report the size if the mmap fails.
10832 * output.h (class Output_file): Declare map_anonymous.
10833
10834 2009-03-24 Ian Lance Taylor <iant@google.com>
10835
10836 * target-select.cc (instantiate_target): Don't acquire the lock if
10837 the instantiated_target_ field has already been set.
10838
10839 2009-03-23 Ian Lance Taylor <iant@google.com>
10840
10841 * gold-threads.h (class Initialize_lock): Define.
10842 * gold-threads.cc (class Initialize_lock_once): Define.
10843 (initialize_lock_control): New static variable.
10844 (initialize_lock_pointer): New static variable.
10845 (initialize_lock_once): New static function.
10846 (Initialize_lock::Initialize_lock): Define.
10847 (Initialize_lock::initialize): Define.
10848 * target-select.h: Include "gold-threads.h".
10849 (class Target_selector): Add lock_ and initialize_lock_ fields.
10850 Don't define instantiate_target, just declare it.
10851 * target-select.cc (Target_selector::Target_selector): Initialize
10852 new fields.
10853 (Target_selector::instantiate_target): Define.
10854 * descriptors.h: Include "gold-threads.h".
10855 (class Descriptors): Add initialize_lock_ field.
10856 * descriptors.cc (Descriptors::Descriptors): Initialize new
10857 field.
10858 (Descriptors::open): Use initialize_lock_ field
10859 * errors.h (class Errors): Add initialize_lock_ field.
10860 * errors.cc (Errors::Errors): Initialize new field.
10861 (Errors::initialize_lock): Use initialize_lock_ field.
10862 * powerpc.cc (class Target_selector_powerpc): Remove
10863 instantiated_target_ field. In do_recognize call
10864 instantiate_target rather than do_instantiate_target. In
10865 do_instantiate_target just allocate a new target.
10866 * sparc.cc (class Target_selector_sparc): Likewise.
10867
10868 * freebsd.h: New file.
10869 * i386.cc: Include "freebsd.h".
10870 (Target_i386): Derive from Target_freebsd rather than
10871 Sized_target.
10872 (Target_selector_i386): Derive from Target_selector_freebsd rather
10873 than Target_selector.
10874 * x86_64.cc: Include "freebsd.h".
10875 (Target_x86_64): Derive from Target_freebsd rather than
10876 Sized_target.
10877 (Target_selector_x86_64): Derive from Target_selector_freebsd
10878 rather than Target_selector.
10879 * target.h (class Target): Add adjust_elf_header and
10880 do_adjust_elf_header.
10881 * output.cc (Output_file_header:: do_sized_write): Call target
10882 adjust_elf_header routine.
10883 * configure.tgt: Set targ_osabi.
10884 * configure.ac: Define GOLD_DEFAULT_OSABI.
10885 * parameters.cc (Parameters::default_target): Pass
10886 GOLD_DEFAULT_OSABI to select_target.
10887 * target-select.h (class Target_selector): Make instantiate_target
10888 protected rather than private.
10889 * Makefile.am (HFILES): Add freebsd.h.
10890 * configure, Makefile.in, config.in: Rebuild.
10891
10892 * merge.cc (do_add_input_section): Correct pend value. Change
10893 message about last entry not being null terminated from error to
10894 warning.
10895
10896 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10897
10898 * incremental.cc: New file.
10899 * Makefile.am (CCFILES): Add incremental.cc.
10900 * Makefile.in: Rebuild.
10901
10902 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10903
10904 * layout.cc (Layout::output_section_name): Preserve names
10905 of '.note.' sections.
10906
10907 2009-03-19 Ian Lance Taylor <iant@google.com>
10908
10909 * descriptors.cc (Descriptors::open): Check that the options are
10910 valid before using them.
10911
10912 2009-03-18 Ian Lance Taylor <iant@google.com>
10913
10914 * script-sections.h: Include <list>.
10915 (class Script_sections): Change Sections_elements from std::vector
10916 to std::list. Typedef public Elements_iterator. Add
10917 orphan_section_placement_, data_segment_align_start_, and
10918 saw_data_segment_align_ fields. Remove data_segment_align_index_
10919 field.
10920 * script-sections.cc (class Orphan_section_placement): New class.
10921 (class Sections_element): Add virtual functions is_relro and
10922 orphan_section_init. Remove virtual function place_orphan_here.
10923 (class Output_section_definition): Add is_relro and
10924 orphan_section_init. Remove place_orphan_here.
10925 (class Orphan_output_section): Likewise.
10926 (Script_sections::Script_sections): Update for field changes.
10927 (Script_sections::data_segment_align): Set saw_data_segment_align_
10928 and data_segment_align_start_, not data_segment_align_index.
10929 (Script_sections::data_segment_relro_end): Check
10930 saw_data_segment_align_. Use data_segment_align_start_ rather
10931 than data_segment_align_index_.
10932 (Script_sections::place_orphan): Rewrite to use
10933 Orphan_section_placement.
10934
10935 2009-03-17 Ian Lance Taylor <iant@google.com>
10936
10937 * archive.cc (Archive::add_symbols): Check for a version attached
10938 to the symbol name in the archive map.
10939 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10940 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10941 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10942 (ver_test_11.a): New target.
10943 * testsuite/Makefile.in: Rebuild.
10944
10945 * configure.ac: Check for chsize and posix_fallocate. Replace
10946 ftruncate.
10947 * ftruncate.c: New file, from gnulib.
10948 * output.cc (posix_fallocate): Define dummy version if not
10949 HAVE_POSIX_FALLOCATE.
10950 (Output_file::map): Call posix_fallocate rather than lseek and
10951 write.
10952 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10953 * configure, Makefile.in, config.in: Rebuild.
10954
10955 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10956
10957 * layout.h (Layout::create_note): Add section_name parameter.
10958 * layout.cc (Layout::create_note): Likewise.
10959 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10960
10961 2009-03-17 Ian Lance Taylor <iant@google.com>
10962
10963 * descriptors.cc: Include "options.h".
10964 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10965 (Descriptors::open): Always use O_CLOEXEC when opening a new
10966 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10967 then set FD_CLOEXEC.
10968
10969 * sparc.cc (class Target_sparc): Add has_got_section.
10970 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10971 make sure we have a GOT section.
10972
10973 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10974 (Target_sparc::Scan::local): Likewise.
10975 (Target_sparc::Scan::global): Likewise.
10976 (Target_sparc::Relocate::relocate): Likewise.
10977 (Target_sparc::Relocate::relocate_tls): Likewise.
10978
10979 * symtab.cc (Symbol_table::define_default_version): New function,
10980 broken out of add_from_object.
10981 (Symbol_table::add_from_object): Call define_default_version.
10982 (Symbol_table::define_special_symbol): Add resolve_oldsym
10983 parameter. Change all callers. If the version for a symbol comes
10984 from a version script, resolve it with the symbol with the same
10985 name with no version. Also add the symbol without a version if
10986 appropriate.
10987 (do_define_in_output_data): If resolving with oldsym, don't delete
10988 sym.
10989 (do_define_in_output_segment): Likewise.
10990 (do_define_as_constant): Likewise.
10991 * symtab.h (class Symbol_table): Update declarations.
10992
10993 2009-03-13 Ian Lance Taylor <iant@google.com>
10994
10995 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10996 (Read_symbols::requeue): New function.
10997 (Read_symbols::do_read_symbols): If make_elf_object fails because
10998 the target type is not configured, and the file was searched for,
10999 issue a warning and retry with the next directory.
11000 (Add_symbols::run): If the file has an incompatible format, and
11001 it was searched for, requeue the Read_symbols task. On error,
11002 release the object.
11003 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
11004 dirindex parameter to constructor. Change all callers. Declare
11005 incompatible_warning and requeue.
11006 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11007 input_argument_ and input_group_ fields. Add them to
11008 constructor. Change all callers.
11009 (class Read_script): Add dirindex_ field. Add it to constructor.
11010 Change all callers.
11011 * archive.cc (Archive::setup): Remove input_objects parameter.
11012 Change all callers.
11013 (Archive::get_file_and_offset): Likewise.
11014 (Archive::read_all_symbols): Likewise.
11015 (Archive::read_symbols): Likewise.
11016 (Archive::get_elf_object_for_member): Remove input_objects
11017 parameter. Add punconfigured parameter. Change all callers.
11018 (Archive::add_symbols): Change return type to bool. Check return
11019 value of include_member.
11020 (Archive::include_all_members): Likewise.
11021 (Archive::include_member): Change return type to bool. Return
11022 false if first included object has incompatible target. Set
11023 included_member_ field.
11024 (Add_archive_symbols::run): If add_symbols returns false, requeue
11025 Read_symbols task.
11026 * archive.h (class Archive): Add included_member_ field.
11027 Initialize it in constructor. Add input_file and searched_for
11028 methods. Update declarations.
11029 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11030 input_argument_ fields. Add them to constructor. Change all
11031 callers.
11032 * script.cc: Include "target-select.h".
11033 (class Parser_closure): Add skip_on_incompatible_target_ and
11034 found_incompatible_target_ fields. Add
11035 skip_on_incompatible_target parameter to constructor. Change all
11036 callers. Add methods skip_on_incompatible_target,
11037 clear_skip_on_incompatible_target, found_incompatible_target, and
11038 set_found_incompatible_target.
11039 (read_input_script): Add dirindex parameter. Change all callers.
11040 If parser finds an incompatible target, requeue Read_symbols
11041 task.
11042 (script_set_symbol): Clear skip_on_incompatible_target in
11043 closure.
11044 (script_add_assertion, script_parse_option): Likewise.
11045 (script_start_sections, script_add_phdr): Likewise.
11046 (script_check_output_format): New function.
11047 * script.h (read_input_script): Update declaration.
11048 * script-c.h (script_check_output_format): Declare.
11049 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11050 (ignore_cmd): Remove OUTPUT_FORMAT.
11051 * fileread.cc (Input_file::Input_file): Add explicit this.
11052 (Input_file::will_search_for): New function.
11053 (Input_file::open): Add pindex parameter. Change all callers.
11054 * fileread.h (class Input_file): Add input_file_argument method.
11055 Declare will_search_for. Update declarations.
11056 * object.cc (make_elf_object): Add punconfigured parameter.
11057 Change all callers.
11058 * object.h (class Object): Make input_file public. Add
11059 searched_for method.
11060 (make_elf_object): Update declaration.
11061 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11062 restart search.
11063 * dirsearch.h (class Dirsearch): Update declaration.
11064 * options.h (class General_options): Add --warn-search-mismatch.
11065 * parameters.cc (Parameters::is_compatible_target): New function.
11066 * parameters.h (class Parameters): Declare is_compatible_target.
11067 * workqueue.cc (Workqueue::add_blocker): New function.
11068 * workqueue.h (class Workqueue): Declare add_blocker.
11069
11070 * fileread.cc (Input_file::open): Remove options parameter.
11071 Change all callers.
11072 (Input_file::open_binary): Likewise.
11073 * script.cc (read_input_script): Likewise.
11074 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11075 options parameter from constructor. Change all callers.
11076 (class Read_script): Likewise.
11077 * fileread.h (class Input_file): Update declarations.
11078 * script.h (read_input_script): Update declaration.
11079
11080 2009-03-10 Nick Clifton <nickc@redhat.com>
11081
11082 * po/es.po: New Spanish translation.
11083
11084 2009-03-06 Cary Coutant <ccoutant@google.com>
11085
11086 * options.cc (parse_short_option): Keep dash_z from registering itself.
11087
11088 2009-03-03 Ian Lance Taylor <iant@google.com>
11089
11090 PR 9918
11091 * target-reloc.h (relocate_section): Pass output_section to
11092 relocate.
11093 * i386.cc (Target_i386::should_apply_static_reloc): Add
11094 output_section parameter. Change all callers.
11095 (Target_i386::Relocate::relocate): Add output_section parameter.
11096 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11097 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11098 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11099 * testsuite/two_file_shared.sh: New script.
11100 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11101 (check_DATA): Add two_file_shared.dbg.
11102 (two_file_shared.dbg): New target.
11103 * testsuite/Makefile.in: Rebuild.
11104
11105 2009-03-01 Ian Lance Taylor <iant@google.com>
11106
11107 * configure.ac: Check for byteswap.h.
11108 * configure: Rebuild.
11109 * config.in: Rebuild.
11110
11111 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11112
11113 * layout.cc (Layout::find_or_add_kept_section): New function.
11114 (Layout::add_comdat): Removed.
11115 * layout.h (struct Kept_section): Move out of class Layout.
11116 Remove trailing underscores from field names. Add group_sections
11117 field. Rename group_ field to is_group. Change all uses.
11118 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11119 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11120 comdat_groups_ field.
11121 (Sized_relobj::include_section_group): Use
11122 find_or_add_kept_section and Kept_section::group_sections.
11123 (Sized_relobj::include_linkonce_section): Likewise.
11124 * object.cc (class Sized_relobj): Don't define Comdat_group or
11125 Comdat_group_table. Remove find_comdat_group and
11126 add_comdat_group. Remove comdat_groups_ field.
11127 * plugin.cc (include_comdat_group): Use
11128 Layout::find_or_add_kept_section.
11129
11130 2009-02-28 Ian Lance Taylor <iant@google.com>
11131
11132 * README: --gc-sections and map files are now supported. Document
11133 some build requirements.
11134
11135 PR 6992
11136 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11137 relocatable link set the value of the section symbol to zero.
11138 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11139 relocatable link don't include the section address in the local
11140 symbol value.
11141
11142 2009-02-27 Ian Lance Taylor <iant@google.com>
11143
11144 PR 6811
11145 * options.h (class Search_directory): Add is_system_directory.
11146 (class General_options): Declare is_in_system_directory.
11147 * options.cc (get_relative_sysroot): Make static.
11148 (get_default_sysroot): Make static.
11149 (General_optoins::is_in_system_directory): New function.
11150 * fileread.cc (Input_file::is_in_system_directory): New function.
11151 * fileread.h (class Input_file): Declare is_in_system_directory.
11152 * object.h (class Object): Add is_in_system_directory.
11153 (class Input_objects): Remove system_library_directory_ field.
11154 * object.cc (Input_objects::add_object): Don't set
11155 system_library_directory_.
11156 (input_objects::found_in_system_library_directory): Remove.
11157 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11158 parameter. Change all callers.
11159 (Symbol_table::sized_write_globals): Likewise.
11160 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11161 Call Object::is_in_system_directory.
11162 * symtab.h (class Symbol_table): Update declarations.
11163
11164 PR 5990
11165 * descriptors.h (Open_descriptor): Add is_on_stack field.
11166 * descriptors.cc (Descriptors::open): If the descriptor is on the
11167 top of the stack, remove it. Initialize is_on_stack field.
11168 (Descriptors::release): Only add pod to stack if it is not on the
11169 stack already.
11170 (Descriptors::close_some_descriptor): Clear stack_next and
11171 is_on_stack fields.
11172
11173 PR 7091
11174 * output.cc (Output_section::find_starting_output_address): Rename
11175 from starting_output_address; add PADDR parameter; change return
11176 type.
11177 * output.h (class Output_section): Declare
11178 find_starting_output_address instead of starting_output_address.
11179 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11180 section symbol for which we can't find a merge section.
11181
11182 PR 9836
11183 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11184 hidden or internal, force the symbol to be local.
11185 * resolve.cc (Symbol::override_visibility): Define.
11186 (Symbol::override_base): Use override_visibility.
11187 (Symbol_table::resolve): Likewise.
11188 (Symbol::override_base_with_special): Likewise.
11189 (Symbol_table::override_with_special): If the visibility is hidden
11190 or internal, force the symbol to be local.
11191 * symtab.h (class Symbol): Add set_visibility and
11192 override_visibility.
11193 * testsuite/ver_test_1.sh: New file.
11194 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11195 (check_DATA): Add ver_test_1.syms.
11196 (ver_test_1.syms): New target.
11197 * testsuite/Makefile.in: Rebuild.
11198
11199 2009-02-25 Cary Coutant <ccoutant@google.com>
11200
11201 * layout.cc (Layout::choose_output_section): Don't rename sections
11202 when using a linker script that has a SECTIONS clause.
11203 * Makefile.in: Regenerate.
11204
11205 * testsuite/Makefile.am (script_test_5.sh): New test case.
11206 * testsuite/Makefile.in: Regenerate.
11207 * testsuite/script_test_5.cc: New file.
11208 * testsuite/script_test_5.sh: New file.
11209 * testsuite/script_test_5.t: New file.
11210
11211 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11212
11213 * archive.cc (Archive::include_member): Update calls to add_symbols.
11214 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11215 the Layout argument.
11216 * dynobj.h (do_add_symbols): Add the Layout argument.
11217 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11218 Layout argument.
11219 * object.h (Object::add_symbols): Add the Layout argument.
11220 (Object::do_add_symbols): Add the Layout argument.
11221 (Sized_relobj::do_add_symbols): Add the Layout argument.
11222 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11223 Unify the two versions.
11224 (Add_plugin_symbols): Remove.
11225 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11226 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11227 (Add_plugin_symbols): Remove.
11228 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11229 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11230 (Add_symbols::run): Make it work with Pulginobj.
11231
11232 2009-02-06 Ian Lance Taylor <iant@google.com>
11233
11234 * object.cc (Sized_relobj::do_layout): Make info message start
11235 with lower case letter.
11236
11237 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11238
11239 * binary.cc: Fix file comment.
11240
11241 * options.h (enum Incremental_disposition): Define.
11242 (class General_options): Add new options: --incremental,
11243 --incremental_changed, --incremental_unchanged,
11244 --incremental_unknown. Add incremental_disposition_ and
11245 implicit_incremental_ fields.
11246 (General_options::incremental_disposition): New function.
11247 (class Position_dependent_options): Add incremental_disposition
11248 option.
11249 (Position_dependent_options::copy_from_options): Set incremental
11250 dispositions.
11251 * options.cc (General_options::parse_incremental_changed): New
11252 function.
11253 (General_options::parse_incremental_unchanged): New function.
11254 (General_options::parse_incremental_unknown): New function.
11255 (General_options::General_options): Initialize new fields
11256 incremental_disposition_ and implicit_incremental_.
11257 (General_options::finalize): Check for uasge of --incremental-*
11258 without --incremental.
11259
11260 2009-02-06 Chris Demetriou <cgd@google.com>
11261
11262 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11263 pointer and to report location as the file name associated with
11264 the symbol.
11265 (gold_undefined_symbol_at_location): New function to replace the
11266 old gold_undefined_symbol functionality.
11267 * target-reloc.h (relocate_section): Update to use
11268 gold_undefined_symbol_at_location.
11269 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11270 Call gold_undefined_symbol function rather than gold_error.
11271 * errors.h (Errors::undefined_symbol): Take location as a
11272 string, rather than calculating it from a relocation.
11273 * errors.cc (Errors::fatal): Print "fatal error:" before the
11274 formatted message.
11275 (Errors::error, Errors::error_at_location): Print "error: "
11276 before the formatted message.
11277 (Errors::undefined_symbol): Take location as a string, rather
11278 than calculating it from a relocation.
11279 (gold_undefined_symbol_at_location): New function akin to
11280 old gold_undefined_symbol, calculates location from relocation.
11281 (gold_undefined_symbol): Change to take only a Symbol pointer
11282 and to report location as the file name associated with the symbol.
11283 * testsuite/debug_msg.sh: Update for changed error messages.
11284 * testsuite/undef_symbol.sh: Likewise.
11285
11286 2009-02-04 Duncan Sands <baldrick@free.fr>
11287
11288 PR 9812
11289 * reduced_debug_output.h
11290 (Output_reduced_debug_abbrev_section::failed): Use format for
11291 gold_warning.
11292 (Output_reduced_debug_info_section::faild): Likewise.
11293
11294 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11295
11296 * script.cc (Lazy_demangler): New class.
11297 (Version_script_info::get_symbol_version_helper): Demangle a
11298 symbol only once.
11299
11300 2009-01-29 Cary Coutant <ccoutant@google.com>
11301
11302 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11303 to __tls_get_addr.
11304 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11305
11306 2009-01-28 Ian Lance Taylor <iant@google.com>
11307
11308 * version.cc (version_string): Bump to 1.9.
11309
11310 * gold.h: Include <cstring> and <stdint.h>.
11311 * version.cc: Include <cstdio>.
11312 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11313 warning.
11314 * reduced_debug_output.cc (insert_into_vector): Rename from
11315 Insert_into_vector; change all callers. Use Swap_unaligned to
11316 avoid aliasing issue; remove union since it is unnecessary.
11317
11318 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11319
11320 * Makefile.am (CCFILES): Add gc.cc.
11321 (HFILES): Add gc.h.
11322 * Makefile.in: Regenerate.
11323 * gold.cc (Gc_runner): New class.
11324 (queue_initial_tasks): Call garbage collection related tasks
11325 when corresponding options are invoked.
11326 (queue_middle_gc_tasks): New function.
11327 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11328 processed early before laying out sections during garbage collection.
11329 * gold.h (queue_middle_gc_tasks): New function.
11330 (is_prefix_of): Move from "layout.cc".
11331 * i386.cc (Target_i386::gc_process_relocs): New function.
11332 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11333 * main.cc (main): Create object of class "Garbage_collection".
11334 * object.cc (Relobj::copy_symbols_data): New function.
11335 (Relobj::is_section_name_included): New function.
11336 (Sized_relobj::do_layout): Allow this function to be called twice
11337 during garbage collection and defer layout of section during the
11338 first call.
11339 * object.h (Relobj::get_symbols_data): New function.
11340 (Relobj::is_section_name_included): New function.
11341 (Relobj::copy_symbols_data): New function.
11342 (Relobj::set_symbols_data): New function.
11343 (Relobj::get_relocs_data): New function.
11344 (Relobj::set_relocs_data): New function.
11345 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11346 (Relobj::gc_process_relocs): New function.
11347 (Relobj::do_gc_process_relocs): New pure virtual function.
11348 (Relobj::sd_): New data member.
11349 (Sized_relobj::is_output_section_offset_invalid): New function.
11350 (Sized_relobj::do_gc_process_relocs): New function.
11351 * options.h (General_options::gc_sections): Modify to not be a no-op.
11352 (General_options::print_gc_sections): New option.
11353 * plugin.cc (Plugin_finish::run): Remove function call to
11354 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11355 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11356 * reloc.cc (Read_relocs::run): Add task to process relocs and
11357 determine unreferenced sections when doing garbage collection.
11358 (Gc_process_relocs): New class.
11359 (Sized_relobj::do_gc_process_relocs): New function.
11360 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11361 sections that are garbage collected.
11362 * reloc.h (Gc_process_relocs): New class.
11363 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11364 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11365 symbols whose corresponding sections are garbage collected.
11366 (Symbol_table::Symbol_table): Add new parameter for the garbage
11367 collection object.
11368 (Symbol_table::gc_mark_undef_symbols): New function.
11369 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11370 (Symbol_table::gc_mark_dyn_syms): New function.
11371 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11372 as garbage.
11373 (Symbol_table::add_from_object): Likewise.
11374 (Symbol_table::add_from_relobj): When building shared objects, do not
11375 treat externally visible symbols as garbage.
11376 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11377 table information for static and relocatable links.
11378 * symtab.h (Symbol_table::set_gc): New function.
11379 (Symbol_table::gc): New function.
11380 (Symbol_table::gc_mark_undef_symbols): New function.
11381 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11382 (Symbol_table::gc_mark_dyn_syms): New function.
11383 (Symbol_table::gc_): New data member.
11384 * target.h (Sized_target::gc_process_relocs): New pure virtual
11385 function.
11386 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11387 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11388
11389 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11390
11391 * options.h (General_options::gc_sections): Define as a no-op for now.
11392 (General_options::no_keep_memory): Ditto.
11393 (General_options::Bshareable): Define.
11394 * options.cc (General_options::finalize): Honor -Bshareable.
11395
11396 2009-01-20 Andreas Schwab <schwab@suse.de>
11397
11398 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11399 read the value in the contents, since we don't use it. Use the
11400 template endianness when writing.
11401 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11402
11403 2009-01-19 Andreas Schwab <schwab@suse.de>
11404
11405 * configure.tgt (powerpc64-*): Fix targ_obj.
11406
11407 2009-01-15 Ian Lance Taylor <iant@google.com>
11408
11409 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11410 local symbols when stripping all symbols.
11411
11412 2009-01-14 Cary Coutant <ccoutant@google.com>
11413
11414 * output.cc (Output_reloc): Add explicit instantiations.
11415
11416 2009-01-14 Cary Coutant <ccoutant@google.com>
11417
11418 * archive.cc (Archive::get_elf_object_for_member): Remove call
11419 to File_read::claim_for_plugin.
11420 * descriptors.cc (Descriptors::open): Remove reference to
11421 is_claimed.
11422 (Descriptors::claim_for_plugin): Remove.
11423 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11424 (Descriptors::is_claimed): Remove.
11425 (claim_descriptor_for_plugin): Remove.
11426 * fileread.cc (File_read::claim_for_plugin): Remove.
11427 * fileread.h (File_read::claim_for_plugin): Remove.
11428 (File_read::descriptor): Reopen descriptor if necessary.
11429 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11430 (Plugin_manager::all_symbols_read): Add task parameter. Change
11431 all callers.
11432 (Plugin_manager::get_input_file): New function.
11433 (Plugin_manager::release_input_file): New function.
11434 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11435 corresponding data member.
11436 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11437 and pass to base constructor. Change all callers.
11438 (get_input_file, release_input_file): New functions.
11439 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11440 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11441 (Plugin_manager::all_symbols_read): Add task parameter.
11442 (Plugin_manager::get_input_file): New function.
11443 (Plugin_manager::release_input_file): New function.
11444 (Plugin_manager::task_): New data member.
11445 (Pluginobj::Pluginobj): Add filesize parameter.
11446 (Pluginobj::filename): New function.
11447 (Pluginobj::descriptor): New function.
11448 (Pluginobj::filesize): New function.
11449 (Pluginobj::filesize_): New data member.
11450 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11451 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11452 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11453
11454 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11455 with archive libraries.
11456 * testsuite/Makefile.in: Regenerate.
11457 * testsuite/plugin_test.c (struct sym_info): New type.
11458 (get_input_file, release_input_file): New static variables.
11459 (onload): Capture new transfer vector entries.
11460 (claim_file_hook): Stop reading at end of file according to filesize.
11461 Factor out parsing of readelf output into separate function.
11462 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11463 APIs and get the source file name from the symbol table. Convert
11464 source file name to corresponding object file name. Print info
11465 message when adding new input files.
11466 (parse_readelf_line): New function.
11467 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11468 * testsuite/plugin_test_2.sh: Likewise.
11469 * testsuite/plugin_test_3.sh: Likewise.
11470 * testsuite/plugin_test_4.sh: New test case.
11471
11472 2009-01-07 Ian Lance Taylor <iant@google.com>
11473
11474 * version.cc (version_string): Bump to 1.8.
11475
11476 2008-12-23 Cary Coutant <ccoutant@google.com>
11477
11478 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11479 * plugin.cc (Plugin_manager::finish): Rename as
11480 layout_deferred_objects. Move cleanup to separate function.
11481 (Plugin_manager::cleanup): New function.
11482 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11483 separately.
11484 * plugin.h (Plugin_manager::finish): Rename as
11485 layout_deferred_objects.
11486 (Plugin_manager::cleanup): New function.
11487 (Plugin_manager::cleanup_done): New field.
11488
11489 2008-12-23 Cary Coutant <ccoutant@google.com>
11490
11491 * plugin.cc (is_visible_from_outside): New function.
11492 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11493 so we don't return "IR only" status for exported symbols or -r links.
11494
11495 * testsuite/Makefile.am (plugin_test_3): New test case.
11496 * testsuite/Makefile.in: Regenerate.
11497 * testsuite/plugin_test_3.sh: New file.
11498
11499 2008-12-22 Cary Coutant <ccoutant@google.com>
11500
11501 * object.cc (Sized_relobj::layout_section): New function.
11502 (Sized_relobj::do_layout): Defer layout of input sections until after
11503 plugin has provided replacement files.
11504 (Sized_relobj::do_layout_deferred_sections): New function.
11505 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11506 (Relobj::layout_deferred_sections): New function.
11507 (Relobj::do_layout_deferred_sections): New function.
11508 (Sized_relobj::do_layout_deferred_sections): New function.
11509 (Sized_relobj::layout_section): New function.
11510 (Sized_relobj::Deferred_layout): New structure.
11511 (Sized_relobj::deferred_layout_): New field.
11512 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11513 Change all callers. Layout deferred sections.
11514 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11515 references.
11516 (Plugin_hook::run): Move code from do_plugin_hook inline.
11517 (Plugin_hook::do_plugin_hook): Remove.
11518 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11519 (Plugin_manager::finish): Renamed, was cleanup.
11520 (Plugin_manager::should_defer_layout): New function.
11521 (Plugin_manager::add_deferred_layout_object): New function.
11522 (Plugin_manager::Deferred_layout_list): New type.
11523 (Plugin_manager::deferred_layout_objects_): New field.
11524 (Plugin_hook::do_plugin_hook): Remove.
11525
11526 2008-12-17 Ian Lance Taylor <iant@google.com>
11527
11528 * options.h (class General_options): Add --no case for
11529 --export-dynamic.
11530
11531 2008-12-16 Cary Coutant <ccoutant@google.com>
11532
11533 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11534 vector.
11535 (Plugin_manager::claim_file): Create plugin object even if
11536 plugin did not call the add_symbols callback.
11537 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11538 asking for more symbols than were added.
11539 * testsuite/Makefile.am (plugin_test_1): Add test case with
11540 no global symbols.
11541 (empty.syms): New target.
11542 * testsuite/Makefile.in: Regenerate.
11543 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11544 message. Don't call add_symbols if no globals.
11545 (all_symbols_read_hook): Don't provide replacement for empty
11546 claimed file.
11547
11548 2008-12-12 Ian Lance Taylor <iant@google.com>
11549
11550 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11551 r_type == 0 for a local symbol with r_sym == 0.
11552 (scan_relocatable_relocs): Pass r_sym to
11553 local_non_section_strategy.
11554 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11555 r_sym parameter.
11556
11557 * configure.ac: Update test for TLS descriptors: they are
11558 supported as of glibc 2.9.
11559 * configure: Rebuild.
11560
11561 2008-12-11 Ian Lance Taylor <iant@google.com>
11562
11563 PR 7091
11564 * target-reloc.h (Default_scan_relocatable_relocs): For each
11565 function, map r_type == 0 to RELOC_DISCARD.
11566
11567 2008-12-10 Cary Coutant <ccoutant@google.com>
11568
11569 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11570 object to override a kept COMDAT group from a plugin object.
11571
11572 2008-12-09 Ian Lance Taylor <iant@google.com>
11573
11574 PR 7088
11575 * yyscript.y (file_cmd): Handle INPUT.
11576
11577 * testsuite/initpri1.c: Change all declarations to be full
11578 prototypes by adding void, to avoid compiler warnings.
11579
11580 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11581
11582 * options.cc (General_options::parse_plugin_opt): New.
11583 (General_options::add_plugin): The argument now is just the filename.
11584 (General_options::add_plugin_option): New.
11585 * options.h (plugin_opt): New.
11586 (add_plugin): Change argument name.
11587 (add_plugin_option): New.
11588 * plugin.cc (Plugin::load): Don't parse the plugin option.
11589 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11590 (Plugin::add_option): New.
11591 (Plugin::args_): Change type.
11592 (Plugin::filename_): New.
11593 (Plugin_manager::add_plugin_option): New.
11594 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11595 * testsuite/Makefile.in: Regenerate.
11596
11597 2008-12-05 Cary Coutant <ccoutant@google.com>
11598
11599 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11600 Handle --strip-lto-sections option.
11601 * options.h (strip_lto_sections): New option.
11602
11603 2008-12-01 Cary Coutant <ccoutant@google.com>
11604
11605 * plugin.cc (ld_plugin_message): Change format parameter to const.
11606 Fix mismatch between new[] and delete.
11607
11608 2008-11-14 Cary Coutant <ccoutant@google.com>
11609
11610 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11611 instead of -1U.
11612
11613 2008-11-05 Craig Silverstein <csilvers@google.com>
11614
11615 * options.cc (General_options::parse_dynamic_list): New function.
11616 * options.h (General_options): New flags dynamic_list,
11617 dynamic_list_data, dynamic_list_cpp_new, and
11618 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11619 (General_options::in_dynamic_list): New function.
11620 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11621 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11622 (Lex::can_continue_name): Likewise.
11623 (yylex): Likewise.
11624 (read_script_file): New parameter script_options.
11625 (read_dynamic_list): New function.
11626 (Script_options::define_dynamic_list): New function.
11627 (dynamic_list_keyword_parsecodes): New variable.
11628 (dynamic_list_keywords): New variable.
11629 * script.h (Script_options::define_dynamic_list): New function
11630 prototype.
11631 (read_dynamic_list): New function prototype.
11632 * symtab.cc (strprefix): New macro.
11633 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11634 dynamic_list_data, dynamic_list_cpp_new, and
11635 dynamic_list_cpp_typeinfo.
11636 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11637 (dynamic_list_expr): New rule.
11638 (dynamic_list_nodes): Likewise.
11639 (dynamic_list_node): Likewise.
11640 * testsuite/Makefile.am (dynamic_list): New test.
11641 * testsuite/Makefile.in: Regenerated.
11642 * testsuite/dynamic_list.t: New file.
11643 * testsuite/dynamic_list.sh: New file.
11644
11645 2008-11-05 Craig Silverstein <csilvers@google.com>
11646
11647 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11648 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11649 (t11_last): Likewise.
11650 * testsuite/ver_test_6.c (main): Likewise.
11651
11652 2008-10-07 Cary Coutant <ccoutant@google.com>
11653
11654 * options.c (General_options::finalize): Add check for -static and
11655 -shared.
11656 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11657 is not empty.
11658
11659 2008-10-02 Cary Coutant <ccoutant@google.com>
11660
11661 * plugin.cc (make_sized_plugin_object): Fix conditional
11662 compilation to work when not all targets are enabled.
11663
11664 2008-09-29 Cary Coutant <ccoutant@google.com>
11665
11666 * archive.cc (Archive::get_file_and_offset): Use filename instead
11667 of name to get library path.
11668 (Archive::include_member): Unlock external member of a thin archive.
11669
11670 * testsuite/Makefile.am (TEST_AR): New variable.
11671 (thin_archive_test_1): New test.
11672 (thin_archive_test_2): New test.
11673 * testsuite/Makefile.in: Regenerate.
11674 * testsuite/thin_archive_main.cc: New file.
11675 * testsuite/thin_archive_test_1.cc: New file.
11676 * testsuite/thin_archive_test_2.cc: New file.
11677 * testsuite/thin_archive_test_3.cc: New file.
11678 * testsuite/thin_archive_test_4.cc: New file.
11679
11680 2008-09-29 Cary Coutant <ccoutant@google.com>
11681
11682 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11683 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11684 instead of -1U.
11685 (Sized_relobj::do_finalize_local_symbols): Likewise.
11686 (Sized_relobj::map_to_kept_section): Likewise.
11687 * object.h (Sized_relobj::invalid_address): New constant.
11688 (Sized_relobj::do_output_section_offset): Check for invalid_address
11689 and return -1ULL.
11690 * output.cc (Output_reloc::local_section_offset): Use constant
11691 invalid_address instead of -1U.
11692 (Output_reloc::get_address): Likewise.
11693 (Output_section::output_address): Change -1U to -1ULL.
11694 * output.h (Output_reloc::invalid_address): New constant.
11695 * reloc.cc (Sized_relobj::write_sections): Use constant
11696 invalid_address instead of -1U.
11697 (Sized_relobj::relocate_sections): Likewise.
11698 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11699 values for merge sections.
11700 * target-reloc.h (relocate_for_relocatable): Use constant
11701 invalid_address instead of -1U.
11702
11703 2008-09-19 Cary Coutant <ccoutant@google.com>
11704
11705 Add plugin functionality for link-time optimization (LTO).
11706 * configure.ac (plugins): Add --enable-plugins option.
11707 * configure: Regenerate.
11708 * config.in: Regenerate.
11709 * Makefile.am (LIBDL): New variable.
11710 (CCFILES): Add plugin.cc.
11711 (HFILES): Add plugin.h.
11712 (ldadd_var): Add LIBDL.
11713 * Makefile.in: Regenerate.
11714
11715 * archive.cc: Include "plugin.h".
11716 (Archive::setup): Don't preread archive symbols when using a plugin.
11717 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11718 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11719 files.
11720 (Archive::include_member): Add symbols from plugin objects.
11721 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11722 * descriptors.cc (Descriptors::open): Check for file descriptors
11723 abandoned by plugins.
11724 (Descriptors::claim_for_plugin): New function.
11725 * descriptors.h (Descriptors::claim_for_plugin): New function.
11726 (Open_descriptor::is_claimed): New field.
11727 (claim_descriptor_for_plugin): New function.
11728 * fileread.cc (File_read::claim_for_plugin): New function.
11729 * fileread.h (File_read::claim_for_plugin): New function.
11730 (File_read::descriptor): New function.
11731 * gold.cc: Include "plugin.h".
11732 (queue_initial_tasks): Add task to call plugin hooks for generating
11733 new object files.
11734 * main.cc: Include "plugin.h".
11735 (main): Load plugin libraries.
11736 * object.h (Pluginobj): Declare.
11737 (Object::pluginobj): New function.
11738 (Object::do_pluginobj): New function.
11739 (Object::set_target): New function.
11740 * options.cc: Include "plugin.h".
11741 (General_options::parse_plugin): New function.
11742 (General_options::General_options): Initialize plugins_ field.
11743 (General_options::add_plugin): New function.
11744 * options.h (Plugin_manager): Declare.
11745 (General_options): Add --plugin option.
11746 (General_options::has_plugins): New function.
11747 (General_options::plugins): New function.
11748 (General_options::add_plugin): New function.
11749 (General_options::plugins_): New field.
11750 * plugin.cc: New file.
11751 * plugin.h: New file.
11752 * readsyms.cc: Include "plugin.h".
11753 (Read_symbols::do_read_symbols): Check for archive before checking
11754 for ELF file. Call plugin hooks to claim files.
11755 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11756 from a real object file; force override when processing replacement
11757 files.
11758 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11759 (Symbol::init_base_object): Likewise.
11760 (Symbol::init_base_output_data): Likewise.
11761 (Symbol::init_base_output_segment): Likewise.
11762 (Symbol::init_base_constant): Likewise.
11763 (Symbol::init_base_undefined): Likewise.
11764 (Symbol::output_section): Assert that object is not a plugin.
11765 (Symbol_table::add_from_pluginobj): New function.
11766 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11767 undefined.
11768 (Symbol_table::sized_write_globals): Likewise.
11769 (Symbol_table::add_from_pluginobj): Instantiate template.
11770 * symtab.h (Sized_pluginobj): Declare.
11771 (Symbol::in_real_elf): New function.
11772 (Symbol::set_in_real_elf): New function.
11773 (Symbol::in_real_elf_): New field.
11774 (Symbol_table::add_from_pluginobj): New function.
11775
11776 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11777 (LIBDL): New variable.
11778 (LDADD): Add LIBDL.
11779 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11780 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11781 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11782 (MOSTLYCLEANFILES): Likewise.
11783 * testsuite/Makefile.in: Regenerate.
11784 * testsuite/plugin_test.c: New file.
11785 * testsuite/plugin_test_1.sh: New file.
11786 * testsuite/plugin_test_2.sh: New file.
11787
11788 2008-09-16 Ian Lance Taylor <iant@google.com>
11789
11790 * target-reloc.h (relocate_section): Check whether a symbol is
11791 defined by the ABI before reporting an undefined symbol error.
11792 * target.h (Target::is_defined_by_abi): Make parameter const.
11793 (Target::do_is_defined_by_abi): Likewise.
11794 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11795 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11796 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11797 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11798 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11799 * testsuite/Makefile.in: Rebuild.
11800
11801 * fileread.cc (make_view): Add casts to avoid warning.
11802
11803 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11804
11805 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11806 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11807
11808 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11809
11810 * options.h (General_options::output_is_executable): New.
11811 (General_options::output_is_pie): New.
11812 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11813 for shared libraries.
11814 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11815
11816 2008-09-11 Chris Demetriou <cgd@google.com>
11817
11818 * options.h (origin): New -z option.
11819 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11820 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11821 in DT_FLAGS_1.
11822
11823 2008-09-05 Cary Coutant <ccoutant@google.com>
11824
11825 * fileread.cc (File_read::make_view): Add check for attempt to map
11826 beyond end of file.
11827
11828 2008-09-05 Cary Coutant <ccoutant@google.com>
11829
11830 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11831 explicit instantiations.
11832
11833 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11834
11835 PR gold/6858
11836 * options.cc (General_options::finalize): Allow undefined symbols
11837 in shlibs if linking -shared.
11838
11839 PR gold/6859
11840 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11841 symbols as not needing a dynsym entry.
11842
11843 2008-08-20 Craig Silverstein <csilvers@google.com>
11844
11845 * fileread.cc (File_read::open): Do not lock the file unless it
11846 was successfully opened.
11847
11848 2008-08-14 Cary Coutant <ccoutant@google.com>
11849
11850 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11851 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11852 * testsuite/tls_test.cc (struct int128): 128-bit struct
11853 for testing TLS relocs with non-zero addend.
11854 (v12): New TLS variable.
11855 (t12): New test.
11856 (t_last): Add check for v12.
11857 * testsuite/tls_test.h (t12): New function.
11858 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11859
11860 2008-08-13 Ian Lance Taylor <iant@google.com>
11861
11862 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11863 set tls_segment_ or relro_segment_.
11864 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11865 when appropriate.
11866 * output.h (Output_section::clear_is_relro): New function.
11867 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11868 sections specially even when output_data_ is empty.
11869 (Output_segment::maximum_alignment): When first section is relro,
11870 only force alignment for PT_LOAD segments.
11871 * script.cc (script_data_segment_align): New function.
11872 (script_data_segment_relro_end): New function.
11873 * script-c.h (script_data_segment_align): Declare.
11874 (script_data_segment_relro_end): Declare.
11875 * script-sections.h (class Script_sections): Declare
11876 data_segment_align and data_segment_relro_end. Add fields
11877 segment_align_index_ and saw_relro_end_.
11878 * script-sections.cc (class Sections_element): Add set_is_relro
11879 virtual function. Add new bool* parameter to place_orphan_here.
11880 Add get_output_section virtual function.
11881 (class Output_section_definition): Add set_is_relro. Add new
11882 bool* parameter to place_orphan_here. Add get_output_section.
11883 Add is_relro_ field.
11884 (Output_section_definition::Output_section_definition): Initialize
11885 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11886 and is_relro_ fields.
11887 (Output_section_definition::place_orphan_here): Add is_relro
11888 parameter.
11889 (Output_section_definition::set_section_addresses): Set relro for
11890 output section.
11891 (Output_section_definition::alternate_constraint): Likewise.
11892 (class Orphan_output_section): Add new bool* parameter to
11893 place_orphan_here. Add get_output_section.
11894 (Orphan_output_section::place_orphan_here): Add is_relro
11895 parameter.
11896 (Script_sections::Script_sections): Initialize
11897 data_segment_align_index_ and saw_relro_end_.
11898 (Script_sections::data_segment_align): New function.
11899 (Script_sections::data_segment_relro_end): New function.
11900 (Script_sections::place_orphan): Set or clear is_relro.
11901 (Script_sections::set_section_addresses): Force alignment of first
11902 TLS section.
11903 * yyscript.y (exp): Call script_data_segment_align and
11904 script_data_segment_relro_end.
11905 * testsuite/relro_script_test.t: New file.
11906 * testsuite/relro_test.cc (using_script): Declare.
11907 (t1, t2): Test using_script.
11908 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11909 (relro_script_test_SOURCES): Define.
11910 (relro_script_test_DEPENDENCIES): Define.
11911 (relro_script_test_LDFLAGS): Define.
11912 (relro_script_test_LDADD): Define.
11913 (relro_script_test.so): New target.
11914 * testsuite/Makefile.in: Rebuild.
11915
11916 2008-08-06 Cary Coutant <ccoutant@google.com>
11917
11918 * archive.cc (Archive::total_archives, Archive::total_members)
11919 (Archive::total_members_loaded): New variables.
11920 (Archive::setup): Add parameter. Add option to preread
11921 archive symbols.
11922 (Archive::read_armap): Add counter.
11923 (Archive::get_file_and_offset): New function.
11924 (Archive::get_elf_object_for_member): New function.
11925 (Archive::read_all_symbols): New function.
11926 (Archive::read_symbols): New function.
11927 (Archive::add_symbols): Add counters.
11928 (Archive::include_all_members): Use armap to find members if it's
11929 already built.
11930 (Archive::include_member): Skip reading symbols if already read.
11931 Factored code into Archive::get_file_and_offset and
11932 Archive::get_elf_object_for_member. Changed call to
11933 Mapfile::report_include_archive_member.
11934 (Archive::print_stats): New function.
11935 * archive.h: Declare Object and Read_symbols_data classes.
11936 (Archive::Archive): Add initializers for new members.
11937 (Archive::setup): Add parameter.
11938 (Archive::print_stats): New function.
11939 (Archive::total_archives, Archive::total_members)
11940 (Archive::total_members_loaded): New variables.
11941 (Archive::get_file_and_offset): New function.
11942 (Archive::get_elf_object_for_member): New function.
11943 (Archive::read_all_symbols): New function.
11944 (Archive::read_symbols): New function.
11945 (Archive::Archive_member): New class.
11946 (Archive::members_): New member.
11947 (Archive::num_members_): New member.
11948 * main.cc: Include archive.h.
11949 (main): Call Archive::print_stats.
11950 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11951 archive parameter; member_name is now the fully-decorated name.
11952 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11953 * options.h: (General_options): Add --preread-archive-symbols option.
11954 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11955 Archive::setup.
11956
11957 2008-08-04 Ian Lance Taylor <iant@google.com>
11958
11959 * symtab.h (Symbol::use_plt_offset): New function.
11960 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11961 * powerpc.cc (Relocate::relocate): Likewise.
11962 * sparc.cc (Relocate::relocate): Likewise.
11963 * x86_64.cc (Relocate::relocate): Likewise.
11964 * testsuite/weak_plt.sh: New test.
11965 * testsuite/weak_plt_main.cc: New test.
11966 * testsuite/weak_plt_shared.cc: New test.
11967 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11968 (check_PROGRAMS): Add weak_plt.
11969 (check_DATA): Add weak_plt_shared.so.
11970 (weak_plt_main_pic.o, weak_plt): New targets.
11971 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11972 * testsuite/Makefile.in: Rebuild.
11973
11974 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11975 gcctestdir/ld.
11976 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11977 * testsuite/Makefile.in: Rebuild.
11978
11979 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11980
11981 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11982 * Makefile.in: Regenerate.
11983 * po/POTFILES.in: Regenerate.
11984
11985 2008-07-29 Ian Lance Taylor <iant@google.com>
11986
11987 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11988 symbols before other symbols.
11989 * testsuite/script_test_2.cc (test_addr): Declare.
11990 (test_addr_alias): Declare.
11991 (main): Check that test_addr and test_addr_alias have the right
11992 values.
11993 * testsuite/script_test_2.t: Define test_addr_alias and
11994 test_addr.
11995
11996 2008-07-24 Ian Lance Taylor <iant@google.com>
11997
11998 PR 5990
11999 * descriptors.cc: New file.
12000 * descriptors.h: New file.
12001 * gold-threads.h (class Hold_optional_lock): New class.
12002 * fileread.cc: Include "descriptors.h".
12003 (File_read::~File_read): Release descriptor rather than closing
12004 it.
12005 (File_read::open) [file]: Call open_descriptor rather than open.
12006 Set is_descriptor_opened_.
12007 (File_read::open) [memory]: Assert that descriptor is not open.
12008 (File_read::reopen_descriptor): New function.
12009 (File_read::release): Release descriptor.
12010 (File_read::do_read): Make non-const. Reopen descriptor.
12011 (File_read::read): Make non-const.
12012 (File_read::make_view): Reopen descriptor.
12013 (File_read::do_readv): Likewise.
12014 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12015 Update declarations.
12016 * layout.cc: Include "descriptors.h".
12017 (Layout::create_build_id): Use open_descriptor rather than open.
12018 * output.cc: Include "descriptors.h".
12019 (Output_file::open): Use open_descriptor rather than open.
12020 * archive.cc (Archive::const_iterator): Change Archive to be
12021 non-const.
12022 (Archive::begin, Archive::end): Make non-const.
12023 (Archive::count_members): Likewise.
12024 * archive.h (class Archive): Update declarations.
12025 * object.h (Object::read): Make non-const.
12026 * Makefile.am (CCFILES): Add descriptors.cc.
12027 (HFILES): Add descriptors.h.
12028 * Makefile.in: Rebuild.
12029
12030 PR 6716
12031 * gold.h: Always include <clocale>. Add Solaris workarounds
12032 following code in binutils/sysdep.h.
12033
12034 PR 6048
12035 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12036 this->eh_frame_hdr_ is NULL before using it.
12037
12038 * dynobj.cc (Versions::Versions): Update comment.
12039
12040 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12041 the base version name.
12042
12043 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12044 array size plus one.
12045 (Stringpool_template::set_string_offsets): Subtract one from key
12046 before using it as an array index.
12047 (Stringpool_template::get_offset_with_length): Likewise.
12048 (Stringpool_template::write_to_buffer): Likewise.
12049 * stringpool.h (Stringpool_template::get_offset_from_key):
12050 Likewise.
12051
12052 2008-07-23 Ian Lance Taylor <iant@google.com>
12053
12054 PR 6658
12055 * object.h (Merged_symbol_value::value): Do our best to handle a
12056 negative addend.
12057
12058 PR 6647
12059 * script.cc (Version_script_info::get_versions): Don't add empty
12060 version tag to return value.
12061 (Version_script_info::get_symbol_version_helper): Change return
12062 type to bool. Add pversion parameter. Change all callers.
12063 (script_register_vers_node): Don't require a non-NULL tag.
12064 * script.h (class Version_script_info): Update declarations.
12065 (Version_script_info::get_symbol_version): Change return type to
12066 bool. Add version parameter. Change all callers.
12067 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12068 handling. Handle an empty version from a version script.
12069 (Symbol_table::define_special_symbol): Likewise.
12070 * testsuite/ver_test_10.script: New file.
12071 * testsuite/ver_test_10.sh: New file.
12072 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12073 (check_DATA): Add ver_test_10.syms.
12074 (ver_test_10.syms, ver_test_10.so): New target.
12075 * testsuite/Makefile.in: Rebuild.
12076
12077 2008-07-23 Simon Baldwin <simonb@google.com>
12078
12079 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12080 to zero for undefined symbols from dynamic libraries.
12081
12082 2008-07-23 Ian Lance Taylor <iant@google.com>
12083
12084 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12085 Change all callers.
12086 * symtab.h (class Symbol_table): Update declaration.
12087 * testsuite/ver_test_9.cc: New file.
12088 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12089 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12090 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12091 (ver_test_9.so, ver_test_9.o): New targets.
12092 * testsuite/Makefile.in: Rebuild.
12093
12094 2008-07-22 Ian Lance Taylor <iant@google.com>
12095
12096 * options.h (class General_options): Define --check-sections.
12097 * layout.cc (Layout::set_segment_offsets): Handle
12098 --check-sections.
12099
12100 * options.h (class General_options): Define -n/--nmagic and
12101 -N/--omagic.
12102 * options.cc (General_options::finalize): For -n/--nmagic or
12103 -N/--omagic, set -static.
12104 * layout.cc (Layout::attach_allocated_section_to_segment): If
12105 -N/--omagic, don't put read-only and read-write sections in
12106 different segments.
12107 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12108 finding a read-only segment.
12109 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12110 don't set the minimum segment alignment to the common page size,
12111 and don't set the file offset to the address modulo the page size.
12112 * script-sections.cc (Script_sections::create_segments): If
12113 -n/--omagic, don't put read-only and read-write sections in
12114 different segments.
12115
12116 * cref.cc: New file.
12117 * cref.h: New file.
12118 * options.h (class General_options): Add --print-symbol-counts.
12119 * main.cc (main): Issue defined symbol report if requested.
12120 * archive.cc (Archive::interpret_header): Make into a const member
12121 function.
12122 (Archive::add_symbols): Call Input_objects::archive_start and
12123 archive_stop.
12124 (Archive::const_iterator): Define new class.
12125 (Archive::begin, Archive::end): New functions.
12126 (Archive::include_all_members): Rewrite to use iterator.
12127 (Archive::count_members): New function.
12128 * archive.h (class Archive): Update declarations.
12129 (Archive::filename): New function.
12130 * object.cc: Include "cref.h".
12131 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12132 (Sized_relobj::do_get_global_symbol_counts): New function.
12133 (Input_objects::add_object): Add object to cross-referencer.
12134 (Input_objects::archive_start): New function.
12135 (Input_objects::archive_stop): New function.
12136 (Input_objects::print_symbol_counts): New function.
12137 * object.h: Declare Cref and Archive.
12138 (Object::get_global_symbol_counts): New function.
12139 (Object::do_get_global_symbol_counts): New pure virtual function.
12140 (class Sized_relobj): Add defined_count_ field. Update
12141 declarations.
12142 (class Input_objects): Add cref_ field. Update constructor.
12143 Update declarations.
12144 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12145 defined_count_.
12146 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12147 symbol counts.
12148 (Sized_dynobj::do_get_global_symbol_counts): New function.
12149 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12150 defined_count_. Update declarations. Define Symbols typedef.
12151 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12152 parameter. Change all callers.
12153 (Symbol_table::add_from_dynobj): Add sympointers and defined
12154 parameters. Change all callers.
12155 * symtab.h (class Symbol_table): Update declarations.
12156 * Makefile.am (CCFILES): Add cref.cc.
12157 (HFILES): Add cref.h.
12158 * Makefile.in: Rebuild.
12159
12160 2008-07-22 Simon Baldwin <simonb@google.com>
12161
12162 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12163 to zero when writing undefined symbols.
12164
12165 2008-07-22 Ian Lance Taylor <iant@google.com>
12166
12167 * output.cc (Output_section::add_input_section): Don't try to
12168 merge empty merge sections.
12169
12170 2008-07-21 Craig Silverstein <csilvers@google.com>
12171
12172 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12173 Include symbol version in error message.
12174
12175 2008-07-20 Chris Demetriou <cgd@google.com>
12176
12177 * configure.ac (gold_cv_c_random_seed): New configured variable.
12178 (RANDOM_SEED_CFLAGS): New substituted variable.
12179 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12180 * configure: Rebuild.
12181 * Makefile.in: Likewise.
12182 * testsuite/Makefile.in: Likewise.
12183
12184 2008-07-18 Ian Lance Taylor <iant@google.com>
12185
12186 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12187 where we see NAME/NULL and NAME/VERSION as separate symbols.
12188 * testsuite/ver_test_main.cc (main): Call t4.
12189 (t4, t4_2a): Define.
12190 * testsuite/ver_test_2.cc (t4_2): Define.
12191 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12192 * testsuite/ver_test_4.cc (t4_2a): Define.
12193 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12194 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12195
12196 2008-07-17 Ian Lance Taylor <iant@google.com>
12197
12198 * dynobj.cc (Versions::add_def): If we give an error about a
12199 missing version, go ahead and create the version anyhow.
12200
12201 2008-07-10 Ian Lance Taylor <iant@google.com>
12202
12203 Handle output sections with more than 0x7fffffff bytes.
12204 * object.h (class Relobj): Change map_to_output_ to
12205 output_sections_, and just keep a section pointer. Change all
12206 uses. Move comdat group support to Sized_relobj.
12207 (Relobj::is_section_specially_mapped): Remove.
12208 (Relobj::output_section): Remove poff parameter. Change all
12209 callers.
12210 (Relobj::output_section_offset): New function.
12211 (Relobj::set_section_offset): Rewrite.
12212 (Relobj::map_to_output): Remove.
12213 (Relobj::output_sections): New function.
12214 (Relobj::do_output_section_offset): New pure virtual function.
12215 (Relobj::do_set_section_offset): Likewise.
12216 (class Sized_relobj): Add section_offsets_ field. Add comdat
12217 group support from Relobj. Update declarations.
12218 (Sized_relobj::get_output_section_offset): New function.
12219 (Sized_relobj::do_output_section_offset): New function.
12220 (Sized_relobj::do_set_section_offset): New function.
12221 * object.cc (Relobj::output_section_address): Remove.
12222 (Sized_relobj::Sized_relobj): Initialize new fields.
12223 (Sized_relobj::include_section_group): Cast find_kept_object to
12224 Sized_relobj.
12225 (Sized_relobj::include_linkonce_section): Likewise.
12226 (Sized_relobj::do_layout): Use separate arrays for output section
12227 and output offset.
12228 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12229 output_sections.
12230 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12231 output_sections and section_offsets.
12232 (Sized_relobj::write_local_symbols): Likewise.
12233 (map_to_kept_section): Compute output address directly.
12234 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12235 output_sections and section_offsets.
12236 (Sized_relobj::write_sections): Likewise.
12237 (Sized_relobj::relocate_sections): Likewise.
12238 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12239 * output.h (class Output_reloc): Update declarations. Change
12240 u2_.relobj to Sized_relobj*.
12241 (class Output_data_reloc): Change add functions to use
12242 Sized_relobj*.
12243 * output.cc (Output_reloc::Output_reloc): Change relobj to
12244 Sized_relobj*.
12245 (Output_reloc::local_section_offset): Change return type to
12246 Elf_Addr. Use get_output_section_offset.
12247 (Output_reloc::get_address): Likewise.
12248 (Output_section::is_input_address_mapped): Don't call
12249 is_section_specially_mapped.
12250 (Output_section::output_offset): Likewise.
12251 (Output_section::output_address): Likewise.
12252 (Output_section::starting_output_address): Likewise.
12253 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12254 parameter to Sized_relobj*.
12255 (Copy_relocs::need_copy_reloc): Likewise.
12256 (Copy_relocs::save): Likewise.
12257 * copy-relocs.h (class Copy_relocs): Update declarations.
12258 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12259 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12260 * target-reloc.h (relocate_for_relocatable): Change
12261 offset_in_output_section type to Elf_Addr. Change code that uses
12262 it as well.
12263 * layout.cc (Layout::layout): Always set *off.
12264 * mapfile.cc (Mapfile::print_input_section): Use
12265 output_section_offset.
12266 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12267 Sized_relobj*.
12268 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12269 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12270 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12271
12272 2008-07-03 Ian Lance Taylor <iant@google.com>
12273
12274 * layout.cc (Layout::include_section): Do not discard unrecognized
12275 SHT_STRTAB sections.
12276
12277 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12278
12279 * script.cc (Lex::can_continue_name): Make '?' allowable in
12280 version-script names.
12281 * testsuite/version_script.map: Change glob pattern to use '?'
12282
12283 2008-06-30 Manish Singh <yosh@gimp.org>
12284
12285 PR 6585
12286 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12287 Correct typo.
12288
12289 2008-06-30 Ian Lance Taylor <iant@google.com>
12290
12291 PR 6660
12292 PR 6682
12293 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12294 versions]: Don't try to read the value in the contents, since we
12295 don't use it. Use the template endianness when writing.
12296
12297 2008-06-25 Cary Coutant <ccoutant@google.com>
12298
12299 * fileread.cc (File_read::make_view): Assert on zero-length view.
12300 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12301 symbol table when there are no symbols to read.
12302
12303 2008-06-23 Craig Silverstein <csilvers@google.com>
12304
12305 * version.cc (version_string): Bump to 1.7
12306
12307 2008-06-18 Craig Silverstein <csilvers@google.com>
12308
12309 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12310 constant 0xFFFF to type Valtype.
12311 (Powerpc_relocate_functions::rel16_ha): Likewise.
12312
12313 2008-06-17 Ian Lance Taylor <iant@google.com>
12314
12315 * output.h (Output_section::Input_section): Initialize p2align_ to
12316 zero for Output_section_data constructors.
12317 (Output_section::Input_section::addralign): If not an input
12318 section, return the alignment of the Output_section_data.
12319 * testsuite/copy_test.cc: New file.
12320 * testsuite/copy_test_1.cc: New file.
12321 * testsuite/copy_test_2.cc: New file.
12322 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12323 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12324 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12325 (copy_test_1_pic.o, copy_test_1.so): New targets.
12326 (copy_test_2_pic.o, copy_test_2.so): New targets.
12327 * testsuite/Makefile.in: Rebuild.
12328
12329 * script-sections.cc (Script_sections::place_orphan): Initialize
12330 local variable exact.
12331
12332 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12333
12334 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12335
12336 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12337 David S. Miller <davem@davemloft.net>
12338
12339 * powerpc.cc: New file.
12340 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12341 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12342 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12343 * Makefile.in: Rebuild.
12344
12345 2008-06-09 Ian Lance Taylor <iant@google.com>
12346
12347 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12348 <exception>.
12349 (throwing, orig_terminate): New static variables.
12350 (terminate_handler): New static function.
12351 (t2): Set terminate handler.
12352
12353 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12354
12355 PR 6584
12356 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12357 alignment.
12358
12359 2008-05-30 Cary Coutant <ccoutant@google.com>
12360
12361 * archive.cc (Archive::include_all_members) Correct to step
12362 over symbol table and extended name table in thin archives.
12363
12364 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12365
12366 PR 6407
12367 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12368 calculation.
12369
12370 2008-05-28 Caleb Howe <cshowe@google.com>
12371
12372 * reduced_debug_output.cc: New file.
12373 * reduced_debug_output.h: New file.
12374 * options.h (class General_options): Add --strip-debug-non-line.
12375 * options.cc (General_options::finalize): Add strip_debug_non_line
12376 to the strip heirarchy.
12377 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12378 fields.
12379 * layout.cc: Include "reduced_debug_output.h".
12380 (Layout::Layout): Initialize new fields.
12381 (line_only_debug_sections): New static array.
12382 (is_lines_only_debug_sections): New static inline function.
12383 (Layout::include_section): Handle --strip-debug-non-line.
12384 (Layout::make_output_section): If --strip-debug-non-line, build
12385 new output sections for .debug_abbrev and .debug_info.
12386 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12387 gold. Warn about possible overflow.
12388 (read_signed_LEB_128): Likewise.
12389 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12390 (read_signed_LEB_128): Declare.
12391 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12392 (HFILES): Add reduced_debug_output.h.
12393 * Makefile.in: Rebuild.
12394
12395 2008-05-21 Ian Lance Taylor <iant@google.com>
12396
12397 * mapfile.cc: New file.
12398 * mapfile.h: New file.
12399 * options.h (class General_options): Add -M/--print-map and -Map.
12400 * options.cc (General_options::finalize): Make -M equivalent to
12401 -Map -.
12402 * main.cc: Include <cstdio> and "mapfile.h".
12403 (main): Open mapfile if requested.
12404 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12405 constructor. Change caller.
12406 (queue_initial_tasks): Add mapfile parameter. Change caller.
12407 (queue_middle_tasks): Likewise.
12408 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12409 declarations.
12410 * archive.cc: Include "mapfile.h".
12411 (Archive::add_symbols): Add mapfile parameter. Change all
12412 callers. Pass mapfile, symbol, and reason to include_member.
12413 (Archive::include_all_members): Add mapfile parameter. Change all
12414 callers.
12415 (Archive::include_member): Add mapfile, sym, and why parameters.
12416 Change all callers. Report inclusion to map file.
12417 * archive.h: Include "fileread.h".
12418 (class Archive): Update declarations.
12419 (Archive::file): New const method.
12420 (class Add_archive_symbols): Add mapfile_ field. Update
12421 constructor. Change all callers.
12422 * readsyms.h (class Read_symbols): Likewise.
12423 (class Finish_group): Likewise.
12424 (class Read_script): Likewise.
12425 * common.cc: Include "mapfile.h".
12426 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12427 all callers.
12428 (Symbol_table::do_allocate_commons): Likewise.
12429 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12430 symbol allocation to mapfile.
12431 * common.h (class Allocate_commons_task): Add mapfile_ field.
12432 Update constructor. Change all callers.
12433 * symtab.h (class Symbol_table): Update declarations.
12434 * layout.cc: Include "mapfile.h".
12435 (Layout_task_runner::run): Print information to mapfile.
12436 (Layout::create_gold_note): Change Output_data_fixed_space to
12437 Output_data_zero_fill.
12438 (Layout::create_build_id): Likewise.
12439 (Layout::print_to_mapfile): New function.
12440 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12441 constructor. Change caller.
12442 (class Layout): Declare print_to_mapfile.
12443 * output.cc (Output_section::Input_section::print_to_mapfile): New
12444 function.
12445 (Output_section::add_input_section): If producing a map, always
12446 add to input_sections_ list.
12447 (Output_section::do_print_to_mapfile): New function.
12448 (Output_segment::print_sections_to_mapfile): New function.
12449 (Output_segment::print_section_list_to_mapfile): New function.
12450 * output.h: Include "mapfile.h".
12451 (Output_data::print_to_mapfile): New function.
12452 (Output_data::do_print_to_mapfile): New virtual function.
12453 (Output_segment_headers::do_print_to_mapfile): New function.
12454 (Output_file_header::do_print_to_mapfile): New function.
12455 (Output_data_const::do_print_to_mapfile): New function.
12456 (class Output_data_const_buffer): Add map_name_ field. Update
12457 constructor. Change all callers. Add do_print_to_mapfile
12458 function.
12459 (class Output_data_fixed_space): Likewise.
12460 (class Output_data_space): Likewise.
12461 (class Output_data_zero_fill): New class.
12462 (Output_data_strtab::do_print_to_mapfile): New function.
12463 (Output_data_reloc_base::do_print_to_mapfile): New function.
12464 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12465 (Output_data_group::do_print_to_mapfile): New function.
12466 (Output_data_got::do_print_to_mapfile): New function.
12467 (Output_data_dynamic::do_print_to_mapfile): New function.
12468 (Output_symtab_xindex::do_print_to_mapfile): New function.
12469 (class Output_section): Declare do_print_to_mapflie. Declare
12470 print_to_mapfile in Input_section.
12471 (class Output_segment): Declare new functions.
12472 * object.h (Sized_relobj::symbol_count): New function.
12473 * script-sections.cc
12474 (Output_section_element_dot_assignment::set_section_addresses):
12475 Change Output_data_fixed_space to Output_data_zero_fill.
12476 (Output_data_expression::do_print_to_mapfile): New function.
12477 * script.cc (read_input_script): Add mapfile parameter. Change
12478 all callers.
12479 * script.h (read_input_script): Update declaration.
12480 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12481 (Eh_frame::do_print_to_mapfile): New function.
12482 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12483 (Output_merge_string::do_print_to_mapfile): New function.
12484 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12485 function.
12486 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12487 function.
12488 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12489 function.
12490 * Makefile.am (CCFILES): Add mapfile.cc.
12491 (HFILES): Add mapfile.h.
12492 * Makefile.in: Rebuild.
12493
12494 2008-05-19 Ian Lance Taylor <iant@google.com>
12495
12496 * options.h (class General_options): Add -z relro.
12497 * layout.cc (Layout::Layout): Initialize relro_segment_.
12498 (Layout::add_output_section_data): Return the output section.
12499 (Layout::make_output_section): Rcognize relro sections and mark
12500 them appropriately.
12501 (Layout::attach_allocated_section_to_segment): Put relro sections
12502 in a PT_GNU_RELRO segment.
12503 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12504 section as relro.
12505 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12506 PT_TLS segments.
12507 (Layout::linkonce_mapping): Map d.rel.ro.local to
12508 .data.rel.ro.local.
12509 (Layout::output_section_name): Us .data.rel.ro.local for any
12510 section which begins with that.
12511 * layout.h (class Layout): Update add_output_section_data
12512 declaration. Add relro_segment_ field.
12513 * output.cc (Output_section::Output_section): Initialize is_relro_
12514 and is_relro_local_ fields.
12515 (Output_segment::add_output_section): Group relro sections.
12516 (Output_segment::is_first_section_relro): New function.
12517 (Output_segment::maximum_alignment): If there is a relro section,
12518 align the segment to the common page size.
12519 (Output_segment::set_section_addresses): Track whether we are
12520 looking at relro sections. If the last section is a relro
12521 section, align to the common page size.
12522 (Output_segment::set_section_list_addresses): Add in_relro
12523 parameter. Change all callers. Align to the page size when
12524 moving from relro to non-relro section.
12525 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12526 segment.
12527 * output.h (class Output_section): Add is_relro_ and
12528 is_relro_local_ fields.
12529 (Output_section::is_relro): New function.
12530 (Output_section::set_is_relro): New function.
12531 (Output_section::is_relro_local): New function.
12532 (Output_section::set_is_relro_local): New function.
12533 (class Output_segment): Update declarations.
12534 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12535 * sparc.cc (Target_sparc::got_section): Likewise.
12536 * x86_64.cc (Target_x86_64::got_section): Likewise.
12537 * testsuite/relro_test_main.cc: New file.
12538 * testsuite/relro_test.cc: New file.
12539 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12540 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12541 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12542 (relro_test.so, relro_test_pic.o): New targets.
12543 * testsuite/Makefile.in: Rebuild.
12544
12545 2008-05-16 Ian Lance Taylor <iant@google.com>
12546
12547 * output.cc (Output_segment::add_output_section): Remove front
12548 parameter.
12549 * output.h (class Output_segment): Remove
12550 add_initial_output_section and overloaded add_output_section.
12551 Update declaration of remaining add_output_section.
12552 * layout.cc (Layout::create_interp): Call add_output_section
12553 rather than add_initial_output_section.
12554 (Layout::finish_dynamic_section): Likewise.
12555
12556 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12557 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12558 know the dynamic type.
12559 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12560 field. Initialize it in constructor.
12561 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12562 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12563 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12564 reloc.
12565
12566 * output.cc (Output_reloc::get_address): Change return type to
12567 Elf_Addr.
12568 * output.h (class Output_reloc): Update get_address declaration.
12569 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12570 for section addresses.
12571
12572 2008-05-09 Ian Lance Taylor <iant@google.com>
12573
12574 PR 6493
12575 * gold.cc (gold_nomem): Use return value of write.
12576
12577 2008-05-08 Ian Lance Taylor <iant@google.com>
12578
12579 * symtab.c (Symbol::init_base_output_data): Add version
12580 parameter. Change all callers.
12581 (Symbol::init_base_output_segment): Likewise.
12582 (Symbol::init_base_constant): Likewise.
12583 (Symbol::init_base_undefined): Likewise.
12584 (Sized_symbol::init_output_data): Likewise.
12585 (Sized_symbol::init_output_segment): Likewise.
12586 (Sized_symbol::init_constant): Likewise.
12587 (Sized_symbol::init_undefined): Likewise.
12588 (Symbol_table::do_define_in_output_data): If the new symbol has a
12589 version, mark it as the default.
12590 (Symbol_table::do_define_in_output_segment): Likewise.
12591 (Symbol_table::do_define_as_constant): Likewise.
12592 * symtab.h (class Symbol): Update declarations.
12593 (class Sized_symbol): Likewise.
12594 * resolve.cc (Symbol::override_version): New function.
12595 (Symbol::override_base): Call override_version.
12596 (Symbol::override_base_with_special): Likewise.
12597 * testsuite/ver_script_8.script: New file.
12598 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12599 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12600 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12601 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12602
12603 2008-05-06 Ian Lance Taylor <iant@google.com>
12604
12605 PR 6049
12606 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12607 functions.
12608 (class General_options): Remove existing --undefined, and add
12609 --no-undefined instead. Add new --undefined as synonym for -u.
12610 * archive.cc (Archive::add_symbols): Check whether symbol was
12611 named with -u.
12612 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12613 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12614 all uses. Add IS_UNDEFINED. Update declarations to split
12615 different versions of init_base. Declare init_base_undefined.
12616 (Symbol::is_defined): Handle IS_UNDEFINED.
12617 (Symbol::is_undefined): Likewise.
12618 (Symbol::is_weak_undefined): Call is_undefined.
12619 (Symbol::is_absolute): Handle IS_CONSTANT.
12620 (class Sized_symbol): Update declarations to split different
12621 versions of init. Declare init_undefined.
12622 (class Symbol_table): Declare new functions.
12623 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12624 Change all callers.
12625 (Symbol::init_base_output_data): Likewise.
12626 (Symbol::init_base_output_segment): Likewise.
12627 (Symbol::init_base_constant): Likewise.
12628 (Symbol::init_base_undefined): New function.
12629 (Sized_symbol::init_object): Rename from init. Change all
12630 callers.
12631 (Sized_symbol::init_output_data): Likewise.
12632 (Sized_symbol::init_output_segment): Likewise.
12633 (Sized_symbol::init_constant): Likewise.
12634 (Sized_symbol::init_undefined): New function.
12635 (Symbol_table::add_undefined_symbols_from_command_line): New
12636 function.
12637 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12638 function.
12639 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12640 (Symbol::output_section): Likewise.
12641 (Symbol::set_output_section): Likewise.
12642 (Symbol_table::sized_finalize_symbol): Likewise.
12643 (Symbol_table::sized_write_globals): Likewise.
12644 * resolve.cc (Symbol_table::should_override): Likewise.
12645 (Symbol::override_base_with_special): Likewise.
12646
12647 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12648 symbol, change it to have default visibility.
12649 * testsuite/protected_1.cc: New file.
12650 * testsuite/protected_2.cc: New file.
12651 * testsuite/protected_3.cc: New file.
12652 * testsuite/protected_main_1.cc: New file.
12653 * testsuite/protected_main_2.cc: New file.
12654 * testsuite/protected_main_3.cc: New file.
12655 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12656 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12657 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12658 (protected_1.so): New target.
12659 (protected_1_pic.o, protected_2_pic.o): New targets.
12660 (protected_3_pic.o): New target.
12661 (check_PROGRAMS): Add protected_2.
12662 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12663 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12664 * testsuite/Makefile.in: Rebuild.
12665
12666 * options.h (DEFINE_var): Add set_user_set_##varname__.
12667 (DEFINE_bool_alias): New macro.
12668 (class General_options): Define -Bstatic using DEFINE_bool_alias
12669 rather than DEFINE_special. Add --undefined as an alias for -z
12670 defs.
12671 * options.cc (General_options::parse_Bstatic): Remove.
12672
12673 * options.h (class General_options): Add --fatal-warnings.
12674 * main.cc (main): Implement --fatal-warnings.
12675 * errors.h (Errors::warning_count): New function.
12676
12677 * options.h (class General_options): Add -Bsymbolic-functions.
12678 * symtab.h (Symbol::is_preemptible): Check for
12679 -Bsymbolic-functions.
12680
12681 2008-05-05 Ian Lance Taylor <iant@google.com>
12682
12683 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12684 as noVARNAME rather than no-VARNAME.
12685 (class General_options): Add option -z combreloc.
12686 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12687 get_address.
12688 (Output_reloc::sort_before) [SHT_REL]: New function.
12689 (Output_reloc::sort_before) [SHT_RELA]: New function.
12690 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12691 Sort_relocs_comparison.
12692 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12693 parameter. Change all callers.
12694 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12695 sort_relocs parameter. Change all callers.
12696 * output.cc (Output_reloc::get_address): New function, broken out
12697 of write_rel.
12698 (Output_reloc::write_rel): Call it.
12699 (Output_reloc::compare): New function.
12700 (Output_data_reloc_base::do_write): Optionally sort relocs.
12701
12702 * configure.ac: If targ_extra_obj is set, link it in.
12703 * configure.tgt: Initialize all variables.
12704 (x86_64*): Set targ_extra_obj and targ_extra_size.
12705 * configure: Rebuild.
12706
12707 * object.cc (Sized_relobj::include_section_group): Adjust section
12708 indexes read from group data. Build vector to pass to
12709 layout_group.
12710 * layout.cc (Layout::layout_group): Add flags and shndxes
12711 parameters. Remove contents parameter. Change caller. Update
12712 explicit instantiations.
12713 * layout.h (class Layout): Update layout_group declaration.
12714 * output.cc (Output_data_group::Output_data_group): Add flags and
12715 input_shndxes parameters. Remove contents parameter. Change
12716 caller.
12717 (Output_data_group::do_write): Change input_sections_ to
12718 input_shndxes_.
12719 * output.h (class Output_data_group): Update constructor
12720 declaration. Rename input_sections_ to input_shndxes_.
12721 * testsuite/many_sections_test.cc: Add template.
12722
12723 2008-04-30 Cary Coutant <ccoutant@google.com>
12724
12725 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12726
12727 * layout.cc (Layout::include_section): Refactored check for debug
12728 info section.
12729 (Layout::add_comdat): Add new parameters. Change type
12730 of signature parameter. Add object and shndx to signatures table.
12731 (Layout::find_kept_object): New function.
12732 * layout.h: Include <cstring>.
12733 (Layout::is_debug_info_section): New function.
12734 (Layout::add_comdat): Add new parameters.
12735 (Layout::find_kept_object): New function.
12736 (Layout::Kept_section): New struct.
12737 (Layout::Signatures): Change type of map range.
12738 * object.cc (Relobj::output_section_address): New function.
12739 (Sized_relobj::include_section_group): Add new parameters. Change
12740 calls to Layout::add_comdat. Change to build table of kept comdat
12741 groups and table mapping discarded sections to kept sections.
12742 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12743 (Sized_relobj::do_layout): Change calls to include_section_group and
12744 include_linkonce_section.
12745 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12746 value to zero when section is discarded.
12747 (Sized_relobj::map_to_kept_section): New function.
12748 * object.h (Relobj::output_section_address): New function.
12749 (Relobj::Comdat_group): New type.
12750 (Relobj::find_comdat_group): New function.
12751 (Relobj::Comdat_group_table): New type.
12752 (Relobj::Kept_comdat_section): New type.
12753 (Relobj::Kept_comdat_section_table): New type.
12754 (Relobj::add_comdat_group): New function.
12755 (Relobj::set_kept_comdat_section): New function.
12756 (Relobj::get_kept_comdat_section): New function.
12757 (Relobj::comdat_groups_): New field.
12758 (Relobj::kept_comdat_sections_): New field.
12759 (Symbol_value::input_value): Update comment.
12760 (Sized_relobj::map_to_kept_section) New function.
12761 (Sized_relobj::include_linkonce_section): Add new parameter.
12762 * target-reloc.h (Comdat_behavior): New type.
12763 (get_comdat_behavior): New function.
12764 (relocate_section): Add code to map a discarded section to the
12765 corresponding kept section when applying a relocation.
12766
12767 2008-04-30 Craig Silverstein <csilvers@google.com>
12768
12769 * dwarf_reader.cc (next_generation_count): New static var.
12770 (Addr2line_cache_entry): New struct.
12771 (addr2line_cache): New static var.
12772 (Dwarf_line_info::one_addr2line): Added caching.
12773 (Dwarf_line_info::clear_addr2line_cache): New function.
12774 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12775 cache-size parameter.
12776 (Dwarf_line_info::one_addr2line_cache): New function.
12777 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12778 new cache-size argument to one_addr2line(), and clear cache.
12779
12780 2008-04-28 Cary Coutant <ccoutant@google.com>
12781
12782 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12783 R_386_PC8 relocations.
12784
12785 2008-04-23 Ian Lance Taylor <iant@google.com>
12786
12787 * object.cc (Sized_relobj::include_section_group): Check for
12788 invalid section group.
12789
12790 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12791 header size.
12792
12793 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12794 than read for file header.
12795 * archive.cc (Archive::include_member): Likewise.
12796
12797 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12798
12799 * aclocal.m4: Regenerate.
12800 * configure: Regenerate.
12801
12802 2008-04-19 Ian Lance Taylor <iant@google.com>
12803
12804 * version.cc (version_string): Bump to 1.6.
12805
12806 * testsuite/Makefile.am (many_sections_r_test): New target.
12807 (many_sections_r_test_SOURCES): Remove.
12808 (many_sections_r_test_DEPENDENCIES): Remove.
12809 (many_sections_r_test_LDFLAGS): Remove.
12810 (many_sections_r_test_LDADD): Remove.
12811
12812 * object.cc (Sized_relobj::do_add_symbols): Always pass
12813 local_symbol_count_ to add_from_relobj.
12814
12815 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12816 every thousand variables.
12817 * testsuite/Makefile.in: Rebuild.
12818
12819 * object.cc (Xindex::initialize_symtab_xindex): New function.
12820 (Xindex::read_symtab_xindex): New function.
12821 (Xindex::sym_xindex_to_shndx): New function.
12822 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12823 available.
12824 (Sized_relobj::do_initialize_xindex): New function.
12825 (Sized_relobj::do_read_symbols): Adjust section links.
12826 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12827 parameter. Change all callers.
12828 (Sized_relobj::include_section_group): Adjust section links and
12829 symbol section indexes.
12830 (Sized_relobj::do_layout): Adjust section links.
12831 (Sized_relobj::do_count_local_symbols): Adjust section links and
12832 symbol section indexes.
12833 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12834 ordinary and special symbols.
12835 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12836 dynsym_xindex parameters. Change all callers. Adjust section
12837 links. Use SHN_XINDEX when needed.
12838 (Sized_relobj::get_symbol_location_info): Adjust section links.
12839 Don't get fooled by special symbols.
12840 * object.h (class Xindex): Define.
12841 (class Object): Add xindex_ parameter. Declare virtual functoin
12842 do_initialize_xindex.
12843 (Object::adjust_sym_shndx): New function.
12844 (Object::set_xindex): New protected function.
12845 (class Symbol_value): Add is_ordinary_shndx_ field.
12846 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12847 (Symbol_value::value): Assert ordinary section.
12848 (Symbol_value::initialize_input_to_output_map): Likewise.
12849 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12850 Change all callers.
12851 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12852 all callers.
12853 (class Sized_relobj): Update declarations.
12854 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12855 parameter. Change all callers.
12856 (Sized_relobj::adjust_shndx): New function.
12857 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12858 field.
12859 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12860 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12861 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12862 (Sized_dynobj::read_dynsym_section): Adjust section links.
12863 (Sized_dynobj::read_dynamic): Likewise.
12864 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12865 section links.
12866 (Sized_dynobj::do_initialize_xindex): New function.
12867 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12868 do_initialize_xindex.
12869 (Sized_dynobj::adjust_shndx): New function.
12870 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12871 dynsym_xindex_ fields.
12872 (Layout::finalize): Add a call to set_section_indexes before
12873 creating the symtab sections.
12874 (Layout::set_section_indexes): Don't do anything if the section
12875 already has a section index.
12876 (Layout::create_symtab_sections): Add shnum parameter. Change
12877 caller. Create .symtab_shndx section if needed.
12878 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12879 caller.
12880 (Layout::allocated_output_section_count): New function.
12881 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12882 needed.
12883 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12884 fields. Update declarations.
12885 (Layout::symtab_xindex): New function.
12886 (Layout::dynsym_xindex): New function.
12887 (class Write_symbols_task): Add layout_ field.
12888 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12889 Change caller.
12890 * output.cc (Output_section_headers::Output_section_headers): Add
12891 shstrtab_section parameter. Change all callers.
12892 (Output_section_headers::do_sized_write): Store overflow values
12893 for section count and section string table section index in
12894 section header zero.
12895 (Output_file_header::do_sized_write): Check for overflow of
12896 section count and section string table section index.
12897 (Output_symtab_xindex::do_write): New function.
12898 (Output_symtab_xindex::endian_do_write): New function.
12899 * output.h (class Output_section_headers): Add shstrtab_section_.
12900 Update declarations.
12901 (class Output_symtab_xindex): Define.
12902 (Output_section::has_out_shndx): New function.
12903 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12904 field.
12905 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12906 Change all callers.
12907 (Sized_symbol::init): Likewise.
12908 (Symbol::output_section): Check for ordinary symbol.
12909 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12910 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12911 callers.
12912 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12913 Change all callers. Simplify handling of symbols from sections
12914 not included in the link.
12915 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12916 distinction.
12917 (Weak_alias_sorter::operator()): Assert that symbols are
12918 ordinary.
12919 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12920 distinction.
12921 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12922 parameters. Change all callers.
12923 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12924 symbol distinction. Use SHN_XINDEX when needed.
12925 (Symbol_table::write_section_symbol): Add symtab_xindex
12926 parameter. Change all callers.
12927 (Symbol_table::sized_write_section_symbol): Likewise. Use
12928 SHN_XINDEX when needed.
12929 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12930 declarations.
12931 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12932 (Symbol::is_defined): Check is_ordinary.
12933 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12934 (Symbol::is_absolute, Symbol::is_common): Likewise.
12935 (class Sized_symbol): Update declarations.
12936 (class Symbol_table): Update declarations.
12937 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12938 parameters. Change all callers.
12939 (Sized_symbol::override): Likewise.
12940 (Symbol_table::override): Likewise.
12941 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12942 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12943 is_ordinary, and orig_st_shndx parameters. Change all callers.
12944 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12945 to be in an ordinary section.
12946 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12947 object and is_ordinary parameters. Change all callers.
12948 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12949 Change all callers. Don't add undefined or non-ordinary symbols
12950 to reloc_map_.
12951 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12952 Change all callers.
12953 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12954 declarations.
12955 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12956 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12957 (Sized_relobj::relocate_sections): Likewise.
12958 * target-reloc.h (scan_relocs): Adjust section symbol index.
12959 (scan_relocatable_relocs): Likewise.
12960 * i386.cc (Scan::local): Check for ordinary symbols.
12961 * sparc.cc (Scan::local): Likewise.
12962 * x86_64.cc (Scan::local): Likewise.
12963 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12964 to symbol_section_and_value.
12965 * testsuite/many_sections_test.cc: New file.
12966 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12967 (check_PROGRAMS): Add many_sections_test.
12968 (many_sections_test_SOURCES): Define.
12969 (many_sections_test_DEPENDENCIES): Define.
12970 (many_sections_test_LDFLAGS): Define.
12971 (BUILT_SOURCES): Add many_sections_define.h.
12972 (many_sections_define.h): New target.
12973 (BUILT_SOURCES): Add many_sections_check.h.
12974 (many_sections_check.h): New target.
12975 (check_PROGRAMS): Add many_sections_r_test.
12976 (many_sections_r_test_SOURCES): Define.
12977 (many_sections_r_test_DEPENDENCIES): Define.
12978 (many_sections_r_test_LDFLAGS): Define.
12979 (many_sections_r_test_LDADD): Define.
12980 (many_sections_r_test.o): New target.
12981 * testsuite/Makefile.in: Rebuild.
12982
12983 2008-04-17 Cary Coutant <ccoutant@google.com>
12984
12985 * errors.cc (Errors::info): New function.
12986 (gold_info): New function.
12987 * errors.h (Errors::info): New function.
12988 * gold.h (gold_info): New function.
12989 * object.cc (Input_objects::add_object): Print trace output.
12990 * options.cc (options::parse_set): New function.
12991 (General_options::parse_wrap): Deleted.
12992 (General_options::General_options): Deleted initializer.
12993 * options.h (options::String_set): New typedef.
12994 (options::parse_set): New function.
12995 (DEFINE_set): New macro.
12996 (General_options::wrap): Changed to use DEFINE_set. Changed
12997 callers of any_wrap_symbols and is_wrap_symbol.
12998 (General_options::trace, General_options::trace_symbol):
12999 New options.
13000 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13001 (General_options::wrap_symbols_): Deleted.
13002 * symtab.cc (Symbol_table::add_from_object): Print trace output.
13003
13004 2008-04-17 David S. Miller <davem@davemloft.net>
13005
13006 * options.cc (General_options::parse_V): New function.
13007 * options.h: Add entries for -V and -Qy.
13008
13009 2008-04-17 Ian Lance Taylor <iant@google.com>
13010
13011 * common.cc (Symbol_table::allocate_commons): Remove options
13012 parameter. Change caller.
13013 (Symbol_table::do_allocate_commons): Remove options parameter.
13014 Change caller. Just call do_allocate_commons_list twice.
13015 (Symbol_table::do_allocate_commons_list): New function, broken out
13016 of do_allocate_commons.
13017 * common.h (class Allocate_commons_task): Remove options_ field.
13018 Update constructor.
13019 * symtab.cc (Symbol_table::Symbol_table): Initialize
13020 tls_commons_.
13021 (Symbol_table::add_from_object): Put TLS common symbols on
13022 tls_commons_ list.
13023 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13024 which are IN_OUTPUT_DATA.
13025 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13026 allocate_commons and do_allocate_commons declarations. Declare
13027 do_allocate_commons_list.
13028 * gold.cc (queue_middle_tasks): Update creation of
13029 Allocate_commons_task to not pass options.
13030 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13031 (TLS_TEST_C_FLAGS): New variable.
13032 (tls_test_c_pic.o): New target.
13033 (tls_test_shared.so): Link in tls_test_c_pic.o.
13034 (tls_test_c_pic_ie.o): New target.
13035 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13036 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13037 (tls_test_c.o): New target.
13038 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13039 (tls_pic_test_LDADD): Likewise.
13040 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13041 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13042 (tls_test_c_gnu2.o): New target.
13043 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13044 tls_test_c_gnu2.o.
13045 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13046 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13047 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13048 * testsuite/tls_test.cc: Include "config.h".
13049 (t_last): Call t11_last.
13050 * testsuite/tls_test.h (t11, t11_last): Declare.
13051 * testsuite/tls_test_c.c: New file.
13052 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13053 * configure.ac: Check for OpenMP support.
13054 * configure, config.in, Makefile.in: Rebuild.
13055 * testsuite/Makefile.in: Rebuild.
13056
13057 2008-04-16 Cary Coutant <ccoutant@google.com>
13058
13059 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13060 (Target_i386::tls_base_symbol_defined_): New field.
13061 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13062 (Target_i386::Scan::global): Likewise.
13063 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13064 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13065 (Target_x86_64::tls_base_symbol_defined_): New field.
13066 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13067 (Target_x86_64::Scan::global): Likewise.
13068
13069 2008-04-16 Cary Coutant <ccoutant@google.com>
13070
13071 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13072 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13073 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13074 building shared libraries.
13075 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13076 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13077 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13078 * testsuite/Makefile.in: Rebuild.
13079 * testsuite/weak_undef.h: New file.
13080 * testsuite/weak_undef_file1.cc: Add extra test cases.
13081 * testsuite/weak_undef_file2.cc: Likewise.
13082 * testsuite/weak_undef_test.cc: Likewise.
13083
13084 2008-04-16 David S. Miller <davem@davemloft.net>
13085
13086 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13087 Add issued_non_pic_error_ field. Declare check_non_pic.
13088 (Target_sparc::Scan::check_non_pic): New function.
13089 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13090 (Target_sparc::Scan::global): Likewise.
13091
13092 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13093 * configure: Rebuild.
13094
13095 * options.h (DEFINE_enable): New macro.
13096 (new_dtags): New enable option.
13097 (initfirst, interpose, loadfltr, nodefaultlib,
13098 nodelete, nodlopen, nodump): New -z options.
13099 * layout.cc (Layout:finish_dynamic_section): If new
13100 dtags enabled, emit DT_RUNPATH. Also, emit a
13101 DT_FLAGS_1 containing any specified -z flags.
13102
13103 2008-04-16 Ian Lance Taylor <iant@google.com>
13104
13105 * copy-relocs.cc: New file.
13106 * copy-relocs.h: New file.
13107 * reloc.cc: Remove Copy_relocs code.
13108 * reloc.h: Likewise.
13109 * reloc-types.h (struct Reloc_types) [both versions]: Add
13110 get_reloc_addend_noerror.
13111 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13112 variants of add_global which take an addend which must be zero.
13113 * i386.cc: Include "copy-relocs.h".
13114 (class Target_i386): Change type of copy_relocs_ to variable,
13115 update initializer.
13116 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13117 Change all callers.
13118 (Target_i386::do_finalize_sections): Change handling of
13119 copy_relocs_.
13120 * sparc.cc: Include "copy-relocs.h".
13121 (class Target_sparc): Change type of copy_relocs_ to variable,
13122 update initializer.
13123 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13124 Change all callers.
13125 (Target_sparc::do_finalize_sections): Change handling of
13126 copy_relocs_.
13127 * x86_64.cc: Include "copy-relocs.h".
13128 (class Target_x86_64): Change type of copy_relocs_ to variable,
13129 update initializer.
13130 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13131 class. Change all callers.
13132 (Target_x86_64::do_finalize_sections): Change handling of
13133 copy_relocs_.
13134 * Makefile.am (CCFILES): Add copy-relocs.cc.
13135 (HFILES): Add copy-relocs.h.
13136
13137 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13138
13139 * testsuite/script_test_4.sh: Permit leading zeroes.
13140
13141 2008-04-15 Ian Lance Taylor <iant@google.com>
13142
13143 * script-sections.cc (Script_sections::create_segments): Use
13144 header_size_adjustment even when there is enough room for the
13145 headers.
13146 * testsuite/script_test_4.sh: New file.
13147 * testsuite/script_test_4.t: New file.
13148 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13149 (check_DATA): Add script_test_4.stdout.
13150 (MOSTLYCLEANFILES): Likewise.
13151 (script_test_4): New target.
13152 (script_test_4.stdout): New target.
13153 * testsuite/Makefile.in: Rebuild.
13154
13155 * sparc.cc: Add definitions for Output_data_plt_sparc class
13156 constants.
13157
13158 2008-04-14 David S. Miller <davem@davemloft.net>
13159
13160 * sparc.cc: New file.
13161 * Makefile.am (TARGETSOURCES): Add sparc.cc
13162 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13163 * configure.tgt: Document targ_extra_size and
13164 targ_extra_big_endian. Add entries for sparc-* and
13165 sparc64-*.
13166 * configure.ac: Handle targ_extra_size and
13167 targ_extra_big_endian.
13168 * Makefile.in: Rebuild.
13169 * configure: Likewise.
13170 * po/POTFILES.in: Likewise.
13171 * po/gold.pot: Likewise.
13172
13173 2008-04-14 Ian Lance Taylor <iant@google.com>
13174
13175 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13176 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13177 in the name/type/flags to section mapping. Don't call
13178 allocate_output_section.
13179 (Layout::choose_output_section): Change parameter from adjust_name
13180 to is_input_section. Don't permit input sections after sections
13181 are attached to segments. Don't call allocate_output_section.
13182 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13183 not write_enable_output_section.
13184 (Layout::make_output_section): Don't push to
13185 unattached_section_list_ nor call attach_to_segment. Call
13186 attach_section_to_segment if sections are attached.
13187 (Layout::attach_sections_to_segments): New function.
13188 (Layout::attach_section_to_segment): New function.
13189 (Layout::attach_allocated_section_to_segment): Rename from
13190 attach_to_segment. Remove flags parameter.
13191 (Layout::allocate_output_section): Remove function.
13192 (Layout::write_enable_output_section): Remove function.
13193 * layout.h (class Layout): Update for above changes. Add new
13194 field sections_are_attached_.
13195 * output.h (Output_section::update_flags_for_input_section): New
13196 function.
13197 * output.cc (Output_section::add_input_section): Call
13198 update_flags_for_input_section.
13199 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13200
13201 2008-04-11 Cary Coutant <ccoutant@google.com>
13202
13203 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13204 thought unnecessary.
13205 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13206
13207 2008-04-11 Ian Lance Taylor <iant@google.com>
13208
13209 * output.h (class Output_section_data): Remove inline definition
13210 of set_addralign.
13211 * output.cc (Output_section_data::set_addralign): New function.
13212
13213 2008-04-11 Cary Coutant <ccoutant@google.com>
13214
13215 Add support for TLS descriptors for i386 and x86_64.
13216 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13217 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13218 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13219 GOT_TYPE_TLS_DESC.
13220 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13221 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13222 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13223 relocations.
13224 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13225 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13226 Fix problem with initial-exec relocations.
13227 (Target_i386::Relocate::relocate_tls): Likewise.
13228 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13229 relaxation.
13230 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13231 support for section-plus-offset dynamic table entries.
13232 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13233 (Output_data_dynamic::Dynamic_entry): Add support for
13234 section-plus-offset dynamic table entries.
13235 (Output_data_dynamic::Classification): Likewise.
13236 (Output_data_dynamic::classification_): Renamed offset_.
13237 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13238 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13239 (Target_x86_64::make_plt_section): New function.
13240 (Target_x86_64::reserve_tlsdesc_entries): New function.
13241 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13242 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13243 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13244 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13245 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13246 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13247 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13248 add extra PLT entry for TLS descriptors.
13249 (Output_data_plt_x86_64::got_): New field.
13250 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13251 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13252 fields.
13253 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13254 descriptors.
13255 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13256 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13257 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13258 R_386_TLS_DESC_CALL relocations.
13259 (Target_x86_64::Scan::global): Likewise.
13260 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13261 for TLS descriptors.
13262 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13263 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13264 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13265 GD-to-IE relaxation.
13266 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13267 and TLS_DESCRIPTORS.
13268 * Makefile.in: Rebuild.
13269 * configure: Rebuild.
13270 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13271 (tls_test_shared2.so): New target.
13272 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13273 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13274 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13275 (tls_shared_gd_to_ie_test_LDADD): New variable.
13276 (tls_shared_gnu2_gd_to_ie_test): New target.
13277 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13278 New targets.
13279 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13280 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13281 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13282 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13283 (tls_shared_gnu2_test): New target.
13284 (tls_test_gnu2_shared.so): New target.
13285 (tls_shared_gnu2_test_SOURCES): New variable.
13286 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13287 (tls_shared_gnu2_test_LDFLAGS): New variable.
13288 (tls_shared_gnu2_test_LDADD): New variable.
13289 * testsuite/Makefile.in: Rebuild.
13290 * testsuite/Makefile.
13291
13292 2008-04-11 Ian Lance Taylor <iant@google.com>
13293
13294 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13295 justsyms.t.
13296 * testsuite/Makefile.in: Rebuild.
13297
13298 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13299 long.
13300 * testsuite/script_test_2.cc (main): Adjust test.
13301
13302 2008-04-11 David S. Miller <davem@davemloft.net>
13303 Ian Lance Taylor <iant@google.com>
13304
13305 * options.h (General_options): Add entries for '-Y' and
13306 '-relax'.
13307 * options.cc (General_options:finalize): If -Y was used, add those
13308 entries to the library path instead of the default "/lib" and
13309 "/usr/lib".
13310
13311 2008-04-11 David S. Miller <davem@davemloft.net>
13312
13313 * testsuite/justsyms.t: Start at 0x100.
13314 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13315 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13316 long.
13317 * testsuite/script_test_2.cc: Adjust string and section length
13318 checks.
13319
13320 2008-04-09 Ian Lance Taylor <iant@google.com>
13321
13322 PR gold/5996
13323 * script-sections.cc (Sections_element::allocate_to_segment): Add
13324 orphan parameter.
13325 (Output_section_definition::allocate_to_segment): Likewise.
13326 (Orphan_output_section::allocate_to_segment): Likewise.
13327 (Script_sections::attach_sections_using_phdrs_clause): Don't
13328 propagate non-PT_LOAD segments to orphan sections.
13329 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13330 readelf rather than objdump.
13331 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13332 .interp section and PT_INTERP segment are the same size.
13333 * testsuite/Makefile.in: Rebuild.
13334
13335 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13336 aliases for symbols defined in the same object.
13337 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13338 (weak_alias_test_SOURCES): New variable.
13339 (weak_alias_test_DEPENDENCIES): New variable.
13340 (weak_alias_test_LDFLAGS): New variable.
13341 (weak_alias_test_LDADD): New variable.
13342 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13343 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13344 (weak_alias_test_3.o): New target.
13345 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13346 * testsuite/weak_alias_test_main.cc: New file.
13347 * testsuite/weak_alias_test_1.cc: New file.
13348 * testsuite/weak_alias_test_2.cc: New file.
13349 * testsuite/weak_alias_test_3.cc: New file.
13350
13351 2008-04-08 Ian Lance Taylor <iant@google.com>
13352
13353 * options.h (class General_options): Add --noinhibit-exec option.
13354 * main.cc (main): Check --noinhibit-exec.
13355
13356 * options.h (class General_options): Define --wrap as a special
13357 option. Add wrap_symbols_ field.
13358 (General_options::any_wrap_symbols): New function.
13359 (General_options::is_wrap_symbol): New function.
13360 * options.cc (General_options::parse_wrap): New function.
13361 (General_options::General_options): Initialize wrap_symbols_.
13362 * symtab.cc (Symbol_table::wrap_symbol): New function.
13363 (Symbol_table::add_from_object): Handle --wrap.
13364 * symtab.h (class Symbol_table): Declare wrap_symbol.
13365 * target.h (Target::wrap_char): New function.
13366 (Target::Target_info): Add wrap_char field.
13367 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13368 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13369 * testsuite/testfile.cc (Target_test::test_target_info):
13370 Likewise.
13371
13372 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13373 there is one.
13374
13375 * layout.h (class Layout): Add added_eh_frame_data_ field.
13376 * layout.cc (Layout::Layout): Initialize new field.
13377 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13378 output section until we find a section we merged successfully.
13379 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13380 that the size be non-zero.
13381
13382 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13383 qualifier.
13384
13385 2008-04-08 Craig Silverstein <csilvers@google.com>
13386
13387 * configure.ac: Export new conditional variable HAVE_ZLIB.
13388 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13389 on HAVE_ZLIB.
13390 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13391 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13392
13393 2008-04-07 Ian Lance Taylor <iant@google.com>
13394
13395 * version.cc (version_string): Set to "1.5".
13396
13397 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13398 Add issued_non_pic_error_ field. Declare check_non_pic.
13399 (Target_x86_64::Scan::check_non_pic): New function.
13400 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13401 (Target_x86_64::Scan::global): Likewise.
13402
13403 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13404 addend parameter. Change caller. Handle merge sections.
13405 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13406 Address to Addend. Don't add in the result of
13407 local_section_offset, pass down the addend and use the returned
13408 value.
13409 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13410 Update declarations of local_section_offset and symbol_value.
13411 * testsuite/two_file_test_1.cc (t18): New function.
13412 * testsuite/two_file_test_2.cc (f18): New function.
13413 * testsuite/two_file_test_main.cc (main): Call t18.
13414 * testsuite/two_file_test.h (t18, f18): Declare.
13415
13416 * configure.ac: Don't test for objdump, c++filt, or readelf.
13417 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13418 conditionals.
13419 (TEST_READELF): New variable.
13420 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13421 (check_PROGRAMS): Add two_file_strip_test.
13422 (two_file_strip_test): New target.
13423 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13424 (two_file_same_shared_strip_test_SOURCES): New variable.
13425 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13426 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13427 (two_file_same_shared_strip_test_LDADD): New variable.
13428 (two_file_shared_strip.so): New target.
13429 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13430 (ver_test_5.syms, ver_test_7.syms): Likewise.
13431 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13432 (strip_test_3.stdout): Use TEST_OBJDUMP.
13433 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13434
13435 2008-04-04 Cary Coutant <ccoutant@google.com>
13436
13437 * symtab.h (Symbol::is_weak_undefined): New function.
13438 (Symbol::is_strong_undefined): New function.
13439 (Symbol::is_absolute): New function.
13440 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13441 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13442 absolute symbols.
13443 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13444 (weak_undef_test): New target.
13445 * testsuite/Makefile.in: Rebuild.
13446 * testsuite/weak_undef_file1.cc: New file.
13447 * testsuite/weak_undef_file2.cc: New file.
13448 * testsuite/weak_undef_test.cc: New file.
13449
13450 2008-04-03 Craig Silverstein <csilvers@google.com>
13451
13452 * compressed_output.h (class Output_compressed_section): Use
13453 unsigned buffer.
13454 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13455 add zlib header.
13456 (zlib_compressed_suffix): Removed.
13457 (Output_compressed_section::set_final_data_size): Use unsigned
13458 buffers.
13459 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13460 Fix linker invocation.
13461 (flagstest_o_specialfile_and_compress_debug_sections):
13462 Likewise.
13463 * testsuite/Makefile.in: Regenerated.
13464
13465 2008-04-02 David S. Miller <davem@davemloft.net>
13466
13467 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13468 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13469
13470 2008-04-02 Craig Silverstein <csilvers@google.com>
13471
13472 * TODO: New file.
13473
13474 2008-04-02 Ian Lance Taylor <iant@google.com>
13475
13476 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13477 parameters. Update for new key type to views_. Change all
13478 callers.
13479 (File_read::read): Adjust for byteshift in returned view.
13480 (File_read::add_view): New function, broken out of
13481 find_and_make_view.
13482 (File_read::make_view): New function, broken out of
13483 find_and_make_view.
13484 (File_read::find_or_make_view): Add offset and aligned
13485 parameters. Rewrite accordingly. Change all callers.
13486 (File_read::get_view): Add offset and aligned parameters. Adjust
13487 for byteshift in return value.
13488 (File_read::get_lasting_view): Likewise.
13489 * fileread.h (class File_read): Update declarations.
13490 (class File_read::View): Add byteshift_ field. Add byteshift to
13491 constructor. Add byteshift method.
13492 * archive.h (Archive::clear_uncached_views): New function.
13493 (Archive::get_view): Add aligned parameter. Change all callers.
13494 * object.h (Object::get_view): Add aligned parameter. Change all
13495 callers.
13496 (Object::get_lasting_view): Likewise.
13497
13498 * fileread.cc (File_read::release): Don't call clear_views if
13499 there are multiple objects.
13500 * fileread.h (File_read::clear_uncached_views): New function.
13501 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13502 on the archive.
13503
13504 2008-03-31 Cary Coutant <ccoutant@google.com>
13505
13506 Add thin archive support.
13507 * archive.cc (Archive::armagt): New const.
13508 (Archive::setup): Remove task parameter and calls to unlock.
13509 (Archive::unlock_nested_archives): New function.
13510 (Archive::read_header): Add nested_off parameter. Change
13511 all callers.
13512 (Archive::interpret_header): Likewise.
13513 (Archive::include_all_members): Change to handle thin
13514 archives.
13515 (Archive::include_member): Likewise.
13516 * archive.h (Archive::Archive): Add new parameters and
13517 initializers.
13518 (Archive::armagt): New const.
13519 (Archive::setup): Remove task parameter.
13520 (Archive::unlock_nested_archives): New function.
13521 (Archive::read_header): Add nested_off parameter.
13522 (Archive::interpret_header): Likewise.
13523 (Archive::Nested_archive_table): New typedef.
13524 (Archive::is_thin_archive_): New field.
13525 (Archive::nested_archives_): New field.
13526 (Archive::options_): New field.
13527 (Archive::dirpath_): New field.
13528 (Archive::task_): New field.
13529 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13530 for thin archives. Pass additional parameters to
13531 Archive::Archive. Unlock the archive file after calling
13532 Archive::setup.
13533
13534 2008-03-29 Ian Lance Taylor <iant@google.com>
13535
13536 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13537 version symbol to be local.
13538 * testsuite/ver_test_4.sh: New file.
13539 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13540 (check_DATA): Add ver_test_4.syms.
13541 (ver_test_4.syms): New target.
13542 * testsuite/Makefile.in: Rebuild.
13543
13544 * output.cc
13545 (Output_section::Input_section_sort_entry::has_priority): New
13546 function.
13547 (Output_section::Input_section_sort_entry::match_file_name): New
13548 function.
13549 (Output_section::Input_section_sort_entry::match_section_name):
13550 Remove.
13551 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13552 Remove.
13553 (Output_section::Input_section_sort_entry::match_section_file):
13554 Remove.
13555 (Output_section::Input_section_sort_compare::operator()): Rewrite
13556 using new Input_section_sort_entry functions. Sort crtbegin and
13557 crtend first. Sort sections with no priority before sections with
13558 a priority.
13559 * testsuite/initpri1.c (d3): Check j != 4.
13560 (cd5): New constructor/destructor function.
13561 (main): Check j != 2.
13562
13563 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13564 new symbol when resolving, don't call set_is_default.
13565 * testsuite/ver_test_7.cc: New file.
13566 * testsuite/ver_test_7.sh: New file.
13567 * testsuite/Makefile.am (ver_test_7.so): New target.
13568 (ver_test_7.o): New target.
13569 (check_SCRIPTS): Add ver_test_7.sh.
13570 (check_DATA): Add ver_test_7.syms.
13571 (ver_test_7.syms): New target.
13572
13573 2008-03-28 Ian Lance Taylor <iant@google.com>
13574
13575 * layout.cc (Layout::layout): If we see an input section with a
13576 name that needs sorting, set the must_sort flag for the output
13577 section.
13578 (Layout::make_output_section): If the name of the output section
13579 indicates that it might require sorting, set the may_sort flag.
13580 * output.h (Output_section::may_sort_attached_input_sections): New
13581 function.
13582 (Output_section::set_may_sort_attached_input_sections): New
13583 function.
13584 (Output_section::must_sort_attached_input_sections): New
13585 function.
13586 (Output_section::set_must_sort_attached_input_sections): New
13587 function.
13588 (class Output_section): Declare Input_section_sort_entry. Define
13589 Input_section_sort_compare. Declare
13590 sort_attached_input_sections. Add new fields:
13591 may_sort_attached_input_sections_,
13592 must_sort_attached_input_sections_,
13593 attached_input_sections_are_sorted_.
13594 * output.cc (Output_section::Output_section): Initialize new
13595 fields.
13596 (Output_section::add_input_section): Add an entry to
13597 input_sections_ if may_sort or must_sort are true.
13598 (Output_section::set_final_data_size): Call
13599 sort_attached_input_sections if necessary.
13600 (Output_section::Input_section_sort_entry): Define new class.
13601 (Output_section::Input_section_sort_compare::operator()): New
13602 function.
13603 (Output_section::sort_attached_input_sections): New function.
13604 * configure.ac: Check whether the compiler supports constructor
13605 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13606 * testsuite/initpri1.c: New file.
13607 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13608 CONSTRUCTOR_PRIORITY.
13609 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13610 (initpri1_LDFLAGS): New variable.
13611 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13612
13613 2008-03-27 Ian Lance Taylor <iant@google.com>
13614
13615 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13616 * testsuite/common_test_1.c: New file.
13617 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13618 (common_test_1_SOURCES): New variable.
13619 (common_test_1_DEPENDENCIES): New variable.
13620 (common_test_1_LDFLAGS): New variable.
13621
13622 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13623 and commons_ correctly when NAME/VERSION does not override
13624 NAME/NULL.
13625 * testsuite/ver_test_6.c: New file.
13626 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13627 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13628 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13629
13630 2008-03-26 Ian Lance Taylor <iant@google.com>
13631
13632 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13633 of an undefined symbol from a version script.
13634 * testsuite/Makefile.am (ver_test_5.so): New target.
13635 (ver_test_5.o): New target.
13636 (check_SCRIPTS): Add ver_test_5.sh.
13637 (check_DATA): Add ver_test_5.syms.
13638 (ver_test_5.syms): New target.
13639 * testsuite/ver_test_5.cc: New file.
13640 * testsuite/ver_test_5.script: New file.
13641 * testsuite/ver_test_5.sh: New file.
13642 * Makefile.in, testsuite/Makefile.in: Rebuild.
13643
13644 PR gold/5986
13645 Fix problems building gold with gcc 4.3.0.
13646 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13647 (gold_error_at_location, gold_warning_at_location): Use it.
13648 * configure.ac: Check whether we can compile and use a template
13649 function with a printf attribute.
13650 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13651 when jumping over bytes.
13652 * object.cc: Instantiate Object::read_section_data.
13653 * debug.h: Include <cstring>
13654 * dwarf_reader.cc: Include <algorithm>
13655 * main.cc: Include <cstring>.
13656 * options.cc: Include <cstring>.
13657 * output.cc: Include <cstring>.
13658 * script.cc: Include <cstring>.
13659 * script.h: Include <string>.
13660 * symtab.cc: Include <cstring> and <algorithm>.
13661 * target-select.cc: Include <cstring>.
13662 * version.cc: Include <string>.
13663 * testsuite/testmain.cc: Include <cstdlib>.
13664 * configure, config.in: Rebuild.
13665
13666 2008-03-25 Ian Lance Taylor <iant@google.com>
13667
13668 * options.cc: Include "../bfd/bfdver.h".
13669 (options::help): Print bug reporting address.
13670
13671 * version.cc (print_version): Adjust output for current value of
13672 BFD_VERSION_STRING.
13673
13674 * NEWS: New file.
13675
13676 * options.cc (options::help): Print list of supported targets.
13677 * target-select.h: Include <vector>.
13678 (class Target_selector): Make machine_, size_, and is_big_endian_
13679 fields const. Add bfd_name_ and instantiated_target_ fields.
13680 (Target_selector::Target_selector): Add bfd_name parameter.
13681 (Target_selector::recognize): Make non-virtual, call
13682 do_recognize.
13683 (Target_selector::recognize_by_name): Make non-virtual, call
13684 do_recognize_by_name.
13685 (Target_selector::supported_names): New function.
13686 (Target_selector::bfd_name): New function.
13687 (Target_selector::do_instantiate_target): New pure virtual
13688 function.
13689 (Target_selector::do_recognize): New virtual function.
13690 (Target_selector::do_recognize_by_name): New virtual function.
13691 (Target_selector::instantiate_target): New private function.
13692 (supported_target_names): Declare.
13693 * target-select.cc (Target_selector::Target_selector): Update for
13694 new parameter and fields.
13695 (select_target_by_name): Check that the name matches before
13696 calling recognize_by_name.
13697 (supported_target_names): New function.
13698 * i386.cc (class Target_selector_i386): Update Target_selector
13699 constructor call. Remove recognize and recognize_by_name. Add
13700 do_instantiate_target.
13701 * x86_64.cc (class Target_selector_x86_64): Likewise.
13702 * testsuite/testfile.cc (class Target_selector_test): Update for
13703 changes to Target_selector.
13704
13705 * README: Rewrite, with some notes on unsupported features.
13706
13707 2008-03-24 Cary Coutant <ccoutant@google.com>
13708
13709 * i386.cc (Target_i386::Got_type): New enum declaration.
13710 (Target_i386::Scan::local): Updated callers of Output_data_got
13711 member functions.
13712 (Target_i386::Scan::global): Likewise.
13713 (Target_i386::Relocate::relocate): Likewise.
13714 (Target_i386::Relocate::relocate_tls): Likewise.
13715 * object.h (Got_offset_list): New class.
13716 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13717 (Sized_relobj::local_got_offset): Likewise.
13718 (Sized_relobj::set_local_got_offset): Likewise.
13719 (Sized_relobj::local_has_tls_got_offset): Removed.
13720 (Sized_relobj::local_tls_got_offset): Removed.
13721 (Sized_relobj::set_local_tls_got_offset): Removed.
13722 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13723 * output.cc (Output_data_got::add_global): Added got_type parameter.
13724 (Output_data_got::add_global_with_rel): Likewise.
13725 (Output_data_got::add_global_with_rela): Likewise.
13726 (Output_data_got::add_global_pair_with_rel): New function.
13727 (Output_data_got::add_global_pair_with_rela): New function.
13728 (Output_data_got::add_local): Added got_type parameter.
13729 (Output_data_got::add_local_with_rel): Likewise.
13730 (Output_data_got::add_local_with_rela): Likewise.
13731 (Output_data_got::add_local_pair_with_rel): New function.
13732 (Output_data_got::add_local_pair_with_rela): New function.
13733 (Output_data_got::add_global_tls): Removed.
13734 (Output_data_got::add_global_tls_with_rel): Removed.
13735 (Output_data_got::add_global_tls_with_rela): Removed.
13736 (Output_data_got::add_local_tls): Removed.
13737 (Output_data_got::add_local_tls_with_rel): Removed.
13738 (Output_data_got::add_local_tls_with_rela): Removed.
13739 * output.h (Output_data_got::add_global): Added got_type parameter.
13740 (Output_data_got::add_global_with_rel): Likewise.
13741 (Output_data_got::add_global_with_rela): Likewise.
13742 (Output_data_got::add_global_pair_with_rel): New function.
13743 (Output_data_got::add_global_pair_with_rela): New function.
13744 (Output_data_got::add_local): Added got_type parameter.
13745 (Output_data_got::add_local_with_rel): Likewise.
13746 (Output_data_got::add_local_with_rela): Likewise.
13747 (Output_data_got::add_local_pair_with_rel): New function.
13748 (Output_data_got::add_local_pair_with_rela): New function.
13749 (Output_data_got::add_global_tls): Removed.
13750 (Output_data_got::add_global_tls_with_rel): Removed.
13751 (Output_data_got::add_global_tls_with_rela): Removed.
13752 (Output_data_got::add_local_tls): Removed.
13753 (Output_data_got::add_local_tls_with_rel): Removed.
13754 (Output_data_got::add_local_tls_with_rela): Removed.
13755 * resolve.cc (Symbol::override_base_with_special): Removed
13756 reference to has_got_offset_ field.
13757 * symtab.cc (Symbol::init_fields): Replaced initialization
13758 of got_offset_ with got_offsets_. Removed initialization
13759 of has_got_offset_
13760 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13761 (Symbol::got_offset): Likewise.
13762 (Symbol::set_got_offset): Likewise.
13763 (Symbol::has_tls_got_offset): Removed.
13764 (Symbol::tls_got_offset): Removed.
13765 (Symbol::set_tls_got_offset): Removed.
13766 (Symbol::got_offset_): Removed.
13767 (Symbol::tls_mod_got_offset_): Removed.
13768 (Symbol::tls_pair_got_offset_): Removed.
13769 (Symbol::got_offsets_): New field.
13770 (Symbol::has_got_offset): Removed.
13771 (Symbol::has_tls_mod_got_offset): Removed.
13772 (Symbol::has_tls_pair_got_offset): Removed.
13773 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13774 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13775 member functions.
13776 (Target_x86_64::Scan::global): Likewise.
13777 (Target_x86_64::Relocate::relocate): Likewise.
13778 (Target_x86_64::Relocate::relocate_tls): Likewise.
13779
13780 2008-03-25 Ben Elliston <bje@au.ibm.com>
13781
13782 * yyscript.y: Fix spelling error in comment.
13783
13784 2008-03-24 Ian Lance Taylor <iant@google.com>
13785
13786 * options.h (class General_options): Define build_id option.
13787 * layout.h (class Layout): Declare write_build_id, create_note,
13788 create_build_id. Add build_id_note_ member.
13789 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13790 "libiberty.h", "md5.h", "sha1.h".
13791 (Layout::Layout): Initialize eh_frame_data_,
13792 eh_frame_hdr_section_, and build_id_note_.
13793 (Layout::finalize): Call create_build_id.
13794 (Layout::create_note): New function, broken out of
13795 Layout::create_gold_note.
13796 (Layout::create_gold_note): Call create_note.
13797 (Layout::create_build_id): New function.
13798 (Layout::write_build_id): New function.
13799 (Close_task_runner::run): Call write_build_id.
13800
13801 * x86_64.cc: Correct license to GPLv3.
13802
13803 2008-03-23 Ian Lance Taylor <iant@google.com>
13804
13805 * options.cc: Include "demangle.h".
13806 (parse_optional_string): New function.
13807 (parse_long_option): Handle takes_optional_argument.
13808 (parse_short_option): Update dash_z initializer. Handle
13809 takes_optional_argument.
13810 (General_options::General_options): Initialize do_demangle_.
13811 (General_options::finalize): Set do_demangle_. Handle demangling
13812 style.
13813 * options.h (parse_optional_string): Declare.
13814 (struct One_option): Add optional_arg field. Update constructor.
13815 Update call constructor calls. Add takes_optional_argument
13816 function.
13817 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13818 (DEFINE_optional_string): Define.
13819 (General_options::demangle): Change from DEFINE_bool to
13820 DEFINE_optional_string.
13821 (General_options::no_demangle): New function.
13822 (General_options::do_demangle): New function.
13823 (General_options::set_do_demangle): New function.
13824 (General_options::execstack_status_): Move definition to end of
13825 class definition.
13826 (General_options::static_): Likewise.
13827 (General_options::do_demangle_): New field.
13828 * object.cc (big_endian>::get_symbol_location_info): Call
13829 Options::do_demangle, not Options::demangle.
13830 * symtab.cc (demangle): Likewise.
13831
13832 2008-03-22 Ian Lance Taylor <iant@google.com>
13833
13834 * gold.h: Include <cstddef> and <sys/types.h>
13835 * options.h: Include <cstring>.
13836
13837 2008-03-21 Ian Lance Taylor <iant@google.com>
13838
13839 * Added source code to GNU binutils.