* powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
[binutils-gdb.git] / gold / ChangeLog
1 2012-10-12 Alan Modra <amodra@gmail.com>
2
3 * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4 (struct Opd_ent): Make "discard" a bit field. Add "gc_mark".
5 (Target_powerpc::do_gc_mark_symbol): Delay marking function code
6 section if scan_opd_relocs not yet called.
7 (Target_powerpc::gc_process_relocs): Call process_gc_mark.
8
9 2012-10-12 Alan Modra <amodra@gmail.com>
10
11 * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
12 add_local_ifunc_entry): Revert last change.
13 (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
14
15 2012-10-05 Alan Modra <amodra@gmail.com>
16
17 * powerpc.cc (Target_powerpc::do_plt_address_for_local,
18 do_plt_address_for_global): New functions.
19 (Output_data_got_powerpc::do_write): Don't segfault when linking
20 statically.
21 (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
22 add_local_ifunc_entry): Return true on adding entry..
23 (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
24 glink->add_entry call. Remove unused symtab param. Adjust calls.
25 (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
26 (Target_powerpc::make_iplt_section): Remove symtab param. Don't
27 set up symbols here.
28 (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
29 syms here. Do so even when no .iplt. Don't segfault when linking
30 statically.
31 (Output_data_glink::add_entry, find_entry): Rearrange params. Add
32 new variants without reloc param.
33 (Glink_sym_ent::Glink_sym_ent): Likewise.
34 (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
35 reloc when refs will resolve to plt call stub.
36 (Target_powerpc::Scan::local): Correct ifunc handling. Allow
37 R_PPC_PLTREL24 to resolve locally.
38 (Target_powerpc::Scan::global): Correct ifunc handling.
39 (Target_powerpc::Relocate::relocate): Correct local sym glink
40 lookup. Don't destroy "value" when we have a plt call stub,
41 and when checking plt call validity.
42 (Target_powerpc::do_dynsym_value): Simplify.
43
44 2012-10-05 Alan Modra <amodra@gmail.com>
45
46 * i386.cc (Output_data_plt_i386::address_for_global,
47 address_for_local): Add plt offset to returned value. Adjust uses.
48 * sparc.cc (Output_data_plt_sparc::address_for_global,
49 address_for_local): Likewise.
50 * tilegx.cc (Output_data_plt_tilegx::address_for_global,
51 address_for_local): Likewise.
52 * x86_64.cc (Output_data_plt_x86_64::address_for_global,
53 address_for_local): Likewise.
54 * target.h (Target::plt_address_for_global, plt_address_for_local):
55 Update comment.
56 * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
57 (Output_data_got::Got_entry::write): Nor here.
58 * output.h: Comment fix.
59
60 2012-10-02 Jiong Wang <jiwang@tilera.com>
61
62 * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
63 global_offset_table_ value for larget got.
64 (Target_tilegx::Relocate::relocate): Handle adjusted got value.
65
66 2012-09-29 Alan Modra <amodra@gmail.com>
67
68 * powerpc.cc (Target_powerpc::iplt_): New output section.
69 (Target_powerpc::iplt_section, make_iplt_section,
70 reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
71 (Target_powerpc::make_plt_entry): Handle ifunc syms.
72 Target_powerpc::plt_entry_count): Count iplt entries too.
73 (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
74 reloc section in constructor. New params.
75 (Target_powerpc::make_plt_section): Create reloc section here instead.
76 (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
77 functions.
78 (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
79 (Output_data_glink::add_entry, find_entry): New functions to
80 deal with local syms.
81 (Glink_sym_ent): Add support for local syms.
82 (Output_data_glink::do_write): Handle ifunc plt entries.
83 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
84 (Target_powerpc::Scan::local, global): Handle ifunc syms.
85 (Target_powerpc::Relocate::relocate): Likewise.
86 (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
87
88 2012-09-25 Alan Modra <amodra@gmail.com>
89
90 * object.h (Sized_relobj_file::adjust_local_symbol,
91 do_adjust_local_symbol): New functions.
92 * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
93 * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
94 (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
95 and irregular opd entry spacing.
96 (Powerpc_relobj::do_read_relocs): Add opd size checks.
97 (Global_symbol_visitor_opd): New functor.
98 (Target_powerpc::do_finalize_sections): Omit global symbols defined
99 on deleted opd entries.
100
101 2012-09-15 Jiong Wang <jiwang@tilera.com>
102
103 * tilegx.cc: New file.
104 * Makefile.am (TARGETSOURCES): Add tilegx.cc
105 (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
106 * configure.tgt: Add entries for tilegx*.
107 * configure.ac: Likewise.
108 * Makefile.in: Rebuild.
109 * configure: Likewise.
110 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
111 tilegx.
112
113 2012-09-13 Alan Modra <amodra@gmail.com>
114
115 * target-reloc.h (scan_relocs): Call scan.local for relocs
116 against symbols in discarded sections. Pass is_discarded
117 param.
118 * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
119 Add is_discarded param.
120 * powerpc (Target_powerpc::Scan::local): Likewise. Use
121 is_discarded to flag opd entry as discarded. Don't emit dyn
122 relocs on such entries.
123 (Target_powerpc::Scan::global): Similarly detect and handle
124 such opd entries.
125 (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
126 opd_ent_. Update all uses.
127 (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
128 (Target_powerpc::relocate_section): Zero out discarded opd
129 entry relocs.
130
131 2012-09-12 Ian Lance Taylor <iant@google.com>
132
133 PR gold/14570
134 * output.cc: Rename Output_data_got template parameter from size
135 to got_size for all functions. Compile all variants of
136 Output_data_got.
137 (Output_data_got::Got_entry::write): Correct use of size for
138 symbol value. Use local_is_tls rather than casting to
139 Sized_relobj_file.
140 * object.h (class Object): Add local_is_tls and do_local_is_tls.
141 (class Sized_relobj_file): Add do_local_is_tls.
142 * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
143
144 2012-09-11 Alan Modra <amodra@gmail.com>
145
146 PR gold/14566
147 * layout.cc (Layout::set_segment_offsets): When using
148 common-page-size alignment, ensure we are on a new max-page-size
149 page.
150 * output.cc (Output_segment::set_section_addresses): Use
151 abi_pagesize, not common_pagesize for relro boundary.
152 (Output_segment::set_offset): Likewise.
153
154 2012-09-11 Alan Modra <amodra@gmail.com>
155
156 * output.h (Output_data_got::add_global_tls, add_local_tls,
157 add_local_tls_pair): New functions.
158 (Output_data_got::add_local_pair_with_rel): Remove second
159 reloc param. Expand comment.
160 (Output_data_got::Got_entry): Rename use_plt_offset_ to
161 use_plt_or_tls_offset_, similarly for constructor param.
162 (Output_data_got::Got_entry::write): Add got_index param.
163 * output.cc (Output_data_got::add_global_tls, add_local_tls,
164 add_local_tls_pair): New functions.
165 (Output_data_got::Got_entry::write): Handle tls symbols
166 with use_plt_or_tls_offset_ set specially.
167 (Output_data_got::add_local_pair_with_rel): Only one reloc.
168 (Output_data_got::do_write): Replace iterator with index, pass
169 index to entry write function.
170 * target.h (Target::tls_offset_for_local, tls_offset_for_global,
171 do_tls_offset_for_local, do_tls_offset_for_global): New functions.
172 * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
173 call.
174 * i386.cc (Target_i386::Scan::local): Likewise.
175 * sparc.cc (Target_sparc::Scan::local): Likewise.
176 * x86_64.cc (Target_x86_64::Scan::local): Likewise.
177 * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
178 do_tls_offset_for_global): New functions.
179 (Target_powerpc::Scan::local): Correct TLS relocations and got
180 entry values.
181 (Target_powerpc::Scan::global): Don't emit unnecessary
182 dynamic relocations on TLS GOT entries.
183
184 2012-09-10 Matthias Klose <doko@ubuntu.com>
185
186 * config.in: Disable sanity check for kfreebsd.
187
188 2012-09-10 Sterling Augustine <saugustine@google.com>
189
190 * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
191 (Gdb_index::pubtypes_read): New parameter.
192 (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
193 to calls.
194 * gdb-index.h (Gdb_index): New fields pubnames_object_ and
195 pubtypes_object_.
196
197 2012-09-09 Alan Modra <amodra@gmail.com>
198
199 * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
200 (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
201 * gc.h (gc_process_relocs): Call target gc_add_reference.
202 * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
203 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
204 (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
205 unnecessary cast.
206 * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
207 to cater for when we don't need code offset. Update use.
208 (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
209 (Powerpc_relobj::access_from_map, add_reference, opd_valid,
210 set_opd_valid): New functions.
211 (Target_powerpc::do_gc_add_reference): New function.
212 (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
213 stashed refs.
214 (Target_powerpc::do_gc_mark_symbol): New function.
215
216 2012-09-06 Cary Coutant <ccoutant@google.com>
217
218 * dwarf_reader.cc (Dwarf_die::read_attributes): Add
219 DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
220 (Dwarf_die::skip_attributes): Likewise.
221 * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
222 * testsuite/gdb_index_test.cc (inline_func_1): New function.
223 (main): Call it.
224 * testsuite/gdb_index_test_comm.sh: Check index for inline function.
225
226 2012-09-05 H.J. Lu <hongjiu.lu@intel.com>
227
228 * testsuite/script_test_3.t: Add .got.plt output section
229 statement.
230 * testsuite/script_test_4.t: Likewise.
231
232 2012-09-05 Alan Modra <amodra@gmail.com>
233
234 * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
235 update all uses and lose "enum" when using type.
236
237 2012-09-05 Alan Modra <amodra@gmail.com>
238
239 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
240 * configure: Regenerate.
241 * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
242 (plugin_final_layout.stdout): Likewise.
243 (memory_test): Set page sizes to 0x1000.
244 * testsuite/Makefile.in: Regenerate.
245 * testsuite/discard_locals_test.sh: Add FIXME comment.
246 * testsuite/justsyms_exec.c: Disable function test for powerpc64.
247 * testsuite/pr14265.t: Add .got output section statement.
248 * testsuite/script_test_2.t: Likewise.
249 * testsuite/script_test_3.t: Likewise.
250 * testsuite/script_test_4.t: Likewise.
251 * testsuite/script_test_5.t: Likewise.
252 * testsuite/script_test_6.t: Likewise.
253 * testsuite/script_test_7.t: Likewise.
254 * testsuite/script_test_9.t: Likewise.
255
256 2012-09-05 Alan Modra <amodra@gmail.com>
257
258 * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
259 (Powerpc_relocate_functions::Status): New typedef.
260 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
261 (Target_powerpc::Scan::local): Handle REL64.
262 (Target_powerpc::Scan::global): Likewise, and dynamic relocs
263 for REL32 and REL64.
264 (Target_powerpc::symval_for_branch): New function, extracted from..
265 (Target_powerpc::Relocate::relocate): ..here. Correct plt call
266 checks. Report overflow errors.
267
268 2012-09-05 Alan Modra <amodra@gmail.com>
269
270 * object.h (Sized_relobj_file::emit_relocs): Delete.
271 (Sized_relobj_file::emit_relocs_reltype): Delete.
272 * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
273 relocate_relocs for --emit-relocs.
274 (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
275 * output.h: Update comment.
276 (Output_segment::first_section): New function.
277 (Output_segment::first_section_load_address): Use first_section.
278 * output.cc (Output_segment::first_section): New function extracted..
279 (Output_segment::first_section_load_address): ..from here. Delete.
280 * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
281 * target.h (Sized_target::relocate_for_relocatable): Likewise.
282 * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
283 adjust call to target.h function.
284 * i386.cc (Target_i386): Likewise.
285 * sparc.cc (Target_sparc): Likewise.
286 * x86_64.cc (Target_x86_64): Likewise.
287 * powerpc.cc (Target_powerpc): Likewise.
288 (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure
289 first tls section has section symbol for optimised local dynamic
290 output relocs.
291 (Target_powerpc::Relocate::relocate): Correct local dynamic value.
292 (Target_powerpc::relocate_relocs): Adjust relocs emitted for
293 optimised tls code.
294 * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
295 Rename to relocate_relocs. Update error message.
296
297 2012-09-04 Andreas Schwab <schwab@linux-m68k.org>
298
299 * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
300 --just-symbols.
301
302 2012-08-31 Alan Modra <amodra@gmail.com>
303
304 * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
305 (Powerpc_relobj::toc_base_offset): New stub function.
306 (Target_powerpc): Add tp_offset, dtp_offset. Rename
307 got_mod_index_offset to tlsld_got_offset. Update all refs.
308 (Target_powerpc::Relocate::enum skip_tls): New.
309 (Target_powerpc::call_tls_get_addr_): New var.
310 (Target_powerpc::is_branch_reloc): Move to file scope.
311 (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
312 (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
313 New functions.
314 (Target_powerpc::enum Got_type): Delete old values, add new ones.
315 (powerpc_info): Correct common_pagesize for ppc64.
316 (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
317 (Powerpc_relocate_functions): Add overflow check enums and functions.
318 Add non-shift version of rela, rela_ua. Delete all rel public
319 functions. Delete addr16_lo. Add addr64, addr64_u, addr32,
320 addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
321 addr16_ha3, addr14 functions.
322 (Output_data_got_powerpc::add_constant_pair): New function.
323 (Output_data_got_powerpc::got_base_offset): Likewise.
324 (Output_data_got_powerpc::do_write): Correct 64-bit got header.
325 (instruction constants): Sort, add some more.
326 (Output_data_glink::do_write): Add and use Address typedef. Use
327 object->toc_base_offset() stub for 64-bit.
328 (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
329 (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
330 (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
331 for R_PPC64_TOC. Handle more relocs. Generate got entries for TLS.
332 Always treat .opd relocs as against locally defined symbol.
333 Correct condition for RELATIVE relocs.
334 (Target_powerpc::do_finalize_sections): Test for NULL sections.
335 (Target_powerpc::Relocate::relocate): Use plt call stub as value
336 for 32-bit syms with a plt entry. Correct ppc64 toc base
337 calculations. Handle TLS relocs, and more. Add overflow
338 checking and adjust for Powerpc_relocate_functions changes.
339 (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
340 Reinstate --emit-relocs code with FIXME.
341
342 2012-08-30 Alan Modra <amodra@gmail.com>
343
344 * layout.cc (Layout::set_segment_offsets): Set p_align to
345 abi_pagesize, not common_pagesize.
346 (Layout::relaxation_loop_body): Similarly use abi_pagesize
347 to determine whether file header can go in segment.
348
349 2012-08-30 Alan Modra <amodra@gmail.com>
350
351 * output.h (Output_reloc::Output_reloc <output section>): Add
352 is_relative param. Adjust calls.
353 (Output_reloc::add_output_section_relative): New functions.
354 * output.cc (Output_reloc::Output_reloc <output section>): Handle
355 is_relative.
356 (Output_reloc::symbol_value): Handle SECTION_CODE.
357
358 2012-08-24 Sriraman Tallam <tmsriram@google.com>
359
360 * gold.cc (queue_middle_tasks): Call layout again when unique
361 segments for sections is desired.
362 * layout.cc (Layout::Layout): Initialize new members.
363 (Layout::get_output_section_flags): New function.
364 (Layout::choose_output_section): Call get_output_section_flags.
365 (Layout::layout): Make output section for mapping to a unique segment.
366 (Layout::insert_section_segment_map): New function.
367 (Layout::attach_allocated_section_to_segment): Make unique segment for
368 output sections marked so.
369 (Layout::segment_precedes): Check for unique segments when sorting.
370 * layout.h (Layout::Unique_segment_info): New struct.
371 (Layout::Section_segment_map): New typedef.
372 (Layout::insert_section_segment_map): New function.
373 (Layout::get_output_section_flags): New function.
374 (Layout::is_unique_segment_for_sections_specified): New function.
375 (Layout::set_unique_segment_for_sections_specified): New function.
376 (Layout::unique_segment_for_sections_specified_): New member.
377 (Layout::section_segment_map_): New member.
378 * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
379 Rename is_gc_pass_one to is_pass_one.
380 Rename is_gc_pass_two to is_pass_two.
381 Rename is_gc_or_icf to is_two_pass.
382 Check for which pass based on whether symbols data is present.
383 Make it two pass when unique segments for sections is desired.
384 * output.cc (Output_section::Output_section): Initialize new
385 members.
386 * output.h (Output_section::is_unique_segment): New function.
387 (Output_section::set_is_unique_segment): New function.
388 (Output_section::is_unique_segment_): New member.
389 (Output_section::extra_segment_flags): New function.
390 (Output_section::set_extra_segment_flags): New function.
391 (Output_section::extra_segment_flags_): New member.
392 (Output_section::segment_alignment): New function.
393 (Output_section::set_segment_alignment): New function.
394 (Output_section::segment_alignment_): New member.
395 (Output_segment::Output_segment): Initialize is_unique_segment_.
396 (Output_segment::is_unique_segment): New function.
397 (Output_segment::set_is_unique_segment): New function.
398 (Output_segment::is_unique_segment_): New member.
399 * plugin.cc (allow_unique_segment_for_sections): New function.
400 (unique_segment_for_sections): New function.
401 (Plugin::load): Add new functions to transfer vector.
402 * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
403 * Makefile.in: Regenerate.
404 * testsuite/plugin_final_layout.sh: Check if unique segment
405 functionality works.
406 * testsuite/plugin_section_order.c (onload): Check if new interfaces
407 are available.
408 (allow_unique_segment_for_sections): New global.
409 (unique_segment_for_sections): New global.
410 (claim_file_hook): Call allow_unique_segment_for_sections.
411 (all_symbols_read_hook): Call unique_segment_for_sections.
412
413 2012-08-22 Cary Coutant <ccoutant@google.com>
414
415 * layout.cc (Layout::include_section): Don't assert on GROUP
416 sections with --emit-relocs.
417
418 2012-08-21 Cary Coutant <ccoutant@google.com>
419
420 * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
421 if --export-dynamic-symbol names an undef symbol.
422
423 2012-08-18 Alan Modra <amodra@gmail.com>
424
425 * powerpc.cc: Formatting and white space.
426 (Powerpc_relobj): Rename got2_section_ to special_.
427 Add opd_ent_shndx_ and opd_ent_off_ vectors.
428 (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
429 scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
430 (Target_powerpc): Add Address typedef and invalid_address. Use
431 throughout.
432 (Target_powerpc::is_branch_reloc): New function.
433 (Powerpc_relocate_functions): Add Address typedef, use throughout.
434 (Powerpc_relocate_functions:rela, rela_ua): Correct type used
435 for dst_mask, value and addend.
436 (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
437 (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
438 (Output_data_glink::do_write): Correct toc base. Don't try to use
439 uint16_t for 24-bit offset. Use get_output_section_offset and
440 check return.
441 (Target_powerpc::Scan::local): Handle more relocs.
442 (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
443 (Target_powerpc::Relocate::relocate): Correct toc base calculation.
444 Plug in toc restoring insn after plt calls. Translate branches
445 to function descriptor symbols to corresponding entry point.
446 (Target_powerpc::relocate_for_relocatable): Check return from
447 get_output_section_offset.
448 * symtab.h: Comment typo.
449
450 2012-08-14 Ian Lance Taylor <iant@google.com>
451
452 * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
453 unsupported_relocal_local to call unsupported_reloc_global.
454
455 2012-08-14 Nick Clifton <nickc@redhat.com>
456
457 PR ld/14265
458 * script-sections.cc (Sections_element::output_section_name): Add
459 keep return parameter.
460 (Output_section_element::match_name): Add keep return parameter.
461 Return the value of the keep_ member.
462 * script-sections.h (class Output_section): Update
463 output_section_name prototype.
464 * layout.cc (Layout::keep_input_section): New public member
465 function.
466 (Layout::choose_output_section): Pass keep parameter to
467 output_section_name.
468 * layout.h (class Layout): Add keep_input_section.
469 * object.cc (Sized_relobj_file::do_layout): Check for kept input
470 sections.
471 * testsuite/Makefile.am: Add a test.
472 * testsuite/Makefile.in: Regenerate.
473 * testsuite/pr14265.c: Source file for the test.
474 * testsuite/pr14265.t: Linker script for the test.
475 * testsuite/pr14265.sh: Shell script for the test.
476
477 2012-08-14 Alan Modra <amodra@gmail.com>
478
479 * target.h (Target::output_section_name): New function.
480 (Target::do_output_section_name): New function.
481 * layout.cc (Layout::choose_output_section): Call the above.
482 * powerpc.cc (Target_powerpc::do_output_section_name): New function.
483
484 2012-08-14 Alan Modra <amodra@gmail.com>
485
486 * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
487 (Output_data_got_powerpc::do_write): Don't rely on base class lookup
488 for replace_constant call.
489 (Output_data_plt_powerpc::do_print_to_mapfile): New function.
490 (Output_data_glink::do_print_to_mapfile): New function.
491 (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
492 (Target_powerpc::Relocate::relocate): Likewise.
493
494 2012-08-14 Alan Modra <amodra@gmail.com>
495
496 * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
497 (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
498 (Output_data_glink::add_entry,find_entry): Remove shndx param.
499 (class Glink_sym_ent): Rename from struct Glink_sym_ent. Remove
500 all references to shndx_. Handle special case for R_PPC_PLTREL24
501 here.
502 (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
503 (Output_data_glink::do_write): Retrieve got2_shdnx from object.
504 (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
505 here.
506 (Target_powerpc::Scan::global): Nor on make_plt_entry call.
507 (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
508
509 2012-08-12 Alan Modra <amodra@gmail.com>
510
511 * powerpc.cc: Whitespace fixes. Wrap overly long lines.
512 (glink insn constants): Use uint32_t.
513 (Output_data_glink::add_entry): Use insert, not [] operator.
514
515 2012-08-11 Alan Modra <amodra@gmail.com>
516
517 * object.h (Sized_relobj_file::find_shdr): New function.
518 (Sized_relobj_file::find_special_sections): New function.
519 * object.cc (Sized_relobj_file::find_shdr): New function.
520 (Sized_relobj_file::find_eh_frame): Use find_shdr.
521 (Sized_relobj_file::find_special_sections): New function, split out..
522 (Sized_relobj_file::do_read_symbols): ..from here.
523 * output.h (Output_data_got::replace_constant): New function.
524 (Output_data_got::num_entries): New function.
525 (Output_data_got::last_got_offset,set_got_size): Use num_entries.
526 (Output_data_got::got_offset): Protected rather than private.
527 (Output_data_got::replace_got_entry): New function.
528 * output.cc (Output_data_got::replace_got_entry): New function.
529 * powerpc.cc (class Powerpc_relobj): New.
530 (class Powerpc_relocate_functions): Delete all psymval variants or
531 convert to value,addend type. Delete pcrela, pcrela_unaligned.
532 Implement _ha functions using corresponding _hi function.
533 (Powerpc_relobj::find_special_sections): New function.
534 (Target_powerpc::do_make_elf_object): New function.
535 (class Output_data_got_powerpc): New.
536 (class Output_data_glink): New.
537 (class Powerpc_scan_relocatable_reloc): New.
538 Many more changes througout file.
539
540 2012-08-09 Nick Clifton <nickc@redhat.com>
541
542 * po/vi.po: Updated Vietnamese translation.
543
544 2012-08-07 Ian Lance Taylor <iant@google.com>
545
546 * layout.cc (Layout::add_target_dynamic_tags): If
547 dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
548 plt_rel.
549
550 2012-07-30 Nick Clifton <nickc@redhat.com>
551
552 * po/gold.pot: Updated template.
553 * po/es.po: Updated Spanish translation.
554
555 2012-07-18 Cary Coutant <ccoutant@google.com>
556
557 PR gold/14344
558 * configure.ac: Add check for -gpubnames support.
559 * configure: Regenerate.
560 * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
561 support; force -gno-pubnames.
562 (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
563 support.
564 (gdb_index_test_4): New test.
565 * testsuite/Makefile.in: Regenerate.
566 * testsuite/gdb_index_test_1.sh: Refactor code into common file.
567 * testsuite/gdb_index_test_2.sh: Likewise.
568 * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
569 * testsuite/gdb_index_test_4.sh: New script.
570 * testsuite/gdb_index_test_comm.sh: New script with common code;
571 don't look for space after colon.
572
573 2012-07-16 Sriraman Tallam <tmsriram@google.com>
574
575 * gold.cc (queue_middle_tasks): Update function order only after
576 deferred objects due to plugins are processed.
577
578 2012-07-11 Ian Lance Taylor <iant@google.com>
579
580 * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
581 (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
582 (Target_arm::scan_reloc_for_stub): Likewise.
583 * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
584 * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
585 * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
586 * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
587 * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
588
589 2012-07-10 Dodji Seketeli <dodji@redhat.com>
590 Ian Lance Taylor <iant@google.com>
591
592 PR gold/14309
593 * configure.ac: Test whether std::tr1::hash<off_t> works.
594 * gold.h: Add a specialization for std::tr1::hash<off_t> if
595 needed.
596 * output.h (class Output_fill): Add virtual destructor.
597 * configure, config.in: Rebuild.
598
599 2012-06-22 Roland McGrath <mcgrathr@google.com>
600
601 * layout.cc (finalize): Define __ehdr_start symbol if applicable.
602
603 2012-06-12 Rafael Ávila de Espíndola <respindola@mozilla.com>
604
605 * plugin.cc (Plugin::load): Handle position independent executables.
606
607 2012-06-06 Cary Coutant <ccoutant@google.com>
608
609 * layout.cc (gdb_sections): Remove ".debug_" prefixes,
610 add .debug_macro.
611 (lines_only_debug_sections): Likewise.
612 (gdb_fast_lookup_sections): New static array.
613 (is_gdb_debug_section): Rename formal parameter.
614 (is_lines_only_debug_section): Likewise.
615 (is_gdb_fast_lookup_section): New function.
616 (Layout::include_section): Check for ".zdebug_" prefix; pass
617 section name suffix to is_gdb_debug_section, et al.; check for
618 fast-lookup sections when building .gdb_index.
619 * options.h (--strip-debug-gdb): Update GDB version number.
620
621 2012-06-06 Cary Coutant <ccoutant@google.com>
622
623 * configure.ac: Add check for fallocate.
624 * configure: Regenerate.
625 * config.in: Regenerate.
626
627 * options.h (class General_options): Add --mmap-output-file and
628 --posix-fallocate options.
629 * output.cc: (posix_fallocate): Remove; replace with...
630 (gold_fallocate): New function.
631 (Output_file::map_no_anonymous): Call gold_fallocate.
632 (Output_file::map): Check --mmap-output-file option.
633
634 2012-06-05 Jing Yu <jingyu@google.com>
635
636 * gold.h (textdomain): Add do {} to empty while(0).
637 (bindtextdomain): Likewise.
638
639 2012-06-04 Cary Coutant <ccoutant@google.com>
640
641 * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
642 has_dynsym_index.
643
644 2012-05-25 Sriraman Tallam <tmsriram@google.com>
645
646 * symtab.cc (Symbol_table::define_special_symbol):
647 Initialize *poldsym to prevent uninitialized variable errors.
648
649 2012-05-23 Cary Coutant <ccoutant@google.com>
650
651 * layout.cc (Layout::section_name_mapping): Add rules to handle
652 exact match on .data.rel.ro.local or .data.rel.ro.
653 (Layout::output_section_name): Check for exact matches.
654
655 2012-05-23 Cary Coutant <ccoutant@google.com>
656
657 * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
658 more carefully.
659
660 2012-05-22 Cary Coutant <ccoutant@google.com>
661
662 * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
663 object before exporting symbol.
664
665 2012-05-21 H.J. Lu <hongjiu.lu@intel.com>
666
667 * testsuite/tls_test.cc: Include "config.h" first.
668 * testsuite/tls_test_c.c: Likewise.
669
670 2012-05-17 Daniel Richard G. <skunk@iskunk.org>
671 Nick Clifton <nickc@redhat.com>
672
673 PR 14072
674 * configure.in: Add check that sysdep.h has been included before
675 any system header files.
676 * configure: Regenerate.
677 * config.in: Regenerate.
678
679 2012-05-14 Cary Coutant <ccoutant@google.com>
680
681 * layout.cc (Layout::make_output_section): Mark .tdata section
682 as RELRO.
683 * testsuite/relro_test.cc: Add a TLS variable.
684
685 2012-05-10 H.J. Lu <hongjiu.lu@intel.com>
686
687 PR gold/14091
688 * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
689 R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
690 R_X86_64_64.
691
692 2012-05-08 Cary Coutant <ccoutant@google.com>
693
694 * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
695 (lines_only_debug_sections): Likewise.
696
697 2012-05-02 Roland McGrath <mcgrathr@google.com>
698
699 * nacl.cc: New file.
700 * nacl.h: New file.
701 * Makefile.am (CCFILES, HFILES): Add them.
702 * Makefile.in: Regenerate.
703 * i386.cc (Output_data_plt_i386_nacl): New class.
704 (Output_data_plt_i386_nacl_exec): New class.
705 (Output_data_plt_i386_nacl_dyn): New class.
706 (Target_i386_nacl): New class.
707 (Target_selector_i386_nacl): New class.
708 (target_selector_i386): Use it instead of Target_selector_i386.
709 * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
710 (Target_x86_64_nacl): New class.
711 (Target_selector_x86_64_nacl): New class.
712 (target_selector_x86_64, target_selector_x32): Use it instead of
713 Target_selector_x86_64.
714 * arm.cc (Output_data_plt_arm_nacl): New class.
715 (Target_arm_nacl): New class.
716 (Target_selector_arm_nacl): New class.
717 (target_selector_arm, target_selector_armbe): Use it instead of
718 Target_selector_arm.
719
720 * target-select.cc (select_target): Take new Input_file* and off_t
721 arguments, pass them on to recognize method of selector.
722 * object.cc (make_elf_sized_object): Update caller.
723 * parameters.cc (parameters_force_valid_target): Likewise.
724 * incremental.cc (make_sized_incremental_binary): Likewise.
725 * target-select.h: Update decl.
726 (Target_selector::recognize): Take new Input_file* argument,
727 pass it on to do_recognize.
728 (Target_selector::do_recognize): Take new Input_file* argument.
729 * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
730 * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
731 * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
732 * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
733
734 * target.h (Target::Target_info): New members isolate_execinstr
735 and rosegment_gap.
736 (Target::isolate_execinstr, Target::rosegment_gap): New methods.
737 * arm.cc (Target_arm::arm_info): Update initializer.
738 * i386.cc (Target_i386::i386_info): Likewise.
739 * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
740 * sparc.cc (Target_sparc::sparc_info): Likewise.
741 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
742 * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
743 * layout.cc (Layout::attach_allocated_section_to_segment):
744 Take new const Target* argument. If target->isolate_execinstr(), act
745 like --rosegment.
746 (Layout::find_first_load_seg): Take new const Target* argument;
747 if target->isolate_execinstr(), reject PF_X segments.
748 (Layout::relaxation_loop_body): Update caller.
749 (Layout::set_segment_offsets): If target->isolate_execinstr(),
750 reset file offset to zero when we hit LOAD_SEG, and then do a second
751 loop over the segments before LOAD_SEG to reassign offsets after
752 addresses have been determined. Handle target->rosegment_gap().
753 (Layout::attach_section_to_segment): Take new const Target* argument;
754 pass it to attach_allocated_section_to_segment.
755 (Layout::make_output_section): Update caller.
756 (Layout::attach_sections_to_segments): Take new const Target* argument;
757 pass it to attach_section_to_segment.
758 * gold.cc (queue_middle_tasks): Update caller.
759 * layout.h (Layout): Update method decls with new arguments.
760
761 * arm.cc (Target_arm::Target_arm): Take optional argument for the
762 Target_info pointer to use.
763 (Target_arm::do_make_data_plt): New virtual method.
764 (Target_arm::make_data_plt): New method that calls it.
765 (Target_arm::make_plt_entry): Use it.
766 (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
767 for the section alignment.
768 (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
769 method.
770 (Output_data_plt_arm::first_plt_entry_offset): Call it.
771 (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
772 method.
773 (Output_data_plt_arm::get_plt_entry_size): Call it.
774 (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
775 (Output_data_plt_arm::fill_plt_entry): New method that calls it.
776 (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
777 method.
778 (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
779 (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
780 method instead of sizeof(plt_entry).
781 (Output_data_plt_arm::add_entry): Likewise.
782 Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
783 (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
784 than static method.
785 (Target_arm::plt_entry_size): Likewise.
786 (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
787 Move to ...
788 (Output_data_plt_arm_standard): ... here, new class.
789 (Output_data_plt_arm::do_write): Move guts of PLT filling to...
790 (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
791 (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
792
793 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
794 Take additional argument for the PLT entry size.
795 (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
796 Use get_plt_entry_size method rather than plt_entry_size variable.
797 (Output_data_plt_x86_64::reserve_slot): Likewise.
798 (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
799 (Output_data_plt_x86_64::add_entry): Likewise.
800 (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
801 (Output_data_plt_x86_64::address_for_global): Likewise.
802 (Output_data_plt_x86_64::address_for_local): Likewise.
803 (Output_data_plt_x86_64::set_final_data_size): Likewise.
804 (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
805 Make method non-static.
806 (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
807 method.
808 (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
809 (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
810 (Output_data_plt_x86_64::add_eh_frame): New method to call it.
811 (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
812 virtual method.
813 (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
814 (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
815 virtual method.
816 (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
817 (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
818 virtual method.
819 (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
820 (Output_data_plt_x86_64::plt_entry_size)
821 (Output_data_plt_x86_64::first_plt_entry)
822 (Output_data_plt_x86_64::plt_entry)
823 (Output_data_plt_x86_64::tlsdesc_plt_entry)
824 (Output_data_plt_x86_64::plt_eh_frame_fde_size)
825 (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
826 (Output_data_plt_x86_64_standard): ... here, new class.
827 (Target_x86_64::Target_x86_64): Take optional argument for the
828 Target_info pointer to use.
829 (Target_x86_64::do_make_data_plt): New virtual method.
830 (Target_x86_64::make_data_plt): New method to call it.
831 (Target_x86_64::init_got_plt_for_update): Use that.
832 Call this->plt_->add_eh_frame method here.
833 (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
834 (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
835 rather than static method.
836 (Target_x86_64::plt_entry_size): Likewise.
837 (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
838 rather than plt_entry_size variable. Move guts of PLT filling to...
839 (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
840 (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
841 (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
842
843 * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
844 additional argument for the section alignment.
845 Don't do add_eh_frame_for_plt here.
846 (Output_data_plt_i386::first_plt_entry_offset): Make the method
847 non-static. Use get_plt_entry_size method rather than plt_entry_size
848 variable.
849 (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
850 method.
851 (Output_data_plt_i386::get_plt_entry_size): Call it.
852 (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
853 (Output_data_plt_i386::add_eh_frame): New method to call it.
854 (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
855 method.
856 (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
857 (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
858 method.
859 (Output_data_plt_i386::fill_plt_entry): New method to call it.
860 (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
861 method instead of plt_entry_size.
862 (Output_data_plt_i386::plt_entry_size)
863 (Output_data_plt_i386::plt_eh_frame_fde_size)
864 (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
865 (Output_data_plt_i386_standard): ... here, new class.
866 (Output_data_plt_i386_exec): New class.
867 (Output_data_plt_i386::exec_first_plt_entry): Move to ...
868 (Output_data_plt_i386_exec::first_plt_entry): ... here.
869 (Output_data_plt_i386::exec_plt_entry): Move to ...
870 (Output_data_plt_i386_exec::plt_entry): ... here.
871 (Output_data_plt_i386_dyn): New class.
872 (Output_data_plt_i386::first_plt_entry): Move to ...
873 (Output_data_plt_i386_dyn::first_plt_entry): ... here.
874 (Output_data_plt_i386::dyn_plt_entry): Move to ...
875 (Output_data_plt_i386_dyn::plt_entry): ... here.
876 (Target_i386::Target_i386): Take optional argument for the Target_info
877 pointer to use.
878 (Target_i386::do_make_data_plt): New virtual method.
879 (Target_i386::make_data_plt): New method to call it.
880 (Target_i386::make_plt_section): Use that.
881 Call this->plt_->add_eh_frame method here.
882 (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
883 rather than plt_entry_size variable.
884 (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
885 (Output_data_plt_i386::address_for_local): Likewise.
886 (Output_data_plt_i386::do_write): Likewise.
887 Move guts of PLT filling to...
888 (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
889 (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
890 (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
891 (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
892
893 2012-05-01 Cary Coutant <ccoutant@google.com>
894
895 * dwarf_reader.cc (Dwarf_die::read_attributes)
896 (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
897 (Dwarf_die::uint_attribute): Remove DW_FORM_null.
898 * reduced_debug_output.cc
899 (Output_reduced_debug_info_section::get_die_end): Remove
900 DW_FORM_GNU_ref_index. Add default case.
901
902 2012-04-26 Mark Wielaard <mjw@redhat.com>
903
904 * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
905 * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
906 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
907 DW_AT_high_pc as offset from DW_AT_low_pc.
908
909 * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
910 * testsuite/Makefile.in: Regenerate.
911 * testsuite/gdb_index_test_3.c: New test source file.
912 * testsuite/gdb_index_test_3.sh: New test source file.
913
914 2012-04-25 Ian Lance Taylor <iant@google.com>
915
916 * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
917 pointer.
918 (Stub_addend_reader::operator()): Declare Arm_relocate_functions
919 as a class, not a struct.
920 (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
921 (Target_arm::apply_cortex_a8_workaround): Likewise.
922 * gc.h: Declare Reloc_types as a struct, not a class.
923 * object.h: Declare Symbols_data as a struct.
924 * reloc.h: Declare Read_relocs_data as a struct.
925 * target.h: Declare Relocate_info as a struct.
926
927 2012-04-24 David S. Miller <davem@davemloft.net>
928
929 * sparc.cc (Target_sparc::Relocate::relax_call): New function.
930 (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
931 and R_SPARC_WPLT30.
932
933 2012-04-24 Cary Coutant <ccoutant@google.com>
934
935 * incremental-dump.cc (find_input_containing_global): Replace
936 magic number with symbolic constant.
937 (dump_incremental_inputs): Update version number.
938 * incremental.cc (Output_section_incremental_inputs): Update version
939 number; import symbolic constants from Incremental_inputs_reader.
940 (Incremental_inputs::create_data_sections): Align relocations
941 section correctly for 64-bit targets.
942 (Output_section_incremental_inputs::set_final_data_size): Use symbolic
943 constants; add padding.
944 (Output_section_incremental_inputs::write_header): Add assert for
945 header_size.
946 (Output_section_incremental_inputs::write_input_files): Add assert
947 for input_entry_size.
948 (Output_section_incremental_inputs::write_info_blocks): Add padding;
949 add assert for object_info_size, input_section_entry_size,
950 global_sym_entry_size.
951 * incremental.h (Incremental_inputs_reader): Add symbolic constants
952 for data structure sizes; use them.
953 (Incremental_input_entry_reader): Import symbolic constants from
954 Incremental_inputs_reader; use them.
955
956 2012-04-23 David S. Miller <davem@davemloft.net>
957
958 * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
959 and elf_flags_set_.
960 (Target_sparc::Target_sparc): Initialize new fields.
961 (Target_sparc::do_make_elf_object): New function.
962 (Target_sparc::do_adjust_elf_header): New function.
963
964 2012-04-23 Cary Coutant <ccoutant@google.com>
965
966 * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
967 CU range table of gdb index.
968
969 2012-04-20 David S. Miller <davem@davemloft.net>
970
971 * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
972 instead of false.
973
974 2012-04-16 David S. Miller <davem@davemloft.net>
975
976 * sparc.cc (Target_sparc::got_address): New function.
977 (Sparc_relocate_functions::gdop_hix22): New function.
978 (Sparc_relocate_functions::gdop_lox10): New function.
979 (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
980 relocs.
981 (Target_sparc::Scan::local): Likewise if the global symbol is not
982 preemptible and is not IFUNC.
983 (Target_sparc::Relocate::relocate): Perform GOTDATA code
984 transformations for local and non-preemptible non-IFUNC global
985 symbols.
986
987 * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
988 writing out 64-bit part of ranges.
989
990 * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
991 -fpic and -fpie respectively.
992 * Makefile.in: Regenerate.
993
994 * sparc.cc (class Target_sparc): Add rela_ifunc_.
995 (Target_sparc::Target_sparc): Initialize new field.
996 (Target_sparc::do_plt_section_for_global): New function.
997 (Target_sparc::do_plt_section_for_local): New function.
998 (Target_sparc::reloc_needs_plt_for_ifunc): New function.
999 (Target_sparc::make_plt_section): New function, broken out of
1000 make_plt_entry. Use ORDER_NON_RELRO_FIRST for ".plt".
1001 (Target_sparc::make_plt_entry): Call make_plt_section.
1002 (Target_sparc::make_local_ifunc_plt_entry): New function.
1003 (Target_sparc::rela_ifunc_section): New function.
1004 (Target_sparc::plt_section): Remove const.
1005 (Output_data_plt_sparc): Update declarations. Define Global_ifunc
1006 and Local_ifunc types. Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1007 and ifunc_count_ fields.
1008 (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1009 (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1010 (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1011 (Output_data_plt_sparc::rela_ifunc): New function.
1012 (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1013 (Output_data_plt_sparc::has_ifunc_section): New function.
1014 (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1015 (Output_data_plt_sparc::address_for_global): New function.
1016 (Output_data_plt_sparc::address_for_local): New function.
1017 (Output_data_plt_sparc::plt_index_to_offset): New function.
1018 (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1019 and entry_count.
1020 (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1021 entry_count.
1022 (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1023 R_SPARC_JMP_IREL to switch.
1024 (Target_sparc::Scan::check_non_pic): Likewise.
1025 (Target_sparc::Scan::local): Handle IFUNC symbols.
1026 (Target_sparc::Scan::local): Likewise.
1027 (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1028 and plt_address_for_local.
1029 (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1030 Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1031
1032 * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1033 (class Output_data_reloc): Adjust calls to Output_reloc_type.
1034 (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1035 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1036 global relocs too.
1037 (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1038 * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1039 calls.
1040 * sparc.cc (Target_sparc::Scan::global): Likewise.
1041 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1042
1043 2012-04-16 Cary Coutant <ccoutant@google.com>
1044
1045 * archive.cc (Library_base::should_include_member): Check for
1046 --export-dynamic-symbol.
1047 * options.h (class General_options): Add --export-dynamic-symbol.
1048 * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1049 --export-dynamic-symbol.
1050 (Symbol_table::gc_mark_undef_symbols): Likewise.
1051 (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1052
1053 2012-04-12 David S. Miller <davem@davemloft.net>
1054
1055 * sparc.cc (Reloc::wdisp10): New relocation method.
1056 (Reloc::h34): Likewise.
1057 (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1058 (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1059 R_SPARC_WDISP10.
1060 (Target_sparc::Scan::local): Likewise.
1061 (Target_sparc::Scan::global): Likewise.
1062 (Target_sparc::Relocate::relocate): Likewise.
1063
1064 2012-04-09 Cary Coutant <ccoutant@google.com>
1065
1066 * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1067 low_pc == 0.
1068
1069 2012-04-06 Ian Lance Taylor <iant@google.com>
1070
1071 * timer.cc: #include <unistd.h>.
1072
1073 2012-04-06 Roland McGrath <mcgrathr@google.com>
1074
1075 * configure.in (AC_CHECK_HEADERS): Add locale.h.
1076 * config.in: Regenerate.
1077 * configure: Regenerate.
1078
1079 2012-04-05 Nick Clifton <nickc@redhat.com>
1080
1081 * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1082 (AM_LC_MESSAGES): Add.
1083 * aclocal.m4: Regenerate.
1084 * config.in: Regenerate.
1085 * configure: Regenerate.
1086
1087 2012-03-21 Cary Coutant <ccoutant@google.com>
1088
1089 * Makefile.am: Add gdb-index.cc, gdb-index.h.
1090 * Makefile.in: Regenerate.
1091 * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1092 (Sized_elf_reloc_mapper::symbol_section): New function.
1093 (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1094 (make_elf_reloc_mapper): New function.
1095 (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1096 (Dwarf_abbrev_table::do_read_abbrevs): New function.
1097 (Dwarf_abbrev_table::do_get_abbrev): New function.
1098 (Dwarf_ranges_table::read_ranges_table): New function.
1099 (Dwarf_ranges_table::read_range_list): New function.
1100 (Dwarf_pubnames_table::read_section): New function.
1101 (Dwarf_pubnames_table::read_header): New function.
1102 (Dwarf_pubnames_table::next_name): New function.
1103 (Dwarf_die::Dwarf_die): New function.
1104 (Dwarf_die::read_attributes): New function.
1105 (Dwarf_die::skip_attributes): New function.
1106 (Dwarf_die::set_name): New function.
1107 (Dwarf_die::set_linkage_name): New function.
1108 (Dwarf_die::attribute): New function.
1109 (Dwarf_die::string_attribute): New function.
1110 (Dwarf_die::int_attribute): New function.
1111 (Dwarf_die::uint_attribute): New function.
1112 (Dwarf_die::ref_attribute): New function.
1113 (Dwarf_die::child_offset): New function.
1114 (Dwarf_die::sibling_offset): New function.
1115 (Dwarf_info_reader::check_buffer): New function.
1116 (Dwarf_info_reader::parse): New function.
1117 (Dwarf_info_reader::do_parse): New function.
1118 (Dwarf_info_reader::do_read_string_table): New function.
1119 (Dwarf_info_reader::lookup_reloc): New function.
1120 (Dwarf_info_reader::get_string): New function.
1121 (Dwarf_info_reader::visit_compilation_unit): New function.
1122 (Dwarf_info_reader::visit_type_unit): New function.
1123 (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1124 Sized_elf_reloc_mapper.
1125 (Sized_dwarf_line_info::symbol_section): Remove function.
1126 (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1127 (Sized_dwarf_line_info::read_line_mappings): Remove object
1128 parameter, adjust callers.
1129 (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1130 * dwarf_reader.h: Include <sys/types.h>.
1131 (class Track_relocs): Remove forward declaration.
1132 (class Elf_reloc_mapper): New class.
1133 (class Sized_elf_reloc_mapper): New class.
1134 (class Dwarf_abbrev_table): New class.
1135 (class Dwarf_range_list): New class.
1136 (class Dwarf_ranges_table): New class.
1137 (class Dwarf_pubnames_table): New class.
1138 (class Dwarf_die): New class.
1139 (class Dwarf_info_reader): New class.
1140 (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1141 (Sized_dwarf_line_info::symbol_section): Remove member function.
1142 * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1143 base class.
1144 * gdb-index.cc: New source file.
1145 * gdb-index.h: New source file.
1146 * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1147 and .debug_types sections, call Layout::add_to_gdb_index.
1148 (Sized_relobj_incr::do_section_name): Implement.
1149 (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1150 return type; Implement.
1151 (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1152 return type.
1153 * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1154 parameter list and return type.
1155 (Sized_incr_dynobj::do_section_contents): Likewise.
1156 * layout.cc: Include gdb-index.h.
1157 (Layout::Layout): Initialize gdb_index_data_.
1158 (Layout::init_fixed_output_section): Check for .gdb_index section.
1159 (Layout::add_to_gdb_index): New function. Instantiate.
1160 * layout.h: Add forward declaration for class Gdb_index.
1161 (Layout::add_to_gdb_index): New member function.
1162 (Layout::gdb_index_data_): New data member.
1163 * main.cc: Include gdb-index.h.
1164 (main): Print statistics for gdb index.
1165 * object.cc (Object::section_contents): Move code into
1166 do_section_contents.
1167 (need_decompressed_section): Check for sections needed when building
1168 gdb index.
1169 (build_compressed_section_map): Likewise.
1170 (Sized_relobj_file::do_read_symbols): Need local symbols when building
1171 gdb index.
1172 (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1173 sections; call Layout::add_to_gdb_index.
1174 (Sized_relobj_file::do_decompressed_section_contents): Call
1175 do_section_contents directly.
1176 * object.h (Object::do_section_contents): Adjust parameter list and
1177 return type.
1178 (Object::do_decompressed_section_contents): Call do_section_contents
1179 directly.
1180 (Sized_relobj_file::do_section_contents): Adjust parameter list and
1181 return type.
1182 * options.h (class General_options): Add --gdb-index option.
1183 * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1184 list and return type.
1185 * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1186 * reloc.h (Track_relocs::checkpoint): New function.
1187 (Track_relocs::reset): New function.
1188
1189 * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1190 New test cases.
1191 * testsuite/Makefile.in: Regenerate.
1192 * testsuite/gdb_index_test.cc: New test source file.
1193 * testsuite/gdb_index_test_1.sh: New test source file.
1194 * testsuite/gdb_index_test_2.sh: New test source file.
1195
1196 2012-03-19 Doug Kwan <dougkwan@google.com>
1197
1198 * arm.cc (Target_arm::do_define_standard_symbols): New method.
1199 (Target_arm::do_finalize_sections): Remove code which defines
1200 __exidx_start and __exidx_end. Make symbol table parameter
1201 anonymous as it is not used.
1202 * gold.cc (queue_middle_tasks): Call target hook to define any
1203 target-specific symbols.
1204 * target.h (Target::define_standard_symbols): New method.
1205 (Target::do_define_standard_symbols): Same.
1206 * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1207 * testsuite/Makefile.in: Regenerate.
1208 * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1209 and __exidx_end.
1210 * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1211 relocations are generated for __exidx_start and __exidx_end.
1212
1213 2012-03-16 Doug Kwan <dougkwan@google.com>
1214
1215 * testsuite/Makefile.am: Disable test initpri3b.
1216 * testsuite/Makefile.in: Regenerate.
1217
1218 2012-03-15 Doug Kwan <dougkwan@google.com>
1219
1220 * arm.cc (Target_arm::got_section): Make .got section read-only
1221 if -z now is given.
1222
1223 2012-03-15 Ian Lance Taylor <iant@google.com>
1224
1225 PR gold/13850
1226 * layout.cc (Layout::make_output_section): Correctly mark
1227 SHT_INIT_ARRAY, et. al., as relro.
1228
1229 2012-03-14 Doug Kwan <dougkwan@google.com>
1230
1231 * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1232 dynamic relocations for protected symbols in shared objects.
1233
1234 2012-03-13 Ian Lance Taylor <iant@google.com>
1235
1236 * resolve.cc (Symbol_table::resolve): When merging common symbols,
1237 keep the larger alignment.
1238
1239 2012-03-12 Cary Coutant <ccoutant@google.com>
1240
1241 * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1242 handling of DW_LNE_define_file.
1243
1244 2012-03-12 Cary Coutant <ccoutant@google.com>
1245
1246 * reduced_debug_output.cc
1247 (Output_reduced_debug_info_section::get_die_end): Add new FORM
1248 codes to switch.
1249
1250 2012-02-29 Cary Coutant <ccoutant@google.com>
1251
1252 * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1253
1254 2012-02-29 Cary Coutant <ccoutant@google.com>
1255
1256 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1257 Call Object::decompressed_section_contents.
1258 * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1259 New dtor.
1260 (Sized_dwarf_line_info::buffer_start_): New data member.
1261 * merge.cc (Output_merge_data::do_add_input_section): Call
1262 Object::decompressed_section_contents.
1263 (Output_merge_string::do_add_input_section): Likewise.
1264 * object.cc (need_decompressed_section): New function.
1265 (build_compressed_section_map): Decompress sections needed later.
1266 (Sized_relobj_file::do_decompressed_section_contents): New function.
1267 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1268 * object.h (Object::decompressed_section_contents): New function.
1269 (Object::discard_decompressed_sections): New function.
1270 (Object::do_decompressed_section_contents): New function.
1271 (Object::do_discard_decompressed_sections): New function.
1272 (Compressed_section_info): New type.
1273 (Compressed_section_map): Include decompressed section contents.
1274 (Sized_relobj_file::do_decompressed_section_contents): New function.
1275 (Sized_relobj_file::do_discard_decompressed_sections): New function.
1276
1277 2012-02-16 Cary Coutant <ccoutant@google.com>
1278
1279 * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1280 * testsuite/Makefile.in: Regenerate.
1281
1282 2012-02-14 Cary Coutant <ccoutant@google.com>
1283
1284 * options.cc (General_options::finalize): Disallow -pie and -static.
1285
1286 2012-02-03 Doug Kwan <dougkwan@google.com>
1287
1288 * arm.cc (Arm_relocate_functions::abs8,
1289 Arm_relocate_functions::abs16): Use
1290 Bits::has_signed_unsigned_overflow32.
1291 (Arm_relocate_functions::thm_abs8): Correct range of
1292 overflow check.
1293 * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1294 in assertions.
1295
1296 2012-02-02 Doug Kwan <dougkwan@google.com>
1297
1298 * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1299 position independent outputs, not just shared objects.
1300
1301 2012-01-30 H.J. Lu <hongjiu.lu@intel.com>
1302
1303 * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1304 * configure: Regenerated.
1305
1306 2012-01-27 Ian Lance Taylor <iant@google.com>
1307
1308 * reloc.h (Bits): New class with static functions, copied from
1309 namespace utils in arm.cc.
1310 * arm.cc (namespace utils): Remove. Rewrite all uses to use Bits
1311 instead.
1312
1313 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1314
1315 * incremental.cc (write_info_blocks): Correct relocation offset.
1316
1317 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1318
1319 * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1320 (Relocate::tls_gd_to_le): Likewise.
1321
1322 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1323
1324 * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1325
1326 2012-01-27 H.J. Lu <hongjiu.lu@intel.com>
1327
1328 * configure.ac: Check if -mcmodel=medium works.
1329 * configure: Regenerated.
1330
1331 2012-01-24 Cary Coutant <ccoutant@google.com>
1332
1333 * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1334 definition and ...
1335 (read_unsigned_LEB_128_x): ... this new function.
1336 (read_signed_LEB_128): Replaced with inline definition and ...
1337 (read_signed_LEB_128_x): ... this new function.
1338 * int_encoding.h (read_unsigned_LEB_128_x): New function.
1339 (read_unsigned_LEB_128): Add inline definition.
1340 (read_signed_LEB_128_x): New function.
1341 (read_signed_LEB_128): Add inline definition.
1342 * testsuite/Makefile.am (leb128_unittest): New unit test.
1343 * testsuite/Makefile.in: Regenerate.
1344 * testsuite/leb128_unittest.cc: New unit test.
1345
1346 2012-01-23 Ian Lance Taylor <iant@google.com>
1347
1348 PR gold/13617
1349 * i386.cc (Target_i386::do_code_fill): When using a jmp
1350 instruction, pad with nop instructions.
1351 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1352
1353 2012-01-22 H.J. Lu <hongjiu.lu@intel.com>
1354
1355 * x86_64.cc (gc_process_relocs): Add typename on types used in
1356 template.
1357 (scan_relocs): Likewise.
1358 (relocate_section): Likewise.
1359 (apply_relocation): Likewise.
1360
1361 2012-01-10 H.J. Lu <hongjiu.lu@intel.com>
1362
1363 * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1364 (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1365 under x32.
1366
1367 2012-01-09 H.J. Lu <hongjiu.lu@intel.com>
1368
1369 * x86_64.cc: Initial support for x32.
1370
1371 2012-01-03 Cary Coutant <ccoutant@google.com>
1372
1373 * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1374 Use abstract base class for GOT.
1375 * gold/output.h (class Output_data_got_base): New abstract base class.
1376 (class Output_data_got): Derive from new base class, adjust ctors.
1377 (Output_data_got::reserve_slot): Make virtual; rename to
1378 do_reserve_slot; Adjust callers.
1379 * gold/target.h (Sized_target::init_got_plt_for_update): Return
1380 pointer to abstract base class.
1381 * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1382
1383 2011-12-18 Ian Lance Taylor <iant@google.com>
1384
1385 * object.h (Relobj::local_symbol_value): New function.
1386 (Relobj::local_plt_offset): New function.
1387 (Relobj::local_has_got_offset): New function.
1388 (Relobj::local_got_offset): New function.
1389 (Relobj::set_local_got_offset): New function.
1390 (Relobj::do_local_symbol_value): New pure virtual function.
1391 (Relobj::do_local_plt_offset): Likewise.
1392 (Relobj::do_local_has_got_offset): Likewise.
1393 (Relobj::do_local_got_offset): Likewise.
1394 (Relobj::do_set_local_got_offset): Likewise.
1395 (Sized_relobj::do_local_has_got_offset): Rename from
1396 local_has_got_offset.
1397 (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1398 (Sized_relobj::do_set_local_got_offset): Rename from
1399 set_local_got_offset.
1400 (Sized_relobj_file::do_local_plt_offset): Rename from
1401 local_plt_offset.
1402 (Sized_relobj_file::do_local_symbol_value): New function.
1403 * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1404 local_plt_offset.
1405 * output.cc (Output_data_got::Got_entry::write): Change object to
1406 Relobj. Use local_symbol_value.
1407 (Output_data_got::add_global_with_rel): Change rel_dyn to
1408 Output_data_reloc_generic*. Use add_global_generic.
1409 (Output_data_got::add_global_with_rela): Remove. Change all
1410 callers to use add_global_with_rel.
1411 (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1412 Output_data_reloc_generic*. Use add_global_generic.
1413 (Output_data_got::add_global_pair_with_rela): Remove. Change all
1414 callers to use add_global_pair_with_rel.
1415 (Output_data_got::add_local): Change object to Relobj*.
1416 (Output_data_got::add_local_plt): Likewise.
1417 (Output_data_got::add_local_with_rel): Change object to Relobj*,
1418 change rel_dyn to Output_data_reloc_generic*. Use
1419 add_local_generic.
1420 (Output_data_got::add_local_with_rela): Remove. Change all
1421 callers to use all_local_with_rel.
1422 (Output_data_got::add_local_pair_with_rel): Change object to
1423 Relobj*, change rel_dyn to Output_data_reloc_generic*. Use
1424 add_output_section_generic.
1425 (Output_data_got::add_local_pair_with_rela): Remove. Change all
1426 callers to use add_local_pair_with_rel.
1427 (Output_data_got::reserve_local): Change object to Relobj*.
1428 * output.h: (class Output_data_reloc_generic): Add pure virtual
1429 declarations for add_global_generic, add_local_generic,
1430 add_output_section_generic.
1431 (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1432 functions for Output_data_reloc_generic. Update declarations for
1433 changes listed in output.cc.
1434 (class Output_data_got): Change template parameter to got_size.
1435 Don't define Rel_dyn or Rela_dyn. Update declarations per above.
1436 * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1437 function.
1438 (Sized_relobj_incr::do_local_plt_offset): New function.
1439 * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1440 add_global_generic.
1441
1442 2011-12-17 Cary Coutant <ccoutant@google.com>
1443
1444 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1445 * resolve.cc (Symbol_table::resolve): Likewise.
1446 * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1447 arrays.
1448 * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1449
1450 2011-12-16 Ian Lance Taylor <iant@google.com>
1451
1452 * output.h (Output_data_reloc_generic::add): Only call
1453 add_dynamic_reloc if this is a dynamic reloc section.
1454
1455 2011-12-15 H.J. Lu <hongjiu.lu@intel.com>
1456
1457 PR gold/13505
1458 * target-reloc.h (apply_relocation): Replace <64, false> with
1459 <size, big_endian>.
1460
1461 2011-11-25 Nick Clifton <nickc@redhat.com>
1462
1463 * po/it.po: New Italian translation.
1464
1465 2011-11-17 Sterling Augustine <saugustine@google.com>
1466
1467 * script.cc (script_include_directive): Implement.
1468 (read_script_file): New local variables name and search_path. Update
1469 comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1470 * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1471 * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1472
1473 2011-11-11 Sterling Augustine <saugustine@google.com>
1474
1475 * yyscript.y (section_cmd): Add support for INCLUDE directive.
1476 (file_or_sections_cmd): Likewise.
1477
1478 2011-11-11 Doug Kwan <dougkwan@google.com>
1479
1480 * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1481 if --just-symbols is given.
1482
1483 2011-11-10 Doug Kwan <dougkwan@google.com>
1484
1485 PR gold/13362
1486 * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1487 when processing data relocs.
1488 * reloc.h (Relocate_functions::rel_unaligned): New method.
1489 (Relocate_functions::pcrel_unaligned): Ditto.
1490 (Relocate_functions::rel32_unaligned): Ditto.
1491 (Relocate_functions::pcrel32_unaligned): Ditto.
1492
1493 2011-11-09 Doug Kwan <dougkwan@google.com>
1494
1495 PR gold/13362
1496 * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1497 Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1498 * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1499 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1500 (Relocate_functions::rel_unaligned): New.
1501 (Relocate_functions::rel32_unaligned): New.
1502 * target-reloc.h (relocate_for_relocatable): Add code to handle
1503 RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1504 * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1505 arm_unaligned_reloc_r): New targets.
1506 * testsuite/Makefile.in: Regenerate.
1507 * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1508 linking.
1509
1510 2011-11-02 Ian Lance Taylor <iant@google.com>
1511
1512 * configure.ac: Add --with-lib-path option. Define LIB_PATH and
1513 NATIVE_LINKER.
1514 * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1515 * options.cc (General_options::finalize): Use library search path
1516 from configure script if specified. If not native and no sysroot,
1517 only search TOOLLIBDIR.
1518 * options.h (Search_directory::Search_directory): Change name to
1519 const std::string&.
1520 (General_options::add_to_library_path_with_sysroot): Change arg to
1521 const std::string&.
1522 * configure, Makefile.in, config.in: Rebuild.
1523
1524 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1525
1526 * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1527 we are working around the ARM1176 Erratum.
1528 * options.h (General_options::fix_arm1176): Add option.
1529 * testsuite/Makefile.am: Add testcases, and keep current ones
1530 working.
1531 * testsuite/Makefile.in: Regenerate.
1532 * testsuite/arm_fix_1176.s: New file.
1533 * testsuite/arm_fix_1176.sh: Likewise.
1534
1535 2011-11-02 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
1536
1537 * arm.cc (Target_arm::Target_arm): Remove initialisation of
1538 may_use_blx_.
1539 (Target_arm::may_use_blx): Remove method.
1540 (Target_arm::set_may_use_blx): Likewise.
1541 (Target_arm::may_use_v4t_interworking): New method.
1542 (Target_arm::may_use_v5t_interworking): Likewise.
1543 (Target_arm::may_use_blx_): Remove member variable.
1544 (Arm_relocate_functions::arm_branch_common): Check for v5T
1545 interworking.
1546 (Arm_relocate_functions::thumb_branch_common): Likewise.
1547 (Reloc_stub::stub_type_for_reloc): Likewise.
1548 (Target_arm::do_finalize_sections): Correct interworking checks.
1549 * testsuite/Makefile.am: Add new tests.
1550 * testsuite/Makefile.in: Regenerate.
1551 * testsuite/arm_farcall_arm_arm.s: New test.
1552 * testsuite/arm_farcall_arm_arm.sh: Likewise.
1553 * testsuite/arm_farcall_arm_thumb.s: Likewise.
1554 * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1555 * testsuite/arm_farcall_thumb_arm.s: Likewise.
1556 * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1557 * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1558 * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1559
1560 2011-10-31 Cary Coutant <ccoutant@google.com>
1561
1562 PR gold/13023
1563 * expression.cc (Expression::eval_with_dot): Add
1564 is_section_dot_assignment parameter.
1565 (Expression::eval_maybe_dot): Likewise. Adjust value when rhs is
1566 absolute and assigning to dot within a section.
1567 * script-sections.cc
1568 (Output_section_element_assignment::set_section_addresses): Pass
1569 dot_section to set_if_absolute.
1570 (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1571 as is_section_dot_assignment flag to eval_with_dot.
1572 (Output_section_element_dot_assignment::set_section_addresses):
1573 Likewise.
1574 * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1575 parameter. Also set value if relative to dot_section; set the
1576 symbol's output_section.
1577 * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1578 parameter. Adjust all callers.
1579 (Expression::eval_maybe_dot): Likewise.
1580 (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1581 Adjust all callers.
1582 * testsuite/script_test_2.t: Test assignment of an absolute value
1583 to dot within an output section element.
1584
1585 2011-10-31 Cary Coutant <ccoutant@google.com>
1586
1587 * options.h (class General_options): Add --[no-]gnu-unique options.
1588 * symtab.cc (Symbol_table::sized_write_globals): Convert
1589 STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1590
1591 2011-10-31 Cary Coutant <ccoutant@google.com>
1592
1593 PR gold/13359
1594 * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1595 unnecessary assertion.
1596 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1597
1598 2011-10-31 Sriraman Tallam <tmsriram@google.com>
1599
1600 * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1601 gc_mark_symbol.
1602 * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1603 gc_mark_symbol.
1604 Change to just keep the section associated with symbol.
1605 (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1606 they are externally visible and --export-dynamic is turned on.
1607 (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1608
1609 2011-10-19 Ian Lance Taylor <iant@google.com>
1610
1611 PR gold/13163
1612 * script-sections.cc
1613 (Output_section_element_dot_assignment::needs_output_section): New
1614 function.
1615
1616 2011-10-19 Ian Lance Taylor <iant@google.com>
1617
1618 PR gold/13204
1619 * layout.cc (Layout::segment_precedes): Don't assert failure if a
1620 --section-start option was seen.
1621 * options.h (General_options::any_section_start): New function.
1622
1623 2011-10-18 David S. Miller <davem@davemloft.net>
1624
1625 PR binutils/13301
1626 * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1627 member to track relocation locations that have moved during TLS
1628 reloc optimizations.
1629 (Target_sparc::Relocate::Relocate): Initialize to NULL.
1630 (Target_sparc::Relocate::relocate): Adjust view down by 4
1631 bytes if it matches reloc_adjust_addr_.
1632 (Target_sparc::Relocate::relocate_tls): Always move the
1633 __tls_get_addr call delay slot instruction forward 4 bytes when
1634 performing relaxation.
1635
1636 2011-10-18 Cary Coutant <ccoutant@google.com>
1637
1638 * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1639 (Output_file::map_no_anonymous): Check for non-zero
1640 return code from posix_fallocate.
1641
1642 2011-10-17 Cary Coutant <ccoutant@google.com>
1643
1644 PR gold/13245
1645 * plugin.cc (is_visible_from_outside): Check for symbols
1646 referenced from dynamic objects.
1647 * resolve.cc (Symbol_table::resolve): Don't count references
1648 from dynamic objects as references from real ELF files.
1649 * testsuite/plugin_test_2.sh: Adjust expected result.
1650
1651 2011-10-17 Cary Coutant <ccoutant@google.com>
1652
1653 * gold.cc: Include timer.h.
1654 (queue_middle_tasks): Stamp time.
1655 (queue_final_tasks): Likewise.
1656 * main.cc (main): Store timer in parameters. Print timers
1657 for each pass.
1658 * parameters.cc (Parameters::Parameters): Initialize timer_.
1659 (Parameters::set_timer): New function.
1660 (set_parameters_timer): New function.
1661 * parameters.h (Parameters::set_timer): New function.
1662 (Parameters::timer): New function.
1663 (Parameters::timer_): New data member.
1664 (set_parameters_timer): New function.
1665 * timer.cc (Timer::stamp): New function.
1666 (Timer::get_pass_time): New function.
1667 * timer.h (Timer::stamp): New function.
1668 (Timer::get_pass_time): New function.
1669 (Timer::pass_times_): New data member.
1670
1671 2011-10-17 Cary Coutant <ccoutant@google.com>
1672
1673 * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1674 task for members of lib groups.
1675
1676 2011-10-17 Cary Coutant <ccoutant@google.com>
1677
1678 PR gold/13288
1679 * fileread.cc (File_read::find_view): Add assert.
1680 (File_read::make_view): Move bounds check (replace with assert)...
1681 (File_read::find_or_make_view): ... to here.
1682
1683 2011-10-12 Cary Coutant <ccoutant@google.com>
1684
1685 * output.cc (Output_file::open_base_file): Handle case where
1686 ::read returns less than requested size.
1687
1688 2011-10-10 Cary Coutant <ccoutant@google.com>
1689
1690 * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1691 Initialize defined_count_.
1692 (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1693 (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1694 (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1695 (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1696 (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1697 * incremental.h (Sized_relobj_incr::defined_count_): New data
1698 member.
1699 (Sized_incr_dynobj::defined_count_): New data member.
1700 * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1701 Return zeroes instead of internal error.
1702
1703 2011-10-10 Cary Coutant <ccoutant@google.com>
1704
1705 PR gold/13249
1706 * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1707 (Output_reloc::symbol_value): Return PLT offset if flag is set.
1708 * output.h (class Output_reloc): Add use_plt_offset flag.
1709 (Output_reloc::type_): Adjust size of bit field.
1710 (Output_reloc::use_plt_offset_): New bit field.
1711 (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1712 (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1713 flag. Adjust all callers.
1714 * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1715 creating RELATIVE relocations.
1716
1717 2011-10-10 Nick Clifton <nickc@redhat.com>
1718
1719 * po/es.po: Updated Spanish translation.
1720 * po/fi.po: Updated Finnish translation.
1721
1722 2011-10-03 Diego Novillo <dnovillo@google.com>
1723
1724 * options.cc (parse_uint): Fix dereference of RETVAL.
1725
1726 2011-09-29 Sriraman Tallam <tmsriram@google.com>
1727
1728 * layout.h (section_order_map_): New member.
1729 (get_section_order_map): New member function.
1730 * output.cc (Output_section::add_input_section): Check for patterns
1731 only when --section-ordering-file is specified.
1732 * gold.cc (queue_middle_tasks): Delay updating order of sections till
1733 output_sections have been formed.
1734 * layout.cc (Layout_Layout): Initialize section_order_map_.
1735 * plugin.cc (update_section_order): Store order in order_map. Do not
1736 update the order.
1737 * testsuite/Makefile.am: Add test case for plugin_final_layout.
1738 * testsuite/Makefile.in: Regenerate.
1739 * testsuite/plugin_section_order.c: New file.
1740 * testsuite/plugin_final_layout.cc: New file.
1741 * testsuite/plugin_final_layout.sh: New file.
1742
1743 2011-09-29 Cary Coutant <ccoutant@google.com>
1744
1745 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1746 Check for NULL.
1747 * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1748 symbols during incremental update.
1749 (Symbol_table::add_from_dynobj): Likewise.
1750
1751 2011-09-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
1752 Ian Lance Taylor <iant@google.com>
1753
1754 * symtab.cc (Symbol_table::define_special_symbol): Always
1755 canonicalize version string.
1756
1757 2011-09-26 Cary Coutant <ccoutant@google.com>
1758
1759 * gold.cc (queue_initial_tasks): Move option checks ...
1760 * options.cc (General_options::finalize): ... to here. Disable
1761 some options; make others fatal.
1762
1763 2011-09-26 Cary Coutant <ccoutant@google.com>
1764
1765 gcc PR lto/47247
1766 * plugin.cc (get_symbols_v2): New function.
1767 (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1768 (is_referenced_from_outside): New function.
1769 (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1770 LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1771 (get_symbols): Pass version parameter.
1772 (get_symbols_v2): New function.
1773 * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1774 parameter.
1775 * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1776 (onload): Add LDPT_GET_SYMBOLS_V2.
1777 (all_symbols_read_hook): Use get_symbols_v2; check for
1778 LDPR_PREVAILING_DEF_IRONLY_EXP.
1779 * testsuite/plugin_test_3.sh: Update expected results.
1780
1781 2011-09-23 Simon Baldwin <simonb@google.com>
1782
1783 * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1784 configuration options.
1785 * configure: Regenerate.
1786 * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1787 * Makefile.in: Regenerate.
1788 * testsuite/Makefile.in: Regenerate.
1789
1790 2011-09-19 Sriraman Tallam <tmsriram@google.com>
1791
1792 * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1793
1794 2011-09-19 Cary Coutant <ccoutant@google.com>
1795
1796 * incremental.cc (can_incremental_update): Fix typo in comment.
1797 * incremental.h (can_incremental_update): Likewise.
1798
1799 2011-09-18 Cary Coutant <ccoutant@google.com>
1800
1801 * incremental.cc (can_incremental_update): New function.
1802 * incremental.h (can_incremental_update): New function.
1803 * layout.cc (Layout::init_fixed_output_section): Call it.
1804 (Layout::make_output_section): Don't allow patch space in .eh_frame.
1805 * object.cc (Sized_relobj_file::do_layout): Call
1806 can_incremental_update.
1807
1808 2011-09-13 Cary Coutant <ccoutant@google.com>
1809
1810 * configure.ac: Check for glibc support for gnu_indirect_function
1811 support with static linking, setting automake conditional
1812 IFUNC_STATIC.
1813 * Makefile.in: Regenerate.
1814 * configure: Regenerate.
1815
1816 * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1817 (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1818 for IFUNC_STATIC.
1819 * testsuite/Makefile.in: Regenerate.
1820
1821 2011-09-13 Cary Coutant <ccoutant@google.com>
1822
1823 * incremental.cc (Sized_relobj_incr::do_layout): Call
1824 report_comdat_group for kept comdat sections.
1825 * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1826 * testsuite/Makefile.in: Regenerate.
1827 * testsuite/incr_comdat_test_1.cc: New source file.
1828 * testsuite/incr_comdat_test_2_v1.cc: New source file.
1829 * testsuite/incr_comdat_test_2_v2.cc: New source file.
1830 * testsuite/incr_comdat_test_2_v3.cc: New source file.
1831
1832 2011-09-13 Ian Lance Taylor <iant@google.com>
1833
1834 * object.cc (Sized_relobj_file::do_layout): Remove unused local
1835 variable external_symbols_offset.
1836
1837 2011-09-12 Ian Lance Taylor <iant@google.com>
1838
1839 * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1840 triggered if object has no symbols.
1841
1842 2011-09-09 David S. Miller <davem@davemloft.net>
1843
1844 * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1845 (Output_fill_debug_line::do_write): Likewise.
1846
1847 2011-08-29 Cary Coutant <ccoutant@google.com>
1848
1849 * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1850 casts to match formatting specs.
1851 (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1852
1853 2011-08-26 Cary Coutant <ccoutant@google.com>
1854
1855 * layout.cc (Free_list::allocate): Provide guarantee of minimum
1856 remaining hole size when allocating.
1857 (Layout::make_output_section): Set fill methods for debug sections.
1858 * layout.h (Free_list::Free_list_node): Move from private to
1859 public.
1860 (Free_list::set_min_hole_size): New function.
1861 (Free_list::begin, Free_list::end): New functions.
1862 (Free_list::min_hole_): New data member.
1863 * output.cc: Include dwarf.h.
1864 (Output_fill_debug_info::do_minimum_hole_size): New function.
1865 (Output_fill_debug_info::do_write): New function.
1866 (Output_fill_debug_line::do_minimum_hole_size): New function.
1867 (Output_fill_debug_line::do_write): New function.
1868 (Output_section::Output_section): Initialize new data member.
1869 (Output_section::set_final_data_size): Ensure patch space is larger
1870 than minimum hole size.
1871 (Output_section::do_write): Fill holes in debug sections.
1872 * output.h (Output_fill): New class.
1873 (Output_fill_debug_info): New class.
1874 (Output_fill_debug_line): New class.
1875 (Output_section::set_free_space_fill): New function.
1876 (Output_section::free_space_fill_): New data member.
1877 * testsuite/Makefile.am (incremental_test_3): Add
1878 --incremental-patch option.
1879 (incremental_test_4): Likewise.
1880 (incremental_test_5): Likewise.
1881 (incremental_test_6): Likewise.
1882 (incremental_copy_test): Likewise.
1883 (incremental_common_test_1): Likewise.
1884 * testsuite/Makefile.in: Regenerate.
1885
1886 2011-08-26 Nick Clifton <nickc@redhat.com>
1887
1888 * po/es.po: Updated Spanish translation.
1889
1890 2011-08-01 Cary Coutant <ccoutant@google.com>
1891
1892 * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1893 * gold/testsuite/Makefile.in: Regenerate.
1894 * gold/testsuite/justsyms_exec.c: New source file.
1895 * gold/testsuite/justsyms_lib.c: New source file.
1896
1897 2011-08-01 Cary Coutant <ccoutant@google.com>
1898
1899 * layout.cc (Layout::set_segment_offsets): Don't realign text
1900 segment if -Ttext was specified.
1901 * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1902 file type.
1903 * object.h (Sized_relobj_file::e_type): New function.
1904 (Sized_relobj_file::e_type_): New data member.
1905 * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1906 base address for ET_EXEC files.
1907 * target.cc (Target::do_make_elf_object_implementation): Allow
1908 ET_EXEC files with --just-symbols option.
1909
1910 2011-07-28 Cary Coutant <ccoutant@google.com>
1911
1912 * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1913 Add thread_number parameter.
1914 (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1915 * workqueue-threads.cc
1916 (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1917 current thread if its thread number is greater than desired thread
1918 count.
1919 * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1920 Add thread_number parameter.
1921 (Workqueue::should_cancel_thread): Likewise.
1922 (Workqueue::find_runnable_or_wait): Pass thread_number to
1923 should_cancel_thread.
1924 * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1925 parameter.
1926
1927 2011-07-22 Sriraman Tallam <tmsriram@google.com>
1928
1929 * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1930 only after checking if it cannot be forced local.
1931 * symtab.h (is_externally_visible): Check if the symbol is not forced
1932 local.
1933
1934 2011-07-15 Ian Lance Taylor <iant@google.com>
1935
1936 * options.h (class General_options): Add --print-output-format.
1937 Move -EL next to -EB, for better --help output.
1938 * target-select.cc: Include <cstdio>, "options.h", and
1939 "parameters.h".
1940 (Target_selector::do_target_bfd_name): New function.
1941 (print_output_format): New function.
1942 * target-select.h (class Target_selector): Update declarations.
1943 (Target_selector::target_bfd_name): New function.
1944 (print_output_format): Declare.
1945 * main.cc: Include "target-select.h".
1946 (main): Handle --print-output-format.
1947 * gold.cc: Include "target-select.h".
1948 (queue_initial_tasks): Handle --print-output-format when there are
1949 no input files.
1950 * parameters.cc (parameters_force_valid_target): Give a better
1951 error message if -EB/-EL does not match target.
1952 * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1953 function.
1954
1955 2011-07-15 Ian Lance Taylor <iant@google.com>
1956
1957 * i386.cc (class Output_data_plt_i386): Add layout_ field.
1958 (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1959 (Output_data_plt_i386::do_write): Write address of .dynamic
1960 section to first entry in .got.plt section.
1961 * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1962 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1963 Initialize layout_.
1964 (Output_data_plt_x86_64::do_write): Write address of .dynamic
1965 section to first entry in .got.plt section.
1966 * layout.h (Layout::dynamic_section): New function.
1967
1968 2011-07-13 Sriraman Tallam <tmsriram@google.com>
1969
1970 * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1971 to claim_file call.
1972 * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1973 input_section_position_, and input_section_glob_.
1974 (read_layout_from_file): Call function section_ordering_specified.
1975 * layout.h (is_section_ordering_specified): New function.
1976 (section_ordering_specified): New function.
1977 (section_ordering_specified_): New boolean member.
1978 * main.cc(main): Call load_plugins after layout object is defined.
1979 * output.cc (Output_section::add_input_section): Use
1980 function section_ordering_specified to check if section ordering is
1981 needed.
1982 * output.cc (Output_section::add_relaxed_input_section): Use
1983 function section_ordering_specified to check if section ordering is
1984 needed.
1985 (Output_section::update_section_layout): New function.
1986 (Output_section::sort_attached_input_sections): Check if input section
1987 must be reordered.
1988 * output.h (Output_section::update_section_layout): New function.
1989 * plugin.cc (get_section_count): New function.
1990 (get_section_type): New function.
1991 (get_section_name): New function.
1992 (get_section_contents): New function.
1993 (update_section_order): New function.
1994 (allow_section_ordering): New function.
1995 (Plugin::load): Add the new interfaces to the transfer vector.
1996 (Plugin_manager::load_plugins): New parameter.
1997 (Plugin_manager::all_symbols_read): New parameter.
1998 (Plugin_manager::claim_file): New parameter. Save the elf object for
1999 unclaimed objects.
2000 (Plugin_manager::get_elf_object): New function.
2001 (Plugin_manager::get_view): Change to directly use the bool to check
2002 if get_view is called from claim_file_hook.
2003 * plugin.h (input_objects): New function
2004 (Plugin__manager::load_plugins): New parameter.
2005 (Plugin_manager::claim_file): New parameter.
2006 (Plugin_manager::get_elf_object): New function.
2007 (Plugin_manager::in_claim_file_handler): New function.
2008 (Plugin_manager::in_claim_file_handler_): New member.
2009 (layout): New function.
2010 * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2011 handler with an extra parameter. Make the elf object before calling
2012 claim_file handler.
2013 * testsuite/plugin_test.c (get_section_count): New function pointer.
2014 (get_section_type): New function pointer.
2015 (get_section_name): New function pointer.
2016 (get_section_contents): New function pointer.
2017 (update_section_order): New function pointer.
2018 (allow_section_ordering): New function pointer.
2019 (onload): Check if the new interfaces exist.
2020
2021 2011-07-13 Ian Lance Taylor <iant@google.com>
2022
2023 * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2024 relro section.
2025 * x86_64.cc (Target_x86_64::got_section): Likewise.
2026 * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2027 (relro_now_test_SOURCES): New variable.
2028 (relro_now_test_DEPENDENCIES): New variable.
2029 (relro_now_test_LDFLAGS): New variable.
2030 (relro_now_test_LDADD): New variable.
2031 (relro_now_test.so): New target.
2032 * testsuite/Makefile.in: Rebuild.
2033
2034 2011-07-12 Ian Lance Taylor <iant@google.com>
2035
2036 PR gold/12980
2037 * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2038 GLOB_DAT relocation rather than a RELATIVE relocation for a
2039 protected symbol when creating a shared library.
2040 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2041 * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2042 * testsuite/protected_main_1.cc (main): Test that protected
2043 function has same address.
2044
2045 2011-07-11 Ian Lance Taylor <iant@google.com>
2046
2047 PR gold/12979
2048 * options.h (class General_options): Add -Bgroup.
2049 * options.cc (General_options::finalize): If -Bgroup is set,
2050 default to --unresolved-symbols=report-all.
2051 * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2052 * target-reloc.h (issue_undefined_symbol_error): Handle
2053 --unresolved-symbols=report-all.
2054
2055 2011-07-08 Ian Lance Taylor <iant@google.com>
2056
2057 PR gold/11985
2058 * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2059 if linker script discards key sections.
2060 (Layout::create_dynamic_symtab): Likewise.
2061 (Layout::assign_local_dynsym_offsets): Likewise.
2062 (Layout::sized_create_version_sections): Likewise.
2063 (Layout::create_interp): Likewise.
2064 (Layout::finish_dynamic_section): Likewise.
2065 (Layout::set_dynamic_symbol_size): Likewise.
2066
2067 2011-07-08 Ian Lance Taylor <iant@google.com>
2068
2069 PR gold/12386
2070 * options.h (class General_options): Add --unresolved-symbols.
2071 * target-reloc.h (issue_undefined_symbol_error): Check
2072 --unresolved-symbols. Add comments.
2073
2074 2011-07-08 Ian Lance Taylor <iant@google.com>
2075
2076 * testsuite/odr_violation2.cc (Ordering::operator()): Make
2077 expression more complex.
2078
2079 2011-07-08 Ian Lance Taylor <iant@google.com>
2080
2081 PR gold/11317
2082 * target-reloc.h (issue_undefined_symbol_error): New inline
2083 function, broken out of relocate_section.
2084 (relocate_section): Call issue_undefined_symbol_error.
2085 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2086 there is no TLS segment if we are about to issue an undefined
2087 symbol error.
2088 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2089
2090 2011-07-08 Ian Lance Taylor <iant@google.com>
2091
2092 PR gold/12279
2093 * resolve.cc (Symbol_table::should_override): Add fromtype
2094 parameter. Change all callers. Give error when linking together
2095 TLS and non-TLS symbol.
2096 (Symbol_table::should_override_with_special): Add fromtype
2097 parameter. Change all callers.
2098 * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2099 there is no TLS segment if we have reported some errors.
2100 * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2101
2102 2011-07-08 Ian Lance Taylor <iant@google.com>
2103
2104 PR gold/12372
2105 * target.h (Target::plt_address_for_global): New function.
2106 (Target::plt_address_for_local): New function.
2107 (Target::plt_section_for_global): Remove.
2108 (Target::plt_section_for_local): Remove.
2109 (Target::do_plt_address_for_global): New virtual function.
2110 (Target::do_plt_address_for_local): New virtual function.
2111 (Target::do_plt_section_for_global): Remove.
2112 (Target::do_plt_section_for_local): Remove.
2113 (Target::register_global_plt_entry): Add Symbol_table and Layout
2114 parameters.
2115 * output.cc (Output_data_got::Got_entry::write): Use
2116 plt_address_for_global and plt_address_for_local.
2117 * layout.cc (Layout::add_target_dynamic_tags): Use size and
2118 address of output section.
2119 * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2120 got_irelative_, and irelative_count_ fields. Update
2121 declarations.
2122 (Output_data_plt_i386::has_irelative_section): New function.
2123 (Output_data_plt_i386::entry_count): Add irelative_count_.
2124 (Output_data_plt_i386::set_final_data_size): Likewise.
2125 (class Target_i386): Add got_irelative_ and rel_irelative_
2126 fields. Update declarations.
2127 (Target_i386::Target_i386): Initialize new fields.
2128 (Target_i386::do_plt_address_for_global): New function replacing
2129 do_plt_section_for_global.
2130 (Target_i386::do_plt_address_for_local): New function replacing
2131 do_plt_section_for_local.
2132 (Target_i386::got_section): Create got_irelative_.
2133 (Target_i386::rel_irelative_section): New function.
2134 (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2135 fields. Don't define __rel_iplt_{start,end}.
2136 (Output_data_plt_i386::add_entry): Add symtab and layout
2137 parameters. Change all callers. Use different PLT and GOT for
2138 IFUNC symbols.
2139 (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2140 layout parameters. Change all callers. Use different PLT and
2141 GOT.
2142 (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2143 (Output_data_plt_i386::rel_irelative): New function.
2144 (Output_data_plt_i386::address_for_global): New function.
2145 (Output_data_plt_i386::address_for_local): New function.
2146 (Output_data_plt_i386::do_write): Write out IRELATIVE area. Use
2147 IRELATIVE GOT when changing IFUNC GOT entries.
2148 (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2149 reloc.
2150 (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2151 if we didn't create an IRELATIVE GOT.
2152 (Target_i386::Relocate::relocate): Use plt_address_for_global and
2153 plt_address_for_local.
2154 (Target_i386::do_dynsym_value): Use plt_address_for_global.
2155 * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2156 got_irelative_, and irelative_count_ fields. Update
2157 declarations.
2158 (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2159 Initialize new fields. Remove symtab parameter. Change all
2160 callers.
2161 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2162 irelative_count_.
2163 (Output_data_plt_x86_64::has_irelative_section): New function.
2164 (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2165 (class Target_x86_64): Add got_irelative_ and rel_irelative_
2166 fields. Update declarations.
2167 (Target_x86_64::Target_x86_64): Initialize new fields.
2168 (Target_x86_64::do_plt_address_for_global): New function replacing
2169 do_plt_section_for_global.
2170 (Target_x86_64::do_plt_address_for_local): New function replacing
2171 do_plt_section_for_local.
2172 (Target_x86_64::got_section): Create got_irelative_.
2173 (Target_x86_64::rela_irelative_section): New function.
2174 (Output_data_plt_x86_64::init): Remove symtab parameter. Change
2175 all callers. Don't create __rel_iplt_{start,end}.
2176 (Output_data_plt_x86_64::add_entry): Add symtab and layout
2177 parameters. Change all callers. Use different PLT and GOT for
2178 IFUNC symbols.
2179 (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2180 layout parameters. Change all callers. Use different PLT and
2181 GOT.
2182 (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2183 parameters. Change all callers. Use different PLT and GOT for
2184 IFUNC symbols.
2185 (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2186 (Output_data_plt_x86_64::rela_irelative): New function.
2187 (Output_data_plt_x86_64::address_for_global): New function.
2188 (Output_data_plt_x86_64::address_for_local): New function.
2189 (Output_data_plt_x86_64::set_final_data_size): Likewise.
2190 (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2191 (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2192 (Target_x86_64::register_global_plt_entry): Add symtab and layout
2193 parameters.
2194 (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2195 reloc.
2196 (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2197 symbols if we didn't create an IRELATIVE GOT.
2198 (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2199 plt_address_for_local.
2200 (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2201 * testsuite/ifuncvar1.c: New test file.
2202 * testsuite/ifuncvar2.c: New test file.
2203 * testsuite/ifuncvar3.c: New test file.
2204 * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2205 (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2206 (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2207 (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2208 * testsuite/Makefile.in: Rebuild.
2209
2210 2011-07-07 Cary Coutant <ccoutant@google.com>
2211
2212 * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2213 (two_file_test_1_ndebug.o): Likewise.
2214 (two_file_test_1b_ndebug.o): Likewise.
2215 (two_file_test_2_ndebug.o): Likewise.
2216 (two_file_test_main_ndebug.o): Likewise.
2217 (incremental_test_2): Link with no-debug versions.
2218
2219 2011-07-06 Cary Coutant <ccoutant@google.com>
2220
2221 * gold/incremental.cc
2222 (Output_section_incremental_inputs::write_info_blocks): Check for
2223 hidden and internal symbols.
2224
2225 2011-07-06 Cary Coutant <ccoutant@google.com>
2226
2227 * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2228 Check disposition for startup file.
2229 (Incremental_inputs::report_command_line): Ignore
2230 --incremental-startup-unchanged option.
2231 * options.cc (General_options::parse_incremental_startup_unchanged):
2232 New function.
2233 (General_options::General_options): Initialize new data member.
2234 * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2235 (General_options): Add --incremental-startup-unchanged option.
2236 (General_options::incremental_startup_disposition): New function.
2237 (General_options::incremental_startup_disposition_): New data member.
2238
2239 2011-07-06 Cary Coutant <ccoutant@google.com>
2240
2241 * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2242 input file index to Script_info ctor.
2243 (Sized_incremental_binary::do_file_has_changed): Find the
2244 command-line argument for files named in scripts.
2245 * incremental.h (Script_info::Script_info): New ctor
2246 with input file index.
2247 (Script_info::input_file_index): New function.
2248 (Script_info::input_file_index_): New data member.
2249 (Incremental_binary::get_library): Add const.
2250 (Incremental_binary::get_script_info): Add const.
2251 * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2252 * testsuite/Makefile.am (incremental_test_5): New test case.
2253 (incremental_test_6): New test case.
2254 * testsuite/Makefile.in: Regenerate.
2255
2256 2011-07-06 Cary Coutant <ccoutant@google.com>
2257
2258 * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2259 debug output when command lines differ.
2260
2261 2011-07-06 Cary Coutant <ccoutant@google.com>
2262
2263 * incremental.cc (Incremental_inputs::report_command_line): Ignore
2264 --incremental-patch option.
2265 * layout.cc (Free_list::allocate): Extend allocation beyond original
2266 end if enabled.
2267 (Layout::make_output_section): Mark sections that should get
2268 patch space.
2269 * options.cc (parse_percent): New function.
2270 * options.h (parse_percent): New function.
2271 (DEFINE_percent): New macro.
2272 (General_options): Add --incremental-patch option.
2273 * output.cc (Output_section::Output_section): Initialize new data
2274 members.
2275 (Output_section::add_input_section): Print section name when out
2276 of patch space.
2277 (Output_section::add_output_section_data): Likewise.
2278 (Output_section::set_final_data_size): Add patch space when
2279 doing --incremental-full.
2280 (Output_section::do_reset_address_and_file_offset): Remove patch
2281 space.
2282 (Output_segment::set_section_list_addresses): Print debug output
2283 only if --incremental-update.
2284 * output.h (Output_section::set_is_patch_space_allowed): New function.
2285 (Output_section::is_patch_space_allowed_): New data member.
2286 (Output_section::patch_space_): New data member.
2287 * parameters.cc (Parameters::incremental_full): New function.
2288 * parameters.h (Parameters::incremental_full): New function
2289 * testsuite/Makefile.am (incremental_test_2): Add test for
2290 --incremental-patch option.
2291 * testsuite/Makefile.in: Regenerate.
2292 * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2293 (t18): Remove function body.
2294
2295 2011-07-05 Doug Kwan <dougkwan@google.com>
2296
2297 PR gold/12771
2298 * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2299 Arm_Address type for relocation result.
2300 (Arm_relocate_functions::abs16): Use unaligned access. Also fix
2301 overflow check.
2302 (Arm_relocate_functions::abs32): Use unaligned access.
2303 (Arm_relocate_functions::rel32): Ditto.
2304 (Arm_relocate_functions::prel31): Ditto.
2305 (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2306 * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2307 static data relocations.
2308 * testsuite/Makefile.in: Regnerate.
2309 * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2310
2311 2011-07-05 Ian Lance Taylor <iant@google.com>
2312
2313 PR gold/12392
2314 * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2315 symbols if necessary.
2316 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2317
2318 2011-07-05 Ian Lance Taylor <iant@google.com>
2319
2320 PR gold/12952
2321 * resolve.cc (Symbol::override_base_with_special): Simply override
2322 version with special symbol version, ignoring previous version.
2323
2324 2011-07-05 Ian Lance Taylor <iant@google.com>
2325
2326 * object.cc (Sized_relobj_file::include_section_group): Add
2327 information to comment about signature location.
2328
2329 2011-07-02 Ian Lance Taylor <iant@google.com>
2330
2331 PR gold/12957
2332 * options.h (class General_options): Add -f and -F.
2333 * options.cc (General_options::finalize): Fatal error if -f/-F
2334 are used without -shared.
2335 * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2336
2337 2011-07-02 Ian Lance Taylor <iant@google.com>
2338
2339 * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2340
2341 2011-07-01 Ian Lance Taylor <iant@google.com>
2342
2343 PR gold/12525
2344 PR gold/12952
2345 * resolve.cc (Symbol::override_base_with_special): Don't override
2346 the version if the overriding symbol has a different name.
2347 * dynobj.cc (Versions::add_def): Add dynpool parameter. Change
2348 all callers. If we give an error about an undefined version,
2349 define the base version if necessary.
2350 * dynobj.h (class Versions): Update declaration.
2351 * testsuite/weak_alias_test_5.cc: New file.
2352 * testsuite/weak_alias_test.script: New file.
2353 * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2354 and versioned_alias have the right value, and call t2.
2355 * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2356 weak_alias_test_5.so.
2357 (weak_alias_test_LDADD): Likewise.
2358 (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2359 * testsuite/Makefile.in: Rebuild.
2360
2361 2011-07-01 Ian Lance Taylor <iant@google.com>
2362
2363 PR gold/12525
2364 * options.h (class General_options): Support -z notext.
2365 * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2366 -Wl,-z,notext.
2367 (two_file_shared_nonpic.so): Likewise.
2368 (two_file_shared_mixed.so): Likewise.
2369 (two_file_shared_mixed_1.so): Likewise.
2370 (weak_undef_lib_nonpic.so): Likewise.
2371 (alt/weak_undef_lib_nonpic.so): Likewise.
2372 (tls_test_shared_nonpic.so): Likewise.
2373 * testsuite/Makefile.in: Rebuild.
2374
2375 2011-07-01 Ian Lance Taylor <iant@google.com>
2376
2377 PR gold/12525
2378 * configure.ac: Test whether static linking works, setting
2379 the automake conditional HAVE_STATIC.
2380 * testsuite/Makefile.am: Disable tests using -static if
2381 HAVE_STATIC is not true.
2382 * configure, testsuite/Makefile.in: Rebuild.
2383
2384 2011-07-01 Ian Lance Taylor <iant@google.com>
2385
2386 PR gold/12525
2387 * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2388 Assert if we see DW_EH_PE_indirect.
2389 * target.h (Target::ehframe_datarel_base): New function.
2390 (Target::do_ehframe_datarel_base): New target function.
2391 * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2392 * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2393 function.
2394
2395 2011-07-01 Ian Lance Taylor <iant@google.com>
2396
2397 PR gold/12571
2398 * options.h (class General_options): Add
2399 --ld-generated-unwind-info.
2400 * ehframe.cc (Fde::write): Add address parameter. Change all
2401 callers. If associated with PLT, fill in address and size.
2402 (Cie::set_output_offset): Only add merge mapping if there is an
2403 object.
2404 (Cie::write): Add address parameter. Change all callers.
2405 (Eh_frame::add_ehframe_for_plt): New function.
2406 * ehframe.h (class Fde): Update declarations. Move shndx_ and
2407 input_offset_ fields into union u_, with new plt field.
2408 (Fde::Fde): Adjust for new union field.
2409 (Fde::Fde) [Output_data version]: New constructor.
2410 (Fde::add_mapping): Only add merge mapping if there is an object.
2411 (class Cie): Update declarations.
2412 (class Eh_frame): Declare add_ehframe_for_plt.
2413 * layout.cc (Layout::layout_eh_frame): Break out code into
2414 make_eh_frame_section, and call it.
2415 (Layout::make_eh_frame_section): New function.
2416 (Layout::add_eh_frame_for_plt): New function.
2417 * layout.h (class Layout): Update declarations.
2418 * merge.cc (Merge_map::add_mapping): Add assertion.
2419 * i386.cc: Include "dwarf.h".
2420 (class Output_data_plt_i386): Make first_plt_entry,
2421 dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const. Add
2422 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2423 and plt_eh_frame_fde.
2424 (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2425 boundary. Call add_eh_frame_for_plt if appropriate.
2426 * x86_64.cc: Include "dwarf.h".
2427 (class Output_data_plt_x86_64): Align to 16-byte boundary. Make
2428 first_plt_entry, plt_entry and tlsdesc_plt_entry const. Add
2429 plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2430 and plt_eh_frame_fde.
2431 (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2432 appropriate.
2433
2434 2011-06-29 Ian Lance Taylor <iant@google.com>
2435
2436 PR gold/12629
2437 * object.cc (Sized_relobj_file::layout_section): Change shdr
2438 parameter to be const.
2439 (Sized_relobj_file::layout_eh_frame_section): New function, broken
2440 out of do_layout.
2441 (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2442 appropriate. Call layout_eh_frame_section.
2443 (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2444 sections.
2445 * object.h (class Sized_relobj_file): Update declarations.
2446
2447 2011-06-29 Ian Lance Taylor <iant@google.com>
2448
2449 PR gold/12652
2450 * script.cc (Token::integer_value): Accept trailing M/m/K/k
2451 modifier.
2452 (Lex::gather_token): Accept trailing M/m/K/k for integers.
2453
2454 2011-06-29 Ian Lance Taylor <iant@google.com>
2455
2456 PR gold/12675
2457 * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2458 SHT_X86_64_UNWIND.
2459 * layout.cc (Layout::layout_eh_frame): Likewise.
2460
2461 2011-06-29 Ian Lance Taylor <iant@google.com>
2462
2463 PR gold/12695
2464 * layout.cc (Layout::symtab_section_shndx): New function.
2465 * layout.h (class Layout): Declare symtab_section_shndx.
2466 * output.cc (Output_section::write_header): Call it.
2467
2468 2011-06-29 Ian Lance Taylor <iant@google.com>
2469
2470 PR gold/12818
2471 * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2472 symbols which are not used in a relocation.
2473
2474 2011-06-28 Ian Lance Taylor <iant@google.com>
2475
2476 PR gold/12898
2477 * layout.cc (Layout::segment_precedes): Don't crash if a linker
2478 script create indistinguishable segments.
2479 (Layout::set_segment_offsets): Use stable_sort when sorting
2480 segments. Pass this to Compare_segments constructor.
2481 * layout.h (class Layout): Make segment_precedes non-static.
2482 (class Compare_segments): Change from struct to class. Add
2483 layout_ field. Add constructor.
2484 * script-sections.cc
2485 (Script_sections::attach_sections_using_phdrs_clause): Rename
2486 local orphan to is_orphan. Don't report failure to put empty
2487 section in segment. On attachment failure, report name of
2488 section, and attach to first PT_LOAD segment.
2489
2490 2011-06-28 Ian Lance Taylor <iant@google.com>
2491
2492 PR gold/12934
2493 * target-select.cc (Target_selector::Target_selector): Add
2494 emulation parameter. Change all callers.
2495 (select_target_by_bfd_name): Rename from select_target_by_name.
2496 Change all callers.
2497 (select_target_by_emulation): New function.
2498 (supported_emulation_names): New function.
2499 * target-select.h (class Target_selector): Add emulation_ field.
2500 Update declarations.
2501 (Target_selector::recognize_by_bfd_name): Rename from
2502 recognize_by_name. Change all callers.
2503 (Target_selector::supported_bfd_names): Rename from
2504 supported_names. Change all callers.
2505 (Target_selector::recognize_by_emulation): New function.
2506 (Target_selector::supported_emulations): New function.
2507 (Target_selector::emulation): New function.
2508 (Target_selector::do_recognize_by_bfd_name): Rename from
2509 do_recognize_by_name. Change all callers.
2510 (Target_selector::do_supported_bfd_names): Rename from
2511 do_supported_names. Change all callers.
2512 (Target_selector::do_recognize_by_emulation): New function.
2513 (Target_selector::do_supported_emulations): New function.
2514 (select_target_by_bfd_name): Change name in declaration.
2515 (select_target_by_emulation): Declare.
2516 (supported_emulation_names): Declare.
2517 * parameters.cc (parameters_force_valid_target): Try to find
2518 target based on emulation from -m option.
2519 * options.h (class General_options): Change doc string for -m.
2520 * options.cc (help): Print emulations.
2521 (General_options::parse_V): Likewise.
2522 * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2523 Add emulation parameter. Change all callers.
2524
2525 2011-06-28 Ian Lance Taylor <iant@google.com>
2526
2527 * target.h (class Target): Add osabi_ field.
2528 (Target::osabi): New function.
2529 (Target::set_osabi): New function.
2530 (Target::Target): Initialize osabi_.
2531 (Target::do_adjust_elf_header): Make pure virtual.
2532 (Sized_target::do_adjust_elf_header): Declare.
2533 * target.cc (Sized_target::do_adjust_elf_header): New function.
2534 (class Sized_target): Instantiate all versions.
2535 * freebsd.h (class Target_freebsd): Remove.
2536 (Target_selector_freebsd::do_recognize): Call set_osabi on
2537 Target.
2538 (Target_selector_freebsd::do_recognize_by_name): Likewise.
2539 (Target_selector_freebsd::set_osabi): Remove.
2540 * i386.cc (class Target_i386): Inherit from Sized_target rather
2541 than Target_freebsd.
2542 * x86_64.cc (class Target_x86_64): Likewise.
2543
2544 2011-06-28 Ian Lance Taylor <iant@google.com>
2545
2546 * target.h (Target::can_check_for_function_pointers): Rewrite.
2547 Make non-virtual.
2548 (Target::can_icf_inline_merge_sections): Likewise.
2549 (Target::section_may_have_icf_unsafe_poineters): Likewise.
2550 (Target::Target_info): Add can_icf_inline_merge_sections field.
2551 (Target::do_can_check_for_function_pointers): New virtual
2552 function.
2553 (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2554 * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2555 from can_check_for_function_pointers, move in file.
2556 (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2557 section_may_have_icf_unsafe_poineters, move in file.
2558 (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2559 * i386.cc (Target_i386::do_can_check_for_function_pointers):
2560 Rename from can_check_for_function_pointers, move in file.
2561 (Target_i386::can_icf_inline_merge_sections): Remove.
2562 (Target_i386::i386_info): Initialize
2563 can_icf_inline_merge_sections.
2564 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2565 Initialize can_icf_inline_merge_sections.
2566 * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2567 * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2568 Rename from can_check_for_function_pointers, move in file.
2569 (Target_x86_64::can_icf_inline_merge_sections): Remove.
2570 (Target_x86_64::x86_64_info): Initialize
2571 can_icf_inline_merge_sections.
2572 * testsuite/testfile.cc (Target_test::test_target_info):
2573 Likewise.
2574 * icf.cc (get_section_contents): Correct formatting.
2575
2576 2011-06-27 Ian Lance Taylor <iant@google.com>
2577
2578 * symtab.cc (Symbol::versioned_name): New function.
2579 (Symbol_table::add_to_final_symtab): Use versioned_name when
2580 appropriate.
2581 (Symbol_table::sized_write_symbol): Likewise.
2582 * symtab.h (class Symbol): Declare versioned_name.
2583 * stringpool.h (class Stringpool_template): Add variant of add
2584 which takes a std::basic_string.
2585 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2586 (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2587 (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2588 (ver_test_12.o): New target.
2589 * testsuite/Makefile.in: Rebuild.
2590
2591 2011-06-27 Doug Kwan <dougkwan@google.com>
2592
2593 * arm.cc (Arm_relocate_functions::thm_jump8,
2594 Arm_relocate_functions::thm_jump11): Use a wider signed
2595 type to compute offset.
2596 * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2597 arm_thm_jump8.
2598 * testsuite/Makefile.in: Regenerate.
2599 * testsuite/arm_branch_in_range.sh: Check test results of
2600 arm_thm_jump11 and arm_thm_jump8.
2601 * testsuite/arm_thm_jump11.s: New test source file.
2602 * testsuite/arm_thm_jump11.t: New linker script.
2603 * testsuite/arm_thm_jump8.s: New test source file.
2604 * testsuite/arm_thm_jump8.t: New linker script.
2605
2606 2011-06-24 Ian Lance Taylor <iant@google.com>
2607
2608 * layout.cc: Include "object.h".
2609 (ctors_sections_in_init_array): New static variable.
2610 (Layout::is_ctors_in_init_array): New function.
2611 (Layout::layout): Add entry to ctors_sections_in_init_array if
2612 appropriate.
2613 * layout.h (class Layout): Declare is_ctors_in_init_array.
2614 * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2615 is_ctors_reverse_view is set.
2616 (Sized_relobj_file::write_sections): Add layout parameter. Change
2617 all callers. Set is_ctors_reverse_view field of View_size.
2618 (Sized_relobj_file::reverse_words): New function.
2619 * object.h (Sized_relobj_file::View_size): Add
2620 is_ctors_reverse_view field.
2621 (class Sized_relobj_file): Update declarations.
2622 * testsuite/initpri3.c: New test.
2623 * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2624 initpri3b.
2625 (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2626 (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2627 (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2628 (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2629 * testsuite/Makefile.in: Rebuild.
2630
2631 2011-06-24 Cary Coutant <ccoutant@google.com>
2632
2633 * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2634 (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2635 (debug_msg_cdebug.err): New targets.
2636 * testsuite/Makefile.in: Regenerate.
2637 * testsuite/debug_msg.sh: Check output of link with compressed debug.
2638 Fix checks for link with shared library.
2639
2640 2011-06-24 Doug Kwan <dougkwan@google.com>
2641
2642 * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2643 skip empty text sections.
2644 * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2645
2646 2011-06-22 Ian Lance Taylor <iant@google.com>
2647
2648 PR gold/12910
2649 * options.h (class General_options): Add --ctors-in-init-array.
2650 * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2651 friends as SHT_PROGBITS for merging sections.
2652 (Layout::layout): Remove special handling of .init_array and
2653 friends. Don't sort if doing relocatable link. Sort for .ctors
2654 and .dtors if ctors_in_init_array.
2655 (Layout::make_output_section): Force correct section types for
2656 .init_array and friends. Don't sort if doing relocatable link,
2657 Don't sort .ctors and .dtors if ctors_in_init_array.
2658 (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2659 (Layout::output_section_name): Add relobj parameter. Change all
2660 callers. Handle .ctors. and .dtors. in code rather than table.
2661 Handle .ctors and .dtors if ctors_in_init_array.
2662 (Layout::match_file_name): New function, moved from output.cc.
2663 * layout.h (class Layout): Update declarations.
2664 * output.cc: Include "layout.h".
2665 (Input_section_sort_entry::get_priority): New function.
2666 (Input_section_sort_entry::match_file_name): Just call
2667 Layout::match_file_name.
2668 (Output_section::Input_section_sort_init_fini_compare::operator()):
2669 Handle .ctors and .dtors. Sort by explicit priority rather than
2670 by name.
2671 * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2672 * testsuite/initpri2.c: New test.
2673 * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2674 (check_PROGRAMS): Add initpri2.
2675 (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2676 (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2677 * configure, testsuite/Makefile.in: Rebuild.
2678
2679 2011-06-19 Ian Lance Taylor <iant@google.com>
2680
2681 PR gold/12880
2682 * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2683 .interp section to a PT_INTERP segment even if we have seen a
2684 --dynamic-linker option. Don't do it if we have seen a PHDRS
2685 clause in a linker script.
2686 (Layout::finalize): Don't create a .interp section if we've
2687 already create a PT_INTERP segment.
2688 (Layout::create_interp): Always call choose_output_section (revert
2689 patch of 2011-06-17). Don't create PT_INTERP segment.
2690 * script-sections.cc
2691 (Script_sections::create_note_and_tls_segments): Add a .interp
2692 section to a PT_INTERP segment even if we have seen a
2693 --dynamic-linker option.
2694
2695 2011-06-18 Ian Lance Taylor <iant@google.com>
2696
2697 * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2698 merely because a non-PT_LOAD segment has a dynamic reloc.
2699
2700 2011-06-18 Ian Lance Taylor <iant@google.com>
2701
2702 * layout.cc (Layout::finish_dynamic_section): Don't create
2703 DT_FLAGS entry if not needed.
2704
2705 2011-06-18 Ian Lance Taylor <iant@google.com>
2706
2707 PR gold/12745
2708 * layout.cc (Layout::layout_eh_frame): Correct handling of
2709 writable .eh_frame section.
2710
2711 2011-06-17 Ian Lance Taylor <iant@google.com>
2712
2713 PR gold/12893
2714 * resolve.cc (Symbol_table::resolve): Don't give an error if a
2715 symbol is redefined with the exact same object and value.
2716
2717 2011-06-17 Ian Lance Taylor <iant@google.com>
2718
2719 PR gold/12880
2720 * layout.h (class Layout): Add interp_segment_ field.
2721 * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2722 (Layout::attach_allocated_section_to_segment): If making shared
2723 library, put .interp section in PT_INTERP segment.
2724 (Layout::finalize): Also call create_interp if -dynamic-linker
2725 option was used.
2726 (Layout::create_interp): Assert that there is no PT_INTERP
2727 segment. If not using a SECTIONS clause, use make_output_section.
2728 (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2729 * script-sections.cc
2730 (Script_sections::create_note_and_tls_segments): If making shared
2731 library, put .interp section in PT_INTERP segment.
2732
2733 2011-06-17 Ian Lance Taylor <iant@google.com>
2734
2735 * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2736 when making a shared library.
2737
2738 2011-06-17 Ian Lance Taylor <iant@google.com>
2739
2740 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2741 parameter. Change all callers. Don't issue warning about PC32
2742 against locally defined symbol.
2743
2744 2011-06-16 Ian Lance Taylor <iant@google.com>
2745
2746 * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2747 occurs in same object.
2748
2749 2011-06-14 Alan Modra <amodra@gmail.com>
2750
2751 * po/POTFILES.in: Regenerate.
2752
2753 2011-06-09 Ian Lance Taylor <iant@google.com>
2754
2755 * script-sections.cc
2756 (Orphan_output_section::set_section_addresses): For a relocatable
2757 link set address to 0.
2758
2759 2011-06-09 Cary Coutant <ccoutant@google.com>
2760
2761 PR gold/12804
2762 * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2763 used with --compress-debug-sections.
2764 * gold/object.cc (Sized_relobj_file::do_layout): Report
2765 uncompressed size of compressed input sections.
2766
2767 2011-06-08 Cary Coutant <ccoutant@google.com>
2768
2769 PR gold/12804
2770 * testsuite/two_file_test_2_v1.cc: Change initialization of
2771 v2 to keep it in .data.
2772
2773 2011-06-07 Cary Coutant <ccoutant@google.com>
2774
2775 * common.cc (Symbol_table::do_allocate_commons_list): Call
2776 gold_fallback.
2777 * errors.cc (Errors::fatal): Adjust call to gold_exit.
2778 (Errors::fallback): New function.
2779 (gold_fallback): New function.
2780 * errors.h (Errors::fallback): New function.
2781 * gold.cc (gold_exit): Change status parameter to enum; adjust
2782 all callers.
2783 (queue_initial_tasks): Call gold_fallback.
2784 * gold.h: Include cstdlib.
2785 (Exit_status): New enum type.
2786 (gold_exit): Change status parameter to enum.
2787 (gold_fallback): New function.
2788 * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2789 (Layout::create_symtab_sections): Likewise.
2790 (Layout::create_shdrs): Likewise.
2791 * main.cc (main): Adjust call to gold_exit.
2792 * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2793 (Output_data_got::add_got_entry_pair): Likewise.
2794 (Output_section::add_input_section): Likewise.
2795 (Output_section::add_output_section_data): Likewise.
2796 (Output_segment::set_section_list_addresses): Likewise.
2797 * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2798
2799 2011-06-07 Cary Coutant <ccoutant@google.com>
2800
2801 * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2802 for incremental links.
2803 * output.cc (Output_segment::set_section_list_addresses): Remove
2804 FIXME and test for TLS or BSS.
2805
2806 2011-06-07 Cary Coutant <ccoutant@google.com>
2807
2808 * testsuite/Makefile.am: Add incremental_copy_test,
2809 incremental_common_test_1.
2810 * testsuite/Makefile.in: Regenerate.
2811 * testsuite/common_test_1_v1.c: New source file.
2812 * testsuite/common_test_1_v2.c: New source file.
2813 * testsuite/copy_test_v1.cc: New source file.
2814
2815 2011-06-07 Cary Coutant <ccoutant@google.com>
2816
2817 * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2818 update, allocate common from bss section's free list.
2819 * incremental-dump.cc (dump_incremental_inputs): Print flag for
2820 linker-defined symbols.
2821 * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2822 Skip GOT and PLT entries that are no longer referenced.
2823 (Output_section_incremental_inputs::write_info_blocks): Mark
2824 linker-defined symbols.
2825 (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2826 * output.cc (Output_section::allocate): New function.
2827 * output.h (Output_section::allocate): New function.
2828 * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2829 linker-defined symbols.
2830 (Symbol::override_base_with_special): Copy is_predefined_ flag.
2831 * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2832 (Symbol::init_base_output_data): Likewise.
2833 (Symbol::init_base_output_segment): Likewise.
2834 (Symbol::init_base_constant): Likewise.
2835 (Sized_symbol::init_output_data): Likewise.
2836 (Sized_symbol::init_output_segment): Likewise.
2837 (Sized_symbol::init_constant): Likewise.
2838 (Symbol_table::do_define_in_output_data): Likewise.
2839 (Symbol_table::do_define_in_output_segment): Likewise.
2840 (Symbol_table::do_define_as_constant): Likewise.
2841 * symtab.h (Symbol::is_predefined): New function.
2842 (Symbol::init_base_output_data): Add is_predefined parameter.
2843 (Symbol::init_base_output_segment): Likewise.
2844 (Symbol::init_base_constant): Likewise.
2845 (Symbol::is_predefined_): New data member.
2846 (Sized_symbol::init_output_data): Add is_predefined parameter.
2847 (Sized_symbol::init_output_segment): Likewise.
2848 (Sized_symbol::init_constant): Likewise.
2849 (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2850
2851 2011-06-07 Cary Coutant <ccoutant@google.com>
2852
2853 * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2854 instead of emit_copy_reloc.
2855 (Copy_relocs::emit_copy_reloc): Refactor.
2856 (Copy_relocs::make_copy_reloc): New function.
2857 (Copy_relocs::add_copy_reloc): Remove.
2858 * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2859 section.
2860 (Copy_relocs::make_copy_reloc): New function.
2861 (Copy_relocs::add_copy_reloc): Remove.
2862 * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2863 unchanged input files.
2864 * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2865 * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2866 Reserve BSS space for COPY relocations.
2867 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2868 (Output_section_incremental_inputs::write_info_blocks): Record
2869 whether a symbol is copied from a shared object.
2870 (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2871 * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2872 (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2873 (Incremental_input_entry_reader::get_output_symbol_index): Add
2874 is_copy parameter.
2875 (Incremental_binary::emit_copy_relocs): New function.
2876 (Incremental_binary::do_emit_copy_relocs): New function.
2877 (Sized_incremental_binary::Sized_incremental_binary): Initialize
2878 new data member.
2879 (Sized_incremental_binary::add_copy_reloc): New function.
2880 (Sized_incremental_binary::do_emit_copy_relocs): New function.
2881 (Sized_incremental_binary::Copy_reloc): New struct.
2882 (Sized_incremental_binary::Copy_relocs): New typedef.
2883 (Sized_incremental_binary::copy_relocs_): New data member.
2884 * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2885 * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2886 * target.h (Sized_target::emit_copy_reloc): New function.
2887 * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2888
2889 2011-06-02 Cary Coutant <ccoutant@google.com>
2890
2891 PR gold/12163
2892 * gold/archive.cc (Archive::Archive): Initialize new data member.
2893 (Archive::include_all_members): Return if archive has already been
2894 included.
2895 * gold/archive.h (Archive::include_all_members_): New data member.
2896
2897 2011-06-02 Nick Clifton <nickc@redhat.com>
2898
2899 * dynobj.h: Fix spelling mistake in comment.
2900 * output.cc: Likewise.
2901
2902 2011-05-31 Doug Kwan <dougkwan@google.com>
2903 Asier Llano
2904
2905 PR gold/12826
2906 * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2907 arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2908 * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up. Remove
2909 redundant arm_exidx_test.so.
2910 * testsuite/Makefile.in: Regenerate.
2911 (check_SCRIPTS): Add pr12826.sh
2912 (check_DATA): Add pr12826.stdout
2913 (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2914 * testsuite/pr12826.sh: New file.
2915 * testsuite/pr12826_1.s: Ditto.
2916 * testsuite/pr12826_1.s: Ditto.
2917
2918 2011-05-30 Ian Lance Taylor <iant@google.com>
2919
2920 * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2921 sections.
2922
2923 2011-05-29 Ian Lance Taylor <iant@google.com>
2924
2925 PR gold/12804
2926 * testsuite/Makefile.am: Use different file name for two_file_test
2927 temporary file for each incremental test.
2928 * testsuite/Makefile.in: Rebuild.
2929
2930 2011-05-29 Ian Lance Taylor <iant@google.com>
2931
2932 * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2933 binary input file is empty.
2934
2935 2011-05-27 Ian Lance Taylor <iant@google.com>
2936
2937 * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2938 (ver_test_9.so): Likewise.
2939 * testsuite/Makefile.in: Rebuild.
2940
2941 2011-05-26 Cary Coutant <ccoutant@google.com>
2942
2943 * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2944 * incremental.cc (Incremental_inputs::report_input_section): Fix
2945 comment, indentation.
2946 (Incremental_inputs::report_comdat_group): New function.
2947 (Output_section_incremental_inputs::set_final_data_size): Adjust size
2948 of data for incremental input file entry.
2949 (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2950 group count, COMDAT group signatures.
2951 (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2952 an unchanged input file.
2953 * incremental.h (Incremental_object_entry::Incremental_object_entry):
2954 Initialize new data member.
2955 (Incremental_object_entry::add_comdat_group): New function.
2956 (Incremental_object_entry::get_comdat_group_count): New function.
2957 (Incremental_object_entry::get_comdat_signature_key): New function.
2958 (Incremental_object_entry::groups_): New data member.
2959 (Incremental_inputs::report_comdat_group): New function.
2960 (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2961 data for incremental input file entry.
2962 (Incremental_input_entry_reader::get_comdat_group_count): New function.
2963 (Incremental_input_entry_reader::get_input_section): Adjust size of
2964 data for incremental input file entry.
2965 (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2966 (Incremental_input_entry_reader::get_comdat_group_signature): New
2967 function.
2968 * object.cc (Sized_relobj::include_section_group): Report kept
2969 COMDAT groups for incremental links.
2970
2971 2011-05-24 David Meyer <pdox@google.com>
2972
2973 * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2974 with name parameter. Add found_name parameter.
2975 * fileread.cc (Input_file::find_file): Adjust code accordingly.
2976 * dirsearch.h (class Dirsearch): Update declaration.
2977
2978 2011-05-24 Ian Lance Taylor <iant@google.com>
2979
2980 * archive.cc (Library_base::should_include_member): Pull in object
2981 from archive if it defines the entry symbol.
2982 * parameters.cc (Parameters::entry): New function.
2983 * parameters.h (class Parameters): Declare entry.
2984 * output.h (class Output_file_header): Remove entry_ field.
2985 * output.cc (Output_file_header::Output_file_header): Remove entry
2986 parameter. Change all callers.
2987 (Output_file_header::entry): Use parameters->entry.
2988 * gold.cc (queue_middle_tasks): Likewise.
2989 * plugin.cc (Plugin_hook::run): Likewise.
2990
2991 2011-05-24 Cary Coutant <ccoutant@google.com>
2992
2993 * gold.cc (queue_initial_tasks): Pass incremental base filename
2994 to Output_file::open_base_file; don't print error message.
2995 * incremental-dump.cc (main): Adjust call to
2996 Output_file::open_for_modification.
2997 * incremental-dump.cc (main): Likewise.
2998 * incremental.cc (Incremental_inputs::report_command_line):
2999 Ignore --incremental-base option when comparing command lines.
3000 Ignore parameter when given as separate argument.
3001 * options.h (class General_options): Add --incremental-base.
3002 * output.cc (Output_file::Output_file):
3003 (Output_file::open_base_file): Add base_name and writable parameters;
3004 read base file into new file; print error message here.
3005 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3006 callers.
3007 * output.h (Output_file::open_for_modification): Rename to...
3008 (Output_file::open_base_file): ...this; add base_name and
3009 writable parameters; adjust all callers.
3010 (Output_file::map_no_anonymous): Add writable parameter; adjust all
3011 callers.
3012 * testsuite/Makefile.am (incremental_test_4): Test
3013 --incremental-base.
3014 * testsuite/Makefile.in: Regenerate.
3015
3016 2011-05-24 Cary Coutant <ccoutant@google.com>
3017
3018 * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3019 incremental_test_4.
3020 * testsuite/Makefile.in: Regenerate.
3021 * testsuite/two_file_test_1_v1.cc: New test source file.
3022 * testsuite/two_file_test_1b_v1.cc: New test source file.
3023 * testsuite/two_file_test_2_v1.cc: New test source file.
3024
3025 2011-05-24 Cary Coutant <ccoutant@google.com>
3026
3027 * dynobj.h (Dynobj::do_dynobj): New function.
3028 * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3029 flag and soname for shared objects.
3030 * incremental.cc (Incremental_inputs::report_object): Make
3031 either Incremental_object_entry or Incremental_dynobj_entry; add
3032 soname to string table.
3033 (Incremental_inputs::report_input_section): Add assertion.
3034 (Output_section_incremental_inputs::set_final_data_size): Adjust
3035 type of input file entry for shared libraries; adjust size of
3036 shared library info entry.
3037 (Output_section_incremental_inputs::write_input_files): Write
3038 as_needed flag for shared libraries.
3039 (Output_section_incremental_inputs::write_info_blocks): Adjust type
3040 of input file entry for shared libraries; write soname.
3041 (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3042 soname from incremental info.
3043 * incremental.h (enum Incremental_input_flags): Add
3044 INCREMENTAL_INPUT_AS_NEEDED.
3045 (Incremental_input_entry::Incremental_input_entry): Initialize new
3046 data member.
3047 (Incremental_input_entry::set_as_needed): New function.
3048 (Incremental_input_entry::as_needed): New function.
3049 (Incremental_input_entry::do_dynobj_entry): New function.
3050 (Incremental_input_entry::as_needed_): New data member.
3051 (Incremental_object_entry::Incremental_object_entry): Don't check
3052 for shared library.
3053 (Incremental_object_entry::do_type): Likewise.
3054 (class Incremental_dynobj_entry): New class.
3055 (Incremental_input_entry_reader::as_needed): New function.
3056 (Incremental_input_entry_reader::get_soname): New function.
3057 (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3058 (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3059 size of shared library info entry.
3060 * layout.cc (Layout::finish_dynamic_section): Don't test for
3061 incremental link when adding DT_NEEDED entries.
3062 * object.h (Object::Object): Initialize new data member.
3063 (Object::dynobj): New function.
3064 (Object::set_as_needed): New function.
3065 (Object::as_needed): New function.
3066 (Object::do_dynobj): New function.
3067 (Object::as_needed_): New data member.
3068
3069 2011-05-24 Cary Coutant <ccoutant@google.com>
3070
3071 * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3072 info; adjust display of GOT entries.
3073 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3074 vector of input objects; remove file_status_.
3075 (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3076 (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3077 got_plt reader; call target hooks to reserve GOT entries.
3078 (Output_section_incremental_inputs::set_final_data_size): Adjust size
3079 of input file info header and GOT info entry.
3080 (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3081 relocation info.
3082 (Got_plt_view_info::got_descriptor): Remove.
3083 (Got_plt_view_info::sym_index): New data member.
3084 (Got_plt_view_info::input_index): New data member.
3085 (Local_got_offset_visitor::visit): Write input file index.
3086 (Global_got_offset_visitor::visit): Write 0 for input file index.
3087 (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3088 with sym_index and input_index.
3089 (Output_section_incremental_inputs::write_got_plt): Adjust size of
3090 incremental info GOT entry; replace got_descriptor with input_index.
3091 (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3092 map from input file index to object.
3093 (Sized_relobj_incr::do_layout): Replace direct data member reference
3094 with accessor function.
3095 (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3096 * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3097 Adjust size of input file info header.
3098 (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3099 (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3100 (Incremental_input_entry_reader::get_input_section): Adjust size of
3101 input file info header.
3102 (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3103 of incremental info GOT entry.
3104 (Incremental_got_plt_reader::get_got_desc): Remove.
3105 (Incremental_got_plt_reader::get_got_symndx): New function.
3106 (Incremental_got_plt_reader::get_got_input_index): New function.
3107 (Sized_incremental_binary::Sized_incremental_binary): Remove
3108 file_status_; add input_objects_.
3109 (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3110 (Sized_incremental_binary::set_file_is_unchanged): Remove.
3111 (Sized_incremental_binary::file_is_unchanged): Remove.
3112 (Sized_incremental_binary::set_input_object): New function.
3113 (Sized_incremental_binary::input_object): New function.
3114 (Sized_incremental_binary::file_status_): Remove.
3115 (Sized_incremental_binary::input_objects_): New data member.
3116 (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3117 references.
3118 (Sized_relobj_incr::invalid_address): Move to base class.
3119 (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3120 class.
3121 (Sized_relobj_incr::do_output_section_offset): Likewise.
3122 (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3123 (Sized_relobj_incr::section_offsets_): Likewise.
3124 * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3125 function.
3126 (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3127 (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3128 with accessor function.
3129 (Sized_relobj_file::do_layout): Likewise.
3130 (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3131 (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3132 (Sized_relobj_file::compute_final_local_value): Replace refs to
3133 section_offsets_ with accessor function.
3134 (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3135 * object.h (Relobj::Relobj): Initialize new data members.
3136 (Relobj::add_dyn_reloc): New function.
3137 (Relobj::first_dyn_reloc): New function.
3138 (Relobj::dyn_reloc_count): New function.
3139 (Relobj::first_dyn_reloc_): New data member.
3140 (Relobj::dyn_reloc_count_): New data member.
3141 (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3142 references.
3143 (Sized_relobj::Address): New typedef.
3144 (Sized_relobj::invalid_address): Move here from child class.
3145 (Sized_relobj::Sized_relobj): Initialize new data members.
3146 (Sized_relobj::sized_relobj): New function.
3147 (Sized_relobj::is_output_section_offset_invalid): Move here from
3148 child class.
3149 (Sized_relobj::get_output_section_offset): Likewise.
3150 (Sized_relobj::local_has_got_offset): Likewise.
3151 (Sized_relobj::local_got_offset): Likewise.
3152 (Sized_relobj::set_local_got_offset): Likewise.
3153 (Sized_relobj::do_for_all_local_got_entries): Likewise.
3154 (Sized_relobj::clear_got_offsets): New function.
3155 (Sized_relobj::section_offsets): Move here from child class.
3156 (Sized_relobj::do_output_section_offset): Likewise.
3157 (Sized_relobj::do_set_section_offset): Likewise.
3158 (Sized_relobj::Local_got_offsets): Likewise.
3159 (Sized_relobj::local_got_offsets_): Likewise.
3160 (Sized_relobj::section_offsets_): Likewise.
3161 (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3162 references.
3163 (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3164 class.
3165 (Sized_relobj_file::sized_relobj): New function
3166 (Sized_relobj_file::local_has_got_offset): Move to base class.
3167 (Sized_relobj_file::local_got_offset): Likewise.
3168 (Sized_relobj_file::set_local_got_offset): Likewise.
3169 (Sized_relobj_file::get_output_section_offset): Likewise.
3170 (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3171 (Sized_relobj_file::do_output_section_offset): Likewise.
3172 (Sized_relobj_file::do_set_section_offset): Likewise.
3173 (Sized_relobj_file::Local_got_offsets): Likewise.
3174 (Sized_relobj_file::local_got_offsets_): Likewise.
3175 (Sized_relobj_file::section_offsets_): Likewise.
3176 * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3177 (all constructors).
3178 (set_needs_dynsym_index): Convert relobj to derived class pointer.
3179 (Output_reloc::get_symbol_index): Likewise.
3180 (Output_reloc::local_section_offset): Likewise.
3181 (Output_reloc::get_address): Likewise.
3182 (Output_reloc::symbol_value): Likewise.
3183 (Output_data_got::reserve_slot): Move to class definition.
3184 (Output_data_got::reserve_local): New function.
3185 (Output_data_got::reserve_slot_for_global): Remove.
3186 (Output_data_got::reserve_global): New function.
3187 * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3188 (all constructors, two instantiations).
3189 (Output_reloc::get_relobj): New function (two instantiations).
3190 (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3191 (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3192 (Output_data_reloc::add_global): Adjust type of relobj.
3193 (Output_data_reloc::add_global_relative): Likewise.
3194 (Output_data_reloc::add_symbolless_global_addend): Likewise.
3195 (Output_data_reloc::add_local): Likewise.
3196 (Output_data_reloc::add_local_relative): Likewise.
3197 (Output_data_reloc::add_symbolless_local_addend): Likewise.
3198 (Output_data_reloc::add_local_section): Likewise.
3199 (Output_data_reloc::add_output_section): Likewise.
3200 (Output_data_reloc::add_absolute): Likewise.
3201 (Output_data_reloc::add_target_specific): Likewise.
3202 (Output_data_got::reserve_slot): Move definition here.
3203 (Output_data_got::reserve_local): New function.
3204 (Output_data_got::reserve_global): New function.
3205 * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3206 section_offsets_ with accessor function.
3207 (Sized_relobj_file::write_sections): Likewise.
3208 (Sized_relobj_file::do_relocate_sections): Likewise.
3209 * target.h (Sized_target::reserve_local_got_entry): New function.
3210 (Sized_target::reserve_global_got_entry): New function.
3211 * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3212 (Target_x86_64::reserve_global_got_entry): New function.
3213 (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3214
3215 2011-05-23 Cary Coutant <ccoutant@google.com>
3216
3217 * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3218 * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3219 bit when checking got_type.
3220 * incremental.cc (Sized_incremental_binary::setup_readers):
3221 Store symbol table and string table locations; initialize bit vector
3222 of file status flags.
3223 (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3224 unchanged files.
3225 (Sized_incremental_binary::do_process_got_plt): New function.
3226 (Sized_incremental_binary::get_symtab_view): Use stored locations.
3227 (Output_section_incremental_inputs::set_final_data_size): Record
3228 file index for each input file.
3229 (Output_section_incremental_inputs::write_got_plt): Store file index
3230 instead of input entry offset for each GOT entry.
3231 * incremental.h
3232 (Incremental_input_entry::Incremental_input_entry): Initialize new
3233 data member.
3234 (Incremental_input_entry::set_offset): Store file index.
3235 (Incremental_input_entry::get_file_index): New function.
3236 (Incremental_input_entry::file_index_): New data member.
3237 (Incremental_binary::process_got_plt): New function.
3238 (Incremental_binary::do_process_got_plt): New function.
3239 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3240 data members.
3241 (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3242 (Sized_incremental_binary::set_file_is_unchanged): New function.
3243 (Sized_incremental_binary::file_is_unchanged): New function.
3244 (Sized_incremental_binary::do_process_got_plt): New function.
3245 (Sized_incremental_binary::file_status_): New data member.
3246 (Sized_incremental_binary::main_symtab_loc_): New data member.
3247 (Sized_incremental_binary::main_strtab_loc_): New data member.
3248 * output.cc (Output_data_got::Got_entry::write): Add case
3249 RESERVED_CODE.
3250 (Output_data_got::add_global): Call add_got_entry.
3251 (Output_data_got::add_global_plt): Likewise.
3252 (Output_data_got::add_global_with_rel): Likewise.
3253 (Output_data_got::add_global_with_rela): Likewise.
3254 (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3255 (Output_data_got::add_global_pair_with_rela): Likewise.
3256 (Output_data_got::add_local): Call add_got_entry.
3257 (Output_data_got::add_local_plt): Likewise.
3258 (Output_data_got::add_local_with_rel): Likewise.
3259 (Output_data_got::add_local_with_rela): Likewise.
3260 (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3261 (Output_data_got::add_local_pair_with_rela): Likewise.
3262 (Output_data_got::reserve_slot): New function.
3263 (Output_data_got::reserve_slot_for_global): New function.
3264 (Output_data_got::add_got_entry): New function.
3265 (Output_data_got::add_got_entry_pair): New function.
3266 (Output_section::add_output_section_data): Edit FIXME.
3267 * output.h
3268 (Output_section_data_build::Output_section_data_build): New
3269 constructor with size parameter.
3270 (Output_data_space::Output_data_space): Likewise.
3271 (Output_data_got::Output_data_got): Initialize new data member; new
3272 constructor with size parameter.
3273 (Output_data_got::add_constant): Call add_got_entry.
3274 (Output_data_got::reserve_slot): New function.
3275 (Output_data_got::reserve_slot_for_global): New function.
3276 (class Output_data_got::Got_entry): Add RESERVED_CODE.
3277 (Output_data_got::add_got_entry): New function.
3278 (Output_data_got::add_got_entry_pair): New function.
3279 (Output_data_got::free_list_): New data member.
3280 * target.h (Sized_target::init_got_plt_for_update): New function.
3281 (Sized_target::register_global_plt_entry): New function.
3282 * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3283 Initialize new data member; call init; add constructor with PLT count.
3284 (Output_data_plt_x86_64::init): New function.
3285 (Output_data_plt_x86_64::add_relocation): New function.
3286 (Output_data_plt_x86_64::reserve_slot): New function.
3287 (Output_data_plt_x86_64::free_list_): New data member.
3288 (Target_x86_64::init_got_plt_for_update): New function.
3289 (Target_x86_64::register_global_plt_entry): New function.
3290 (Output_data_plt_x86_64::add_entry): Allocate from free list for
3291 incremental updates.
3292 (Output_data_plt_x86_64::add_relocation): New function.
3293 * testsuite/object_unittest.cc (Object_test): Set default options.
3294
3295 2011-05-16 Ian Lance Taylor <iant@google.com>
3296
3297 * options.h (class General_options): Make -i a synonym for -r.
3298
3299 2011-05-16 Ian Lance Taylor <iant@google.com>
3300
3301 * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3302
3303 2011-05-10 Cary Coutant <ccoutant@google.com>
3304
3305 * object.cc (Sized_relobj::do_count_local_symbols): Check for
3306 strip_all (-s).
3307
3308 2011-05-06 Ian Lance Taylor <iant@google.com>
3309
3310 * layout.cc (Layout::layout): If the output section flags change,
3311 update the ordering.
3312
3313 2011-04-25 Cary Coutant <ccoutant@google.com>
3314
3315 * incremental-dump.cc (dump_incremental_inputs): Print local
3316 symbol info for each input file.
3317 * incremental.cc
3318 (Output_section_incremental_inputs::set_final_data_size): Add local
3319 symbol info to input file entries in incremental info.
3320 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3321 (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3322 (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3323 (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3324 implementation.
3325 (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3326 (Sized_incr_relobj::do_relocate): Write the local symbols.
3327 (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3328 * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3329 Adjust size of input file header.
3330 (Incremental_inputs_reader::get_local_symbol_offset): New function.
3331 (Incremental_inputs_reader::get_local_symbol_count): New function.
3332 (Incremental_inputs_reader::get_input_section): Adjust size of input
3333 file header.
3334 (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3335 (Sized_incr_relobj::This): New typedef.
3336 (Sized_incr_relobj::sym_size): New const data member.
3337 (Sized_incr_relobj::Local_symbol): New struct.
3338 (Sized_incr_relobj::do_output_local_symbol_count): New function.
3339 (Sized_incr_relobj::do_local_symbol_offset): New function.
3340 (Sized_incr_relobj::local_symbol_count_): New data member.
3341 (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3342 (Sized_incr_relobj::local_symbol_index_): New data member.
3343 (Sized_incr_relobj::local_symbol_offset_): New data member.
3344 (Sized_incr_relobj::local_dynsym_offset_): New data member.
3345 (Sized_incr_relobj::local_symbols_): New data member.
3346 * object.h (Relobj::output_local_symbol_count): New function.
3347 (Relobj::local_symbol_offset): New function.
3348 (Relobj::do_output_local_symbol_count): New function.
3349 (Relobj::do_local_symbol_offset): New function.
3350 (Sized_relobj::do_output_local_symbol_count): New function.
3351 (Sized_relobj::do_local_symbol_offset): New function.
3352
3353 2011-04-22 Vladimir Simonov <sv@sw.ru>
3354
3355 * descriptors.cc (set_close_on_exec): New function.
3356 (Descriptors::open): Use set_close_on_exec.
3357 * output.cc (S_ISLNK): Define if not defined.
3358
3359 2011-04-22 Cary Coutant <ccoutant@google.com>
3360
3361 * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3362 global symbol map.
3363 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3364 (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3365 (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3366 relocations.
3367 (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3368 (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3369 (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3370 * incremental.h
3371 (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3372 function.
3373 (Incremental_binary::apply_incremental_relocs): New function.
3374 (Incremental_binary::do_apply_incremental_relocs): New function.
3375 (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3376 data member.
3377 (Sized_incremental_binary::add_global_symbol): New function.
3378 (Sized_incremental_binary::global_symbol): New function.
3379 (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3380 (Sized_incremental_binary::symbol_map_): New data member.
3381 * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3382 * target.h (Sized_target::apply_relocation): New function.
3383 * target-reloc.h (apply_relocation): New function.
3384 * x86_64.cc (Target_x86_64::apply_relocation): New function.
3385
3386 2011-04-22 Doug Kwan <dougkwan@google.com>
3387
3388 * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3389 flag of a SHT_ARM_EXIDX section.
3390 * testsuite/Makefile.am (arm_exidx_test): New test rules.
3391 * testsuite/Makefile.in: Regenerate.
3392 * testsuite/arm_exidx_test.s: New file.
3393 * testsuite/arm_exidx_test.sh: Same.
3394
3395 2011-04-20 Cary Coutant <ccoutant@google.com>
3396
3397 PR gold/12689
3398 * archive.h (Incremental_archive_entry::Archive_member):
3399 Initialize arg_serial_ (second constructor).
3400
3401 2011-04-17 Ian Lance Taylor <iant@google.com>
3402
3403 * object.cc (Relocate_info::location): Simplify location string.
3404 * errors.cc (Errors::error_at_location): Don't print program
3405 name.
3406 (Errors::warning_at_location): Likewise.
3407 (Errors::undefined_symbol): Likewise.
3408 * testsuite/debug_msg.sh: Update accordingly.
3409
3410 2011-04-14 Cary Coutant <ccoutant@google.com>
3411
3412 * gold/layout.cc (Layout::symtab_section_offset): New function.
3413 * gold/layout.h (Layout::symtab_section_offset): New function.
3414 * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3415
3416 2011-04-12 Ian Lance Taylor <iant@google.com>
3417
3418 * configure.ac: Check for sys/mman.h and mmap. Check for mremap
3419 with MREMAP_MAYMOVE.
3420 * output.h (class Output_file): Add map_is_allocated_ field.
3421 * output.cc: Only #include <sys/mman.h> if it exists. If mmap is
3422 not available, provide stubs. If mremap is not available, #define
3423 it to gold_mremap.
3424 (MREMAP_MAYMOVE): Define if not defined.
3425 (Output_file::Output_file): Initialize map_is_allocated_.
3426 (Output_file::resize): Check map_is_allocated_.
3427 (Output_file::map_anonymous): If mmap fails, use malloc.
3428 (Output_file::unmap): Don't do anything for an anonymous map.
3429 * fileread.cc: Only #include <sys/mman.h> if it exists. If mmap
3430 is not available, provide stubs.
3431 (File_read::View::~View): Use free rather than delete[].
3432 (File_read::make_view): Use malloc rather than new[]. If mmap
3433 fails, use malloc.
3434 (File_read::find_or_make_view): Use malloc rather than new[].
3435 * gold.h: Remove HAVE_REMAP code.
3436 * mremap.c: #include <errno.h>. Only #include <sys/mman.h> if it
3437 exists. Rename mremap to gold_mremap. If mmap is not available
3438 don't do anything.
3439 * configure, config.in: Rebuild.
3440
3441 2011-04-11 Ian Lance Taylor <iant@google.com>
3442
3443 * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3444 initialize local variable v.
3445
3446 2011-04-11 Cary Coutant <ccoutant@google.com>
3447
3448 * archive.cc (Archive::include_member): Adjust call to
3449 report_object.
3450 (Add_archive_symbols::run): Track argument serial numbers.
3451 (Lib_group::include_member): Likewise.
3452 (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3453 * archive.h (Incremental_archive_entry::Archive_member):
3454 Initialize arg_serial_.
3455 (Archive_member::arg_serial_): New data member.
3456 * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3457 (Sized_dynobj::do_add_symbols): Track symbols when doing an
3458 incremental link.
3459 (Sized_dynobj::do_for_all_local_got_entries): New function.
3460 * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3461 function.
3462 * fileread.cc (get_mtime): New function.
3463 * fileread.h (get_mtime): New function.
3464 * gold.cc (queue_initial_tasks): Check for incremental update.
3465 (process_incremental_input): New function.
3466 (queue_middle_tasks): Don't force valid target for incremental
3467 update.
3468 * incremental-dump.cc (find_input_containing_global): Adjust
3469 size of symbol info entry.
3470 (dump_incremental_inputs): Dump argument serial number and
3471 in_system_directory flag; bias shndx by 1; print symbol names
3472 when dumping per-file symbol lists; use new symbol info readers.
3473 * incremental.cc
3474 (Output_section_incremental_inputs:update_data_size): New function.
3475 (Sized_incremental_binary::setup_readers): Setup input readers
3476 for each input file; build maps for files added from libraries
3477 and scripts.
3478 (Sized_incremental_binary::check_input_args): New function.
3479 (Sized_incremental_binary::do_check_inputs): Build map of argument
3480 serial numbers to input arguments.
3481 (Sized_incremental_binary::do_file_has_changed): Rename
3482 do_file_is_unchanged to this; compare file modification times.
3483 (Sized_incremental_binary::do_init_layout): New function.
3484 (Sized_incremental_binary::do_reserve_layout): New function.
3485 (Sized_incremental_binary::do_get_input_reader): Remove.
3486 (Sized_incremental_binary::get_symtab_view): New function.
3487 (Incremental_checker::can_incrementally_link_output_file): Remove.
3488 (Incremental_inputs::report_command_line): Exclude --debug options.
3489 (Incremental_inputs::report_archive_begin): Add parameter; track
3490 argument serial numbers; don't put input file entry for archive
3491 before archive members.
3492 (Incremental_inputs::report_archive_end): Put input file entry
3493 for archive after archive members.
3494 (Incremental_inputs::report_object): Add parameter; track argument
3495 serial numbers and in_system_directory flag.
3496 (Incremental_inputs::report_script): Add parameter; track argument
3497 serial numbers.
3498 (Output_section_incremental_inputs::set_final_data_size): Adjust
3499 size of symbol info entry; check for forwarding symbols.
3500 (Output_section_incremental_inputs::write_input_files): Write
3501 in_system_directory flag and argument serial number.
3502 (Output_section_incremental_inputs::write_info_blocks): Map section
3503 indices between incremental info and original input file; store
3504 input section index for each symbol.
3505 (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3506 change operator() to visit().
3507 (class Global_got_offset_visitor): Likewise.
3508 (class Global_symbol_visitor_got_plt):
3509 (Output_section_incremental_inputs::write_got_plt): Use new visitor
3510 classes.
3511 (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3512 (Sized_incr_relobj::do_read_symbols): New function.
3513 (Sized_incr_relobj::do_layout): New function.
3514 (Sized_incr_relobj::do_layout_deferred_sections): New function.
3515 (Sized_incr_relobj::do_add_symbols): New function.
3516 (Sized_incr_relobj::do_should_include_member): New function.
3517 (Sized_incr_relobj::do_for_all_global_symbols): New function.
3518 (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3519 (Sized_incr_relobj::do_section_size): New function.
3520 (Sized_incr_relobj::do_section_name): New function.
3521 (Sized_incr_relobj::do_section_contents): New function.
3522 (Sized_incr_relobj::do_section_flags): New function.
3523 (Sized_incr_relobj::do_section_entsize): New function.
3524 (Sized_incr_relobj::do_section_address): New function.
3525 (Sized_incr_relobj::do_section_type): New function.
3526 (Sized_incr_relobj::do_section_link): New function.
3527 (Sized_incr_relobj::do_section_info): New function.
3528 (Sized_incr_relobj::do_section_addralign): New function.
3529 (Sized_incr_relobj::do_initialize_xindex): New function.
3530 (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3531 (Sized_incr_relobj::do_read_relocs): New function.
3532 (Sized_incr_relobj::do_gc_process_relocs): New function.
3533 (Sized_incr_relobj::do_scan_relocs): New function.
3534 (Sized_incr_relobj::do_count_local_symbols): New function.
3535 (Sized_incr_relobj::do_finalize_local_symbols): New function.
3536 (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3537 (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3538 (Sized_incr_relobj::do_relocate): New function.
3539 (Sized_incr_relobj::do_set_section_offset): New function.
3540 (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3541 (Sized_incr_dynobj::do_read_symbols): New function.
3542 (Sized_incr_dynobj::do_layout): New function.
3543 (Sized_incr_dynobj::do_add_symbols): New function.
3544 (Sized_incr_dynobj::do_should_include_member): New function.
3545 (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3546 (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3547 (Sized_incr_dynobj::do_section_size): New function.
3548 (Sized_incr_dynobj::do_section_name): New function.
3549 (Sized_incr_dynobj::do_section_contents): New function.
3550 (Sized_incr_dynobj::do_section_flags): New function.
3551 (Sized_incr_dynobj::do_section_entsize): New function.
3552 (Sized_incr_dynobj::do_section_address): New function.
3553 (Sized_incr_dynobj::do_section_type): New function.
3554 (Sized_incr_dynobj::do_section_link): New function.
3555 (Sized_incr_dynobj::do_section_info): New function.
3556 (Sized_incr_dynobj::do_section_addralign): New function.
3557 (Sized_incr_dynobj::do_initialize_xindex): New function.
3558 (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3559 (make_sized_incremental_object): New function.
3560 (Incremental_library::copy_unused_symbols): New function.
3561 (Incremental_library::do_for_all_unused_symbols): New function.
3562 * incremental.h (enum Incremental_input_flags): New type.
3563 (class Incremental_checker): Remove.
3564 (Incremental_input_entry::Incremental_input_entry): Add argument
3565 serial number.
3566 (Incremental_input_entry::arg_serial): New function.
3567 (Incremental_input_entry::set_is_in_system_directory): New function.
3568 (Incremental_input_entry::is_in_system_directory): New function.
3569 (Incremental_input_entry::arg_serial_): New data member.
3570 (Incremental_input_entry::is_in_system_directory_): New data member.
3571 (class Script_info): Move here from script.h.
3572 (Script_info::Script_info): Add filename parameter.
3573 (Script_info::filename): New function.
3574 (Script_info::filename_): New data member.
3575 (Incremental_script_entry::Incremental_script_entry): Add argument
3576 serial number.
3577 (Incremental_object_entry::Incremental_object_entry): Likewise.
3578 (Incremental_object_entry::add_input_section): Build list of input
3579 sections with map to original shndx.
3580 (Incremental_object_entry::get_input_section_index): New function.
3581 (Incremental_object_entry::shndx_): New data member.
3582 (Incremental_object_entry::name_key_): Rename; adjust all refs.
3583 (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3584 (Incremental_archive_entry::Incremental_archive_entry): Add argument
3585 serial number.
3586 (Incremental_inputs::report_archive_begin): Likewise.
3587 (Incremental_inputs::report_object): Likewise.
3588 (Incremental_inputs::report_script): Likewise.
3589 (class Incremental_global_symbol_reader): New class.
3590 (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3591 and store flags and input file type.
3592 (Incremental_input_entry_reader::arg_serial): New function.
3593 (Incremental_input_entry_reader::type): Extract type from flags.
3594 (Incremental_input_entry_reader::is_in_system_directory): New function.
3595 (Incremental_input_entry_reader::get_input_section_count): Call
3596 accessor function for type.
3597 (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3598 function for type; adjust size of global symbol entry.
3599 (Incremental_input_entry_reader::get_global_symbol_count): Call
3600 accessor function for type.
3601 (Incremental_input_entry_reader::get_object_count): Likewise.
3602 (Incremental_input_entry_reader::get_object_offset): Likewise.
3603 (Incremental_input_entry_reader::get_member_count): Likewise.
3604 (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3605 (Incremental_input_entry_reader::get_member_offset): Likewise.
3606 (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3607 (Incremental_input_entry_reader::Global_symbol_info): Remove.
3608 (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3609 (Incremental_input_entry_reader::get_global_symbol_reader): New
3610 function.
3611 (Incremental_input_entry_reader::get_output_symbol_index): New
3612 function.
3613 (Incremental_input_entry_reader::type_): Remove.
3614 (Incremental_input_entry_reader::flags_): New data member.
3615 (Incremental_inputs_reader::input_file_offset): New function.
3616 (Incremental_inputs_reader::input_file_index): New function.
3617 (Incremental_inputs_reader::input_file): Call input_file_offset.
3618 (Incremental_inputs_reader::input_file_at_offset): New function.
3619 (Incremental_relocs_reader::get_r_type): Reformat.
3620 (Incremental_relocs_reader::get_r_shndx): Reformat.
3621 (Incremental_relocs_reader::get_r_offset): Reformat.
3622 (Incremental_relocs_reader::data): New function.
3623 (Incremental_binary::Incremental_binary): Initialize new data members.
3624 (Incremental_binary::check_inputs): Add cmdline parameter.
3625 (Incremental_binary::file_is_unchanged): Remove.
3626 (Input_reader::arg_serial): New function.
3627 (Input_reader::get_unused_symbol_count): New function.
3628 (Input_reader::get_unused_symbol): New function.
3629 (Input_reader::do_arg_serial): New function.
3630 (Input_reader::do_get_unused_symbol_count): New function.
3631 (Input_reader::do_get_unused_symbol): New function.
3632 (Incremental_binary::input_file_count): New function.
3633 (Incremental_binary::get_input_reader): Change signature to use
3634 index instead of filename.
3635 (Incremental_binary::file_has_changed): New function.
3636 (Incremental_binary::get_input_argument): New function.
3637 (Incremental_binary::get_library): New function.
3638 (Incremental_binary::get_script_info): New function.
3639 (Incremental_binary::init_layout): New function.
3640 (Incremental_binary::reserve_layout): New function.
3641 (Incremental_binary::output_file): New function.
3642 (Incremental_binary::do_check_inputs): New function.
3643 (Incremental_binary::do_file_is_unchanged): Remove.
3644 (Incremental_binary::do_file_has_changed): New function.
3645 (Incremental_binary::do_init_layout): New function.
3646 (Incremental_binary::do_reserve_layout): New function.
3647 (Incremental_binary::do_input_file_count): New function.
3648 (Incremental_binary::do_get_input_reader): Change signature.
3649 (Incremental_binary::input_args_map_): New data member.
3650 (Incremental_binary::library_map_): New data member.
3651 (Incremental_binary::script_map_): New data member.
3652 (Sized_incremental_binary::Sized_incremental_binary): Initialize
3653 new data members.
3654 (Sized_incremental_binary::output_section): New function.
3655 (Sized_incremental_binary::inputs_reader): Add const.
3656 (Sized_incremental_binary::symtab_reader): Add const.
3657 (Sized_incremental_binary::relocs_reader): Add const.
3658 (Sized_incremental_binary::got_plt_reader): Add const.
3659 (Sized_incremental_binary::get_symtab_view): New function.
3660 (Sized_incremental_binary::Inputs_reader): New typedef.
3661 (Sized_incremental_binary::Input_entry_reader): New typedef.
3662 (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3663 (Sized_incremental_binary::do_file_is_unchanged): Remove.
3664 (Sized_incremental_binary::do_file_has_changed): New function.
3665 (Sized_incremental_binary::do_init_layout): New function.
3666 (Sized_incremental_binary::do_reserve_layout): New function.
3667 (Sized_input_reader::Inputs_reader): Remove.
3668 (Sized_input_reader::Input_entry_reader): Remove.
3669 (Sized_input_reader::do_arg_serial): New function.
3670 (Sized_input_reader::do_get_unused_symbol_count): New function.
3671 (Sized_input_reader::do_get_unused_symbol): New function.
3672 (Sized_incremental_binary::do_input_file_count): New function.
3673 (Sized_incremental_binary::do_get_input_reader): Change signature;
3674 use index instead of filename.
3675 (Sized_incremental_binary::section_map_): New data member.
3676 (Sized_incremental_binary::input_entry_readers_): New data member.
3677 (class Sized_incr_relobj): New class.
3678 (class Sized_incr_dynobj): New class.
3679 (make_sized_incremental_object): New function.
3680 (class Incremental_library): New class.
3681 * layout.cc (Free_list::num_lists): New static data member.
3682 (Free_list::num_nodes): New static data member.
3683 (Free_list::num_removes): New static data member.
3684 (Free_list::num_remove_visits): New static data member.
3685 (Free_list::num_allocates): New static data member.
3686 (Free_list::num_allocate_visits): New static data member.
3687 (Free_list::init): New function.
3688 (Free_list::remove): New function.
3689 (Free_list::allocate): New function.
3690 (Free_list::dump): New function.
3691 (Free_list::print_stats): New function.
3692 (Layout_task_runner::run): Resize output file for incremental updates.
3693 (Layout::Layout): Initialize new data members.
3694 (Layout::set_incremental_base): New function.
3695 (Layout::init_fixed_output_section): New function.
3696 (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3697 incremental updates.
3698 (Layout::create_gold_note): Do not create gold note section for
3699 incremental updates.
3700 (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3701 for incremental updates.
3702 (Layout::set_section_offsets): For incremental updates, allocate space
3703 from free list.
3704 (Layout::create_symtab_sections): Layout with offsets relative to
3705 start of section; for incremental updates, allocate space from free
3706 list.
3707 (Layout::create_shdrs): For incremental updates, allocate space from
3708 free list.
3709 (Layout::finish_dynamic_section): For incremental updates, do not
3710 check --as-needed (fixed in subsequent patch).
3711 * layout.h (class Free_list): New class.
3712 (Layout::set_incremental_base): New function.
3713 (Layout::incremental_base): New function.
3714 (Layout::init_fixed_output_section): New function.
3715 (Layout::allocate): New function.
3716 (Layout::incremental_base_): New data member.
3717 (Layout::free_list_): New data member.
3718 * main.cc (main): Print Free_list statistics.
3719 * object.cc (Relobj::finalize_incremental_relocs): Add
3720 clear_counts parameter; clear counts only when clear_counts is set.
3721 (Sized_relobj::Sized_relobj): Initialize new base class.
3722 (Sized_relobj::do_layout): Don't report special sections.
3723 (Sized_relobj::do_for_all_local_got_entries): New function.
3724 (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3725 symtab_off to all symbol table offsets.
3726 (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3727 * object.h (class Got_offset_list): Move to top of file.
3728 (Object::Object): Allow case where input_file == NULL.
3729 (Object::~Object): Likewise.
3730 (Object::input_file): Assert that input_file != NULL.
3731 (Object::lock): Allow case where input_file == NULL.
3732 (Object::unlock): Likewise.
3733 (Object::is_locked): Likewise.
3734 (Object::token): Likewise.
3735 (Object::release): Likewise.
3736 (Object::is_incremental): New function.
3737 (Object::get_mtime): New function.
3738 (Object::for_all_local_got_entries): New function.
3739 (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3740 (Object::set_is_in_system_directory): New function.
3741 (Object::is_in_system_directory): New function.
3742 (Object::do_is_incremental): New function.
3743 (Object::do_get_mtime): New function.
3744 (Object::do_for_all_local_got_entries): New function.
3745 (Object::is_in_system_directory_): New data member.
3746 (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3747 (class Sized_relobj_base): New class.
3748 (class Sized_relobj): Derive from Sized_relobj_base.
3749 (class Sized_relobj::Symbols): Redeclare from base class.
3750 (class Sized_relobj::local_got_offset_list): Remove.
3751 (class Sized_relobj::Output_sections): Redeclare from base class.
3752 (class Sized_relobj::do_for_all_local_got_entries): New function.
3753 (class Sized_relobj::write_local_symbols): Add offset parameter.
3754 (class Sized_relobj::local_symbol_offset_): Update comment.
3755 (class Sized_relobj::local_dynsym_offset_): Update comment.
3756 * options.cc (Input_arguments::add_file): Remove const.
3757 * options.h (Input_file_argument::Input_file_argument):
3758 Initialize arg_serial_ (all constructors).
3759 (Input_file_argument::set_arg_serial): New function.
3760 (Input_file_argument::arg_serial): New function.
3761 (Input_file_argument::arg_serial_): New data member.
3762 (Input_arguments::Input_arguments): Initialize file_count_.
3763 (Input_arguments::add_file): Remove const.
3764 (Input_arguments::number_of_input_files): New function.
3765 (Input_arguments::file_count_): New data member.
3766 (Command_line::number_of_input_files): Call
3767 Input_arguments::number_of_input_files.
3768 * output.cc (Output_segment_headers::Output_segment_headers):
3769 Set current size.
3770 (Output_section::Input_section::current_data_size): New function.
3771 (Output_section::Output_section): Initialize new data members.
3772 (Output_section::add_input_section): Don't do merge sections for
3773 an incremental link; allocate space from free list for an
3774 incremental update.
3775 (Output_section::add_output_section_data): Allocate space from
3776 free list for an incremental update.
3777 (Output_section::update_data_size): New function.
3778 (Output_section::set_fixed_layout): New function.
3779 (Output_section::reserve): New function.
3780 (Output_segment::set_section_addresses): Remove const.
3781 (Output_segment::set_section_list_addresses): Remove const; allocate
3782 space from free list for an incremental update.
3783 (Output_segment::set_offset): Adjust size of RELRO segment for an
3784 incremental update.
3785 * output.h (Output_data::current_data_size): Move here from
3786 child classes.
3787 (Output_data::pre_finalize_data_size): New function.
3788 (Output_data::update_data_size): New function.
3789 (Output_section_headers::update_data_size): new function.
3790 (Output_section_data_build::current_data_size): Move to Output_data.
3791 (Output_data_strtab::update_data_size): New function.
3792 (Output_section::current_data_size): Move to Output_data.
3793 (Output_section::set_fixed_layout): New function.
3794 (Output_section::has_fixed_layout): New function.
3795 (Output_section::reserve): New function.
3796 (Output_section::update_data_size): New function.
3797 (Output_section::has_fixed_layout_): New data member.
3798 (Output_section::free_list_): New data member.
3799 (Output_segment::set_section_addresses): Remove const.
3800 (Output_segment::set_section_list_addresses): Remove const.
3801 * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3802 New function.
3803 * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3804 New function.
3805 * readsyms.cc (Read_symbols::do_read_symbols): Add library
3806 parameter when calling Add_symbols constructor; store argument
3807 serial number for members of a lib group.
3808 (Add_symbols::locks): Allow case where token == NULL.
3809 (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3810 (Read_member::~Read_member): New function.
3811 (Read_member::is_runnable): New function.
3812 (Read_member::locks): New function.
3813 (Read_member::run): New function.
3814 (Check_script::~Check_script): New function.
3815 (Check_script::is_runnable): New function.
3816 (Check_script::locks): New function.
3817 (Check_script::run): New function.
3818 (Check_library::~Check_library): New function.
3819 (Check_library::is_runnable): New function.
3820 (Check_library::locks): New function.
3821 (Check_library::run): New function.
3822 * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3823 (Add_symbols::library_): New data member.
3824 (class Read_member): New class.
3825 (class Check_script): New class.
3826 (class Check_library): New class.
3827 * reloc.cc (Read_relocs::is_runnable): Allow case where
3828 token == NULL.
3829 (Read_relocs::locks): Likewise.
3830 (Scan_relocs::locks): Likewise.
3831 (Relocate_task::locks): Likewise.
3832 (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3833 to clear counters.
3834 (Sized_relobj::incremental_relocs_scan): Fix comment.
3835 (Sized_relobj::do_relocate): Pass output file offset to
3836 write_local_symbols.
3837 (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3838 from class declaration.
3839 * script.cc (read_input_script): Allocate Script_info; pass
3840 argument serial number to report_script.
3841 * script.h (class Script_info): Move to incremental.h.
3842 * symtab.cc (Symbol_table::add_from_incrobj): New function.
3843 * symtab.h (Symbol_table::add_from_incrobj): New function.
3844 (Symbol_table::set_file_offset): New function.
3845
3846 2011-04-05 Cary Coutant <ccoutant@google.com>
3847
3848 * incremental-dump.cc (dump_incremental_inputs): Change signature
3849 to take a Sized_incremental_binary; change caller. Use readers
3850 in Sized_incremental_binary.
3851 * incremental.cc
3852 (Sized_incremental_binary::find_incremental_inputs_sections):
3853 Rename do_find_incremental_inputs_sections to this.
3854 (Sized_incremental_binary::setup_readers): New function.
3855 (Sized_incremental_binary::do_check_inputs): Check
3856 has_incremental_info_ flag; move setup code to setup_readers;
3857 use input readers.
3858 (Sized_incremental_binary::do_file_is_unchanged): New function.
3859 (Sized_incremental_binary::do_get_input_reader): New function.
3860 * incremental.h (class Incremental_binary): Move to end of file.
3861 (Incremental_binary::file_is_unchanged): New function.
3862 (Incremental_binary::do_file_is_unchanged): New function.
3863 (Incremental_binary::Input_reader): New class.
3864 (Incremental_binary::get_input_reader): New function.
3865 (class Sized_incremental_binary): Move to end of file.
3866 (Sized_incremental_binary::Sized_incremental_binary): Setup the
3867 input section reader classes.
3868 (Sized_incremental_binary::has_incremental_info): New function.
3869 (Sized_incremental_binary::inputs_reader): New function.
3870 (Sized_incremental_binary::symtab_reader): New function.
3871 (Sized_incremental_binary::relocs_reader): New function.
3872 (Sized_incremental_binary::got_plt_reader): New function.
3873 (Sized_incremental_binary::do_file_is_unchanged): New function.
3874 (Sized_incremental_binary::Sized_input_reader): New class.
3875 (Sized_incremental_binary::get_input_reader): New function.
3876 (Sized_incremental_binary::find_incremental_inputs_sections):
3877 Rename do_find_incremental_inputs_sections to this.
3878 (Sized_incremental_binary::setup_readers): New function.
3879 (Sized_incremental_binary::has_incremental_info_): New data member.
3880 (Sized_incremental_binary::inputs_reader_): New data member.
3881 (Sized_incremental_binary::symtab_reader_): New data member.
3882 (Sized_incremental_binary::relocs_reader_): New data member.
3883 (Sized_incremental_binary::got_plt_reader_): New data member.
3884 (Sized_incremental_binary::current_input_file_): New data member.
3885
3886 2011-04-05 Paul Pluzhnikov <ppluzhnikov@google.com>
3887
3888 PR gold/12640
3889 * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3890 violation.
3891
3892 2011-03-30 Cary Coutant <ccoutant@google.com>
3893
3894 * archive.cc (Archive::include_member): Adjust call to report_object.
3895 (Add_archive_symbols::run): Add script_info to call to
3896 report_archive_begin.
3897 (Lib_group::include_member): Adjust call to report_object.
3898 (Add_lib_group_symbols::run): Adjust call to report_object.
3899 * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3900 blocks. Add object count for script input files.
3901 * incremental.cc (Incremental_inputs::report_archive_begin): Add
3902 script_info parameter; change all callers.
3903 (Incremental_inputs::report_object): Add script_info parameter;
3904 change all callers.
3905 (Incremental_inputs::report_script): Store backpointer to
3906 incremental info entry.
3907 (Output_section_incremental_inputs::set_final_data_size): Record
3908 additional information for scripts.
3909 (Output_section_incremental_inputs::write_info_blocks): Likewise.
3910 * incremental.h (Incremental_script_entry::add_object): New function.
3911 (Incremental_script_entry::get_object_count): New function.
3912 (Incremental_script_entry::get_object): New function.
3913 (Incremental_script_entry::objects_): New data member; adjust
3914 constructor.
3915 (Incremental_inputs::report_archive_begin): Add script_info parameter.
3916 (Incremental_inputs::report_object): Add script_info parameter.
3917 (Incremental_inputs_reader::get_object_count): New function.
3918 (Incremental_inputs_reader::get_object_offset): New function.
3919 * options.cc (Input_arguments::add_file): Return reference to
3920 new input argument.
3921 * options.h (Input_argument::set_script_info): New function.
3922 (Input_argument::script_info): New function.
3923 (Input_argument::script_info_): New data member; adjust all
3924 constructors.
3925 (Input_file_group::add_file): Return reference to new input argument.
3926 (Input_file_lib::add_file): Likewise.
3927 (Input_arguments::add_file): Likewise.
3928 * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3929 * script.cc (Parser_closure::Parser_closure): Add script_info
3930 parameter; adjust all callers.
3931 (Parser_closure::script_info): New function.
3932 (Parser_closure::script_info_): New data member.
3933 (read_input_script): Report scripts earlier to incremental info.
3934 (script_add_file): Set script_info in Input_argument.
3935 (script_add_library): Likewise.
3936 * script.h (Script_options::Script_info): Rewrite class.
3937
3938 2011-03-29 Cary Coutant <ccoutant@google.com>
3939
3940 * archive.cc (Library_base::should_include_member): Move
3941 method here from class Archive.
3942 (Archive::Archive): Initialize base class.
3943 (Archive::should_include_member): Move to base class.
3944 (Archive::do_for_all_unused_symbols): New function.
3945 (Add_archive_symbols::run): Remove redundant access to
3946 incremental_inputs.
3947 (Lib_group::Lib_group): Initialize base class.
3948 (Lib_group::do_filename): New function.
3949 (Lib_group::include_member): Pass pointer to Lib_group to
3950 report_object.
3951 (Lib_group::do_for_all_unused_symbols): New function.
3952 (Add_lib_group_symbols::run): Report archive information for
3953 incremental links.
3954 * archive.h (class Library_base): New base class.
3955 (class Archive): Derive from Library_base.
3956 (Archive::filename): Move to base class.
3957 (Archive::set_incremental_info): Likewise.
3958 (Archive::incremental_info): Likewise.
3959 (Archive::Should_include): Likewise.
3960 (Archive::should_include_member): Likewise.
3961 (Archive::Armap_entry): Remove.
3962 (Archive::Unused_symbol_iterator): Remove.
3963 (Archive::unused_symbols_begin): Remove.
3964 (Archive::unused_symbols_end): Remove.
3965 (Archive::do_filename): New function.
3966 (Archive::do_get_mtime): New function.
3967 (Archive::do_for_all_unused_symbols): New function.
3968 (Archive::task_): Move to base class.
3969 (Archive::incremental_info_): Likewise.
3970 (class Lib_group): Derive from Library_base.
3971 (Lib_group::do_filename): New function.
3972 (Lib_group::do_get_mtime): New function.
3973 (Lib_group::do_for_all_unused_symbols): New function.
3974 (Lib_group::task_): Move to base class.
3975 * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3976 function.
3977 * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3978 function.
3979 * incremental.cc (Incremental_inputs::report_archive_begin):
3980 Use Library_base; call library's get_mtime; add incremental inputs
3981 entry before members.
3982 (class Unused_symbol_visitor): New class.
3983 (Incremental_inputs::report_archive_end): Use Library_base; use
3984 visitor class to record unused symbols; don't add incremental inputs
3985 entry after members.
3986 (Incremental_inputs::report_object): Use Library_base.
3987 * incremental.h
3988 (Incremental_archive_entry::Incremental_archive_entry): Remove
3989 unused Archive parameter.
3990 (Incremental_inputs::report_archive_begin): Use Library_base.
3991 (Incremental_inputs::report_archive_end): Likewise.
3992 (Incremental_inputs::report_object): Likewise.
3993 * object.cc (Sized_relobj::do_for_all_global_symbols): New
3994 function.
3995 * object.h (Object::for_all_global_symbols): New function.
3996 (Object::do_for_all_global_symbols): New function.
3997 (Sized_relobj::do_for_all_global_symbols): New function.
3998 * plugin.cc (Sized_pluginobj::do_for_all_global_symbols): New
3999 function.
4000 * plugin.h (Sized_pluginobj::do_for_all_global_symbols): New
4001 function.
4002
4003 2011-03-27 Ian Lance Taylor <iant@google.com>
4004
4005 * archive.cc (Archive::interpret_header): Return -1 if something
4006 goes wrong. Change callers accordingly.
4007
4008 2011-03-25 Cary Coutant <ccoutant@google.com>
4009
4010 * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4011 * testsuite/Makefile.in: Regenerate.
4012
4013 2011-03-23 Rafael Ávila de Espíndola <respindola@mozilla.com>
4014
4015 * plugin.cc (get_view): New.
4016 (Plugin::load): Pass get_view to the plugin.
4017 (Plugin_manager::get_view): New.
4018
4019 2011-03-21 Ian Lance Taylor <iant@google.com>
4020
4021 * testsuite/final_layout.sh: Rewrite to not use dc.
4022 * testsuite/relro_test.sh: Fail if dc is not present.
4023
4024 2011-03-21 Sriraman Tallam <tmsriram@google.com>
4025
4026 * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4027 Change == to -eq.
4028 * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4029 * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4030 Change == to -eq.
4031 * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4032 * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4033
4034 2011-03-14 Ian Lance Taylor <iant@google.com>
4035
4036 * script-sections.cc (Sort_output_sections::script_compare):
4037 Rename from is_before, change return type.
4038 (Sort_output_sections::operator()): Adjust accordingly.
4039
4040 2011-03-11 Jeffrey Yasskin <jyasskin@google.com>
4041
4042 PR gold/12572
4043 * testsuite/odr_violation2.cc: Add comment to make all error line
4044 numbers double digits.
4045 * testsuite/debug_msg.sh: Adjust expected errors.
4046
4047 2011-03-09 Jeffrey Yasskin <jyasskin@google.com>
4048
4049 * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4050 but mark earlier ones as non-canonical
4051 (offset_to_iterator): Update search target and example
4052 (do_addr2line): Return extra lines in a vector*
4053 (format_file_lineno): Extract from do_addr2line
4054 (one_addr2line): Add vector* out-param
4055 * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4056 when a lineno entry appeared last for its instruction
4057 (Dwarf_line_info): Add vector* out-param
4058 * object.cc (Relocate_info): Pass NULL for the vector* out-param
4059 * symtab.cc (Odr_violation_compare): Include the lineno in the
4060 comparison again.
4061 (linenos_from_loc): New. Combine the canonical line for an
4062 address with its other lines.
4063 (True_if_intersect): New. Helper functor to make
4064 std::set_intersection a query.
4065 (detect_odr_violations): Compare sets of lines instead of just
4066 one line for each function. This became less deterministic, but
4067 has fewer false positives.
4068 * symtab.h: Declarations.
4069 * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4070 mix an optimized and non-optimized object in the same binary
4071 (odr_violation2.so): Same.
4072 * testsuite/Makefile.in: Regenerate from Makefile.am.
4073 * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4074 * testsuite/debug_msg.sh: Update line numbers and add
4075 assertions.
4076 * testsuite/odr_violation1.cc: Use OdrDerived, in a
4077 non-optimized context.
4078 * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4079 isn't inlined, and use OdrDerived in an optimized context.
4080 * testsuite/odr_header1.h: Defines OdrDerived, where
4081 optimization will change the
4082 first-instruction-in-the-destructor's file and line number.
4083 * testsuite/odr_header2.h: Defines OdrBase.
4084
4085 2011-03-09 Ian Lance Taylor <iant@google.com>
4086
4087 * fileread.cc (File_read::clear_views): Don't delete the whole
4088 file view.
4089
4090 2011-03-08 Ian Lance Taylor <iant@google.com>
4091
4092 PR gold/12525
4093 * fileread.cc: #include <climits>.
4094 (GOLD_IOV_MAX): Define.
4095 (File_read::read_multiple): Limit number of entries by iov_max.
4096 * fileread.h (class File_read): Always set max_readv_entries to
4097 128.
4098
4099 2011-03-07 Ian Lance Taylor <iant@google.com>
4100
4101 PR gold/12525
4102 * options.h (class General_options): Add -dy and -dn.
4103
4104 2011-03-02 Cary Coutant <ccoutant@google.com>
4105
4106 * testsuite/script_test_9.t: Add TLS segment.
4107
4108 2011-03-02 Simon Baldwin <simonb@google.com>
4109
4110 * configure.ac: Add check for gnu_indirect_function support in
4111 the toolchain building binutils.
4112 * configure: Rebuild.
4113
4114 2011-02-18 Rafael Ávila de Espíndola <respindola@mozilla.com>
4115
4116 * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4117 plugin only symbols.
4118 (Symbol_table::sized_finalize_symbol) Mark symbol only present
4119 in plugin files as not needed in the symbol table.
4120
4121 2011-02-11 Sriraman Tallam <tmsriram@google.com>
4122
4123 * output.cc (Output_section::add_input_section): Delay fill
4124 generation for section ordering.
4125
4126 2011-02-09 Ian Lance Taylor <iant@google.com>
4127
4128 PR gold/12316
4129 * object.h (class Sized_relobj): Remove clear_local_symbols.
4130 * reloc.cc (Sized_relobj::do_relocate): Don't call
4131 clear_local_symbols.
4132
4133 2011-02-08 Rafael Ávila de Espíndola <respindola@mozilla.com>
4134
4135 * plugin.cc (is_visible_from_outside): Return true for symbols
4136 in the -u option.
4137
4138 2011-02-04 Jeffrey Yasskin <jyasskin@google.com>
4139
4140 * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4141 filename.
4142
4143 2011-02-02 Sriraman Tallam <tmsriram@google.com>
4144
4145 * icf.h (is_section_foldable_candidate): Change type of parameter
4146 to std::string.
4147 * icf.cc (Icf::find_identical_sections): Change type of local variable
4148 section_name to be std::string.
4149 (is_function_ctor_or_dtor): Change type of parameter to std::string.
4150
4151 2011-01-25 Ian Lance Taylor <iant@google.com>
4152
4153 * script.cc (script_add_extern): Rewrite to use
4154 add_symbol_reference.
4155
4156 2011-01-25 Doug Kwan <dougkwan@google.com>
4157
4158 * icf.cc (get_section_contents): Always lock section's object.
4159
4160 2011-01-24 Ian Lance Taylor <iant@google.com>
4161
4162 * options.h (class General_options): Accept
4163 --no-detect-odr-violations.
4164
4165 2011-01-24 Ian Lance Taylor <iant@google.com>
4166
4167 * version.cc (version_string): Bump to 1.11.
4168
4169 2011-01-24 Ian Lance Taylor <iant@google.com>
4170
4171 * plugin.cc (class Plugin_rescan): Define new class.
4172 (Plugin_manager::claim_file): Set any_claimed_.
4173 (Plugin_manager::save_archive): New function.
4174 (Plugin_manager::save_input_group): New function.
4175 (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4176 necessary.
4177 (Plugin_manager::new_undefined_symbol): New function.
4178 (Plugin_manager::rescan): New function.
4179 (Plugin_manager::rescannable_defines): New function.
4180 (Plugin_manager::add_input_file): Set any_added_.
4181 * plugin.h (class Plugin_manager): define new fields rescannable_,
4182 undefined_symbols_, any_claimed_, and any_added_. Declare
4183 Plugin_rescan as friend. Declare new functions.
4184 (Plugin_manager::Rescannable): Define type.
4185 (Plugin_manager::Rescannable_list): Define type.
4186 (Plugin_manager::Undefined_symbol_list): Define type.
4187 (Plugin_manager::Plugin_manager): Initialize new fields.
4188 * archive.cc (Archive::defines_symbol): New function.
4189 (Add_archive_symbols::run): Pass archive to plugins if any.
4190 * archive.h (class Archive): Declare defines_symbol.
4191 * readsyms.cc (Input_group::~Input_group): New function.
4192 (Finish_group::run): Pass input_group to plugins if any.
4193 * readsyms.h (class Input_group): Declare destructor.
4194 * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4195 any.
4196
4197 2011-01-10 Ian Lance Taylor <iant@google.com>
4198
4199 * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4200 section as relro.
4201 (Layout::set_segment_offsets): Reset increase_relro before calling
4202 set_section_addresses a second time.
4203
4204 2011-01-04 Cary Coutant <ccoutant@google.com>
4205
4206 * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4207 sections before NOBITS sections.
4208
4209 2011-01-01 H.J. Lu <hongjiu.lu@intel.com>
4210
4211 * version.cc (print_version): Update copyright to 2011.
4212
4213 2010-12-23 Cary Coutant <ccoutant@google.com>
4214
4215 * output.h (Output_data_reloc::add_output_section): Pass OD instead
4216 of OS to this->add. Add OD parameter to second form of the function.
4217
4218 2010-12-20 Ian Lance Taylor <iant@google.com>
4219
4220 * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4221 second of two consecutive entries with same offset.
4222
4223 2010-12-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4224
4225 * testsuite/Makefile.am (ifuncmain2static_LDADD)
4226 (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4227 (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4228 to avoid unneeded links against $(LDADD).
4229 * testsuite/Makefile.in: Regenerate.
4230
4231 2010-12-15 Ian Lance Taylor <iant@google.com>
4232
4233 PR gold/12324
4234 * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4235 for R_X86_64_32 and R_X86_64_PC32.
4236 * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4237 ver_matching_def_pic.o.
4238 (ver_matching_def_pic.o): New target.
4239
4240 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4241
4242 * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4243 (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4244 Move definition before File_read::View member definitions.
4245 (File_read::View::~View): Initialize and hold lock before
4246 updating current_mapped_bytes.
4247
4248 2010-12-14 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4249
4250 * dwarf_reader.cc: Remove outdated comment.
4251 * gold-threads.cc: Fix typo in error message.
4252 * archive.cc: Fix typos in comments.
4253 * archive.h: Likewise.
4254 * arm-reloc-property.cc: Likewise.
4255 * arm-reloc-property.h: Likewise.
4256 * arm-reloc.def: Likewise.
4257 * arm.cc: Likewise.
4258 * attributes.h: Likewise.
4259 * cref.cc: Likewise.
4260 * ehframe.cc: Likewise.
4261 * fileread.h: Likewise.
4262 * gold.h: Likewise.
4263 * i386.cc: Likewise.
4264 * icf.cc: Likewise.
4265 * incremental.h: Likewise.
4266 * int_encoding.cc: Likewise.
4267 * layout.h: Likewise.
4268 * main.cc: Likewise.
4269 * merge.h: Likewise.
4270 * object.cc: Likewise.
4271 * object.h: Likewise.
4272 * options.cc: Likewise.
4273 * readsyms.cc: Likewise.
4274 * reduced_debug_output.cc: Likewise.
4275 * reloc.cc: Likewise.
4276 * script-sections.cc: Likewise.
4277 * sparc.cc: Likewise.
4278 * symtab.h: Likewise.
4279 * target-reloc.h: Likewise.
4280 * target.cc: Likewise.
4281 * target.h: Likewise.
4282 * timer.cc: Likewise.
4283 * timer.h: Likewise.
4284 * x86_64.cc: Likewise.
4285
4286 2010-12-09 Cary Coutant <ccoutant@google.com>
4287
4288 * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4289 stack.
4290 * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4291 parameter; change all callers.
4292 * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4293 * options.h (warn_execstack): New option.
4294
4295 2010-12-07 Doug Kwan <dougkwan@google.com>
4296
4297 * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4298 like function call relocations.
4299
4300 2010-12-07 Ian Lance Taylor <iant@google.com>
4301
4302 * archive.cc (Archive::get_elf_object_for_member): Permit
4303 punconfigured to be NULL.
4304 (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4305 (Archive::include_member): Pass NULL to get_elf_object_for_member
4306 if we searched for the archive and this is the first included
4307 object.
4308
4309 2010-12-01 Ian Lance Taylor <iant@google.com>
4310
4311 * dwarf_reader.h (class Sized_dwarf_line_info): Add
4312 track_relocs_type_ field.
4313 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4314 Set track_relocs_type_.
4315 (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4316 contents when using RELA relocs.
4317 (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4318 reloc_map_.
4319 * reloc.cc (Track_relocs::next_addend): New function.
4320 * reloc.h (class Track_relocs): Declare next_addend.
4321
4322 2010-12-01 Ian Lance Taylor <iant@google.com>
4323
4324 * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4325 virtual destructor.
4326
4327 2010-12-01 Ian Lance Taylor <iant@google.com>
4328
4329 * README: Update compilers known to work and fail.
4330
4331 2010-11-23 Matthias Klose <doko@ubuntu.com>
4332
4333 * configure.in: For --enable-gold, handle value `default' instead of
4334 `both*'. Always install ld as ld.bfd, install as ld if gold is
4335 not the default.
4336 * configure: Regenerate.
4337
4338 2010-11-18 Doug Kwan <dougkwan@google.com>
4339
4340 * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4341 and right_alignment to be zero. Store result alignment only if it is
4342 greater than existing alignment.
4343
4344 2010-11-16 Cary Coutant <ccoutant@google.com>
4345
4346 PR gold/12220
4347 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4348 Check for ".zdebug_line".
4349
4350 2010-11-16 Doug Kwan <dougkwan@google.com>
4351 Cary Coutant <ccoutant@google.com>
4352
4353 * output.h (Output_segment::set_section_addresses): Pass increase_relro
4354 by reference; adjust all callers.
4355 * output.cc (Output_segment::set_section_addresses): Adjust references
4356 to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4357 list is empty.
4358 (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4359 end at page boundary.
4360
4361 2010-11-16 Cary Coutant <ccoutant@google.com>
4362
4363 PR gold/12220
4364 * layout.cc (Layout::choose_output_section): Transform names of
4365 compressed sections even when using a script with a SECTIONS clause.
4366 (Layout::output_section_name): Remove code to transform
4367 compressed debug section names.
4368 * output.cc (Output_section::add_input_section): Use uncompressed
4369 section size when tracking input sections.
4370
4371 2010-11-11 Richard Sandiford <richard.sandiford@linaro.org>
4372
4373 * symtab.h (Symbol::NON_PIC_REF): Remove.
4374 (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4375 (Symbol::FUNCTION_CALL): Renumber. Reword comment.
4376 (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4377 (Symbol::use_plt_offset): Take a flags argument and pass it
4378 directly to needs_dynamic_reloc. Restrict check for undefined
4379 weak symbols to function calls.
4380 * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4381 (Target_arm::Scan::global): Use it.
4382 (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4383 (Target_arm::Relocate::relocate): Likewise.
4384 (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4385 parameter with an r_type parameter. Use get_reference_flags
4386 to get the flags.
4387 (Target_arm::Relocate::relocate): Update accordingly.
4388 * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4389 (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4390 (Target_i386::Scan::global): Likewise.
4391 (Target_i386::Relocate::relocate): Likewise.
4392 (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4393 parameter with an r_type parameter. Use get_reference_flags
4394 to get the flags.
4395 (Target_i386::Relocate::relocate): Update accordingly.
4396 * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4397 (Target_powerpc::Scan::global): Use it.
4398 (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4399 (Target_powerpc::Relocate::relocate): Likewise.
4400 * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4401 (Target_sparc::Scan::global): Use it.
4402 (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4403 (Target_sparc::Relocate::relocate): Likewise.
4404 * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4405 (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4406 (Target_x86_64::Scan::global): Likewise.
4407 (Target_x86_64::Relocate::relocate): Likewise.
4408
4409 2010-11-08 Doug Kwan <dougkwan@google.com>
4410 Cary Coutant <ccoutant@google.com>
4411
4412 * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4413 (Arm_exidx_merge_section::section_contents_): New data member.
4414 (Arm_input_section::Arm_input_section): Initialize original_contents_.
4415 (Arm_input_section::~Arm_input_section): De-allocate memory.
4416 (Arm_input_section::original_contents_): New data member.
4417 (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4418 in parameters instead of calling Object::section_contents without
4419 locking.
4420 (Arm_output_section::group_section): New parameter TASK. Pass it
4421 to callees that need locking objects.
4422 (Arm_output_section::fix_exidx_coverage): New parameter TASK. Use it
4423 to lock EXIDX input sections. Fix a formatting issue. Call
4424 Arm_exidx_merged_section::build_contents to create merged section
4425 contents.
4426 (Arm_output_section::create_stub_group): New parameter TASK. Use it
4427 to lock object of stub table owner.
4428 (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4429 TEXT_SIZE to initialize data member TEXT_SIZE_.
4430 (Arm_exidx_input_section::addralign): Fix typo in comment.
4431 (Arm_exidx_input_section::text_size): New method.
4432 (Target_arm::do_relax): New parameter TASK. Pass it to callees
4433 that require locking objects. Lock objects before scanning for stubs
4434 and updating local symbols.
4435 (Arm_input_section<big_endian>::init): Copy contents of original
4436 input section.
4437 (Arm_input_section<big_endian>::do_write): Use saved contents of
4438 original input section instead of calling Object::section_contents
4439 without locking.
4440 (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4441 size without calling Object::section_size().
4442 (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4443 for size. Allocate a buffer for merged EXIDX entries.
4444 (Arm_exidx_merged_section::build_contents): New method.
4445 (Arm_exidx_merged_section::do_write): Move merge section contents
4446 building code to Arm_exidx_merged_section::build_contetns. Write
4447 out contetns in buffer instead of building it on the fly.
4448 (Arm_relobj::make_exidx_input_section): Also pass text section size
4449 to Arm_exidx_input_section constructor.
4450 (Arm_relobj::do_read_symbols): Fix memory leak. Fix a formatting issue.
4451 (Arm_dynobj::do_read_symbols): Fix memory leak.
4452 * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4453 * target.h: (class Task): Add forward declaration.
4454 (Target::relax): Add new parameter TASK and pass it to
4455 Target::do_relax().
4456 (Target::do_relax):: New parameter TASK. Fix a formatting issue.
4457
4458 2010-11-05 Cary Coutant <ccoutant@google.com>
4459
4460 PR gold/10708
4461 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4462 object when reading from the file.
4463 * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4464 second layout pass.
4465 * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4466 when reading section contents.
4467 (get_section_contents): Likewise.
4468 (icf::find_identical_sections): Likewise.
4469 * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4470 object when reading from the file.
4471 * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4472 the object when doing deferred section layout.
4473
4474 2010-11-03 Nick Clifton <nickc@redhat.com>
4475
4476 PR gold/12001
4477 * script.h (class Symbol_assignment: name): New member. Returns
4478 the name of the symbol.
4479 * scrfipt.cc (Script_options::is_pending_assignment): New member.
4480 Returns true if the given symbol name is on the list of
4481 assignments wating to be processed.
4482 * archive.cc (should_incldue_member): If the symbol is undefined,
4483 check to see if it is on the list of symbols pending assignment.
4484
4485 2010-11-03 Ryan Mansfield <rmansfield@qnx.com>
4486
4487 * script-sections.cc (Script_sections::find_memory_region): Check
4488 for a NULL output section pointer.
4489
4490 2010-10-29 Doug Kwan <dougkwan@google.com>
4491
4492 * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4493 Output_section::add_relaxed_input_section.
4494 * output.cc (Output_section::add_relaxed_input_section): Add new
4495 arguments LAYOUT and NAME. Set section order index.
4496 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4497 Copy section order index.
4498 * output.h (Output_section::add_relaxed_input_section): Add new
4499 arguments LAYOUT and NAME.
4500
4501 2010-10-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4502
4503 * testsuite/Makefile.am: Move gcctestdir/ld rule to
4504 NATIVE_OR_CROSS_LINKER.
4505 * testsuite/Makefile.in: Regenerate.
4506
4507 2010-10-20 Doug Kwan <dougkwan@google.com>
4508
4509 * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4510 without SHF_LINK_ORDER flags.
4511 * layout.cc (Layout::choose_output_section): Do not filter
4512 SHF_LINK_ORDER flag in a relocatable link.
4513
4514 2010-10-17 Cary Coutant <ccoutant@google.com>
4515
4516 * output.h (Output_segment::set_section_addresses): Change function
4517 signature. Update all callers.
4518 * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4519 sections.
4520 (Output_segment::set_section_addresses): Align after last TLS
4521 section. Add padding before last relro section instead of after.
4522
4523 2010-10-17 Doug Kwan <dougkwan@google.com>
4524
4525 * gold/arm.cc (Target_arm::got_section): Use correct order and set
4526 GOT output section to be writable.
4527
4528 2010-10-14 Cary Coutant <ccoutant@google.com>
4529
4530 * debug.h (DEBUG_INCREMENTAL): New flag.
4531 (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4532 * gold.cc (queue_initial_tasks): Check parameters for incremental link
4533 mode.
4534 * incremental.cc (report_command_line): Ignore all forms of
4535 --incremental.
4536 * layout.cc (Layout::Layout): Check parameters for incremental link
4537 mode.
4538 * options.cc (General_options::parse_incremental): New function.
4539 (General_options::parse_no_incremental): New function.
4540 (General_options::parse_incremental_full): New function.
4541 (General_options::parse_incremental_update): New function.
4542 (General_options::incremental_mode_): New data member.
4543 (General_options::finalize): Check incremental_mode_.
4544 * options.h (General_options): Update help text for --incremental.
4545 Add --no-incremental, --incremental-full, --incremental-update.
4546 (General_options::Incremental_mode): New enum type.
4547 (General_options::incremental_mode): New function.
4548 (General_options::incremental_mode_): New data member.
4549 * parameters.cc (Parameters::incremental_mode_): New data member.
4550 (Parameters::set_options): Set incremental_mode_.
4551 (Parameters::set_incremental_full): New function.
4552 (Parameters::incremental): New function.
4553 (Parameters::incremental_update): New function.
4554 (set_parameters_incremental_full): New function.
4555 * parameters.h (Parameters::set_incremental_full): New function.
4556 (Parameters::incremental): New function.
4557 (Parameters::incremental_update): New function.
4558 (Parameters::incremental_mode_): New data member.
4559 (set_parameters_incremental_full): New function.
4560 * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4561 incremental link mode.
4562 * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4563 (Sized_relobj::do_relocate_sections): Likewise.
4564 * testsuite/Makefile.am (incremental_test): Use --incremental-full
4565 option.
4566 * testsuite/Makefile.in: Regenerate.
4567 * testsuite/incremental_test.sh: Filter all forms of --incremental.
4568
4569 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4570
4571 * script-sections.h (class Script_sections): Make
4572 Sections_elements typedef public.
4573 * script-sections.cc (class Sort_output_sections): Add elements_
4574 field. Add constructor which sets it; change all callers.
4575 (Sort_output_sections::is_before): New function.
4576 (Sort_output_sections::operator()): Call is_before.
4577 * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4578 conditional.
4579 * testsuite/script_test_10.sh: New test. Test script section
4580 order.
4581 * testsuite/script_test_10.t: Likewise.
4582 * testsuite/script_test_10.s: Likewise.
4583 * testsuite/Makefile.am: Wrap the cross linker tests and the
4584 common tests into NATIVE_OR_CROSS_LINKER.
4585 (check_SCRIPTS): Add script_test_10.sh.
4586 (check_DATA): Add script_test_10.stdout.
4587 (script_test_10.o, script_test_10): New targets.
4588 (script_test_10.stdout): New target.
4589 * configure, testsuite/Makefile.in: Regenerate.
4590
4591 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
4592
4593 * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4594 error for the deprecated relocations.
4595 (Target_arm::Scan::global): Likewise.
4596 (Target_arm::Relocate::relocate): Likewise.
4597
4598 2010-10-12 Richard Sandiford <richard.sandiford@linaro.org>
4599
4600 * fileread.cc (Input_file::find_file): Initialize *found_name
4601 and *namep when using the fallback search for case 4.
4602
4603 2010-10-11 Cary Coutant <ccoutant@google.com>
4604
4605 * options.h (class General_options): Redefine -z lazy as an alias for
4606 the negation of -z now.
4607
4608 2010-10-11 Ian Lance Taylor <iant@google.com>
4609
4610 * resolve.cc (symbol_to_bits): Report the value of the unsupported
4611 binding.
4612
4613 2010-10-06 Nick Clifton <nickc@redhat.com>
4614
4615 * script-sections.cc(class Memory_region): Remove
4616 current_lma_offset_ field. Rename current_vma_offset_ to
4617 current_offset_. Add last_section_ field.
4618 (Memory_region::get_current_vma_address): Rename to
4619 get_current_address.
4620 (Memory_region::get_current_lma_address): Delete.
4621 (Memory_region::increment_vma_offset): Rename to
4622 increment_offset.
4623 (Memory_region::increment_lma_offset): Delete.
4624 (Memory_region::attributes_compatible): New method. Returns
4625 true if the provided section is compatible with the region.
4626 (Memory_region::get_last_section): New method. Returns the last
4627 section to use the region.
4628 (Memory_region::set_last_section): New method. Stores the last
4629 section to use the region.
4630 (Script_sections::block_in_region): New method. Returns true if
4631 a block of memory is contained within a region.
4632 (Script_sections::find_memory_region): New method. Locates a
4633 memory region to be used to set a VMA or LMA address.
4634 (Output_section_definition::set_section_addresses): Add code to
4635 check for addresses set by memory regions.
4636 (Output_segment::set_section_addresses): Remove memory region
4637 walking code.
4638 (Script_sections::create_segment): Add a warning if a header
4639 segment is created outside of any region.
4640 * script-sections.h (class Script_sections): Add prototypes for
4641 find_memory_region and block_in_region methods.
4642 * testsuite/memory_test.s: Use .long instead of .word.
4643 * testsuite/memory_test.t: Add some more output sections.
4644 * testsuite/memory_test.sh: Update expected output.
4645
4646 2010-10-02 Doug Kwan <dougkwan@google.com>
4647
4648 * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4649 defintion to symtab.h
4650 * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4651 declaration to defintion.
4652
4653 2010-10-01 Nick Clifton <nickc@redhat.com>
4654
4655 * expression.cc (eval): Replace dummy argument with NULL.
4656 (eval_maybe_dot): Check for a NULL result section pointer.
4657 (Symbol_expression::value): Likewise.
4658 (Dot_expression::value): Likewise.
4659 (BINARY_EXPRESSION): Likewise.
4660 (Max_expression::value): Likewise.
4661 (Min_expression::value): Likewise.
4662 (Absolute_expression::value): Likewise.
4663 (Addr_expression::value_from_output_section): Likewise.
4664 (Loaddddr_expression::value_from_output_section): Likewise.
4665 (Segment_start_expression::value): Likewise.
4666 * script-sections.cc
4667 (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4668 argument with NULL.
4669 (Sections_elememt_dot_assignment::set_section_addresses):
4670 Likewise.
4671 (Output_data_expression::do_write_to_buffer): Likewise.
4672 (Output_section_definition::finalize_symbols): Likewise.
4673 (Output_section_definition::set_section_addresses): Likewise.
4674
4675 2010-09-30 Doug Kwan <dougkwan@google.com>
4676
4677 * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4678
4679 2010-09-28 Sriraman Tallam <tmsriram@google.com>
4680
4681 * target.h (Target::can_icf_inline_merge_sections): New virtual
4682 function.
4683 * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4684 virtual function.
4685 * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4686 virtual function.
4687 * icf.cc (get_section_contents): Inline merge sections only when
4688 target allows it.
4689
4690 2010-09-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
4691
4692 * configure: Regenerate.
4693
4694 2010-09-17 Ian Lance Taylor <iant@google.com>
4695
4696 * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4697 * testsuite/Makefile.am (memory_test.o): New target.
4698 (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4699 memory_test.t.
4700 * testsuite/Makefile.in: Rebuild.
4701
4702 2010-09-17 Doug Kwan <dougkwan@google.com>
4703
4704 * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4705 defintion if relocation uses GOT entries of the symbol.
4706 * testsuite/icf_safe_test.sh: Fix test.
4707 * testsuite/icf_safe_so_test.sh: Fix test.
4708
4709 2010-09-16 Cary Coutant <ccoutant@google.com>
4710
4711 * script_sections.cc (class Memory_region): Remove "NULL" from
4712 vector initializations.
4713
4714 2010-09-15 Cary Coutant <ccoutant@google.com>
4715
4716 * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4717 Resolve forwarding symbols.
4718
4719 2010-09-15 Doug Kwan <dougkwan@google.com>
4720
4721 * gold/testsuite/script_test_3.t: Add ARM special sections.
4722 * gold/testsuite/script_test_4.t: Same.
4723 * gold/testsuite/script_test_5.t: Same.
4724 * gold/testsuite/script_test_6.t: Same.
4725 * gold/testsuite/script_test_7.t: Same.
4726 * gold/testsuite/script_test_7.t: Same.
4727 * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4728
4729 2010-09-14 Cary Coutant <ccoutant@google.com>
4730
4731 * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4732 (Target_x86_64::Relocate::relocate_tls): Replace check for
4733 saw_tls_block_reloc_ with test for executable section.
4734
4735 2010-09-12 Cary Coutant <ccoutant@google.com>
4736
4737 * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4738 position-independent executables to shared libraries need dynamic
4739 relocations.
4740 (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4741 position-independent executables.
4742 * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4743 * testsuite/Makefile.in: Regenerate.
4744
4745 2010-09-10 Nick Clifton <nickc@redhat.com>
4746
4747 PR gold/11997
4748 * testsuite/memory_test.t: Discard any sections that are not
4749 needed.
4750
4751 2010-09-09 H.J. Lu <hongjiu.lu@intel.com>
4752
4753 PR gold/11996
4754 * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4755 "This::" to work around a bug in gcc 4.2.
4756
4757 * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4758
4759 2010-09-09 Rafael Espindola <espindola@google.com>
4760
4761 * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4762 sections with different PF_X flags in the same segment.
4763 (Layout::find_first_load_seg): Search all segments to find the first
4764 one.
4765 * options.h (rosegment): New.
4766
4767 2010-09-08 Rafael Espindola <espindola@google.com>
4768
4769 * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4770
4771 2010-09-08 Doug Kwan <dougkwan@google.com>
4772
4773 * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4774 (Arm_relobj::do_relocate_sections): Add new parameter for output
4775 file to match the parent.
4776 (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4777 of local symbols instead of input values. Update code to track
4778 changes in gold::relocate_section.
4779 * object.cc (Sized_relobj::compute_final_local_value): New methods.
4780 (Sized_relobj::compute_final_local_value_internal): New methods.
4781 (Sized_relobj::do_finalize_local_symbols): Move code from loop
4782 body into private version of Sized_relobj::compute_final_local_value.
4783 Call the inline method.
4784 * object.h (Symbol_value::Symbol_value): Define destructor. Free
4785 merged symbol value if there is one.
4786 (Symbol_value::has_output_value): New method defintiion.
4787 (Sized_relobj::Compute_final_local_value_status): New enum type.
4788 (Sized_relobj::compute_final_local_value): New methods.
4789 (Sized_relobj::compute_final_local_value_internal): New methods.
4790 * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4791 and arm_cortex_a8.sh.
4792 (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4793 arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4794 New tests.
4795 * Makefile.in: Regenerate.
4796 * testsuite/arm_bl_out_of_range.s: Update test.
4797 * testsuite/thumb_bl_out_of_range.s: Ditto.
4798 * testsuite/thumb_blx_out_of_range.s: Ditto.
4799 * testsuite/arm_branch_out_of_range.sh: New file.
4800 * testsuite/arm_cortex_a8.sh: Ditto.
4801 * testsuite/arm_cortex_a8_b.s: Ditto.
4802 * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4803 * testsuite/arm_cortex_a8_b_local.s: Ditto.
4804 * testsuite/arm_cortex_a8_bl.s: Ditto.
4805 * testsuite/arm_cortex_a8_blx.s: Ditto.
4806 * testsuite/arm_cortex_a8_local.s: Ditto.
4807 * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4808 * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4809
4810 2010-09-08 Rafael Espindola <espindola@google.com>
4811
4812 * Makefile.am (memory_test.stdout): Run readelf with -W.
4813 * Makefile.in: Regenerate.
4814 * testsuite/memory_test.sh: Make the regexps accept both 32 and
4815 64 bit output.
4816
4817 2010-09-08 Rafael Espindola <espindola@google.com>
4818
4819 * script-sections.cc (Script_sections::add_memory_region): Convert
4820 field precision to int.
4821 * script.cc (script_set_section_region, script_set_section_region):
4822 Convert field precision to int.
4823
4824 2010-09-08 Rafael Espindola <espindola@google.com>
4825
4826 * arm.cc (do_finalize_sections): Create the __exidx_start and
4827 __exdix_end symbols even when the section is missing.
4828
4829 2010-09-08 Nick Clifton <nickc@redhat.com>
4830
4831 * README: Remove claim that MEMORY is not supported.
4832 * expression.cc (script_exp_function_origin)
4833 (script_exp_function_length): Move from here to ...
4834 * script.cc: ... here.
4835 (script_set_section_region, script_add_memory)
4836 (script_parse_memory_attr, script_include_directive): New
4837 functions.
4838 * script-sections.cc
4839 (class Memory_region): New class.
4840 (class Output_section_definition): Add set_memory_region,
4841 set_section_vma, set_section_lma and get_section_name methods.
4842 (class Script_Sections): Add add_memory_region,
4843 find_memory_region, find_memory_region_origin,
4844 find_memory_region_length and set_memory_region methods.
4845 Have set_section_addresses method walk the list of set memory
4846 regions.
4847 Extend the print methos to display memory regions.
4848 * script-sections.h: Add prototypes for new methods.
4849 Add enum for MEMORY region attributes.
4850 * yyscript.y: Add support for parsing MEMORY regions.
4851 * script-c.h: Add prototypes for new functions.
4852 * testsuite/Makefile.am: Add test of MEMORY region functionality.
4853 * testsuite/Makefile.in: Regenerate.
4854 * testsuite/memory_test.sh: New script.
4855 * testsuite/memory_test.s: New assembler source file.
4856 * testsuite/memory_test.t: New linker script.
4857
4858 2010-08-27 Doug Kwan <dougkwan@google.com>
4859
4860 * gold/resolve.cc (Symbol_table::should_override): Let a weak
4861 reference override an existing dynamic weak reference.
4862 * testsuite/Makefile.am: Add new test dyn_weak_ref.
4863 * testsuite/Makefile.in: Regenerate.
4864 * testsuite/dyn_weak_ref.sh: New file.
4865 * testsuite/dyn_weak_ref_1.c: Ditto.
4866 * testsuite/dyn_weak_ref_2.c: Ditto.
4867
4868 2010-08-27 Ian Lance Taylor <iant@google.com>
4869
4870 * incremental.h (class Incremental_input_entry): Add virtual
4871 destructor.
4872
4873 2010-08-27 Ian Lance Taylor <iant@google.com>
4874
4875 * testsuite/start_lib_test_3.c: Mark t3 as used.
4876
4877 2010-08-27 Nick Clifton <nickc@redhat.com>
4878
4879 * options.cc (version_script): Fix small typo in previous
4880 whitespace tidyup.
4881
4882 2010-08-25 Nick Clifton <nickc@redhat.com>
4883
4884 * archive.cc: Formatting fixes: Remove whitespace between
4885 typename and following asterisk. Remove whitespace between
4886 function name and opening parenthesis.
4887 * archive.h: Likewise.
4888 * arm.cc: Likewise.
4889 * attributes.cc: Likewise.
4890 * attributes.h: Likewise.
4891 * common.cc: Likewise.
4892 * copy-relocs.cc: Likewise.
4893 * dirsearch.h: Likewise.
4894 * dynobj.cc: Likewise.
4895 * ehframe.cc: Likewise.
4896 * ehframe.h: Likewise.
4897 * expression.cc: Likewise.
4898 * fileread.cc: Likewise.
4899 * fileread.h: Likewise.
4900 * gc.h: Likewise.
4901 * gold-threads.cc: Likewise.
4902 * gold.cc: Likewise.
4903 * i386.cc: Likewise.
4904 * icf.h: Likewise.
4905 * incremental-dump.cc: Likewise.
4906 * incremental.cc: Likewise.
4907 * layout.cc: Likewise.
4908 * layout.h: Likewise.
4909 * main.cc: Likewise.
4910 * merge.cc: Likewise.
4911 * merge.h: Likewise.
4912 * object.cc: Likewise.
4913 * object.h: Likewise.
4914 * options.cc: Likewise.
4915 * options.h: Likewise.
4916 * output.cc: Likewise.
4917 * output.h: Likewise.
4918 * plugin.cc: Likewise.
4919 * plugin.h: Likewise.
4920 * powerpc.cc: Likewise.
4921 * reloc.cc: Likewise.
4922 * script-c.h: Likewise.
4923 * script-sections.cc: Likewise.
4924 * script.cc: Likewise.
4925 * stringpool.cc: Likewise.
4926 * symtab.cc: Likewise.
4927 * symtab.h: Likewise.
4928 * target.cc: Likewise.
4929 * timer.cc: Likewise.
4930 * timer.h: Likewise.
4931 * version.cc: Likewise.
4932 * x86_64.cc: Likewise.
4933
4934 2010-08-24 Nick Clifton <nickc@redhat.com>
4935
4936 PR 11899
4937 * layout.cc (segment_precedes): Sort segments by their physical
4938 addresses, if they have been set.
4939
4940 2010-08-23 Cary Coutant <ccoutant@google.com>
4941
4942 * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4943 symbols data.
4944 (Lib_group::include_member): Unlock object after deleting its
4945 symbols data.
4946 * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4947 the bug fixed here.
4948
4949 2010-08-19 Neil Vachharajani <nvachhar@google.com>
4950 Cary Coutant <ccoutant@google.com>
4951
4952 * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4953 constructor, and set_blocker.
4954 * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4955 readsyms_blocker_.
4956 * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4957 this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4958 * testsuite/Makefile.am (start_lib_test): New test case.
4959 * testsuite/Makefile.in: Regenerate.
4960 * testsuite/start_lib_test_main.c: New file.
4961 * testsuite/start_lib_test_1.c: New file.
4962 * testsuite/start_lib_test_2.c: New file.
4963 * testsuite/start_lib_test_3.c: New file.
4964
4965 2010-08-19 Ian Lance Taylor <iant@google.com>
4966
4967 * Makefile.in: Rebuild with automake 1.11.1.
4968 * aclocal.m4: Likewise.
4969 * testsuite/Makefile.in: Likewise.
4970
4971 2010-08-19 Ian Lance Taylor <iant@google.com>
4972
4973 PR 10893
4974 * i386.cc (class Output_data_plt_i386): Update declarations.
4975 Define Global_ifunc and Local_ifunc types. Add global_ifuncs_ and
4976 local_ifuncs_ fields.
4977 (Target_i386::do_plt_section_for_global): New function.
4978 (Target_i386::do_plt_section_for_local): New function.
4979 (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4980 parameter; change all callers. Initialize global_ifuncs_ and
4981 local_ifuncs_. If doing a static link define __rel_iplt_start and
4982 __rel_iplt_end.
4983 (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4984 (Output_data_plt_i386::add_local_ifunc_entry): New function.
4985 (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4986 symbols.
4987 (Target_i386::make_plt_section): New function, broken out of
4988 make_plt_entry. Set sh_info field of .rel.plt to point to .plt.
4989 (Target_i386::make_plt_entry): Call make_plt_section.
4990 (Target_i386::make_local_ifunc_plt_entry): New function.
4991 (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4992 (Target_i386::Scan::local): Handle IFUNC symbols. Add
4993 R_386_IRELATIVE to switch.
4994 (Target_i386::Scan::global): Likewise.
4995 (Target_i386::Relocate::relocate): Likewise.
4996 (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4997 switch.
4998 * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4999 (Target_x86_64::do_plt_section_for_global): New function.
5000 (Target_x86_64::do_plt_section_for_local): New function.
5001 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5002 parameter; change all callers. If doing a static link define
5003 __rela_iplt_start and __rela_iplt_end.
5004 (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5005 (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5006 (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5007 to point to .plt.
5008 (Target_x86_64::make_local_ifunc_plt_entry): New function.
5009 (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5010 switch.
5011 (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5012 (Target_x86_64::Scan::local): Handle IFUNC symbols. Add
5013 R_X86_64_IRELATIVE to switch.
5014 (Target_x86_64::Scan::global): Likewise.
5015 (Target_x86_64::Relocate::relocate): Likewise.
5016 (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5017 switch.
5018 * target.h (class Target): Add plt_section_for_global and
5019 plt_section_for_local functions. Add do_plt_section_for_global
5020 and do_plt_section_for_local virtual functions.
5021 * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol. Add
5022 clarifying comments.
5023 (Symbol::use_plt_offset): Handle IFUNC symbol.
5024 * object.cc (Sized_relobj::Sized_relobj): Initialize
5025 local_plt_offsets_.
5026 (Sized_relobj::local_has_plt_offset): New function.
5027 (Sized_relobj::local_plt_offset): New function.
5028 (Sized_relobj::set_local_plt_offset): New function.
5029 (Sized_relobj::do_count): Handle IFUNC symbol.
5030 * object.h (class Symbol_value): Add is_ifunc_symbol_ field. Take
5031 a bit away from input_shndx_ field. Add set_is_func_symbol and
5032 is_ifunc_symbol functions.
5033 (class Sized_relobj): Update declarations. Remove Tls_got_entry
5034 and Local_tls_got_offsets. Define Local_plt_offsets. Add
5035 local_plt_offsets_ field.
5036 (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5037 * output.h (class Output_section_data): Add non-const
5038 output_section function.
5039 (class Output_data_got): Update declarations.
5040 (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5041 Add use_plt_offset parameter to global and local constructors.
5042 Change all callers. Change local_sym_index_ field to 31 bits.
5043 Change GSYM_CODE and CONSTANT_CODE accordingly.
5044 * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5045 doing a static link don't set sh_link field.
5046 (Output_data_got::Got_entry::write): Use PLT offset if
5047 appropriate.
5048 (Output_data_got::add_global_plt): New function.
5049 (Output_data_got::add_local_plt): New function.
5050 * target-reloc.h (relocate_section): Handle IFUNC symbol.
5051 * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5052 __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5053 * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5054 * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5055 IFUNC conditional.
5056 * testsuite/ifunc-sel.h: New file.
5057 * testsuite/ifuncmain1.c: New file.
5058 * testsuite/ifuncmain1vis.c: New file.
5059 * testsuite/ifuncmod1.c: New file.
5060 * testsuite/ifuncdep2.c: New file.
5061 * testsuite/ifuncmain2.c: New file.
5062 * testsuite/ifuncmain3.c: New file.
5063 * testsuite/ifuncmod3.c: New file.
5064 * testsuite/ifuncmain4.c: New file.
5065 * testsuite/ifuncmain5.c: New file.
5066 * testsuite/ifuncmod5.c: New file.
5067 * testsuite/ifuncmain6pie.c: New file.
5068 * testsuite/ifuncmod6.c: New file.
5069 * testsuite/ifuncmain7.c: New file.
5070 * configure, testsuite/Makefile.in: Rebuild.
5071
5072 2010-08-18 Ian Lance Taylor <iant@google.com>
5073
5074 * incremental.cc
5075 (Output_section_incremental_inputs::write_input_files): Add cast
5076 to avoid signed/unsigned comparison warning.
5077 (Output_section_incremental_inputs::write_info_blocks): Likewise.
5078
5079 2010-08-12 Cary Coutant <ccoutant@google.com>
5080
5081 * common.cc (Sort_commons::operator()): Remove unnecessary code.
5082
5083 2010-08-13 Ian Lance Taylor <iant@google.com>
5084
5085 * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5086
5087 2010-08-12 Cary Coutant <ccoutant@google.com>
5088 Doug Kwan <dougkwan@google.com>
5089
5090 * resolve.cc (Symbol_table::should_override): When a weak dynamic
5091 defintion overrides non-weak undef, remember that the original undef
5092 is not weak.
5093 * symtab.cc (Symbol_table::sized_write_global): For undef without
5094 an original weak binding, set binding to global in output.
5095 * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5096 * testsuite/Makefile.in: Regenerate.
5097 * testsuite/strong_ref_weak_def.sh: New file.
5098 * testsuite/strong_ref_weak_def_1.c: Ditto.
5099 * testsuite/strong_ref_weak_def_2.c: Ditto.
5100
5101 2010-08-12 Cary Coutant <ccoutant@google.com>
5102
5103 * testsuite/incremental_test.sh: Rewrite.
5104 * testsuite/incremental_test_1.c: Rewrite.
5105 * testsuite/incremental_test_2.c: Rewrite.
5106
5107 2010-08-12 Cary Coutant <ccoutant@google.com>
5108
5109 * arm.cc (Target_arm::got_size): Add const.
5110 (Target_arm::got_entry_count): New function.
5111 (Target_arm::plt_entry_count): New function.
5112 (Target_arm::first_plt_entry_offset): New function.
5113 (Target_arm::plt_entry_size): New function.
5114 (Output_data_plt_arm::entry_count): New function.
5115 (Output_data_plt_arm::first_plt_entry_offset): New function.
5116 (Output_data_plt_arm::get_plt_entry_size): New function.
5117 * i386.cc (Target_i386::got_size): Add const.
5118 (Target_i386::got_entry_count): New function.
5119 (Target_i386::plt_entry_count): New function.
5120 (Target_i386::first_plt_entry_offset): New function.
5121 (Target_i386::plt_entry_size): New function.
5122 (Output_data_plt_i386::entry_count): New function.
5123 (Output_data_plt_i386::first_plt_entry_offset): New function.
5124 (Output_data_plt_i386::get_plt_entry_size): New function.
5125 * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5126 find_incremental_inputs_sections. Dump incremental_got_plt section.
5127 * incremental.cc: Include target.h.
5128 (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5129 parameter. Adjust all callers. Find incremental_got_plt section.
5130 (Incremental_inputs::create_data_sections): Create incremental_got_plt
5131 section.
5132 (Output_section_incremental_inputs::set_final_data_size): Calculate
5133 size of incremental_got_plt section.
5134 (Output_section_incremental_inputs::do_write): Write the
5135 incremental_got_plt section.
5136 (Got_plt_view_info): New struct.
5137 (Local_got_offset_visitor): New class.
5138 (Global_got_offset_visitor): New class.
5139 (Global_symbol_visitor_got_plt): New class.
5140 (Output_section_incremental_inputs::write_got_plt): New function.
5141 * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5142 Add parameter. Adjust all callers.
5143 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5144 (Incremental_inputs::got_plt_section): New function.
5145 (Incremental_inputs::got_plt_section_): New data member.
5146 (Incremental_got_plt_reader): New class.
5147 * layout.cc (Layout::create_incremental_info_sections): Add the
5148 incremental_got_plt section.
5149 * object.h (Got_offset_list::get_list): New function.
5150 (Got offset_list::for_all_got_offsets): New function.
5151 (Sized_relobj::local_got_offset_list): New function.
5152 * powerpc.cc (Target_powerpc::got_size): Add const.
5153 (Target_powerpc::got_entry_count): New function.
5154 (Target_powerpc::plt_entry_count): New function.
5155 (Target_powerpc::first_plt_entry_offset): New function.
5156 (Target_powerpc::plt_entry_size): New function.
5157 (Output_data_plt_powerpc::entry_count): New function.
5158 (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5159 (Output_data_plt_powerpc::get_plt_entry_size): New function.
5160 * sparc.cc (Target_sparc::got_size): Add const.
5161 (Target_sparc::got_entry_count): New function.
5162 (Target_sparc::plt_entry_count): New function.
5163 (Target_sparc::first_plt_entry_offset): New function.
5164 (Target_sparc::plt_entry_size): New function.
5165 (Output_data_plt_sparc::entry_count): New function.
5166 (Output_data_plt_sparc::first_plt_entry_offset): New function.
5167 (Output_data_plt_sparc::get_plt_entry_size): New function.
5168 * symtab.h (Symbol::got_offset_list): New function.
5169 (Symbol_table::for_all_symbols): New function.
5170 * target.h (Sized_target::got_entry_count): New function.
5171 (Sized_target::plt_entry_count): New function.
5172 (Sized_target::plt_entry_size): New function.
5173 * x86_64.cc (Target_x86_64::got_size): Add const.
5174 (Target_x86_64::got_entry_count): New function.
5175 (Target_x86_64::plt_entry_count): New function.
5176 (Target_x86_64::first_plt_entry_offset): New function.
5177 (Target_x86_64::plt_entry_size): New function.
5178 (Output_data_plt_x86_64::entry_count): New function.
5179 (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5180 (Output_data_plt_x86_64::get_plt_entry_size): New function.
5181
5182 2010-08-12 Cary Coutant <ccoutant@google.com>
5183
5184 * archive.cc: Include incremental.h.
5185 (Archive::Archive): Initialize incremental_info_.
5186 (Archive::include_member): Record archive members in incremental info.
5187 (Add_archive_symbols::run): Record begin and end of an archive in
5188 incremental info.
5189 (Lib_group::include_member): Record objects in incremental info.
5190 * archive.h (Incremental_archive_entry): Forward declaration.
5191 (Archive::set_incremental_info): New member function.
5192 (Archive::incremental_info): New member function.
5193 (Archive::Unused_symbol_iterator): New class.
5194 (Archive::unused_symbols_begin): New member function.
5195 (Archive::unused_symbols_end): New member function.
5196 (Archive::incremental_info_): New data member.
5197 * incremental-dump.cc (find_input_containing_global): New function.
5198 (dump_incremental_inputs): Dump new incremental info sections.
5199 * incremental.cc: Include symtab.h.
5200 (Output_section_incremental_inputs): New class.
5201 (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5202 new incremental info sections.
5203 (Sized_incremental_binary::do_check_inputs): Likewise.
5204 (Incremental_inputs::report_archive): Remove.
5205 (Incremental_inputs::report_archive_begin): New function.
5206 (Incremental_inputs::report_archive_end): New function.
5207 (Incremental_inputs::report_object): New function.
5208 (Incremental_inputs::finalize_inputs): Remove.
5209 (Incremental_inputs::report_input_section): New function.
5210 (Incremental_inputs::report_script): Rewrite.
5211 (Incremental_inputs::finalize): Do nothing but finalize string table.
5212 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5213 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5214 (Incremental_inputs::create_data_sections): New function.
5215 (Incremental_inputs::relocs_entsize): New function.
5216 (Output_section_incremental_inputs::set_final_data_size): New function.
5217 (Output_section_incremental_inputs::do_write): New function.
5218 (Output_section_incremental_inputs::write_header): New function.
5219 (Output_section_incremental_inputs::write_input_files): New function.
5220 (Output_section_incremental_inputs::write_info_blocks): New function.
5221 (Output_section_incremental_inputs::write_symtab): New function.
5222 * incremental.h (Incremental_script_entry): Forward declaration.
5223 (Incremental_object_entry): Forward declaration.
5224 (Incremental_archive_entry): Forward declaration.
5225 (Incremental_inputs): Forward declaration.
5226 (Incremental_inputs_header_data): Remove.
5227 (Incremental_inputs_header): Remove.
5228 (Incremental_inputs_header_write): Remove.
5229 (Incremental_inputs_entry_data): Remove.
5230 (Incremental_inputs_entry): Remove.
5231 (Incremental_inputs_entry_write): Remove.
5232 (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5233 (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5234 (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5235 (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5236 Likewise.
5237 (Incremental_input_entry): New class.
5238 (Incremental_script_entry): New class.
5239 (Incremental_object_entry): New class.
5240 (Incremental_archive_entry): New class.
5241 (Incremental_inputs::Incremental_inputs): Initialize new data members.
5242 (Incremental_inputs::report_inputs): Remove.
5243 (Incremental_inputs::report_archive): Remove.
5244 (Incremental_inputs::report_archive_begin): New function.
5245 (Incremental_inputs::report_archive_end): New function.
5246 (Incremental_inputs::report_object): Change prototype.
5247 (Incremental_inputs::report_input_section): New function.
5248 (Incremental_inputs::report_script): Change prototype.
5249 (Incremental_inputs::get_reloc_count): New function.
5250 (Incremental_inputs::set_reloc_count): New function.
5251 (Incremental_inputs::create_data_sections): New function.
5252 (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5253 (Incremental_inputs::inputs_section): New function.
5254 (Incremental_inputs::symtab_section): New function.
5255 (Incremental_inputs::relocs_section): New function.
5256 (Incremental_inputs::get_stringpool): Add const.
5257 (Incremental_inputs::command_line): Add const.
5258 (Incremental_inputs::inputs): Remove.
5259 (Incremental_inputs::command_line_key): New function.
5260 (Incremental_inputs::input_file_count): New function.
5261 (Incremental_inputs::input_files): New function.
5262 (Incremental_inputs::relocs_entsize): New function.
5263 (Incremental_inputs::sized_create_inputs_section_data): Remove.
5264 (Incremental_inputs::finalize_inputs): Remove.
5265 (Incremental_inputs::Input_info): Remove.
5266 (Incremental_inputs::lock_): Remove.
5267 (Incremental_inputs::inputs_): Change type.
5268 (Incremental_inputs::inputs_map_): Remove.
5269 (Incremental_inputs::current_object_entry_): New data member.
5270 (Incremental_inputs::inputs_section_): New data member.
5271 (Incremental_inputs::symtab_section_): New data member.
5272 (Incremental_inputs::relocs_section_): New data member.
5273 (Incremental_inputs::reloc_count_): New data member.
5274 (Incremental_inputs_reader): New class.
5275 (Incremental_symtab_reader): New class.
5276 (Incremental_relocs_reader): New class.
5277 * layout.cc (Layout::finalize): Move finalization of incremental info
5278 and creation of incremental info sections to follow finalization of
5279 symbol table. Set offsets for postprocessing sections.
5280 (Layout::create_incremental_info_sections): Call
5281 Incremental_inputs::create_data_sections. Add incremental symtab
5282 and relocs sections. Set sh_entsize and sh_link fields. Arrange for
5283 sections to layout after input sections.
5284 * layout.h (struct Timespec): Forward declaration.
5285 (Layout::incremental_inputs): Add const.
5286 (Layout::create_incremental_info_sections): Add parameter.
5287 * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5288 * object.cc: Include incremental.h.
5289 (Relobj::finalize_incremental_relocs): New function.
5290 (Sized_relobj::do_layout): Record input sections in incremental info.
5291 * object.h (Object::output_section): New function.
5292 (Object::output_section_offset): Moved from Relobj.
5293 (Object::get_incremental_reloc_base): New function.
5294 (Object::get_incremental_reloc_count): New function.
5295 (Object::do_output_section): New function.
5296 (Object::do_output_section_offset): Moved from Relobj.
5297 (Object::do_get_incremental_reloc_base): New function.
5298 (Object::do_get_incremental_reloc_count): New function.
5299 (Object::Object): Initialize new data members.
5300 (Relobj::output_section): Renamed do_output_section and moved to
5301 protected.
5302 (Relobj::output_section_offset): Moved to Object.
5303 (Relobj::do_get_incremental_reloc_base): New function.
5304 (Relobj::do_get_incremental_reloc_count): New function.
5305 (Relobj::allocate_incremental_reloc_counts): New function.
5306 (Relobj::count_incremental_reloc): New function.
5307 (Relobj::finalize_incremental_relocs): New function.
5308 (Relobj::next_incremental_reloc_index): New function.
5309 (Relobj::reloc_counts_): New data member.
5310 (Relobj::reloc_bases_): New data member.
5311 (Sized_relobj::do_relocate_sections): Add parameter. Change caller.
5312 (Sized_relobj::relocate_sections): Add parameter. Change all callers.
5313 (Sized_relobj::incremental_relocs_scan): New function.
5314 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5315 (Sized_relobj::incremental_relocs_write): New function.
5316 (Sized_relobj::incremental_relocs_write_reltype): New function.
5317 * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5318 incremental link.
5319 * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5320 archives and object files elsewhere.
5321 (Add_symbols::run): Report object files here.
5322 (Finish_group::run): Report end of archive at end of group.
5323 * reloc.cc: Include layout.h, incremental.h.
5324 (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5325 (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5326 (Sized_relobj::incremental_relocs_scan): New function.
5327 (Sized_relobj::incremental_relocs_scan_reltype): New function.
5328 (Sized_relobj::do_relocate_sections): Write incremental relocations.
5329 (Sized_relobj::incremental_relocs_write): New function.
5330 (Sized_relobj::incremental_relocs_write_reltype): New function.
5331 * script.cc (read_input_script): Rewrite test for incremental link.
5332 Change call to Incremental_inputs::report_script.
5333 * symtab.h (Symbol_table::first_global_index): New function.
5334 (Symbol_table::output_count): New function.
5335
5336 2010-08-12 Doug Kwan <dougkwan@google.com>
5337
5338 * arm.cc (Target_arm::merge_object_attributes): Check command line
5339 options --no-wchar-size-warning and --no-enum-size-warning.
5340 * options.h (General_options): Add ld-compatible options
5341 --no-enum-size-warning and --no-wchar-size-warning.
5342
5343 2010-08-04 Ian Lance Taylor <iant@google.com>
5344
5345 * x86_64.cc (Target_x86_64::Scan::local): Use
5346 R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5347 R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5348 (Target_x86_64::Scan::global): Likewise.
5349 (Target_x86_64::Relocate::relocate): Likewise.
5350 (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5351 Likewise.
5352
5353 2010-08-03 Cary Coutant <ccoutant@google.com>
5354
5355 * merge.cc (Output_merge_string::do_add_input_section): Count strings
5356 to reserve space in merged_strings vector. Keep total input size
5357 for stats.
5358 (Output_merge_string::do_print_merge_stats): Print total input size.
5359 * merge.h (Output_merge_string): Add input_size_ field.
5360 * stringpool.cc (Stringpool_template::string_length): Move
5361 implementations out of Stringpool_template class and place in
5362 stringpool.h.
5363 * stringpool.h (string_length): Move out of Stringpool_template.
5364
5365 2010-08-03 Ian Lance Taylor <iant@google.com>
5366
5367 PR 11712
5368 * layout.cc (relaxation_loop_body): If address of load segment is
5369 set, adjust address to include headers if possible.
5370
5371 2010-08-03 Ian Lance Taylor <iant@google.com>
5372
5373 * version.cc (version_string): Bump to 1.10.
5374
5375 2010-08-03 Ian Lance Taylor <iant@google.com>
5376
5377 PR 11805
5378 * layout.h (enum Output_section_order): Define.
5379 (class Layout): Update declarations.
5380 * layout.cc (Layout::get_output_section): Add order parameter.
5381 Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5382 is_first_non_relro parameters. Change all callers.
5383 (Layout::choose_output_section): Likewise.
5384 (Layout::add_output_section_data): Likewise.
5385 (Layout::make_output_section): Likewise. Set order.
5386 (Layout::default_section_order): New function.
5387 (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5388 * output.cc (Output_section::Output_section): Initialize order_.
5389 Don't initialize deleted fields.
5390 (Output_segment::Output_segment): Don't initialize deleted
5391 fields.
5392 (Output_segment::add_output_section_to_load): New function
5393 replacing add_output_section. Change all callers to call this or
5394 add_output_section_to_nonload.
5395 (Output_segment::add_output_section_to_nonload): New function.
5396 (Output_segment::remove_output_section): Rewrite.
5397 (Output_segment::add_initial_output_data): Likewise.
5398 (Output_segment::has_any_data_sections): Likewise.
5399 (Output_segment::is_first_section_relro): Likewise.
5400 (Output_segment::maximum_alignment): Likewise.
5401 (Output_segment::has_dynamic_reloc): New function replacing
5402 dynamic_reloc_count. Change all callers.
5403 (Output_segment::has_dynamic_reloc_list): New function replacing
5404 dynamic_reloc_count_list. Change all callers.
5405 (Output_segment::set_section_addresses): Rewrite.
5406 (Output_segment::set_offset): Rewrite.
5407 (Output_segment::find_first_and_last_list): Remove.
5408 (Output_segment::set_tls_offsets): Rewrite.
5409 (Output_segment::first_section_load_address): Likewise.
5410 (Output_segment::output_section_count): Likewise.
5411 (Output_segment::section_with_lowest_load_address): Likewise.
5412 (Output_segment::write_section_headers): Likewise.
5413 (Output_segment::print_sections_to_map): Likewise.
5414 * output.h (class Output_data): Remove dynamic_reloc_count_
5415 field. Add has_dynamic_reloc_ field. Make bools into bitfields.
5416 (Output_data::add_dynamic_reloc): Rewrite.
5417 (Output_data::has_dynamic_reloc): New function.
5418 (Output_data::dynamic_reloc_count): Remove.
5419 (class Output_section): Add order_ field. Remvoe is_relro_local_,
5420 is_last_relro_, is_first_non_relro_, is_interp_,
5421 is_dynamic_linker_section_ fields. Add order and set_order
5422 functions. Remove is_relro_local, set_is_relro_local,
5423 is_last_relro, set_is_last_relro, is_first_non_relro,
5424 set_is_first_non_relro functions, is_interp, set_is_interp,
5425 is_dynamic_linker_section, and set_is_dynamic_linker_section
5426 functions.
5427 (class Output_segment): Change Output_data_list from std::list to
5428 std:;vector. Add output_lists_ field. Remove output_data_ and
5429 output_bss_ fields. Update declarations.
5430
5431 2010-08-02 Ian Lance Taylor <iant@google.com>
5432
5433 * arm.cc (Target_arm::gc_process_relocs): Use typename.
5434 * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5435 * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5436
5437 2010-08-02 Ian Lance Taylor <iant@google.com>
5438
5439 PR 11855
5440 * script.cc (Script_options::Script_options): Initialize
5441 symbol_definitions_ and symbol_references_.
5442 (Script_options::add_symbol_assignment): Update
5443 symbol_definitions_ and symbol_references_.
5444 (Script_options::add_symbol_reference): New function.
5445 (script_symbol): New function.
5446 * script.h (class Script_options): Add symbol_definitions_ and
5447 symbol_references_ fields.
5448 (Script_options::referenced_const_iterator): New type.
5449 (Script_options::referenced_begin): New function.
5450 (Script_options::referenced_end): New function.
5451 (Script_options::is_referenced): New function.
5452 (Script_options::any_unreferenced): New function.
5453 * script-c.h (script_symbol): Declare.
5454 * yyscript.y (exp): Call script_symbol.
5455 * symtab.cc: Include "script.h".
5456 (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5457 Change all callers. Check symbols referenced by scripts.
5458 (Symbol_table::add_undefined_symbols_from_command_line): Add
5459 layout parameter. Change all callers.
5460 (Symbol_table::do_add_undefined_symbols_from_command_line):
5461 Likewise. Break out loop body. Check symbols referenced by
5462 scripts.
5463 (Symbol_table::add_undefined_symbol_from_command_line): New
5464 function broken out of
5465 do_add_undefined_symbols_from_command_line.
5466 * symtab.h (class Symbol_table): Update declarations.
5467 * archive.cc: Include "layout.h".
5468 (Archive::should_include_member): Add layout parameter. Change
5469 all callers. Check for symbol mentioned in expression.
5470 * archive.h (class Archive): Update declaration.
5471 * object.cc (Sized_relobj::do_should_include_member): Add layout
5472 parameter.
5473 * object.h (Object::should_include_member): Add layout parameter.
5474 Change all callers.
5475 (Object::do_should_include_member): Add layout parameter.
5476 (class Sized_relobj): Update declaration.
5477 * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5478 parameter.
5479 * dynobj.h (class Sized_dynobj): Update declaration.
5480 * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5481 layout parameter.
5482 * plugin.h (class Sized_pluginobj): Update declaration.
5483
5484 2010-08-02 Ian Lance Taylor <iant@google.com>
5485
5486 PR 11866
5487 * output.cc (Output_segment::set_offset): Search for the first and
5488 last sections rather than assuming that the list is in order.
5489 (Output_segment::find_first_and_last_list): New function.
5490 * output.h (class Output_segment): Update declarations.
5491 * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5492 (relro_strip_test_SOURCES): New variable.
5493 (relro_strip_test_DEPENDENCIES): New variable.
5494 (relro_strip_test_LDFLAGS): New variable.
5495 (relro_strip_test_LDADD): New variable.
5496 (relro_strip_test.so): New target.
5497
5498 2010-08-02 Ian Lance Taylor <iant@google.com>
5499
5500 * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5501 (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5502 (Target_i386::got_tlsdesc_section): New function.
5503 (Target_i386::got_section): Create space for GOT entries for
5504 TLSDESC relocations.
5505 (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5506 R_386_TLS_GOTDESC.
5507 (Target_i386::Scan::global): Likewise.
5508 (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5509 using TLSDESC GOT.
5510 * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5511 (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5512 (Target_x86_64::got_tlsdesc_section): New function.
5513 (Target_x86_64::got_section): Create space for GOT entries for
5514 TLSDESC relocations.
5515 (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5516 R_386_TLS_GOTDESC.
5517 (Target_x86_64::Scan::global): Likewise.
5518 (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5519 using TLSDESC GOT.
5520
5521 2010-08-02 Ian Lance Taylor <iant@google.com>
5522
5523 * testsuite/final_layout.sh: Use dc to convert from hex to
5524 decimal.
5525
5526 2010-07-29 Sriraman Tallam <tmsriram@google.com>
5527
5528 * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5529 paramter to the call to gold::gc_process_relocs.
5530 * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5531 paramter to the call to gold::gc_process_relocs.
5532 * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5533 parameter to the call to gold::gc_process_relocs.
5534 * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5535 template parameter to the call to gold::gc_process_relocs.
5536 * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5537 paramter to the call to gold::gc_process_relocs.
5538 * gc.h (get_embedded_addend_size): New function.
5539 (gc_process_relocs): Save the size of the reloc for use by ICF.
5540 * icf.cc (get_section_contents): Get the addend from the text section
5541 for SHT_REL relocation sections.
5542 * icf.h (Icf::Reloc_addend_size_info): New typedef.
5543 (Icf::Reloc_info): Add new member reloc_addend_size_info.
5544 * int_encoding.h (read_from_pointer): New overloaded function.
5545 * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5546 * testsuite/icf_sht_rel_addend_test.sh: New file.
5547 * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5548 * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5549
5550 2010-07-28 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
5551
5552 * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5553 * Makefile.in: Regenerate.
5554 * testsuite/Makefile.in: Regenerate.
5555
5556 2010-07-27 Jeffrey Yasskin <jyasskin@google.com>
5557
5558 * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5559 * gold/testsuite/debug_msg.cc: Likewise.
5560 * gold/testsuite/odr_violation1.cc
5561 * gold/testsuite/odr_violation2.cc
5562
5563 2010-07-21 Cary Coutant <ccoutant@google.com>
5564
5565 * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5566 string, and length fields.
5567 (Output_merge_string::Merged_strings_list): New type.
5568 (Output_merge_string::Merged_strings_lists): New typedef.
5569 (Output_merge_string): Replace merged_strings_ with
5570 merged_strings_lists_.
5571 * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5572 Merged_strings_list per input object and section. Don't store pointer
5573 to the string. Don't store length with each merged string entry.
5574 (Output_merge_string::finalize_merged_data): Loop over list of merged
5575 strings lists. Recompute length of each merged string.
5576
5577 2010-07-15 Cary Coutant <ccoutant@google.com>
5578
5579 * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5580 here.
5581
5582 2010-07-14 Ian Lance Taylor <iant@google.com>
5583
5584 * descriptors.cc (Descriptors::open): Report correct name in error
5585 message.
5586
5587 2010-07-13 Doug Kwan <dougkwan@google.com>
5588
5589 * arm.cc (Arm_input_section::Arm_input_section): For a
5590 SHT_ARM_EXIDX section, always keeps the input sections.
5591 (Arm_input_section::set_exidx_section_link): New method.
5592 (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5593 has_errors_ to false.
5594 (Arm_exidx_input_section::has_errors,
5595 Arm_exidx_input_section::set_has_errors): New methods.
5596 (Arm_exidx_input_section::has_errors_): New data member.
5597 (Arm_relobj::get_exidx_shndx_list): New method.
5598 (Arm_output_section::append_text_sections_to_list): Do not skip
5599 section without SHF_EXECINSTR.
5600 (Arm_output_section::fix_exidx_coverage): Skip input sections with
5601 errors.
5602 (Arm_relobj::make_exidx_input_section): Add new parameter for text
5603 section header. Make error messages more verbose. Check for
5604 a non-executable section linked to an EXIDX section.
5605 (Arm_relobj::do_read_symbols): Remove error checking, which has been
5606 moved to Arm_relobj::make_exidx_input_section. Add an assertion to
5607 check that there is no deferred EXIDX section if we exit early.
5608 Instead of not making an EXIDX section in case of an error, make one
5609 and set the has_errors flag of it.
5610 (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5611 in a relocatable link.
5612 (Target_arm::do_relax): Look for the EXIDX output section instead of
5613 assuming that it is called .ARM.exidx.
5614 (Target_arm::fix_exidx_coverage): Add a new parameter for input
5615 section list. Do not check for SHF_EXECINSTR section flags but
5616 skip any input section with errors.
5617 * output.cc (Output_section::Output_section): Initialize
5618 always_keeps_input_sections_ to false.
5619 (Output_section::add_input_section): Check for
5620 always_keeps_input_sections_.
5621 * output.h (Output_section::always_keeps_input_sections,
5622 Output_section::set_always_keeps_input_sections): New methods.
5623 (Output_section::always_keeps_input_sections): New data member.
5624
5625 2010-07-13 Rafael Espindola <espindola@google.com>
5626
5627 * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5628 * fileread.h (Input_file): Add try_extra_search_path and find_file.
5629
5630 2010-07-13 Philip Herron <herron.philip@googlemail.com>
5631 Ian Lance Taylor <iant@google.com>
5632
5633 * output.h (Output_section_lookup_maps::add_merge_section):
5634 Correct check of whether value was inserted.
5635 (Output_section_lookup_maps::add_merge_input_section): Likewise.
5636 (Output_section_lookup_maps::add_relaxed_input_section):
5637 Likewise.
5638 * arm.cc (Target_arm::got_section): Remove used local os.
5639 * i386.cc (Target_i386::got_section): Likewise.
5640 * x86_64.cc (Target_x86_64::got_section): Likewise.
5641 * sparc.cc (Target_sparc::got_section): Likewise.
5642 (Target_sparc::relocate): Remove unused local have_got_offset.
5643 * powerpc.cc (Target_powerpc::relocate): Likewise.
5644
5645 2010-07-13 Ian Lance Taylor <iant@google.com>
5646
5647 * compressed_output.cc (zlib_decompress): Fix signature in
5648 !HAVE_ZLIB_H case.
5649
5650 * archive.cc (Archive::include_member): Unlock an external member
5651 of a thin archive. Don't bother to delete an object we know is
5652 NULL.
5653
5654 2010-07-12 Cary Coutant <ccoutant@google.com>
5655
5656 * compressed_output.cc (zlib_decompress): New function.
5657 (get_uncompressed_size): New function.
5658 (decompress_input_section): New function.
5659 * compressed_output.h (get_uncompressed_size): New function.
5660 (decompress_input_section): New function.
5661 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5662 Handle compressed debug sections.
5663 * layout.cc (is_compressed_debug_section): New function.
5664 (Layout::output_section_name): Map compressed section names to
5665 canonical names.
5666 * layout.h (is_compressed_debug_section): New function.
5667 (is_debug_info_section): Recognize compressed debug sections.
5668 * merge.cc: Include compressed_output.h.
5669 (Output_merge_data::do_add_input_section): Handle compressed
5670 debug sections.
5671 (Output_merge_string::do_add_input_section): Handle compressed
5672 debug sections.
5673 * object.cc: Include compressed_output.h.
5674 (Sized_relobj::Sized_relobj): Initialize new data members.
5675 (build_compressed_section_map): New function.
5676 (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5677 * object.h (Object::section_is_compressed): New method.
5678 (Object::do_section_is_compressed): New method.
5679 (Sized_relobj::Compressed_section_map): New type.
5680 (Sized_relobj::do_section_is_compressed): New method.
5681 (Sized_relobj::compressed_sections_): New data member.
5682 * output.cc (Output_section::add_input_section): Handle compressed
5683 debug sections.
5684 * reloc.cc: Include compressed_output.h.
5685 (Sized_relobj::write_sections): Handle compressed debug sections.
5686
5687 2010-07-08 Cary Coutant <ccoutant@google.com>
5688
5689 * resolve.cc (Symbol_table::resolve): Remember whether undef was
5690 weak when resolving to a dynamic def.
5691 (Symbol_table::should_override): Add adjust_dyndef flag; set it
5692 for weak undef/dynamic def cases. Adjust callers.
5693 * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5694 undef_binding_weak_.
5695 (Symbol_table::sized_write_globals): Adjust symbol binding.
5696 (Symbol_table::sized_write_symbol): Add binding parameter.
5697 * symtab.h (Symbol::set_undef_binding): New method.
5698 (Symbol::is_undef_binding_weak): New method.
5699 (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5700 (Symbol_table::should_override): Add new parameter.
5701 (Symbol_table::sized_write_symbol): Add new parameter.
5702
5703 * testsuite/weak_undef_file1.cc: Add new test case.
5704 * testsuite/weak_undef_file2.cc: Fix header comment.
5705 * testsuite/weak_undef_test.cc: Add new test case.
5706
5707 2010-06-29 Doug Kwan <dougkwan@google.com>
5708
5709 * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5710 Initialize USE_SYMBOL_.
5711 * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5712 definition.
5713 (Arm_reloc_property::uses_symbol_): New data member declaration.
5714 * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5715 uses symbol value and symbol is undefined but not weakly undefined.
5716
5717 2010-06-28 Rafael Espindola <espindola@google.com>
5718
5719 * plugin.cc (Plugin::load): Use dlerror.
5720
5721 2010-06-26 Jeffrey Yaskin <jyasskin@google.com>
5722
5723 * symtab.cc (detect_odr_violations): When reporting an ODR
5724 violation, report an object where the symbol is defined.
5725
5726 2010-06-25 Doug Kwan <dougkwan@google.com>
5727
5728 * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5729 (Target_arm::section_may_have_icf_unsafe_pointers): New method
5730 definition.
5731 (Target_arm::Scan::local_reloc_may_be_function_pointer,
5732 Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5733 target hook to detect function points.
5734 (Target_arm::Scan::possible_function_pointer_reloc): New method.
5735 * icf.h (Icf::check_section_for_function_pointers): Change type of
5736 parameter SECTION_NAME to const reference to std::string. Use
5737 target hook to determine if section may have unsafe pointers.
5738 * target.h (Target::section_may_have_icf_unsafe_pointers): New
5739 method definition.
5740
5741 2010-06-21 Rafael Espindola <espindola@google.com>
5742
5743 * fileread.cc (Input_file::find_fie): New
5744 (Input_file::open): Use Input_file::find_fie.
5745 * fileread.h (Input_file::find_fie): New
5746 * plugin.cc (set_extra_library_path): New.
5747 (Plugin::load): Add set_extra_library_path to the transfer vector.
5748 (Plugin_manager::set_extra_library_path): New.
5749 (Plugin_manager::add_input_file): Use the extra search path if set.
5750 (set_extra_library_path(): New.
5751 * plugin.h (Plugin_manager): Add set_extra_library_path and
5752 extra_search_path_.
5753
5754 2010-06-19 Cary Coutant <ccoutant@google.com>
5755
5756 * layout.cc (gdb_sections): Add .debug_types.
5757 (lines_only_debug_sections): Likewise.
5758
5759 2010-06-18 Rafael Espindola <espindola@google.com>
5760
5761 * plugin.cc (add_input_file,add_input_library)
5762 (Plugin_manager::add_input_file): Make filename arguments const.
5763 * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5764 const.
5765
5766 2010-06-16 Doug Kwan <dougkwan@google.com>
5767
5768 * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5769 .ARM.attributes section if we have not merged any input
5770 attributes sections.
5771
5772 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5773
5774 * arm.cc: Allow combining objects with no EABI version
5775 information.
5776
5777 2010-06-15 Rafael Espindola <espindola@google.com>
5778
5779 * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5780
5781 2010-06-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5782
5783 * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5784 (struct iovec): Correct !HAVE_READV definition.
5785
5786 2010-06-10 Cary Coutant <ccoutant@google.com>
5787
5788 * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5789 (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5790 reloc sections.
5791 * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5792
5793 PR 11683
5794 * symtab.h (Symbol::is_placeholder): New member function.
5795 * target-reloc.h (relocate_section): Check for placeholder symbols.
5796
5797 * testsuite/Makefile.am (plugin_test_8): New test.
5798 (plugin_test_9): New test.
5799 * testsuite/Makefile.in: Regenerate.
5800
5801 2010-06-09 Nick Clifton <nickc@redhat.com>
5802
5803 * yyscript.y (input_list_element): Allow strings prefixed with
5804 the '-' character. Treat these as libraries.
5805 * script.cc (script_add_library): New function. Adds a library
5806 specified by "-l<name>" found in an input script.
5807 * script-c.h: Add prototype for script_add_library.
5808
5809 2010-06-07 Doug Kwan <dougkwan@google.com>
5810
5811 * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5812 Restrict stub-group size to be within long conditional branch
5813 range when working around cortex-A8 erratum.
5814
5815 2010-06-07 Damien Diederen <dd@crosstwine.com>
5816
5817 * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5818 #ifdef typo.
5819
5820 2010-06-03 Sriraman Tallam <tmsriram@google.com>
5821
5822 PR gold/11658
5823 * output.cc
5824 (Output_section::Input_section_sort_entry::compare_section_ordering):
5825 Change to return non-zero correctly.
5826 (Output_section::Input_section_sort_section_order_index_compare
5827 ::operator()): Change to fix ambiguity in comparisons.
5828
5829 2010-06-01 Sriraman Tallam <tmsriram@google.com>
5830
5831 * gold.h (is_wildcard_string): New function.
5832 * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5833 (Layout::layout_eh_frame): Ditto.
5834 (Layout::find_section_order_index): New method.
5835 (Layout::read_layout_from_file): New method.
5836 * layout.h (Layout::find_section_order_index): New method.
5837 (Layout::read_layout_from_file): New method.
5838 (Layout::input_section_position_): New private member.
5839 (Layout::input_section_glob_): New private member.
5840 * main.cc (main): Call read_layout_from_file here.
5841 * options.h (--section-ordering-file): New option.
5842 * output.cc (Output_section::input_section_order_specified_): New
5843 member.
5844 (Output_section::Output_section): Initialize new member.
5845 (Output_section::add_input_section): Add new parameter.
5846 Keep input sections when --section-ordering-file is used.
5847 (Output_section::set_final_data_size): Sort input sections when
5848 section ordering file is specified.
5849 (Output_section::Input_section_sort_entry): Add new parameter.
5850 Check sorting type.
5851 (Output_section::Input_section_sort_entry::compare_section_ordering):
5852 New method.
5853 (Output_section::Input_section_sort_compare::operator()): Change to
5854 consider section_order_index.
5855 (Output_section::Input_section_sort_init_fini_compare::operator()):
5856 Change to consider section_order_index.
5857 (Output_section::Input_section_sort_section_order_index_compare
5858 ::operator()): New method.
5859 (Output_section::sort_attached_input_sections): Change to sort
5860 according to section order when specified.
5861 (Output_section::add_input_section<32, true>): Add new parameter.
5862 (Output_section::add_input_section<64, true>): Add new parameter.
5863 (Output_section::add_input_section<32, false>): Add new parameter.
5864 (Output_section::add_input_section<64, false>): Add new parameter.
5865 * output.h (Output_section::add_input_section): Add new parameter.
5866 (Output_section::input_section_order_specified): New
5867 method.
5868 (Output_section::set_input_section_order_specified): New method.
5869 (Input_section::Input_section): Initialize section_order_index_.
5870 (Input_section::section_order_index): New method.
5871 (Input_section::set_section_order_index): New method.
5872 (Input_section::section_order_index_): New member.
5873 (Input_section::Input_section_sort_section_order_index_compare): New
5874 struct.
5875 (Output_section::input_section_order_specified_): New member.
5876 * script-sections.cc (is_wildcard_string): Delete and move modified
5877 method to gold.h.
5878 (Output_section_element_input::Output_section_element_input): Modify
5879 call to is_wildcard_string.
5880 (Output_section_element_input::Input_section_pattern
5881 ::Input_section_pattern): Ditto.
5882 (Output_section_element_input::Output_section_element_input): Ditto.
5883 * testsuite/Makefile.am (final_layout): New test case.
5884 * testsuite/Makefile.in: Regenerate.
5885 * testsuite/final_layout.cc: New file.
5886 * testsuite/final_layout.sh: New file.
5887
5888 2010-06-01 Rafael Espindola <espindola@google.com>
5889
5890 * plugin.cc (Plugin::load): Pass the output name to the plugin.
5891
5892 2010-06-01 Rafael Espindola <espindola@google.com>
5893
5894 * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5895 visibility of symbols.
5896
5897 2010-05-27 Doug Kwan <dougkwan@google.com>
5898
5899 * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5900 from start of output section instead of address for a local symbol
5901 in a merged or relaxed section when doing a relocatable link.
5902
5903 2010-05-26 Rafael Espindola <espindola@google.com>
5904
5905 PR 11604
5906 * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5907 adding sections the garbage collector removed.
5908 * gold/testsuite/Makefile.am: Add test.
5909 * gold/testsuite/Makefile.in: Regenerate.
5910 * gold/testsuite/plugin_test_7.sh: New.
5911 * gold/testsuite/plugin_test_7_1.c: New.
5912 * gold/testsuite/plugin_test_7_2.c: New.
5913
5914 2010-05-26 Rafael Espindola <espindola@google.com>
5915
5916 * script-sections.cc (Output_section_definition::set_section_addresses):
5917 Check for --section-start.
5918
5919 2010-05-26 Doug Kwan <dougkwan@google.com>
5920
5921 * arm.cc (Arm_scan_relocatable_relocs): New class.
5922 (Target_arm::relocate_special_relocatable): New method.
5923 (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5924 (Arm_relocate_functions::thumb_branch_common): Same.
5925 (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5926 instead of Default_scan_relocatable_relocs.
5927 * target-reloc.h (relocate_for_relocatable): Let target handle
5928 relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5929 * target.h (Sized_target::relocate_special_relocatable): New method.
5930
5931 2010-05-25 Viktor Kutuzov <vkutuzov@accesssoftek.com>
5932
5933 * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5934
5935 2010-05-23 Doug Kwan <dougkwan@google.com>
5936
5937 * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5938 instead of a cast.
5939 (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5940 with a direct branch, not a conditional branch, to a stub.
5941 * merge.cc (Output_merge_base::record_input_section): New method
5942 defintion.
5943 (Output_merge_data::do_add_input_section): Record input section if
5944 keeps-input-sections flag is set.
5945 (Output_merge_string::do_add_input_section): Ditto.
5946 * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5947 members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5948 INPUT_SECTIONS_.
5949 (Output_merge_base::keeps_input_sections,
5950 Output_merge_base::set_keeps_input_sections,
5951 Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5952 method definitions.
5953 (Output_merge_base::Input_sections): New type declaration.
5954 (Output_merge_base::input_sections_begin,
5955 Output_merge_base::input_sections_end,
5956 Output_merge_base::do_set_keeps_input_sections): New method definitions.
5957 (Output_merge_base::bool keeps_input_sections_,
5958 Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5959 Output_merge_base::input_sections_): New data members.
5960 (Output_merge_data::do_set_keeps_input_sections): New method
5961 defintion.
5962 (Output_merge_string::do_set_keeps_input_sections): Ditto.
5963 * output.cc (Output_section::Input_section::relobj): Move method
5964 defintion from class declaration to here and handle merge sections.
5965 (Output_section::Input_section::shndx): Ditto.
5966 (Output_section::Output_section): Remove initializations of removed
5967 data members and initialize new data member LOOKUP_MAPS_.
5968 (Output_section::add_input_section): Set keeps-input-sections flag
5969 for a newly created merge output section as appropriate. Adjust code
5970 to use Output_section_lookup_maps class.
5971 (Output_section::add_relaxed_input_section): Adjst code for lookup
5972 maps code refactoring.
5973 (Output_section::add_merge_input_section): Add a new parameter
5974 KEEPS_INPUT_SECTION. Adjust code to use Output_section_lookup_maps
5975 class. If adding input section to a newly created merge output
5976 section fails, remove the new merge section.
5977 (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5978 Adjust code for use of the Output_section_lookup_maps class.
5979 (Output_section::find_merge_section): Ditto.
5980 (Output_section::build_lookup_maps): New method defintion.
5981 (Output_section::find_relaxed_input_section): Adjust code to use
5982 Output_section_lookup_maps class.
5983 (Output_section::get_input_sections): Export merge sections. Adjust
5984 code to use Output_section_lookup_maps class.
5985 (Output_section:::add_script_input_section): Adjust code to use
5986 Output_section_lookup_maps class. Update lookup maps for merge
5987 sections also.
5988 (Output_section::discard_states): Use Output_section_lookup_maps.
5989 (Output_section::restore_states): Same.
5990 * output.h (Merge_section_properties): Move class defintion out of
5991 Output_section.
5992 (Output_section_lookup_maps): New class.
5993 (Output_section::Input_section::is_merge_section): New method
5994 defintion.
5995 (Output_section::Input_section::relobj): Move defintion out of class
5996 defintion. Declare method only.
5997 (Output_section::Input_section::shndx): Ditto.
5998 (Output_section::Input_section::output_merge_base): New method defintion.
5999 (Output_section::Input_section::u2_.pomb): New union field.
6000 (Output_section::Merge_section_by_properties_map,
6001 Output_section::Output_section_data_by_input_section_map,
6002 Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6003 Remove types.
6004 (Output_section::add_merge_input_section): Add new parameter
6005 KEEPS_INPUT_SECTIONS.
6006 (Output_section::build_lookup_maps): New method declaration.
6007 (Output_section::merge_section_map_,
6008 Output_section::merge_section_by_properties_map_,
6009 Output_section::relaxed_input_section_map_,
6010 Output_section::is_relaxed_input_section_map_valid_): Remove data
6011 members.
6012 (Output_section::lookup_maps_): New data member.
6013
6014 2010-05-21 Doug Kwan <dougkwan@google.com>
6015
6016 PR gold/11619
6017 * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6018 avoid a compilation error.
6019
6020 2010-05-19 Rafael Espindola <espindola@google.com>
6021
6022 * script-sections.cc (Output_section_definition::allocate_to_segment):
6023 Update the phdrs_list even when the output section is NULL.
6024 * testsuite/Makefile.am: Add test.
6025 * testsuite/Makefile.in: Regenerate.
6026 * testsuite/script_test_9.cc: New.
6027 * testsuite/script_test_9.sh: New.
6028 * testsuite/script_test_9.t: New.
6029
6030 2010-05-19 Doug Kwan <dougkwan@google.com>
6031
6032 * arm.cc (Arm_input_section::original_size): New method.
6033 (Arm_input_section::do_addralign): Add a cast.
6034 (Arm_input_section::do_output_offset): Remove static cast.
6035 (Arm_input_section::original_addralign,
6036 Arm_input_section::original_size_): Change type to uint32_t.
6037 (Arm_input_section::init): Add safe casts for section alignment
6038 and size.
6039 (Arm_input_section::set_final_data_size): Do not set address and
6040 offset of stub table.
6041 (Arm_output_section::fix_exidx_coverage): Change use of of
6042 Output_section::Simple_input_section to that of
6043 Output_section::Input_section.
6044 (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6045 except for the first pass.
6046 * output.cc (Output_section::get_input_sections): Change type of
6047 input_sections to std::list<Input_section>.
6048 (Output_section::add_script_input_section): Rename from
6049 Output_section::add_simple_input_section. Change type of SIS
6050 parameter from Simple_input_section to Input_section.
6051 * output.h (Output_section::Simple_input_section): Remove class.
6052 (Output_section::Input_section): Change class visibility to public.
6053 (Output_section::Input_section::addralign): Use stored alignments
6054 for special input sections if set.
6055 (Output_section::Input_section::set_addralign): New method.
6056 (Output_section::get_input_sections): Change parameter type from
6057 list of Simple_input_section to list of Input_section.
6058 (Output_section::add_script_input_section): Rename from
6059 Output_section::add_simple_input_section. Change first parameter's
6060 type from Simple_input_section to Input_section and remove the
6061 second and third parameters.
6062 * script-sections.cc (Input_section::Input_section_list): Change
6063 type to list of Output_section::Input_section/
6064 (Input_section_info::Input_section_info): Change parameter type of
6065 INPUT_SECTION to Output_section::Input_section.
6066 (Input_section_info::input_section): Change return type.
6067 (Input_section_info::input_section_): Change type to
6068 Output_section::Input_section.
6069 (Output_section_element_input::set_section_addresses): Adjust code
6070 to use Output_section::Input_section instead of
6071 Output_section::Simple_input_section. Adjust code for renaming
6072 of Output_section::add_simple_input_section.
6073 (Orphan_output_section::set_section_addresses): Ditto.
6074
6075 2010-05-18 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6076
6077 * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6078 when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6079
6080 2010-05-18 Rafael Espindola <espindola@google.com>
6081
6082 * options.cc (General_options::finalize): Handle -nostdlib.
6083 * options.h (nostdlib): New option.
6084 * script.cc (script_add_search_dir): Handle -nostdlib.
6085
6086 2010-05-12 Doug Kwan <dougkwan@google.com>
6087
6088 * arm.cc (Target_arm::do_finalize_sections): Create an empty
6089 attributes section only if there no attributes section after merging.
6090 (Target_arm::merge_object_attributes): Move value of
6091 Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6092 Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6093 * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6094 (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6095 and arm_attr_merge_7.stdout.
6096 (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6097 arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6098 arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6099 arm_attr_merge_7b.o): New rules.
6100 (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6101 arm_attr_merge_7
6102 * testsuite/Makefile.in: Regenerate.
6103 * testsuite/arm_attr_merge.sh: New file.
6104 * testsuite/arm_attr_merge_[67][ab].s: Same.
6105
6106 2010-05-05 Nick Clifton <nickc@redhat.com>
6107
6108 * po/es.po: Updated Spanish translation.
6109
6110 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6111
6112 * Makefile.am (install-exec-local): Properly install gold as
6113 default cross linker.
6114 * Makefile.in: Regenerated.
6115
6116 2010-04-27 H.J. Lu <hongjiu.lu@intel.com>
6117 Nick Clifton <nickc@redhat.com>
6118
6119 * configure.ac (install_as_default): Define and set to false
6120 unless --enable-gold or --enable-gold=both/gold has been
6121 specified.
6122 * configure: Regenerate.
6123
6124 * Makefile.am (install-exec-local): Install the executable as
6125 'ld.gold'. If install_as_default is true then also install it as
6126 'ld'.
6127 * Makefile.in: Regenerated.
6128
6129 2010-04-24 Ian Lance Taylor <iant@google.com>
6130
6131 * layout.cc (Layout::layout_reloc): In relocatable link don't
6132 combine reloc sections for grouped sections.
6133
6134 2010-04-23 Sriraman Tallam <tmsriram@google.com>
6135
6136 * gc.h (gc_process_relocs): Pass information on relocs pointing to
6137 sections that are not ordinary to icf.
6138 * icf.cc (get_section_contents): Handle relocation pointing to section
6139 with no object or shndx information.
6140 * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6141 * testsuite/Makefile.in: Regenerate.
6142 * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6143 * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6144
6145 2010-04-22 Ian Lance Taylor <iant@google.com>
6146
6147 * expression.cc (Expression::Expression_eval_info): Add
6148 result_alignment_pointer field.
6149 (Expression::eval_with_dot): Add result_alignment_pointer
6150 parameter. Change all callers.
6151 (Expression::eval_maybe_dot): Likewise.
6152 (class Binary_expression): Add alignment_pointer parameter to
6153 left_value and right_value. Change all callers.
6154 (BINARY_EXPRESSION): Set result alignment.
6155 (class Trinary_expression): Add alignment_pointer parameter to
6156 arg2_value and arg3_value. Change all callers.
6157 (Trinary_cond::value): Set result alignment.
6158 (Max_expression::value, Min_expression::value): Likewise.
6159 (Align_expression::value): Likewise.
6160 * script-sections.cc (class Sections_element): Add dot_alignment
6161 parameter to set_section_addresses virtual function. Update
6162 instantiations.
6163 (class Output_section_element): Likewise.
6164 (Script_sections::create_segments): Add dot_alignment parameter.
6165 Change all callers.
6166 (Script_sections::create_segments_from_phdrs_clause): Likewise.
6167 (Script_sections::set_phdrs_clause_addresses): Likewise.
6168 * script-sections.h: Update declarations.
6169 * script.h: Update declarations.
6170 * output.h (Output_segment::set_minimum_p_align): Don't decrease
6171 min_p_align.
6172 * testsuite/script_test_3.t: Set large alignment.
6173 * testsuite/script_test_3.sh: Make sure that at least one LOAD
6174 segment has expected alignment.
6175
6176 2010-04-22 Nick Clifton <nickc@redhat.com>
6177
6178 * po/gold.pot: Updated by the Translation project.
6179 * po/vi.po: Updated Vietnamese translation.
6180
6181 2010-04-22 H.J. Lu <hongjiu.lu@intel.com>
6182
6183 * testsuite/Makefile.am (check_PROGRAMS): Add
6184 icf_virtual_function_folding_test.
6185 * testsuite/Makefile.in: Regenerated.
6186
6187 2010-04-15 Andrew Haley <aph@redhat.com>
6188
6189 * options.h (merge_exidx_entries): New option.
6190 * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6191 (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6192 (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6193 (Target_arm::merge_exidx_entries): New function.
6194 (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6195 (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6196 to Arm_exidx_fixup constructor.
6197 Add new arg, merge_exidx_entries.
6198 (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6199 Arm_output_section::fix_exidx_coverage.
6200
6201 2010-04-18 Sriraman Tallam <tmsriram@google.com>
6202
6203 * icf.cc (get_section_contents): Check for preemptible functions.
6204 Ignore addend when appropriate.
6205 * symtab.cc (should_add_dynsym_entry): Add new parameter. Check for
6206 section folded.
6207 (add_from_relobj): Check for section folded.
6208 (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6209 * symtab.h (should_add_dynsym_entry): Add new parameter.
6210 * target-reloc.h (scan_relocs): Check for section folded.
6211 * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6212 Check reloc types for function pointers in shared objects.
6213 * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6214 case.
6215 (icf_preemptible_functions_test): New test case.
6216 (icf_string_merge_test): New test case.
6217 * testsuite.Makefile.in: Regenerate.
6218 * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6219 bar_glob. Refactor code.
6220 * testsuite/icf_preemptible_functions_test.cc: New file.
6221 * testsuite/icf_preemptible_functions_test.sh: New file.
6222 * testsuite/icf_string_merge_test.cc: New file.
6223 * testsuite/icf_string_merge_test.sh: New file.
6224 * testsuite/icf_virtual_function_folding_test.cc: New file.
6225 * testsuite/icf_virtual_function_folding_test.sh: New file.
6226
6227 2010-04-14 Doug Kwan <dougkwan@google.com>
6228
6229 * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6230 for local symbol recounting if we remove a section due to ICF.
6231 * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6232 there are no regular objects in input.
6233
6234 2010-04-13 Doug Kwan <dougkwan@google.com>
6235
6236 * arm.cc (Arm_input_section::set_final_data_size): Compute
6237 accurate final data size instead of using current data size.
6238
6239 2010-04-09 Doug Kwan <dougkwan@google.com>
6240
6241 * layout.cc (Layout::choose_output_section): Handle script section
6242 types.
6243 (Layout::make_output_section_for_script): Add section type parameter.
6244 Handle script section types.
6245 * layout.h (Layout::make_output_section_for_script): Add section
6246 type parameter.
6247 * output.cc (Output_section::Output_section): Initialize data member
6248 is_noload_.
6249 (Output_section::do_reset_address_and_file_offset): Do not set address
6250 to 0 if section is a NOLOAD section.
6251 * output.h (Output_section::is_noload): New method.
6252 (Output_section::set_is_noload): Ditto.
6253 (Output_section::is_noload_): New data member.
6254 * script-c.h (Script_section_type): New enum type.
6255 (struct Parser_output_section_header): Add new file section_type.
6256 * script-sections.cc (Sections_element::output_section_name): Add
6257 parameter for returning script section type.
6258 (Output_section_definition::output_section_name): Ditto.
6259 (Output_section_definition::section_type)P; New method.
6260 (Output_section_definiton::script_section_type_name): Ditto.
6261 (Output_section_definition::script_section_type_): New data member.
6262 (Output_section_definition::Output_section_definition): Initialize
6263 data member Output_section_definition::script_section_type_.
6264 (Output_section_definition::create_sections): Pass script section type
6265 to Layout::make_output_section_for_script.
6266 (Output_section_definition::output_section_name): Return script
6267 section type to caller.
6268 (Output_section_definition::set_section_address): Do not advance
6269 dot value and load address if section type is NOLOAD. Set address
6270 of NOLOAD sections regardless of section flags.
6271 (Output_section_definition::print): Print section type if it is
6272 not SCRIPT_SECTION_TYPE_NONE.
6273 (Output_section_definition::section_type): New method.
6274 (Output_section_definition::script_section_type_name): Ditto.
6275 (Script_sections::output_section_name): Add new parameter
6276 PSECTION_TYPE for returning script section type. Pass it to
6277 section elements. Handle discard sections.
6278 (Sort_output_sections::operator()): Handle NOLOAD sections.
6279 * script-sections.h (Script_sections::Section_type): New enum type.
6280 (Script_sections::output_section_name): Add a new parameter for
6281 returning script section type.
6282 * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6283 INFO and NOLOAD.
6284 * yyscript.y (union): Add new field SECTION_TYPE.
6285 (COPY, DSECT, INFO, NOLOAD): New tokens.
6286 (opt_address_and_section_type): Change type to output_section_header.
6287 (section_type): New non-terminal
6288 (section_header): Handle section type.
6289 (opt_address_and_section_type): Return section type value.
6290
6291 2010-04-09 H.J. Lu <hongjiu.lu@intel.com>
6292
6293 * testsuite/plugin_common_test_1.c (foo): Add prototype.
6294 * testsuite/plugin_common_test_2.c (foo): Likewise.
6295
6296 2010-04-08 Doug Kwan <dougkwan@google.com>
6297
6298 * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6299 Output_merge_data.
6300 * output.cc (Output_section::add_merge_input_section): Simplify
6301 code and return status of Output_merge_base::add_input_section.
6302 Update merge section map only if Output_merge_base::add_input_section
6303 returns true.
6304
6305 2010-04-07 Doug Kwan <dougkwan@google.com>
6306
6307 * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6308 if section is marked as containing instructions but has no mapping
6309 symbols.
6310 (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6311 correct section index.
6312 (Arm_relobj::find_linked_text_section): Ditto.
6313
6314 2010-04-07 Cary Coutant <ccoutant@google.com>
6315
6316 * archive.cc (include_member): Destroy Read_symbols_data object before
6317 releasing file.
6318 * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6319 * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6320 (Read_symbols_data::~Read_symbols_data) New destructor.
6321 (Section_relocs::Section_relocs) New constructor.
6322 (Section_relocs::~Section_relocs) New destructor.
6323 (Read_relocs_data::Read_relocs_data) New constructor.
6324 (Read_relocs_data::~Read_relocs_data) New destructor.
6325 * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6326 pointers to NULL after deleting.
6327
6328 2010-04-07 Doug Kwan <dougkwan@google.com>
6329
6330 * arm.cc: Replace "endianity" with "endianness" in comments.
6331 (Arm_exidx_cantunwind): Ditto.
6332 (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6333 (Arm_relobj::merge_flags_and_attributes): New method.
6334 (Arm_relobj::merge_flags_and_attributes_): New data member.
6335 (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6336 (Arm_relobj::scan_sections_for_stubs): Ditto.
6337 (Arm_relobj::do_read_symbols): Check to see if we really want to
6338 merge processor-specific flags and attributes. Exit early if
6339 an object is empty except for section names and the undefined symbol.
6340 (Target_arm::do_finalize_sections): Move check for ELF format to
6341 Arm_relobj::do_read_symbols. Merge processor specific flags and
6342 attributes from a regular object only when we have determined that
6343 it is aapropriate. Do not create an .ARM.attributes section in
6344 output if there is no regular input object.
6345 (Target_arm::merge_processor_specific_flags): Check
6346 --warn-mismatch before printing any error.
6347 (Target_arm::merge_object_attributes): Ditto.
6348 * gold.cc (queue_middle_tasks): Handle the case in which there is
6349 no regular object in input.
6350 * options.cc (General_options::parse_EB): New method.
6351 (General_options::parse_EL): Same.
6352 (General_options::General_options): Initialize endianness_.
6353 * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6354 New options.
6355 (General_options::Endianness): New enum.
6356 (General_options::endianness): New method.
6357 (General_options::endianness_): New data member.
6358 * parameters.cc (Parameters::set_options): Check target endianness.
6359 (Parameters::set_target_once): Ditto.
6360 (Parameters::check_target_endianness): New method.
6361 (parameters_force_valid_target): If either -EL or -EB is specified,
6362 use it to define endianness of default target.
6363 * parameters.h (Parameters::check_target_endianness): New method
6364 declaration.
6365 * target.h (class Target): Change "endianity" to "endianness"
6366 in comments.
6367
6368 2010-04-07 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
6369
6370 * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6371 * configure: Regenerate.
6372 * Makefile.in: Regenerate.
6373 * testsuite/Makefile.in: Regenerate.
6374
6375 2010-04-06 Cary Coutant <ccoutant@google.com>
6376
6377 gcc PR lto/42757
6378 * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6379 prevailing definitions of common symbols.
6380 * testsuite/plugin_test_6.sh: New test case.
6381 * testsuite/plugin_common_test_1.c: New test case.
6382 * testsuite/plugin_common_test_2.c: New test case.
6383 * testsuite/Makefile.am (plugin_test_6): New test case.
6384 * testsuite/Makefile.in: Regenerate.
6385
6386 2010-04-06 Nick Clifton <nickc@redhat.com>
6387
6388 * po/vi.po: New Vietnamese translation.
6389
6390 2010-03-30 Doug Kwan <dougkwan@google.com>
6391
6392 * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6393
6394 2010-03-25 Doug Kwan <dougkwan@google.com>
6395
6396 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6397 to avoid a conversion warning on a 32-bit host.
6398
6399 2010-03-24 Ian Lance Taylor <iant@google.com>
6400
6401 * testsuite/script_test_3.t: Add a TLS segment.
6402 * testsuite/Makefile.am (check_PROGRAMS): Add
6403 tls_phdrs_script_test.
6404 (tls_phdrs_script_test_SOURCES): Define.
6405 (tls_phdrs_script_test_DEPENDENCIES): Define.
6406 (tls_phdrs_script_test_LDFLAGS): Define.
6407 (tls_phdrs_script_test_LDADD): Define.
6408 * testsuite/Makefile.in: Rebuild.
6409
6410 2010-03-23 Cary Coutant <ccoutant@google.com>
6411
6412 * fileread.cc (find_or_make_view): Fix comment.
6413
6414 2010-03-23 Ian Lance Taylor <iant@google.com>
6415
6416 * script-sections.cc (class Orphan_section_placement): Define
6417 PLACE_TLS and PLACE_TLS_BSS.
6418 (Orphan_section_placement::Orphan_section_placement): Initialize
6419 new places.
6420 (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6421 * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6422 (tls_script_test_SOURCES): Define.
6423 (tls_script_test_DEPENDENCIES): Define.
6424 (tls_script_test_LDFLAGS): Define.
6425 (tls_script_test_LDADD): Define.
6426 * testsuite/Makefile.in: Rebuild.
6427
6428 2010-03-22 Doug Kwan <dougkwan@google.com>
6429
6430 * arm.cc (Arm_relocate_functions::abs8,
6431 Arm_relocate_functions::abs16): Use correct check for overflow
6432 specified in the ARM ELF specs.
6433 (Arm_relocate_functions): thumb_branch_common. Handle bit 1 of branch
6434 target of a BLX instruction specially.
6435 (Reloc_stub::stub_type_for_reloc): Ditto.
6436 (Relocate::relocate): Use symbolic names instead of numeric relocation
6437 codes to report error.
6438 (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6439 workaround.
6440 * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6441 thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6442 thumb2_blx_out_of_range.stdout
6443 (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6444 thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6445 (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6446 thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6447 thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6448 thumb2_blx_in_range, thumb2_blx_in_range.o,
6449 thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6450 thumb2_blx_out_of_range.o): New rules.
6451 (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6452 thumb2_blx_in_range and thumb2_blx_out_of_range.
6453 * testsuite/Makefile.in: Regenerate.
6454 * arm_branch_in_range.sh: Add tests for THUMB BLX.
6455 * testsuite/thumb_blx_in_range.s: New file.
6456 * testsuite/thumb_blx_out_of_range.s: New file.
6457
6458 2010-03-22 Rafael Espindola <espindola@google.com>
6459
6460 * archive.cc (Should_include): Move to archive.h.
6461 (should_include_member): Make it a member of Archive.
6462 (Lib_group): New.
6463 (Add_lib_group_symbols): New.
6464 * archive.h: Include options.h.
6465 (Archive_member): Moved from Archive.
6466 (Should_include): Moved from archive.cc.
6467 (Lib_group): New.
6468 (Add_lib_group_symbols): New.
6469 * dynobj.cc (do_should_include_member): New.
6470 * dynobj.h (do_should_include_member): New.
6471 * gold.cc (queue_initial_tasks): Update call to queue.
6472 * main.cc (main): Print lib group stats.
6473 * object.cc (do_should_include_member): New.
6474 * object.h: Include archive.h.
6475 (Object::should_include_member): New.
6476 (Object::do_should_include_member): New.
6477 (Sized_relobj::do_should_include_member): New.
6478 * options.cc (General_options::parse_start_lib): New.
6479 (General_options::parse_end_lib): New.
6480 (Input_arguments::add_file): Handle lib groups.
6481 (Input_arguments::start_group): Check we are not in a lib.
6482 (Input_arguments::start_lib): New.
6483 (Input_arguments::end_lib): New.
6484 * options.h (General_options): Add start_lib and end_lib.
6485 (Input_argument::lib_): New.
6486 (Input_argument::lib): New.
6487 (Input_argument::is_lib): New.
6488 (Input_file_lib): New.
6489 (Input_arguments::in_lib_): New.
6490 (Input_arguments::in_lib): New.
6491 (Input_arguments::start_lib): New.
6492 (Input_arguments::end_lib_): New.
6493 * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6494 in unused members as preempted.
6495 (Sized_pluginobj::do_should_include_member): New.
6496 * plugin.h (Sized_pluginobj::do_should_include_member): New.
6497 * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6498 return the blocker.
6499 (Read_symbols::do_whole_lib_group): New.
6500 (Read_symbols::do_lib_group): New.
6501 (Read_symbols::do_read_symbols): Handle lib groups.
6502 (Read_symbols::get_name): Handle lib groups.
6503 * readsyms.h (Read_symbols): Add an archive member pointer.
6504 (Read_symbols::do_whole_lib_group): New.
6505 (Read_symbols::do_lib_group): New.
6506 (Read_symbols::member_): New.
6507 * script.cc (read_input_script): Update call to queue_soon.
6508
6509 2010-03-19 Doug Kwan <dougkwan@google.com>
6510
6511 * arm.cc (Stub_table::Stub_table): Initialize new data members
6512 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6513 (Stub_table::add_reloc_stub): Assign stub offset and update
6514 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6515 (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6516 New data members.
6517 (Stub_table::update_data_size_and_addralign): Use
6518 Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6519 instead of going over all reloc stubs.
6520 (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6521 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6522 Stringpool_template::offset_ to size of Stringpool_char.
6523 (Stringpool_template::new_key_offset): Remove code to initialize
6524 Stringpool_template::offset_.
6525 * stringpool.h (Stringpool_template::set_no_zero_null): Set
6526 Stringpool_template::offset_ to zero.
6527
6528 2010-03-15 Doug Kwan <dougkwan@google.com>
6529
6530 * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6531 offset_.
6532 (Stringpool_template::new_key_offset): New method.
6533 (Stringpool_template::add_string): Assign offsets when adding new
6534 strings.
6535 (Stringpool_template::set_string_offsets): Do not set string offsets
6536 when not optimizing.
6537 * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6538 member size_.
6539 (Chunked_vector::clear): Clear size_.
6540 (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6541 (Chunked_vector::size): Return size_.
6542 (Chunked_vector::push_back): Use size_ to find insert position.
6543 (Chunked_vector::size_): New data member.
6544 (Stringpool_template::set_no_zero_null): Assert string set is empty.
6545 (Stringpool_template::new_key_offset): New method declaration.
6546 (Stringpool_template::offset_): New data member.
6547
6548 2010-03-15 Rafael Espindola <espindola@google.com>
6549
6550 * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6551 Add_symbols' constructor.
6552 * readsyms.h (Add_symbols): Remove the input_group member.
6553
6554 2010-03-10 Ian Lance Taylor <iant@google.com>
6555
6556 * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6557 target to ask whether a reference to a symbol requires a stack
6558 split.
6559 * target.h (Target::is_call_to_non_split): New function.
6560 (Target::do_is_call_to_non_split): Declare virtual function.
6561 * target.cc: Include "symtab.h".
6562 (Target::do_is_call_to_non_split): New function.
6563 * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6564
6565 2010-03-10 Cary Coutant <ccoutant@google.com>
6566
6567 * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6568 (File_read::open[1]): Remove initial mapping of whole_file_view_.
6569 (File_read::open[2]): Add whole_file_view_ to list of views.
6570 (File_read::make_view): Remove test of whole_file_view_.
6571 (File_read::find_or_make_view): Create whole_file_view_ if
6572 necessary.
6573 (File_read::clear_views): Replace bool parameter with enum;
6574 adjust all callers. Don't delete views with permanent data;
6575 do delete cached views and views from archives if
6576 --no-keep-files-mapped is set. Set whole_file_view_ to NULL
6577 if clearing the corresponding view.
6578 * fileread.h (File_read::Clear_views_mode): New enum.
6579 (File_read::View::is_permanent_view): New method.
6580 (File_read::clear_views): Replace bool parameter
6581 with enum; adjust all callers.
6582 * options.h (General_options): Change keep_files_mapped option;
6583 add map_whole_files.
6584 * readsyms.cc (Add_symbols::run): Delete sd_ object before
6585 releasing the file.
6586 * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6587 the file.
6588
6589 2010-03-10 David S. Miller <davem@davemloft.net>
6590
6591 * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6592
6593 2010-03-09 Sriraman Tallam <tmsriram@google.com>
6594
6595 * icf.cc (get_section_contents): Add '@' marker after processing the
6596 merge reloc.
6597
6598 2010-03-08 Doug Kwan <dougkwan@google.com>
6599
6600 * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6601 due to a conversion warning.
6602 (Arm_relobj::update_output_local_symbol_count): Check for local
6603 symbol with unset output index.
6604
6605 2010-03-05 Ian Lance Taylor <iant@google.com>
6606
6607 * options.h (class General_options): Add --spare-dynamic-tags.
6608 * output.cc (Output_data_dynamic::set_final_data_size): Implement
6609 --spare-dynamic-tags.
6610
6611 2010-03-05 Ian Lance Taylor <iant@google.com>
6612
6613 * incremental.cc: Include "libiberty.h".
6614
6615 2010-03-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
6616
6617 * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6618 function, is_info_ member.
6619 * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6620 (Versions::Versions): Update caller.
6621 (Versions::define_base_version): Likewise.
6622 (Versions::add_def): Likewise.
6623
6624 2010-03-03 Sriraman Tallam <tmsriram@google.com>
6625
6626 * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6627 (Scan::possible_function_pointer_reloc): New function.
6628 (Scan::local_reloc_may_be_function_pointer): Change to call
6629 possible_function_pointer_reloc.
6630 (Scan::global_reloc_may_be_function_pointer): Ditto.
6631 * icf.h (Icf::check_section_for_function_pointers): Change to reject
6632 relocations in ".data.rel.ro._ZTV" section.
6633 * testsuite/icf_safe_so_test.sh: Change to pass i386.
6634 * testsuite/icf_safe_so_test.cc: Ditto.
6635 * testsuite/icf_safe_test.cc: Ditto.
6636 * testsuite/icf_safe_test.sh: Ditto.
6637
6638 2010-03-03 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6639 Ian Lance Taylor <iant@google.com>
6640
6641 * target-reloc.h (relocate_section): Check the symbol table index
6642 for -1U before setting the local symbol index.
6643 (scan_relocatable_relocs): If copying the relocation, record that
6644 the local symbol is required.
6645 * object.h (Symbol_value::is_output_symtab_index_set): New
6646 function.
6647 (Symbol_value::may_be_discarded_from_output_symtab): New
6648 function.
6649 (Symbol_value::has_output_symtab_entry): New function.
6650 (Symbol_value::needs_output_symtab_entry): Remove.
6651 (Symbol_value::output_symtab_index): Make sure the symbol index is
6652 set.
6653 (Symbol_value::set_output_symtab_index): Make sure the symbol
6654 index is not set. Make sure the new index is valid.
6655 (Symbol_value::set_must_have_output_symtab_entry): New function.
6656 (Symbol_value::has_output_dynsym_entry): New function.
6657 (Symbol_value::set_output_dynsym_index): Make sure the new index
6658 is valid.
6659 (Sized_relobj::set_must_have_output_symtab_entry): New function.
6660 * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6661 local symbol if permitted.
6662 (Sized_relobj::do_finalize_local_symbols): Call
6663 is_output_symtab_index_set rather than needs_output_symtab_entry.
6664 (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6665 rather than needs_output_symtab_entry. Call
6666 has_output_dynsym_entry rather than needs_output_dynsym_entry.
6667 * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6668 is_output_symtab_index_set rather than needs_output_symtab_entry.
6669 * testsuite/discard_locals_relocatable_test.c: New file.
6670 * testsuite/discard_locals_test.sh: Test -r.
6671 * testsuite/Makefile.am (check_DATA): Add
6672 discard_locals_relocatable_test1.syms,
6673 discard_local_relocatable_test2.syms.
6674 (MOSTLYCLEANFILES): Likewise. Also add
6675 discard_locals_relocatable_test1.lout and
6676 discard_locals_relocatable_test2.out.
6677 (discard_locals_relocatable_test1.syms): New target.
6678 (discard_locals_relocatable_test.o): New target.
6679 (discard_locals_relocatable_test1.out): New target.
6680 (discard_locals_relocatable_test2.syms): New target.
6681 (discard_locals_relocatable_test2.out): New target.
6682 (various): Add missing ../ld-new dependencies.
6683 * testsuite/Makefile.in: Rebuild.
6684
6685 2010-03-03 Nick Clifton <nickc@redhat.com>
6686
6687 * po/fi.po: New Finnish translation.
6688
6689 2010-03-01 Doug Kwan <dougkwan@google.com>
6690
6691 * layout.cc (Layout::Layout): Force section types of .init_array*,
6692 .preinit_array* and .fini_array* sections.
6693 * output.cc (Output_section::Input_section_sort_entry::has_priority):
6694 Fix check of return value of std::string::find.().
6695 (Output_section::Input_section_sort_compare::operator()): Remove
6696 comment about .init_array.
6697 (Output_section::Input_section_sort_init_fini_compare::operator()):
6698 New method.
6699 (Output_section::sort_attached_input_sections): Handle .init_array
6700 and .fini_array specially.
6701 * output.h (Output_section::Inut_section_sort_compare): Update
6702 comment.
6703 (Output_section::Input_section_sort_init_fini_compare): New struct.
6704
6705 2010-02-26 Doug Kwan <dougkwan@google.com>
6706
6707 * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6708 R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6709 * testsuite/debug_msg.sh: Avoid matching source line number for
6710 use of global variable undef_int.
6711
6712 2010-02-26 Doug Kwan <dougkwan@google.com>
6713
6714 * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6715 R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6716 (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6717 scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6718 * options.cc (General_options::General_options): Initialize member
6719 fix_v4bx_.
6720 * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6721 (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6722 and rm_no_fix_v4bx.stdout
6723 (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6724 arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6725 arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6726 (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6727 and arm_no_fix_v4bx.
6728 * Makefile.in: Regenerate.
6729 * testsuite/arm_fix_v4bx.s: New file.
6730 * testsuite/arm_fix_v4bx.sh: Ditto.
6731
6732 2010-02-24 Doug Kwan <dougkwan@google.com>
6733
6734 * arm.cc (Target_arm::got_section): Make the .got section the first
6735 non RELRO section in the data segment.
6736 * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6737 suffixes of section names.
6738
6739 2010-02-24 Doug Kwan <dougkwan@google.com>
6740
6741 * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6742 flags and attributes merging if an input file is a binary file.
6743 * fileread.cc (Input_file::open): Record format of original file.
6744 * fileread.h (Input_file::Format): New enum type.
6745 (Input_file::Input_file): Initialize data member format_.
6746 (Input_file::format): New method definition.
6747 (Input_file::format_):: New data member.
6748
6749 2010-02-24 Doug Kwan <dougkwan@google.com>
6750
6751 * arm.cc (Arm_output_data_got): New class.
6752 (ARM_TCB_SIZE): New constant
6753 (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6754 (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6755 If user uses a script with a SECTIONS clause, issue only a warning
6756 for a misplaced EXIDX input section. Otherwise, issue an error.
6757 (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6758 garbage collection.
6759 (Target_arm::got_mode_index_entry): Handle static linking.
6760 (Target_arm::Scan::local): Ditto.
6761 (Target_arm::Scan::global): Ditto.
6762 (Target_arm::Relocate::relocate_tls): Handle static linking. Fix
6763 all incorrectly implemented relocations.
6764 (Target_arm::fix_exidx_coverage): Pass layout to
6765 Arm_output_section::fix_exidx_coverage.
6766 * layout.cc (Layout::section_name_mapping): Remove trailing dots
6767 from ".ARM.exidx." and ".ARM.extab.".
6768
6769 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6770
6771 * arm.cc (Target_arm::do_finalize_sections): Create attribute
6772 section if it does not already exist.
6773 * attributes.cc (Attributes_section_data::Attributes_section_data):
6774 Don't crash if size is zero.
6775
6776 2010-02-23 Viktor Kutuzov <vkutuzov@accesssoftek.com>
6777 Ian Lance Taylor <iant@google.com>
6778
6779 * gold.cc (queue_middle_tasks): If no input files were opened,
6780 exit.
6781 * workqueue.h (Task_function::Task_function): Assert that there is
6782 a blocker.
6783
6784 2010-02-22 Doug Kwan <dougkwan@google.com>
6785
6786 * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6787 * icf.cc (get_section_contents): Cast snprintf arguments to long long
6788 types to avoid warnings due to different uint64_t implementations
6789 on different hosts.
6790
6791 2010-02-21 Doug Kwan <dougkwan@google.com>
6792
6793 * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6794 handling of the maximum backward branch offset.
6795 (Arm_relocate_functions::thumb_branch_common): Ditto.
6796 * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6797 (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6798 thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6799 thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6800 (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6801 arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6802 arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6803 thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6804 thumb_bl_out_of_range thumb_bl_out_of_range.o,
6805 thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6806 thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6807 thumb2_bl_out_of_range.o): New rules.
6808 (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6809 thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6810 thumb2_bl_out_of_range
6811 * testsuite/Makefile.in: Regenerate.
6812 * testsuite/arm_bl_in_range.s: New file.
6813 * testsuite/arm_bl_out_of_range.s: Ditto.
6814 * testsuite/arm_branch_in_range.sh: Ditto.
6815 * testsuite/arm_branch_range.t: Ditto.
6816 * testsuite/thumb2_branch_range.t: Ditto.
6817 * testsuite/thumb_bl_in_range.s: Ditto.
6818 * testsuite/thumb_bl_out_of_range.s: Ditto.
6819 * testsuite/thumb_branch_range.t: Ditto.
6820
6821 2010-02-20 Sriraman Tallam <tmsriram@google.com>
6822
6823 * gc.h (gc_process_relocs): Change vectors to point to the new list.
6824 Add reloc offset information.
6825 * icf.cc (get_section_contents): Change iterators to point to the new
6826 vectors. Add reloc offset information to the contents.
6827 * icf.h (Icf::Sections_reachable_info): New typedef.
6828 (Icf::Sections_reachable_list): New typedef.
6829 (Icf::Offset_info): New typedef.
6830 (Icf::Reloc_info): New struct typedef.
6831 (Icf::Reloc_info_list): New typedef.
6832 (Icf::symbol_reloc_list): Delete method.
6833 (Icf::addend_reloc_list): Delete method.
6834 (Icf::section_reloc_list): Delete method.
6835 (Icf::reloc_info_list): New method.
6836 (Icf::reloc_info_list_): New member.
6837
6838 2010-02-19 Doug Kwan <dougkwan@google.com>
6839
6840 * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6841 R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6842 * arm.cc (Arm_relocation_functions): New forward declaration.
6843 (Target_arm::Target_arm): Initialize new data members
6844 got_mod_index_offset_ and tls_base_symbol_defined_.
6845 (Target_arm::Relocate::relocate_tls): New method.
6846 (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6847 Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6848 New methods.
6849 (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6850 GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6851 (Target_arm::got_mod_index_offset_,
6852 Target_arm::tls_base_symbol_defined_): New data members.
6853 (Target_arm::Scan::local, Target::Scan::global,
6854 Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6855 relocations.
6856
6857 2010-02-18 Doug Kwan <dougkwan@google.com>
6858
6859 * arm.cc (Arm_relobj::find_linked_text_section): New method.
6860 (Arm_relobj::make_exidx_input_section): Pass section index of linked
6861 text section as a parameter becuase some broken tools may not set
6862 the link in section header.
6863 (Target_arm::has_got_section): New method.
6864 (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6865 without any mapping symbol as data only. Remove warning.
6866 (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6867 link in its section header, try to discover the link by inspecting the
6868 REL31 relocation at the beginning of the section.
6869 (Target_arm::Scan::check_non_pic): Report name of offending relocation
6870 in error message.
6871 (Target_arm::Scan::global): Treat any reference to the symbol
6872 _GLOBAL_OFFSET_TABLE_ as a GOT access.
6873
6874 2010-02-12 Sriraman Tallam <tmsriram@google.com>
6875
6876 * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6877 (Scan::global_reloc_may_be_function_pointer): New function.
6878 * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6879 (Scan::global_reloc_may_be_function_pointer): New function.
6880 * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6881 (Scan::global_reloc_may_be_function_pointer): New function.
6882 * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6883 (Scan::global_reloc_may_be_function_pointer): New function.
6884 * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6885 (Scan::global_reloc_may_be_function_pointer): New function.
6886 (Scan::possible_function_pointer_reloc): New function.
6887 (Target_x86_64::can_check_for_function_pointers): New function.
6888 * gc.h (gc_process_relocs): Scan relocation types to determine if
6889 function pointers were taken for targets that support it.
6890 * icf.cc (Icf::find_identical_sections): Include functions for
6891 folding in safe ICF whose pointer is not taken.
6892 * icf.h (Secn_fptr_taken_set): New typedef.
6893 (fptr_section_id_): New member.
6894 (section_has_function_pointers): New function.
6895 (set_section_has_function_pointers): New function.
6896 (check_section_for_function_pointers): New function.
6897 * options.h: Fix comment for safe ICF option.
6898 * target.h (can_check_for_function_pointers): New function.
6899 * testsuite/Makefile.am: Add icf_safe_so_test test case.
6900 Modify icf_safe_test for X86-64.
6901 * testsuite/Makefile.in: Regenerate.
6902 * testsuite/icf_safe_so_test.cc: New file.
6903 * testsuite/icf_safe_so_test.sh: New file.
6904 * testsuite/icf_safe_test.cc (kept_func_3): New function.
6905 (main): Change to take pointer to function kept_func_3.
6906 * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6907 folding is done correctly for X86-64.
6908
6909 2010-02-12 David S. Miller <davem@davemloft.net>
6910
6911 * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6912 is_symbolless parameter.
6913 (Output_reloc<SHT_REL>::is_symbolless): New.
6914 (Output_reloc<SHT_REL>::is_symbolless_): New.
6915 (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6916 (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6917 (Output_reloc<SHT_RELA>::is_symbolless): New.
6918 (Output_data_reloc::add_global): Handle is_symbolless.
6919 (Output_data_reloc::add_global_relative): Likewise.
6920 (Output_data_reloc::add_local): Likewise.
6921 (Output_data_reloc::add_local_relative): Likewise.
6922 (Output_data_reloc::add_symbolless_global_addend): New.
6923 (Output_data_reloc::add_symbolless_local_addend): New.
6924 * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6925 is_symbolless.
6926 (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6927 instead of ->is_relative_
6928 (Output_reloc::write): Likewise.
6929 (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6930 (Output_reloc::write_rel): Simplify.
6931
6932 * sparc.cc (Target_sparc::Scan::local): Use
6933 ->add_symbolless_local_addend as needed.
6934 (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6935 needed. Also, emit appropriate unaligned vs. aligned dynamic reloc
6936 based upon relocation offset.
6937
6938 2010-02-11 Doug Kwan <dougkwan@google.com>
6939
6940 * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6941 (Target_arm::Scan::global): Ditto. Also remove a comment before the
6942 beginning of function.
6943 (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6944 and MOVT_ABS relocations. Those are non issued in scanning. Fix
6945 parameter is_32bit in calls to should_apply_static_reloc.
6946 * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6947 (check_DATA): Add arm_abs_global.stdout.
6948 (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6949 arm_abs_global.stdout): New rules.
6950 (MOSTLLYCLEANFILES): Add arm_abs_global
6951 * Makefile.in: Regenerate.
6952 * testsuite/arm_abs_global.s: New file.
6953 * testsuite/arm_abs_global.sh: Ditto.
6954 * testsuite/arm_abs_lib.s: Ditto.
6955
6956 2010-02-11 Ian Lance Taylor <iant@google.com>
6957
6958 * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6959 Read_relocs task.
6960 (queue_middle_tasks): Likewise, and also for Scan_relocs. Run
6961 Allocate_commons_task first.
6962 * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6963 task, rather than symtab_lock_.
6964 (Gc_process_relocs::~Gc_process_relocs): New function.
6965 (Gc_process_relocs::is_runnable): Check this_blocker_.
6966 (Gc_process_relocs::locks): Use next_blocker_ rather than
6967 blocker_.
6968 (Scan_relocs::~Scan_relocs): New function.
6969 (Scan_relocs::is_runnable): Check this_blocker_ rather than
6970 symtab_lock_.
6971 (Scan_relocs::locks): Drop symtab_lock_ and blocker_. Add
6972 next_blocker_.
6973 * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6974 fields. Add this_blocker_ and next_blocker_ fields. Adjust
6975 constructor accordingly.
6976 (class Gc_process_relocs): Likewise.
6977 (class Scan_relocs): Likewise.
6978 * common.h (class Allocate_commons_task): Remove symtab_lock_
6979 field, and corresponding constructor parameter.
6980 * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6981 symtab_lock_.
6982 (Allocate_commons_task::locks): Likewise.
6983
6984 2010-02-11 Ian Lance Taylor <iant@google.com>
6985
6986 * gold-threads.h (class Once): Define.
6987 (class Initialize_lock): Rewrite as child of Once.
6988 * gold-threads.cc (class Once_initialize): Define.
6989 (once_pointer_control): New static variable.
6990 (once_pointer, once_arg): New static variables.
6991 (c_run_once): New static function.
6992 (Once::Once, Once::run_once, Once::internal_run): New functions.
6993 (class Initialize_lock_once): Remove.
6994 (initialize_lock_control): Remove.
6995 (initialize_lock_pointer): Remove.
6996 (initialize_lock_once): Remove.
6997 (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6998 (Initialize_lock::initialize): Rewrite.
6999 (Initialize_lock::do_run_once): New function.
7000 * archive.cc (Archive::interpret_header): Only clear name if it is
7001 not already empty.
7002 * fileread.cc: Include "gold-threads.h"
7003 (file_counts_lock): New static variable.
7004 (file_counts_initialize_lock): Likewise.
7005 (File_read::release): Only increment counts when using --stats.
7006 Use a lock around the increment.
7007 * parameters.cc (class Set_parameters_target_once): Define.
7008 (set_parameters_target_once): New static variable.
7009 (Parameters::Parameters): Move here from parameters.h.
7010 (Parameters::set_target): Rewrite.
7011 (Parameters::set_target_once): New function.
7012 (Parameters::clear_target): Move here and rewrite.
7013 * parameters.h (class Parameters): Update declarations. Add
7014 set_parameters_target_once_ field.
7015 (Parameters::Parameters): Move to parameters.cc.
7016 (Parameters::clear_target): Likewise.
7017 * readsyms.cc (Read_symbols::do_group): Create a Start_group
7018 task.
7019 (Start_group::~Start_group): New function.
7020 (Start_group::is_runnable): New function.
7021 (Start_group::locks, Start_group::run): New functions.
7022 (Finish_group::run): Change saw_undefined to size_t.
7023 * readsyms.h (class Start_group): Define.
7024 (class Finish_group): Change saw_undefined_ field to size_t.
7025 (Finish_group::Finish_group): Remove saw_undefined and
7026 this_blocker parameters. Change all callers.
7027 (Finish_group::set_saw_undefined): New function.
7028 (Finish_group::set_blocker): New function.
7029 * symtab.h (class Symbol_table): Change saw_undefined to return
7030 size_t. Change saw_undefined_ field to size_t.
7031 * target-select.cc (Set_target_once::do_run_once): New function.
7032 (Target_selector::Target_selector): Initialize set_target_once_
7033 field. Don't initialize lock_ and initialize_lock_ fields.
7034 (Target_selector::instantiate_target): Rewrite.
7035 (Target_selector::set_target): New function.
7036 * target-select.h (class Set_target_once): Define.
7037 (class Target_selector): Update declarations. Make
7038 Set_target_once a friend. Remove lock_ and initialize_lock_
7039 fields. Add set_target_once_ field.
7040
7041 2010-02-10 Ian Lance Taylor <iant@google.com>
7042
7043 * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7044 queueing any tasks.
7045 * gold.cc (queue_middle_gc_tasks): Likewise. Fix final blocker.
7046 (queue_middle_tasks): Add all blockers before queueing any tasks.
7047 (queue_final_tasks): Likewise.
7048 * token.h (Task_token::add_blockers): New function.
7049 * object.h (Input_objects::number_of_relobjs): New function.
7050
7051 2010-02-10 Ian Lance Taylor <iant@google.com>
7052
7053 * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7054 shared, not if not position independent.
7055 * x86_64.cc (Relocate::relocate_tls): Likewise.
7056 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7057 (tls_pie_pic_test): New target.
7058 * testsuite/Makefile.in: Rebuild.
7059
7060 * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7061 (tls_test_main_pie.o, tls_test_pie.o): New targets.
7062 (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7063 * testsuite/Makefile.in: Rebuild.
7064
7065 2010-02-09 David S. Miller <davem@davemloft.net>
7066
7067 * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7068 R_SPARC_RELATIVE using ->add_local_relative().
7069 (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7070
7071 * output.h (Output_data_dynamic::add_section_size): New method
7072 that takes two Output_data objects.
7073 (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7074 entry param. Handle it in initializers.
7075 * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7076 DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7077 * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7078 arg.
7079 * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7080 and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7081 * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7082 for dynrel_includes_plt.
7083 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7084 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7085 * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7086 before .rela.plt
7087 (Target_sparc::do_finalize_sections): Update to pass true for
7088 dynrel_includes_plt.
7089 * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7090 output before .rela.plt
7091 (Target_powerpc::do_finalize_sections): Update to pass true for
7092 dynrel_includes_plt when 32-bit.
7093
7094 2010-02-08 Doug Kwan <dougkwan@google.com>
7095
7096 * arm.cc (Arm_relobj::simple_input_section_output_address): New
7097 method.
7098 (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7099 Arm_relobj::scan_section_for_cortex_a8_stubs,
7100 Arm_relobj::do_relocation_section): Instead of calling
7101 Output_section::output_address, use faster
7102 Arm_relobj::simple_input_section_output_address.
7103
7104 2010-02-08 David S. Miller <davem@davemloft.net>
7105
7106 * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7107 unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7108 relocation helper function.
7109
7110 * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7111 just like R_SPARC_GOT{10,13,22}.
7112 (Target_sparc::Scan::local): Likewise.
7113 (Target_sparc::Relocate:relocate): Likewise.
7114
7115 2010-02-06 Ian Lance Taylor <iant@google.com>
7116
7117 * configure.ac: Rewrite targetobjs duplicate removal code to use
7118 only shell constructs.
7119 * configure: Rebuild.
7120
7121 2010-02-05 Doug Kwan <dougkwan@google.com>
7122
7123 PR 11247
7124 * arm.cc (Arm_relobj::section_is_scannable): New method.
7125 (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7126 (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7127
7128 2010-02-04 Doug Kwan <dougkwan@google.com>
7129
7130 PR 11247
7131 * arm-reloc-property.cc (cstdio): Include.
7132 * configure.ac (targetobjs): Remove duplicates.
7133 * configure: Regenerate.
7134 * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7135 big and little endian version for a given address size.
7136
7137 2010-02-03 Doug Kwan <dougkwan@google.com>
7138
7139 * arm-reloc-property.cc
7140 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7141 definition.
7142 * arm-reloc-property.h
7143 (Arm_reloc_property_table::get_implemented_static_reloc_property):
7144 New method definition.
7145 (Arm_reloc_property_table::reloc_name_in_error_message): New method
7146 declaration.
7147 * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7148 overflow to N.
7149 (GOT_PREL): Change implemented to Y.
7150 * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7151 (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7152 (Arm_relocate_functions::movw_abs_nc): Remove method.
7153 (Arm_relocate_functions::movt_abs): Ditto.
7154 (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7155 (Arm_relocate_functions::thm_movt_abs): Ditto.
7156 (Arm_relocate_functions::movw_rel_nc): Ditto.
7157 (Arm_relocate_functions::movw_rel): Ditto.
7158 (Arm_relocate_functions::movt_rel): Ditto.
7159 (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7160 (Arm_relocate_functions:thm_movw_rel): Ditto.
7161 (Arm_relocate_functions:thm_movt_rel): Ditto.
7162 (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7163 (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7164 New method definitions.
7165 (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7166 (Arm_relocation_functions::arm_grp_ldr): Ditto.
7167 (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7168 (Arm_relocation_functions::arm_grp_ldc): Ditto.
7169 (Target_arm::Relocate::relocate): Check for non-static or
7170 unimplemented relocation code and exit early. Change calls to
7171 Target_arm::reloc_uses_thumb_bit and
7172 Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7173 instead. Refactor code to handle similar relocations to increase
7174 code sharing. Remove check for unsupported relocation code in switch
7175 statement.
7176 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7177 relocation property table to find out size. Change error message to
7178 print out the name of a relocation code instead of the numeric value.
7179 (Target_arm::scan_reloc_for_stub): Use relocation property table
7180 instead of calling Target_arm::reloc_uses_thumb_bit().
7181
7182 2010-02-02 Doug Kwan <dougkwan@google.com>
7183
7184 * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7185 types of relaxed input section.
7186
7187 2010-02-02 Doug Kwan <dougkwan@google.com>
7188
7189 * Makefile.am (HFILES): Add arm-reloc-property.h.
7190 (DEFFILES): New.
7191 (TARGETSOURCES): Add arm-reloc-property.cc
7192 (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7193 (libgold_a_SOURCES): $(DEFFILES)
7194 * Makefile.in: Regenerate.
7195 * arm-reloc-property.cc: New file.
7196 * arm-reloc-property.h: New file.
7197 * arm-reloc.def: New file.
7198 * arm.cc: Update comments.
7199 (arm-reloc-property.h): New included header.
7200 (arm_reloc_property_table): New global variable.
7201 (Target_arm::do_select_as_default_target): New method definition.
7202 * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7203 arm-reloc-property to targ_extra_obj.
7204 * parameters.cc (set_parameters_target): Call
7205 Target::select_as_default_target().
7206 * target.h (Target::select_as_default_target): New method definition.
7207 (Target::do_select_as_default_target): Same.
7208
7209 2010-02-01 Doug Kwan <dougkwan@google.com>
7210
7211 * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7212 first_output_text_section_.
7213 (Arm_exidx_fixup::first_output_text_section): New method definition.
7214 (Arm_exidx_fixup::first_output_text_section_): New data member.
7215 (Arm_exidx_fixup::process_exidx_section): Record the first text
7216 output section seen.
7217 (Arm_output_section::fix_exidx_coverage): Set correct linked section
7218 and entsize in output section header.
7219
7220 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7221
7222 * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7223 R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7224 (Arm_relocate_functions::thm_alu11): New Method.
7225 (Arm_relocate_functions::thm_pc8): New Method.
7226 (Arm_relocate_functions::thm_pc12): New Method.
7227 (Target_arm::Scan::local): Handle the relocations.
7228 (Target_arm::Scan::global): Likewise.
7229 (Target_arm::Relocate::relocate): Likewise.
7230 (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7231
7232 2010-01-29 Doug Kwan <dougkwan@google.com>
7233
7234 * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7235 of relocation types as ld.
7236
7237 2010-01-29 Doug Kwan <dougkwan@google.com>
7238
7239 * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7240 to public.
7241 (Arm_relocate_functions::thumb_branch_common): Ditto.
7242 (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7243 Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7244 Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7245 Arm_relocate_functions::jump24): Remove.
7246 (Target_arm::Relocate::relocate): Adjust code to call
7247 Arm_relocation_functions::arm_branch_common and
7248 Arm_relocation_functions::thumb_branch_common instead of their removed
7249 wrappers. Merge switch-cases together to reduce source code size.
7250
7251 2010-01-29 Doug Kwan <dougkwan@google.com>
7252
7253 * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7254 output_local_symbol_count_needs_update_.
7255 (Arm_relobj::output_local_symbol_count_needs_update,
7256 Arm_relobj::set_output_local_symbol_count_needs_update,
7257 Arm_relobj::update_output_local_symbol_count): New methods.
7258 (Arm_relobj::output_local_symbol_count_needs_update_): New data
7259 member.
7260 (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7261 of pointed function as in a R_ARM_PREL31 relocation.
7262 (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7263 for output local symbol count updating.
7264 (Target_arm::do_relax): Update output local symbol counts in objects
7265 if necessary.
7266 * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7267
7268 2010-01-29 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7269
7270 * arm.cc: Added support for the ARM relocations:
7271 R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7272 R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7273 (Arm_relocate_functions::movw_rel_nc): Renamed (was
7274 movw_prel_nc).
7275 (Arm_relocate_functions::movw_rel): New method.
7276 (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7277 (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7278 thm_movw_prel_nc).
7279 (Arm_relocate_functions::thm_movw_rel): New method.
7280 (Arm_relocate_functions::thm_movt_rel): Renamed (was
7281 thm_movt_prel).
7282 (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7283 relocations.
7284 (Target_arm::Scan::global): Likewise.
7285 (Target_arm::Relocate::relocate): Likewise.
7286 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7287 Likewise.
7288
7289 2010-01-27 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7290
7291 * arm.cc: Added support for ARM group relocations.
7292 (Target_arm::reloc_needs_sym_origin): New method.
7293 (Arm_relocate_functions::calc_grp_kn): New method.
7294 (Arm_relocate_functions::calc_grp_residual): New method.
7295 (Arm_relocate_functions::calc_grp_gn): New method.
7296 (Arm_relocate_functions::arm_grp_alu): New Method.
7297 (Arm_relocate_functions::arm_grp_ldr): New Method.
7298 (Arm_relocate_functions::arm_grp_ldrs): New Method.
7299 (Arm_relocate_functions::arm_grp_ldc): New Method.
7300 (Target_arm::Scan::local): Handle the ARM group relocations.
7301 (Target_arm::Scan::global): Likewise.
7302 (Target_arm::Relocate::relocate): Likewise.
7303 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7304 Likewise.
7305
7306 2010-01-26 Doug Kwan <dougkwan@google.com>
7307
7308 * arm.cc (set): Include.
7309 (class Arm_exidx_fixup): Change type of last_input_section_ to const
7310 pointer type.
7311 (Arm_output_section::Text_section_list): New type.
7312 (Arm_output_section::append_text_sections_to_list): New method.
7313 (Arm_output_section::fix_exidx_coverage): Ditto.
7314 (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7315 (Arm_relobj::convert_input_section_to_relaxed_section): Use
7316 Relobj::set_section_offset() instead of
7317 Sized_relobj::invalidate_section_offset().
7318 (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7319 parameter for section headers. Ignore relocation sections for
7320 unallocated sections and EXIDX sections.
7321 (Target_arm::fix_exidx_coverage): New method.
7322 (Target_arm::output_section_address_less_than): New type.
7323 (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7324 linked text section instead of the EXIDX section.
7325 (Arm_output_section::create_stub_group): Add an assertion to check
7326 that this is not an EXIDX output section.
7327 (Arm_output_section::append_text_sections_to_list): New method.
7328 (Arm_output_section::fix_exidx_coverage): Ditto.
7329 (Arm_relobj::scan_sections_for_stubs): Adjust call to
7330 Arm_relobj::section_needs_reloc_stub_scanning.
7331 (Target_arm::do_relax): Fix EXIDX output section coverage in the
7332 first pass.
7333 (Target_arm::fix_exidx_coverage): New method.
7334 * object.h (Relobj::set_output_section): New method.
7335 (Sized_relobj::invalidate_section_offset): Remove method.
7336 (Sized_relobj::do_invalidate_section_offset): Remove method.
7337 (Sized_relobj::do_set_section_offset): Handle offset value -1.
7338
7339 2010-01-25 Doug Kwan <dougkwan@google.com>
7340
7341 * arm.cc (Arm_exidx_merged_section::do_output_offset):
7342 Fix warning due to signed and unsigned comparison on a 32-bit host.
7343
7344 2010-01-22 Doug Kwan <dougkwan@google.com>
7345
7346 * arm.cc (Target_arm::do_relax): Record an output section for section
7347 offset adjustment it contains any stub table that has changed.
7348 * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7349 offsets in an output section if necessary.
7350 * output.cc (Output_section::Output_section): Initialize
7351 section_offsets_need_adjustments_.
7352 (Output_section::add_input_section_for_script): Renamed to
7353 Output_section::add_simple_input_section.
7354 (Output_section::save_states): Add a comment.
7355 (Output_section::discard_states): New method defintion.
7356 (Output_section::adjust_section_offsets): Same.
7357 * output.h (Output_section::add_input_section_for_script): Renamed to
7358 Output_section::add_simple_input_section.
7359 (Output_section::discard_states): New method declaration.
7360 (Output_section::adjust_section_offsets): Same.
7361 (Output_section::section_offsets_need_adjustment,
7362 Output_section::set_section_offsets_need_adjustment): New method
7363 definitions.
7364 (Output_section::section_offsets_need_adjustment_): New data member.
7365 * script-sections.cc
7366 (Output_section_element_input::set_section_address): Adjust code for
7367 renaming of Output_section::add_input_section_for_script.
7368 (Orphan_output_section::set_section_address): Same.
7369
7370 2010-01-22 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7371
7372 * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7373 Fix_v4bx enum values .
7374 * gold/options.h (General_options): New option definitions.
7375 (General_options::fix_v4bx): New method.
7376 (General_options::Fix_v4bx): New enum.
7377 * gold/options.cc (General_options::parse_fix_v4bx): New method.
7378 (General_options::parse_fix_v4bx_interworking): New method.
7379
7380 2010-01-22 Doug Kwan <dougkwan@google.com>
7381
7382 * arm.cc (Arm_exidx_fixup): New class.
7383
7384 2010-01-21 Doug Kwan <dougkwan@google.com>
7385
7386 * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7387 classes.
7388 (Arm_exidx_section_offset_map): New type.
7389
7390 2010-01-21 Doug Kwan <dougkwan@google.com>
7391
7392 * arm.cc (Arm_exidx_input_section): New class.
7393 (Arm_relobj::exidx_input_section_by_link,
7394 Arm_relobj::exidx_input_section_by_shndx,
7395 Arm_relobj::make_exidx_input_section): New methods.
7396 (read_arm_attributes_section): Remove.
7397 (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7398 information about them.
7399 (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7400 to here.
7401
7402 2010-01-20 Doug Kwan <dougkwan@google.com>
7403
7404 * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7405 Input_section_specifier to Section_id.
7406 (Target_arm::new_arm_input_section: Adjust code for change of key
7407 type.
7408 (Target_arm::find_arm_input_section): Ditto.
7409 * gc.h (object.h): Include for Section_id nand Section_id_hash.
7410 (Section_id): Remove.
7411 (Garbage_collection::Section_id_hash): Remove.
7412 * icf.h (object.h): Include for Section_id nand Section_id_hash.
7413 (Section_id): Remove.
7414 (Icf::Section_id_hash): Remove.
7415 * object.h (Section_id, Const_section_id, Section_id_hash,
7416 Const_section_id_hash): New type definitions.
7417 * output.cc (Output_section::add_relaxed_input_section): Change to
7418 use Const_section_id instead of Input_section_specifier as key type.
7419 (Output_section::add_merge_input_section): Ditto.
7420 (Output_section::build_relaxation_map): Change to use Section_id
7421 instead of Input_section_specifier as key type.
7422 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7423 Ditto.
7424 (Output_section::convert_input_sections_to_relaxed_sections): Change
7425 to use Const_section_id instead of Input_section_specifier as key type.
7426 (Output_section::find_merge_section): Ditto.
7427 (Output_section::find_relaxed_input_section): Ditto.
7428 * output.h (Input_section_specifier): Remove class.
7429 (Output_section::Output_section_data_by_input_section_map): Change
7430 key type to Const_section_id.
7431 (Output_section::Output_relaxed_input_section_by_input_section_map):
7432 Ditto.
7433 (Output_section::Relaxation_map): Change key type to Section_id.
7434
7435 2010-01-20 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7436
7437 * gold/arm.cc: Added support for R_ARM_V4BX relocation
7438 (class Arm_v4bx_stub): New class.
7439 (DEF_STUBS): Updated definition to support v4_veneer_bx.
7440 (Stub_factory::make_arm_v4bx_stub): New method.
7441 (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7442 (Stub_table::empty): Handle v4bx stubs.
7443 (Stub_table::add_arm_v4bx_stub): New method.
7444 (Stub_table::find_arm_v4bx_stub): New method.
7445 (Arm_relocate_functions::v4bx): New method.
7446 (Target_arm::fix_v4bx): New method.
7447 (Target_arm::Target_arm): Handle R_ARM_V4BX.
7448 (Stub_table::relocate_stubs): Likewise.
7449 (Stub_table::do_write): Likewise.
7450 (Stub_table::update_data_size_and_addralign): Likewise.
7451 (Stub_table::finalize_stubs): Likewise.
7452 (Target_arm::Scan::local): Likewise.
7453 (Target_arm::Scan::global): Likewise.
7454 (Target_arm::do_finalize_sections): Likewise.
7455 (Target_arm::Relocate::relocate): Likewise.
7456 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7457 Likewise.
7458 (Target_arm::scan_reloc_for_stub): Likewise.
7459 (Target_arm::scan_reloc_section_for_stubs): Likewise.
7460
7461 2010-01-19 Ian Lance Taylor <iant@google.com>
7462
7463 * output.cc (Output_section_headers::do_sized_write): Write large
7464 segment count to sh_info field.
7465 (Output_file_header::do_sized_write): For large segment count,
7466 write PN_XNUM to e_phnum field.
7467
7468 2010-01-15 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7469
7470 * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7471 (Arm_relocate_functions::thm_jump8): New function.
7472 (Arm_relocate_functions::thm_jump11): New function.
7473 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7474 R_ARM_THM_JUMP11.
7475 (Target_arm::Scan::global): Likewise.
7476 (Target_arm::Relocate::relocate): Likewise.
7477 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7478 Likewise.
7479
7480 2010-01-14 Doug Kwan <dougkwan@google.com>
7481
7482 * arm.cc (map, utility): Include headers.
7483 (Target_arm::apply_cortex_a8_workaround): New method.
7484 (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7485 (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7486 (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7487 (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7488 the --[no-]fix-cortex-a8 command line options.
7489 (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7490 (Target_arm::relocate_stub): Use addend in instruction template.
7491 * options.h (DEFINE_bool): Set the user-set flag.
7492 (General_options): Add --[no-]-fix-cortex options.
7493 * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7494 : Update fast look-up map after conversion.
7495
7496 2010-01-14 Sriraman Tallam <tmsriram@google.com>
7497
7498 * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7499 in the first pass of do_layout.
7500
7501 2010-01-13 Doug Kwan <dougkwan@google.com>
7502
7503 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7504 Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7505 apparent compiler problem of not folding static constant integral
7506 data members of elfcpp::Elf_sizes<32>.
7507
7508 2010-01-13 Doug Kwan <dougkwan@google.com>
7509
7510 * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7511 Arm_relobj::section_needs_cortex_a8_stub_scanning,
7512 Arm_relobj::scan_section_for_cortex_a8_erratum,
7513 Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7514 (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7515 sections to scan for relocation stubs into a new method
7516 Arm_relobj::section_needs_reloc_stub_scanning. Handle both
7517 relocation and Cortex-A8 stub scanning.
7518 (Target_arm::do_relax): Force stubs to be after stubbed sections
7519 if fixing the Cortex-A8 erratum. Remove all Cortex-A8 stubs at
7520 the beginning of a new relaxation pass. Update a comment.
7521 (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7522
7523 2010-01-12 Ian Lance Taylor <iant@google.com>
7524
7525 * target-reloc.h (visibility_error): New inline function.
7526 (relocate_section): Call visibility_error.
7527 * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7528 (MOSTLYCLEANFILES): Likewise.
7529 (protected_4_pic.o, protected_3.err): New targets.
7530 * testsuite/protected_4.cc: New file.
7531
7532 2010-01-12 Doug Kwan <dougkwan@google.com>
7533
7534 * arm.cc (Cortex_a8_reloc): New class.
7535 (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7536 and cortex_a8_relocs_info_.
7537 (Target_arm::fix_cortex_a8): New method definition.
7538 (Target_arm::Cortex_a8_relocs_info): New type.
7539 (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7540 New data member declarations.
7541 (Target_arm::scan_reloc_for_stub): Record information about
7542 relocations for THUMB branches that might be exempted from the
7543 Cortex-A8 workaround.
7544 (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7545 at the beginning of a relaxation pass.
7546
7547 2010-01-12 Doug Kwan <dougkwan@google.com>
7548
7549 * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7550 (Arm_relobj::Mapping_symbol_position,
7551 Arm_reloj::Mapping_symbol_position_less,
7552 Arm_relobj::Mapping_symbols_info): New types.
7553 (Target_arm::is_mapping_symbol_name): New method definition.
7554 (Arm_relobj::do_count_local_symbols): Save information about mapping
7555 symbols.
7556
7557 2010-01-11 Doug Kwan <dougkwan@google.com>
7558
7559 * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7560 Arm_relocate_functions::thumb32_branch_upper,
7561 Arm_relocate_functions::thumb32_branch_lower,
7562 Arm_relocate_functions::thumb32_cond_branch_offset,
7563 Arm_relocate_functions::thumb32_cond_branch_upper,
7564 Arm_relocate_functions::thumb32_cond_branch_lower,
7565 Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7566 branch offset encoding.
7567 (Arm_relocate_functions::thumb_branch_common): Use new branch
7568 offset encoding methods to avoid code duplication.
7569 (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7570 (Stub_addend_reader::operator()): Use new branch encoding method
7571 to avoid code duplication.
7572
7573 2010-01-11 Doug Kwan <dougkwan@google.com>
7574
7575 * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7576 (Target_arm::do_finalize_sections): Define special EXIDX section
7577 symbols only if referenced.
7578 * gc.h (Garbage_collection::add_reference): New method.
7579 (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7580 code duplication.
7581
7582 2010-01-11 Ian Lance Taylor <iant@google.com>
7583
7584 * script.cc (Version_script_info::build_expression_list_lookup):
7585 Change complaing about duplicate wildcard match from error to
7586 warning.
7587
7588 * script.cc (class Lazy_demangler): Recreate--revert part of patch
7589 of 2009-12-30.
7590 (Version_script_info::Version_script_info): Initialize globs_,
7591 default_version_, default_is_global_, and exact_. Don't
7592 initialize globals_ or locals_.
7593 (Version_script_info::build_lookup_tables): Build local symbols
7594 first.
7595 (Version_script_info::unquote): New function.
7596 (Version_script_info::add_exact_match): New function.
7597 (Version_script_info::build_expression_list_lookup): Remove lookup
7598 parameter. Add is_global parameter. Change all callers. Handle
7599 wildcard pattern specially. Unquote pattern. Call
7600 add_exact_match.
7601 (Version_script_info::get_name_to_match): New function.
7602 (Version_script_info::get_symbol_version): New function.
7603 (Version_script_info::get_symbol_version_helper): Remove.
7604 (Version_script_info::check_unmatched_names): Call unquote.
7605 * script.h (class Version_script_info): Change get_symbol_version
7606 to be non-inline and add is_global parameter; change all callers.
7607 Rewrite symbol_is_local. Update declarations. Define struct
7608 Version_tree_match, Exact, Globs. Don't define struct Lookup.
7609 Remove globals_ and locals_ members. Add exact_, globs_,
7610 default_version_, is_global_.
7611 (Version_script_info::Glob): Remove pattern, add expression and
7612 is_global. Update constructor. Change all callers.
7613 * dynobj.cc (Versions::finalize): Mark the version symbol as the
7614 default version.
7615 (Versions::symbol_section_contents): If a symbol is undefined, or
7616 defined in a dynamic object, set the version index to
7617 VER_NDX_LOCAL.
7618 * symtab.cc (Symbol_table::add_from_relobj): Don't call
7619 symbol_is_local.
7620 (Symbol_table::add_from_pluginobj): Likewise.
7621 * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7622
7623 2010-01-11 Doug Kwan <dougkwan@google.com>
7624
7625 * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7626 (incremental_dump_LDADD): Add linking option for libintl.
7627 * Makefile.in: Regenerate.
7628
7629 2010-01-11 H.J. Lu <hongjiu.lu@intel.com>
7630
7631 PR gold/11144
7632 * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7633 instead of -Ds.
7634 * testsuite/Makefile.in: Regenerated.
7635
7636 2010-01-10 Doug Kwan <dougkwan@google.com>
7637
7638 * options.h (DEFINE_var): Use parentheses around argument varname__
7639 in macro body to avoid any unintended subsequent substitutions.
7640
7641 2010-01-10 Ian Lance Taylor <iant@google.com>
7642
7643 * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7644 candidates before doing symbol resolution.
7645
7646 * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7647 ODR candidates if only one is weak.
7648
7649 2010-01-08 Ian Lance Taylor <iant@google.com>
7650
7651 * script.cc (Version_script_info::build_expression_list_lookup):
7652 Don't warn about ambiguous version, just record the ambiguity.
7653 (Version_script_info::get_symbol_version_helper): Give error if
7654 version is ambiguous.
7655
7656 2010-01-08 Doug Kwan <dougkwan@google.com>
7657
7658 * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7659 prev_data_size_ and prev_addralign_. Remove initializer for
7660 deleted data member has_been_changed_.
7661 (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7662 to determine if the table is empty.
7663 (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7664 Remove.
7665 (Stub_table::add_reloc_stub): Define method in class definition
7666 instead of just declaring it there.
7667 (Stub_table::add_cortex_a8_stub): New method definition.
7668 (Stub_table::update_data_size_and_addralign): Ditto.
7669 (Stub_table::finalize_stubs): Ditto.
7670 (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7671 (Stub_table::do_addralign_): Return address alignment in the
7672 (Stub_table::do_reset_address_and_file_offset): Define method in
7673 class definition instead of declaring it there. Set current data
7674 size to be the data size of the previous pass.
7675 (Stub_table::set_final_data_size): Use current data size as the
7676 final data size.
7677 (Stub_table::relocate_stub): Change parameter type of stub from
7678 Reloc_stub pointer to Stub pointer.
7679 (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7680 (Stub_table::Cortex_a8_stub_list): New typedef.
7681 (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7682 Stub_table::prev_addralign_): New data member.
7683 (Arm_relobj::Arm_relobj): Initialize data member
7684 section_has_cortex_a8_workaround_.
7685 (Arm_relobj::section_has_cortex_a8_workaround,
7686 Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7687 definitions.
7688 (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7689 declarations.
7690 (Target_arm::relocate_stub): Change parameter type of stub from
7691 Reloc_stub pointer to Stub pointer.
7692 (Insn_template::size, Insn_template::alignment): Handle
7693 THUMB16_SPECIAL_TYPE.
7694 (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7695 Stub_table::update_data_size_and_addralign,
7696 Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7697 definitions.
7698 (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7699 (Stub_table::do_write): Ditto.
7700 (Target_arm::do_relax): Adjust code for changes in Stub_table.
7701
7702 2010-01-08 Ian Lance Taylor <iant@google.com>
7703
7704 PR 11108
7705 * symtab.h (class Symbol): Remove fields is_target_special_ and
7706 has_plt_offset_. Add field is_defined_in_discarded_section_.
7707 (Symbol::is_defined_in_discarded_section): New function.
7708 (Symbol::set_is_defined_in_discarded_section): New function.
7709 (Symbol::has_plt_offset): Rewrite.
7710 (Symbol::set_plt_offset): Verify that new offset is not -1U.
7711 * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7712 Don't initialize is_target_special_ or has_plt_offset_.
7713 Initialize is_defined_in_discarded_section_.
7714 (Symbol_table::add_from_relobj): If appropriate, set
7715 is_defined_in_discarded_section.
7716 * resolve.cc (Symbol::override_base_with_special): Don't test
7717 is_target_special_. Change has_plt_offset_ to has_plt_offset().
7718 * target-reloc.h (relocate_section): Do special handling for
7719 symbols defined in discarded sections for global symbols as well
7720 as local symbols.
7721
7722 2010-01-08 Ian Lance Taylor <iant@google.com>
7723
7724 * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7725 the SHT_SYMTAB case.
7726
7727 2010-01-08 Ian Lance Taylor <iant@google.com>
7728
7729 * object.cc (Sized_relobj::do_layout): Don't get confused if
7730 layout_eh_frame returns NULL.
7731
7732 2010-01-08 Ian Lance Taylor <iant@google.com>
7733
7734 PR 11084
7735 * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7736 dynamic symbol table, use the normal symbol table.
7737 (Sized_dynobj::do_read_symbols): Remove assertion about type of
7738 symbol table.
7739
7740 2010-01-08 Ian Lance Taylor <iant@google.com>
7741
7742 PR 11072
7743 * layout.cc (Layout::include_section): Remove .gnu_debuglink
7744 sections.
7745
7746 2010-01-08 H.J. Lu <hongjiu.lu@intel.com>
7747
7748 * version.cc (print_version): Change to "Copyright 2010".
7749
7750 2010-01-08 Ian Lance Taylor <iant@google.com>
7751
7752 PR 10287
7753 PR 11063
7754 * i386.cc (class Target_i386): Change return type of plt_section
7755 to be non-const.
7756 (class Output_data_plt_i386): Add tls_desc_rel_ field.
7757 (Output_data_plt_i386::Output_data_plt_i386): Initialize
7758 tls_desc_rel_ field.
7759 (Output_data_plt_i386::rel_tls_desc): New function.
7760 (Target_i386::rel_tls_desc_section): New function.
7761 (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7762 (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7763 R_386_TLS_DESC reloc in rel_tls_desc_section.
7764 * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7765 Define struct Tlsdesc_info.
7766 (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7767 (Target_x86_64::do_reloc_symbol_index): New function.
7768 (Target_x86_64::add_tlsdesc_info): New function.
7769 (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7770 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7771 tlsdesc_rel_ field.
7772 (Output_data_plt_x86_64::rela_plt): Rename from rel_plt. Change
7773 all callers.
7774 (Output_data_plt_x86_64::rela_tlsdesc): New function.
7775 (Target_x86_64::rela_tlsdesc_section): New function.
7776 (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7777 handling.
7778 (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7779 (Target_x86_64::do_reloc_addend): New function.
7780 R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7781 * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7782 declarations. Define TARGET_CODE. Add arg field to u1_ union.
7783 (Output_reloc::type): New function.
7784 (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7785 (Output_reloc::is_target_specific): New function.
7786 (Output_reloc::target_arg): New function.
7787 (class Output_reloc) [SHT_RELA]: Add four new constructors for
7788 absolute relocs and target specific relocs.
7789 (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7790 add_target_specific.
7791 (class Output_data_reloc) [SHT_RELA]: Likewise.
7792 * output.cc (Output_reloc::Output_reloc): Add four new versions
7793 for absolute relocs and target specific relocs.
7794 (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7795 (Output_reloc::get_symbol_index): Likewise.
7796 (Output_reloc::local_section_offset): Check that local_sym_index_
7797 is not TARGET_CODE or 0.
7798 (Output_reloc::symbol_value): Likewise.
7799 (Output_reloc::write) [SHT_RELA]: Call target for target specific
7800 reloc.
7801 * target.h (class Target): Add reloc_symbol_index and reloc_addend
7802 functions. Add do_reloc_symbol_index and do_reloc_addend virtual
7803 functions.
7804 * layout.cc (add_target_dynamic_tags): Use output section for
7805 DT_PLTRELSZ and DT_JMPREL.
7806
7807 2010-01-07 Ian Lance Taylor <iant@google.com>
7808
7809 PR 11061
7810 * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7811 function.
7812 (class Output_data_reloc_generic): Define.
7813 (class Output_data_reloc_base): Change base class to
7814 Output_data_reloc_generic. Change add() method to call
7815 bump_relative_reloc_count for a relative reloc. Remove
7816 sort_relocs_ field.
7817 * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7818 to sort_relocs().
7819 * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7820 Output_data_reloc_generic*. Add DT_RELCOUNT/DT_RELACOUNT tag if
7821 appropriate.
7822 * layout.h (class Layout): Update declaration.
7823
7824 2010-01-07 Ian Lance Taylor <iant@google.com>
7825
7826 * output.h (class Output_data): Add const version of
7827 output_section and do_output_section.
7828 (class Output_section_data): Add const version of
7829 do_output_section.
7830 (class Output_section): Likewise.
7831 * layout.cc (Layout::add_target_dynamic_tags): New function.
7832 * layout.h (class Layout): Update declarations.
7833 * arm.cc (Target_arm::do_finalize_sections): Use
7834 add_target_dynamic_tags.
7835 * i386.cc (Target_i386::do_finalize_sections): Likewise.
7836 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7837 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7838 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7839
7840 2010-01-07 Ian Lance Taylor <iant@google.com>
7841
7842 PR 11042
7843 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7844 object as needed.
7845
7846 2010-01-07 Dmitry Gorbachev <d.g.gorbachev@gmail.com>
7847 Ian Lance Taylor <iant@google.com>
7848
7849 PR 11019
7850 * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7851 Xindex::read_symtab_xindex.
7852
7853 2010-01-07 Doug Kwan <dougkwan@google.com>
7854
7855 * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7856 (Insn_template::thumb16_bcond_insn): New method declaration.
7857 (Insn_template): Fix spelling.
7858 (Stub::thumb16_special): New method declaration.
7859 (Stub::do_write): Define virtual method which was previously pure
7860 virtual.
7861 (Stub::do_thumb16_special): New method declaration.
7862 (Stub::do_fixed_endian_write): New template member.
7863 (Reloc_stub::do_write): Remove.
7864 (Reloc_stub::do_fixed_endian_write): Remove.
7865 (Cortex_a8_stub): New class definition.
7866 (Stub_factory::make_cortex_a8_stub): New method definition.
7867 (Stub_factory::Stub_factory): Add missing static storage class
7868 qualifier for elf32_arm_stub_a8_veneer_blx.
7869
7870 2010-01-07 Ian Lance Taylor <iant@google.com>
7871
7872 PR 10980
7873 * options.h (class General_options): Add --warn-unresolved-symbols
7874 and --error-unresolved-symbols.
7875 * errors.cc (Errors::undefined_symbol): Implement
7876 --warn-unresolved-symbols.
7877
7878 * options.h (class General_options): Add -z text and -z textoff.
7879 * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7880
7881 2010-01-06 Sriraman Tallam <tmsriram@google.com>
7882
7883 * gc.h (Garbage_collection::Cident_section_map): New typedef.
7884 (Garbage_collection::cident_sections): New function.
7885 (Garbage_collection::add_cident_section): New function.
7886 (Garbage_collection::cident_sections_): New member.
7887 (gc_process_relocs): Add references to sections whose names are C
7888 identifiers.
7889 * gold.h (cident_section_start_prefix): New constant.
7890 (cident_section_stop_prefix): New constant.
7891 (is_cident): New function.
7892 * layout.cc (Layout::define_section_symbols): Replace string constants
7893 with the newly defined constants.
7894 * object.cc (Sized_relobj::do_layout): Track sections whose names are
7895 C identifiers.
7896 * testsuite/Makefile.am: Add gc_orphan_section_test.
7897 * testsuite/Makefile.in: Regenerate.
7898 * testsuite/gc_orphan_section_test.cc: New file.
7899 * testsuite/gc_orphan_section_test.sh: New file.
7900
7901 2010-01-06 Ian Lance Taylor <iant@google.com>
7902
7903 PR 10980
7904 * options.h (class General_options): Add --warn-shared-textrel.
7905 * layout.cc (Layout::finish_dynamic_section): Implement
7906 --warn-shared-textrel.
7907
7908 PR 10980
7909 * options.h (class General_options): Add --warn-multiple-gp.
7910
7911 2010-01-06 Viktor Kutuzov <vkutuzov@accesssoftek.com>
7912
7913 * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7914 $(THREADSLIB) and $(LIBDL).
7915 * Makefile.in: Rebuild.
7916
7917 2010-01-06 Ian Lance Taylor <iant@google.com>
7918
7919 PR 10980
7920 * options.cc (General_options::parse_section_start): New function.
7921 (General_options::section_start): New function.
7922 (General_options::General_options): Initialize all members.
7923 * options.h: Include <map>
7924 (class General_options): Add --section-start. Add section_starts_
7925 member.
7926 * layout.cc (Layout::attach_allocated_section_to_segment): If
7927 --section-start was used, set the address of the segment. Remove
7928 local sort_sections.
7929 (Layout::relaxation_loop_body): If the address of the load segment
7930 has been set by --section-start, don't use it.
7931 * output.h (Output_segment::update_flags_for_output_section): New
7932 function.
7933 * output.cc (Output_segment::add_output_section): Call
7934 update_flags_for_output_section.
7935
7936 2010-01-05 Ian Lance Taylor <iant@google.com>
7937
7938 PR 10980
7939 * options.h (class General_options): Add --undefined-version.
7940 * script.cc (struct Version_expression): Add was_matched_by_symbol
7941 field.
7942 (Version_script_info::matched_symbol): New function.
7943 (Version_script_info::get_symbol_version_helper): Call
7944 matched_symbol.
7945 (Version_script_info::check_unmatched_names): New function.
7946 * script.h (class Version_script_info): Update declarations.
7947 * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7948
7949 * options.h (class General_options): Use DEFINE_bool_alias for
7950 allow_multiple_definition.
7951 * resolve.cc (Symbol_table::should_override): Don't test
7952 allow_multiple_definition.
7953
7954 PR 10980
7955 * options.h (class General_options): Add --cref.
7956 * main.cc (main): Print cref table if --cref. Don't close mapfile
7957 until after printing cref table.
7958 * cref.cc: Include "symtab.h".
7959 (class Cref_inputs): Define Cref_table_compare and Cref_table.
7960 (Cref_table_compare::operator()): New function.
7961 (Cref_inputs::gather_cref): New function.
7962 (filecol): New static const.
7963 (Cref_inputs::print_cref): New function.
7964 (Cref::print_cref): New function.
7965 * cref.h: Include <cstdio>.
7966 (class Cref): Update declarations.
7967 * mapfile.h (Mapfile::file): New function.
7968 * object.h (class Object): Define Symbols. Declare virtual
7969 do_get_global_symbols.
7970 (Object::get_global_symbols): New function.
7971 * object.cc (Input_objects::add_object): Pass object to cref_ if
7972 --cref.
7973 (Input_objects::archive_start): Likewise.
7974 (Input_objects::archive_stop): Likewise.
7975 (Input_objects::print_cref): New function.
7976 * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7977 * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7978 --cref.
7979 * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7980 function.
7981 * plugin.h (class Sized_pluginobj): Update declarations.
7982
7983 2010-01-05 Ian Lance Taylor <iant@google.com>
7984
7985 * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7986 to is_default_version. Rename insdef to insdefault.
7987 (Symbol_table::add_from_relobj): Rename def to is_default_version
7988 and local to is_forced_local.
7989 (Symbol_table::add_from_pluginobj): Likewise.
7990 (Symbol_table::add_from_dynobj): Likewise.
7991 (Symbol_table::define_special_symbol): Rename insdef to
7992 insdefault.
7993
7994 2010-01-04 Ian Lance Taylor <iant@google.com>
7995
7996 PR 10980
7997 * options.h (class General_options): Add
7998 --allow-multiple-definition and -z muldefs.
7999 * resolve.cc (Symbol_table::should_override): Don't warn about a
8000 multiple symbol definition if --allow-multiple-definition or -z
8001 muldefs.
8002
8003 PR 10980
8004 * options.h (class General_options): Add --add-needed and
8005 --copy-dt-needed-entries. Tweak --as-needed help entry.
8006 * object.cc (Input_objects::check_dynamic_dependencies): Give an
8007 error if --copy-dt-needed-entries aka --add-needed is used and
8008 would cause a change in behaviour.
8009
8010 PR 10980
8011 * options.h (class General_options): Add -G as a short version of
8012 --shared. Add no-op options -assert, -g, and -i.
8013
8014 2010-01-04 Sriraman Tallam <tmsriram@google.com>
8015
8016 * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8017 check for .text or .gnu.linkonce.t sections.
8018 * icf.cc (Icf::find_identical_sections): Ditto.
8019 Change the detection for mangled function name within the section
8020 name.
8021 * icf.h (is_section_foldable_candidate): New function.
8022
8023 2009-12-30 Ian Lance Taylor <iant@google.com>
8024
8025 PR 10980
8026 * options.h (class General_options): Permit two dashes with
8027 --retain-symbols-file.
8028
8029 2009-12-30 Ian Lance Taylor <iant@google.com>
8030
8031 PR 10979
8032 * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8033 don't put the file header and segment headers in the text
8034 segment.
8035
8036 PR 10979
8037 * common.cc (Sort_commons::operator()): Stabilize sort when both
8038 entries are NULL.
8039 (Symbol_table::do_allocate_commons_list): When allocating common
8040 symbols, skip a symbol which is no longer common.
8041 * symtab.h (Symbol::is_common): Test whether the symbol comes from
8042 an object before checking its type.
8043 * testsuite/common_test_2.c: New file.
8044 * testsuite/common_test_3.c: New file.
8045 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8046 (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8047 (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8048 (common_test_2_pic.o, common_test_2.so): New targets.
8049 (common_test_3_pic.o, common_test_3.so): New targets.
8050 * testsuite/Makefile.in: Rebuild.
8051
8052 PR 10979
8053 * script.cc (read_input_script): If we see a new SECTIONS clause,
8054 and we have added an input section, give an error.
8055 * layout.h (class Layout): Add have_added_input_section function.
8056 Add have_added_input_section_ field.
8057 * layout.cc (Layout::Layout): Initialize
8058 have_added_input_section_.
8059 (Layout::layout): Set have_added_input_section_.
8060 (Layout::layout_eh_frame): Likewise.
8061
8062 2009-12-30 Ian Lance Taylor <iant@google.com>
8063
8064 PR 10931
8065 * options.h (class General_options): Add --sort-common option.
8066 * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8067 * common.cc (Sort_common): Add sort_order parameter to
8068 constructor. Add sort_order_ field.
8069 (Sort_commons::operator): Check sort_order_.
8070 (Symbol_table::allocate_commons): Determine the sort order.
8071 (Symbol_table::do_allocate_commons): Add sort_order parameter.
8072 Change all callers.
8073 (Symbol_table::do_allocate_commons_list): Likewise.
8074
8075 2009-12-30 Ian Lance Taylor <iant@google.com>
8076
8077 PR 10916
8078 * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8079 symbols from this object, don't change the visibility of an
8080 undefined symbol.
8081 * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8082
8083 2009-12-30 Ian Lance Taylor <iant@google.com>
8084
8085 PR 10861
8086 * script.h (class Version_script_info): Define Language enum.
8087 Update declarations. Define Glob, Exact, and Lookup types. Add
8088 new fields globals_, locals_, and is_finalized_.
8089 * script.cc: Various formatting fixes.
8090 (class Parser_closure): Change language_stack_ from a vector of
8091 std::string to one of Version_script_info::Language. Adjust all
8092 uses accordingly.
8093 (class Lazy_demangler): Remove.
8094 (struct Version_expression): Change language from std::string to
8095 Version_script_info::Language.
8096 (Version_script_info::Version_script_info): New function.
8097 (Version_script_info::~Version_script_info): Don't call clear.
8098 (Version_script_info::finalize): New function.
8099 (Version_script_info::build_lookup_tables): New function.
8100 (Version_script_info::build_expression_list_lookup): New
8101 function.
8102 (Version_script_info::get_symbol_version_helper): Rewrite to use
8103 lookup tables.
8104 (Version_script_info::print_expression_list): Adjust to use
8105 Version_script_info::Language.
8106 (script_push_lex_into_version_mode): Check that the version script
8107 has not been finalized.
8108 (version_script_push_lang): Change language string to
8109 Version_script_info::Language.
8110 * options.cc (Command_line::version_script): New function.
8111 * options.h (class General_options): Add finalize_dynamic_list
8112 function. Change version_script from declaration to definition.
8113 * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8114 * testsuite/version_script.map: Remove duplicate def of foo.
8115 * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8116 version_script.map.
8117 * testsuite/Makefile.in: Rebuild.
8118
8119 2009-12-30 Ian Lance Taylor <iant@google.com>
8120
8121 PR 10843
8122 * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8123 if the input symbol index is 0, make the output symbol index 0.
8124
8125 2009-12-30 Ian Lance Taylor <iant@google.com>
8126
8127 PR 10670
8128 * options.h (class General_options): Add -x/--discard-all.
8129 * object.cc (Sized_relobj::do_count_local_symbols): Handle
8130 --discard-all. If the local symbol needs a dynamic entry, check
8131 that before handling --discard-locals.
8132
8133 2009-12-30 Ian Lance Taylor <iant@google.com>
8134
8135 PR 10450
8136 * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8137 flags to PF_R.
8138 (Output_segment::add_output_section): Don't change the flags if
8139 the type is PT_TLS.
8140
8141 PR 10450
8142 * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8143 GNU hash table if they need a dynamic value. Otherwise, don't add
8144 them if they are defined in a dynamic object or are forced local.
8145
8146 2009-12-29 Ian Lance Taylor <iant@google.com>
8147
8148 PR 10450
8149 * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8150 .gnu.hash table for a 32-bit target.
8151
8152 PR 10450
8153 * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8154 regular and a dynamic object only needs a dynamic symbol table
8155 entry if it is externally visible.
8156
8157 PR 10450
8158 * i386.cc (class Target_i386): Initialize global_offset_table_ in
8159 constructor. Add global_offset_table_ field.
8160 (Target_i386::got_section): Set global_offset_table_.
8161 (Target_i386::do_finalize_sections): Set global_offset_table_
8162 size.
8163 * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8164 in constructor. Add global_offset_table_ field.
8165 (Target_x86_64::got_section): Set global_offset_table_.
8166 (Target_x86_64::do_finalize_sections): Set global_offset_table_
8167 size.
8168
8169 * layout.cc (Layout::Layout): Initialize increase_relro_.
8170 (Layout::get_output_section): Add is_relro, is_last_relro, and
8171 is_first_non_relro parameters. Change all callers.
8172 (Layout::choose_output_section): Likewise.
8173 (Layout::add_output_section_data): Likewise.
8174 (Layout::make_output_section): Likewise.
8175 (Layout::set_segment_offsets): Clear increase_relro when using a
8176 linker script.
8177 * layout.h (class Layout): Add increase_relro method. Add
8178 increase_relro_ field. Update declarations.
8179 * output.cc (Output_section::Output_section): Initialize
8180 is_last_relro_ and is_first_non_relro_.
8181 (Output_segment::add_output_section): Group relro sections is
8182 do_sort is true. Handle is_last_relro and is_first_non_relro.
8183 (Output_segment::maximum_alignment): Remove relro handling.
8184 (Output_segment::set_section_addresses): Add increase_relro
8185 parameter. Change all callers. Add initial alignment to align
8186 relro sections on separate page. Remove old relro handling.
8187 (Output_segment::set_section_list_addresses): Remove in_relro
8188 parameter. Change all callers.
8189 (Output_segment::set_offset): Add increase parameter. Change all
8190 callers. Remove old relro handling.
8191 * output.h (class Output_section): Add new methods: is_last_relro,
8192 set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8193 Add is_last_relro_ and is_first_non_relro_ fields.
8194 * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8195 Create separate .got.plt section. Call increase_relro.
8196 * x86_64.cc (Target_x86_64::got_section): Likewise.
8197 * testsuite/relro_script_test.t: Add .got.plt.
8198
8199 PR 10450
8200 * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8201 (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8202 (Layout::finalize): Call set_dynamic_symbol_size.
8203 (Layout::set_dynamic_symbol_size): New function.
8204 * layout.h (class Layout): Add dynamic_symbol_ field. Declare
8205 set_dynamic_symbol_size.
8206
8207 PR 10450
8208 * output.h (class Output_section): Add is_entsize_zero_ field.
8209 * output.cc (Output_section::Output_section): Initialize
8210 is_entsize_zero_.
8211 (Output_section::set_entsize): If two different entsizes are
8212 requested, force it to zero.
8213 (Output_section::add_input_section): Set flags for .debug_str
8214 before updating section flags. Set entsize.
8215 (Output_section::update_flags_for_input_section): Set SHF_MERGE
8216 and SHF_STRING if all input sections have those flags.
8217
8218 2009-12-29 Rafael Espindola <espindola@google.com>
8219
8220 * main.cc (main): Fix the sys time reporting.
8221 * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8222 reporting.
8223
8224 2009-12-29 Sriraman Tallam <tmsriram@google.com>
8225
8226 * options.cc (General_options::parse_version): Allow -v to exit
8227 without an error if there is nothing to link.
8228
8229 2009-12-29 Ian Lance Taylor <iant@google.com>
8230
8231 * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8232 using a version of gcc before 4.1.
8233 * configure: Rebuild.
8234
8235 2009-12-28 Chris Demetriou <cgd@google.com>
8236
8237 * attributes.cc (Output_attributes_section_data::do_write): Use
8238 std::vector::front rather than std::vector::data.
8239
8240 2009-12-28 Ian Lance Taylor <iant@google.com>
8241
8242 * symtab.h (class Symbol_table): Add enum Defined.
8243 * resolve.cc (Symbol_table::should_override): Add defined
8244 parameter. Change all callers. Test whether object is NULL
8245 before calling a method on it.
8246 (Symbol_table::report_resolve_problem): Add defined parameter.
8247 Change all callers.
8248 (Symbol_table::should_override_with_special): Likewise.
8249 * symtab.cc (Symbol_table::define_in_output_data): Add defined
8250 parameter. Change all callers.
8251 (Symbol_table::do_define_in_output_data): Likewise.
8252 (Symbol_table::define_in_output_segment): Likewise.
8253 (Symbol_table::do_define_in_output_segment): Likewise.
8254 (Symbol_table::define_as_constant): Likewise.
8255 (Symbol_table::do_define_as_constant): Likewise.
8256 * script.h (class Symbol_assignment): Add is_defsym parameter to
8257 constructor; change all callers.
8258 * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8259 parameter. Change all callers. Add is_defsym_ field.
8260 (class Parser_closure): Add parsing_defsym parameter to
8261 constructor; change all callers. Add parsing_defsym accessor
8262 function. Add parsing_defsym_ field.
8263
8264 2009-12-28 Ian Lance Taylor <iant@google.com>
8265
8266 * gold.cc (queue_middle_tasks): Fix formatting.
8267 * object.cc (Relobj::is_section_name_included): Likewise.
8268
8269 2009-12-23 Ian Lance Taylor <iant@google.com>
8270
8271 * i386.cc (Target_i386::do_calls_non_split): Recognize
8272 -fsplit-stack prologue for a function with a static chain.
8273 * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8274 -fsplit-stack prologue when using %r11.
8275
8276 2009-12-21 Sriraman Tallam <tmsriram@google.com>
8277
8278 * options.cc (General_options::parse_version): Make -v continue and do
8279 the link like GNU ld does.
8280
8281 2009-12-17 Rafael Avila de Espindola <espindola@google.com>
8282
8283 * Makefile.am (CCFILES): Add timer.cc.
8284 (HFILES): Add timer.h.
8285 * configure.ac: Check for sysconf and times.
8286 * main.cc: include timer.h.
8287 (main): Use Timer instead of get_run_time.
8288 * timer.cc: New.
8289 * timer.h: New.
8290 * workqueue.cc: include timer.h.
8291 (Workqueue::find_and_run_task):
8292 Report user, sys and wall time.
8293 * Makefile.in: Regenerate.
8294 * config.in: Regenerate.
8295 * configure: Regenerate.
8296
8297 2009-12-16 Doug Kwan <dougkwan@google.com>
8298
8299 * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8300 sections.
8301 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8302 relaxed input sections.
8303 * output.cc (Output_section::find_relaxed_input_section): Change
8304 return type to Output_relaxed_input_section pointer. Adjust code
8305 for new type of relaxed_input_section_map_.
8306 * output.h (Output_section::find_relaxed_input_section): Change
8307 return type to Output_relaxed_input_section pointer.
8308 (Output_section::Output_relaxed_input_section_by_input_section_map):
8309 New type.
8310 (Output_section::relaxed_input_section_map_): Change type to
8311 Output_section::Output_relaxed_input_section_by_input_section_map.
8312 * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8313 input section.
8314
8315 2009-12-15 Ian Lance Taylor <iant@google.com>
8316
8317 * layout.cc (Layout::create_shstrtab): Only write out after input
8318 sections if we are compressing debug sections.
8319
8320 2009-12-15 Ian Lance Taylor <iant@google.com>
8321
8322 * archive.cc (Archive::add_symbols): Only look up a symbol without
8323 a version if there is, in fact, a version.
8324
8325 2009-12-14 Ian Lance Taylor <iant@google.com>
8326
8327 Revert -Wshadow changes, all changes from:
8328 2009-12-11 Doug Kwan <dougkwan@google.com>
8329 2009-12-11 Nick Clifton <nickc@redhat.com>
8330 * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8331
8332 2009-12-11 Doug Kwan <dougkwan@google.com>
8333
8334 * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8335 due to -Wshadow.
8336 * attributes.cc (Object_attribute::size): Ditto.
8337 (Attributes_section_data::size): Ditto.
8338 (Attributes_section_data::Attributes_section_data): Ditto.
8339 (Output_attributes_section_data::do_write): Ditto.
8340 * attributes.h (Object_attribute::set_type): Ditto.
8341 * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8342
8343 2009-12-11 Nick Clifton <nickc@redhat.com>
8344
8345 * archive.cc: Fix shadowed variable warnings.
8346 * arm.cc: Likewise.
8347 * compressed_output.cc: Likewise.
8348 * compressed_output.h: Likewise.
8349 * configure: Likewise.
8350 * dwarf_reader.cc: Likewise.
8351 * dynobj.cc: Likewise.
8352 * dynobj.h: Likewise.
8353 * ehframe.cc: Likewise.
8354 * ehframe.h: Likewise.
8355 * errors.cc: Likewise.
8356 * expression.cc: Likewise.
8357 * fileread.cc: Likewise.
8358 * fileread.h: Likewise.
8359 * freebsd.h: Likewise.
8360 * i386.cc: Likewise.
8361 * icf.cc: Likewise.
8362 * incremental.h: Likewise.
8363 * layout.cc: Likewise.
8364 * layout.h: Likewise.
8365 * mapfile.cc: Likewise.
8366 * merge.cc: Likewise.
8367 * merge.h: Likewise.
8368 * object.cc: Likewise.
8369 * object.h: Likewise.
8370 * options.h: Likewise.
8371 * output.cc: Likewise.
8372 * output.h: Likewise.
8373 * parameters.cc: Likewise.
8374 * plugin.cc: Likewise.
8375 * powerpc.cc: Likewise.
8376 * reduced_debug_output.cc: Likewise.
8377 * reduced_debug_output.h: Likewise.
8378 * reloc.cc: Likewise.
8379 * reloc.h: Likewise.
8380 * resolve.cc: Likewise.
8381 * script-sections.cc: Likewise.
8382 * script.cc: Likewise.
8383 * script.h: Likewise.
8384 * sparc.cc: Likewise.
8385 * symtab.cc: Likewise.
8386 * symtab.h: Likewise.
8387 * target-select.cc: Likewise.
8388 * target-select.h: Likewise.
8389 * token.h: Likewise.
8390 * workqueue.cc: Likewise.
8391 * workqueue.h: Likewise.
8392 * x86_64.cc: Likewise.
8393
8394 2009-12-10 Doug Kwan <dougkwan@google.com>
8395
8396 * arm.cc (attributes.h): New include.
8397 (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8398 (Arm_relobj::~Arm_relobj): Delete object pointed by
8399 attributes_section_data_.
8400 (Arm_relobj::attributes_section_data): New method definition.
8401 (Arm_relobj::attributes_section_data_): New data member declaration.
8402 (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8403 (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8404 attributes_section_data_.
8405 (Arm_dynobj::attributes_section_data): New method definition.
8406 (Arm_dynobj::attributes_section_data_): New data member declaration.
8407 (Target_arm::Target_arm): Initialize attributes_section_data_. Change
8408 initialization value of may_use_blx_ to false.
8409 (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8410 Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8411 object attributes to compute results instead of hard-coding.
8412 (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8413 Target_arm::get_secondary_compatible_arch,
8414 Target_arm::set_secondary_compatible_arch
8415 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8416 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8417 New method declarations.
8418 (Target_arm::get_aeabi_object_attribute): New method definition.
8419 (Target_arm::attributes_section_data_): New data member declaration.
8420 (read_arm_attributes_section): New template definition.
8421 (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8422 (Arm_dynobj::do_read_symbols): Ditto.
8423 (Target_arm::do_finalize_sections): Merge attributes sections from
8424 input. Check for BLX use after attributes section merging.
8425 Fix __exidx_start and __exidx_end visibility. Create an
8426 .ARM.attributes section if necessary.
8427 (Target_arm::get_secondary_compatible_arch,
8428 Target_arm::set_secondary_compatible_arch,
8429 Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8430 Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8431 Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8432 New method definitions.
8433
8434 2009-12-09 Ian Lance Taylor <iant@google.com>
8435
8436 * plugin.cc (Plugin::load): Don't cast from void* to a function
8437 pointer.
8438
8439 2009-12-09 Ian Lance Taylor <iant@google.com>
8440
8441 * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8442 information fields.
8443
8444 2009-12-09 H.J. Lu <hongjiu.lu@intel.com>
8445
8446 * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8447 Replace two_file_shared_1.so with two_file_shared_2.so.
8448 * testsuite/Makefile.in: Regenerated.
8449
8450 2009-12-08 Doug Kwan <dougkwan@google.com>
8451
8452 * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8453 (HFILES): Add attributes.h and int_encoding.h.
8454 * Makefile.in: Regenerate.
8455 * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8456 function definitions to int_encoding.cc
8457 * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8458 prototypes to int_encoding.h
8459 * reduced_debug_output.cc (int_encoding.h): New include.
8460 (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8461 function definitions to int_encoding.cc
8462 (insert_into_vector, read_from_pointer): Move template definitions to
8463 int_encoding.h
8464 * attributes.cc: New file.
8465 * attributes.h: New file.
8466 * int_encoding.cc: New file.
8467 * int_encoding.h: New file.
8468
8469 2009-12-07 Rafael Avila de Espindola <espindola@google.com>
8470
8471 PR gold/11055
8472 * incremental-dump.cc (dump_incremental_inputs): New.
8473 (main): Use dump_incremental_inputs.
8474
8475 2009-12-07 H.J. Lu <hongjiu.lu@intel.com>
8476
8477 PR gold/10893
8478 * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8479 checking elfcpp::STT_FUNC.
8480 (Target_i386::Relocate::relocate): Likewise.
8481 * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8482
8483 * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8484 symbols from shared libraries into normal FUNC symbols.
8485
8486 * symtab.h (Symbol): Add is_func and use it.
8487
8488 2009-12-05 Doug Kwan <dougkwan@google.com>
8489
8490 * arm.cc (Target_arm::arm_info): Initialize new fields
8491 attributes_section and attributes_vendor.
8492 * i386.cc (Target_i386::i386_info): Same.
8493 * object.cc (Sized_relobj::do_layout): Skip attribute section.
8494 * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8495 fields attributes_section and attributes_vendor.
8496 * sparc.cc (Target_sparc::sparc_info): Same.
8497 * target.h (Target::attributes_section, Target::attributes_vendor,
8498 Target::is_attributes_section, Target::attribute_arg_type,
8499 Target::attributes_order): New method definitions.
8500 (Target::Target_info::attributes_section,
8501 Target::Target_info::attributes_vendor): New fields.
8502 (Target::do_attribute_arg_type, Target::do_attributes_order): New
8503 virtual method definitions.
8504 * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8505 attributes_section and attributes_vendor.
8506 * testsuite/testfile.cc (Target_test::test_target_info): Same.
8507
8508 2009-12-05 Doug Kwan <dougkwan@google.com>
8509
8510 * arm.cc: Update comments about interworking and stub generation.
8511 (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8512 considered as non-PIC.
8513 (Arm_relocate_functions::base_abs): Fix formatting.
8514 (Arm_relocate_functions::got_prel): Fix comment. Change interface
8515 of function to use GOT entry address instead of offset.
8516 (Target_arm::Scan::global): Issue an error if a symbol would need a
8517 PLT does not get one because it is untyped. Remove code to create
8518 dynamic symbols for relative branches.
8519 (Target_arm::Relocate::relocate: Use 0 instead of false since function
8520 takes unsigned integer instead of boolean.
8521
8522 2009-12-05 H.J. Lu <hongjiu.lu@intel.com>
8523
8524 * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8525 (two_file_test_LDADD): Likewise.
8526 (common_test_1_LDADD): Likewise.
8527 (exception_test_LDADD) Likewise.
8528 (weak_test_LDADD): Likewise.
8529 (many_sections_test_LDADD): Likewise.
8530 (initpri1_LDADD): Likewise.
8531 (script_test_1_LDADD): Likewise.
8532 (script_test_2_LDADD): Likewise.
8533 (justsyms_LDADD): Likewise.
8534 (binary_test_LDADD): Likewise.
8535 (large_LDADD): Likewise.
8536 * testsuite/Makefile.in: Regenerated.
8537
8538 2009-12-04 H.J. Lu <hongjiu.lu@intel.com>
8539
8540 * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8541 (Symbol_table::override_with_special): Likewise.
8542 (Symbol_table::add_from_object): Likewise.
8543
8544 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8545
8546 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8547 Don't set the data_offset twice.
8548
8549 2009-12-04 Rafael Avila de Espindola <espindola@google.com>
8550
8551 * testsuite/Makefile.in: Regenerate.
8552
8553 2009-12-03 Doug Kwan <dougkwan@google.com>
8554
8555 * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8556 (Target_arm::do_finalize_sections): Add parameter for symbol table
8557 pointer. Add __exidx_start and __exidx_end symbols as appropriate.
8558 * i386.cc (Target_i386::do_finalize_sections): Add an additional
8559 parameter for symbol table pointer.
8560 * layout.cc (Layout::finalize): Call Target::finalize_sections with
8561 an additional parameter for a pointer to symbol table.
8562 * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8563 parameter for a symbol table pointer.
8564 * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8565 * target.h (Target::finalize_sections, Target::do_finalize_sections):
8566 Ditto.
8567 * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8568 parameter for a symbol table pointer.
8569
8570 2009-12-03 Rafael Avila de Espindola <espindola@google.com>
8571
8572 * incremental.cc (Incremental_inputs_header)
8573 (Incremental_inputs_header_write, Incremental_inputs_entry)
8574 (Incremental_inputs_entry_write): Move ...
8575 * incremental.h (Incremental_inputs_header)
8576 (Incremental_inputs_header_write, Incremental_inputs_entry)
8577 (Incremental_inputs_entry_write): here.
8578
8579 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8580
8581 * incremental.cc (make_sized_incremental_binary): Set the target.
8582 Error if it is incompatible.
8583 * output.h (Output_file): Add filename method.
8584
8585 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8586
8587 * incremental.cc (Incremental_inputs_entry): Remove unused argument
8588 from the get_* methods.
8589
8590 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8591
8592 * incremental-dump.cc (main): Check that the offeset of a script is 0.
8593 * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8594 Write 0 for the data_offset of scripts.
8595
8596 2009-12-02 Rafael Avila de Espindola <espindola@google.com>
8597
8598 * testsuite/Makefile.am: Add the incremental_test.sh test.
8599 * testsuite/incremental_test.sh: New.
8600 * testsuite/incremental_test_1.c: New.
8601 * testsuite/incremental_test_2.c: New.
8602
8603 2009-12-01 Rafael Avila de Espindola <espindola@google.com>
8604
8605 * incremental-dump.cc (main): Fix typos.
8606
8607 2009-11-27 Rafael Avila de Espindola <espindola@google.com>
8608
8609 PR gold/11025
8610 * incremental-dump.cc (main): Use llu to print 64 bit values.
8611
8612 2009-11-26 Per Øyvind Karlsen <peroyvind@mandriva.org>
8613 H.J. Lu <hongjiu.lu@intel.com>
8614
8615 * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8616 $(LIBDL).
8617 (incremental_dump_LDADD): Likewise.
8618 * Makefile.in: Regenerated.
8619
8620 2009-11-25 Doug Kwan <dougkwan@google.com>
8621
8622 Revert:
8623
8624 2009-11-25 Doug Kwan <dougkwan@google.com>
8625
8626 * arm.cc (Target_arm::Target_arm): Move method definition
8627 outside of class definition. Add code to handle
8628 --target1-rel, --target1-abs and --target2= options.
8629 (Target_arm::get_reloc_reloc_type): Change method to be
8630 non-static and const.
8631 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8632 New data member declaration.
8633 (Target_arm::Scan::local, Target_arm::Scan::global,
8634 Target_arm::Relocate::relocate,
8635 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8636 Adjust call to Target_arm::get_real_reloc_type.
8637 (Target_arm::get_real_reloc_type): Use command line options
8638 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8639 * options.h (--target1-rel, --target1-abs, --target2): New
8640 ARM-only options.
8641
8642 2009-11-25 Doug Kwan <dougkwan@google.com>
8643
8644 * arm.cc (Target_arm::Target_arm): Move method definition outside of
8645 class definition. Add code to handle --target1-rel, --target1-abs
8646 and --target2= options.
8647 (Target_arm::get_reloc_reloc_type): Change method to be non-static
8648 and const.
8649 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8650 member declaration.
8651 (Target_arm::Scan::local, Target_arm::Scan::global,
8652 Target_arm::Relocate::relocate,
8653 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8654 call to Target_arm::get_real_reloc_type.
8655 (Target_arm::get_real_reloc_type): Use command line options to
8656 determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8657 * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8658 options.
8659
8660 2009-11-25 Doug Kwan <dougkwan@google.com>
8661
8662 * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8663 (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8664 (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8665 formatting.
8666 (Arm_relocate_functions::thm_call): Replace body with a call to
8667 Arm_relocate_functions::thumb_branch_common.
8668 (Arm_relocate_functions::thm_jump24,
8669 Arm_relocate_functions::thm_xpc22): New method definitions.
8670 (Arm_relocate_functions::thumb_branch_common): New method definition.
8671 (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8672 operator.
8673 (Target_arm::Relocate::relocate): Adjust call to thm_call.
8674 Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8675
8676 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8677
8678 * Makefile.am: Build incremental-dump
8679 * Makefile.in: Regenerate.
8680 * incremental-dump.cc: New.
8681 * incremental.cc (Incremental_inputs_header_data,
8682 Incremental_inputs_entry_data): Move to incremental.h
8683 * incremental.h: (Incremental_inputs_header_data,
8684 Incremental_inputs_entry_data): Move from incremental.cc
8685
8686 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8687
8688 * incremental.cc (Incremental_inputs_header,
8689 Incremental_inputs_header_write, Incremental_inputs_entry,
8690 Incremental_inputs_entry_write): Add a typedef with the data type.
8691
8692 2009-11-24 Rafael Avila de Espindola <espindola@google.com>
8693
8694 * incremental.cc (Incremental_inputs_header,
8695 Incremental_inputs_header_write, Incremental_inputs_entry,
8696 Incremental_inputs_entry_write): Update comment about which
8697 type has the filed descriptions.
8698
8699 2009-11-15 Doug Kwan <dougkwan@google.com>
8700
8701 * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8702 (Arm_relocate_functions::arm_branch_common): Change method defintion
8703 in class definition to a method declaration and update list of formal
8704 parameters.
8705 (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8706 Arm_relocation_functions::jump24): Adjust call to
8707 Arm_relocate_functions::arm_branch_common. Update list of formal
8708 parameters.
8709 (Arm_relocate_functions::xpc25): New method definition.
8710 (Arm_relocate_functions::arm_branch_common): Move method defintion
8711 out from class definition. Use stubs for mode-switching and extending
8712 branch ranges.
8713 (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8714 specially. Change code to enable use of stubs in ARM branches.
8715
8716 2009-11-10 Doug Kwan <dougkwan@google.com>
8717
8718 * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8719 in method declaration.
8720 (Target_arm::relocate_stub): New method declaration.
8721 (Target_arm::default_target): Change to return a pointer instead of
8722 a const reference.
8723 (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8724 Target_arm::default_target.
8725 (Arm_Relobj::do_relocate_sections): Remove options paramater in
8726 method definition.
8727 (Target_arm::relocate_section): Adjust view.
8728 (Target_arm::relocate_stub): New method definition.
8729
8730 2009-11-10 Doug Kwan <dougkwan@google.com>
8731
8732 * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8733 a format warning.
8734 * incremental.cc (open_incremental_binary): Initialized local
8735 variables to avoid warnings.
8736 * object.cc (make_elf_object): Ditto.
8737 * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8738 a format warning.
8739
8740 009-11-09 H.J. Lu <hongjiu.lu@intel.com>
8741
8742 PR gold/10930
8743 * testsuite/plugin_test.c: Include "config.h".
8744
8745 2009-11-09 Doug Kwan <dougkwan@google.com>
8746
8747 * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8748 (arm_symbol_value): Remove.
8749 (Arm_relocate_functions::arm_branch_common,
8750 Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8751 Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8752 Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8753 Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8754 Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8755 Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8756 Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8757 Arm_relocate_functions::thm_mobw_abs_nc,
8758 Arm_relocate_functions::thm_mov_abs,
8759 Arm_relocate_functions::movw_prel_nc,
8760 Arm_relocate_functions::thm_movt_abs,
8761 Arm_relocate_functions::movt_prel,
8762 Arm_relocate_functions::thm_movw_prel_nc,
8763 Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8764 (Target_arm::Relocate::relocate): Only decompose address into two
8765 parts if relocation type uses the thumb-bit and pass the actual
8766 bit instead of a flag indicating that the thumb-bit is used. Adjust
8767 calls to methods in Arm_relocate_functions for this change.
8768
8769 2009-11-08 Ian Lance Taylor <iant@google.com>
8770
8771 PR 10925
8772 * reloc.cc: Instantiate
8773 Sized_relobj::initialize_input_to_output_maps and
8774 Sized_relobj:free_input_to_output_maps.
8775
8776 2009-11-06 Ian Lance Taylor <iant@google.com>
8777
8778 PR 10876
8779 * defstd.cc (in_segment): Set only_if_ref true for "end".
8780
8781 2009-11-06 Doug Kwan <dougkwan@google.com>
8782
8783 * arm.cc (class Reloc_stub): Correct a comment.
8784 (Target_arm::Target_arm): Initialize arm_input_section_map_.
8785 (Target_arm::scan_section_for_stubs): New method declaration.
8786 (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8787 Change methods from private to protected.
8788 (Target_arm::do_may_relax): New method definition.
8789 (Target_arm::do_relax, Target_arm::group_sections,
8790 Target_arm::scan_reloc_for_stub,
8791 Target_arm::scan_reloc_section_for_stubs): New method declarations.
8792 (Target_arm::arm_input_section_map_): New data member declaration.
8793 (Target_arm::scan_reloc_for_stub,
8794 Target_arm::scan_reloc_section_for_stubs,
8795 Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8796 Target_arm::do_relax): New method definitions.
8797
8798 2009-11-06 Mikolaj Zalewski <mikolaj@google.com>
8799
8800 * configure.ac: Check for (struct stat)::st_mtim
8801 * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8802 * config.in: Regenerate.
8803 * configure: Regenerate.
8804
8805 2009-11-05 Ian Lance Taylor <iant@google.com>
8806
8807 PR 10910
8808 * output.cc (Output_segment::add_output_section): Add missing
8809 return statement.
8810
8811 2009-11-04 Ian Lance Taylor <iant@google.com>
8812
8813 PR 10880
8814 * object.h (class Object): Add is_needed and set_is_needed
8815 methods. Add is_needed_ field. Make bool fields into bitfields.
8816 * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8817 defined in a dynamic object and referenced by a regular object,
8818 set is_needed for the dynamic object.
8819 * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8820 if the file is marked with as_needed and it is not needed.
8821
8822 2009-11-04 Ian Lance Taylor <iant@google.com>
8823
8824 PR 10887
8825 * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8826 tags if data is discarded by linker script.
8827 * i386.cc (Target_i386::do_finalize_sections): Likewise.
8828 * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8829 * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8830 * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8831
8832 2009-11-04 Ian Lance Taylor <iant@google.com>
8833
8834 * layout.cc (Layout::get_output_section): Add is_interp and
8835 is_dynamic_linker_section parameters. Change all callers.
8836 (Layout::choose_output_section): Likewise.
8837 (Layout::make_output_section): Likewise.
8838 (Layout::add_output_section_data): Add is_dynamic_linker_section
8839 parameter. Change all callers.
8840 * layout.h (class Layout): Update declarations.
8841 * output.h (class Output_section): Add is_interp, set_is_interp,
8842 is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8843 Add is_interp_, is_dynamic_linker_section_ fields. Change
8844 generate_code_fills_at_write_ to a bitfield.
8845 * output.cc (Output_section::Output_sections): Initialize new
8846 fields.
8847 (Output_segment::add_output_section): Add do_sort parameter.
8848 Change all callers.
8849
8850 2009-11-03 Ian Lance Taylor <iant@google.com>
8851
8852 PR 10860
8853 * options.h (class General_options): Add --warn-common.
8854 * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8855 merging two common symbols.
8856 (Symbol_table::should_override): Handle --warn-common when merging
8857 a common symbol with a defined symbol. Use report_resolve_problem
8858 for multiple definitions.
8859 (Symbol_table::report_resolve_problem): New function.
8860 * symtab.h (class Symbol_table): Declare report_resolve_problem.
8861
8862 2009-11-03 Doug Kwan <dougkwan@google.com>
8863
8864 * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8865 stub_factory_.
8866 (Target_arm::stub_factory): New method definition.
8867 (Target_arm::new_arm_input_section,
8868 Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8869 Target_arm::reloc_uses_thumb_bit): New method declarations.
8870 (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8871 New type definitions.
8872 (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8873 member declarations.
8874 (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8875 Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8876 New method definitions.
8877
8878 2009-11-03 Ian Lance Taylor <iant@google.com>
8879
8880 * options.h (class General_options): Add --warn_constructors.
8881
8882 2009-11-03 Ian Lance Taylor <iant@google.com>
8883
8884 PR 10893
8885 * defstd.cc (in_section): Add entries for __rel_iplt_start,
8886 __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8887
8888 2009-11-03 Ian Lance Taylor <iant@google.com>
8889
8890 PR 10895
8891 * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8892 --msgid-bugs-address.
8893 (install-pdf): New target.
8894 (install-data_yes): Look up one directory to find mkinstalldirs.
8895
8896 2009-11-03 H.J. Lu <hongjiu.lu@intel.com>
8897
8898 * po/Make-in (.po.gmo): Don't generate .gmo files in source
8899 tree.
8900
8901 2009-10-30 Doug Kwan <dougkwan@google.com>
8902
8903 * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8904
8905 2009-10-30 Doug Kwan <dougkwan@google.com>
8906
8907 * arm.cc (Stub_addend_reader): New struct template definition
8908 and partial specializations.
8909 (Stub_addend_reader::operator()): New method definition for a
8910 partially specialized template.
8911
8912 2009-10-30 Doug Kwan <dougkwan@google.com>
8913
8914 * arm.cc (Arm_relobj::processor_specific_flags): New method
8915 definition.
8916 (Arm_relobj::do_read_symbols): New method declaration.
8917 (Arm_relobj::processor_specific_flags_): New data member declaration.
8918 (Arm_dynobj): New class definition.
8919 (Target_arm::do_finalize_sections): Add input_objects parameter.
8920 (Target_arm::do_adjust_elf_header): New method declaration.
8921 (Target_arm::are_eabi_versions_compatible,
8922 (Target_arm::merge_processor_specific_flags): New method declaration.
8923 (Target_arm::do_make_elf_object): New overloaded method definitions
8924 and declaration.
8925 (Arm_relobj::do_read_symbols): New method definition.
8926 (Arm_dynobj::do_read_symbols): Ditto.
8927 (Target_arm::do_finalize_sections): Add input_objects parameters.
8928 Merge processor-specific flags from all input objects.
8929 (Target_arm::are_eabi_versions_compatible,
8930 Target_arm::merge_processor_specific_flags,
8931 Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8932 New method definitions.
8933 * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8934 Input_objects pointer type parameter.
8935 * layout.cc (Layout::finalize): Pass input objects to target's.
8936 finalize_sections function.
8937 * output.cc (Output_file_header::do_sized_write): Set ELF file
8938 header's processor-specific flags.
8939 * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8940 Input_objects pointer type parameter.
8941 * sparc.cc (Target_sparc::do_finalize_sections): Same.
8942 * target.h (Input_objects): New forward class declaration.
8943 (Target::processor_specific_flags,
8944 Target::are_processor_specific_flags_sect): New method definitions.
8945 (Target::finalize_sections): Add input_objects parameter.
8946 (Target::Target): Initialize processor_specific_flags_ and
8947 are_processor_specific_flags_set_.
8948 (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8949 parameter.
8950 (Target::set_processor_specific_flags): New method definition.
8951 (Target::processor_specific_flags_,
8952 Target::are_processor_specific_flags_set_): New data member
8953 declarations.
8954 * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8955 Input_objects pointer type parameter.
8956
8957 2009-10-30 Doug Kwan <dougkwan@google.com>
8958
8959 * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8960
8961 2009-10-28 Ian Lance Taylor <iant@google.com>
8962
8963 * object.h (class Relobj): Drop options parameter from
8964 gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8965 do_scan_relocs, do_relocate. Change all callers.
8966 (class Sized_relobj): Drop options parameters from
8967 do_gc_process_relocs, do_scan_relocs, do_relocate,
8968 do_relocate_sections, relocate_sections, emit_relocs_scan,
8969 emit_relocs_scan_reltype. Change all callers.
8970 (struct Relocate_info): Remove options field and all references to
8971 it.
8972 * reloc.h (class Read_relocs): Remove options constructor
8973 parameter and options_ field. Change all callers.
8974 (class Gc_process_relocs, class Scan_relocs): Likewise.
8975 (class Relocate_task): Likewise.
8976 * target-reloc.h (scan_relocs): Remove options parameter. Change
8977 all callers.
8978 (scan_relocatable_relocs): Likewise.
8979 * target.h (class Sized_target): Remove options parameter from
8980 gc_process_relocs, scan_relocs, scan_relocatable_relocs. Change
8981 all callers.
8982 * gc.h (gc_process_relocs): Remove options parameter. Change all
8983 callers.
8984 * arm.cc: Update functions to remove options parameters.
8985 * i386.cc: Likewise.
8986 * powerpc.cc: Likewise.
8987 * sparc.cc: Likewise.
8988 * x86_64.cc: Likewise.
8989 * testsuite/testfile.cc: Likewise.
8990
8991 2009-10-28 Doug Kwan <dougkwan@google.com>
8992
8993 * arm.cc (Arm_relobj): New class definition.
8994 (Arm_relobj::scan_sections_for_stubs,
8995 Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8996 New method definitions.
8997
8998 2009-10-28 Cary Coutant <ccoutant@google.com>
8999
9000 * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9001 (Plugin::cleanup_done_): New member.
9002 (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9003 (Plugin_manager::cleanup_done_): Remove.
9004 (Plugin_manager::add_input_file): Edit error message.
9005 * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9006 (Plugin_manager::cleanup): Remove use of cleanup_done_.
9007
9008 2009-10-27 Mikolaj Zalewski <mikolajz@google.com>
9009
9010 * fileread.cc: (File_read::View::~View): Use the new
9011 data_ownership_ filed.
9012 (File_read::~File_read): Dispose the new whole_file_view_.
9013 (File_read::open): Mmap the whole file if needed.
9014 (File_read::open): Use whole_file_view_ instead of contents_.
9015 (File_read::find_view): Use whole_file_view_ if applicable.
9016 (File_read::do_read): Use whole_file_view_ instead of contents_.
9017 (File_read::make_view): Use whole_file_view_ instead of contents_,
9018 update File_read::View::View call.
9019 (File_read::find_or_make_view): Update File_read::View::View
9020 call.
9021 * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9022 remove contents_
9023 (File_read::View::Data_ownership): New enum.
9024 (File_read::View::View): Replace bool mapped_ with Data_ownership
9025 argument.
9026 (File_read::View::mapped_): Remove (replaced by data_ownership_).
9027 (File_read::View::data_ownership_): New field.
9028 (File_read::contents_): Remove (replaced by whole_file_view_).
9029 (File_read::whole_file_view_): New field.
9030 * options.h (class General_options): Add --keep-files-mapped.
9031
9032 2009-10-27 Cary Coutant <ccoutant@google.com>
9033
9034 * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9035 * testsuite/Makefile.am (plugin_test_5): New test case.
9036 * testsuite/Makefile.in: Regenerate.
9037
9038 2009-10-25 Doug Kwan <dougkwan@google.com>
9039
9040 * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9041 from private to protected to allow access by child class.
9042 (Sized_relobj::do_relocate_sections): New method declaration.
9043 (Sized_relobj::relocate_sections): Virtualize.
9044 * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9045 Sized_relobj::relocate_sections. Instantiate template explicitly
9046 for different target sizes and endianity.
9047
9048 2009-10-24 Doug Kwan <dougkwan@google.com>
9049
9050 * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9051 (Arm_input_section::as_arm_input_section): New method.
9052 (Arm_output_section): New class definition.
9053 (Arm_output_section::create_stub_group,
9054 Arm_output_section::group_sections): New method definitions.
9055
9056 2009-10-22 Doug Kwan <dougkwan@google.com>
9057
9058 * arm.cc (Arm_input_section): New class definition.
9059 (Arm_input_section::init, Arm_input_section:do_write,
9060 Arm_input_section::set_final_data_size,
9061 Arm_input_section::do_reset_address_and_file_offset): New method
9062 definitions.
9063
9064 2009-10-21 Doug Kwan <dougkwan@google.com>
9065
9066 * arm.cc (Stub_table, Arm_input_section): New forward class
9067 declarations.
9068 (Stub_table): New class defintion.
9069 (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9070 Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9071 New method definition.
9072
9073 2009-10-21 Doug Kwan <dougkwan@google.com>
9074
9075 * arm.cc: Update copyright comments.
9076 (Target_arm): New forward class template declaration.
9077 (Arm_address): New type.
9078 (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9079 THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9080 THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9081 constants.
9082 (Insn_template): Same.
9083 (DEF_STUBS): New macro.
9084 (Stub_type): New enum type.
9085 (Stub_template): New class definition.
9086 (Stub): Same.
9087 (Reloc_stub): Same.
9088 (Stub_factory): Same.
9089 (Target_arm::Target_arm): Initialize may_use_blx_ and
9090 should_force_pic_veneer_.
9091 (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9092 Target_arm::should_force_pic_veneer,
9093 Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9094 Target_arm::using_thumb_only, Target_arm:;default_target): New
9095 method defintions.
9096 (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9097 New data member declarations.
9098 (Insn_template::size, Insn_template::alignment): New method defintions.
9099 (Stub_template::Stub_template): New method definition.
9100 (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9101 Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9102 (Stub_factory::Stub_factory): New method definition.
9103 * gold.h (string_hash): New template.
9104 * output.h (Input_section_specifier::hash_value): Use
9105 gold::string_hash.
9106 (Input_section_specifier::string_hash): Remove.
9107 * stringpool.cc (Stringpool_template::string_hash): Use
9108 gold::string_hash.
9109
9110 2009-10-20 Doug Kwan <dougkwan@google.com>
9111
9112 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9113 symbols of relaxed input sections.
9114 * output.h (Output_section::find_relaxed_input_section): Make
9115 method public.
9116
9117 2009-10-16 Doug Kwan <dougkwan@google.com>
9118
9119 * dynobj.cc (Versions::Versions): Initialize version_script_.
9120 Only insert base version symbol definition for a shared object
9121 if version script defines any version versions.
9122 (Versions::define_base_version): New method definition.
9123 (Versions::add_def): Check that base version is not needed.
9124 (Versions::add_need): Define base version lazily.
9125 * dynobj.h (Versions::define_base_version): New method declaration.
9126 (Versions::needs_base_version_): New data member declaration.
9127 * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9128 (check_DATA): Add no_version_test.stdout.
9129 (libno_version_test.so, no_version_test.o no_version_test.stdout):
9130 New make rules.
9131 * testsuite/Makefile.in: Regenerate.
9132 * testsuite/no_version_test.c: New file.
9133 * testsuite/no_version_test.sh: Ditto.
9134
9135 2009-10-16 Doug Kwan <dougkwan@google.com>
9136
9137 * expression.cc (class Segment_start_expression): New class definition.
9138 (Segment_start_expression::value): New method definition.
9139 (script_exp_function_segment_start): Return a new
9140 Segment_start_expression.
9141 * gold/script-c.h (script_saw_segment_start_expression): New function
9142 prototype.
9143 * script-sections.cc (Script_sections::Script_sections): Initialize
9144 SAW_SEGMENT_START_EXPRESSION_ to false.
9145 (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9146 and -Tbbs options to specify section addresses if given in
9147 command line and no SEGMENT_START expression is seen in a script.
9148 * script-sections.h (Script_sections::saw_segment_start_expression,
9149 Script_sections::set_saw_segment_start_expression): New method
9150 definition.
9151 (Script_sections::saw_segment_start_expression_): New data member
9152 declaration.
9153 * script.cc (script_saw_segment_start_expression): New function.
9154 * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9155 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9156 script_test_7.sh and script_test_8.sh.
9157 (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9158 script_test_8.stdout.
9159 (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9160 (script_test_6, script_test_6.stdout, script_test_7,
9161 script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9162 * Makefile.in: Regenerate.
9163 * testsuite/script_test_6.sh: New file.
9164 * testsuite/script_test_6.t: Same.
9165 * testsuite/script_test_7.sh: Same.
9166 * testsuite/script_test_7.t: Same.
9167 * testsuite/script_test_8.sh: Same.
9168
9169 2009-10-16 Doug Kwan <dougkwan@google.com>
9170
9171 * output.cc (Output_segment::set_section_list_address): Cast
9172 expressions to unsigned long long type to avoid format warnings.
9173
9174 2009-10-15 Ian Lance Taylor <iant@google.com>
9175
9176 * script.cc (Script_options::add_symbol_assignment): Always add a
9177 dot assignment to script_sections_.
9178 * script-sections.cc (Script_sections::add_dot_assignment):
9179 Initialize if necessary.
9180
9181 * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9182 program headers with no load segment if there is a linker script.
9183
9184 * layout.cc (Layout::set_segment_offsets): Align the file offset
9185 to the segment aligment for -N or -n with no load segment.
9186 * output.cc (Output_segment::add_output_section): Don't crash if
9187 the first section is a TLS section.
9188 (Output_segment::set_section_list_addresses): Print an error
9189 message if the address moves backward in a linker script.
9190 * script-sections.cc
9191 (Output_section_element_input::set_section_addresses): Don't
9192 increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9193 (Orphan_output_section::set_section_addresses): Likewise.
9194
9195 2009-10-15 Doug Kwan <dougkwan@google.com>
9196
9197 * layout.cc (Layout::finish_dynamic_section): Generate tags
9198 DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9199 DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9200 used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9201
9202 2009-10-14 Ian Lance Taylor <iant@google.com>
9203
9204 * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9205 fields.
9206 * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9207 data_shdr fields of relinfo.
9208 * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9209 (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo. For
9210 R_386_TLS_LDO_32, adjust based on section flags.
9211 (Target_i386::Relocate::fix_up_ldo): Remove.
9212
9213 2009-10-13 Ian Lance Taylor <iant@google.com>
9214
9215 Add support for -pie.
9216 * options.h (class General_options): Add -pie and
9217 --pic-executable.
9218 (General_options::output_is_position_independent): Test -pie.
9219 (General_options::output_is_executable): Return true if not shared
9220 and not relocatable.
9221 (General_options::output_is_pie): Remove.
9222 * options.cc (General_options::finalize): Reject incompatible uses
9223 of -pie.
9224 * gold.cc (queue_middle_tasks): A -pie link is not static.
9225 * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9226 * symtab.cc (Symbol::final_value_is_known): Return false if
9227 output_is_position_independent.
9228 * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9229 output_is_position_independent.
9230 * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9231 output_is_position_independent.
9232 * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9233 output_is_position_independent.
9234 * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9235 two_file_pie_test.
9236 (basic_pie_test.o, basic_pie_test): New targets.
9237 (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9238 (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9239 (two_file_pie_test): New target.
9240 * testsuite/Makefile.in: Rebuild.
9241 * README: Remove note saying that -pie is not supported.
9242
9243 2009-10-13 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
9244
9245 * options.h (class General_options): Add -init and -fini.
9246 * layout.cc (Layout::finish_dynamic_section): Emit
9247 given init and fini functions.
9248
9249 2009-10-13 Sriraman Tallam <tmsriram@google.com>
9250
9251 * gc.h (gc_process_relocs): Check if icf is enabled using new
9252 function.
9253 * gold.cc (queue_initial_tasks): Likewise.
9254 (queue_middle_tasks): Likewise.
9255 * object.cc (do_layout): Likewise.
9256 * symtab.cc (is_section_folded): Likewise.
9257 * main.cc (main): Likewise.
9258 * reloc.cc (Read_relocs::run): Likewise.
9259 (Sized_relobj::do_scan_relocs): Likewise.
9260 * icf.cc (is_function_ctor_or_dtor): New function.
9261 (Icf::find_identical_sections): Check if function is ctor or dtor when
9262 safe icf is chosen.
9263 * options.h (General_options::icf): Change option to be an enum.
9264 (Icf_status): New enum.
9265 (icf_enabled): New method.
9266 (icf_safe_folding): New method.
9267 (set_icf_status): New method.
9268 (icf_status_): New variable.
9269 * (options.cc) (General_options::finalize): Set icf_status_.
9270 * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9271 icf_test and icf_keep_unique_test to use the --icf enum flag.
9272 * testsuite/icf_safe_test.sh: New file.
9273 * testsuite/icf_safe_test.cc: New file.
9274
9275 2009-10-12 Sriraman Tallam <tmsriram@google.com>
9276
9277 * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9278 includes to gc.h and icf.h.
9279 * arm.cc: Include gc.h.
9280 * gold.cc: Likewise.
9281 * i386.cc: Likewise.
9282 * powerpc.cc: Likewise.
9283 * sparc.cc: Likewise.
9284 * x86_64.cc: Likewise.
9285 * gc.h: Include icf.h.
9286
9287 2009-10-11 Ian Lance Taylor <iant@google.com>
9288
9289 * plugin.cc: Include "gold.h" before other header files.
9290
9291 2009-10-10 Chris Demetriou <cgd@google.com>
9292
9293 * options.h (Input_file_argument::Input_file_type): New enum.
9294 (Input_file_argument::is_lib_): Replace with...
9295 (Input_file_argument::type_): New member.
9296 (Input_file_argument::Input_file_argument): Take Input_file_type
9297 'type' rather than boolean 'is_lib' as second argument.
9298 (Input_file_argument::is_lib): Use type_.
9299 (Input_file_argument::is_searched_file): New function.
9300 (Input_file_argument::may_need_search): Handle is_searched_file.
9301 * options.cc (General_options::parse_library): Support -l:filename.
9302 (General_options::parse_just_symbols): Update for Input_file_argument
9303 changes.
9304 (Command_line::process): Likewise.
9305 * archive.cc (Archive::get_file_and_offset): Likewise.
9306 * plugin.cc (Plugin_manager::release_input_file): Likewise.
9307 * script.cc (read_script_file, script_add_file): Likewise.
9308 * fileread.cc (Input_file::Input_file): Likewise.
9309 (Input_file::will_search_for): Handle is_searched_file.
9310 (Input_file::open): Likewise.
9311 * readsyms.cc (Read_symbols::get_name): Likewise.
9312 * testsuite/Makefile.am (searched_file_test): New test.
9313 * testsuite/Makefile.in: Regenerate.
9314 * testsuite/searched_file_test.cc: New file.
9315 * testsuite/searched_file_test_lib.cc: New file.
9316
9317 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9318 Ian Lance Taylor <iant@google.com>
9319
9320 * descriptor.cc: Include <cstdio> and "binary-io.h".
9321 (Descriptors::open): Open the files in binary mode always.
9322 * script.cc (Lex::get_token): Treat \r as whitespace.
9323
9324 2009-10-09 Ian Lance Taylor <iant@google.com>
9325
9326 * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9327
9328 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9329 Ian Lance Taylor <iant@google.com>
9330
9331 * configure.ac: Check for readv function also.
9332 * fileread.cc (readv): Define if not HAVE_READV.
9333 * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9334 does not exist.
9335 * config.in: Regenerate.
9336 * configure: Regenerate.
9337
9338 2009-10-09 Doug Kwan <dougkwan@google.com>
9339
9340 * layout.cc (Layout::make_output_section): Call target hook to make
9341 ordinary output section.
9342 (Layout::finalize): Adjust parameter list of call the
9343 Target::may_relax().
9344 * layout.h (class Layout::section_list): New method.
9345 * merge.h (Output_merge_base::entsize): Change visibility to public.
9346 (Output_merge_base::is_string, Output_merge_base::do_is_string):
9347 New methods.
9348 (Output_merge_string::do_is_string): New method.
9349 * object.cc (Sized_relobj::do_setup): renamed from
9350 Sized_relobj::set_up.
9351 * object.h (Sized_relobj::adjust_shndx,
9352 Sized_relobj::initializ_input_to_output_maps,
9353 Sized_relobj::free_input_to_output_maps): Change visibilities to
9354 protected.
9355 (Sized_relobj::setup): Virtualize.
9356 (Sized_relobj::do_setup): New method declaration.
9357 (Sized_relobj::invalidate_section_offset,
9358 Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9359 (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9360 * options.cc (parse_int): New function.
9361 * options.h (parse_int): New declaration.
9362 (DEFINE_int): New macro.
9363 (stub_group_size): New option.
9364 * output.cc (Output_section::Output_section): Initialize memebers
9365 merge_section_map_, merge_section_by_properties_map_,
9366 relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9367 (Output_section::add_input_section): Handled deferred code-fill
9368 generation and remove an old comment.
9369 (Output_section::add_relaxed_input_section): New method definition.
9370 (Output_section::add_merge_input_section): Use merge section by
9371 properties map to speed to search. Update merge section maps
9372 as appropriate.
9373 (Output_section::build_relaxation_map): New method definition.
9374 (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9375 Same.
9376 (Output_section::relax_input_section): Renamed to
9377 Output_section::convert_input_sections_to_relaxed_sections and change
9378 interface to take a vector of pointers to relaxed sections.
9379 (Output_section::find_merge_section,
9380 Output_section::find_relaxed_input_section): New method definitions.
9381 (Output_section::is_input_address_mapped,
9382 Output_section::output_offset, Output_section::output_address):
9383 Use output section data maps to speed up searching.
9384 (Output_section::find_starting_output_address): Add comments.
9385 (Output_section::do_write,
9386 Output_section::write_to_postprocessing_buffer): Do code-fill
9387 generation as appropriate.
9388 (Output_section::get_input_sections): Invalidate relaxed input section
9389 map.
9390 (Output_section::restore_states): Adjust type of checkpoint .
9391 Invalidate relaxed input section map.
9392 * output.h (Output_merge_base): New class declaration.
9393 (Input_section_specifier): New class defintion.
9394 (class Output_relaxed_input_section) Change base class to
9395 Output_section_data_build.
9396 (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9397 base class initializer.
9398 (Output_section::add_relaxed_input_section): New method declaration.
9399 (Output_section::Input_section): Change visibility to protected.
9400 (Output_section::Input_section::relobj,
9401 Output_section::Input_section::shndx): Handle relaxed input sections.
9402 Output_section::input_sections) Change visibility to protected. Also
9403 define overload to return a non-const pointer.
9404 (Output_section::Merge_section_properties): New class defintion.
9405 (Output_section::Merge_section_by_properties_map,
9406 Output_section::Output_section_data_by_input_section_map,
9407 Output_section::Relaxation_map): New types.
9408 (Output_section::relax_input_section): Rename method to
9409 Output_section::convert_input_sections_to_relaxed_sections and change
9410 interface to take a vector of relaxed section pointers.
9411 (Output_section::find_merge_section,
9412 Output_section::find_relaxed_input_section,
9413 Output_section::build_relaxation_map,
9414 Output_section::convert_input_sections_in_list_to_relaxed_sections):
9415 New method declarations.
9416 (Output_section::merge_section_map_
9417 Output_section::merge_section_by_properties_map_,
9418 Output_section::relaxed_input_section_map_,
9419 Output_section::is_relaxed_input_section_map_valid_,
9420 Output_section::generate_code_fills_at_write_): New data members.
9421 * script-sections.cc
9422 (Output_section_element_input::set_section_addresses): Call
9423 current_data_size and addralign methods of relaxed input sections.
9424 (Orphan_output_section::set_section_addresses): Call current_data_size
9425 and addralign methods of relaxed input sections.
9426 * symtab.cc (Symbol_table::compute_final_value): Extract template
9427 from the body of Symbol_table::sized_finalize_symbol.
9428 (Symbol_table::sized_finalized_symbol): Call
9429 Symbol_table::compute_final_value.
9430 * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9431 (Symbol_table::compute_final_value): New templated method declaration.
9432 * target.cc (Target::do_make_output_section): New method defintion.
9433 * target.h (Target::make_output_section): New method declaration.
9434 (Target::relax): Add more parameters for input objects, symbol table
9435 and layout. Adjust call to do_relax.
9436 (Target::do_make_output_section): New method declaration.
9437 (Target::do_relax): Add parameters for input objects, symbol table
9438 and layout.
9439
9440 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9441
9442 * pread.c: Include stdio.h.
9443
9444 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9445
9446 * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9447 defined.
9448
9449 2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
9450
9451 * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9452 Change read_shndx type to unsigned int.
9453 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9454 int.
9455 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9456 * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9457 Change read_shndx type to unsigned int.
9458 (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9459 int.
9460 (Sized_dwarf_line_info::read_line_mappings): Likewise.
9461 * layout.cc (Layout::create_symtab_sections): Cast the result of
9462 local_symcount * symsize to off_t in the gold_assert.
9463
9464 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9465
9466 * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9467 R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9468 R_ARM_BASE_ABS.
9469 (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9470 (Arm_relocate_functions::thm_abs5): New function.
9471 (Arm_relocate_functions::abs12): New function.
9472 (Arm_relocate_functions::abs16): New function.
9473 (Arm_relocate_functions::base_abs): New function.
9474 (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9475 (Scan::local): Remove special handling of R_ARM_ABS8. Handle
9476 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9477 R_ARM_BASE_ABS.
9478 (Scan::global): Likewise.
9479 (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9480 R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9481 (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9482 R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9483 R_ARM_BASE_ABS.
9484
9485 2009-10-09 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9486
9487 * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9488 (Arm_relocate_functions::movt_prel): New function.
9489 (Arm_relocate_functions::thm_movw_prel_nc): New function.
9490 (Arm_relocate_functions::thm_movt_prel): New function.
9491 (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9492 R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9493 (Scan::global, Relocate::relocate): Likewise.
9494 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9495
9496 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9497
9498 * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9499 Incremental_checker.
9500 * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9501 unsigned int.
9502 (class Incremental_inputs_header): New class.
9503 (Incremental_inputs_header_writer): Edit comment.
9504 (Incremental_inputs_entry): New class.
9505 (Incremental_inputs_entry_writer): Edit comment.
9506 (Sized_incremental_binary::do_find_incremental_inputs_section):
9507 Add *strtab_shndx parameter, fill it.
9508 (Sized_incremental_binary::do_check_inputs): New method.
9509 (Incremental_checker::can_incrementally_link_output_file): Use
9510 Sized_incremental_binary::check_inputs.
9511 (Incremental_inputs::report_command_line): Save command line in
9512 command_line_.
9513 * incremental.h:
9514 (Incremental_binary::find_incremental_inputs_section): New
9515 method.
9516 (Incremental_binary::do_find_incremental_inputs_section): Add
9517 strtab_shndx parameter.
9518 (Incremental_binary::do_check_inputs): New pure virtual method.
9519 (Sized_incremental_binary::do_check_inputs): Declare.
9520 (Incremental_checker::Incremental_checker): Add incremental_inputs
9521 parameter, use it to initialize incremental_inputs_.
9522 (Incremental_checker::incremental_inputs_): New field.
9523 (Incremental_checker::command_line): New method.
9524 (Incremental_checker::inputs): New method.
9525 (Incremental_checker::command_line_): New field.
9526
9527 2009-10-09 Mikolaj Zalewski <mikolajz@google.com>
9528
9529 * incremental.cc: Include <cstdarg> and "target-select.h".
9530 (vexplain_no_incremental): New function.
9531 (explain_no_incremental): New function.
9532 (Incremental_binary::error): New method.
9533 (Sized_incremental_binary::do_find_incremental_inputs_section): New
9534 method.
9535 (make_sized_incremental_binary): New function.
9536 (open_incremental_binary): New function.
9537 (can_incrementally_link_file): Add checks if output is ELF and has
9538 inputs section.
9539 * incremental.h: Include "elfcpp_file.h" and "output.h".
9540 (Incremental_binary): New class.
9541 (Sized_incremental_binary): New class.
9542 (open_incremental_binary): Declare.
9543 * object.cc (is_elf_object): Use
9544 elfcpp::Elf_recognizer::is_elf_file.
9545 (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9546 * output.h (Output_file::filesize): New method.
9547
9548 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9549
9550 * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9551 New function.
9552 (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9553 (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9554 function.
9555 (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9556 function.
9557 (Arm_relocate_functions::movw_abs_nc): New function.
9558 (Arm_relocate_functions::movt_abs): New function.
9559 (Arm_relocate_functions::thm_movw_abs_nc): New function.
9560 (Arm_relocate_functions::thm_movt_abs): New function.
9561 (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9562 R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9563 (Scan::global): Likewise.
9564 (Relocate::relocate): Likewise.
9565 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9566
9567 2009-10-07 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9568
9569 * arm.cc (Arm_relocate_functions::got_prel) New function.
9570 (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9571 (Relocate::relocate): Likewise.
9572 (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9573
9574 2009-10-06 Ian Lance Taylor <iant@google.com>
9575
9576 * options.h (class General_options): Define
9577 split_stack_adjust_size parameter.
9578 * object.h (class Object): Add uses_split_stack_ and
9579 has_no_split_stack_ fields. Add uses_split_stack and
9580 has_no_split_stack accessor functions. Declare
9581 handle_split_stack_section.
9582 (class Reloc_symbol_changes): Define.
9583 (class Sized_relobj): Define Function_offsets. Declare
9584 split_stack_adjust, split_stack_adjust_reltype, and
9585 find_functions.
9586 * object.cc (Object::handle_split_stack_section): New function.
9587 (Sized_relobj::do_layout): Call handle_split_stack_section.
9588 * dynobj.cc (Sized_dynobj::do_layout): Call
9589 handle_split_stack_section.
9590 * reloc.cc (Sized_relobj::relocate_sections): Call
9591 split_stack_adjust for executable sections in split_stack
9592 objects. Pass reloc_map to relocate_section.
9593 (Sized_relobj::split_stack_adjust): New function.
9594 (Sized_relobj::split_stack_adjust_reltype): New function.
9595 (Sized_relobj::find_functions): New function.
9596 * target-reloc.h: Include "object.h".
9597 (relocate_section): Add reloc_symbol_changes parameter. Change
9598 all callers.
9599 * target.h (class Target): Add calls_non_split method. Declare
9600 do_calls_non_split virtual method. Declare match_view and
9601 set_view_to_nop.
9602 * target.cc: Include "elfcpp.h".
9603 (Target::do_calls_non_split): New function.
9604 (Target::match_view): New function.
9605 (Target::set_view_to_nop): New function.
9606 * gold.cc (queue_middle_tasks): Give an error if mixing
9607 split-stack and non-split-stack objects with -r.
9608 * i386.cc (Target_i386::relocate_section): Add
9609 reloc_symbol_changes parameter.
9610 (Target_i386::do_calls_non_split): New function.
9611 * x86_64.cc (Target_x86_64::relocate_section): Add
9612 reloc_symbol_changes parameter.
9613 (Target_x86_64::do_calls_non_split): New function.
9614 * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9615 parameter.
9616 * powerpc.cc (Target_powerpc::relocate_section): Add
9617 reloc_symbol_changes parameter.
9618 * sparc.cc (Target_sparc::relocate_section): Add
9619 reloc_symbol_changes parameter.
9620 * configure.ac: Call AM_CONDITIONAL for the default target.
9621 * configure: Rebuild.
9622 * testsuite/Makefile.am (TEST_AS): New variable.
9623 (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9624 (check_DATA): Add split_i386 and split_x86_64 files.
9625 (SPLIT_DEFSYMS): Define.
9626 (split_i386_[1234n].o): New targets.
9627 (split_i386_[124]): New targets.
9628 (split_i386_[1234r].stdout): New targets.
9629 (split_x86_64_[1234n].o): New targets.
9630 (split_x86_64_[124]): New targets.
9631 (split_x86_64_[1234r].stdout): New targets.
9632 (MOSTLYCLEANFILES): Add new executables.
9633 * testsuite/split_i386.sh: New file.
9634 * testsuite/split_x86_64.sh: New file.
9635 * testsuite/split_i386_1.s: New file.
9636 * testsuite/split_i386_2.s: New file.
9637 * testsuite/split_i386_3.s: New file.
9638 * testsuite/split_i386_4.s: New file.
9639 * testsuite/split_i386_n.s: New file.
9640 * testsuite/split_x86_64_1.s: New file.
9641 * testsuite/split_x86_64_2.s: New file.
9642 * testsuite/split_x86_64_3.s: New file.
9643 * testsuite/split_x86_64_4.s: New file.
9644 * testsuite/split_x86_64_n.s: New file.
9645 * testsuite/testfile.cc (Target_test): Update relocation_section
9646 function.
9647 * testsuite/Makefile.in: Rebuild.
9648
9649 2009-10-06 Ian Lance Taylor <iant@google.com>
9650
9651 * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9652 (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9653 changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE. When
9654 handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9655 the address on ldo_addrs_.
9656 (Target_i386::Relocate::fix_up_ldo): New function.
9657
9658 2009-10-06 Rafael Espindola <espindola@google.com>
9659
9660 * plugin.cc (add_input_library): New.
9661 (Plugin::load): Add add_input_library to tv.
9662 (Plugin_manager::add_input_file): Add the is_lib argument.
9663 (add_input_file): Update call to Plugin_manager::add_input_file.
9664 (add_input_library): New.
9665 * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9666
9667 2009-09-30 Doug Kwan <dougkwan@google.com>
9668
9669 * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9670 symbol and call Symbol::may_need_copy_reloc to determine if
9671 a copy reloc is needed.
9672 * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9673 nocopyreloc is given in command line.
9674 (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9675 given in command line.
9676 * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9677 (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9678 of the removed Target_i386::may_need_copy_reloc.
9679 * options.h (copyreloc): New option with default value false.
9680 * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9681 (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9682 instead of the removed Target_powerpc::may_need_copy_reloc.
9683 * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9684 (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9685 instead of the removed Target_sparc::may_need_copy_reloc.
9686 * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9687 * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9688 (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9689 instead of the removed Target_x86_64::may_need_copy_reloc.
9690
9691 2009-09-30 Ian Lance Taylor <iant@google.com>
9692
9693 * object.h (class Object): Remove target_ field, and target,
9694 sized_target, and set_target methods.
9695 (Object::sized_target): Remove.
9696 (class Sized_relobj): Update declarations. Remove sized_target.
9697 * object.cc (Sized_relobj::setup): Remove target parameter.
9698 Change all callers.
9699 (Input_objects::add_object): Don't do anything with the target.
9700 (make_elf_sized_object): Add punconfigured parameter. Change all
9701 callers. Set or test parameter target.
9702 * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9703 Change all callers.
9704 * parameters.cc (Parameters::set_target): Change parameter type to
9705 be non-const.
9706 (Parameters::default_target): Remove.
9707 (set_parameters_target): Change parameter type to be non-const.
9708 (parameters_force_valid_target): New function.
9709 (parameters_clear_target): New function.
9710 * parameters.h (class Parameters): Update declarations. Remove
9711 default_target method. Add sized_target and clear_target
9712 methods. Change target_ to be non-const.
9713 (set_parameters_target): Update declaration.
9714 (parameters_force_valid_target): Declare.
9715 (parameters_clear_target): Declare.
9716 * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9717 as NULL if we aren't searching.
9718 (Add_symbols::run): Don't check for compatible target.
9719 * fileread.cc (Input_file::open_binary): Call
9720 parameters_force_valid_target.
9721 * gold.cc (queue_middle_tasks): Likewise.
9722 * plugin.cc (make_sized_plugin_object): Likewise. Don't call
9723 set_target on object.
9724 * dynobj.h (class Sized_dynobj): Update declarations.
9725 * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9726 make_elf_object returns NULL.
9727 (Archive::include_member): Don't check whether object target is
9728 compatible.
9729 * output.cc (Output_section::add_input_section): Get target from
9730 parameters.
9731 (Output_section::relax_input_section): Likewise.
9732 * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9733 parameters.
9734 (Sized_relobj::do_scan_relocs): Likewise.
9735 (Sized_relobj::relocate_sections): Likewise.
9736 * resolve.cc (Symbol_table::resolve): Likewise.
9737 * symtab.cc (Symbol_table::wrap_symbol): Likewise. Remove object
9738 parameter. Change all callers.
9739 (Symbol_table::add_from_object): Get target from parameters.
9740 (Symbol_table::add_from_relobj): Don't check object target.
9741 (Symbol_table::add_from_dynobj): Likewise.
9742 (Symbol_table::define_special_symbol): Get target from
9743 parameters.
9744 * symtab.h (class Symbol_table): Update declaration.
9745 * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9746 parameter. Change all callers. Clear parameter target.
9747 (Binary_test): Test target here.
9748 * testsuite/object_unittest.cc (gold_testsuite): Remove
9749 target_test_pointer parameter. Change all callers.
9750 (Object_test): Test target here.
9751
9752 2009-09-26 Ian Lance Taylor <iant@google.com>
9753
9754 * testsuite/initpri1.c: Don't try to use constructor priorities if
9755 compiling with gcc before 4.3.
9756
9757 2009-09-22 Mikolaj Zalewski <mikolajz@google.com>
9758
9759 * testsuite/retain_symbols_file_test.sh (check_present): Change
9760 output file name to retain_symbols_file_test.stdout.
9761 (check_absent): Likewise.
9762
9763 2009-09-18 Craig Silverstein <csilvers@google.com>
9764
9765 * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9766 * options.cc: Include <cerrno> and <fstream>.
9767 (General_options::finalize): Parse -retain-symbols-file tag.
9768 * options.h: New flag.
9769 (General_options): New method should_retain_symbol, new
9770 variable symbols_to_retain.
9771 * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9772 should_retain_symbol map.
9773 * testsuite/Makefile.am (retain_symbols_file_test): New test.
9774 * testsuite/Makefile.in: Regenerate.
9775 * testsuite/retain_symbols_file_test.sh: New file.
9776
9777 2009-09-18 Nick Clifton <nickc@redhat.com>
9778
9779 * po/es.po: Updated Spanish translation.
9780
9781 2009-09-17 Doug Kwan <dougkwan@google.com>
9782
9783 * debug.h (DEBUG_RELAXATION): New constant.
9784 (DEBUG_ALL): Add DEBUG_RELAXATION.
9785 (debug_string_to_enum): Add relaxation debug option.
9786 * layout.cc
9787 (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9788 Layout::Relaxation_debug_check::read_sections,
9789 Layout::Relaxation_debug_check::read_sections): New method definitions.
9790 (Layout::Layout): Initialize data members
9791 record_output_section_data_from_scrips_,
9792 script_output_section_data_list_ and relaxation_debug_check_.
9793 (Layout::save_segments, Layout::restore_segments,
9794 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9795 Layout::relaxation_loop_body): New method definitions.
9796 (Layout::finalize): Support relaxation. Move section layout code to
9797 Layout::relaxation_loop_body.
9798 (Layout::set_asection_address_from_script): Move code for orphan
9799 section placement out.
9800 (Layout::place_orphan_sections_in_script): New method definition.
9801 * layout.h (Output_segment_headers, Output_file_header):
9802 New forward class declarations.
9803 (Layout::~Layout): Define.
9804 (Layout::new_output_section_data_from_script): New method definition.
9805 (Layout::place_orphan_sections_in_script): New method declaration.
9806 (Layout::Segment_states): New type declaration.
9807 (Layout::save_segments, Layout::restore_segments,
9808 Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9809 Layout::relaxation_loop_body): New method declarations.
9810 (Layout::Output_section_data_list): New type declaration.
9811 (Layout::Relaxation_debug_check): New class definition.
9812 (Layout::record_output_section_data_from_script_,
9813 Layout::script_output_section_data_list_, Layout::segment_states_,
9814 Layout::relaxation_debug_check_): New data members.
9815 * output.cc: (Output_section_headers::do_size): New method definition.
9816 (Output_section_headers::Output_section_headers): Move size
9817 computation to Output_section_headers::do_size.
9818 (Output_segment_headers::do_size): New method definition.
9819 (Output_file_header::Output_file_header): Move size computation to
9820 Output_file_header::do_size and call it.
9821 (Output_file_header::do_size): New method definition.
9822 (Output_data_group::Output_data_group): Adjust call to
9823 Output_section_data.
9824 (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9825 (Output_symtab_xindex::do_write): Add array bound check.
9826 (Output_section::Input_section::print_to_mapfile): Handle
9827 RELAXED_INPUT_SECTION_CODE.
9828 (Output_section::Output_section): Initialize data member checkpoint_.
9829 (Output_section::~Output_section): Delete checkpoint object pointed
9830 by checkpoint_.
9831 (Output_section::add_input_section): Always add an Input_section if
9832 relaxing.
9833 (Output_section::add_merge_input_section): Add assert.
9834 (Output_section::relax_input_section): New method definition.
9835 (Output_section::set_final_data_size): Set load address to zero for
9836 an unallocated section.
9837 (Output_section::do_address_and_file_offset_have_reset_values):
9838 New method definition.
9839 (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9840 Handle relaxed input section.
9841 (Output_section::sort_attached_input_sections): Checkpoint input
9842 section list lazily.
9843 (Output_section::get_input_sections): Change type of input_sections to
9844 list of Simple_input_section pointers. Checkpoint input section list
9845 lazily. Also handle relaxed input sections.
9846 (Output_section::add_input_section_for_script): Take a reference to
9847 a Simple_input_section object instead of Relobj pointer and section
9848 index as parameter. Handle relaxed input sections.
9849 (Output_section::save_states, Output_section::restore_states): New
9850 method definitions.
9851 * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9852 (Output_data::is_data_size_fixed): New method definition.
9853 (Output_data::reset_addresss_and_file_offset): Do not reset data size
9854 if it is fixed.
9855 (Output_data::address_and_file_offset_have_reset_values): New method
9856 definition.
9857 (Output_data::do_address_and_file_offset_have_reset_values): New method
9858 definition.
9859 (Output_data::set_data_size): Check that data size is not fixed.
9860 (Output_data::fix_data_size): New method definition.
9861 (Output_data::is_data_size_fixed_): New data member.
9862 (Output_section_headers::set_final_data_size): New method definition.
9863 (Output_section_headers::do_size): New method declaration.
9864 (Output_segment_headers::set_final_data_size): New method definition.
9865 (Output_segment_headers::do_size): New method declaration.
9866 (Output_file_header::set_final_data_size)::New method definition.
9867 (Output_file_header::do_size)::New method declaration.
9868 (Output_section_data::Output_section_data): Add new parameter
9869 is_data_size_fixed and use it to fix data size.
9870 (Output_data_const::Output_data_const): Adjust call to base class
9871 constructor and fix data size.
9872 (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9873 base class constructor and fix data size.
9874 (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9875 base class constructor and fix data size.
9876 (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9877 class constructor and fix data size.
9878 (Output_data_group::set_final_data_size): New method definition.
9879 (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9880 (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9881 class constructor and fix data size.
9882 (Output_relaxed_input_section): New class definition.
9883 (Output_section::Simple_input_section): New class definition.
9884 (Output_section::get_input_sections): Adjust parameter list.
9885 (Output_section::add_input_section_for_script): Same.
9886 (Output_section::save_states, Output_section::restore_states,
9887 Output_section::do_address_and_file_offset_have_reset_values,
9888 (Output_section::Input_section::Input_section): Handle
9889 RELAXED_INPUT_SECTION_CODE. Add new overload for
9890 Output_relaxed_input_section.
9891 (Output_section::Input_section::is_input_section,
9892 Output_section::Input_section::set_output_section): Handle relaxed
9893 input section.
9894 (Output_section::Input_section::is_relaxed_input_section,
9895 Output_section::Input_section::output_section_data,
9896 Output_section::Input_section::relaxed_input_section): New method
9897 definitions.
9898 (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9899 value.
9900 (Output_section::Input_section::u1_): Update comments.
9901 (Output_section::Input_section::u2_): Add new union member poris.
9902 (Output_section::Checkpoint_output_section): New classs definition.
9903 (Output_section::relax_input_section): New method declaration.
9904 (Output_section::checkpoint_): New data member.
9905 (Output_segment): Update comments.
9906 (Output_segment::Output_segment): Un-privatize copy constructor.
9907 (Output_segment::operator=): Un-privatize.
9908 * script-sections.cc (Output_section_element::Input_section_list):
9909 Change element type to Output_section::Simple_input_section.
9910 (Output_section_element_dot_assignment::set_section_addresses):
9911 Register output section data for relaxation clean up.
9912 (Output_data_exression::Output_data_expression): Adjust call to base
9913 constructor to fix data size.
9914 (Output_section_element_data::set_section_addresses): Register
9915 Output_data_expression object for relaxation clean up.
9916 (struct Input_section_info): Replace Relobj pointer and section index
9917 pair with Output_section::Simple_input_section and Convert struct to a
9918 class.
9919 (Input_section_sorter::operator()): Adjust access to
9920 Input_section_info data member to use accessors.
9921 (Output_section_element_input::set_section_addresses): Use layout
9922 parameter. Adjust code to use Output_section::Simple_input_section
9923 and Input_secction_info classes. Register filler for relaxation
9924 clean up.
9925 (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9926 and section index pair with Output_section::Simple_input_section
9927 class. Adjust code accordingly.
9928 (Phdrs_element::release_segment): New method definition.
9929 (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9930 segment list.
9931 (Script_sections::release_segments): New method definition.
9932 * gold/script-sections.h (Script_sections::release_segments): New
9933 method declaration.
9934 * gold/target.h (Target::may_relax, Target::relax,
9935 Target::do_may_relax, Target::do_relax): New method definitions.
9936
9937 2009-09-17 Viktor Kutuzov <vkutuzov@accesssoftek.com>
9938
9939 * arm.cc (has_signed_unsigned_overflow): New function.
9940 (Arm_relocate_functions::abs8): New function.
9941 (Target_arm::Scan::local): Handle R_ARM_ABS8.
9942 (Target_arm::Scan::global): Likewise.
9943 (Target_arm::relocate::relocate): Likewise.
9944 (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9945 Likewise.
9946
9947 2009-09-16 Cary Coutant <ccoutant@google.com>
9948
9949 * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9950 * testsuite/Makefile.in: Regenerate.
9951
9952 2009-09-11 Nick Clifton <nickc@redhat.com>
9953
9954 * po/gold.pot: Updated by the Translation project.
9955
9956 2009-09-08 Cary Coutant <ccoutant@google.com>
9957
9958 * output.cc (Output_file::open): Add execute permission to empty file.
9959 * testsuite/Makefile.am (permission_test): New test.
9960 * testsuite/Makefile.in: Regenerate.
9961
9962 2009-09-02 Ian Lance Taylor <iant@google.com>
9963
9964 * output.cc (Output_file::resize): Call map_no_anonymous rather
9965 than map.
9966
9967 2009-09-01 Mikolaj Zalewski <mikolajz@google.com>
9968
9969 * gold.cc: Include "incremental.h".
9970 (queue_initial_tasks): Call Incremental_checker methods.
9971 * incremental.cc: Include "output.h".
9972 (Incremental_checker::can_incrementally_link_output_file): New
9973 method.
9974 * incremental.h (Incremental_checker): New class.
9975
9976 * output.cc (Output_file::open_for_modification): New method.
9977 (Output_file::map_anonymous): Changed return type to bool. Record
9978 map in base_ field.
9979 (Output_file::map_no_anonymous): New method, broken out of map.
9980 (Output_file::map): Use map_no_anonymous and map_anonymous.
9981 * output.h (class Output_file): Update declarations.
9982
9983 2009-08-24 Cary Coutant <ccoutant@google.com>
9984
9985 * options.h (Command_line::Pre_options): New class.
9986 (Command_line::pre_options): New member.
9987 * options.cc (gold::options::ready_to_register): New variable.
9988 (One_option::register_option): Do nothing if not registering options.
9989 Assert if same short option registered twice.
9990 (General_options::General_options): Turn off option registration when
9991 done constructing.
9992 (Command_line::Pre_options::Pre_options): New constructor.
9993
9994 2009-08-24 Cary Coutant <ccoutant@google.com>
9995
9996 * options.h (General_options::no_keep_memory): Remove incorrect
9997 short option.
9998
9999 2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10000
10001 * Makefile.am (am__skiplex, am__skipyacc): New.
10002 * Makefile.in: Regenerate.
10003
10004 2009-08-22 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
10005
10006 * Makefile.am (AM_CPPFLAGS): Renamed from ...
10007 (INCLUDES): ... this.
10008 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10009 (AM_CPPFLAGS): Renamed from ...
10010 (INCLUDE): ... this.
10011 * Makefile.in, testsuite/Makefile.in: Regenerate.
10012
10013 * Makefile.in: Regenerate.
10014 * aclocal.m4: Likewise.
10015 * config.in: Likewise.
10016 * configure: Likewise.
10017 * testsuite/Makefile.in: Likewise.
10018
10019 * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10020 * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10021 * Makefile.in: Regenerate.
10022 * testsuite/Makefile.in: Regenerate.
10023
10024 2009-08-19 Cary Coutant <ccoutant@google.com>
10025
10026 * resolve.cc (Symbol_table::resolve): Don't complain about defined
10027 symbols in shared libraries overridden by hidden or internal symbols
10028 in the main program.
10029
10030 2009-08-19 Chris Demetriou <cgd@google.com>
10031
10032 * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10033 checking source file names in error messages.
10034
10035 2009-08-18 Doug Kwan <dougkwan@google.com>
10036
10037 * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10038 an elcpp::Ehdr as parameter. Adjust call to set_target.
10039 * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10040 an elfcpp::Ehdr as parameter.
10041 * object.cc (Object::set_target): Remove the version that looks up
10042 a target and sets it.
10043 (Sized_relobj::setup): Take a Target object instead of
10044 an elfcpp::Ehdr as parameter. Adjust call to set_target.
10045 (make_elf_sized_object): Find target and ask target to
10046 make an ELF object.
10047 * object.h: (Object::set_target): Remove the version that looks up
10048 a target and sets it.
10049 (Sized_relobj::setup): Take a Target object instead of
10050 an elfcpp:Ehdr as parameter.
10051 * target.cc: Include dynobj.h.
10052 (Target::do_make_elf_object_implementation): New.
10053 (Target::do_make_elf_object): New.
10054 * target.h (Target::make_elf_object): New template declaration.
10055 (Target::do_make_elf_object): New method declarations.
10056 (Target::do_make_elf_object_implementation): New template declaration.
10057
10058 2009-08-14 Ian Lance Taylor <iant@google.com>
10059
10060 * gold.h (FUNCTION_NAME): Define.
10061 (gold_unreachable): Use FUNCTION_NAME.
10062
10063 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10064
10065 * icf.cc (Icf::find_identical_sections): Issue a warning when a
10066 symbol in the --keep-unique list is not found.
10067
10068 2009-08-12 Sriraman Tallam <tmsriram@google.com>
10069
10070 * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10071 been maked as --keep-unique.
10072 (Icf::unfold_section): New function.
10073 * icf.h (Icf::unfold_section): New function.
10074 * options.h (General_options::keep_unique): New option.
10075 * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10076 * testsuite/Makefile.in: Regenerate.
10077 * testsuite/icf_keep_unique_test.sh: New file.
10078 * testsuite/icf_keep_unique_test.cc: New file.
10079
10080 2009-08-12 Cary Coutant <ccoutant@google.com>
10081
10082 PR 10471
10083 * resolve.cc (Symbol_table::resolve): Check for references from
10084 dynamic objects to hidden and internal symbols.
10085 * testsuite/Makefile.am (hidden_test.sh): New test.
10086 * testsuite/Makefile.in: Regenerate.
10087 * testsuite/hidden_test.sh: New script.
10088 * testsuite/hidden_test_1.c: New test source.
10089 * testsuite/hidden_test_main.c: New test source.
10090
10091 2009-08-11 Doug Kwan <dougkwan@google.com>
10092
10093 * arm.cc: Update comments.
10094 (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10095 segment to locate the .ARM.exidx section if present.
10096
10097 2009-08-09 Doug Kwan <dougkwan@google.com>
10098
10099 * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10100 patch.
10101
10102 2009-08-07 Sriraman Tallam <tmsriram@google.com>
10103 * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10104 compiler warnings.
10105
10106 2009-08-06 Sriraman Tallam <tmsriram@google.com>
10107
10108 * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10109 valid tls_segment only for non-debug-section relocations.
10110 * testsuite/Makefile.am: Add gc_tls_test.
10111 * testsuite/Makefile.in: Regenerate.
10112 * testsuite/gc_tls_test.cc: New file.
10113 * testsuite/gc_tls_test.sh: New file.
10114
10115 2009-08-05 Sriraman Tallam <tmsriram@google.com>
10116
10117 * icf.cc: New file.
10118 * icf.h: New file.
10119 * Makefile.am (CCFILES): Add icf.cc.
10120 (HFILES): Add icf.h
10121 * Makefile.in: Regenerate.
10122 * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10123 * gc.h (gc_process_relocs): Populate lists used by icf to contain
10124 section, symbol and addend information for the relocs.
10125 * gold.cc (queue_middle_tasks): Call identical code folding.
10126 * gold.h: Add defines for multimap.
10127 * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10128 to the call of finalize_local_symbols.
10129 * main.cc (main): Create object of class Icf.
10130 * object.cc (Sized_relobj::do_layout): Allow this function to be
10131 called twice during icf.
10132 (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10133 to sections marked as identical by icf.
10134 (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10135 when available.
10136 (Sized_relobj::do_section_entsize): New function.
10137 * object.h (Object::section_entsize): New function.
10138 (Object::do_section_entsize): New pure virtual function.
10139 (Relobj::finalize_local_symbols): Add new parameter.
10140 (Relobj::do_section_entsize): New function.
10141 * options.h (General_options::icf): New option.
10142 (General_options::icf_iterations): New option.
10143 (General_options::print_icf_sections): New option.
10144 * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10145 * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10146 * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10147 icf.
10148 * symtab.cc (Symbol_table::is_section_folded): New function.
10149 (Symbol_table::sized_finalize_symbol): Fold symbols corresponding
10150 to sections marked as identical by icf.
10151 * symtab.h (Symbol_table::set_icf): New function.
10152 (Symbol_table::icf): New function.
10153 (Symbol_table::is_section_folded): New function.
10154 (Symbol_table::icf_): New data member.
10155 * target-reloc.h (relocate_section): Ignore sections folded by icf.
10156 * testsuite/Makefile.am: Add commands to build icf_test.
10157 * testsuite/Makefile.in: Regenerate.
10158 * testsuite/icf_test.sh: New file.
10159 * testsuite/icf_test.cc: New file.
10160
10161 2009-07-24 Chris Demetriou <cgd@google.com>
10162
10163 * layout.cc (is_compressible_debug_section): Fix incorrect
10164 comment about compressed section names.
10165
10166 2009-07-20 Ian Lance Taylor <ian@airs.com>
10167
10168 PR 10419
10169 * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10170
10171 2009-07-16 Ian Lance Taylor <iant@google.com>
10172
10173 PR 10400
10174 * layout.h: #include <map>.
10175 (class Kept_section): Change from struct to class. Add accessors
10176 and setters. Add section size to Comdat_group mapping. Change
10177 Comdat_group to std::map. Add is_comdat_ field. Add
10178 linkonce_size field in union.
10179 (class Layout): Update declaration of find_or_add_kept_section.
10180 Don't declare find_kept_object.
10181 * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10182 parameter. Add object, shndx, is_comdat, and is_group_name
10183 parameters. Change all callers. Adjust for new Kept_section.
10184 (Layout::find_kept_object): Remove.
10185 * object.cc (Sized_relobj::include_section_group): Update use of
10186 Kept_section. Rename secnum to shndx. Only record
10187 Kept_comdat_section if sections are the same size.
10188 (Sized_relobj::include_linkonce_section): Update use of
10189 Kept_section. Only record Kept_comdat_section if sections are the
10190 same size. Set size of linkonce section.
10191 (Sized_relobj::map_to_kept_section): Update call to
10192 get_kept_comdat_section.
10193 * object.h (class Sized_relobj): Rename fields in
10194 Kept_comdat_section to drop trailing underscores; change object
10195 field to Relobj*. Change Kept_comdat_section_table to store
10196 struct rather than pointer.
10197 (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10198 Add kept_object and kept_shndx parameters. Change all callers.
10199 (Sized_relobj::get_kept_comdat_section): Change return type to
10200 bool. Add kept_object and kept_shndx parameters. Change all
10201 callers.
10202 * plugin.cc (Pluginobj::include_comdat_group): Update call to
10203 Layout::find_or_add_kept_section.
10204
10205 2009-07-09 Ian Lance Taylor <iant@google.com>
10206
10207 * merge.cc (Object_merge_map::initialize_input_to_output_map):
10208 Reserve space in the hash table.
10209
10210 2009-07-06 Mikolaj Zalewski <mikolajz@google.com>
10211
10212 * fileread.cc (File_read::get_mtime): New method.
10213 * fileread.h (Timespec): New structure.
10214 (File_read::get_mtime): New method.
10215 * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10216 Renamed from timestamp_nsec.
10217 (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10218 Elf_Xword.
10219 (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10220 timestamp_nsec.
10221 (Incremental_inputs::report_archive): Save mtime; style fix.
10222 (Incremental_inputs::report_obejct): Save mtime; style fix.
10223 (Incremental_inputs::report_script): Save mtime; style fix.
10224 (Incremental_inputs::finalize_inputs): Style fix.
10225 (Incremental_inputs::finalize): Style fix.
10226 (Incremental_inputs::create_input_section_data): Store inputs
10227 mtime.
10228 * incremental.h (Incremental_inputs::report_script): Add mtime
10229 argument.
10230 (Incremental_inputs::Input_info::Input_info): Intialize only one
10231 union member.
10232 (Incremental_inputs::Input_info::archive): Move to nameless
10233 union.
10234 (Incremental_inputs::Input_info::obejct): Move to nameless union.
10235 (Incremental_inputs::Input_info::script): Move to nameless union.
10236 (Incremental_inputs::mtime): New field.
10237 * script.cc (read_input_script): Pass file mtime to
10238 Incremental_input.
10239 * script.h (Script_info::inputs): Style fix.
10240
10241 2009-07-01 Ian Lance Taylor <ian@airs.com>
10242
10243 * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10244 instead of 32.
10245
10246 2009-06-24 Ian Lance Taylor <iant@google.com>
10247
10248 PR 10156
10249 * layout.cc (Layout::choose_output_section): If we find an
10250 existing section, update the flags.
10251 (Layout::create_notes): New function, broken out of
10252 Layout::finalize.
10253 (Layout::finalize): Don't create note sections.
10254 (Layout::create_note): Don't crash if linker script discards
10255 section.
10256 (Layout::create_gold_note): Likewise.
10257 (Layout::create_build_id): Likewise. Don't set
10258 after_input_sections on the section.
10259 (Layout::create_executable_stack_info): Remove target parameter.
10260 Change caller.
10261 * layout.h (class Layout): Declare create_notes. Update
10262 declaration of create_executable_stack_info.
10263 * gold.cc (queue_middle_tasks): Call create_notes.
10264 * output.cc (Output_section::update_flags_for_input_section): Move
10265 here from output.h. If SHF_ALLOC flag is newly set, mark address
10266 invalid.
10267 * output.h (Output_data::mark_address_invalid): New function.
10268 (class Output_section): Only declare, not define,
10269 update_flags_for_input_section. Remove set_flags.
10270
10271 2009-06-24 Ian Lance Taylor <iant@google.com>
10272
10273 * script-sections.cc (Output_section_definition::
10274 set_section_addresses): Rename shadowing local load_address to
10275 laddr.
10276
10277 2009-06-24 Ian Lance Taylor <iant@google.com>
10278
10279 PR 10244
10280 * reloc.cc (relocate_sections): Skip empty relocation sections.
10281
10282 2009-06-23 Ian Lance Taylor <iant@google.com>
10283
10284 PR 10156
10285 * layout.cc (Layout::create_note): Use choose_output_section
10286 rather than make_output_section.
10287
10288 2009-06-23 Ian Lance Taylor <iant@google.com>
10289
10290 PR 10237
10291 * options.cc (General_options::parse_V): Set printed_version_.
10292 (General_options::General_options): Initialize printed_version_.
10293 * options.h (class General_options): Add printed_version_ field.
10294 * gold.cc (queue_initial_tasks): If there are no input files,
10295 don't give a fatal error if we printed the version information.
10296 (queue_middle_tasks): If using -r with a shared object, give a
10297 fatal error rather than an ordinary error.
10298
10299 2009-06-23 Ian Lance Taylor <iant@google.com>
10300
10301 PR 10219
10302 * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10303 (Layout::make_output_section): Set have_stabstr_section_ if we see
10304 a .stab*str section.
10305 (Layout::finalize): Call link_stabs_sections.
10306 (Layout::link_stabs_sections): New file.
10307 * layout.h (class Layout): Add have_stabstr_section_ field.
10308 Declare link_stabs_sections.
10309
10310 2009-06-23 Doug Kwan <dougkwan@google.com>
10311
10312 * Makefile.am (libgold_a_LIBADD): New.
10313 (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10314 * Makefile.in: Regenerate.
10315 * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10316 * configure: Regenerate.
10317 * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10318 * fileread.cc: Include sys/state.h
10319 * gold.h: Declare memmem and strndup if found missing.
10320 * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10321
10322 2009-06-23 Ian Lance Taylor <iant@google.com>
10323
10324 * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10325 * configure: Rebuild.
10326
10327 2009-06-23 Ian Lance Taylor <iant@google.com>
10328
10329 PR 10147
10330 * object.cc (Object::section_contents): Don't try to get a view if
10331 the section has length zero.
10332 (Object::handle_gnu_warning_section): If the section is empty, use
10333 the name of the section as the warning.
10334
10335 2009-06-23 Ian Lance Taylor <iant@google.com>
10336
10337 PR 10133
10338 * stringpool.h (class Stringpool_template): Add optimize_ field.
10339 (Stringpool_template::set_optimize): New function.
10340 * stringpool.cc (Stringpool_template::Stringpool_template):
10341 Initialize optimize_ field.
10342 (Stringpool_template::set_string_offsets): Test local optimize
10343 fild rather than parameter.
10344 * layout.cc (Layout::Layout): Call set_optimize on the section
10345 name stringpool.
10346
10347 2009-06-22 Ian Lance Taylor <iant@google.com>
10348
10349 PR 10030
10350 * yyscript.y: Parse TARGET.
10351 * script.cc (script_set_target): New function.
10352 * script-c.h (script_set_target): Declare.
10353 * options.cc (General_options::string_to_object_format): Rename
10354 from string_to_object_format in anonymous namespace. Change
10355 callers.
10356 * options.h (class General_options): Declare
10357 string_to_object_format.
10358
10359 2009-06-22 Ian Lance Taylor <iant@google.com>
10360
10361 * script-sections.cc (Script_sections::create_segments): Don't put
10362 program headers in a PT_LOAD segment if -n or -N.
10363
10364 2009-06-22 Ian Lance Taylor <iant@google.com>
10365
10366 PR 10141
10367 * options.h (class General_options): Add -z lazy and -z now. Sort
10368 -z options into alphabetical order.
10369 * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10370
10371 2009-06-21 Ian Lance Taylor <iant@google.com>
10372
10373 * layout.cc (Layout::make_output_section): Call
10374 Target::new_output_section.
10375 (Layout::attach_allocated_section_to_segment): Put large section
10376 sections in a separate load segment with the large segment flag
10377 set.
10378 (Layout::segment_precedes): Sort large data segments after other
10379 load segments.
10380 (align_file_offset): New static function.
10381 (Layout::set_segment_offsets): Use align_file_offset.
10382 * output.h (class Output_section): Add is_small_section_ and
10383 is_large_section_ fields.
10384 (Output_section::is_small_section): New function.
10385 (Output_section::set_is_small_section): New function.
10386 (Output_section::is_large_section): New function.
10387 (Output_section::set_is_large_section): New function.
10388 (Output_section::is_large_data_section): New function.
10389 (class Output_segment): Add is_large_data_segment_ field.
10390 (Output_segment::is_large_data_segment): New function.
10391 (Output_segment::set_is_large_data_segment): New function.
10392 * output.cc (Output_section::Output_section): Initialize new
10393 fields.
10394 (Output_segment::Output_segment): Likewise.
10395 (Output_segment::add_output_section): Add assertion that large
10396 data sections always go in large data segments. Force small data
10397 sections to the end of the list of data sections. Force small BSS
10398 sections to the start of the list of BSS sections. For large BSS
10399 sections to the end of the list of BSS sections.
10400 * symtab.h (class Symbol): Declare is_common_shndx.
10401 (Symbol::is_defined): Check Symbol::is_common_shndx.
10402 (Symbol::is_common): Likewise.
10403 (class Symbol_table): Define enum Commons_section_type. Update
10404 declarations. Add small_commons_ and large_commons_ fields.
10405 * symtab.cc (Symbol::is_common_shndx): New function.
10406 (Symbol_table::Symbol_table): Initialize new fields.
10407 (Symbol_table::add_from_object): Put small and large common
10408 symbols in the right list.
10409 (Symbol_table::sized_finalized_symbol): Check
10410 Symbol::is_common_shndx.
10411 (Symbol_table::sized_write_globals): Likewise.
10412 * common.cc (Symbol_table::do_allocate_commons): Allocate new
10413 common symbol lists. Don't call do_allocate_commons_list if the
10414 list is empty.
10415 (Symbol_table::do_allocate_commons_list): Remove is_tls
10416 parameter. Add comons_section_type parameter. Change all
10417 callers. Handle small and large common symbols.
10418 * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10419 Symbol::is_common_shndx.
10420 * resolve.cc (symbol_to_bits): Likewise.
10421 * target.h (Target::small_common_shndx): New function.
10422 (Target::small_common_section_flags): New function.
10423 (Target::large_common_shndx): New function.
10424 (Target::large_common_section_flags): New function.
10425 (Target::new_output_section): New function.
10426 (Target::Target_info): Add small_common_shndx, large_common_shndx,
10427 small_common_section_flags, and large_common_section_flags
10428 fields.
10429 (Target::do_new_output_section): New virtual function.
10430 * arm.cc (Target_arm::arm_info): Initialize new fields.
10431 * i386.cc (Target_i386::i386_info): Likewise.
10432 * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10433 Likewise.
10434 * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10435 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10436 (Target_x86_64::do_new_output_section): New function.
10437 * configure.ac: Define conditional MCMODEL_MEDIUM.
10438 * testsuite/Makefile.am (check_PROGRAMS): Add large.
10439 (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10440 (large_LDFLAGS): Define.
10441 * testsuite/large.c: New file.
10442 * testsuite/testfile.cc (Target_test::test_target_info):
10443 Initialize new fields.
10444 * configure, testsuite/Makefile.in: Rebuild.
10445
10446 2009-06-05 Doug Kwan <dougkwan@google.com>
10447
10448 * Makefile.am (CCFILES): Add target.cc.
10449 * Makefile.in: Regenerate.
10450 * i386.cc (class Target_i386): Define new virtual method to
10451 override do_is_local_label_name in parent.
10452 * object.cc (Sized_relobj::do_count_local_symbols): Discard
10453 local symbols if --discard-locals or -X is given.
10454 * options.h (class General_options): Declare new options
10455 '--discard-locals' and '-X' for discarding locals.
10456 * target.h (class Target): Define new methods is_local_label_name.
10457 Declare new virtual method do_is_local_label_name.
10458 * target.cc: New file.
10459 * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10460 (check_SCRIPTS): Add discard_locals_test.sh.
10461 (check_DATA): Add discard_local_tests.syms.
10462 (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10463 (discard_local_tests.syms, discard_locals_test.o): New make rules.
10464 * testsuite/Makefile.in: Regenerate.
10465 * testsuite/discard_locals_test.c: New file.
10466 * testsuite/discard_locals_test.sh: Same.
10467
10468 2009-06-05 Doug Kwan <dougkwan@google.com>
10469
10470 * object.cc (Sized_relobj::Sized_relobj): Initialize
10471 discarded_eh_frame_shndx_ to -1U.
10472 (Sized_relobj::do_layout): Record index of a discard .eh_frame
10473 section.
10474 (Sized_relobj::do_count_local_symbols): Skip local symbols in
10475 a discarded .eh_frame section.
10476 (Sized_relobj::do_finalize_local_symbols): Ditto.
10477 * object.h (class Sized_relobj): Declare new member
10478 discarded_eh_frame_shndx_.
10479 * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10480 (local_labels_test.o, local_labels_test): New rules.
10481 * testsuite/Makefile.in: Regenerate.
10482
10483 2009-06-04 Doug Kwan <dougkwan@google.com>
10484
10485 * layout.cc (Layout::section_name_mapping): Add mapping for
10486 special ARM sections.
10487
10488 2009-06-03 Doug Kwan <dougkwan@google.com>
10489
10490 * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10491 (utils::has_overflow): Same.
10492
10493 2009-06-03 Ian Lance Taylor <iant@google.com>
10494
10495 * layout.cc (Layout::section_name_mapping): New array, replacing
10496 Layout::linkonce_mapping.
10497 (Layout::section_name_mapping_count): New variable, replacing
10498 Layout::linkonce_mapping_count.
10499 (Layout::linkonce_output_name): Remove.
10500 (Layout::output_section_name): Rewrite.
10501 * layout.h (class Layout): Rename Linkonce_mapping to
10502 Section_name_mapping, linkonce_mapping to section_name_mapping,
10503 linkonce_mapping_count to section_name_mapping_count. Don't
10504 declare linkonce_output_name.
10505
10506 2009-06-03 Doug Kwan <dougkwan@google.com>
10507
10508 * gold/arm.cc (namespace utils): New.
10509 (Target_arm::reloc_is_non_pic): Define new method.
10510 (class Arm_relocate_functions): New.
10511 (Target_arm::Relocate::relocate): Handle relocation types used by
10512 Android.
10513
10514 2009-06-03 Ian Lance Taylor <iant@google.com>
10515
10516 * arm.cc (Target_arm::scan::global): Use || instead of |.
10517
10518 2009-06-02 Doug Kwan <dougkwan@google.com>
10519
10520 * gold/arm.cc (Target_arm::Scan::Scan): Initialize
10521 issued_non_pic_error_.
10522 (class Target_arm::Scan): Declare new method check_non_pic.
10523 Define new method symbol_needs_plt_entry.
10524 Declare new data member issued_non_pic_error_.
10525 (class Target_arm::Relocate): Declare new method
10526 should_apply_static_reloc.
10527 (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10528 (Target_arm::Scan::check_non_pic): Define new method.
10529 (Target_arm::Scan::local): Handle a small subset of reloc types used
10530 by Android.
10531 (Target_arm::Scan::local): Same.
10532 (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10533
10534 2009-05-31 Mikolaj Zalewski <mikolajz@google.com>
10535
10536 * incremental.cc (Incremental_inputs::report_command_line): Filter
10537 out --incremental-* options.
10538
10539 2009-05-29 Doug Kwan <dougkwan@google.com>
10540
10541 * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10542 template class.
10543 (class Target_arm): Update comment.
10544 (Target_arm::Target_arm): Initialize new data members GOT_,
10545 PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10546 Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10547 and Target_arm::rel_dyn_section.
10548 Declare new_enum Target_arm::Got_type.
10549 Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10550 and DYNBSS_.
10551 Update commments for member do_dynsym_value.
10552 (Target_arm::got_size, Target_arm::plt_section,
10553 Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10554 new methods inside class defintion.
10555 (Target_arm::got_section): Define new method.
10556 (Target_arm::rel_dyn_section): Same.
10557 (Output_data_plt_arm): New template class.
10558 (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10559 (Output_data_plt_arm:do_adjust_output_section): Define new method.
10560 (Output_data_plt_arm::add_entry): Same.
10561 (Output_data_plt_arm::first_plt_entry): Define new
10562 static data member for PLT instruction template.
10563 (Output_data_plt_arm::plt_entry): Same.
10564 (Output_data_plt_arm::do_write): Define new method.
10565 (Target_arm::make_plt_entry): Same.
10566 (Target_arm::do_finalize_sections): Same.
10567 (Target_arm::do_dynsym_value): Same.
10568
10569 2009-05-28 Doug Kwan <dougkwan@google.com>
10570
10571 * Makefile.am (TARGETSOURCES): Add arm.cc.
10572 (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10573 * Makefile.in: Regenerate.
10574 * arm.cc: New file.
10575 * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10576
10577 2009-05-26 Doug Kwan <dougkwan@google.com>
10578
10579 * options.cc (General_options::parse_exclude_libs). Fix a comment.
10580 (General_options::check_excluded_libs): Strip off directories in
10581 archive name before matching like GNU ld does.
10582 * testsuite/Makefile.am (MOSTLYCLEANFILES,
10583 exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10584 (exclude_libs_test_LDFLAGS): Add linker option
10585 -Wl,--exclude-libs,libexclude_libs_test_3
10586 (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10587 an explicit archive without using -l.
10588 (alt/libexclude_libs_test_3.a): New make rule.
10589 * testsuite/Makefile.in: Regenerate.
10590 * testsuite/exclude_libs_test.c : Declare lib3_default().
10591 (main): Call it.
10592 * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10593 * exclude_libs_test_3.c: New file.
10594
10595 2009-05-26 Nick Clifton <nickc@redhat.com>
10596
10597 * po/id.po: New Indonesian translation.
10598 * po/gold.pot: Updated template file.
10599
10600 2009-05-22 Sriraman Tallam <tmsriram@google.com>
10601
10602 * testsuite/Makefile.am: Add -ffunction-sections to compile
10603 gc_comdat_test files. Add -Wl,--gc-sections to build
10604 gc_comdat_test.
10605 * testsuite/Makefile.in: Regenerate.
10606 * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10607
10608 2009-05-21 Sriraman Tallam <tmsriram@google.com>
10609
10610 * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10611 kept comdat section was garbage collected.
10612 * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10613 * testsuite/Makefile.in: Regenerate.
10614 * testsuite/gc_comdat_test.sh: New file.
10615 * testsuite/gc_comdat_test_1.cc: New file.
10616 * testsuite/gc_comdat_test_2.cc: New file.
10617
10618 2009-05-19 Doug Kwan <dougkwan@google.com>
10619
10620 * archive.cc (Archive::Archive): Move constructor from archive.h
10621 to here. Initialize no_export_.
10622 (Archive::get_elf_object_for_member): Set no_export flag of object.
10623 * archive.h (Archive::Archive): Move constructor body to
10624 archive.cc.
10625 (Archive::no_export): New method.
10626 (Archive::no_export_): New field.
10627 * object.h (Object::Object): Initialize no_export_ to false.
10628 (Object::no_export, Object::set_no_export): New methods.
10629 (Object::no_export_): New field.
10630 * options.cc (General_options::parse_exclude_libs): New method.
10631 (General_options::check_excluded_libs) Same.
10632 * options.h (exclude_libs): New option.
10633 (General_options::check_excluded_libs): New method declaration.
10634 (General_options::excluded_libs_): New field.
10635 * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10636 default or protected visibility if an object has no-export flag set.
10637 testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10638 (check_SCRIPTS): Add exclude_libs_test.sh.
10639 (check_DATA): Add exclude_libs_test.syms.
10640 (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10641 libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10642 (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10643 exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10644 (exclude_libs_test.syms, libexclude_libs_test_1.a,
10645 libexclude_libs_test_2.a): New rules.
10646 * testsuite/Makefile.in: Regenerate.
10647 * testsuite/exclude_libs_test.c: New file.
10648 * testsuite/exclude_libs_test.sh: Ditto.
10649 * testsuite/exclude_libs_test_1.c: Ditto.
10650 * testsuite/exclude_libs_test_2.c: Ditto.
10651
10652 2009-05-15 Ian Lance Taylor <iant@google.com>
10653
10654 * configure.ac: Check for declarations for cases where libiberty.h
10655 checks HAVE_DECL_xxx.
10656 * configure, config.in: Rebuild.
10657
10658 2009-05-15 Mikolaj Zalewski <mikolajz@google.com>
10659
10660 * gold.h (Incremental_argument_list): Remove (invalid) forward
10661 declaration.
10662 * incremental.cc (Incremental_inputs::report_achive): New method.
10663 (Incremental_inputs::report_object): New method.
10664 (Incremental_inputs::report_script): New method.
10665 (Incremental_inputs::finalize_inputs): New method.
10666 (Incremental_inputs::finalize): Call finalize_inputs().
10667 (Incremental_inputs::sized_create_incremental_inputs_section_data):
10668 Create inputs entries.
10669 * incremental.h (Incremental_input_type): New enum.
10670 (Incremental_inputs::Incremental_input): Initialize new fields.
10671 (Incremental_inputs::report_inputs): New method.
10672 (Incremental_inputs::report_achive): New method.
10673 (Incremental_inputs::report_object): New method.
10674 (Incremental_inputs::report_script): New method.
10675 (Incremental_inputs::finalize_inputs): New method.
10676 (Incremental_inputs::Input_info): New struct.
10677 (Incremental_inputs::Input_info_map): New typedef.
10678 (Incremental_inputs::lock_): New field.
10679 (Incremental_inputs::Inputs_): New field.
10680 (Incremental_inputs::Inputs_map): New field.
10681 * main.cc (main): Call Incremental_input::report_inputs.
10682 * options.h (Input_argument_list): Typedef moved from
10683 Input_arguments.
10684 (Input_file_group::Files): Remove, use ::Input_argument_list.
10685 (Input_file_group::Input_argument_list): Remove, use
10686 ::Input_argument_list.
10687 * plugin.cc (Plugin_manager::add_input_file): Add error in
10688 incremental build.
10689 * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10690 functions.
10691 * script.cc (read_input_script): Call
10692 Incremental_input::report_script.
10693 * script.h (Script_info): New class.
10694
10695 2009-04-27 Ian Lance Taylor <iant@google.com>
10696
10697 * x86_64.cc (do_adjust_output_section): Set entsize to
10698 plt_entry_size.
10699
10700 2009-04-23 Elliott Hughes <enh@google.com>
10701
10702 * output.cc (Output_file::close): After short writes, continue
10703 writing from the correct offset in the buffer being written.
10704
10705 2009-04-23 Chris Demetriou <cgd@google.com>
10706
10707 * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10708 * configure: Regenerate.
10709 * config.in: Regenerate.
10710 * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10711 if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10712
10713 2009-04-21 Mikolaj Zalewski <mikolajz@google.com>
10714
10715 * incremental.cc (Incremental_inputs_header_data): Renamed from
10716 Incremental_input_header_data.
10717 (Incremental_inputs_header_data::data_size): New field.
10718 (Incremental_inputs_header_data::put_input_file_count): Renamed
10719 from input_file_count.
10720 (Incremental_inputs_header_data::put_command_line_offset): Renamed
10721 from command_line_offset.
10722 (Incremental_inputs_header_data::put_reserved): Renamed from
10723 put_reserved.
10724 (Incremental_inputs_entry_data): Renamed from
10725 Incremental_input_entry_data.
10726 (Incremental_inputs_entry_data::data_size): New field.
10727 (Incremental_inputs::report_command_line): New method.
10728 (Incremental_inputs::finalize): New method.
10729 (Incremental_inputs::create_incremental_inputs_data): New method.
10730 (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10731 * incremental.h: New file.
10732 * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10733 (Layout::finalize): Create incremental inputs section in
10734 incremental builds.
10735 (Layout::create_incremental_info_sections): New method.
10736 * layout.h (Layout::incremental_inputs): New method.
10737 (Layout::create_incremental_info_sections): New method.
10738 (Layout::incremental_inputs_): New field.
10739 * main.cc (main): Notify Incremental_input of the command line.
10740
10741 2009-04-01 Ian Lance Taylor <iant@google.com>
10742 Mikolaj Zalewski <mikolajz@google.com>
10743
10744 * gold.h (reserve_unordered_map): Define, three versions, one for
10745 each version of Unordered_map.
10746 * layout.cc (Layout::Layout): Remove options parameter. Add
10747 number_of_input_files parameter. Don't initialize options_.
10748 Initialize number_of_input_files_ and resized_signatures_. Move
10749 sections_are_attached_.
10750 (Layout::layout_group): Reserve space for group_signatures_.
10751 (Layout::find_or_add_kept_section): Change name parameter to be a
10752 reference. Resize signatures_ map when it gets large enough.
10753 (Layout::layout_eh_frame): Use parameters->options() instead of
10754 this->options_.
10755 (Layout::make_output_section): Likewise.
10756 (Layout::attach_allocated_section_to_segment): Likewise.
10757 (Layout::finalize, Layout::create_executable_stack): Likewise.
10758 (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10759 (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10760 * layout.h (class Layout): Update declarations. Remove options_
10761 field. Add number_of_input_files_ and resized_signatures_
10762 fields. Move sections_are_attached_ field.
10763 * main.cc (main): Pass number of input files to Layout
10764 constructor. Don't pass options.
10765
10766 2009-03-30 Ian Lance Taylor <iant@google.com>
10767
10768 * ffsll.c (ffsll): Correct implementation.
10769
10770 2009-03-27 Ian Lance Taylor <iant@google.com>
10771
10772 * ffsll.c: New file.
10773 * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10774 * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10775 * ftruncate.c (ftruncate): Declare before definition.
10776 * mremap.c (mremap): Likewise.
10777 * pread.c (pread): Likewise.
10778 * configure, Makefile.in, config.in: Rebuild.
10779
10780 * mremap.c: New file.
10781 * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10782 * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10783 (mremap): Declare if HAVE_MREMAP is not defined.
10784 * configure, Makefile.in, config.in: Rebuild.
10785
10786 2009-03-27 Cary Coutant <ccoutant@google.com>
10787
10788 * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10789 position independent.
10790 * sparc.cc (Target_sparc::check_non_pic): Likewise.
10791 * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10792
10793 2009-03-24 Cary Coutant <ccoutant@google.com>
10794
10795 * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10796 an executable.
10797 (needs_dynamic_reloc): Likewise.
10798
10799 2009-03-24 Ian Lance Taylor <iant@google.com>
10800
10801 * yyscript.y (file_cmd): Recognize EXTERN.
10802 (extern_name_list, extern_name_list_body): New nonterminals.
10803 * script.cc (script_add_extern): Define.
10804 * script-c.h (script_add_extern): Declare.
10805
10806 2009-03-24 Rafael Avila de Espindola <espindola@google.com>
10807
10808 * object.cc (is_elf_object): Define.
10809 * object.h (is_elf_object): Declare.
10810 * archive.cc (Archive::get_elf_object_for_member): Call
10811 is_elf_object.
10812 * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10813
10814 2009-03-24 Elliott Hughes <enh@google.com>
10815
10816 * output.cc (Output_file::map_anonymous): Define.
10817 (Output_file::map): Use map_anonymous. If the regular mmap fails,
10818 try an anonymous one. Report the size if the mmap fails.
10819 * output.h (class Output_file): Declare map_anonymous.
10820
10821 2009-03-24 Ian Lance Taylor <iant@google.com>
10822
10823 * target-select.cc (instantiate_target): Don't acquire the lock if
10824 the instantiated_target_ field has already been set.
10825
10826 2009-03-23 Ian Lance Taylor <iant@google.com>
10827
10828 * gold-threads.h (class Initialize_lock): Define.
10829 * gold-threads.cc (class Initialize_lock_once): Define.
10830 (initialize_lock_control): New static variable.
10831 (initialize_lock_pointer): New static variable.
10832 (initialize_lock_once): New static function.
10833 (Initialize_lock::Initialize_lock): Define.
10834 (Initialize_lock::initialize): Define.
10835 * target-select.h: Include "gold-threads.h".
10836 (class Target_selector): Add lock_ and initialize_lock_ fields.
10837 Don't define instantiate_target, just declare it.
10838 * target-select.cc (Target_selector::Target_selector): Initialize
10839 new fields.
10840 (Target_selector::instantiate_target): Define.
10841 * descriptors.h: Include "gold-threads.h".
10842 (class Descriptors): Add initialize_lock_ field.
10843 * descriptors.cc (Descriptors::Descriptors): Initialize new
10844 field.
10845 (Descriptors::open): Use initialize_lock_ field
10846 * errors.h (class Errors): Add initialize_lock_ field.
10847 * errors.cc (Errors::Errors): Initialize new field.
10848 (Errors::initialize_lock): Use initialize_lock_ field.
10849 * powerpc.cc (class Target_selector_powerpc): Remove
10850 instantiated_target_ field. In do_recognize call
10851 instantiate_target rather than do_instantiate_target. In
10852 do_instantiate_target just allocate a new target.
10853 * sparc.cc (class Target_selector_sparc): Likewise.
10854
10855 * freebsd.h: New file.
10856 * i386.cc: Include "freebsd.h".
10857 (Target_i386): Derive from Target_freebsd rather than
10858 Sized_target.
10859 (Target_selector_i386): Derive from Target_selector_freebsd rather
10860 than Target_selector.
10861 * x86_64.cc: Include "freebsd.h".
10862 (Target_x86_64): Derive from Target_freebsd rather than
10863 Sized_target.
10864 (Target_selector_x86_64): Derive from Target_selector_freebsd
10865 rather than Target_selector.
10866 * target.h (class Target): Add adjust_elf_header and
10867 do_adjust_elf_header.
10868 * output.cc (Output_file_header:: do_sized_write): Call target
10869 adjust_elf_header routine.
10870 * configure.tgt: Set targ_osabi.
10871 * configure.ac: Define GOLD_DEFAULT_OSABI.
10872 * parameters.cc (Parameters::default_target): Pass
10873 GOLD_DEFAULT_OSABI to select_target.
10874 * target-select.h (class Target_selector): Make instantiate_target
10875 protected rather than private.
10876 * Makefile.am (HFILES): Add freebsd.h.
10877 * configure, Makefile.in, config.in: Rebuild.
10878
10879 * merge.cc (do_add_input_section): Correct pend value. Change
10880 message about last entry not being null terminated from error to
10881 warning.
10882
10883 2009-03-20 Mikolaj Zalewski <mikolajz@google.com>
10884
10885 * incremental.cc: New file.
10886 * Makefile.am (CCFILES): Add incremental.cc.
10887 * Makefile.in: Rebuild.
10888
10889 2009-03-19 Paul Pluzhnikov <ppluzhnikov@google.com>
10890
10891 * layout.cc (Layout::output_section_name): Preserve names
10892 of '.note.' sections.
10893
10894 2009-03-19 Ian Lance Taylor <iant@google.com>
10895
10896 * descriptors.cc (Descriptors::open): Check that the options are
10897 valid before using them.
10898
10899 2009-03-18 Ian Lance Taylor <iant@google.com>
10900
10901 * script-sections.h: Include <list>.
10902 (class Script_sections): Change Sections_elements from std::vector
10903 to std::list. Typedef public Elements_iterator. Add
10904 orphan_section_placement_, data_segment_align_start_, and
10905 saw_data_segment_align_ fields. Remove data_segment_align_index_
10906 field.
10907 * script-sections.cc (class Orphan_section_placement): New class.
10908 (class Sections_element): Add virtual functions is_relro and
10909 orphan_section_init. Remove virtual function place_orphan_here.
10910 (class Output_section_definition): Add is_relro and
10911 orphan_section_init. Remove place_orphan_here.
10912 (class Orphan_output_section): Likewise.
10913 (Script_sections::Script_sections): Update for field changes.
10914 (Script_sections::data_segment_align): Set saw_data_segment_align_
10915 and data_segment_align_start_, not data_segment_align_index.
10916 (Script_sections::data_segment_relro_end): Check
10917 saw_data_segment_align_. Use data_segment_align_start_ rather
10918 than data_segment_align_index_.
10919 (Script_sections::place_orphan): Rewrite to use
10920 Orphan_section_placement.
10921
10922 2009-03-17 Ian Lance Taylor <iant@google.com>
10923
10924 * archive.cc (Archive::add_symbols): Check for a version attached
10925 to the symbol name in the archive map.
10926 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10927 (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10928 (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10929 (ver_test_11.a): New target.
10930 * testsuite/Makefile.in: Rebuild.
10931
10932 * configure.ac: Check for chsize and posix_fallocate. Replace
10933 ftruncate.
10934 * ftruncate.c: New file, from gnulib.
10935 * output.cc (posix_fallocate): Define dummy version if not
10936 HAVE_POSIX_FALLOCATE.
10937 (Output_file::map): Call posix_fallocate rather than lseek and
10938 write.
10939 * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10940 * configure, Makefile.in, config.in: Rebuild.
10941
10942 2009-03-17 Paul Pluzhnikov <ppluzhnikov@google.com>
10943
10944 * layout.h (Layout::create_note): Add section_name parameter.
10945 * layout.cc (Layout::create_note): Likewise.
10946 (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10947
10948 2009-03-17 Ian Lance Taylor <iant@google.com>
10949
10950 * descriptors.cc: Include "options.h".
10951 (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10952 (Descriptors::open): Always use O_CLOEXEC when opening a new
10953 descriptor. If we have a plugin, and O_CLOEXEC was not defined,
10954 then set FD_CLOEXEC.
10955
10956 * sparc.cc (class Target_sparc): Add has_got_section.
10957 (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10958 make sure we have a GOT section.
10959
10960 * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10961 (Target_sparc::Scan::local): Likewise.
10962 (Target_sparc::Scan::global): Likewise.
10963 (Target_sparc::Relocate::relocate): Likewise.
10964 (Target_sparc::Relocate::relocate_tls): Likewise.
10965
10966 * symtab.cc (Symbol_table::define_default_version): New function,
10967 broken out of add_from_object.
10968 (Symbol_table::add_from_object): Call define_default_version.
10969 (Symbol_table::define_special_symbol): Add resolve_oldsym
10970 parameter. Change all callers. If the version for a symbol comes
10971 from a version script, resolve it with the symbol with the same
10972 name with no version. Also add the symbol without a version if
10973 appropriate.
10974 (do_define_in_output_data): If resolving with oldsym, don't delete
10975 sym.
10976 (do_define_in_output_segment): Likewise.
10977 (do_define_as_constant): Likewise.
10978 * symtab.h (class Symbol_table): Update declarations.
10979
10980 2009-03-13 Ian Lance Taylor <iant@google.com>
10981
10982 * readsyms.cc (Read_symbols::incompatible_warning): New function.
10983 (Read_symbols::requeue): New function.
10984 (Read_symbols::do_read_symbols): If make_elf_object fails because
10985 the target type is not configured, and the file was searched for,
10986 issue a warning and retry with the next directory.
10987 (Add_symbols::run): If the file has an incompatible format, and
10988 it was searched for, requeue the Read_symbols task. On error,
10989 release the object.
10990 * readsyms.h (class Read_symbols): Add dirindex_ field. Add
10991 dirindex parameter to constructor. Change all callers. Declare
10992 incompatible_warning and requeue.
10993 (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10994 input_argument_ and input_group_ fields. Add them to
10995 constructor. Change all callers.
10996 (class Read_script): Add dirindex_ field. Add it to constructor.
10997 Change all callers.
10998 * archive.cc (Archive::setup): Remove input_objects parameter.
10999 Change all callers.
11000 (Archive::get_file_and_offset): Likewise.
11001 (Archive::read_all_symbols): Likewise.
11002 (Archive::read_symbols): Likewise.
11003 (Archive::get_elf_object_for_member): Remove input_objects
11004 parameter. Add punconfigured parameter. Change all callers.
11005 (Archive::add_symbols): Change return type to bool. Check return
11006 value of include_member.
11007 (Archive::include_all_members): Likewise.
11008 (Archive::include_member): Change return type to bool. Return
11009 false if first included object has incompatible target. Set
11010 included_member_ field.
11011 (Add_archive_symbols::run): If add_symbols returns false, requeue
11012 Read_symbols task.
11013 * archive.h (class Archive): Add included_member_ field.
11014 Initialize it in constructor. Add input_file and searched_for
11015 methods. Update declarations.
11016 (class Add_archive_symbols): Add dirpath_, dirindex_, and
11017 input_argument_ fields. Add them to constructor. Change all
11018 callers.
11019 * script.cc: Include "target-select.h".
11020 (class Parser_closure): Add skip_on_incompatible_target_ and
11021 found_incompatible_target_ fields. Add
11022 skip_on_incompatible_target parameter to constructor. Change all
11023 callers. Add methods skip_on_incompatible_target,
11024 clear_skip_on_incompatible_target, found_incompatible_target, and
11025 set_found_incompatible_target.
11026 (read_input_script): Add dirindex parameter. Change all callers.
11027 If parser finds an incompatible target, requeue Read_symbols
11028 task.
11029 (script_set_symbol): Clear skip_on_incompatible_target in
11030 closure.
11031 (script_add_assertion, script_parse_option): Likewise.
11032 (script_start_sections, script_add_phdr): Likewise.
11033 (script_check_output_format): New function.
11034 * script.h (read_input_script): Update declaration.
11035 * script-c.h (script_check_output_format): Declare.
11036 * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11037 (ignore_cmd): Remove OUTPUT_FORMAT.
11038 * fileread.cc (Input_file::Input_file): Add explicit this.
11039 (Input_file::will_search_for): New function.
11040 (Input_file::open): Add pindex parameter. Change all callers.
11041 * fileread.h (class Input_file): Add input_file_argument method.
11042 Declare will_search_for. Update declarations.
11043 * object.cc (make_elf_object): Add punconfigured parameter.
11044 Change all callers.
11045 * object.h (class Object): Make input_file public. Add
11046 searched_for method.
11047 (make_elf_object): Update declaration.
11048 * dirsearch.cc (Dirsearch::find): Add pindex parameter. Use it to
11049 restart search.
11050 * dirsearch.h (class Dirsearch): Update declaration.
11051 * options.h (class General_options): Add --warn-search-mismatch.
11052 * parameters.cc (Parameters::is_compatible_target): New function.
11053 * parameters.h (class Parameters): Declare is_compatible_target.
11054 * workqueue.cc (Workqueue::add_blocker): New function.
11055 * workqueue.h (class Workqueue): Declare add_blocker.
11056
11057 * fileread.cc (Input_file::open): Remove options parameter.
11058 Change all callers.
11059 (Input_file::open_binary): Likewise.
11060 * script.cc (read_input_script): Likewise.
11061 * readsyms.h (class Read_symbols): Remove options_ field. Remove
11062 options parameter from constructor. Change all callers.
11063 (class Read_script): Likewise.
11064 * fileread.h (class Input_file): Update declarations.
11065 * script.h (read_input_script): Update declaration.
11066
11067 2009-03-10 Nick Clifton <nickc@redhat.com>
11068
11069 * po/es.po: New Spanish translation.
11070
11071 2009-03-06 Cary Coutant <ccoutant@google.com>
11072
11073 * options.cc (parse_short_option): Keep dash_z from registering itself.
11074
11075 2009-03-03 Ian Lance Taylor <iant@google.com>
11076
11077 PR 9918
11078 * target-reloc.h (relocate_section): Pass output_section to
11079 relocate.
11080 * i386.cc (Target_i386::should_apply_static_reloc): Add
11081 output_section parameter. Change all callers.
11082 (Target_i386::Relocate::relocate): Add output_section parameter.
11083 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11084 * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11085 * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11086 * testsuite/two_file_shared.sh: New script.
11087 * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11088 (check_DATA): Add two_file_shared.dbg.
11089 (two_file_shared.dbg): New target.
11090 * testsuite/Makefile.in: Rebuild.
11091
11092 2009-03-01 Ian Lance Taylor <iant@google.com>
11093
11094 * configure.ac: Check for byteswap.h.
11095 * configure: Rebuild.
11096 * config.in: Rebuild.
11097
11098 2009-03-01 Mikolaj Zalewski <mikolajz@google.com>
11099
11100 * layout.cc (Layout::find_or_add_kept_section): New function.
11101 (Layout::add_comdat): Removed.
11102 * layout.h (struct Kept_section): Move out of class Layout.
11103 Remove trailing underscores from field names. Add group_sections
11104 field. Rename group_ field to is_group. Change all uses.
11105 (class Layout): Declare find_or_add_kept_section, not add_comdat.
11106 * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11107 comdat_groups_ field.
11108 (Sized_relobj::include_section_group): Use
11109 find_or_add_kept_section and Kept_section::group_sections.
11110 (Sized_relobj::include_linkonce_section): Likewise.
11111 * object.cc (class Sized_relobj): Don't define Comdat_group or
11112 Comdat_group_table. Remove find_comdat_group and
11113 add_comdat_group. Remove comdat_groups_ field.
11114 * plugin.cc (include_comdat_group): Use
11115 Layout::find_or_add_kept_section.
11116
11117 2009-02-28 Ian Lance Taylor <iant@google.com>
11118
11119 * README: --gc-sections and map files are now supported. Document
11120 some build requirements.
11121
11122 PR 6992
11123 * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11124 relocatable link set the value of the section symbol to zero.
11125 * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11126 relocatable link don't include the section address in the local
11127 symbol value.
11128
11129 2009-02-27 Ian Lance Taylor <iant@google.com>
11130
11131 PR 6811
11132 * options.h (class Search_directory): Add is_system_directory.
11133 (class General_options): Declare is_in_system_directory.
11134 * options.cc (get_relative_sysroot): Make static.
11135 (get_default_sysroot): Make static.
11136 (General_optoins::is_in_system_directory): New function.
11137 * fileread.cc (Input_file::is_in_system_directory): New function.
11138 * fileread.h (class Input_file): Declare is_in_system_directory.
11139 * object.h (class Object): Add is_in_system_directory.
11140 (class Input_objects): Remove system_library_directory_ field.
11141 * object.cc (Input_objects::add_object): Don't set
11142 system_library_directory_.
11143 (input_objects::found_in_system_library_directory): Remove.
11144 * symtab.cc (Symbol_table::write_globals): Remove input_objects
11145 parameter. Change all callers.
11146 (Symbol_table::sized_write_globals): Likewise.
11147 (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11148 Call Object::is_in_system_directory.
11149 * symtab.h (class Symbol_table): Update declarations.
11150
11151 PR 5990
11152 * descriptors.h (Open_descriptor): Add is_on_stack field.
11153 * descriptors.cc (Descriptors::open): If the descriptor is on the
11154 top of the stack, remove it. Initialize is_on_stack field.
11155 (Descriptors::release): Only add pod to stack if it is not on the
11156 stack already.
11157 (Descriptors::close_some_descriptor): Clear stack_next and
11158 is_on_stack fields.
11159
11160 PR 7091
11161 * output.cc (Output_section::find_starting_output_address): Rename
11162 from starting_output_address; add PADDR parameter; change return
11163 type.
11164 * output.h (class Output_section): Declare
11165 find_starting_output_address instead of starting_output_address.
11166 * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11167 section symbol for which we can't find a merge section.
11168
11169 PR 9836
11170 * symtab.cc (Symbol_table::add_from_object): If the visibility is
11171 hidden or internal, force the symbol to be local.
11172 * resolve.cc (Symbol::override_visibility): Define.
11173 (Symbol::override_base): Use override_visibility.
11174 (Symbol_table::resolve): Likewise.
11175 (Symbol::override_base_with_special): Likewise.
11176 (Symbol_table::override_with_special): If the visibility is hidden
11177 or internal, force the symbol to be local.
11178 * symtab.h (class Symbol): Add set_visibility and
11179 override_visibility.
11180 * testsuite/ver_test_1.sh: New file.
11181 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11182 (check_DATA): Add ver_test_1.syms.
11183 (ver_test_1.syms): New target.
11184 * testsuite/Makefile.in: Rebuild.
11185
11186 2009-02-25 Cary Coutant <ccoutant@google.com>
11187
11188 * layout.cc (Layout::choose_output_section): Don't rename sections
11189 when using a linker script that has a SECTIONS clause.
11190 * Makefile.in: Regenerate.
11191
11192 * testsuite/Makefile.am (script_test_5.sh): New test case.
11193 * testsuite/Makefile.in: Regenerate.
11194 * testsuite/script_test_5.cc: New file.
11195 * testsuite/script_test_5.sh: New file.
11196 * testsuite/script_test_5.t: New file.
11197
11198 2009-02-13 Rafael Avila de Espindola <espindola@google.com>
11199
11200 * archive.cc (Archive::include_member): Update calls to add_symbols.
11201 * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11202 the Layout argument.
11203 * dynobj.h (do_add_symbols): Add the Layout argument.
11204 * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11205 Layout argument.
11206 * object.h (Object::add_symbols): Add the Layout argument.
11207 (Object::do_add_symbols): Add the Layout argument.
11208 (Sized_relobj::do_add_symbols): Add the Layout argument.
11209 * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11210 Unify the two versions.
11211 (Add_plugin_symbols): Remove.
11212 * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11213 (Sized_pluginobj::do_add_symbols): Unify the two versions.
11214 (Add_plugin_symbols): Remove.
11215 * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11216 Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11217 (Add_symbols::run): Make it work with Pulginobj.
11218
11219 2009-02-06 Ian Lance Taylor <iant@google.com>
11220
11221 * object.cc (Sized_relobj::do_layout): Make info message start
11222 with lower case letter.
11223
11224 2009-02-06 Mikolaj Zalewski <mikolajz@google.com>
11225
11226 * binary.cc: Fix file comment.
11227
11228 * options.h (enum Incremental_disposition): Define.
11229 (class General_options): Add new options: --incremental,
11230 --incremental_changed, --incremental_unchanged,
11231 --incremental_unknown. Add incremental_disposition_ and
11232 implicit_incremental_ fields.
11233 (General_options::incremental_disposition): New function.
11234 (class Position_dependent_options): Add incremental_disposition
11235 option.
11236 (Position_dependent_options::copy_from_options): Set incremental
11237 dispositions.
11238 * options.cc (General_options::parse_incremental_changed): New
11239 function.
11240 (General_options::parse_incremental_unchanged): New function.
11241 (General_options::parse_incremental_unknown): New function.
11242 (General_options::General_options): Initialize new fields
11243 incremental_disposition_ and implicit_incremental_.
11244 (General_options::finalize): Check for uasge of --incremental-*
11245 without --incremental.
11246
11247 2009-02-06 Chris Demetriou <cgd@google.com>
11248
11249 * gold.h (gold_undefined_symbol): Change to take only a Symbol
11250 pointer and to report location as the file name associated with
11251 the symbol.
11252 (gold_undefined_symbol_at_location): New function to replace the
11253 old gold_undefined_symbol functionality.
11254 * target-reloc.h (relocate_section): Update to use
11255 gold_undefined_symbol_at_location.
11256 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11257 Call gold_undefined_symbol function rather than gold_error.
11258 * errors.h (Errors::undefined_symbol): Take location as a
11259 string, rather than calculating it from a relocation.
11260 * errors.cc (Errors::fatal): Print "fatal error:" before the
11261 formatted message.
11262 (Errors::error, Errors::error_at_location): Print "error: "
11263 before the formatted message.
11264 (Errors::undefined_symbol): Take location as a string, rather
11265 than calculating it from a relocation.
11266 (gold_undefined_symbol_at_location): New function akin to
11267 old gold_undefined_symbol, calculates location from relocation.
11268 (gold_undefined_symbol): Change to take only a Symbol pointer
11269 and to report location as the file name associated with the symbol.
11270 * testsuite/debug_msg.sh: Update for changed error messages.
11271 * testsuite/undef_symbol.sh: Likewise.
11272
11273 2009-02-04 Duncan Sands <baldrick@free.fr>
11274
11275 PR 9812
11276 * reduced_debug_output.h
11277 (Output_reduced_debug_abbrev_section::failed): Use format for
11278 gold_warning.
11279 (Output_reduced_debug_info_section::faild): Likewise.
11280
11281 2009-01-31 Mikolaj Zalewski <mikolajz@google.com>
11282
11283 * script.cc (Lazy_demangler): New class.
11284 (Version_script_info::get_symbol_version_helper): Demangle a
11285 symbol only once.
11286
11287 2009-01-29 Cary Coutant <ccoutant@google.com>
11288
11289 * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11290 to __tls_get_addr.
11291 * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11292
11293 2009-01-28 Ian Lance Taylor <iant@google.com>
11294
11295 * version.cc (version_string): Bump to 1.9.
11296
11297 * gold.h: Include <cstring> and <stdint.h>.
11298 * version.cc: Include <cstdio>.
11299 * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11300 warning.
11301 * reduced_debug_output.cc (insert_into_vector): Rename from
11302 Insert_into_vector; change all callers. Use Swap_unaligned to
11303 avoid aliasing issue; remove union since it is unnecessary.
11304
11305 2009-01-27 Sriraman Tallam <tmsriram@google.com>
11306
11307 * Makefile.am (CCFILES): Add gc.cc.
11308 (HFILES): Add gc.h.
11309 * Makefile.in: Regenerate.
11310 * gold.cc (Gc_runner): New class.
11311 (queue_initial_tasks): Call garbage collection related tasks
11312 when corresponding options are invoked.
11313 (queue_middle_gc_tasks): New function.
11314 (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11315 processed early before laying out sections during garbage collection.
11316 * gold.h (queue_middle_gc_tasks): New function.
11317 (is_prefix_of): Move from "layout.cc".
11318 * i386.cc (Target_i386::gc_process_relocs): New function.
11319 * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11320 * main.cc (main): Create object of class "Garbage_collection".
11321 * object.cc (Relobj::copy_symbols_data): New function.
11322 (Relobj::is_section_name_included): New function.
11323 (Sized_relobj::do_layout): Allow this function to be called twice
11324 during garbage collection and defer layout of section during the
11325 first call.
11326 * object.h (Relobj::get_symbols_data): New function.
11327 (Relobj::is_section_name_included): New function.
11328 (Relobj::copy_symbols_data): New function.
11329 (Relobj::set_symbols_data): New function.
11330 (Relobj::get_relocs_data): New function.
11331 (Relobj::set_relocs_data): New function.
11332 (Relobj::is_output_section_offset_invalid): New pure virtual function.
11333 (Relobj::gc_process_relocs): New function.
11334 (Relobj::do_gc_process_relocs): New pure virtual function.
11335 (Relobj::sd_): New data member.
11336 (Sized_relobj::is_output_section_offset_invalid): New function.
11337 (Sized_relobj::do_gc_process_relocs): New function.
11338 * options.h (General_options::gc_sections): Modify to not be a no-op.
11339 (General_options::print_gc_sections): New option.
11340 * plugin.cc (Plugin_finish::run): Remove function call to
11341 Plugin_manager::layout_deferred_objects. Move it to "gold.cc".
11342 * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11343 * reloc.cc (Read_relocs::run): Add task to process relocs and
11344 determine unreferenced sections when doing garbage collection.
11345 (Gc_process_relocs): New class.
11346 (Sized_relobj::do_gc_process_relocs): New function.
11347 (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11348 sections that are garbage collected.
11349 * reloc.h (Gc_process_relocs): New class.
11350 * sparc.cc (Target_sparc::gc_process_relocs): New function.
11351 * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11352 symbols whose corresponding sections are garbage collected.
11353 (Symbol_table::Symbol_table): Add new parameter for the garbage
11354 collection object.
11355 (Symbol_table::gc_mark_undef_symbols): New function.
11356 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11357 (Symbol_table::gc_mark_dyn_syms): New function.
11358 (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11359 as garbage.
11360 (Symbol_table::add_from_object): Likewise.
11361 (Symbol_table::add_from_relobj): When building shared objects, do not
11362 treat externally visible symbols as garbage.
11363 (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11364 table information for static and relocatable links.
11365 * symtab.h (Symbol_table::set_gc): New function.
11366 (Symbol_table::gc): New function.
11367 (Symbol_table::gc_mark_undef_symbols): New function.
11368 (Symbol_table::gc_mark_symbol_for_shlib): New function.
11369 (Symbol_table::gc_mark_dyn_syms): New function.
11370 (Symbol_table::gc_): New data member.
11371 * target.h (Sized_target::gc_process_relocs): New pure virtual
11372 function.
11373 * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11374 * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11375
11376 2009-01-20 Chris Faylor <me.sourceware@sourceware.org>
11377
11378 * options.h (General_options::gc_sections): Define as a no-op for now.
11379 (General_options::no_keep_memory): Ditto.
11380 (General_options::Bshareable): Define.
11381 * options.cc (General_options::finalize): Honor -Bshareable.
11382
11383 2009-01-20 Andreas Schwab <schwab@suse.de>
11384
11385 * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11386 read the value in the contents, since we don't use it. Use the
11387 template endianness when writing.
11388 (Relocate::relocate): Use it for R_PPC_REL16_HA.
11389
11390 2009-01-19 Andreas Schwab <schwab@suse.de>
11391
11392 * configure.tgt (powerpc64-*): Fix targ_obj.
11393
11394 2009-01-15 Ian Lance Taylor <iant@google.com>
11395
11396 * object.cc (Sized_relobj::write_local_symbols): Don't write out
11397 local symbols when stripping all symbols.
11398
11399 2009-01-14 Cary Coutant <ccoutant@google.com>
11400
11401 * output.cc (Output_reloc): Add explicit instantiations.
11402
11403 2009-01-14 Cary Coutant <ccoutant@google.com>
11404
11405 * archive.cc (Archive::get_elf_object_for_member): Remove call
11406 to File_read::claim_for_plugin.
11407 * descriptors.cc (Descriptors::open): Remove reference to
11408 is_claimed.
11409 (Descriptors::claim_for_plugin): Remove.
11410 * descriptors.h (Descriptors::claim_for_plugin): Remove.
11411 (Descriptors::is_claimed): Remove.
11412 (claim_descriptor_for_plugin): Remove.
11413 * fileread.cc (File_read::claim_for_plugin): Remove.
11414 * fileread.h (File_read::claim_for_plugin): Remove.
11415 (File_read::descriptor): Reopen descriptor if necessary.
11416 * plugin.cc (Plugin::load): Add two new APIs to transfer vector.
11417 (Plugin_manager::all_symbols_read): Add task parameter. Change
11418 all callers.
11419 (Plugin_manager::get_input_file): New function.
11420 (Plugin_manager::release_input_file): New function.
11421 (Pluginobj::Pluginobj): Add filesize parameter and initialize
11422 corresponding data member.
11423 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11424 and pass to base constructor. Change all callers.
11425 (get_input_file, release_input_file): New functions.
11426 (make_sized_plugin_object): Add filesize parameter. Change all callers.
11427 * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11428 (Plugin_manager::all_symbols_read): Add task parameter.
11429 (Plugin_manager::get_input_file): New function.
11430 (Plugin_manager::release_input_file): New function.
11431 (Plugin_manager::task_): New data member.
11432 (Pluginobj::Pluginobj): Add filesize parameter.
11433 (Pluginobj::filename): New function.
11434 (Pluginobj::descriptor): New function.
11435 (Pluginobj::filesize): New function.
11436 (Pluginobj::filesize_): New data member.
11437 (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11438 * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11439 File_read::claim_for_plugin; use Object::unlock to unlock the file.
11440
11441 * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11442 with archive libraries.
11443 * testsuite/Makefile.in: Regenerate.
11444 * testsuite/plugin_test.c (struct sym_info): New type.
11445 (get_input_file, release_input_file): New static variables.
11446 (onload): Capture new transfer vector entries.
11447 (claim_file_hook): Stop reading at end of file according to filesize.
11448 Factor out parsing of readelf output into separate function.
11449 (all_symbols_read_hook): Exercise get_input_file and release_input_file
11450 APIs and get the source file name from the symbol table. Convert
11451 source file name to corresponding object file name. Print info
11452 message when adding new input files.
11453 (parse_readelf_line): New function.
11454 * testsuite/plugin_test_1.sh: Add checks for new info messages.
11455 * testsuite/plugin_test_2.sh: Likewise.
11456 * testsuite/plugin_test_3.sh: Likewise.
11457 * testsuite/plugin_test_4.sh: New test case.
11458
11459 2009-01-07 Ian Lance Taylor <iant@google.com>
11460
11461 * version.cc (version_string): Bump to 1.8.
11462
11463 2008-12-23 Cary Coutant <ccoutant@google.com>
11464
11465 * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11466 * plugin.cc (Plugin_manager::finish): Rename as
11467 layout_deferred_objects. Move cleanup to separate function.
11468 (Plugin_manager::cleanup): New function.
11469 (Plugin_finish::run): Call layout_deferred_objects and cleanup
11470 separately.
11471 * plugin.h (Plugin_manager::finish): Rename as
11472 layout_deferred_objects.
11473 (Plugin_manager::cleanup): New function.
11474 (Plugin_manager::cleanup_done): New field.
11475
11476 2008-12-23 Cary Coutant <ccoutant@google.com>
11477
11478 * plugin.cc (is_visible_from_outside): New function.
11479 (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11480 so we don't return "IR only" status for exported symbols or -r links.
11481
11482 * testsuite/Makefile.am (plugin_test_3): New test case.
11483 * testsuite/Makefile.in: Regenerate.
11484 * testsuite/plugin_test_3.sh: New file.
11485
11486 2008-12-22 Cary Coutant <ccoutant@google.com>
11487
11488 * object.cc (Sized_relobj::layout_section): New function.
11489 (Sized_relobj::do_layout): Defer layout of input sections until after
11490 plugin has provided replacement files.
11491 (Sized_relobj::do_layout_deferred_sections): New function.
11492 * object.h (Relobj::set_section_offset): Remove virtual keyword.
11493 (Relobj::layout_deferred_sections): New function.
11494 (Relobj::do_layout_deferred_sections): New function.
11495 (Sized_relobj::do_layout_deferred_sections): New function.
11496 (Sized_relobj::layout_section): New function.
11497 (Sized_relobj::Deferred_layout): New structure.
11498 (Sized_relobj::deferred_layout_): New field.
11499 * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11500 Change all callers. Layout deferred sections.
11501 (class Plugin_finish): Renamed, was Plugin_cleanup. Change all
11502 references.
11503 (Plugin_hook::run): Move code from do_plugin_hook inline.
11504 (Plugin_hook::do_plugin_hook): Remove.
11505 * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11506 (Plugin_manager::finish): Renamed, was cleanup.
11507 (Plugin_manager::should_defer_layout): New function.
11508 (Plugin_manager::add_deferred_layout_object): New function.
11509 (Plugin_manager::Deferred_layout_list): New type.
11510 (Plugin_manager::deferred_layout_objects_): New field.
11511 (Plugin_hook::do_plugin_hook): Remove.
11512
11513 2008-12-17 Ian Lance Taylor <iant@google.com>
11514
11515 * options.h (class General_options): Add --no case for
11516 --export-dynamic.
11517
11518 2008-12-16 Cary Coutant <ccoutant@google.com>
11519
11520 * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11521 vector.
11522 (Plugin_manager::claim_file): Create plugin object even if
11523 plugin did not call the add_symbols callback.
11524 (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11525 asking for more symbols than were added.
11526 * testsuite/Makefile.am (plugin_test_1): Add test case with
11527 no global symbols.
11528 (empty.syms): New target.
11529 * testsuite/Makefile.in: Regenerate.
11530 * testsuite/plugin_test.c (claim_file_hook): Add new debug
11531 message. Don't call add_symbols if no globals.
11532 (all_symbols_read_hook): Don't provide replacement for empty
11533 claimed file.
11534
11535 2008-12-12 Ian Lance Taylor <iant@google.com>
11536
11537 * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11538 r_type == 0 for a local symbol with r_sym == 0.
11539 (scan_relocatable_relocs): Pass r_sym to
11540 local_non_section_strategy.
11541 * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11542 r_sym parameter.
11543
11544 * configure.ac: Update test for TLS descriptors: they are
11545 supported as of glibc 2.9.
11546 * configure: Rebuild.
11547
11548 2008-12-11 Ian Lance Taylor <iant@google.com>
11549
11550 PR 7091
11551 * target-reloc.h (Default_scan_relocatable_relocs): For each
11552 function, map r_type == 0 to RELOC_DISCARD.
11553
11554 2008-12-10 Cary Coutant <ccoutant@google.com>
11555
11556 * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11557 object to override a kept COMDAT group from a plugin object.
11558
11559 2008-12-09 Ian Lance Taylor <iant@google.com>
11560
11561 PR 7088
11562 * yyscript.y (file_cmd): Handle INPUT.
11563
11564 * testsuite/initpri1.c: Change all declarations to be full
11565 prototypes by adding void, to avoid compiler warnings.
11566
11567 2008-12-05 Rafael Avila de Espindola <espindola@google.com>
11568
11569 * options.cc (General_options::parse_plugin_opt): New.
11570 (General_options::add_plugin): The argument now is just the filename.
11571 (General_options::add_plugin_option): New.
11572 * options.h (plugin_opt): New.
11573 (add_plugin): Change argument name.
11574 (add_plugin_option): New.
11575 * plugin.cc (Plugin::load): Don't parse the plugin option.
11576 * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11577 (Plugin::add_option): New.
11578 (Plugin::args_): Change type.
11579 (Plugin::filename_): New.
11580 (Plugin_manager::add_plugin_option): New.
11581 * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11582 * testsuite/Makefile.in: Regenerate.
11583
11584 2008-12-05 Cary Coutant <ccoutant@google.com>
11585
11586 * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11587 Handle --strip-lto-sections option.
11588 * options.h (strip_lto_sections): New option.
11589
11590 2008-12-01 Cary Coutant <ccoutant@google.com>
11591
11592 * plugin.cc (ld_plugin_message): Change format parameter to const.
11593 Fix mismatch between new[] and delete.
11594
11595 2008-11-14 Cary Coutant <ccoutant@google.com>
11596
11597 * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11598 instead of -1U.
11599
11600 2008-11-05 Craig Silverstein <csilvers@google.com>
11601
11602 * options.cc (General_options::parse_dynamic_list): New function.
11603 * options.h (General_options): New flags dynamic_list,
11604 dynamic_list_data, dynamic_list_cpp_new, and
11605 dynamic_list_cpp_typeinfo. New variable dynamic_list_.
11606 (General_options::in_dynamic_list): New function.
11607 * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11608 (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11609 (Lex::can_continue_name): Likewise.
11610 (yylex): Likewise.
11611 (read_script_file): New parameter script_options.
11612 (read_dynamic_list): New function.
11613 (Script_options::define_dynamic_list): New function.
11614 (dynamic_list_keyword_parsecodes): New variable.
11615 (dynamic_list_keywords): New variable.
11616 * script.h (Script_options::define_dynamic_list): New function
11617 prototype.
11618 (read_dynamic_list): New function prototype.
11619 * symtab.cc (strprefix): New macro.
11620 (Symbol::should_add_dynsym_entry): Support dynamic_list,
11621 dynamic_list_data, dynamic_list_cpp_new, and
11622 dynamic_list_cpp_typeinfo.
11623 * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11624 (dynamic_list_expr): New rule.
11625 (dynamic_list_nodes): Likewise.
11626 (dynamic_list_node): Likewise.
11627 * testsuite/Makefile.am (dynamic_list): New test.
11628 * testsuite/Makefile.in: Regenerated.
11629 * testsuite/dynamic_list.t: New file.
11630 * testsuite/dynamic_list.sh: New file.
11631
11632 2008-11-05 Craig Silverstein <csilvers@google.com>
11633
11634 * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11635 * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11636 (t11_last): Likewise.
11637 * testsuite/ver_test_6.c (main): Likewise.
11638
11639 2008-10-07 Cary Coutant <ccoutant@google.com>
11640
11641 * options.c (General_options::finalize): Add check for -static and
11642 -shared.
11643 * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11644 is not empty.
11645
11646 2008-10-02 Cary Coutant <ccoutant@google.com>
11647
11648 * plugin.cc (make_sized_plugin_object): Fix conditional
11649 compilation to work when not all targets are enabled.
11650
11651 2008-09-29 Cary Coutant <ccoutant@google.com>
11652
11653 * archive.cc (Archive::get_file_and_offset): Use filename instead
11654 of name to get library path.
11655 (Archive::include_member): Unlock external member of a thin archive.
11656
11657 * testsuite/Makefile.am (TEST_AR): New variable.
11658 (thin_archive_test_1): New test.
11659 (thin_archive_test_2): New test.
11660 * testsuite/Makefile.in: Regenerate.
11661 * testsuite/thin_archive_main.cc: New file.
11662 * testsuite/thin_archive_test_1.cc: New file.
11663 * testsuite/thin_archive_test_2.cc: New file.
11664 * testsuite/thin_archive_test_3.cc: New file.
11665 * testsuite/thin_archive_test_4.cc: New file.
11666
11667 2008-09-29 Cary Coutant <ccoutant@google.com>
11668
11669 * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11670 * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11671 instead of -1U.
11672 (Sized_relobj::do_finalize_local_symbols): Likewise.
11673 (Sized_relobj::map_to_kept_section): Likewise.
11674 * object.h (Sized_relobj::invalid_address): New constant.
11675 (Sized_relobj::do_output_section_offset): Check for invalid_address
11676 and return -1ULL.
11677 * output.cc (Output_reloc::local_section_offset): Use constant
11678 invalid_address instead of -1U.
11679 (Output_reloc::get_address): Likewise.
11680 (Output_section::output_address): Change -1U to -1ULL.
11681 * output.h (Output_reloc::invalid_address): New constant.
11682 * reloc.cc (Sized_relobj::write_sections): Use constant
11683 invalid_address instead of -1U.
11684 (Sized_relobj::relocate_sections): Likewise.
11685 * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11686 values for merge sections.
11687 * target-reloc.h (relocate_for_relocatable): Use constant
11688 invalid_address instead of -1U.
11689
11690 2008-09-19 Cary Coutant <ccoutant@google.com>
11691
11692 Add plugin functionality for link-time optimization (LTO).
11693 * configure.ac (plugins): Add --enable-plugins option.
11694 * configure: Regenerate.
11695 * config.in: Regenerate.
11696 * Makefile.am (LIBDL): New variable.
11697 (CCFILES): Add plugin.cc.
11698 (HFILES): Add plugin.h.
11699 (ldadd_var): Add LIBDL.
11700 * Makefile.in: Regenerate.
11701
11702 * archive.cc: Include "plugin.h".
11703 (Archive::setup): Don't preread archive symbols when using a plugin.
11704 (Archive::get_file_and_offset): Add memsize parameter. Change callers.
11705 (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11706 files.
11707 (Archive::include_member): Add symbols from plugin objects.
11708 * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11709 * descriptors.cc (Descriptors::open): Check for file descriptors
11710 abandoned by plugins.
11711 (Descriptors::claim_for_plugin): New function.
11712 * descriptors.h (Descriptors::claim_for_plugin): New function.
11713 (Open_descriptor::is_claimed): New field.
11714 (claim_descriptor_for_plugin): New function.
11715 * fileread.cc (File_read::claim_for_plugin): New function.
11716 * fileread.h (File_read::claim_for_plugin): New function.
11717 (File_read::descriptor): New function.
11718 * gold.cc: Include "plugin.h".
11719 (queue_initial_tasks): Add task to call plugin hooks for generating
11720 new object files.
11721 * main.cc: Include "plugin.h".
11722 (main): Load plugin libraries.
11723 * object.h (Pluginobj): Declare.
11724 (Object::pluginobj): New function.
11725 (Object::do_pluginobj): New function.
11726 (Object::set_target): New function.
11727 * options.cc: Include "plugin.h".
11728 (General_options::parse_plugin): New function.
11729 (General_options::General_options): Initialize plugins_ field.
11730 (General_options::add_plugin): New function.
11731 * options.h (Plugin_manager): Declare.
11732 (General_options): Add --plugin option.
11733 (General_options::has_plugins): New function.
11734 (General_options::plugins): New function.
11735 (General_options::add_plugin): New function.
11736 (General_options::plugins_): New field.
11737 * plugin.cc: New file.
11738 * plugin.h: New file.
11739 * readsyms.cc: Include "plugin.h".
11740 (Read_symbols::do_read_symbols): Check for archive before checking
11741 for ELF file. Call plugin hooks to claim files.
11742 * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11743 from a real object file; force override when processing replacement
11744 files.
11745 * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11746 (Symbol::init_base_object): Likewise.
11747 (Symbol::init_base_output_data): Likewise.
11748 (Symbol::init_base_output_segment): Likewise.
11749 (Symbol::init_base_constant): Likewise.
11750 (Symbol::init_base_undefined): Likewise.
11751 (Symbol::output_section): Assert that object is not a plugin.
11752 (Symbol_table::add_from_pluginobj): New function.
11753 (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11754 undefined.
11755 (Symbol_table::sized_write_globals): Likewise.
11756 (Symbol_table::add_from_pluginobj): Instantiate template.
11757 * symtab.h (Sized_pluginobj): Declare.
11758 (Symbol::in_real_elf): New function.
11759 (Symbol::set_in_real_elf): New function.
11760 (Symbol::in_real_elf_): New field.
11761 (Symbol_table::add_from_pluginobj): New function.
11762
11763 * testsuite/Makefile.am (AM_CFLAGS): New variable.
11764 (LIBDL): New variable.
11765 (LDADD): Add LIBDL.
11766 (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11767 (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11768 (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11769 (MOSTLYCLEANFILES): Likewise.
11770 * testsuite/Makefile.in: Regenerate.
11771 * testsuite/plugin_test.c: New file.
11772 * testsuite/plugin_test_1.sh: New file.
11773 * testsuite/plugin_test_2.sh: New file.
11774
11775 2008-09-16 Ian Lance Taylor <iant@google.com>
11776
11777 * target-reloc.h (relocate_section): Check whether a symbol is
11778 defined by the ABI before reporting an undefined symbol error.
11779 * target.h (Target::is_defined_by_abi): Make parameter const.
11780 (Target::do_is_defined_by_abi): Likewise.
11781 * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11782 * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11783 * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11784 * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11785 * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11786 * testsuite/Makefile.in: Rebuild.
11787
11788 * fileread.cc (make_view): Add casts to avoid warning.
11789
11790 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11791
11792 * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11793 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11794
11795 2008-09-16 Alexandre Oliva <aoliva@redhat.com>
11796
11797 * options.h (General_options::output_is_executable): New.
11798 (General_options::output_is_pie): New.
11799 * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11800 for shared libraries.
11801 * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11802
11803 2008-09-11 Chris Demetriou <cgd@google.com>
11804
11805 * options.h (origin): New -z option.
11806 * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11807 is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11808 in DT_FLAGS_1.
11809
11810 2008-09-05 Cary Coutant <ccoutant@google.com>
11811
11812 * fileread.cc (File_read::make_view): Add check for attempt to map
11813 beyond end of file.
11814
11815 2008-09-05 Cary Coutant <ccoutant@google.com>
11816
11817 * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11818 explicit instantiations.
11819
11820 2008-08-28 Kris Van Hees <kris.van.hees@oracle.com>
11821
11822 PR gold/6858
11823 * options.cc (General_options::finalize): Allow undefined symbols
11824 in shlibs if linking -shared.
11825
11826 PR gold/6859
11827 * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11828 symbols as not needing a dynsym entry.
11829
11830 2008-08-20 Craig Silverstein <csilvers@google.com>
11831
11832 * fileread.cc (File_read::open): Do not lock the file unless it
11833 was successfully opened.
11834
11835 2008-08-14 Cary Coutant <ccoutant@google.com>
11836
11837 * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11838 Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11839 * testsuite/tls_test.cc (struct int128): 128-bit struct
11840 for testing TLS relocs with non-zero addend.
11841 (v12): New TLS variable.
11842 (t12): New test.
11843 (t_last): Add check for v12.
11844 * testsuite/tls_test.h (t12): New function.
11845 * testsuite/tls_test_main.cc (thread_routine): Call new test.
11846
11847 2008-08-13 Ian Lance Taylor <iant@google.com>
11848
11849 * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11850 set tls_segment_ or relro_segment_.
11851 (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11852 when appropriate.
11853 * output.h (Output_section::clear_is_relro): New function.
11854 * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11855 sections specially even when output_data_ is empty.
11856 (Output_segment::maximum_alignment): When first section is relro,
11857 only force alignment for PT_LOAD segments.
11858 * script.cc (script_data_segment_align): New function.
11859 (script_data_segment_relro_end): New function.
11860 * script-c.h (script_data_segment_align): Declare.
11861 (script_data_segment_relro_end): Declare.
11862 * script-sections.h (class Script_sections): Declare
11863 data_segment_align and data_segment_relro_end. Add fields
11864 segment_align_index_ and saw_relro_end_.
11865 * script-sections.cc (class Sections_element): Add set_is_relro
11866 virtual function. Add new bool* parameter to place_orphan_here.
11867 Add get_output_section virtual function.
11868 (class Output_section_definition): Add set_is_relro. Add new
11869 bool* parameter to place_orphan_here. Add get_output_section.
11870 Add is_relro_ field.
11871 (Output_section_definition::Output_section_definition): Initialize
11872 evaluated_address_, evaluated_load_address, evaluated_addralign_,
11873 and is_relro_ fields.
11874 (Output_section_definition::place_orphan_here): Add is_relro
11875 parameter.
11876 (Output_section_definition::set_section_addresses): Set relro for
11877 output section.
11878 (Output_section_definition::alternate_constraint): Likewise.
11879 (class Orphan_output_section): Add new bool* parameter to
11880 place_orphan_here. Add get_output_section.
11881 (Orphan_output_section::place_orphan_here): Add is_relro
11882 parameter.
11883 (Script_sections::Script_sections): Initialize
11884 data_segment_align_index_ and saw_relro_end_.
11885 (Script_sections::data_segment_align): New function.
11886 (Script_sections::data_segment_relro_end): New function.
11887 (Script_sections::place_orphan): Set or clear is_relro.
11888 (Script_sections::set_section_addresses): Force alignment of first
11889 TLS section.
11890 * yyscript.y (exp): Call script_data_segment_align and
11891 script_data_segment_relro_end.
11892 * testsuite/relro_script_test.t: New file.
11893 * testsuite/relro_test.cc (using_script): Declare.
11894 (t1, t2): Test using_script.
11895 * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11896 (relro_script_test_SOURCES): Define.
11897 (relro_script_test_DEPENDENCIES): Define.
11898 (relro_script_test_LDFLAGS): Define.
11899 (relro_script_test_LDADD): Define.
11900 (relro_script_test.so): New target.
11901 * testsuite/Makefile.in: Rebuild.
11902
11903 2008-08-06 Cary Coutant <ccoutant@google.com>
11904
11905 * archive.cc (Archive::total_archives, Archive::total_members)
11906 (Archive::total_members_loaded): New variables.
11907 (Archive::setup): Add parameter. Add option to preread
11908 archive symbols.
11909 (Archive::read_armap): Add counter.
11910 (Archive::get_file_and_offset): New function.
11911 (Archive::get_elf_object_for_member): New function.
11912 (Archive::read_all_symbols): New function.
11913 (Archive::read_symbols): New function.
11914 (Archive::add_symbols): Add counters.
11915 (Archive::include_all_members): Use armap to find members if it's
11916 already built.
11917 (Archive::include_member): Skip reading symbols if already read.
11918 Factored code into Archive::get_file_and_offset and
11919 Archive::get_elf_object_for_member. Changed call to
11920 Mapfile::report_include_archive_member.
11921 (Archive::print_stats): New function.
11922 * archive.h: Declare Object and Read_symbols_data classes.
11923 (Archive::Archive): Add initializers for new members.
11924 (Archive::setup): Add parameter.
11925 (Archive::print_stats): New function.
11926 (Archive::total_archives, Archive::total_members)
11927 (Archive::total_members_loaded): New variables.
11928 (Archive::get_file_and_offset): New function.
11929 (Archive::get_elf_object_for_member): New function.
11930 (Archive::read_all_symbols): New function.
11931 (Archive::read_symbols): New function.
11932 (Archive::Archive_member): New class.
11933 (Archive::members_): New member.
11934 (Archive::num_members_): New member.
11935 * main.cc: Include archive.h.
11936 (main): Call Archive::print_stats.
11937 * mapfile.cc (Mapfile::report_include_archive_member): Delete
11938 archive parameter; member_name is now the fully-decorated name.
11939 * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11940 * options.h: (General_options): Add --preread-archive-symbols option.
11941 * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11942 Archive::setup.
11943
11944 2008-08-04 Ian Lance Taylor <iant@google.com>
11945
11946 * symtab.h (Symbol::use_plt_offset): New function.
11947 * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11948 * powerpc.cc (Relocate::relocate): Likewise.
11949 * sparc.cc (Relocate::relocate): Likewise.
11950 * x86_64.cc (Relocate::relocate): Likewise.
11951 * testsuite/weak_plt.sh: New test.
11952 * testsuite/weak_plt_main.cc: New test.
11953 * testsuite/weak_plt_shared.cc: New test.
11954 * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11955 (check_PROGRAMS): Add weak_plt.
11956 (check_DATA): Add weak_plt_shared.so.
11957 (weak_plt_main_pic.o, weak_plt): New targets.
11958 (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11959 * testsuite/Makefile.in: Rebuild.
11960
11961 * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11962 gcctestdir/ld.
11963 (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11964 * testsuite/Makefile.in: Rebuild.
11965
11966 2008-08-04 Alan Modra <amodra@bigpond.net.au>
11967
11968 * Makefile.am (POTFILES.in): Set LC_ALL=C.
11969 * Makefile.in: Regenerate.
11970 * po/POTFILES.in: Regenerate.
11971
11972 2008-07-29 Ian Lance Taylor <iant@google.com>
11973
11974 * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11975 symbols before other symbols.
11976 * testsuite/script_test_2.cc (test_addr): Declare.
11977 (test_addr_alias): Declare.
11978 (main): Check that test_addr and test_addr_alias have the right
11979 values.
11980 * testsuite/script_test_2.t: Define test_addr_alias and
11981 test_addr.
11982
11983 2008-07-24 Ian Lance Taylor <iant@google.com>
11984
11985 PR 5990
11986 * descriptors.cc: New file.
11987 * descriptors.h: New file.
11988 * gold-threads.h (class Hold_optional_lock): New class.
11989 * fileread.cc: Include "descriptors.h".
11990 (File_read::~File_read): Release descriptor rather than closing
11991 it.
11992 (File_read::open) [file]: Call open_descriptor rather than open.
11993 Set is_descriptor_opened_.
11994 (File_read::open) [memory]: Assert that descriptor is not open.
11995 (File_read::reopen_descriptor): New function.
11996 (File_read::release): Release descriptor.
11997 (File_read::do_read): Make non-const. Reopen descriptor.
11998 (File_read::read): Make non-const.
11999 (File_read::make_view): Reopen descriptor.
12000 (File_read::do_readv): Likewise.
12001 * fileread.h (class File_read): Add is_descriptor_opened_ field.
12002 Update declarations.
12003 * layout.cc: Include "descriptors.h".
12004 (Layout::create_build_id): Use open_descriptor rather than open.
12005 * output.cc: Include "descriptors.h".
12006 (Output_file::open): Use open_descriptor rather than open.
12007 * archive.cc (Archive::const_iterator): Change Archive to be
12008 non-const.
12009 (Archive::begin, Archive::end): Make non-const.
12010 (Archive::count_members): Likewise.
12011 * archive.h (class Archive): Update declarations.
12012 * object.h (Object::read): Make non-const.
12013 * Makefile.am (CCFILES): Add descriptors.cc.
12014 (HFILES): Add descriptors.h.
12015 * Makefile.in: Rebuild.
12016
12017 PR 6716
12018 * gold.h: Always include <clocale>. Add Solaris workarounds
12019 following code in binutils/sysdep.h.
12020
12021 PR 6048
12022 * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12023 this->eh_frame_hdr_ is NULL before using it.
12024
12025 * dynobj.cc (Versions::Versions): Update comment.
12026
12027 * dynobj.cc (Versions::Versions): If there is an soname, use it as
12028 the base version name.
12029
12030 * stringpool.cc (Stringpool_template::add_with_length): Set key to
12031 array size plus one.
12032 (Stringpool_template::set_string_offsets): Subtract one from key
12033 before using it as an array index.
12034 (Stringpool_template::get_offset_with_length): Likewise.
12035 (Stringpool_template::write_to_buffer): Likewise.
12036 * stringpool.h (Stringpool_template::get_offset_from_key):
12037 Likewise.
12038
12039 2008-07-23 Ian Lance Taylor <iant@google.com>
12040
12041 PR 6658
12042 * object.h (Merged_symbol_value::value): Do our best to handle a
12043 negative addend.
12044
12045 PR 6647
12046 * script.cc (Version_script_info::get_versions): Don't add empty
12047 version tag to return value.
12048 (Version_script_info::get_symbol_version_helper): Change return
12049 type to bool. Add pversion parameter. Change all callers.
12050 (script_register_vers_node): Don't require a non-NULL tag.
12051 * script.h (class Version_script_info): Update declarations.
12052 (Version_script_info::get_symbol_version): Change return type to
12053 bool. Add version parameter. Change all callers.
12054 * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12055 handling. Handle an empty version from a version script.
12056 (Symbol_table::define_special_symbol): Likewise.
12057 * testsuite/ver_test_10.script: New file.
12058 * testsuite/ver_test_10.sh: New file.
12059 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12060 (check_DATA): Add ver_test_10.syms.
12061 (ver_test_10.syms, ver_test_10.so): New target.
12062 * testsuite/Makefile.in: Rebuild.
12063
12064 2008-07-23 Simon Baldwin <simonb@google.com>
12065
12066 * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12067 to zero for undefined symbols from dynamic libraries.
12068
12069 2008-07-23 Ian Lance Taylor <iant@google.com>
12070
12071 * symtab.cc (Symbol_table::resolve): Remove version parameter.
12072 Change all callers.
12073 * symtab.h (class Symbol_table): Update declaration.
12074 * testsuite/ver_test_9.cc: New file.
12075 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12076 (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12077 (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12078 (ver_test_9.so, ver_test_9.o): New targets.
12079 * testsuite/Makefile.in: Rebuild.
12080
12081 2008-07-22 Ian Lance Taylor <iant@google.com>
12082
12083 * options.h (class General_options): Define --check-sections.
12084 * layout.cc (Layout::set_segment_offsets): Handle
12085 --check-sections.
12086
12087 * options.h (class General_options): Define -n/--nmagic and
12088 -N/--omagic.
12089 * options.cc (General_options::finalize): For -n/--nmagic or
12090 -N/--omagic, set -static.
12091 * layout.cc (Layout::attach_allocated_section_to_segment): If
12092 -N/--omagic, don't put read-only and read-write sections in
12093 different segments.
12094 (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12095 finding a read-only segment.
12096 (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12097 don't set the minimum segment alignment to the common page size,
12098 and don't set the file offset to the address modulo the page size.
12099 * script-sections.cc (Script_sections::create_segments): If
12100 -n/--omagic, don't put read-only and read-write sections in
12101 different segments.
12102
12103 * cref.cc: New file.
12104 * cref.h: New file.
12105 * options.h (class General_options): Add --print-symbol-counts.
12106 * main.cc (main): Issue defined symbol report if requested.
12107 * archive.cc (Archive::interpret_header): Make into a const member
12108 function.
12109 (Archive::add_symbols): Call Input_objects::archive_start and
12110 archive_stop.
12111 (Archive::const_iterator): Define new class.
12112 (Archive::begin, Archive::end): New functions.
12113 (Archive::include_all_members): Rewrite to use iterator.
12114 (Archive::count_members): New function.
12115 * archive.h (class Archive): Update declarations.
12116 (Archive::filename): New function.
12117 * object.cc: Include "cref.h".
12118 (Sized_relobj::Sized_relobj): Initialize defined_count_.
12119 (Sized_relobj::do_get_global_symbol_counts): New function.
12120 (Input_objects::add_object): Add object to cross-referencer.
12121 (Input_objects::archive_start): New function.
12122 (Input_objects::archive_stop): New function.
12123 (Input_objects::print_symbol_counts): New function.
12124 * object.h: Declare Cref and Archive.
12125 (Object::get_global_symbol_counts): New function.
12126 (Object::do_get_global_symbol_counts): New pure virtual function.
12127 (class Sized_relobj): Add defined_count_ field. Update
12128 declarations.
12129 (class Input_objects): Add cref_ field. Update constructor.
12130 Update declarations.
12131 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12132 defined_count_.
12133 (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12134 symbol counts.
12135 (Sized_dynobj::do_get_global_symbol_counts): New function.
12136 * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12137 defined_count_. Update declarations. Define Symbols typedef.
12138 * symtab.cc (Symbol_table::add_from_relobj): Add defined
12139 parameter. Change all callers.
12140 (Symbol_table::add_from_dynobj): Add sympointers and defined
12141 parameters. Change all callers.
12142 * symtab.h (class Symbol_table): Update declarations.
12143 * Makefile.am (CCFILES): Add cref.cc.
12144 (HFILES): Add cref.h.
12145 * Makefile.in: Rebuild.
12146
12147 2008-07-22 Simon Baldwin <simonb@google.com>
12148
12149 * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12150 to zero when writing undefined symbols.
12151
12152 2008-07-22 Ian Lance Taylor <iant@google.com>
12153
12154 * output.cc (Output_section::add_input_section): Don't try to
12155 merge empty merge sections.
12156
12157 2008-07-21 Craig Silverstein <csilvers@google.com>
12158
12159 * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12160 Include symbol version in error message.
12161
12162 2008-07-20 Chris Demetriou <cgd@google.com>
12163
12164 * configure.ac (gold_cv_c_random_seed): New configured variable.
12165 (RANDOM_SEED_CFLAGS): New substituted variable.
12166 * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12167 * configure: Rebuild.
12168 * Makefile.in: Likewise.
12169 * testsuite/Makefile.in: Likewise.
12170
12171 2008-07-18 Ian Lance Taylor <iant@google.com>
12172
12173 * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12174 where we see NAME/NULL and NAME/VERSION as separate symbols.
12175 * testsuite/ver_test_main.cc (main): Call t4.
12176 (t4, t4_2a): Define.
12177 * testsuite/ver_test_2.cc (t4_2): Define.
12178 * testsuite/ver_test_2.script: Put t4_2a in VER2.
12179 * testsuite/ver_test_4.cc (t4_2a): Define.
12180 * testsuite/ver_test_4.script: Put t4_2a in VER2.
12181 * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12182
12183 2008-07-17 Ian Lance Taylor <iant@google.com>
12184
12185 * dynobj.cc (Versions::add_def): If we give an error about a
12186 missing version, go ahead and create the version anyhow.
12187
12188 2008-07-10 Ian Lance Taylor <iant@google.com>
12189
12190 Handle output sections with more than 0x7fffffff bytes.
12191 * object.h (class Relobj): Change map_to_output_ to
12192 output_sections_, and just keep a section pointer. Change all
12193 uses. Move comdat group support to Sized_relobj.
12194 (Relobj::is_section_specially_mapped): Remove.
12195 (Relobj::output_section): Remove poff parameter. Change all
12196 callers.
12197 (Relobj::output_section_offset): New function.
12198 (Relobj::set_section_offset): Rewrite.
12199 (Relobj::map_to_output): Remove.
12200 (Relobj::output_sections): New function.
12201 (Relobj::do_output_section_offset): New pure virtual function.
12202 (Relobj::do_set_section_offset): Likewise.
12203 (class Sized_relobj): Add section_offsets_ field. Add comdat
12204 group support from Relobj. Update declarations.
12205 (Sized_relobj::get_output_section_offset): New function.
12206 (Sized_relobj::do_output_section_offset): New function.
12207 (Sized_relobj::do_set_section_offset): New function.
12208 * object.cc (Relobj::output_section_address): Remove.
12209 (Sized_relobj::Sized_relobj): Initialize new fields.
12210 (Sized_relobj::include_section_group): Cast find_kept_object to
12211 Sized_relobj.
12212 (Sized_relobj::include_linkonce_section): Likewise.
12213 (Sized_relobj::do_layout): Use separate arrays for output section
12214 and output offset.
12215 (Sized_relobj::do_count_local_symbols): Change map_to_output to
12216 output_sections.
12217 (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12218 output_sections and section_offsets.
12219 (Sized_relobj::write_local_symbols): Likewise.
12220 (map_to_kept_section): Compute output address directly.
12221 * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12222 output_sections and section_offsets.
12223 (Sized_relobj::write_sections): Likewise.
12224 (Sized_relobj::relocate_sections): Likewise.
12225 * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12226 * output.h (class Output_reloc): Update declarations. Change
12227 u2_.relobj to Sized_relobj*.
12228 (class Output_data_reloc): Change add functions to use
12229 Sized_relobj*.
12230 * output.cc (Output_reloc::Output_reloc): Change relobj to
12231 Sized_relobj*.
12232 (Output_reloc::local_section_offset): Change return type to
12233 Elf_Addr. Use get_output_section_offset.
12234 (Output_reloc::get_address): Likewise.
12235 (Output_section::is_input_address_mapped): Don't call
12236 is_section_specially_mapped.
12237 (Output_section::output_offset): Likewise.
12238 (Output_section::output_address): Likewise.
12239 (Output_section::starting_output_address): Likewise.
12240 * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12241 parameter to Sized_relobj*.
12242 (Copy_relocs::need_copy_reloc): Likewise.
12243 (Copy_relocs::save): Likewise.
12244 * copy-relocs.h (class Copy_relocs): Update declarations.
12245 (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12246 Sized_relobj*. Change relobj_ field to Sized_relobj*.
12247 * target-reloc.h (relocate_for_relocatable): Change
12248 offset_in_output_section type to Elf_Addr. Change code that uses
12249 it as well.
12250 * layout.cc (Layout::layout): Always set *off.
12251 * mapfile.cc (Mapfile::print_input_section): Use
12252 output_section_offset.
12253 * i386.cc (Target_i386::copy_reloc): Change object parameter to
12254 Sized_relobj*.
12255 * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12256 * sparc.cc (Target_sparc::copy_reloc): Likewise.
12257 * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12258
12259 2008-07-03 Ian Lance Taylor <iant@google.com>
12260
12261 * layout.cc (Layout::include_section): Do not discard unrecognized
12262 SHT_STRTAB sections.
12263
12264 2008-06-30 Craig Silverstein <csilvers@cs.stanford.edu>
12265
12266 * script.cc (Lex::can_continue_name): Make '?' allowable in
12267 version-script names.
12268 * testsuite/version_script.map: Change glob pattern to use '?'
12269
12270 2008-06-30 Manish Singh <yosh@gimp.org>
12271
12272 PR 6585
12273 * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12274 Correct typo.
12275
12276 2008-06-30 Ian Lance Taylor <iant@google.com>
12277
12278 PR 6660
12279 PR 6682
12280 * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12281 versions]: Don't try to read the value in the contents, since we
12282 don't use it. Use the template endianness when writing.
12283
12284 2008-06-25 Cary Coutant <ccoutant@google.com>
12285
12286 * fileread.cc (File_read::make_view): Assert on zero-length view.
12287 * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12288 symbol table when there are no symbols to read.
12289
12290 2008-06-23 Craig Silverstein <csilvers@google.com>
12291
12292 * version.cc (version_string): Bump to 1.7
12293
12294 2008-06-18 Craig Silverstein <csilvers@google.com>
12295
12296 * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12297 constant 0xFFFF to type Valtype.
12298 (Powerpc_relocate_functions::rel16_ha): Likewise.
12299
12300 2008-06-17 Ian Lance Taylor <iant@google.com>
12301
12302 * output.h (Output_section::Input_section): Initialize p2align_ to
12303 zero for Output_section_data constructors.
12304 (Output_section::Input_section::addralign): If not an input
12305 section, return the alignment of the Output_section_data.
12306 * testsuite/copy_test.cc: New file.
12307 * testsuite/copy_test_1.cc: New file.
12308 * testsuite/copy_test_2.cc: New file.
12309 * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12310 (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12311 (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12312 (copy_test_1_pic.o, copy_test_1.so): New targets.
12313 (copy_test_2_pic.o, copy_test_2.so): New targets.
12314 * testsuite/Makefile.in: Rebuild.
12315
12316 * script-sections.cc (Script_sections::place_orphan): Initialize
12317 local variable exact.
12318
12319 2008-06-13 David Edelsohn <edelsohn@gnu.org>
12320
12321 * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12322
12323 2008-06-12 David Edelsohn <edelsohn@gnu.org>
12324 David S. Miller <davem@davemloft.net>
12325
12326 * powerpc.cc: New file.
12327 * Makefile.am (TARGETSOURCES): Add powerpc.cc
12328 (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12329 * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12330 * Makefile.in: Rebuild.
12331
12332 2008-06-09 Ian Lance Taylor <iant@google.com>
12333
12334 * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12335 <exception>.
12336 (throwing, orig_terminate): New static variables.
12337 (terminate_handler): New static function.
12338 (t2): Set terminate handler.
12339
12340 2008-06-05 Kris Van Hees <kris.van.hees@oracle.com>
12341
12342 PR 6584
12343 * binary.cc (Binary_to_elf::sized_convert): Fix .data
12344 alignment.
12345
12346 2008-05-30 Cary Coutant <ccoutant@google.com>
12347
12348 * archive.cc (Archive::include_all_members) Correct to step
12349 over symbol table and extended name table in thin archives.
12350
12351 2008-05-29 Kris Van Hees <kris.van.hees@oracle.com>
12352
12353 PR 6407
12354 * target-reloc.h (relocate_for_relocatable): Fix new_offset
12355 calculation.
12356
12357 2008-05-28 Caleb Howe <cshowe@google.com>
12358
12359 * reduced_debug_output.cc: New file.
12360 * reduced_debug_output.h: New file.
12361 * options.h (class General_options): Add --strip-debug-non-line.
12362 * options.cc (General_options::finalize): Add strip_debug_non_line
12363 to the strip heirarchy.
12364 * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12365 fields.
12366 * layout.cc: Include "reduced_debug_output.h".
12367 (Layout::Layout): Initialize new fields.
12368 (line_only_debug_sections): New static array.
12369 (is_lines_only_debug_sections): New static inline function.
12370 (Layout::include_section): Handle --strip-debug-non-line.
12371 (Layout::make_output_section): If --strip-debug-non-line, build
12372 new output sections for .debug_abbrev and .debug_info.
12373 * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12374 gold. Warn about possible overflow.
12375 (read_signed_LEB_128): Likewise.
12376 * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12377 (read_signed_LEB_128): Declare.
12378 * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12379 (HFILES): Add reduced_debug_output.h.
12380 * Makefile.in: Rebuild.
12381
12382 2008-05-21 Ian Lance Taylor <iant@google.com>
12383
12384 * mapfile.cc: New file.
12385 * mapfile.h: New file.
12386 * options.h (class General_options): Add -M/--print-map and -Map.
12387 * options.cc (General_options::finalize): Make -M equivalent to
12388 -Map -.
12389 * main.cc: Include <cstdio> and "mapfile.h".
12390 (main): Open mapfile if requested.
12391 * gold.cc (class Middle_runner): Add mapfile_ field. Update
12392 constructor. Change caller.
12393 (queue_initial_tasks): Add mapfile parameter. Change caller.
12394 (queue_middle_tasks): Likewise.
12395 * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12396 declarations.
12397 * archive.cc: Include "mapfile.h".
12398 (Archive::add_symbols): Add mapfile parameter. Change all
12399 callers. Pass mapfile, symbol, and reason to include_member.
12400 (Archive::include_all_members): Add mapfile parameter. Change all
12401 callers.
12402 (Archive::include_member): Add mapfile, sym, and why parameters.
12403 Change all callers. Report inclusion to map file.
12404 * archive.h: Include "fileread.h".
12405 (class Archive): Update declarations.
12406 (Archive::file): New const method.
12407 (class Add_archive_symbols): Add mapfile_ field. Update
12408 constructor. Change all callers.
12409 * readsyms.h (class Read_symbols): Likewise.
12410 (class Finish_group): Likewise.
12411 (class Read_script): Likewise.
12412 * common.cc: Include "mapfile.h".
12413 (Symbol_table::allocate_commons): Add mapfile parameter. Change
12414 all callers.
12415 (Symbol_table::do_allocate_commons): Likewise.
12416 (Symbol_table::do_allocate_commons_list): Likewise. Report common
12417 symbol allocation to mapfile.
12418 * common.h (class Allocate_commons_task): Add mapfile_ field.
12419 Update constructor. Change all callers.
12420 * symtab.h (class Symbol_table): Update declarations.
12421 * layout.cc: Include "mapfile.h".
12422 (Layout_task_runner::run): Print information to mapfile.
12423 (Layout::create_gold_note): Change Output_data_fixed_space to
12424 Output_data_zero_fill.
12425 (Layout::create_build_id): Likewise.
12426 (Layout::print_to_mapfile): New function.
12427 * layout.h (class Layout_task_runner): Add mapfile_ field. Update
12428 constructor. Change caller.
12429 (class Layout): Declare print_to_mapfile.
12430 * output.cc (Output_section::Input_section::print_to_mapfile): New
12431 function.
12432 (Output_section::add_input_section): If producing a map, always
12433 add to input_sections_ list.
12434 (Output_section::do_print_to_mapfile): New function.
12435 (Output_segment::print_sections_to_mapfile): New function.
12436 (Output_segment::print_section_list_to_mapfile): New function.
12437 * output.h: Include "mapfile.h".
12438 (Output_data::print_to_mapfile): New function.
12439 (Output_data::do_print_to_mapfile): New virtual function.
12440 (Output_segment_headers::do_print_to_mapfile): New function.
12441 (Output_file_header::do_print_to_mapfile): New function.
12442 (Output_data_const::do_print_to_mapfile): New function.
12443 (class Output_data_const_buffer): Add map_name_ field. Update
12444 constructor. Change all callers. Add do_print_to_mapfile
12445 function.
12446 (class Output_data_fixed_space): Likewise.
12447 (class Output_data_space): Likewise.
12448 (class Output_data_zero_fill): New class.
12449 (Output_data_strtab::do_print_to_mapfile): New function.
12450 (Output_data_reloc_base::do_print_to_mapfile): New function.
12451 (Output_relocatable_relocs::do_print_to_mapfile): New function.
12452 (Output_data_group::do_print_to_mapfile): New function.
12453 (Output_data_got::do_print_to_mapfile): New function.
12454 (Output_data_dynamic::do_print_to_mapfile): New function.
12455 (Output_symtab_xindex::do_print_to_mapfile): New function.
12456 (class Output_section): Declare do_print_to_mapflie. Declare
12457 print_to_mapfile in Input_section.
12458 (class Output_segment): Declare new functions.
12459 * object.h (Sized_relobj::symbol_count): New function.
12460 * script-sections.cc
12461 (Output_section_element_dot_assignment::set_section_addresses):
12462 Change Output_data_fixed_space to Output_data_zero_fill.
12463 (Output_data_expression::do_print_to_mapfile): New function.
12464 * script.cc (read_input_script): Add mapfile parameter. Change
12465 all callers.
12466 * script.h (read_input_script): Update declaration.
12467 * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12468 (Eh_frame::do_print_to_mapfile): New function.
12469 * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12470 (Output_merge_string::do_print_to_mapfile): New function.
12471 * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12472 function.
12473 * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12474 function.
12475 * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12476 function.
12477 * Makefile.am (CCFILES): Add mapfile.cc.
12478 (HFILES): Add mapfile.h.
12479 * Makefile.in: Rebuild.
12480
12481 2008-05-19 Ian Lance Taylor <iant@google.com>
12482
12483 * options.h (class General_options): Add -z relro.
12484 * layout.cc (Layout::Layout): Initialize relro_segment_.
12485 (Layout::add_output_section_data): Return the output section.
12486 (Layout::make_output_section): Rcognize relro sections and mark
12487 them appropriately.
12488 (Layout::attach_allocated_section_to_segment): Put relro sections
12489 in a PT_GNU_RELRO segment.
12490 (Layout::create_initial_dynamic_sections): Mark the .dynamic
12491 section as relro.
12492 (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12493 PT_TLS segments.
12494 (Layout::linkonce_mapping): Map d.rel.ro.local to
12495 .data.rel.ro.local.
12496 (Layout::output_section_name): Us .data.rel.ro.local for any
12497 section which begins with that.
12498 * layout.h (class Layout): Update add_output_section_data
12499 declaration. Add relro_segment_ field.
12500 * output.cc (Output_section::Output_section): Initialize is_relro_
12501 and is_relro_local_ fields.
12502 (Output_segment::add_output_section): Group relro sections.
12503 (Output_segment::is_first_section_relro): New function.
12504 (Output_segment::maximum_alignment): If there is a relro section,
12505 align the segment to the common page size.
12506 (Output_segment::set_section_addresses): Track whether we are
12507 looking at relro sections. If the last section is a relro
12508 section, align to the common page size.
12509 (Output_segment::set_section_list_addresses): Add in_relro
12510 parameter. Change all callers. Align to the page size when
12511 moving from relro to non-relro section.
12512 (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12513 segment.
12514 * output.h (class Output_section): Add is_relro_ and
12515 is_relro_local_ fields.
12516 (Output_section::is_relro): New function.
12517 (Output_section::set_is_relro): New function.
12518 (Output_section::is_relro_local): New function.
12519 (Output_section::set_is_relro_local): New function.
12520 (class Output_segment): Update declarations.
12521 * i386.cc (Target_i386::got_section): Mark .got section as relro.
12522 * sparc.cc (Target_sparc::got_section): Likewise.
12523 * x86_64.cc (Target_x86_64::got_section): Likewise.
12524 * testsuite/relro_test_main.cc: New file.
12525 * testsuite/relro_test.cc: New file.
12526 * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12527 (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12528 (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12529 (relro_test.so, relro_test_pic.o): New targets.
12530 * testsuite/Makefile.in: Rebuild.
12531
12532 2008-05-16 Ian Lance Taylor <iant@google.com>
12533
12534 * output.cc (Output_segment::add_output_section): Remove front
12535 parameter.
12536 * output.h (class Output_segment): Remove
12537 add_initial_output_section and overloaded add_output_section.
12538 Update declaration of remaining add_output_section.
12539 * layout.cc (Layout::create_interp): Call add_output_section
12540 rather than add_initial_output_section.
12541 (Layout::finish_dynamic_section): Likewise.
12542
12543 * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12544 for TLS_GOTDESC and TLS_DESC_CALL. Only optimize TLS_LDO_32 if we
12545 know the dynamic type.
12546 * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12547 field. Initialize it in constructor.
12548 (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12549 block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12550 Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12551 reloc.
12552
12553 * output.cc (Output_reloc::get_address): Change return type to
12554 Elf_Addr.
12555 * output.h (class Output_reloc): Update get_address declaration.
12556 * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12557 for section addresses.
12558
12559 2008-05-09 Ian Lance Taylor <iant@google.com>
12560
12561 PR 6493
12562 * gold.cc (gold_nomem): Use return value of write.
12563
12564 2008-05-08 Ian Lance Taylor <iant@google.com>
12565
12566 * symtab.c (Symbol::init_base_output_data): Add version
12567 parameter. Change all callers.
12568 (Symbol::init_base_output_segment): Likewise.
12569 (Symbol::init_base_constant): Likewise.
12570 (Symbol::init_base_undefined): Likewise.
12571 (Sized_symbol::init_output_data): Likewise.
12572 (Sized_symbol::init_output_segment): Likewise.
12573 (Sized_symbol::init_constant): Likewise.
12574 (Sized_symbol::init_undefined): Likewise.
12575 (Symbol_table::do_define_in_output_data): If the new symbol has a
12576 version, mark it as the default.
12577 (Symbol_table::do_define_in_output_segment): Likewise.
12578 (Symbol_table::do_define_as_constant): Likewise.
12579 * symtab.h (class Symbol): Update declarations.
12580 (class Sized_symbol): Likewise.
12581 * resolve.cc (Symbol::override_version): New function.
12582 (Symbol::override_base): Call override_version.
12583 (Symbol::override_base_with_special): Likewise.
12584 * testsuite/ver_script_8.script: New file.
12585 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12586 (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12587 (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12588 (ver_test_8_1.so, ver_test_8_2.so): New targets.
12589
12590 2008-05-06 Ian Lance Taylor <iant@google.com>
12591
12592 PR 6049
12593 * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12594 functions.
12595 (class General_options): Remove existing --undefined, and add
12596 --no-undefined instead. Add new --undefined as synonym for -u.
12597 * archive.cc (Archive::add_symbols): Check whether symbol was
12598 named with -u.
12599 * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12600 * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12601 all uses. Add IS_UNDEFINED. Update declarations to split
12602 different versions of init_base. Declare init_base_undefined.
12603 (Symbol::is_defined): Handle IS_UNDEFINED.
12604 (Symbol::is_undefined): Likewise.
12605 (Symbol::is_weak_undefined): Call is_undefined.
12606 (Symbol::is_absolute): Handle IS_CONSTANT.
12607 (class Sized_symbol): Update declarations to split different
12608 versions of init. Declare init_undefined.
12609 (class Symbol_table): Declare new functions.
12610 * symtab.cc (Symbol::init_base_object): Rename from init_base.
12611 Change all callers.
12612 (Symbol::init_base_output_data): Likewise.
12613 (Symbol::init_base_output_segment): Likewise.
12614 (Symbol::init_base_constant): Likewise.
12615 (Symbol::init_base_undefined): New function.
12616 (Sized_symbol::init_object): Rename from init. Change all
12617 callers.
12618 (Sized_symbol::init_output_data): Likewise.
12619 (Sized_symbol::init_output_segment): Likewise.
12620 (Sized_symbol::init_constant): Likewise.
12621 (Sized_symbol::init_undefined): New function.
12622 (Symbol_table::add_undefined_symbols_from_command_line): New
12623 function.
12624 (Symbol_table::do_add_undefined_symbols_from_command_line): New
12625 function.
12626 (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12627 (Symbol::output_section): Likewise.
12628 (Symbol::set_output_section): Likewise.
12629 (Symbol_table::sized_finalize_symbol): Likewise.
12630 (Symbol_table::sized_write_globals): Likewise.
12631 * resolve.cc (Symbol_table::should_override): Likewise.
12632 (Symbol::override_base_with_special): Likewise.
12633
12634 * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12635 symbol, change it to have default visibility.
12636 * testsuite/protected_1.cc: New file.
12637 * testsuite/protected_2.cc: New file.
12638 * testsuite/protected_3.cc: New file.
12639 * testsuite/protected_main_1.cc: New file.
12640 * testsuite/protected_main_2.cc: New file.
12641 * testsuite/protected_main_3.cc: New file.
12642 * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12643 (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12644 (protected_1_LDFLAGS, protected_1_LDADD): Define.
12645 (protected_1.so): New target.
12646 (protected_1_pic.o, protected_2_pic.o): New targets.
12647 (protected_3_pic.o): New target.
12648 (check_PROGRAMS): Add protected_2.
12649 (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12650 (protected_2_LDFLAGS, protected_2_LDADD): Define.
12651 * testsuite/Makefile.in: Rebuild.
12652
12653 * options.h (DEFINE_var): Add set_user_set_##varname__.
12654 (DEFINE_bool_alias): New macro.
12655 (class General_options): Define -Bstatic using DEFINE_bool_alias
12656 rather than DEFINE_special. Add --undefined as an alias for -z
12657 defs.
12658 * options.cc (General_options::parse_Bstatic): Remove.
12659
12660 * options.h (class General_options): Add --fatal-warnings.
12661 * main.cc (main): Implement --fatal-warnings.
12662 * errors.h (Errors::warning_count): New function.
12663
12664 * options.h (class General_options): Add -Bsymbolic-functions.
12665 * symtab.h (Symbol::is_preemptible): Check for
12666 -Bsymbolic-functions.
12667
12668 2008-05-05 Ian Lance Taylor <iant@google.com>
12669
12670 * options.h (DEFINE_bool): For DASH_Z, create the negative option
12671 as noVARNAME rather than no-VARNAME.
12672 (class General_options): Add option -z combreloc.
12673 * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12674 get_address.
12675 (Output_reloc::sort_before) [SHT_REL]: New function.
12676 (Output_reloc::sort_before) [SHT_RELA]: New function.
12677 (class Output_data_reloc_base): Add sort_relocs_ field. Define
12678 Sort_relocs_comparison.
12679 (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12680 parameter. Change all callers.
12681 (Output_data_reloc::Output_data_reloc) [both versions]: Add
12682 sort_relocs parameter. Change all callers.
12683 * output.cc (Output_reloc::get_address): New function, broken out
12684 of write_rel.
12685 (Output_reloc::write_rel): Call it.
12686 (Output_reloc::compare): New function.
12687 (Output_data_reloc_base::do_write): Optionally sort relocs.
12688
12689 * configure.ac: If targ_extra_obj is set, link it in.
12690 * configure.tgt: Initialize all variables.
12691 (x86_64*): Set targ_extra_obj and targ_extra_size.
12692 * configure: Rebuild.
12693
12694 * object.cc (Sized_relobj::include_section_group): Adjust section
12695 indexes read from group data. Build vector to pass to
12696 layout_group.
12697 * layout.cc (Layout::layout_group): Add flags and shndxes
12698 parameters. Remove contents parameter. Change caller. Update
12699 explicit instantiations.
12700 * layout.h (class Layout): Update layout_group declaration.
12701 * output.cc (Output_data_group::Output_data_group): Add flags and
12702 input_shndxes parameters. Remove contents parameter. Change
12703 caller.
12704 (Output_data_group::do_write): Change input_sections_ to
12705 input_shndxes_.
12706 * output.h (class Output_data_group): Update constructor
12707 declaration. Rename input_sections_ to input_shndxes_.
12708 * testsuite/many_sections_test.cc: Add template.
12709
12710 2008-04-30 Cary Coutant <ccoutant@google.com>
12711
12712 * target-reloc.h (relocate_section): Fix dead-pointer bug.
12713
12714 * layout.cc (Layout::include_section): Refactored check for debug
12715 info section.
12716 (Layout::add_comdat): Add new parameters. Change type
12717 of signature parameter. Add object and shndx to signatures table.
12718 (Layout::find_kept_object): New function.
12719 * layout.h: Include <cstring>.
12720 (Layout::is_debug_info_section): New function.
12721 (Layout::add_comdat): Add new parameters.
12722 (Layout::find_kept_object): New function.
12723 (Layout::Kept_section): New struct.
12724 (Layout::Signatures): Change type of map range.
12725 * object.cc (Relobj::output_section_address): New function.
12726 (Sized_relobj::include_section_group): Add new parameters. Change
12727 calls to Layout::add_comdat. Change to build table of kept comdat
12728 groups and table mapping discarded sections to kept sections.
12729 (Sized_relobj::include_linkonce_section): Likewise. Add new parameter.
12730 (Sized_relobj::do_layout): Change calls to include_section_group and
12731 include_linkonce_section.
12732 (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12733 value to zero when section is discarded.
12734 (Sized_relobj::map_to_kept_section): New function.
12735 * object.h (Relobj::output_section_address): New function.
12736 (Relobj::Comdat_group): New type.
12737 (Relobj::find_comdat_group): New function.
12738 (Relobj::Comdat_group_table): New type.
12739 (Relobj::Kept_comdat_section): New type.
12740 (Relobj::Kept_comdat_section_table): New type.
12741 (Relobj::add_comdat_group): New function.
12742 (Relobj::set_kept_comdat_section): New function.
12743 (Relobj::get_kept_comdat_section): New function.
12744 (Relobj::comdat_groups_): New field.
12745 (Relobj::kept_comdat_sections_): New field.
12746 (Symbol_value::input_value): Update comment.
12747 (Sized_relobj::map_to_kept_section) New function.
12748 (Sized_relobj::include_linkonce_section): Add new parameter.
12749 * target-reloc.h (Comdat_behavior): New type.
12750 (get_comdat_behavior): New function.
12751 (relocate_section): Add code to map a discarded section to the
12752 corresponding kept section when applying a relocation.
12753
12754 2008-04-30 Craig Silverstein <csilvers@google.com>
12755
12756 * dwarf_reader.cc (next_generation_count): New static var.
12757 (Addr2line_cache_entry): New struct.
12758 (addr2line_cache): New static var.
12759 (Dwarf_line_info::one_addr2line): Added caching.
12760 (Dwarf_line_info::clear_addr2line_cache): New function.
12761 * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12762 cache-size parameter.
12763 (Dwarf_line_info::one_addr2line_cache): New function.
12764 * symtab.cc (Symbol_table::detect_odr_violations): Pass
12765 new cache-size argument to one_addr2line(), and clear cache.
12766
12767 2008-04-28 Cary Coutant <ccoutant@google.com>
12768
12769 * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12770 R_386_PC8 relocations.
12771
12772 2008-04-23 Ian Lance Taylor <iant@google.com>
12773
12774 * object.cc (Sized_relobj::include_section_group): Check for
12775 invalid section group.
12776
12777 * object.cc (make_elf_object): Correct test for 64-bit ELF file
12778 header size.
12779
12780 * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12781 than read for file header.
12782 * archive.cc (Archive::include_member): Likewise.
12783
12784 2008-04-23 Paolo Bonzini <bonzini@gnu.org>
12785
12786 * aclocal.m4: Regenerate.
12787 * configure: Regenerate.
12788
12789 2008-04-19 Ian Lance Taylor <iant@google.com>
12790
12791 * version.cc (version_string): Bump to 1.6.
12792
12793 * testsuite/Makefile.am (many_sections_r_test): New target.
12794 (many_sections_r_test_SOURCES): Remove.
12795 (many_sections_r_test_DEPENDENCIES): Remove.
12796 (many_sections_r_test_LDFLAGS): Remove.
12797 (many_sections_r_test_LDADD): Remove.
12798
12799 * object.cc (Sized_relobj::do_add_symbols): Always pass
12800 local_symbol_count_ to add_from_relobj.
12801
12802 * testsuite/Makefile.am (many_sections_check.h): Only check one in
12803 every thousand variables.
12804 * testsuite/Makefile.in: Rebuild.
12805
12806 * object.cc (Xindex::initialize_symtab_xindex): New function.
12807 (Xindex::read_symtab_xindex): New function.
12808 (Xindex::sym_xindex_to_shndx): New function.
12809 (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12810 available.
12811 (Sized_relobj::do_initialize_xindex): New function.
12812 (Sized_relobj::do_read_symbols): Adjust section links.
12813 (Sized_relobj::symbol_section_and_value): Add is_ordinary
12814 parameter. Change all callers.
12815 (Sized_relobj::include_section_group): Adjust section links and
12816 symbol section indexes.
12817 (Sized_relobj::do_layout): Adjust section links.
12818 (Sized_relobj::do_count_local_symbols): Adjust section links and
12819 symbol section indexes.
12820 (Sized_relobj::do_finalize_local_symbols): Distinguish between
12821 ordinary and special symbols.
12822 (Sized_relobj::write_local_symbols): Add symtab_xindex and
12823 dynsym_xindex parameters. Change all callers. Adjust section
12824 links. Use SHN_XINDEX when needed.
12825 (Sized_relobj::get_symbol_location_info): Adjust section links.
12826 Don't get fooled by special symbols.
12827 * object.h (class Xindex): Define.
12828 (class Object): Add xindex_ parameter. Declare virtual functoin
12829 do_initialize_xindex.
12830 (Object::adjust_sym_shndx): New function.
12831 (Object::set_xindex): New protected function.
12832 (class Symbol_value): Add is_ordinary_shndx_ field.
12833 (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12834 (Symbol_value::value): Assert ordinary section.
12835 (Symbol_value::initialize_input_to_output_map): Likewise.
12836 (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12837 Change all callers.
12838 (Symbol_value::input_shndx): Add is_ordinary parameter. Change
12839 all callers.
12840 (class Sized_relobj): Update declarations.
12841 (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12842 parameter. Change all callers.
12843 (Sized_relobj::adjust_shndx): New function.
12844 * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12845 field.
12846 (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12847 parameter. Change all callers. Pick up SHT_DYNSYM_SHNDX section
12848 for SHT_DYNSYM section if available. Set dynsym_shndx_ field.
12849 (Sized_dynobj::read_dynsym_section): Adjust section links.
12850 (Sized_dynobj::read_dynamic): Likewise.
12851 (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field. Adjust
12852 section links.
12853 (Sized_dynobj::do_initialize_xindex): New function.
12854 * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field. Declare
12855 do_initialize_xindex.
12856 (Sized_dynobj::adjust_shndx): New function.
12857 * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12858 dynsym_xindex_ fields.
12859 (Layout::finalize): Add a call to set_section_indexes before
12860 creating the symtab sections.
12861 (Layout::set_section_indexes): Don't do anything if the section
12862 already has a section index.
12863 (Layout::create_symtab_sections): Add shnum parameter. Change
12864 caller. Create .symtab_shndx section if needed.
12865 (Layout::create_shdrs): Add shstrtab_section parameter. Change
12866 caller.
12867 (Layout::allocated_output_section_count): New function.
12868 (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12869 needed.
12870 * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12871 fields. Update declarations.
12872 (Layout::symtab_xindex): New function.
12873 (Layout::dynsym_xindex): New function.
12874 (class Write_symbols_task): Add layout_ field.
12875 (Write_symbols_task::Write_symbols_task): Add layout parameter.
12876 Change caller.
12877 * output.cc (Output_section_headers::Output_section_headers): Add
12878 shstrtab_section parameter. Change all callers.
12879 (Output_section_headers::do_sized_write): Store overflow values
12880 for section count and section string table section index in
12881 section header zero.
12882 (Output_file_header::do_sized_write): Check for overflow of
12883 section count and section string table section index.
12884 (Output_symtab_xindex::do_write): New function.
12885 (Output_symtab_xindex::endian_do_write): New function.
12886 * output.h (class Output_section_headers): Add shstrtab_section_.
12887 Update declarations.
12888 (class Output_symtab_xindex): Define.
12889 (Output_section::has_out_shndx): New function.
12890 * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12891 field.
12892 (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12893 Change all callers.
12894 (Sized_symbol::init): Likewise.
12895 (Symbol::output_section): Check for ordinary symbol.
12896 (Symbol_table::add_from_object): Remove orig_sym parameter. Add
12897 st_shndx, is_ordinary, and orig_st_shndx parameters. Change all
12898 callers.
12899 (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12900 Change all callers. Simplify handling of symbols from sections
12901 not included in the link.
12902 (Symbol_table::add_from_dynobj): Handle ordinary symbol
12903 distinction.
12904 (Weak_alias_sorter::operator()): Assert that symbols are
12905 ordinary.
12906 (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12907 distinction.
12908 (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12909 parameters. Change all callers.
12910 (Symbol_table::sized_write_globals): Likewise. Handle ordinary
12911 symbol distinction. Use SHN_XINDEX when needed.
12912 (Symbol_table::write_section_symbol): Add symtab_xindex
12913 parameter. Change all callers.
12914 (Symbol_table::sized_write_section_symbol): Likewise. Use
12915 SHN_XINDEX when needed.
12916 * symtab.h (class Symbol): Add is_ordinary_shndx_ field. Update
12917 declarations.
12918 (Symbol::shndx): Add is_ordinary parameter. Change all callers.
12919 (Symbol::is_defined): Check is_ordinary.
12920 (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12921 (Symbol::is_absolute, Symbol::is_common): Likewise.
12922 (class Sized_symbol): Update declarations.
12923 (class Symbol_table): Update declarations.
12924 * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12925 parameters. Change all callers.
12926 (Sized_symbol::override): Likewise.
12927 (Symbol_table::override): Likewise.
12928 (symbol_to_bits): Add is_ordinary parameter. Change all callers.
12929 (Symbol_table::resolve): Remove orig_sym parameter. Add st_shndx,
12930 is_ordinary, and orig_st_shndx parameters. Change all callers.
12931 * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12932 to be in an ordinary section.
12933 * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12934 object and is_ordinary parameters. Change all callers.
12935 (Sized_dwarf_line_info::read_relocs): Add object parameter.
12936 Change all callers. Don't add undefined or non-ordinary symbols
12937 to reloc_map_.
12938 (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12939 Change all callers.
12940 * dwarf_reader.h (class Sized_dwarf_line_info): Update
12941 declarations.
12942 * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12943 * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12944 (Sized_relobj::relocate_sections): Likewise.
12945 * target-reloc.h (scan_relocs): Adjust section symbol index.
12946 (scan_relocatable_relocs): Likewise.
12947 * i386.cc (Scan::local): Check for ordinary symbols.
12948 * sparc.cc (Scan::local): Likewise.
12949 * x86_64.cc (Scan::local): Likewise.
12950 * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12951 to symbol_section_and_value.
12952 * testsuite/many_sections_test.cc: New file.
12953 * testsuite/Makefile.am (BUILT_SOURCES): Define.
12954 (check_PROGRAMS): Add many_sections_test.
12955 (many_sections_test_SOURCES): Define.
12956 (many_sections_test_DEPENDENCIES): Define.
12957 (many_sections_test_LDFLAGS): Define.
12958 (BUILT_SOURCES): Add many_sections_define.h.
12959 (many_sections_define.h): New target.
12960 (BUILT_SOURCES): Add many_sections_check.h.
12961 (many_sections_check.h): New target.
12962 (check_PROGRAMS): Add many_sections_r_test.
12963 (many_sections_r_test_SOURCES): Define.
12964 (many_sections_r_test_DEPENDENCIES): Define.
12965 (many_sections_r_test_LDFLAGS): Define.
12966 (many_sections_r_test_LDADD): Define.
12967 (many_sections_r_test.o): New target.
12968 * testsuite/Makefile.in: Rebuild.
12969
12970 2008-04-17 Cary Coutant <ccoutant@google.com>
12971
12972 * errors.cc (Errors::info): New function.
12973 (gold_info): New function.
12974 * errors.h (Errors::info): New function.
12975 * gold.h (gold_info): New function.
12976 * object.cc (Input_objects::add_object): Print trace output.
12977 * options.cc (options::parse_set): New function.
12978 (General_options::parse_wrap): Deleted.
12979 (General_options::General_options): Deleted initializer.
12980 * options.h (options::String_set): New typedef.
12981 (options::parse_set): New function.
12982 (DEFINE_set): New macro.
12983 (General_options::wrap): Changed to use DEFINE_set. Changed
12984 callers of any_wrap_symbols and is_wrap_symbol.
12985 (General_options::trace, General_options::trace_symbol):
12986 New options.
12987 (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12988 (General_options::wrap_symbols_): Deleted.
12989 * symtab.cc (Symbol_table::add_from_object): Print trace output.
12990
12991 2008-04-17 David S. Miller <davem@davemloft.net>
12992
12993 * options.cc (General_options::parse_V): New function.
12994 * options.h: Add entries for -V and -Qy.
12995
12996 2008-04-17 Ian Lance Taylor <iant@google.com>
12997
12998 * common.cc (Symbol_table::allocate_commons): Remove options
12999 parameter. Change caller.
13000 (Symbol_table::do_allocate_commons): Remove options parameter.
13001 Change caller. Just call do_allocate_commons_list twice.
13002 (Symbol_table::do_allocate_commons_list): New function, broken out
13003 of do_allocate_commons.
13004 * common.h (class Allocate_commons_task): Remove options_ field.
13005 Update constructor.
13006 * symtab.cc (Symbol_table::Symbol_table): Initialize
13007 tls_commons_.
13008 (Symbol_table::add_from_object): Put TLS common symbols on
13009 tls_commons_ list.
13010 (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13011 which are IN_OUTPUT_DATA.
13012 * symtab.h (class Symbol_table): Add tls_commons_ field. Update
13013 allocate_commons and do_allocate_commons declarations. Declare
13014 do_allocate_commons_list.
13015 * gold.cc (queue_middle_tasks): Update creation of
13016 Allocate_commons_task to not pass options.
13017 * testsuite/Makefile.am (INCLUDES): Add -I.. .
13018 (TLS_TEST_C_FLAGS): New variable.
13019 (tls_test_c_pic.o): New target.
13020 (tls_test_shared.so): Link in tls_test_c_pic.o.
13021 (tls_test_c_pic_ie.o): New target.
13022 (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13023 (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13024 (tls_test_c.o): New target.
13025 (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13026 (tls_pic_test_LDADD): Likewise.
13027 (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13028 (tls_shared_gd_to_ie_test_LDADD): Likewise.
13029 (tls_test_c_gnu2.o): New target.
13030 (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13031 tls_test_c_gnu2.o.
13032 (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13033 (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13034 (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13035 * testsuite/tls_test.cc: Include "config.h".
13036 (t_last): Call t11_last.
13037 * testsuite/tls_test.h (t11, t11_last): Declare.
13038 * testsuite/tls_test_c.c: New file.
13039 * testsuite/tls_test_main.cc (thread_routine): Call t11.
13040 * configure.ac: Check for OpenMP support.
13041 * configure, config.in, Makefile.in: Rebuild.
13042 * testsuite/Makefile.in: Rebuild.
13043
13044 2008-04-16 Cary Coutant <ccoutant@google.com>
13045
13046 * i386.cc (Target_i386::define_tls_base_symbol): New function.
13047 (Target_i386::tls_base_symbol_defined_): New field.
13048 (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13049 (Target_i386::Scan::global): Likewise.
13050 * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13051 * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13052 (Target_x86_64::tls_base_symbol_defined_): New field.
13053 (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13054 (Target_x86_64::Scan::global): Likewise.
13055
13056 2008-04-16 Cary Coutant <ccoutant@google.com>
13057
13058 * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13059 (Symbol::needs_plt_entry): Allow weak undefined symbols.
13060 (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13061 building shared libraries.
13062 * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13063 (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13064 (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13065 * testsuite/Makefile.in: Rebuild.
13066 * testsuite/weak_undef.h: New file.
13067 * testsuite/weak_undef_file1.cc: Add extra test cases.
13068 * testsuite/weak_undef_file2.cc: Likewise.
13069 * testsuite/weak_undef_test.cc: Likewise.
13070
13071 2008-04-16 David S. Miller <davem@davemloft.net>
13072
13073 * sparc.cc (Target_sparc::Scan): Change from struct to class.
13074 Add issued_non_pic_error_ field. Declare check_non_pic.
13075 (Target_sparc::Scan::check_non_pic): New function.
13076 (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13077 (Target_sparc::Scan::global): Likewise.
13078
13079 * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13080 * configure: Rebuild.
13081
13082 * options.h (DEFINE_enable): New macro.
13083 (new_dtags): New enable option.
13084 (initfirst, interpose, loadfltr, nodefaultlib,
13085 nodelete, nodlopen, nodump): New -z options.
13086 * layout.cc (Layout:finish_dynamic_section): If new
13087 dtags enabled, emit DT_RUNPATH. Also, emit a
13088 DT_FLAGS_1 containing any specified -z flags.
13089
13090 2008-04-16 Ian Lance Taylor <iant@google.com>
13091
13092 * copy-relocs.cc: New file.
13093 * copy-relocs.h: New file.
13094 * reloc.cc: Remove Copy_relocs code.
13095 * reloc.h: Likewise.
13096 * reloc-types.h (struct Reloc_types) [both versions]: Add
13097 get_reloc_addend_noerror.
13098 * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13099 variants of add_global which take an addend which must be zero.
13100 * i386.cc: Include "copy-relocs.h".
13101 (class Target_i386): Change type of copy_relocs_ to variable,
13102 update initializer.
13103 (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13104 Change all callers.
13105 (Target_i386::do_finalize_sections): Change handling of
13106 copy_relocs_.
13107 * sparc.cc: Include "copy-relocs.h".
13108 (class Target_sparc): Change type of copy_relocs_ to variable,
13109 update initializer.
13110 (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13111 Change all callers.
13112 (Target_sparc::do_finalize_sections): Change handling of
13113 copy_relocs_.
13114 * x86_64.cc: Include "copy-relocs.h".
13115 (class Target_x86_64): Change type of copy_relocs_ to variable,
13116 update initializer.
13117 (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13118 class. Change all callers.
13119 (Target_x86_64::do_finalize_sections): Change handling of
13120 copy_relocs_.
13121 * Makefile.am (CCFILES): Add copy-relocs.cc.
13122 (HFILES): Add copy-relocs.h.
13123
13124 * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13125
13126 * testsuite/script_test_4.sh: Permit leading zeroes.
13127
13128 2008-04-15 Ian Lance Taylor <iant@google.com>
13129
13130 * script-sections.cc (Script_sections::create_segments): Use
13131 header_size_adjustment even when there is enough room for the
13132 headers.
13133 * testsuite/script_test_4.sh: New file.
13134 * testsuite/script_test_4.t: New file.
13135 * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13136 (check_DATA): Add script_test_4.stdout.
13137 (MOSTLYCLEANFILES): Likewise.
13138 (script_test_4): New target.
13139 (script_test_4.stdout): New target.
13140 * testsuite/Makefile.in: Rebuild.
13141
13142 * sparc.cc: Add definitions for Output_data_plt_sparc class
13143 constants.
13144
13145 2008-04-14 David S. Miller <davem@davemloft.net>
13146
13147 * sparc.cc: New file.
13148 * Makefile.am (TARGETSOURCES): Add sparc.cc
13149 (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13150 * configure.tgt: Document targ_extra_size and
13151 targ_extra_big_endian. Add entries for sparc-* and
13152 sparc64-*.
13153 * configure.ac: Handle targ_extra_size and
13154 targ_extra_big_endian.
13155 * Makefile.in: Rebuild.
13156 * configure: Likewise.
13157 * po/POTFILES.in: Likewise.
13158 * po/gold.pot: Likewise.
13159
13160 2008-04-14 Ian Lance Taylor <iant@google.com>
13161
13162 * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13163 (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13164 in the name/type/flags to section mapping. Don't call
13165 allocate_output_section.
13166 (Layout::choose_output_section): Change parameter from adjust_name
13167 to is_input_section. Don't permit input sections after sections
13168 are attached to segments. Don't call allocate_output_section.
13169 (Layout::layout_eh_frame): Call update_flags_for_input_section,
13170 not write_enable_output_section.
13171 (Layout::make_output_section): Don't push to
13172 unattached_section_list_ nor call attach_to_segment. Call
13173 attach_section_to_segment if sections are attached.
13174 (Layout::attach_sections_to_segments): New function.
13175 (Layout::attach_section_to_segment): New function.
13176 (Layout::attach_allocated_section_to_segment): Rename from
13177 attach_to_segment. Remove flags parameter.
13178 (Layout::allocate_output_section): Remove function.
13179 (Layout::write_enable_output_section): Remove function.
13180 * layout.h (class Layout): Update for above changes. Add new
13181 field sections_are_attached_.
13182 * output.h (Output_section::update_flags_for_input_section): New
13183 function.
13184 * output.cc (Output_section::add_input_section): Call
13185 update_flags_for_input_section.
13186 * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13187
13188 2008-04-11 Cary Coutant <ccoutant@google.com>
13189
13190 * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13191 thought unnecessary.
13192 * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13193
13194 2008-04-11 Ian Lance Taylor <iant@google.com>
13195
13196 * output.h (class Output_section_data): Remove inline definition
13197 of set_addralign.
13198 * output.cc (Output_section_data::set_addralign): New function.
13199
13200 2008-04-11 Cary Coutant <ccoutant@google.com>
13201
13202 Add support for TLS descriptors for i386 and x86_64.
13203 * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13204 (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13205 (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13206 GOT_TYPE_TLS_DESC.
13207 (Target_i386::got_mod_index_entry): Remove unnecessary code.
13208 (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13209 R_386_TLS_DESC_CALL relocations. Fix problem with initial-exec
13210 relocations.
13211 (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13212 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13213 Fix problem with initial-exec relocations.
13214 (Target_i386::Relocate::relocate_tls): Likewise.
13215 (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13216 relaxation.
13217 * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13218 support for section-plus-offset dynamic table entries.
13219 * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13220 (Output_data_dynamic::Dynamic_entry): Add support for
13221 section-plus-offset dynamic table entries.
13222 (Output_data_dynamic::Classification): Likewise.
13223 (Output_data_dynamic::classification_): Renamed offset_.
13224 * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13225 (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13226 (Target_x86_64::make_plt_section): New function.
13227 (Target_x86_64::reserve_tlsdesc_entries): New function.
13228 (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13229 (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13230 (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13231 (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13232 (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13233 (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13234 (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13235 add extra PLT entry for TLS descriptors.
13236 (Output_data_plt_x86_64::got_): New field.
13237 (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13238 (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13239 fields.
13240 (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13241 descriptors.
13242 (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13243 (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13244 (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13245 R_386_TLS_DESC_CALL relocations.
13246 (Target_x86_64::Scan::global): Likewise.
13247 (Target_x86_64::do_finalize_sections): Add dynamic table entries
13248 for TLS descriptors.
13249 (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13250 Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13251 (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13252 GD-to-IE relaxation.
13253 * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13254 and TLS_DESCRIPTORS.
13255 * Makefile.in: Rebuild.
13256 * configure: Rebuild.
13257 * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13258 (tls_test_shared2.so): New target.
13259 (tls_shared_gd_to_ie_test_SOURCES): New variable.
13260 (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13261 (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13262 (tls_shared_gd_to_ie_test_LDADD): New variable.
13263 (tls_shared_gnu2_gd_to_ie_test): New target.
13264 (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13265 New targets.
13266 (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13267 (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13268 (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13269 (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13270 (tls_shared_gnu2_test): New target.
13271 (tls_test_gnu2_shared.so): New target.
13272 (tls_shared_gnu2_test_SOURCES): New variable.
13273 (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13274 (tls_shared_gnu2_test_LDFLAGS): New variable.
13275 (tls_shared_gnu2_test_LDADD): New variable.
13276 * testsuite/Makefile.in: Rebuild.
13277 * testsuite/Makefile.
13278
13279 2008-04-11 Ian Lance Taylor <iant@google.com>
13280
13281 * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13282 justsyms.t.
13283 * testsuite/Makefile.in: Rebuild.
13284
13285 * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13286 long.
13287 * testsuite/script_test_2.cc (main): Adjust test.
13288
13289 2008-04-11 David S. Miller <davem@davemloft.net>
13290 Ian Lance Taylor <iant@google.com>
13291
13292 * options.h (General_options): Add entries for '-Y' and
13293 '-relax'.
13294 * options.cc (General_options:finalize): If -Y was used, add those
13295 entries to the library path instead of the default "/lib" and
13296 "/usr/lib".
13297
13298 2008-04-11 David S. Miller <davem@davemloft.net>
13299
13300 * testsuite/justsyms.t: Start at 0x100.
13301 * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13302 * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13303 long.
13304 * testsuite/script_test_2.cc: Adjust string and section length
13305 checks.
13306
13307 2008-04-09 Ian Lance Taylor <iant@google.com>
13308
13309 PR gold/5996
13310 * script-sections.cc (Sections_element::allocate_to_segment): Add
13311 orphan parameter.
13312 (Output_section_definition::allocate_to_segment): Likewise.
13313 (Orphan_output_section::allocate_to_segment): Likewise.
13314 (Script_sections::attach_sections_using_phdrs_clause): Don't
13315 propagate non-PT_LOAD segments to orphan sections.
13316 * testsuite/Makefile.am (script_test_3.stdout): Generate using
13317 readelf rather than objdump.
13318 * testsuite/script_test_3.sh: Adjust accordingly. Test that
13319 .interp section and PT_INTERP segment are the same size.
13320 * testsuite/Makefile.in: Rebuild.
13321
13322 * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13323 aliases for symbols defined in the same object.
13324 * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13325 (weak_alias_test_SOURCES): New variable.
13326 (weak_alias_test_DEPENDENCIES): New variable.
13327 (weak_alias_test_LDFLAGS): New variable.
13328 (weak_alias_test_LDADD): New variable.
13329 (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13330 (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13331 (weak_alias_test_3.o): New target.
13332 (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13333 * testsuite/weak_alias_test_main.cc: New file.
13334 * testsuite/weak_alias_test_1.cc: New file.
13335 * testsuite/weak_alias_test_2.cc: New file.
13336 * testsuite/weak_alias_test_3.cc: New file.
13337
13338 2008-04-08 Ian Lance Taylor <iant@google.com>
13339
13340 * options.h (class General_options): Add --noinhibit-exec option.
13341 * main.cc (main): Check --noinhibit-exec.
13342
13343 * options.h (class General_options): Define --wrap as a special
13344 option. Add wrap_symbols_ field.
13345 (General_options::any_wrap_symbols): New function.
13346 (General_options::is_wrap_symbol): New function.
13347 * options.cc (General_options::parse_wrap): New function.
13348 (General_options::General_options): Initialize wrap_symbols_.
13349 * symtab.cc (Symbol_table::wrap_symbol): New function.
13350 (Symbol_table::add_from_object): Handle --wrap.
13351 * symtab.h (class Symbol_table): Declare wrap_symbol.
13352 * target.h (Target::wrap_char): New function.
13353 (Target::Target_info): Add wrap_char field.
13354 * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13355 * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13356 * testsuite/testfile.cc (Target_test::test_target_info):
13357 Likewise.
13358
13359 * errors.cc (Errors::undefined_symbol): Mention symbol version if
13360 there is one.
13361
13362 * layout.h (class Layout): Add added_eh_frame_data_ field.
13363 * layout.cc (Layout::Layout): Initialize new field.
13364 (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13365 output section until we find a section we merged successfully.
13366 * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13367 that the size be non-zero.
13368
13369 * merge.cc (Object_merge_map::get_output_offset): Remove inline
13370 qualifier.
13371
13372 2008-04-08 Craig Silverstein <csilvers@google.com>
13373
13374 * configure.ac: Export new conditional variable HAVE_ZLIB.
13375 * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13376 on HAVE_ZLIB.
13377 (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13378 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13379
13380 2008-04-07 Ian Lance Taylor <iant@google.com>
13381
13382 * version.cc (version_string): Set to "1.5".
13383
13384 * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13385 Add issued_non_pic_error_ field. Declare check_non_pic.
13386 (Target_x86_64::Scan::check_non_pic): New function.
13387 (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13388 (Target_x86_64::Scan::global): Likewise.
13389
13390 * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13391 addend parameter. Change caller. Handle merge sections.
13392 (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13393 Address to Addend. Don't add in the result of
13394 local_section_offset, pass down the addend and use the returned
13395 value.
13396 * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13397 Update declarations of local_section_offset and symbol_value.
13398 * testsuite/two_file_test_1.cc (t18): New function.
13399 * testsuite/two_file_test_2.cc (f18): New function.
13400 * testsuite/two_file_test_main.cc (main): Call t18.
13401 * testsuite/two_file_test.h (t18, f18): Declare.
13402
13403 * configure.ac: Don't test for objdump, c++filt, or readelf.
13404 * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13405 conditionals.
13406 (TEST_READELF): New variable.
13407 (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13408 (check_PROGRAMS): Add two_file_strip_test.
13409 (two_file_strip_test): New target.
13410 (check_PROGRAMS): Add two_file_same_shared_strip_test.
13411 (two_file_same_shared_strip_test_SOURCES): New variable.
13412 (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13413 (two_file_same_shared_strip_test_LDFLAGS): New variable.
13414 (two_file_same_shared_strip_test_LDADD): New variable.
13415 (two_file_shared_strip.so): New target.
13416 (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13417 (ver_test_5.syms, ver_test_7.syms): Likewise.
13418 (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13419 (strip_test_3.stdout): Use TEST_OBJDUMP.
13420 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13421
13422 2008-04-04 Cary Coutant <ccoutant@google.com>
13423
13424 * symtab.h (Symbol::is_weak_undefined): New function.
13425 (Symbol::is_strong_undefined): New function.
13426 (Symbol::is_absolute): New function.
13427 (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13428 (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13429 absolute symbols.
13430 * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13431 (weak_undef_test): New target.
13432 * testsuite/Makefile.in: Rebuild.
13433 * testsuite/weak_undef_file1.cc: New file.
13434 * testsuite/weak_undef_file2.cc: New file.
13435 * testsuite/weak_undef_test.cc: New file.
13436
13437 2008-04-03 Craig Silverstein <csilvers@google.com>
13438
13439 * compressed_output.h (class Output_compressed_section): Use
13440 unsigned buffer.
13441 * compressed_output.cc (zlib_compress): Use unsigned buffers,
13442 add zlib header.
13443 (zlib_compressed_suffix): Removed.
13444 (Output_compressed_section::set_final_data_size): Use unsigned
13445 buffers.
13446 * testsuite/Makefile.am (flagstest_compress_debug_sections):
13447 Fix linker invocation.
13448 (flagstest_o_specialfile_and_compress_debug_sections):
13449 Likewise.
13450 * testsuite/Makefile.in: Regenerated.
13451
13452 2008-04-02 David S. Miller <davem@davemloft.net>
13453
13454 * dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13455 Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13456
13457 2008-04-02 Craig Silverstein <csilvers@google.com>
13458
13459 * TODO: New file.
13460
13461 2008-04-02 Ian Lance Taylor <iant@google.com>
13462
13463 * fileread.cc (File_read::find_view): Add byteshift and vshifted
13464 parameters. Update for new key type to views_. Change all
13465 callers.
13466 (File_read::read): Adjust for byteshift in returned view.
13467 (File_read::add_view): New function, broken out of
13468 find_and_make_view.
13469 (File_read::make_view): New function, broken out of
13470 find_and_make_view.
13471 (File_read::find_or_make_view): Add offset and aligned
13472 parameters. Rewrite accordingly. Change all callers.
13473 (File_read::get_view): Add offset and aligned parameters. Adjust
13474 for byteshift in return value.
13475 (File_read::get_lasting_view): Likewise.
13476 * fileread.h (class File_read): Update declarations.
13477 (class File_read::View): Add byteshift_ field. Add byteshift to
13478 constructor. Add byteshift method.
13479 * archive.h (Archive::clear_uncached_views): New function.
13480 (Archive::get_view): Add aligned parameter. Change all callers.
13481 * object.h (Object::get_view): Add aligned parameter. Change all
13482 callers.
13483 (Object::get_lasting_view): Likewise.
13484
13485 * fileread.cc (File_read::release): Don't call clear_views if
13486 there are multiple objects.
13487 * fileread.h (File_read::clear_uncached_views): New function.
13488 * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13489 on the archive.
13490
13491 2008-03-31 Cary Coutant <ccoutant@google.com>
13492
13493 Add thin archive support.
13494 * archive.cc (Archive::armagt): New const.
13495 (Archive::setup): Remove task parameter and calls to unlock.
13496 (Archive::unlock_nested_archives): New function.
13497 (Archive::read_header): Add nested_off parameter. Change
13498 all callers.
13499 (Archive::interpret_header): Likewise.
13500 (Archive::include_all_members): Change to handle thin
13501 archives.
13502 (Archive::include_member): Likewise.
13503 * archive.h (Archive::Archive): Add new parameters and
13504 initializers.
13505 (Archive::armagt): New const.
13506 (Archive::setup): Remove task parameter.
13507 (Archive::unlock_nested_archives): New function.
13508 (Archive::read_header): Add nested_off parameter.
13509 (Archive::interpret_header): Likewise.
13510 (Archive::Nested_archive_table): New typedef.
13511 (Archive::is_thin_archive_): New field.
13512 (Archive::nested_archives_): New field.
13513 (Archive::options_): New field.
13514 (Archive::dirpath_): New field.
13515 (Archive::task_): New field.
13516 * readsyms.cc (Read_symbols::do_read_symbols): Add check
13517 for thin archives. Pass additional parameters to
13518 Archive::Archive. Unlock the archive file after calling
13519 Archive::setup.
13520
13521 2008-03-29 Ian Lance Taylor <iant@google.com>
13522
13523 * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13524 version symbol to be local.
13525 * testsuite/ver_test_4.sh: New file.
13526 * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13527 (check_DATA): Add ver_test_4.syms.
13528 (ver_test_4.syms): New target.
13529 * testsuite/Makefile.in: Rebuild.
13530
13531 * output.cc
13532 (Output_section::Input_section_sort_entry::has_priority): New
13533 function.
13534 (Output_section::Input_section_sort_entry::match_file_name): New
13535 function.
13536 (Output_section::Input_section_sort_entry::match_section_name):
13537 Remove.
13538 (Output_section::Input_section_sort_entry::match_section_name_prefix):
13539 Remove.
13540 (Output_section::Input_section_sort_entry::match_section_file):
13541 Remove.
13542 (Output_section::Input_section_sort_compare::operator()): Rewrite
13543 using new Input_section_sort_entry functions. Sort crtbegin and
13544 crtend first. Sort sections with no priority before sections with
13545 a priority.
13546 * testsuite/initpri1.c (d3): Check j != 4.
13547 (cd5): New constructor/destructor function.
13548 (main): Check j != 2.
13549
13550 * symtab.cc (Symbol_table::add_from_object): If we don't use the
13551 new symbol when resolving, don't call set_is_default.
13552 * testsuite/ver_test_7.cc: New file.
13553 * testsuite/ver_test_7.sh: New file.
13554 * testsuite/Makefile.am (ver_test_7.so): New target.
13555 (ver_test_7.o): New target.
13556 (check_SCRIPTS): Add ver_test_7.sh.
13557 (check_DATA): Add ver_test_7.syms.
13558 (ver_test_7.syms): New target.
13559
13560 2008-03-28 Ian Lance Taylor <iant@google.com>
13561
13562 * layout.cc (Layout::layout): If we see an input section with a
13563 name that needs sorting, set the must_sort flag for the output
13564 section.
13565 (Layout::make_output_section): If the name of the output section
13566 indicates that it might require sorting, set the may_sort flag.
13567 * output.h (Output_section::may_sort_attached_input_sections): New
13568 function.
13569 (Output_section::set_may_sort_attached_input_sections): New
13570 function.
13571 (Output_section::must_sort_attached_input_sections): New
13572 function.
13573 (Output_section::set_must_sort_attached_input_sections): New
13574 function.
13575 (class Output_section): Declare Input_section_sort_entry. Define
13576 Input_section_sort_compare. Declare
13577 sort_attached_input_sections. Add new fields:
13578 may_sort_attached_input_sections_,
13579 must_sort_attached_input_sections_,
13580 attached_input_sections_are_sorted_.
13581 * output.cc (Output_section::Output_section): Initialize new
13582 fields.
13583 (Output_section::add_input_section): Add an entry to
13584 input_sections_ if may_sort or must_sort are true.
13585 (Output_section::set_final_data_size): Call
13586 sort_attached_input_sections if necessary.
13587 (Output_section::Input_section_sort_entry): Define new class.
13588 (Output_section::Input_section_sort_compare::operator()): New
13589 function.
13590 (Output_section::sort_attached_input_sections): New function.
13591 * configure.ac: Check whether the compiler supports constructor
13592 priorities. Define a CONSTRUCTOR_PRIORITY automake conditional.
13593 * testsuite/initpri1.c: New file.
13594 * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13595 CONSTRUCTOR_PRIORITY.
13596 (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13597 (initpri1_LDFLAGS): New variable.
13598 * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13599
13600 2008-03-27 Ian Lance Taylor <iant@google.com>
13601
13602 * common.cc (Sort_commons::operator): Correct sorting algorithm.
13603 * testsuite/common_test_1.c: New file.
13604 * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13605 (common_test_1_SOURCES): New variable.
13606 (common_test_1_DEPENDENCIES): New variable.
13607 (common_test_1_LDFLAGS): New variable.
13608
13609 * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13610 and commons_ correctly when NAME/VERSION does not override
13611 NAME/NULL.
13612 * testsuite/ver_test_6.c: New file.
13613 * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13614 (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13615 (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13616
13617 2008-03-26 Ian Lance Taylor <iant@google.com>
13618
13619 * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13620 of an undefined symbol from a version script.
13621 * testsuite/Makefile.am (ver_test_5.so): New target.
13622 (ver_test_5.o): New target.
13623 (check_SCRIPTS): Add ver_test_5.sh.
13624 (check_DATA): Add ver_test_5.syms.
13625 (ver_test_5.syms): New target.
13626 * testsuite/ver_test_5.cc: New file.
13627 * testsuite/ver_test_5.script: New file.
13628 * testsuite/ver_test_5.sh: New file.
13629 * Makefile.in, testsuite/Makefile.in: Rebuild.
13630
13631 PR gold/5986
13632 Fix problems building gold with gcc 4.3.0.
13633 * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13634 (gold_error_at_location, gold_warning_at_location): Use it.
13635 * configure.ac: Check whether we can compile and use a template
13636 function with a printf attribute.
13637 * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13638 when jumping over bytes.
13639 * object.cc: Instantiate Object::read_section_data.
13640 * debug.h: Include <cstring>
13641 * dwarf_reader.cc: Include <algorithm>
13642 * main.cc: Include <cstring>.
13643 * options.cc: Include <cstring>.
13644 * output.cc: Include <cstring>.
13645 * script.cc: Include <cstring>.
13646 * script.h: Include <string>.
13647 * symtab.cc: Include <cstring> and <algorithm>.
13648 * target-select.cc: Include <cstring>.
13649 * version.cc: Include <string>.
13650 * testsuite/testmain.cc: Include <cstdlib>.
13651 * configure, config.in: Rebuild.
13652
13653 2008-03-25 Ian Lance Taylor <iant@google.com>
13654
13655 * options.cc: Include "../bfd/bfdver.h".
13656 (options::help): Print bug reporting address.
13657
13658 * version.cc (print_version): Adjust output for current value of
13659 BFD_VERSION_STRING.
13660
13661 * NEWS: New file.
13662
13663 * options.cc (options::help): Print list of supported targets.
13664 * target-select.h: Include <vector>.
13665 (class Target_selector): Make machine_, size_, and is_big_endian_
13666 fields const. Add bfd_name_ and instantiated_target_ fields.
13667 (Target_selector::Target_selector): Add bfd_name parameter.
13668 (Target_selector::recognize): Make non-virtual, call
13669 do_recognize.
13670 (Target_selector::recognize_by_name): Make non-virtual, call
13671 do_recognize_by_name.
13672 (Target_selector::supported_names): New function.
13673 (Target_selector::bfd_name): New function.
13674 (Target_selector::do_instantiate_target): New pure virtual
13675 function.
13676 (Target_selector::do_recognize): New virtual function.
13677 (Target_selector::do_recognize_by_name): New virtual function.
13678 (Target_selector::instantiate_target): New private function.
13679 (supported_target_names): Declare.
13680 * target-select.cc (Target_selector::Target_selector): Update for
13681 new parameter and fields.
13682 (select_target_by_name): Check that the name matches before
13683 calling recognize_by_name.
13684 (supported_target_names): New function.
13685 * i386.cc (class Target_selector_i386): Update Target_selector
13686 constructor call. Remove recognize and recognize_by_name. Add
13687 do_instantiate_target.
13688 * x86_64.cc (class Target_selector_x86_64): Likewise.
13689 * testsuite/testfile.cc (class Target_selector_test): Update for
13690 changes to Target_selector.
13691
13692 * README: Rewrite, with some notes on unsupported features.
13693
13694 2008-03-24 Cary Coutant <ccoutant@google.com>
13695
13696 * i386.cc (Target_i386::Got_type): New enum declaration.
13697 (Target_i386::Scan::local): Updated callers of Output_data_got
13698 member functions.
13699 (Target_i386::Scan::global): Likewise.
13700 (Target_i386::Relocate::relocate): Likewise.
13701 (Target_i386::Relocate::relocate_tls): Likewise.
13702 * object.h (Got_offset_list): New class.
13703 (Sized_relobj::local_has_got_offset): Added got_type parameter.
13704 (Sized_relobj::local_got_offset): Likewise.
13705 (Sized_relobj::set_local_got_offset): Likewise.
13706 (Sized_relobj::local_has_tls_got_offset): Removed.
13707 (Sized_relobj::local_tls_got_offset): Removed.
13708 (Sized_relobj::set_local_tls_got_offset): Removed.
13709 (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13710 * output.cc (Output_data_got::add_global): Added got_type parameter.
13711 (Output_data_got::add_global_with_rel): Likewise.
13712 (Output_data_got::add_global_with_rela): Likewise.
13713 (Output_data_got::add_global_pair_with_rel): New function.
13714 (Output_data_got::add_global_pair_with_rela): New function.
13715 (Output_data_got::add_local): Added got_type parameter.
13716 (Output_data_got::add_local_with_rel): Likewise.
13717 (Output_data_got::add_local_with_rela): Likewise.
13718 (Output_data_got::add_local_pair_with_rel): New function.
13719 (Output_data_got::add_local_pair_with_rela): New function.
13720 (Output_data_got::add_global_tls): Removed.
13721 (Output_data_got::add_global_tls_with_rel): Removed.
13722 (Output_data_got::add_global_tls_with_rela): Removed.
13723 (Output_data_got::add_local_tls): Removed.
13724 (Output_data_got::add_local_tls_with_rel): Removed.
13725 (Output_data_got::add_local_tls_with_rela): Removed.
13726 * output.h (Output_data_got::add_global): Added got_type parameter.
13727 (Output_data_got::add_global_with_rel): Likewise.
13728 (Output_data_got::add_global_with_rela): Likewise.
13729 (Output_data_got::add_global_pair_with_rel): New function.
13730 (Output_data_got::add_global_pair_with_rela): New function.
13731 (Output_data_got::add_local): Added got_type parameter.
13732 (Output_data_got::add_local_with_rel): Likewise.
13733 (Output_data_got::add_local_with_rela): Likewise.
13734 (Output_data_got::add_local_pair_with_rel): New function.
13735 (Output_data_got::add_local_pair_with_rela): New function.
13736 (Output_data_got::add_global_tls): Removed.
13737 (Output_data_got::add_global_tls_with_rel): Removed.
13738 (Output_data_got::add_global_tls_with_rela): Removed.
13739 (Output_data_got::add_local_tls): Removed.
13740 (Output_data_got::add_local_tls_with_rel): Removed.
13741 (Output_data_got::add_local_tls_with_rela): Removed.
13742 * resolve.cc (Symbol::override_base_with_special): Removed
13743 reference to has_got_offset_ field.
13744 * symtab.cc (Symbol::init_fields): Replaced initialization
13745 of got_offset_ with got_offsets_. Removed initialization
13746 of has_got_offset_
13747 * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13748 (Symbol::got_offset): Likewise.
13749 (Symbol::set_got_offset): Likewise.
13750 (Symbol::has_tls_got_offset): Removed.
13751 (Symbol::tls_got_offset): Removed.
13752 (Symbol::set_tls_got_offset): Removed.
13753 (Symbol::got_offset_): Removed.
13754 (Symbol::tls_mod_got_offset_): Removed.
13755 (Symbol::tls_pair_got_offset_): Removed.
13756 (Symbol::got_offsets_): New field.
13757 (Symbol::has_got_offset): Removed.
13758 (Symbol::has_tls_mod_got_offset): Removed.
13759 (Symbol::has_tls_pair_got_offset): Removed.
13760 * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13761 (Target_x86_64::Scan::local): Updated callers of Output_data_got
13762 member functions.
13763 (Target_x86_64::Scan::global): Likewise.
13764 (Target_x86_64::Relocate::relocate): Likewise.
13765 (Target_x86_64::Relocate::relocate_tls): Likewise.
13766
13767 2008-03-25 Ben Elliston <bje@au.ibm.com>
13768
13769 * yyscript.y: Fix spelling error in comment.
13770
13771 2008-03-24 Ian Lance Taylor <iant@google.com>
13772
13773 * options.h (class General_options): Define build_id option.
13774 * layout.h (class Layout): Declare write_build_id, create_note,
13775 create_build_id. Add build_id_note_ member.
13776 * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13777 "libiberty.h", "md5.h", "sha1.h".
13778 (Layout::Layout): Initialize eh_frame_data_,
13779 eh_frame_hdr_section_, and build_id_note_.
13780 (Layout::finalize): Call create_build_id.
13781 (Layout::create_note): New function, broken out of
13782 Layout::create_gold_note.
13783 (Layout::create_gold_note): Call create_note.
13784 (Layout::create_build_id): New function.
13785 (Layout::write_build_id): New function.
13786 (Close_task_runner::run): Call write_build_id.
13787
13788 * x86_64.cc: Correct license to GPLv3.
13789
13790 2008-03-23 Ian Lance Taylor <iant@google.com>
13791
13792 * options.cc: Include "demangle.h".
13793 (parse_optional_string): New function.
13794 (parse_long_option): Handle takes_optional_argument.
13795 (parse_short_option): Update dash_z initializer. Handle
13796 takes_optional_argument.
13797 (General_options::General_options): Initialize do_demangle_.
13798 (General_options::finalize): Set do_demangle_. Handle demangling
13799 style.
13800 * options.h (parse_optional_string): Declare.
13801 (struct One_option): Add optional_arg field. Update constructor.
13802 Update call constructor calls. Add takes_optional_argument
13803 function.
13804 (DEFINE_var): Add optional_arg__ parameter. Change all callers.
13805 (DEFINE_optional_string): Define.
13806 (General_options::demangle): Change from DEFINE_bool to
13807 DEFINE_optional_string.
13808 (General_options::no_demangle): New function.
13809 (General_options::do_demangle): New function.
13810 (General_options::set_do_demangle): New function.
13811 (General_options::execstack_status_): Move definition to end of
13812 class definition.
13813 (General_options::static_): Likewise.
13814 (General_options::do_demangle_): New field.
13815 * object.cc (big_endian>::get_symbol_location_info): Call
13816 Options::do_demangle, not Options::demangle.
13817 * symtab.cc (demangle): Likewise.
13818
13819 2008-03-22 Ian Lance Taylor <iant@google.com>
13820
13821 * gold.h: Include <cstddef> and <sys/types.h>
13822 * options.h: Include <cstring>.
13823
13824 2008-03-21 Ian Lance Taylor <iant@google.com>
13825
13826 * Added source code to GNU binutils.